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

import { betaObservabilitySpansFetchSpanEvalFieldOptions } from "../funcs/betaObservabilitySpansFetchSpanEvalFieldOptions.js";
import { betaObservabilitySpansFetchSpanFieldOptions } from "../funcs/betaObservabilitySpansFetchSpanFieldOptions.js";
import { betaObservabilitySpansListSpanEvalFields } from "../funcs/betaObservabilitySpansListSpanEvalFields.js";
import { betaObservabilitySpansListSpanFields } from "../funcs/betaObservabilitySpansListSpanFields.js";
import { betaObservabilitySpansSearchLatestSpanEvaluations } from "../funcs/betaObservabilitySpansSearchLatestSpanEvaluations.js";
import { betaObservabilitySpansSearchSpanEvaluations } from "../funcs/betaObservabilitySpansSearchSpanEvaluations.js";
import { betaObservabilitySpansSearchSpans } from "../funcs/betaObservabilitySpansSearchSpans.js";
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
import * as components from "../models/components/index.js";
import * as operations from "../models/operations/index.js";
import { unwrapAsync } from "../types/fp.js";

export class Spans extends ClientSDK {
  /**
   * Search spans
   */
  async searchSpans(
    request: operations.SearchSpansV1ObservabilitySpansSearchPostRequest,
    options?: RequestOptions,
  ): Promise<components.GetSpans> {
    return unwrapAsync(betaObservabilitySpansSearchSpans(
      this,
      request,
      options,
    ));
  }

  /**
   * Search span evaluations
   */
  async searchSpanEvaluations(
    request:
      operations.SearchSpanEvaluationsV1ObservabilitySpansEvaluationsSearchPostRequest,
    options?: RequestOptions,
  ): Promise<components.GetSpanEvaluations> {
    return unwrapAsync(betaObservabilitySpansSearchSpanEvaluations(
      this,
      request,
      options,
    ));
  }

  /**
   * Search latest span evaluations
   */
  async searchLatestSpanEvaluations(
    request:
      operations.SearchLatestSpanEvaluationsV1ObservabilitySpansEvaluationsSearchLatestPostRequest,
    options?: RequestOptions,
  ): Promise<components.GetSpanEvaluations> {
    return unwrapAsync(betaObservabilitySpansSearchLatestSpanEvaluations(
      this,
      request,
      options,
    ));
  }

  /**
   * Get span field definitions
   */
  async listSpanFields(
    options?: RequestOptions,
  ): Promise<components.GetSpanFields> {
    return unwrapAsync(betaObservabilitySpansListSpanFields(
      this,
      options,
    ));
  }

  /**
   * Get span evaluation field definitions
   */
  async listSpanEvalFields(
    options?: RequestOptions,
  ): Promise<components.GetSpanEvaluationFields> {
    return unwrapAsync(betaObservabilitySpansListSpanEvalFields(
      this,
      options,
    ));
  }

  /**
   * Get options for a span field
   */
  async fetchSpanFieldOptions(
    request:
      operations.GetSpanFieldOptionsV1ObservabilitySpansFieldsFieldNameOptionsGetRequest,
    options?: RequestOptions,
  ): Promise<components.GetSpanFieldOptions> {
    return unwrapAsync(betaObservabilitySpansFetchSpanFieldOptions(
      this,
      request,
      options,
    ));
  }

  /**
   * Get options for a span evaluation field
   */
  async fetchSpanEvalFieldOptions(
    request:
      operations.GetSpanEvaluationFieldOptionsV1ObservabilitySpansEvaluationsFieldsFieldNameOptionsGetRequest,
    options?: RequestOptions,
  ): Promise<components.GetSpanEvaluationFieldOptions> {
    return unwrapAsync(betaObservabilitySpansFetchSpanEvalFieldOptions(
      this,
      request,
      options,
    ));
  }
}
