import type { RequestInit, RequestInfo } from "./internal/builtin-types.js"; import type { PromiseOrValue, MergedRequestInit, FinalizedRequestInit } from "./internal/types.js"; export type { Logger, LogLevel } from "./internal/utils/log.js"; import * as Opts from "./internal/request-options.js"; import * as Errors from "./core/error.js"; import * as Pagination from "./core/pagination.js"; import { type CursorPageParams, CursorPageResponse } from "./core/pagination.js"; import * as UploadsCore from "./core/uploads.js"; import * as API from "./resources/index.js"; import { APIPromise } from "./core/api-promise.js"; import { AvatarVideoCreateParams, AvatarVideoCreateResponse, AvatarVideos } from "./resources/avatar-videos.js"; import { AvatarCreateParams, AvatarCreateResponse, AvatarListParams, AvatarListResponse, AvatarListResponsesCursorPage, AvatarRetrieveResponse, AvatarUpdateParams, AvatarUpdateResponse, Avatars } from "./resources/avatars.js"; import { CharacterPerformance, CharacterPerformanceCreateParams, CharacterPerformanceCreateResponse } from "./resources/character-performance.js"; import { DocumentCreateParams, DocumentCreateResponse, DocumentListParams, DocumentListResponse, DocumentListResponsesCursorPage, DocumentRetrieveResponse, DocumentUpdateParams, Documents } from "./resources/documents.js"; import { ImageToVideo, ImageToVideoCreateParams, ImageToVideoCreateResponse } from "./resources/image-to-video.js"; import { Organization, OrganizationRetrieveResponse, OrganizationRetrieveUsageParams, OrganizationRetrieveUsageResponse } from "./resources/organization.js"; import { RealtimeSessionCreateParams, RealtimeSessionCreateResponse, RealtimeSessionRetrieveResponse, RealtimeSessions } from "./resources/realtime-sessions.js"; import { SoundEffect, SoundEffectCreateParams, SoundEffectCreateResponse } from "./resources/sound-effect.js"; import { SpeechToSpeech, SpeechToSpeechCreateParams, SpeechToSpeechCreateResponse } from "./resources/speech-to-speech.js"; import { TaskRetrieveResponse, Tasks } from "./resources/tasks.js"; import { TextToImage, TextToImageCreateParams, TextToImageCreateResponse } from "./resources/text-to-image.js"; import { TextToSpeech, TextToSpeechCreateParams, TextToSpeechCreateResponse } from "./resources/text-to-speech.js"; import { TextToVideo, TextToVideoCreateParams, TextToVideoCreateResponse } from "./resources/text-to-video.js"; import { VideoToVideo, VideoToVideoCreateParams, VideoToVideoCreateResponse } from "./resources/video-to-video.js"; import { VoiceDubbing, VoiceDubbingCreateParams, VoiceDubbingCreateResponse } from "./resources/voice-dubbing.js"; import { VoiceIsolation, VoiceIsolationCreateParams, VoiceIsolationCreateResponse } from "./resources/voice-isolation.js"; import { Uploads, UploadsCreateEphemeralParams, UploadCreateEphemeralResponse } from "./resources/uploads.js"; import { VoiceCreateParams, VoiceCreateResponse, VoiceListParams, VoiceListResponse, VoiceListResponsesCursorPage, VoicePreviewParams, VoicePreviewResponse, VoiceRetrieveResponse, Voices } from "./resources/voices.js"; import { WorkflowInvocationRetrieveResponse, WorkflowInvocations } from "./resources/workflow-invocations.js"; import { WorkflowListResponse, WorkflowRetrieveResponse, WorkflowRunParams, WorkflowRunResponse, Workflows } from "./resources/workflows.js"; import { type Fetch } from "./internal/builtin-types.js"; import { HeadersLike, NullableHeaders } from "./internal/headers.js"; import { FinalRequestOptions, RequestOptions } from "./internal/request-options.js"; import { type LogLevel, type Logger } from "./internal/utils/log.js"; export interface ClientOptions { /** * Defaults to process.env['RUNWAYML_API_SECRET']. */ apiKey?: string | undefined; runwayVersion?: string | undefined; /** * Override the default base URL for the API, e.g., "https://api.example.com/v2/" * * Defaults to process.env['RUNWAYML_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['RUNWAYML_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 RunwayML API. */ export declare class RunwayML { #private; apiKey: string; runwayVersion: string; 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 RunwayML API. * * @param {string | undefined} [opts.apiKey=process.env['RUNWAYML_API_SECRET'] ?? undefined] * @param {string | undefined} [opts.runwayVersion=2024-11-06] * @param {string} [opts.baseURL=process.env['RUNWAYML_BASE_URL'] ?? https://api.dev.runwayml.com] - 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, runwayVersion, ...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; /** * Basic re-implementation of `qs.stringify` for primitive types. */ 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 RunwayML: typeof RunwayML; static DEFAULT_TIMEOUT: number; static RunwayMLError: typeof Errors.RunwayMLError; 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 UploadsCore.toFile; /** * Endpoints for managing tasks that have been submitted. */ tasks: API.Tasks; /** * These endpoints all kick off tasks to create generations. */ imageToVideo: API.ImageToVideo; /** * These endpoints all kick off tasks to create generations. */ videoToVideo: API.VideoToVideo; /** * These endpoints all kick off tasks to create generations. */ textToVideo: API.TextToVideo; /** * These endpoints all kick off tasks to create generations. */ textToImage: API.TextToImage; /** * These endpoints all kick off tasks to create generations. */ characterPerformance: API.CharacterPerformance; /** * These endpoints all kick off tasks to create generations. */ textToSpeech: API.TextToSpeech; /** * These endpoints all kick off tasks to create generations. */ soundEffect: API.SoundEffect; /** * These endpoints all kick off tasks to create generations. */ voiceIsolation: API.VoiceIsolation; /** * These endpoints all kick off tasks to create generations. */ voiceDubbing: API.VoiceDubbing; /** * These endpoints all kick off tasks to create generations. */ speechToSpeech: API.SpeechToSpeech; organization: API.Organization; avatars: API.Avatars; avatarVideos: API.AvatarVideos; documents: API.Documents; realtimeSessions: API.RealtimeSessions; voices: API.Voices; uploads: API.Uploads; workflows: API.Workflows; workflowInvocations: API.WorkflowInvocations; } export declare namespace RunwayML { export type RequestOptions = Opts.RequestOptions; export import CursorPage = Pagination.CursorPage; export { type CursorPageParams as CursorPageParams, type CursorPageResponse as CursorPageResponse }; export { Tasks as Tasks, type TaskRetrieveResponse as TaskRetrieveResponse }; export { ImageToVideo as ImageToVideo, type ImageToVideoCreateResponse as ImageToVideoCreateResponse, type ImageToVideoCreateParams as ImageToVideoCreateParams, }; export { VideoToVideo as VideoToVideo, type VideoToVideoCreateResponse as VideoToVideoCreateResponse, type VideoToVideoCreateParams as VideoToVideoCreateParams, }; export { TextToVideo as TextToVideo, type TextToVideoCreateResponse as TextToVideoCreateResponse, type TextToVideoCreateParams as TextToVideoCreateParams, }; export { TextToImage as TextToImage, type TextToImageCreateResponse as TextToImageCreateResponse, type TextToImageCreateParams as TextToImageCreateParams, }; export { CharacterPerformance as CharacterPerformance, type CharacterPerformanceCreateResponse as CharacterPerformanceCreateResponse, type CharacterPerformanceCreateParams as CharacterPerformanceCreateParams, }; export { TextToSpeech as TextToSpeech, type TextToSpeechCreateResponse as TextToSpeechCreateResponse, type TextToSpeechCreateParams as TextToSpeechCreateParams, }; export { SoundEffect as SoundEffect, type SoundEffectCreateResponse as SoundEffectCreateResponse, type SoundEffectCreateParams as SoundEffectCreateParams, }; export { VoiceIsolation as VoiceIsolation, type VoiceIsolationCreateResponse as VoiceIsolationCreateResponse, type VoiceIsolationCreateParams as VoiceIsolationCreateParams, }; export { VoiceDubbing as VoiceDubbing, type VoiceDubbingCreateResponse as VoiceDubbingCreateResponse, type VoiceDubbingCreateParams as VoiceDubbingCreateParams, }; export { SpeechToSpeech as SpeechToSpeech, type SpeechToSpeechCreateResponse as SpeechToSpeechCreateResponse, type SpeechToSpeechCreateParams as SpeechToSpeechCreateParams, }; export { Organization as Organization, type OrganizationRetrieveResponse as OrganizationRetrieveResponse, type OrganizationRetrieveUsageResponse as OrganizationRetrieveUsageResponse, type OrganizationRetrieveUsageParams as OrganizationRetrieveUsageParams, }; export { Avatars as Avatars, type AvatarCreateResponse as AvatarCreateResponse, type AvatarRetrieveResponse as AvatarRetrieveResponse, type AvatarUpdateResponse as AvatarUpdateResponse, type AvatarListResponse as AvatarListResponse, type AvatarListResponsesCursorPage as AvatarListResponsesCursorPage, type AvatarCreateParams as AvatarCreateParams, type AvatarUpdateParams as AvatarUpdateParams, type AvatarListParams as AvatarListParams, }; export { AvatarVideos as AvatarVideos, type AvatarVideoCreateResponse as AvatarVideoCreateResponse, type AvatarVideoCreateParams as AvatarVideoCreateParams, }; export { Documents as Documents, type DocumentCreateResponse as DocumentCreateResponse, type DocumentRetrieveResponse as DocumentRetrieveResponse, type DocumentListResponse as DocumentListResponse, type DocumentListResponsesCursorPage as DocumentListResponsesCursorPage, type DocumentCreateParams as DocumentCreateParams, type DocumentUpdateParams as DocumentUpdateParams, type DocumentListParams as DocumentListParams, }; export { RealtimeSessions as RealtimeSessions, type RealtimeSessionCreateResponse as RealtimeSessionCreateResponse, type RealtimeSessionRetrieveResponse as RealtimeSessionRetrieveResponse, type RealtimeSessionCreateParams as RealtimeSessionCreateParams, }; export { Voices as Voices, type VoiceCreateResponse as VoiceCreateResponse, type VoiceRetrieveResponse as VoiceRetrieveResponse, type VoiceListResponse as VoiceListResponse, type VoicePreviewResponse as VoicePreviewResponse, type VoiceListResponsesCursorPage as VoiceListResponsesCursorPage, type VoiceCreateParams as VoiceCreateParams, type VoiceListParams as VoiceListParams, type VoicePreviewParams as VoicePreviewParams, }; export { Uploads as Uploads, type UploadCreateEphemeralResponse as UploadCreateEphemeralResponse, type UploadsCreateEphemeralParams as UploadsCreateEphemeralParams, }; export { Workflows as Workflows, type WorkflowRetrieveResponse as WorkflowRetrieveResponse, type WorkflowListResponse as WorkflowListResponse, type WorkflowRunResponse as WorkflowRunResponse, type WorkflowRunParams as WorkflowRunParams, }; export { WorkflowInvocations as WorkflowInvocations, type WorkflowInvocationRetrieveResponse as WorkflowInvocationRetrieveResponse, }; } //# sourceMappingURL=client.d.ts.map