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

import { downloadQueueAddDownloadQueueItems } from "../funcs/downloadQueueAddDownloadQueueItems.js";
import { downloadQueueCreateDownloadQueue } from "../funcs/downloadQueueCreateDownloadQueue.js";
import { downloadQueueGetDownloadQueue } from "../funcs/downloadQueueGetDownloadQueue.js";
import { downloadQueueGetDownloadQueueItems } from "../funcs/downloadQueueGetDownloadQueueItems.js";
import { downloadQueueGetDownloadQueueMedia } from "../funcs/downloadQueueGetDownloadQueueMedia.js";
import { downloadQueueGetItemDecision } from "../funcs/downloadQueueGetItemDecision.js";
import { downloadQueueListDownloadQueueItems } from "../funcs/downloadQueueListDownloadQueueItems.js";
import { downloadQueueRemoveDownloadQueueItems } from "../funcs/downloadQueueRemoveDownloadQueueItems.js";
import { downloadQueueRestartProcessingDownloadQueueItems } from "../funcs/downloadQueueRestartProcessingDownloadQueueItems.js";
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
import * as operations from "./models/operations/index.js";
import { unwrapAsync } from "./types/fp.js";

export class DownloadQueue extends ClientSDK {
  /**
   * Create download queue
   *
   * @remarks
   * Available: 0.2.0
   *
   * Creates a download queue for this client if one doesn't exist, or returns the existing queue for this client and user.
   */
  async createDownloadQueue(
    options?: RequestOptions,
  ): Promise<operations.CreateDownloadQueueResponse> {
    return unwrapAsync(downloadQueueCreateDownloadQueue(
      this,
      options,
    ));
  }

  /**
   * Get a download queue
   *
   * @remarks
   * Available: 0.2.0
   *
   * Get a download queue by its id
   */
  async getDownloadQueue(
    request: operations.GetDownloadQueueRequest,
    options?: RequestOptions,
  ): Promise<operations.GetDownloadQueueResponse> {
    return unwrapAsync(downloadQueueGetDownloadQueue(
      this,
      request,
      options,
    ));
  }

  /**
   * Add to download queue
   *
   * @remarks
   * Available: 0.2.0
   *
   * Add items to the download queue
   */
  async addDownloadQueueItems(
    request: operations.AddDownloadQueueItemsRequest,
    options?: RequestOptions,
  ): Promise<operations.AddDownloadQueueItemsResponse> {
    return unwrapAsync(downloadQueueAddDownloadQueueItems(
      this,
      request,
      options,
    ));
  }

  /**
   * Get download queue items
   *
   * @remarks
   * Available: 0.2.0
   *
   * Get items from a download queue
   */
  async listDownloadQueueItems(
    request: operations.ListDownloadQueueItemsRequest,
    options?: RequestOptions,
  ): Promise<operations.ListDownloadQueueItemsResponse> {
    return unwrapAsync(downloadQueueListDownloadQueueItems(
      this,
      request,
      options,
    ));
  }

  /**
   * Grab download queue item decision
   *
   * @remarks
   * Available: 0.2.0
   *
   * Grab the decision for a download queue item
   */
  async getItemDecision(
    request: operations.GetItemDecisionRequest,
    options?: RequestOptions,
  ): Promise<operations.GetItemDecisionResponse> {
    return unwrapAsync(downloadQueueGetItemDecision(
      this,
      request,
      options,
    ));
  }

  /**
   * Grab download queue media
   *
   * @remarks
   * Available: 0.2.0
   *
   * Grab the media for a download queue item
   */
  async getDownloadQueueMedia(
    request: operations.GetDownloadQueueMediaRequest,
    options?: RequestOptions,
  ): Promise<operations.GetDownloadQueueMediaResponse> {
    return unwrapAsync(downloadQueueGetDownloadQueueMedia(
      this,
      request,
      options,
    ));
  }

  /**
   * Delete download queue items
   *
   * @remarks
   * delete items from a download queue
   */
  async removeDownloadQueueItems(
    request: operations.RemoveDownloadQueueItemsRequest,
    options?: RequestOptions,
  ): Promise<operations.RemoveDownloadQueueItemsResponse> {
    return unwrapAsync(downloadQueueRemoveDownloadQueueItems(
      this,
      request,
      options,
    ));
  }

  /**
   * Get download queue items
   *
   * @remarks
   * Available: 0.2.0
   *
   * Get items from a download queue
   */
  async getDownloadQueueItems(
    request: operations.GetDownloadQueueItemsRequest,
    options?: RequestOptions,
  ): Promise<operations.GetDownloadQueueItemsResponse> {
    return unwrapAsync(downloadQueueGetDownloadQueueItems(
      this,
      request,
      options,
    ));
  }

  /**
   * Restart processing of items from the decision
   *
   * @remarks
   * Available: 0.2.0
   *
   * Reprocess download queue items with previous decision parameters
   */
  async restartProcessingDownloadQueueItems(
    request: operations.RestartProcessingDownloadQueueItemsRequest,
    options?: RequestOptions,
  ): Promise<operations.RestartProcessingDownloadQueueItemsResponse> {
    return unwrapAsync(downloadQueueRestartProcessingDownloadQueueItems(
      this,
      request,
      options,
    ));
  }
}
