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

import { logEnablePapertrail } from "../funcs/logEnablePapertrail.js";
import { logWriteLog } from "../funcs/logWriteLog.js";
import { logWriteMessage } from "../funcs/logWriteMessage.js";
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
import * as operations from "./models/operations/index.js";
import { unwrapAsync } from "./types/fp.js";

export class Log extends ClientSDK {
  /**
   * Logging a multi-line message to the Plex Media Server log
   *
   * @remarks
   * This endpoint will write multiple lines to the main Plex Media Server log in a single request. It takes a set of query strings as would normally sent to the above PUT endpoint as a linefeed-separated block of POST data. The parameters for each query string match as above.
   */
  async writeLog(
    request: ReadableStream<Uint8Array> | Blob | ArrayBuffer | Uint8Array,
    options?: RequestOptions,
  ): Promise<operations.WriteLogResponse> {
    return unwrapAsync(logWriteLog(
      this,
      request,
      options,
    ));
  }

  /**
   * Logging a single-line message to the Plex Media Server log
   *
   * @remarks
   * This endpoint will write a single-line log message, including a level and source to the main Plex Media Server log.
   *
   * Note: This endpoint responds to all HTTP verbs **except POST** but PUT is preferred
   */
  async writeMessage(
    request: operations.WriteMessageRequest,
    options?: RequestOptions,
  ): Promise<operations.WriteMessageResponse> {
    return unwrapAsync(logWriteMessage(
      this,
      request,
      options,
    ));
  }

  /**
   * Enabling Papertrail
   *
   * @remarks
   * This endpoint will enable all Plex Media Server logs to be sent to the Papertrail networked logging site for a period of time
   *
   * Note: This endpoint responds to all HTTP verbs but POST is preferred
   */
  async enablePapertrail(
    request: operations.EnablePapertrailRequest,
    options?: RequestOptions,
  ): Promise<operations.EnablePapertrailResponse> {
    return unwrapAsync(logEnablePapertrail(
      this,
      request,
      options,
    ));
  }
}
