import { HttpClient } from './http-client'; import { RetryConfig, RetryService } from './internal/retry'; export * from './error-handling'; export * from './http-client'; export type HttpClientType = 'axios' | 'fetch'; /** * Authorization credentials */ export interface Credentials { /** Personal Access Token */ token: string; /** Yor Crowdin Enterprise organization name */ organization?: string; /** @deprecated API base URL. Use `apiDomain` instead` */ baseUrl?: string; /** API domain (e.g., 'api.crowdin.com') */ apiDomain?: string; } /** * Client Configuration */ export interface ClientConfig { /** The type of HTTP client to be used for making requests */ httpClientType?: HttpClientType; /** Instance of your HTTP client if needed */ httpClient?: HttpClient; /** Custom User-Agent to be passed to the `User-Agent` header */ userAgent?: string; /** Custom User-Agent to be passed to the `X-Crowdin-Integrations-User-Agent` header */ integrationUserAgent?: string; /** Retry strategy configuration */ retryConfig?: RetryConfig; /** Http request timeout in ms */ httpRequestTimeout?: number; } export interface ResponseList { data: ResponseObject[]; pagination: Pagination; } export interface ResponseObject { data: T; } export interface Pagination { offset: number; limit: number; } export type PaginationOptions = Partial; /** * A JSON Patch document as defined by [RFC 6902](https://datatracker.ietf.org/doc/html/rfc6902#section-3) */ export interface PatchRequest { /** Patch value */ value?: any; /** Patch operation to perform */ op: PatchOperation; /** A JSON Pointer as defined by [RFC 6901](https://datatracker.ietf.org/doc/html/rfc6901) */ path: string; } export type PatchOperation = 'add' | 'remove' | 'replace' | 'move' | 'copy' | 'test'; export type ProjectRoles = 'manager' | 'developer' | 'translator' | 'proofreader' | 'language_coordinator' | 'member'; export interface DownloadLink { url: string; expireIn: string; } /** * @internal */ export declare enum BooleanInt { TRUE = 1, FALSE = 0 } export interface Status { identifier: string; status: string; progress: number; attributes: T; createdAt: string; updatedAt: string; startedAt: string; finishedAt: string; eta: string; } export interface Attribute { [key: string]: string; } export type PlainObject = Record; export declare abstract class CrowdinApi { private static readonly CROWDIN_API_DOMAIN; private static readonly AXIOS_INSTANCE; private static readonly FETCH_INSTANCE; /** @internal */ readonly token: string; /** @internal */ readonly organization?: string; /** @internal */ readonly url: string; /** @internal */ readonly apiDomain: string; /** @internal */ readonly config: ClientConfig | undefined; /** @internal */ readonly retryService: RetryService; protected fetchAllFlag: boolean; protected maxLimit: number | undefined; /** * @param credentials credentials * @param config optional configuration of the client */ constructor(credentials: Credentials, config?: ClientConfig); graphql(req: { query: string; operationName?: string; variables?: any; }, config?: { url?: string; }): Promise>; protected addQueryParam(url: string, name: string, value?: string | number): string; protected defaultConfig(): { headers: Record; }; /** @internal */ get httpClient(): HttpClient; withFetchAll(maxLimit?: number): this; protected getList(url: string, limit?: number, offset?: number, config?: { headers: Record; }): Promise>; protected fetchAll(url: string, config: { headers: Record; }, maxAmount?: number): Promise>; protected encodeUrlParam(param: string | number | boolean): string; protected get(url: string, config?: { headers: Record; }): Promise; protected delete(url: string, config?: { headers: Record; }): Promise; protected head(url: string, config?: { headers: Record; }): Promise; protected post(url: string, data?: unknown, config?: { headers: Record; }): Promise; protected put(url: string, data?: unknown, config?: { headers: Record; }): Promise; protected patch(url: string, data?: unknown, config?: { headers: Record; }): Promise; } /** * @internal */ export declare function isOptionalString(parameter: string | unknown, parameterInArgs: boolean): parameter is string | undefined; /** * @internal */ export declare function isOptionalNumber(parameter: number | unknown, parameterInArgs: boolean): parameter is number | undefined; export interface ProjectRole { name: string; permissions: ProjectRolePermissions; } export interface ProjectRolePermissions { allLanguages: boolean; languagesAccess: { [lang: string]: { allContent: boolean; workflowStepIds: number[]; }; }; }