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

import { timelineMarkPlayed } from "../funcs/timelineMarkPlayed.js";
import { timelineReport } from "../funcs/timelineReport.js";
import { timelineUnscrobble } from "../funcs/timelineUnscrobble.js";
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
import * as operations from "./models/operations/index.js";
import { unwrapAsync } from "./types/fp.js";

export class Timeline extends ClientSDK {
  /**
   * Mark an item as played
   *
   * @remarks
   * Mark an item as played.  Note, this does not create any view history of this item but rather just sets the state as played. The client must provide either the `key` or `uri` query parameter
   * This API does respond to the GET verb but applications should use PUT
   */
  async markPlayed(
    request: operations.MarkPlayedRequest,
    options?: RequestOptions,
  ): Promise<operations.MarkPlayedResponse> {
    return unwrapAsync(timelineMarkPlayed(
      this,
      request,
      options,
    ));
  }

  /**
   * Report media timeline
   *
   * @remarks
   * This endpoint is hit during media playback for an item. It must be hit whenever the play state changes, or in the absence of a play state change, in a regular fashion (generally this means every 10 seconds on a LAN/WAN, and every 20 seconds over cellular).
   */
  async report(
    request: operations.ReportRequest,
    options?: RequestOptions,
  ): Promise<operations.ReportResponse> {
    return unwrapAsync(timelineReport(
      this,
      request,
      options,
    ));
  }

  /**
   * Mark an item as unplayed
   *
   * @remarks
   * Mark an item as unplayed. The client must provide either the `key` or `uri` query parameter
   * This API does respond to the GET verb but applications should use PUT
   */
  async unscrobble(
    request: operations.UnscrobbleRequest,
    options?: RequestOptions,
  ): Promise<operations.UnscrobbleResponse> {
    return unwrapAsync(timelineUnscrobble(
      this,
      request,
      options,
    ));
  }
}
