UNPKG

woodwing-assets

Version:

TypeScript client for interacting with the WoodWing Assets Server API

36 lines (35 loc) 1.74 kB
import { AssetsConfig } from './AssetsConfig'; import { TokenResponse } from './interfaces/Response/Service'; export declare class AssetsError extends Error { code: number; constructor(code: number, message: string); } export declare class AssetsServerBase { protected readonly config: AssetsConfig; private tokenResponse; private readonly tokenValidity; private readonly axiosInstance; static readonly FOLDER_REPLACE_POLICY_AUTO_RENAME = "AUTO_RENAME"; static readonly FOLDER_REPLACE_POLICY_MERGE = "MERGE"; static readonly FOLDER_REPLACE_POLICY_THROW_EXCEPTION = "THROW_EXCEPTION"; static readonly FILE_REPLACE_POLICY_AUTO_RENAME = "AUTO_RENAME"; static readonly FILE_REPLACE_POLICY_OVERWRITE = "OVERWRITE"; static readonly FILE_REPLACE_POLICY_OVERWRITE_IF_NEWER = "OVERWRITE_IF_NEWER"; static readonly FILE_REPLACE_POLICY_REMOVE_SOURCE = "REMOVE_SOURCE"; static readonly FILE_REPLACE_POLICY_THROW_EXCEPTION = "THROW_EXCEPTION"; static readonly FILE_REPLACE_POLICY_DO_NOTHING = "DO_NOTHING"; constructor(config: AssetsConfig); get(service: string, params?: Record<string, any>): Promise<any>; post(service: string, data?: Record<string, any>, sendAsJson?: boolean): Promise<any>; put(service: string, data?: Record<string, any>, sendAsJson?: boolean): Promise<any>; delete(service: string, params?: Record<string, any>): Promise<any>; download(service: string, filePath: string): Promise<string>; setToken(TokenResponse: TokenResponse): void; getToken(): TokenResponse; isTokenValid(): boolean; private call; private callWithAuth; authenticate(): Promise<TokenResponse>; private downloadFile; private downloadFileWithAuth; }