// this file is @generated
{% for resource in api.resources -%}
import { {{ resource.name | to_upper_camel_case }} } from "./api/{{ resource.name | to_lower_camel_case }}";
{% endfor -%}
import { createSvixRequestContext, type SvixRequestContext } from "./request";

export { type PostOptions, ApiException } from "./util";
export { HTTPValidationError, HttpErrorOut, ValidationError } from "./HttpErrors";
export * from "./webhook";
export * from "./models/index";
import type { XOR } from "./util";

export type { ApplicationListOptions } from "./api/application";
export type { BackgroundTaskListOptions } from "./api/backgroundTask";
export type { EndpointListOptions, EndpointGetStatsOptions } from "./api/endpoint";
export type { EventTypeListOptions } from "./api/eventType";
export type { IntegrationListOptions } from "./api/integration";
export { type MessageListOptions, messageInRaw } from "./api/message";
export type { MessageAttemptListByEndpointOptions } from "./api/messageAttempt";


export type SvixOptions = {
  debug?: boolean;
  serverUrl?: string;
  /** Time in milliseconds to wait for requests to get a response. */
  requestTimeout?: number;
  /**
   * Custom fetch implementation to use for HTTP requests.
   * Useful for testing, adding custom middleware, or running in non-standard environments.
   */
  fetch?: typeof fetch;
} & XOR<
  {
    /** List of delays (in milliseconds) to wait before each retry attempt.*/
    retryScheduleInMs?: number[];
  },
  {
    /** The number of times the client will retry if a server-side error
     *  or timeout is received.
     *  Default: 2
     */
    numRetries?: number;
  }
>;

export class Svix {
  protected readonly requestCtx: SvixRequestContext;

  public constructor(token: string, options: SvixOptions = {}) {
    this.requestCtx = createSvixRequestContext(token, options);
  }


  {% for resource in api.resources -%}
  public get {{ resource.name | to_lower_camel_case }}(){
    return new {{ resource.name | to_upper_camel_case }}(this.requestCtx);
  }

  {% endfor -%}
}

// Last to avoid circular dependency
export { AutoConfig, AutoConfigError } from "./autoconfig";
export { AutoConfigConsumer } from "./autoconfigConsumer";
