/* tslint:disable */
/* eslint-disable */
/**
 * Signal Cli REST API
 * This is the Signal Cli REST API documentation.
 *
 * The version of the OpenAPI document: 1.0
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

import * as runtime from "../runtime.js";
import type { ApiError, ApiUpdateProfileRequest } from "../models/index.js";
import {
  ApiErrorFromJSON,
  ApiErrorToJSON,
  ApiUpdateProfileRequestFromJSON,
  ApiUpdateProfileRequestToJSON,
} from "../models/index.js";

export interface V1ProfilesNumberPutRequest {
  number: string;
  data: ApiUpdateProfileRequest;
}

/**
 *
 */
export class ProfilesApi extends runtime.BaseAPI {
  /**
   * Set your name and optional an avatar.
   * Update Profile.
   */
  async v1ProfilesNumberPutRaw(
    requestParameters: V1ProfilesNumberPutRequest,
    initOverrides?: RequestInit | runtime.InitOverrideFunction,
  ): Promise<runtime.ApiResponse<string>> {
    if (requestParameters["number"] == null) {
      throw new runtime.RequiredError(
        "number",
        'Required parameter "number" was null or undefined when calling v1ProfilesNumberPut().',
      );
    }

    if (requestParameters["data"] == null) {
      throw new runtime.RequiredError(
        "data",
        'Required parameter "data" was null or undefined when calling v1ProfilesNumberPut().',
      );
    }

    const queryParameters: any = {};

    const headerParameters: runtime.HTTPHeaders = {};

    headerParameters["Content-Type"] = "application/json";

    const response = await this.request(
      {
        path: `/v1/profiles/{number}`.replace(
          `{${"number"}}`,
          encodeURIComponent(String(requestParameters["number"])),
        ),
        method: "PUT",
        headers: headerParameters,
        query: queryParameters,
        body: ApiUpdateProfileRequestToJSON(requestParameters["data"]),
      },
      initOverrides,
    );

    if (this.isJsonMime(response.headers.get("content-type"))) {
      return new runtime.JSONApiResponse<string>(response);
    } else {
      return new runtime.TextApiResponse(response) as any;
    }
  }

  /**
   * Set your name and optional an avatar.
   * Update Profile.
   */
  async v1ProfilesNumberPut(
    requestParameters: V1ProfilesNumberPutRequest,
    initOverrides?: RequestInit | runtime.InitOverrideFunction,
  ): Promise<string> {
    const response = await this.v1ProfilesNumberPutRaw(
      requestParameters,
      initOverrides,
    );
    return await response.value();
  }
}
