// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { APIResource } from '../../core/resource';
import { APIPromise } from '../../core/api-promise';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';

export class BaseSchemas extends APIResource {
  static override readonly _key: readonly ['apiGateway', 'schemas'] = Object.freeze([
    'apiGateway',
    'schemas',
  ] as const);

  /**
   * Returns tracked web and API operations and their feature configuration rendered
   * as OpenAPI schemas.
   *
   * @example
   * ```ts
   * const schemas = await client.apiGateway.schemas.list({
   *   zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
   * });
   * ```
   */
  list(params: SchemaListParams, options?: RequestOptions): APIPromise<SchemaListResponse> {
    const { zone_id, ...query } = params;
    return (
      this._client.get(path`/zones/${zone_id}/api_gateway/schemas`, { query, ...options }) as APIPromise<{
        result: SchemaListResponse;
      }>
    )._thenUnwrap((obj) => obj.result);
  }
}
export class Schemas extends BaseSchemas {}

export interface SchemaListResponse {
  schemas?: Array<unknown>;

  timestamp?: string;
}

export interface SchemaListParams {
  /**
   * Path param: Identifier.
   */
  zone_id: string;

  /**
   * Query param: Add feature(s) to the results. The feature name that is given here
   * corresponds to the resulting feature object. Have a look at the top-level object
   * description for more details on the specific meaning.
   */
  feature?: Array<'thresholds' | 'parameter_schemas' | 'schema_info' | 'confidence_intervals'>;

  /**
   * Query param: Receive schema only for the given host(s).
   */
  host?: Array<string>;

  /**
   * Query param: Schema kinds to include in exported OpenAPI schemas.
   */
  include_schema_kind?: Array<'learned'>;
}

export declare namespace Schemas {
  export { type SchemaListResponse as SchemaListResponse, type SchemaListParams as SchemaListParams };
}
