getBrowser method

Future<Response> getBrowser({
  1. required String code,
  2. int? width,
  3. int? height,
  4. int? quality,
})

Get Browser Icon

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 /account/sessions endpoint. Use width, height and quality arguments to change the output settings.

Implementation

Future<req.Response> getBrowser(
    {required String code, int? width, int? height, int? quality}) {
  final String path =
      '/avatars/browsers/{code}'.replaceAll(RegExp('{code}'), code);

  final Map<String, dynamic> params = {
    'width': width,
    'height': height,
    'quality': quality,
    'project': client.config['project'],
  };

  params.keys.forEach((key) {
    if (params[key] is int || params[key] is double) {
      params[key] = params[key].toString();
    }
  });

  return client.call(HttpMethod.get,
      path: path, params: params, responseType: dio.ResponseType.bytes);
}