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

import { threadsGet } from "../funcs/threadsGet.js";
import { threadsList } from "../funcs/threadsList.js";
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
import {
  GetV2ThreadsRequest,
  GetV2ThreadsResponse,
} from "../models/operations/getv2threads.js";
import {
  GetV2ThreadsThreadIdRequest,
  GetV2ThreadsThreadIdResponse,
} from "../models/operations/getv2threadsthreadid.js";
import { unwrapAsync } from "../types/fp.js";

export class Threads extends ClientSDK {
  /**
   * List threads
   *
   * @remarks
   * List threads of comments on a record or list entry.
   *
   * To view threads on records, you will need the `object_configuration:read` and `record_permission:read` scopes.
   *
   * To view threads on list entries, you will need the `list_configuration:read` and `list_entry:read` scopes.
   *
   * Required scopes: `comment:read`.
   */
  async list(
    request: GetV2ThreadsRequest,
    options?: RequestOptions,
  ): Promise<GetV2ThreadsResponse> {
    return unwrapAsync(threadsList(
      this,
      request,
      options,
    ));
  }

  /**
   * Get a thread
   *
   * @remarks
   * Get all comments in a thread.
   *
   * To view threads on records, you will need the `object_configuration:read` and `record_permission:read` scopes.
   *
   * To view threads on list entries, you will need the `list_configuration:read` and `list_entry:read` scopes.
   *
   * Required scopes: `comment:read`.
   */
  async get(
    request: GetV2ThreadsThreadIdRequest,
    options?: RequestOptions,
  ): Promise<GetV2ThreadsThreadIdResponse> {
    return unwrapAsync(threadsGet(
      this,
      request,
      options,
    ));
  }
}
