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

import { generalGetIdentity } from "../funcs/generalGetIdentity.js";
import { generalGetServerInfo } from "../funcs/generalGetServerInfo.js";
import { generalGetSourceConnectionInformation } from "../funcs/generalGetSourceConnectionInformation.js";
import { generalGetTransientToken } from "../funcs/generalGetTransientToken.js";
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
import * as operations from "./models/operations/index.js";
import { unwrapAsync } from "./types/fp.js";

export class General extends ClientSDK {
  /**
   * Get PMS info
   *
   * @remarks
   * Information about this PMS setup and configuration
   */
  async getServerInfo(
    request: operations.GetServerInfoRequest,
    options?: RequestOptions,
  ): Promise<operations.GetServerInfoResponse> {
    return unwrapAsync(generalGetServerInfo(
      this,
      request,
      options,
    ));
  }

  /**
   * Get PMS identity
   *
   * @remarks
   * Get details about this PMS's identity
   */
  async getIdentity(
    options?: RequestOptions,
  ): Promise<operations.GetIdentityResponse> {
    return unwrapAsync(generalGetIdentity(
      this,
      options,
    ));
  }

  /**
   * Get Source Connection Information
   *
   * @remarks
   * If a caller requires connection details and a transient token for a source that is known to the server, for example a cloud media provider or shared PMS, then this endpoint can be called. This endpoint is only accessible with either an admin token or a valid transient token generated from an admin token.
   */
  async getSourceConnectionInformation(
    request: operations.GetSourceConnectionInformationRequest,
    options?: RequestOptions,
  ): Promise<operations.GetSourceConnectionInformationResponse> {
    return unwrapAsync(generalGetSourceConnectionInformation(
      this,
      request,
      options,
    ));
  }

  /**
   * Get Transient Tokens
   *
   * @remarks
   * This endpoint provides the caller with a temporary token with the same access level as the caller's token. These tokens are valid for up to 48 hours and are destroyed if the server instance is restarted.
   * Note: This endpoint responds to all HTTP verbs but POST in preferred
   */
  async getTransientToken(
    request: operations.GetTransientTokenRequest,
    options?: RequestOptions,
  ): Promise<operations.GetTransientTokenResponse> {
    return unwrapAsync(generalGetTransientToken(
      this,
      request,
      options,
    ));
  }
}
