import type { RequestInit, RequestInfo } from "./internal/builtin-types.mjs"; import type { PromiseOrValue, MergedRequestInit, FinalizedRequestInit } from "./internal/types.mjs"; export type { Logger, LogLevel } from "./internal/utils/log.mjs"; import * as Opts from "./internal/request-options.mjs"; import * as Errors from "./core/error.mjs"; import * as Pagination from "./core/pagination.mjs"; import { type AssetsCursorParams, AssetsCursorResponse, type CollectionsCursorParams, CollectionsCursorResponse, type JobsCursorParams, JobsCursorResponse, type ModelsCursorParams, ModelsCursorResponse, type SearchHitsOffsetParams, SearchHitsOffsetResponse, type SnapshotsCursorParams, SnapshotsCursorResponse, type TagsCursorParams, TagsCursorResponse, type WorkflowsCursorParams, WorkflowsCursorResponse } from "./core/pagination.mjs"; import * as Uploads from "./core/uploads.mjs"; import * as API from "./resources/index.mjs"; import { APIPromise } from "./core/api-promise.mjs"; import { Generate, GenerateCaptionParams, GenerateCaptionResponse, GenerateDescribeStyleParams, GenerateDescribeStyleResponse, GenerateDetectParams, GenerateDetectResponse, GenerateEmbedParams, GenerateEmbedResponse, GeneratePatchParams, GeneratePatchResponse, GeneratePromptParams, GeneratePromptResponse, GenerateRunModelParams, GenerateRunModelResponse, GenerateTranslateParams, GenerateTranslateResponse } from "./resources/generate.mjs"; import { JobListParams, JobListResponse, JobListResponsesJobsCursor, JobRetrieveParams, JobRetrieveResponse, JobTriggerActionParams, JobTriggerActionResponse, Jobs } from "./resources/jobs.mjs"; import { Oscu, OscuRetrievePricesResponse } from "./resources/oscu.mjs"; import { Search, SearchAssetSearchParams, SearchAssetSearchResponse, SearchAssetSearchResponsesSearchHitsOffset, SearchModelSearchParams, SearchModelSearchResponse, SearchModelSearchResponsesSearchHitsOffset } from "./resources/search.mjs"; import { TagListParams, TagListResponse, TagListResponsesTagsCursor, Tags } from "./resources/tags.mjs"; import { UploadCreateParams, UploadCreateResponse, UploadRetrieveParams, UploadRetrieveResponse, UploadTriggerActionParams, UploadTriggerActionResponse, Uploads as UploadsAPIUploads } from "./resources/uploads.mjs"; import { UsageListParams, UsageListResponse, Usages } from "./resources/usages.mjs"; import { WorkflowApproveUserParams, WorkflowCreateParams, WorkflowCreateResponse, WorkflowDeleteParams, WorkflowDeleteResponse, WorkflowGetTagsParams, WorkflowGetTagsResponse, WorkflowListParams, WorkflowListResponse, WorkflowListResponsesWorkflowsCursor, WorkflowRetrieveParams, WorkflowRetrieveResponse, WorkflowRunParams, WorkflowRunResponse, WorkflowUpdateParams, WorkflowUpdateResponse, WorkflowUserApprovalParams, WorkflowUserApprovalResponse, Workflows } from "./resources/workflows.mjs"; import { AssetDeleteMultipleParams, AssetDeleteMultipleResponse, AssetDuplicateParams, AssetDuplicateResponse, AssetGetBulkParams, AssetGetBulkResponse, AssetListParams, AssetListResponse, AssetListResponsesAssetsCursor, AssetListSnapshotsParams, AssetListSnapshotsResponse, AssetListSnapshotsResponsesSnapshotsCursor, AssetLockParams, AssetLockResponse, AssetRetrieveParams, AssetRetrieveResponse, AssetUnlockParams, AssetUnlockResponse, AssetUpdateParams, AssetUpdateResponse, AssetUpdateTagsParams, AssetUpdateTagsResponse, AssetUploadParams, AssetUploadResponse, Assets } from "./resources/assets/assets.mjs"; import { CollectionCreateParams, CollectionCreateResponse, CollectionDeleteParams, CollectionDeleteResponse, CollectionListParams, CollectionListResponse, CollectionListResponsesCollectionsCursor, CollectionRetrieveParams, CollectionRetrieveResponse, CollectionUpdateParams, CollectionUpdateResponse, Collections } from "./resources/collections/collections.mjs"; import { ModelCopyParams, ModelCopyResponse, ModelCreateParams, ModelCreateResponse, ModelDeleteImagesParams, ModelDeleteImagesResponse, ModelDeleteParams, ModelDeleteResponse, ModelDownloadParams, ModelDownloadResponse, ModelGetBulkParams, ModelGetBulkResponse, ModelListParams, ModelListResponse, ModelListResponsesModelsCursor, ModelRetrieveParams, ModelRetrieveResponse, ModelTransferParams, ModelTransferResponse, ModelUpdateParams, ModelUpdateResponse, ModelUpdateTagsParams, ModelUpdateTagsResponse, Models } from "./resources/models/models.mjs"; import { Pricing } from "./resources/pricing/pricing.mjs"; import { type Fetch } from "./internal/builtin-types.mjs"; import { HeadersLike, NullableHeaders } from "./internal/headers.mjs"; import { FinalRequestOptions, RequestOptions } from "./internal/request-options.mjs"; import { type LogLevel, type Logger } from "./internal/utils/log.mjs"; export interface ClientOptions { /** * Defaults to process.env['SCENARIO_SDK_API_KEY']. */ apiKey?: string | null | undefined; /** * Defaults to process.env['SCENARIO_SDK_API_SECRET']. */ apiSecret?: string | null | undefined; /** * Defaults to process.env['SCENARIO_SDK_JWT']. */ bearerAuth?: string | null | undefined; /** * Override the default base URL for the API, e.g., "https://api.example.com/v2/" * * Defaults to process.env['SCENARIO_BASE_URL']. */ baseURL?: string | null | undefined; /** * The maximum amount of time (in milliseconds) that the client should wait for a response * from the server before timing out a single request. * * Note that request timeouts are retried by default, so in a worst-case scenario you may wait * much longer than this timeout before the promise succeeds or fails. * * @unit milliseconds */ timeout?: number | undefined; /** * Additional `RequestInit` options to be passed to `fetch` calls. * Properties will be overridden by per-request `fetchOptions`. */ fetchOptions?: MergedRequestInit | undefined; /** * Specify a custom `fetch` function implementation. * * If not provided, we expect that `fetch` is defined globally. */ fetch?: Fetch | undefined; /** * The maximum number of times that the client will retry a request in case of a * temporary failure, like a network error or a 5XX error from the server. * * @default 2 */ maxRetries?: number | undefined; /** * Default headers to include with every request to the API. * * These can be removed in individual requests by explicitly setting the * header to `null` in request options. */ defaultHeaders?: HeadersLike | undefined; /** * Default query parameters to include with every request to the API. * * These can be removed in individual requests by explicitly setting the * param to `undefined` in request options. */ defaultQuery?: Record | undefined; /** * Set the log level. * * Defaults to process.env['SCENARIO_LOG'] or 'warn' if it isn't set. */ logLevel?: LogLevel | undefined; /** * Set the logger. * * Defaults to globalThis.console. */ logger?: Logger | undefined; } /** * API Client for interfacing with the Scenario API. */ export declare class Scenario { #private; apiKey: string | null; apiSecret: string | null; bearerAuth: string | null; baseURL: string; maxRetries: number; timeout: number; logger: Logger; logLevel: LogLevel | undefined; fetchOptions: MergedRequestInit | undefined; private fetch; protected idempotencyHeader?: string; private _options; /** * API Client for interfacing with the Scenario API. * * @param {string | null | undefined} [opts.apiKey=process.env['SCENARIO_SDK_API_KEY'] ?? null] * @param {string | null | undefined} [opts.apiSecret=process.env['SCENARIO_SDK_API_SECRET'] ?? null] * @param {string | null | undefined} [opts.bearerAuth=process.env['SCENARIO_SDK_JWT'] ?? null] * @param {string} [opts.baseURL=process.env['SCENARIO_BASE_URL'] ?? https://api.cloud.scenario.com/v1] - Override the default base URL for the API. * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out. * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls. * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation. * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request. * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API. * @param {Record} opts.defaultQuery - Default query parameters to include with every request to the API. */ constructor({ baseURL, apiKey, apiSecret, bearerAuth, ...opts }?: ClientOptions); /** * Create a new client instance re-using the same options given to the current client with optional overriding. */ withOptions(options: Partial): this; protected defaultQuery(): Record | undefined; protected validateHeaders({ values, nulls }: NullableHeaders): void; protected authHeaders(opts: FinalRequestOptions): Promise; protected scBasicAuth(opts: FinalRequestOptions): Promise; protected scBearerAuth(opts: FinalRequestOptions): Promise; protected stringifyQuery(query: object | Record): string; private getUserAgent; protected defaultIdempotencyKey(): string; protected makeStatusError(status: number, error: Object, message: string | undefined, headers: Headers): Errors.APIError; buildURL(path: string, query: Record | null | undefined, defaultBaseURL?: string | undefined): string; /** * Used as a callback for mutating the given `FinalRequestOptions` object. */ protected prepareOptions(options: FinalRequestOptions): Promise; /** * Used as a callback for mutating the given `RequestInit` object. * * This is useful for cases where you want to add certain headers based off of * the request properties, e.g. `method` or `url`. */ protected prepareRequest(request: RequestInit, { url, options }: { url: string; options: FinalRequestOptions; }): Promise; get(path: string, opts?: PromiseOrValue): APIPromise; post(path: string, opts?: PromiseOrValue): APIPromise; patch(path: string, opts?: PromiseOrValue): APIPromise; put(path: string, opts?: PromiseOrValue): APIPromise; delete(path: string, opts?: PromiseOrValue): APIPromise; private methodRequest; request(options: PromiseOrValue, remainingRetries?: number | null): APIPromise; private makeRequest; getAPIList = Pagination.AbstractPage>(path: string, Page: new (...args: any[]) => PageClass, opts?: PromiseOrValue): Pagination.PagePromise; requestAPIList = Pagination.AbstractPage>(Page: new (...args: ConstructorParameters) => PageClass, options: PromiseOrValue): Pagination.PagePromise; fetchWithTimeout(url: RequestInfo, init: RequestInit | undefined, ms: number, controller: AbortController): Promise; private shouldRetry; private retryRequest; private calculateDefaultRetryTimeoutMillis; buildRequest(inputOptions: FinalRequestOptions, { retryCount }?: { retryCount?: number; }): Promise<{ req: FinalizedRequestInit; url: string; timeout: number; }>; private buildHeaders; private _makeAbort; private buildBody; static Scenario: typeof Scenario; static DEFAULT_TIMEOUT: number; static ScenarioError: typeof Errors.ScenarioError; static APIError: typeof Errors.APIError; static APIConnectionError: typeof Errors.APIConnectionError; static APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError; static APIUserAbortError: typeof Errors.APIUserAbortError; static NotFoundError: typeof Errors.NotFoundError; static ConflictError: typeof Errors.ConflictError; static RateLimitError: typeof Errors.RateLimitError; static BadRequestError: typeof Errors.BadRequestError; static AuthenticationError: typeof Errors.AuthenticationError; static InternalServerError: typeof Errors.InternalServerError; static PermissionDeniedError: typeof Errors.PermissionDeniedError; static UnprocessableEntityError: typeof Errors.UnprocessableEntityError; static toFile: typeof Uploads.toFile; assets: API.Assets; collections: API.Collections; generate: API.Generate; jobs: API.Jobs; models: API.Models; oscu: API.Oscu; pricing: API.Pricing; search: API.Search; tags: API.Tags; uploads: API.Uploads; usages: API.Usages; workflows: API.Workflows; } export declare namespace Scenario { export type RequestOptions = Opts.RequestOptions; export import AssetsCursor = Pagination.AssetsCursor; export { type AssetsCursorParams as AssetsCursorParams, type AssetsCursorResponse as AssetsCursorResponse }; export import SnapshotsCursor = Pagination.SnapshotsCursor; export { type SnapshotsCursorParams as SnapshotsCursorParams, type SnapshotsCursorResponse as SnapshotsCursorResponse, }; export import CollectionsCursor = Pagination.CollectionsCursor; export { type CollectionsCursorParams as CollectionsCursorParams, type CollectionsCursorResponse as CollectionsCursorResponse, }; export import JobsCursor = Pagination.JobsCursor; export { type JobsCursorParams as JobsCursorParams, type JobsCursorResponse as JobsCursorResponse }; export import ModelsCursor = Pagination.ModelsCursor; export { type ModelsCursorParams as ModelsCursorParams, type ModelsCursorResponse as ModelsCursorResponse }; export import TagsCursor = Pagination.TagsCursor; export { type TagsCursorParams as TagsCursorParams, type TagsCursorResponse as TagsCursorResponse }; export import WorkflowsCursor = Pagination.WorkflowsCursor; export { type WorkflowsCursorParams as WorkflowsCursorParams, type WorkflowsCursorResponse as WorkflowsCursorResponse, }; export import SearchHitsOffset = Pagination.SearchHitsOffset; export { type SearchHitsOffsetParams as SearchHitsOffsetParams, type SearchHitsOffsetResponse as SearchHitsOffsetResponse, }; export { Assets as Assets, type AssetRetrieveResponse as AssetRetrieveResponse, type AssetUpdateResponse as AssetUpdateResponse, type AssetListResponse as AssetListResponse, type AssetDeleteMultipleResponse as AssetDeleteMultipleResponse, type AssetDuplicateResponse as AssetDuplicateResponse, type AssetGetBulkResponse as AssetGetBulkResponse, type AssetListSnapshotsResponse as AssetListSnapshotsResponse, type AssetLockResponse as AssetLockResponse, type AssetUnlockResponse as AssetUnlockResponse, type AssetUpdateTagsResponse as AssetUpdateTagsResponse, type AssetUploadResponse as AssetUploadResponse, type AssetListResponsesAssetsCursor as AssetListResponsesAssetsCursor, type AssetListSnapshotsResponsesSnapshotsCursor as AssetListSnapshotsResponsesSnapshotsCursor, type AssetRetrieveParams as AssetRetrieveParams, type AssetUpdateParams as AssetUpdateParams, type AssetListParams as AssetListParams, type AssetDeleteMultipleParams as AssetDeleteMultipleParams, type AssetDuplicateParams as AssetDuplicateParams, type AssetGetBulkParams as AssetGetBulkParams, type AssetListSnapshotsParams as AssetListSnapshotsParams, type AssetLockParams as AssetLockParams, type AssetUnlockParams as AssetUnlockParams, type AssetUpdateTagsParams as AssetUpdateTagsParams, type AssetUploadParams as AssetUploadParams, }; export { Collections as Collections, type CollectionCreateResponse as CollectionCreateResponse, type CollectionRetrieveResponse as CollectionRetrieveResponse, type CollectionUpdateResponse as CollectionUpdateResponse, type CollectionListResponse as CollectionListResponse, type CollectionDeleteResponse as CollectionDeleteResponse, type CollectionListResponsesCollectionsCursor as CollectionListResponsesCollectionsCursor, type CollectionCreateParams as CollectionCreateParams, type CollectionRetrieveParams as CollectionRetrieveParams, type CollectionUpdateParams as CollectionUpdateParams, type CollectionListParams as CollectionListParams, type CollectionDeleteParams as CollectionDeleteParams, }; export { Generate as Generate, type GenerateCaptionResponse as GenerateCaptionResponse, type GenerateDescribeStyleResponse as GenerateDescribeStyleResponse, type GenerateDetectResponse as GenerateDetectResponse, type GenerateEmbedResponse as GenerateEmbedResponse, type GeneratePatchResponse as GeneratePatchResponse, type GeneratePromptResponse as GeneratePromptResponse, type GenerateRunModelResponse as GenerateRunModelResponse, type GenerateTranslateResponse as GenerateTranslateResponse, type GenerateCaptionParams as GenerateCaptionParams, type GenerateDescribeStyleParams as GenerateDescribeStyleParams, type GenerateDetectParams as GenerateDetectParams, type GenerateEmbedParams as GenerateEmbedParams, type GeneratePatchParams as GeneratePatchParams, type GeneratePromptParams as GeneratePromptParams, type GenerateRunModelParams as GenerateRunModelParams, type GenerateTranslateParams as GenerateTranslateParams, }; export { Jobs as Jobs, type JobRetrieveResponse as JobRetrieveResponse, type JobListResponse as JobListResponse, type JobTriggerActionResponse as JobTriggerActionResponse, type JobListResponsesJobsCursor as JobListResponsesJobsCursor, type JobRetrieveParams as JobRetrieveParams, type JobListParams as JobListParams, type JobTriggerActionParams as JobTriggerActionParams, }; export { Models as Models, type ModelCreateResponse as ModelCreateResponse, type ModelRetrieveResponse as ModelRetrieveResponse, type ModelUpdateResponse as ModelUpdateResponse, type ModelListResponse as ModelListResponse, type ModelDeleteResponse as ModelDeleteResponse, type ModelCopyResponse as ModelCopyResponse, type ModelDeleteImagesResponse as ModelDeleteImagesResponse, type ModelDownloadResponse as ModelDownloadResponse, type ModelGetBulkResponse as ModelGetBulkResponse, type ModelTransferResponse as ModelTransferResponse, type ModelUpdateTagsResponse as ModelUpdateTagsResponse, type ModelListResponsesModelsCursor as ModelListResponsesModelsCursor, type ModelCreateParams as ModelCreateParams, type ModelRetrieveParams as ModelRetrieveParams, type ModelUpdateParams as ModelUpdateParams, type ModelListParams as ModelListParams, type ModelDeleteParams as ModelDeleteParams, type ModelCopyParams as ModelCopyParams, type ModelDeleteImagesParams as ModelDeleteImagesParams, type ModelDownloadParams as ModelDownloadParams, type ModelGetBulkParams as ModelGetBulkParams, type ModelTransferParams as ModelTransferParams, type ModelUpdateTagsParams as ModelUpdateTagsParams, }; export { Oscu as Oscu, type OscuRetrievePricesResponse as OscuRetrievePricesResponse }; export { Pricing as Pricing }; export { Search as Search, type SearchAssetSearchResponse as SearchAssetSearchResponse, type SearchModelSearchResponse as SearchModelSearchResponse, type SearchAssetSearchResponsesSearchHitsOffset as SearchAssetSearchResponsesSearchHitsOffset, type SearchModelSearchResponsesSearchHitsOffset as SearchModelSearchResponsesSearchHitsOffset, type SearchAssetSearchParams as SearchAssetSearchParams, type SearchModelSearchParams as SearchModelSearchParams, }; export { Tags as Tags, type TagListResponse as TagListResponse, type TagListResponsesTagsCursor as TagListResponsesTagsCursor, type TagListParams as TagListParams, }; export { UploadsAPIUploads as Uploads, type UploadCreateResponse as UploadCreateResponse, type UploadRetrieveResponse as UploadRetrieveResponse, type UploadTriggerActionResponse as UploadTriggerActionResponse, type UploadCreateParams as UploadCreateParams, type UploadRetrieveParams as UploadRetrieveParams, type UploadTriggerActionParams as UploadTriggerActionParams, }; export { Usages as Usages, type UsageListResponse as UsageListResponse, type UsageListParams as UsageListParams, }; export { Workflows as Workflows, type WorkflowCreateResponse as WorkflowCreateResponse, type WorkflowRetrieveResponse as WorkflowRetrieveResponse, type WorkflowUpdateResponse as WorkflowUpdateResponse, type WorkflowListResponse as WorkflowListResponse, type WorkflowDeleteResponse as WorkflowDeleteResponse, type WorkflowGetTagsResponse as WorkflowGetTagsResponse, type WorkflowRunResponse as WorkflowRunResponse, type WorkflowUserApprovalResponse as WorkflowUserApprovalResponse, type WorkflowListResponsesWorkflowsCursor as WorkflowListResponsesWorkflowsCursor, type WorkflowCreateParams as WorkflowCreateParams, type WorkflowRetrieveParams as WorkflowRetrieveParams, type WorkflowUpdateParams as WorkflowUpdateParams, type WorkflowListParams as WorkflowListParams, type WorkflowDeleteParams as WorkflowDeleteParams, type WorkflowGetTagsParams as WorkflowGetTagsParams, type WorkflowRunParams as WorkflowRunParams, type WorkflowUserApprovalParams as WorkflowUserApprovalParams, type WorkflowApproveUserParams as WorkflowApproveUserParams, }; } //# sourceMappingURL=client.d.mts.map