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

import { updaterApplyUpdates } from "../funcs/updaterApplyUpdates.js";
import { updaterCheckUpdates } from "../funcs/updaterCheckUpdates.js";
import { updaterGetUpdatesStatus } from "../funcs/updaterGetUpdatesStatus.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 {
  /**
   * Applying updates
   *
   * @remarks
   * Apply any downloaded updates.  Note that the two parameters `tonight` and `skip` are effectively mutually exclusive. The `tonight` parameter takes precedence and `skip` will be ignored if `tonight` is also passed.
   */
  async applyUpdates(
    request: operations.ApplyUpdatesRequest,
    options?: RequestOptions,
  ): Promise<operations.ApplyUpdatesResponse> {
    return unwrapAsync(updaterApplyUpdates(
      this,
      request,
      options,
    ));
  }

  /**
   * Checking for updates
   *
   * @remarks
   * Perform an update check and potentially download
   */
  async checkUpdates(
    request: operations.CheckUpdatesRequest,
    options?: RequestOptions,
  ): Promise<operations.CheckUpdatesResponse> {
    return unwrapAsync(updaterCheckUpdates(
      this,
      request,
      options,
    ));
  }

  /**
   * Querying status of updates
   *
   * @remarks
   * Get the status of updating the server
   */
  async getUpdatesStatus(
    options?: RequestOptions,
  ): Promise<operations.GetUpdatesStatusResponse> {
    return unwrapAsync(updaterGetUpdatesStatus(
      this,
      options,
    ));
  }
}
