'use strict';

var client = require('../client');

class Avatars {
  constructor(client) {
    this.client = client;
  }
  getBrowser(paramsOrFirst, ...rest) {
    let params;
    if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "code" in paramsOrFirst) {
      params = paramsOrFirst || {};
    } else {
      params = {
        code: paramsOrFirst,
        width: rest[0],
        height: rest[1],
        quality: rest[2]
      };
    }
    const code = params.code;
    const width = params.width;
    const height = params.height;
    const quality = params.quality;
    if (typeof code === "undefined") {
      throw new client.AppwriteException('Missing required parameter: "code"');
    }
    const apiPath = "/avatars/browsers/{code}".replace("{code}", code);
    const payload = {};
    if (typeof width !== "undefined") {
      payload["width"] = width;
    }
    if (typeof height !== "undefined") {
      payload["height"] = height;
    }
    if (typeof quality !== "undefined") {
      payload["quality"] = quality;
    }
    const uri = new URL(this.client.config.endpoint + apiPath);
    const apiHeaders = {};
    return this.client.call(
      "get",
      uri,
      apiHeaders,
      payload,
      "arrayBuffer"
    );
  }
  getCreditCard(paramsOrFirst, ...rest) {
    let params;
    if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "code" in paramsOrFirst) {
      params = paramsOrFirst || {};
    } else {
      params = {
        code: paramsOrFirst,
        width: rest[0],
        height: rest[1],
        quality: rest[2]
      };
    }
    const code = params.code;
    const width = params.width;
    const height = params.height;
    const quality = params.quality;
    if (typeof code === "undefined") {
      throw new client.AppwriteException('Missing required parameter: "code"');
    }
    const apiPath = "/avatars/credit-cards/{code}".replace("{code}", code);
    const payload = {};
    if (typeof width !== "undefined") {
      payload["width"] = width;
    }
    if (typeof height !== "undefined") {
      payload["height"] = height;
    }
    if (typeof quality !== "undefined") {
      payload["quality"] = quality;
    }
    const uri = new URL(this.client.config.endpoint + apiPath);
    const apiHeaders = {};
    return this.client.call(
      "get",
      uri,
      apiHeaders,
      payload,
      "arrayBuffer"
    );
  }
  getFavicon(paramsOrFirst) {
    let params;
    if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
      params = paramsOrFirst || {};
    } else {
      params = {
        url: paramsOrFirst
      };
    }
    const url = params.url;
    if (typeof url === "undefined") {
      throw new client.AppwriteException('Missing required parameter: "url"');
    }
    const apiPath = "/avatars/favicon";
    const payload = {};
    if (typeof url !== "undefined") {
      payload["url"] = url;
    }
    const uri = new URL(this.client.config.endpoint + apiPath);
    const apiHeaders = {};
    return this.client.call(
      "get",
      uri,
      apiHeaders,
      payload,
      "arrayBuffer"
    );
  }
  getFlag(paramsOrFirst, ...rest) {
    let params;
    if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst) && "code" in paramsOrFirst) {
      params = paramsOrFirst || {};
    } else {
      params = {
        code: paramsOrFirst,
        width: rest[0],
        height: rest[1],
        quality: rest[2]
      };
    }
    const code = params.code;
    const width = params.width;
    const height = params.height;
    const quality = params.quality;
    if (typeof code === "undefined") {
      throw new client.AppwriteException('Missing required parameter: "code"');
    }
    const apiPath = "/avatars/flags/{code}".replace("{code}", code);
    const payload = {};
    if (typeof width !== "undefined") {
      payload["width"] = width;
    }
    if (typeof height !== "undefined") {
      payload["height"] = height;
    }
    if (typeof quality !== "undefined") {
      payload["quality"] = quality;
    }
    const uri = new URL(this.client.config.endpoint + apiPath);
    const apiHeaders = {};
    return this.client.call(
      "get",
      uri,
      apiHeaders,
      payload,
      "arrayBuffer"
    );
  }
  getImage(paramsOrFirst, ...rest) {
    let params;
    if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
      params = paramsOrFirst || {};
    } else {
      params = {
        url: paramsOrFirst,
        width: rest[0],
        height: rest[1]
      };
    }
    const url = params.url;
    const width = params.width;
    const height = params.height;
    if (typeof url === "undefined") {
      throw new client.AppwriteException('Missing required parameter: "url"');
    }
    const apiPath = "/avatars/image";
    const payload = {};
    if (typeof url !== "undefined") {
      payload["url"] = url;
    }
    if (typeof width !== "undefined") {
      payload["width"] = width;
    }
    if (typeof height !== "undefined") {
      payload["height"] = height;
    }
    const uri = new URL(this.client.config.endpoint + apiPath);
    const apiHeaders = {};
    return this.client.call(
      "get",
      uri,
      apiHeaders,
      payload,
      "arrayBuffer"
    );
  }
  getInitials(paramsOrFirst, ...rest) {
    let params;
    if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
      params = paramsOrFirst || {};
    } else {
      params = {
        name: paramsOrFirst,
        width: rest[0],
        height: rest[1],
        background: rest[2]
      };
    }
    const name = params.name;
    const width = params.width;
    const height = params.height;
    const background = params.background;
    const apiPath = "/avatars/initials";
    const payload = {};
    if (typeof name !== "undefined") {
      payload["name"] = name;
    }
    if (typeof width !== "undefined") {
      payload["width"] = width;
    }
    if (typeof height !== "undefined") {
      payload["height"] = height;
    }
    if (typeof background !== "undefined") {
      payload["background"] = background;
    }
    const uri = new URL(this.client.config.endpoint + apiPath);
    const apiHeaders = {};
    return this.client.call(
      "get",
      uri,
      apiHeaders,
      payload,
      "arrayBuffer"
    );
  }
  getQR(paramsOrFirst, ...rest) {
    let params;
    if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
      params = paramsOrFirst || {};
    } else {
      params = {
        text: paramsOrFirst,
        size: rest[0],
        margin: rest[1],
        download: rest[2]
      };
    }
    const text = params.text;
    const size = params.size;
    const margin = params.margin;
    const download = params.download;
    if (typeof text === "undefined") {
      throw new client.AppwriteException('Missing required parameter: "text"');
    }
    const apiPath = "/avatars/qr";
    const payload = {};
    if (typeof text !== "undefined") {
      payload["text"] = text;
    }
    if (typeof size !== "undefined") {
      payload["size"] = size;
    }
    if (typeof margin !== "undefined") {
      payload["margin"] = margin;
    }
    if (typeof download !== "undefined") {
      payload["download"] = download;
    }
    const uri = new URL(this.client.config.endpoint + apiPath);
    const apiHeaders = {};
    return this.client.call(
      "get",
      uri,
      apiHeaders,
      payload,
      "arrayBuffer"
    );
  }
  getScreenshot(paramsOrFirst, ...rest) {
    let params;
    if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
      params = paramsOrFirst || {};
    } else {
      params = {
        url: paramsOrFirst,
        headers: rest[0],
        viewportWidth: rest[1],
        viewportHeight: rest[2],
        scale: rest[3],
        theme: rest[4],
        userAgent: rest[5],
        fullpage: rest[6],
        locale: rest[7],
        timezone: rest[8],
        latitude: rest[9],
        longitude: rest[10],
        accuracy: rest[11],
        touch: rest[12],
        permissions: rest[13],
        sleep: rest[14],
        width: rest[15],
        height: rest[16],
        quality: rest[17],
        output: rest[18]
      };
    }
    const url = params.url;
    const headers = params.headers;
    const viewportWidth = params.viewportWidth;
    const viewportHeight = params.viewportHeight;
    const scale = params.scale;
    const theme = params.theme;
    const userAgent = params.userAgent;
    const fullpage = params.fullpage;
    const locale = params.locale;
    const timezone = params.timezone;
    const latitude = params.latitude;
    const longitude = params.longitude;
    const accuracy = params.accuracy;
    const touch = params.touch;
    const permissions = params.permissions;
    const sleep = params.sleep;
    const width = params.width;
    const height = params.height;
    const quality = params.quality;
    const output = params.output;
    if (typeof url === "undefined") {
      throw new client.AppwriteException('Missing required parameter: "url"');
    }
    const apiPath = "/avatars/screenshots";
    const payload = {};
    if (typeof url !== "undefined") {
      payload["url"] = url;
    }
    if (typeof headers !== "undefined") {
      payload["headers"] = headers;
    }
    if (typeof viewportWidth !== "undefined") {
      payload["viewportWidth"] = viewportWidth;
    }
    if (typeof viewportHeight !== "undefined") {
      payload["viewportHeight"] = viewportHeight;
    }
    if (typeof scale !== "undefined") {
      payload["scale"] = scale;
    }
    if (typeof theme !== "undefined") {
      payload["theme"] = theme;
    }
    if (typeof userAgent !== "undefined") {
      payload["userAgent"] = userAgent;
    }
    if (typeof fullpage !== "undefined") {
      payload["fullpage"] = fullpage;
    }
    if (typeof locale !== "undefined") {
      payload["locale"] = locale;
    }
    if (typeof timezone !== "undefined") {
      payload["timezone"] = timezone;
    }
    if (typeof latitude !== "undefined") {
      payload["latitude"] = latitude;
    }
    if (typeof longitude !== "undefined") {
      payload["longitude"] = longitude;
    }
    if (typeof accuracy !== "undefined") {
      payload["accuracy"] = accuracy;
    }
    if (typeof touch !== "undefined") {
      payload["touch"] = touch;
    }
    if (typeof permissions !== "undefined") {
      payload["permissions"] = permissions;
    }
    if (typeof sleep !== "undefined") {
      payload["sleep"] = sleep;
    }
    if (typeof width !== "undefined") {
      payload["width"] = width;
    }
    if (typeof height !== "undefined") {
      payload["height"] = height;
    }
    if (typeof quality !== "undefined") {
      payload["quality"] = quality;
    }
    if (typeof output !== "undefined") {
      payload["output"] = output;
    }
    const uri = new URL(this.client.config.endpoint + apiPath);
    const apiHeaders = {};
    return this.client.call(
      "get",
      uri,
      apiHeaders,
      payload,
      "arrayBuffer"
    );
  }
}

exports.Avatars = Avatars;
//# sourceMappingURL=out.js.map
//# sourceMappingURL=avatars.js.map