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

import { updaterApplyUpdates } from "../funcs/updaterApplyUpdates.js";
import { updaterCheckForUpdates } from "../funcs/updaterCheckForUpdates.js";
import { updaterGetUpdateStatus } from "../funcs/updaterGetUpdateStatus.js";
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
import * as operations from "./models/operations/index.js";
import { unwrapAsync } from "./types/fp.js";

export class Updater extends ClientSDK {
  /**
   * Querying status of updates
   *
   * @remarks
   * Querying status of updates
   */
  async getUpdateStatus(
    options?: RequestOptions,
  ): Promise<operations.GetUpdateStatusResponse> {
    return unwrapAsync(updaterGetUpdateStatus(
      this,
      options,
    ));
  }

  /**
   * Checking for updates
   *
   * @remarks
   * Checking for updates
   */
  async checkForUpdates(
    download?: operations.Download | undefined,
    options?: RequestOptions,
  ): Promise<operations.CheckForUpdatesResponse> {
    return unwrapAsync(updaterCheckForUpdates(
      this,
      download,
      options,
    ));
  }

  /**
   * Apply Updates
   *
   * @remarks
   * Note that these two parameters are effectively mutually exclusive. The `tonight` parameter takes precedence and `skip` will be ignored if `tonight` is also passed
   */
  async applyUpdates(
    tonight?: operations.Tonight | undefined,
    skip?: operations.Skip | undefined,
    options?: RequestOptions,
  ): Promise<operations.ApplyUpdatesResponse> {
    return unwrapAsync(updaterApplyUpdates(
      this,
      tonight,
      skip,
      options,
    ));
  }
}
