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

import { devicesAddDevice } from "../funcs/devicesAddDevice.js";
import { devicesDiscoverDevices } from "../funcs/devicesDiscoverDevices.js";
import { devicesGetAvailableGrabbers } from "../funcs/devicesGetAvailableGrabbers.js";
import { devicesGetDeviceDetails } from "../funcs/devicesGetDeviceDetails.js";
import { devicesGetDevicesChannels } from "../funcs/devicesGetDevicesChannels.js";
import { devicesGetThumb } from "../funcs/devicesGetThumb.js";
import { devicesListDevices } from "../funcs/devicesListDevices.js";
import { devicesModifyDevice } from "../funcs/devicesModifyDevice.js";
import { devicesRemoveDevice } from "../funcs/devicesRemoveDevice.js";
import { devicesScan } from "../funcs/devicesScan.js";
import { devicesSetChannelmap } from "../funcs/devicesSetChannelmap.js";
import { devicesSetDevicePreferences } from "../funcs/devicesSetDevicePreferences.js";
import { devicesStopScan } from "../funcs/devicesStopScan.js";
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
import * as operations from "./models/operations/index.js";
import { unwrapAsync } from "./types/fp.js";

export class Devices extends ClientSDK {
  /**
   * Get available grabbers
   *
   * @remarks
   * Get available grabbers visible to the server
   */
  async getAvailableGrabbers(
    request: operations.GetAvailableGrabbersRequest,
    options?: RequestOptions,
  ): Promise<operations.GetAvailableGrabbersResponse> {
    return unwrapAsync(devicesGetAvailableGrabbers(
      this,
      request,
      options,
    ));
  }

  /**
   * Get all devices
   *
   * @remarks
   * Get the list of all devices present
   */
  async listDevices(
    options?: RequestOptions,
  ): Promise<operations.ListDevicesResponse> {
    return unwrapAsync(devicesListDevices(
      this,
      options,
    ));
  }

  /**
   * Add a device
   *
   * @remarks
   * This endpoint adds a device to an existing grabber. The device is identified, and added to the correct grabber.
   */
  async addDevice(
    request: operations.AddDeviceRequest,
    options?: RequestOptions,
  ): Promise<operations.AddDeviceResponse> {
    return unwrapAsync(devicesAddDevice(
      this,
      request,
      options,
    ));
  }

  /**
   * Tell grabbers to discover devices
   *
   * @remarks
   * Tell grabbers to discover devices
   */
  async discoverDevices(
    options?: RequestOptions,
  ): Promise<operations.DiscoverDevicesResponse> {
    return unwrapAsync(devicesDiscoverDevices(
      this,
      options,
    ));
  }

  /**
   * Remove a device
   *
   * @remarks
   * Remove a devices by its id along with its channel mappings
   */
  async removeDevice(
    request: operations.RemoveDeviceRequest,
    options?: RequestOptions,
  ): Promise<operations.RemoveDeviceResponse> {
    return unwrapAsync(devicesRemoveDevice(
      this,
      request,
      options,
    ));
  }

  /**
   * Get device details
   *
   * @remarks
   * Get a device's details by its id
   */
  async getDeviceDetails(
    request: operations.GetDeviceDetailsRequest,
    options?: RequestOptions,
  ): Promise<operations.GetDeviceDetailsResponse> {
    return unwrapAsync(devicesGetDeviceDetails(
      this,
      request,
      options,
    ));
  }

  /**
   * Enable or disable a device
   *
   * @remarks
   * Enable or disable a device by its id
   */
  async modifyDevice(
    request: operations.ModifyDeviceRequest,
    options?: RequestOptions,
  ): Promise<operations.ModifyDeviceResponse> {
    return unwrapAsync(devicesModifyDevice(
      this,
      request,
      options,
    ));
  }

  /**
   * Set a device's channel mapping
   *
   * @remarks
   * Set a device's channel mapping
   */
  async setChannelmap(
    request: operations.SetChannelmapRequest,
    options?: RequestOptions,
  ): Promise<operations.SetChannelmapResponse> {
    return unwrapAsync(devicesSetChannelmap(
      this,
      request,
      options,
    ));
  }

  /**
   * Get a device's channels
   *
   * @remarks
   * Get a device's channels by its id
   */
  async getDevicesChannels(
    request: operations.GetDevicesChannelsRequest,
    options?: RequestOptions,
  ): Promise<operations.GetDevicesChannelsResponse> {
    return unwrapAsync(devicesGetDevicesChannels(
      this,
      request,
      options,
    ));
  }

  /**
   * Set device preferences
   *
   * @remarks
   * Set device preferences by its id
   */
  async setDevicePreferences(
    request: operations.SetDevicePreferencesRequest,
    options?: RequestOptions,
  ): Promise<operations.SetDevicePreferencesResponse> {
    return unwrapAsync(devicesSetDevicePreferences(
      this,
      request,
      options,
    ));
  }

  /**
   * Tell a device to stop scanning for channels
   *
   * @remarks
   * Tell a device to stop scanning for channels
   */
  async stopScan(
    request: operations.StopScanRequest,
    options?: RequestOptions,
  ): Promise<operations.StopScanResponse> {
    return unwrapAsync(devicesStopScan(
      this,
      request,
      options,
    ));
  }

  /**
   * Tell a device to scan for channels
   *
   * @remarks
   * Tell a device to scan for channels
   */
  async scan(
    request: operations.ScanRequest,
    options?: RequestOptions,
  ): Promise<operations.ScanResponse> {
    return unwrapAsync(devicesScan(
      this,
      request,
      options,
    ));
  }

  /**
   * Get device thumb
   *
   * @remarks
   * Get a device's thumb for display to the user
   */
  async getThumb(
    request: operations.GetThumbRequest,
    options?: RequestOptions,
  ): Promise<operations.GetThumbResponse> {
    return unwrapAsync(devicesGetThumb(
      this,
      request,
      options,
    ));
  }
}
