/* 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, ApiReaction } from "../models/index.js";
import {
  ApiErrorFromJSON,
  ApiErrorToJSON,
  ApiReactionFromJSON,
  ApiReactionToJSON,
} from "../models/index.js";

export interface V1ReactionsNumberDeleteRequest {
  data: ApiReaction;
}

export interface V1ReactionsNumberPostRequest {
  data: ApiReaction;
}

/**
 *
 */
export class ReactionsApi extends runtime.BaseAPI {
  /**
   * Remove a reaction
   * Remove a reaction.
   */
  async v1ReactionsNumberDeleteRaw(
    requestParameters: V1ReactionsNumberDeleteRequest,
    initOverrides?: RequestInit | runtime.InitOverrideFunction,
  ): Promise<runtime.ApiResponse<string>> {
    if (requestParameters["data"] == null) {
      throw new runtime.RequiredError(
        "data",
        'Required parameter "data" was null or undefined when calling v1ReactionsNumberDelete().',
      );
    }

    const queryParameters: any = {};

    const headerParameters: runtime.HTTPHeaders = {};

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

    const response = await this.request(
      {
        path: `/v1/reactions/{number}`,
        method: "DELETE",
        headers: headerParameters,
        query: queryParameters,
        body: ApiReactionToJSON(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;
    }
  }

  /**
   * Remove a reaction
   * Remove a reaction.
   */
  async v1ReactionsNumberDelete(
    requestParameters: V1ReactionsNumberDeleteRequest,
    initOverrides?: RequestInit | runtime.InitOverrideFunction,
  ): Promise<string> {
    const response = await this.v1ReactionsNumberDeleteRaw(
      requestParameters,
      initOverrides,
    );
    return await response.value();
  }

  /**
   * React to a message
   * Send a reaction.
   */
  async v1ReactionsNumberPostRaw(
    requestParameters: V1ReactionsNumberPostRequest,
    initOverrides?: RequestInit | runtime.InitOverrideFunction,
  ): Promise<runtime.ApiResponse<string>> {
    if (requestParameters["data"] == null) {
      throw new runtime.RequiredError(
        "data",
        'Required parameter "data" was null or undefined when calling v1ReactionsNumberPost().',
      );
    }

    const queryParameters: any = {};

    const headerParameters: runtime.HTTPHeaders = {};

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

    const response = await this.request(
      {
        path: `/v1/reactions/{number}`,
        method: "POST",
        headers: headerParameters,
        query: queryParameters,
        body: ApiReactionToJSON(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;
    }
  }

  /**
   * React to a message
   * Send a reaction.
   */
  async v1ReactionsNumberPost(
    requestParameters: V1ReactionsNumberPostRequest,
    initOverrides?: RequestInit | runtime.InitOverrideFunction,
  ): Promise<string> {
    const response = await this.v1ReactionsNumberPostRaw(
      requestParameters,
      initOverrides,
    );
    return await response.value();
  }
}
