Method: Appwrite::Avatars#get_qr

Defined in:
lib/appwrite/services/avatars.rb

#get_qr(text:, size: nil, margin: nil, download: nil) ⇒ Object

Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image.

Parameters:

  • text (String)

    Plain text to be converted to QR code image.

  • size (Integer) (defaults to: nil)

    QR code size. Pass an integer between 1 to 1000. Defaults to 400.

  • margin (Integer) (defaults to: nil)

    Margin from edge. Pass an integer between 0 to 10. Defaults to 1.

  • []

    download Return resulting image with ‘Content-Disposition: attachment ’ headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0.

Returns:



266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/appwrite/services/avatars.rb', line 266

def get_qr(text:, size: nil, margin: nil, download: nil)
    api_path = '/avatars/qr'

    if text.nil?
      raise Appwrite::Exception.new('Missing required parameter: "text"')
    end

    api_params = {
        text: text,
        size: size,
        margin: margin,
        download: download,
    }
    
    api_headers = {
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
    )
end