Method: Appwrite::Avatars#get_browser

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

#get_browser(code:, width: nil, height: nil, quality: nil) ⇒ Object

You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings.

When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px.

Parameters:

  • code (Browser)

    Browser Code.

  • width (Integer) (defaults to: nil)

    Image width. Pass an integer between 0 to 2000. Defaults to 100.

  • height (Integer) (defaults to: nil)

    Image height. Pass an integer between 0 to 2000. Defaults to 100.

  • quality (Integer) (defaults to: nil)

    Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.

Returns:



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/appwrite/services/avatars.rb', line 27

def get_browser(code:, width: nil, height: nil, quality: nil)
    api_path = '/avatars/browsers/{code}'
        .gsub('{code}', code)

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

    api_params = {
        width: width,
        height: height,
        quality: quality,
    }
    
    api_headers = {
    }

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