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

import { statusDeleteHistory } from "../funcs/statusDeleteHistory.js";
import { statusGetBackgroundTasks } from "../funcs/statusGetBackgroundTasks.js";
import { statusGetHistoryItem } from "../funcs/statusGetHistoryItem.js";
import { statusListPlaybackHistory } from "../funcs/statusListPlaybackHistory.js";
import { statusListSessions } from "../funcs/statusListSessions.js";
import { statusTerminateSession } from "../funcs/statusTerminateSession.js";
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
import * as operations from "./models/operations/index.js";
import { unwrapAsync } from "./types/fp.js";

export class Status extends ClientSDK {
  /**
   * List Sessions
   *
   * @remarks
   * List all current playbacks on this server
   */
  async listSessions(
    options?: RequestOptions,
  ): Promise<operations.ListSessionsResponse> {
    return unwrapAsync(statusListSessions(
      this,
      options,
    ));
  }

  /**
   * Get background tasks
   *
   * @remarks
   * Get the list of all background tasks
   */
  async getBackgroundTasks(
    options?: RequestOptions,
  ): Promise<operations.GetBackgroundTasksResponse> {
    return unwrapAsync(statusGetBackgroundTasks(
      this,
      options,
    ));
  }

  /**
   * List Playback History
   *
   * @remarks
   * List all playback history (Admin can see all users, others can only see their own).
   * Pagination should be used on this endpoint.  Additionally this endpoint supports `includeFields`, `excludeFields`, `includeElements`, and `excludeElements` parameters.
   */
  async listPlaybackHistory(
    request: operations.ListPlaybackHistoryRequest,
    options?: RequestOptions,
  ): Promise<operations.ListPlaybackHistoryResponse> {
    return unwrapAsync(statusListPlaybackHistory(
      this,
      request,
      options,
    ));
  }

  /**
   * Terminate a session
   *
   * @remarks
   * Terminate a playback session kicking off the user
   */
  async terminateSession(
    request: operations.TerminateSessionRequest,
    options?: RequestOptions,
  ): Promise<operations.TerminateSessionResponse> {
    return unwrapAsync(statusTerminateSession(
      this,
      request,
      options,
    ));
  }

  /**
   * Delete Single History Item
   *
   * @remarks
   * Delete a single history item by id
   */
  async deleteHistory(
    request: operations.DeleteHistoryRequest,
    options?: RequestOptions,
  ): Promise<operations.DeleteHistoryResponse> {
    return unwrapAsync(statusDeleteHistory(
      this,
      request,
      options,
    ));
  }

  /**
   * Get Single History Item
   *
   * @remarks
   * Get a single history item by id
   */
  async getHistoryItem(
    request: operations.GetHistoryItemRequest,
    options?: RequestOptions,
  ): Promise<operations.GetHistoryItemResponse> {
    return unwrapAsync(statusGetHistoryItem(
      this,
      request,
      options,
    ));
  }
}
