/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */

import { webhooksCreateWebhook } from "../funcs/webhooksCreateWebhook.js";
import { webhooksDeleteWebhook } from "../funcs/webhooksDeleteWebhook.js";
import { webhooksGetWebhook } from "../funcs/webhooksGetWebhook.js";
import { webhooksGetWebhooks } from "../funcs/webhooksGetWebhooks.js";
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
import {
  CreateWebhookRequest,
  CreateWebhookResponseBody,
} from "../models/createwebhookop.js";
import { DeleteWebhookRequest } from "../models/deletewebhookop.js";
import {
  GetWebhookRequest,
  GetWebhookResponseBody,
} from "../models/getwebhookop.js";
import {
  GetWebhooksRequest,
  GetWebhooksResponseBody,
} from "../models/getwebhooksop.js";
import { unwrapAsync } from "../types/fp.js";

export class Webhooks extends ClientSDK {
  /**
   * Creates a webhook
   *
   * @remarks
   * Creates a webhook
   */
  async createWebhook(
    request: CreateWebhookRequest,
    options?: RequestOptions,
  ): Promise<CreateWebhookResponseBody> {
    return unwrapAsync(webhooksCreateWebhook(
      this,
      request,
      options,
    ));
  }

  /**
   * Get a list of webhooks
   *
   * @remarks
   * Get a list of webhooks
   */
  async getWebhooks(
    request: GetWebhooksRequest,
    options?: RequestOptions,
  ): Promise<GetWebhooksResponseBody> {
    return unwrapAsync(webhooksGetWebhooks(
      this,
      request,
      options,
    ));
  }

  /**
   * Get a webhook
   *
   * @remarks
   * Get a webhook
   */
  async getWebhook(
    request: GetWebhookRequest,
    options?: RequestOptions,
  ): Promise<GetWebhookResponseBody> {
    return unwrapAsync(webhooksGetWebhook(
      this,
      request,
      options,
    ));
  }

  /**
   * Deletes a webhook
   *
   * @remarks
   * Deletes a webhook
   */
  async deleteWebhook(
    request: DeleteWebhookRequest,
    options?: RequestOptions,
  ): Promise<void> {
    return unwrapAsync(webhooksDeleteWebhook(
      this,
      request,
      options,
    ));
  }
}
