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

import { hubsCreateCustomHub } from "../funcs/hubsCreateCustomHub.js";
import { hubsDeleteCustomHub } from "../funcs/hubsDeleteCustomHub.js";
import { hubsGetAllHubs } from "../funcs/hubsGetAllHubs.js";
import { hubsGetContinueWatching } from "../funcs/hubsGetContinueWatching.js";
import { hubsGetHubItems } from "../funcs/hubsGetHubItems.js";
import { hubsGetMetadataHubs } from "../funcs/hubsGetMetadataHubs.js";
import { hubsGetPostplayHubs } from "../funcs/hubsGetPostplayHubs.js";
import { hubsGetPromotedHubs } from "../funcs/hubsGetPromotedHubs.js";
import { hubsGetRelatedHubs } from "../funcs/hubsGetRelatedHubs.js";
import { hubsGetSectionHubs } from "../funcs/hubsGetSectionHubs.js";
import { hubsListHubs } from "../funcs/hubsListHubs.js";
import { hubsMoveHub } from "../funcs/hubsMoveHub.js";
import { hubsResetSectionDefaults } from "../funcs/hubsResetSectionDefaults.js";
import { hubsUpdateHubVisibility } from "../funcs/hubsUpdateHubVisibility.js";
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
import * as operations from "./models/operations/index.js";
import { unwrapAsync } from "./types/fp.js";

export class Hubs extends ClientSDK {
  /**
   * Get global hubs
   *
   * @remarks
   * Get the global hubs in this PMS
   */
  async getAllHubs(
    request: operations.GetAllHubsRequest,
    options?: RequestOptions,
  ): Promise<operations.GetAllHubsResponse> {
    return unwrapAsync(hubsGetAllHubs(
      this,
      request,
      options,
    ));
  }

  /**
   * Get the continue watching hub
   *
   * @remarks
   * Get the global continue watching hub
   */
  async getContinueWatching(
    request: operations.GetContinueWatchingRequest,
    options?: RequestOptions,
  ): Promise<operations.GetContinueWatchingResponse> {
    return unwrapAsync(hubsGetContinueWatching(
      this,
      request,
      options,
    ));
  }

  /**
   * Get a hub's items
   *
   * @remarks
   * Get the items within a single hub specified by identifier
   */
  async getHubItems(
    request: operations.GetHubItemsRequest,
    options?: RequestOptions,
  ): Promise<operations.GetHubItemsResponse> {
    return unwrapAsync(hubsGetHubItems(
      this,
      request,
      options,
    ));
  }

  /**
   * Get the hubs which are promoted
   *
   * @remarks
   * Get the global hubs which are promoted (should be displayed on the home screen)
   */
  async getPromotedHubs(
    request: operations.GetPromotedHubsRequest,
    options?: RequestOptions,
  ): Promise<operations.GetPromotedHubsResponse> {
    return unwrapAsync(hubsGetPromotedHubs(
      this,
      request,
      options,
    ));
  }

  /**
   * Get hubs for section by metadata item
   *
   * @remarks
   * Get the hubs for a section by metadata item.  Currently only for music sections
   */
  async getMetadataHubs(
    request: operations.GetMetadataHubsRequest,
    options?: RequestOptions,
  ): Promise<operations.GetMetadataHubsResponse> {
    return unwrapAsync(hubsGetMetadataHubs(
      this,
      request,
      options,
    ));
  }

  /**
   * Get postplay hubs
   *
   * @remarks
   * Get the hubs for a metadata to be displayed in post play
   */
  async getPostplayHubs(
    request: operations.GetPostplayHubsRequest,
    options?: RequestOptions,
  ): Promise<operations.GetPostplayHubsResponse> {
    return unwrapAsync(hubsGetPostplayHubs(
      this,
      request,
      options,
    ));
  }

  /**
   * Get related hubs
   *
   * @remarks
   * Get the hubs for a metadata related to the provided metadata item
   */
  async getRelatedHubs(
    request: operations.GetRelatedHubsRequest,
    options?: RequestOptions,
  ): Promise<operations.GetRelatedHubsResponse> {
    return unwrapAsync(hubsGetRelatedHubs(
      this,
      request,
      options,
    ));
  }

  /**
   * Get section hubs
   *
   * @remarks
   * Get the hubs for a single section
   */
  async getSectionHubs(
    request: operations.GetSectionHubsRequest,
    options?: RequestOptions,
  ): Promise<operations.GetSectionHubsResponse> {
    return unwrapAsync(hubsGetSectionHubs(
      this,
      request,
      options,
    ));
  }

  /**
   * Reset hubs to defaults
   *
   * @remarks
   * Reset hubs for this section to defaults and delete custom hubs
   */
  async resetSectionDefaults(
    request: operations.ResetSectionDefaultsRequest,
    options?: RequestOptions,
  ): Promise<operations.ResetSectionDefaultsResponse> {
    return unwrapAsync(hubsResetSectionDefaults(
      this,
      request,
      options,
    ));
  }

  /**
   * Get hubs
   *
   * @remarks
   * Get the list of hubs including both built-in and custom
   */
  async listHubs(
    request: operations.ListHubsRequest,
    options?: RequestOptions,
  ): Promise<operations.ListHubsResponse> {
    return unwrapAsync(hubsListHubs(
      this,
      request,
      options,
    ));
  }

  /**
   * Create a custom hub
   *
   * @remarks
   * Create a custom hub based on a metadata item
   */
  async createCustomHub(
    request: operations.CreateCustomHubRequest,
    options?: RequestOptions,
  ): Promise<operations.CreateCustomHubResponse> {
    return unwrapAsync(hubsCreateCustomHub(
      this,
      request,
      options,
    ));
  }

  /**
   * Move Hub
   *
   * @remarks
   * Changed the ordering of a hub among others hubs
   */
  async moveHub(
    request: operations.MoveHubRequest,
    options?: RequestOptions,
  ): Promise<operations.MoveHubResponse> {
    return unwrapAsync(hubsMoveHub(
      this,
      request,
      options,
    ));
  }

  /**
   * Delete a custom hub
   *
   * @remarks
   * Delete a custom hub from the server
   */
  async deleteCustomHub(
    request: operations.DeleteCustomHubRequest,
    options?: RequestOptions,
  ): Promise<operations.DeleteCustomHubResponse> {
    return unwrapAsync(hubsDeleteCustomHub(
      this,
      request,
      options,
    ));
  }

  /**
   * Change hub visibility
   *
   * @remarks
   * Changed the visibility of a hub for both the admin and shared users
   */
  async updateHubVisibility(
    request: operations.UpdateHubVisibilityRequest,
    options?: RequestOptions,
  ): Promise<operations.UpdateHubVisibilityResponse> {
    return unwrapAsync(hubsUpdateHubVisibility(
      this,
      request,
      options,
    ));
  }
}
