cybersource-rest-client-typescript
Version:
NodeJS client for cybersource-rest-client-typescript
40 lines (39 loc) • 2.09 kB
TypeScript
import { Request, Response } from 'superagent';
import { Configuration } from './authentication/core/Configuration';
declare enum CollectionFormatEnum {
CSV = ",",
SSV = " ",
TSV = "\t",
PIPES = "|",
MULTI = "multi"
}
export type ApiCallback<T = unknown> = (error?: string, data?: T, reaponse?: Response) => void;
declare class ApiClient {
constructor();
basePath: string;
authentications: Record<string, string>;
defaultHeaders: Record<string, string>;
timeout: number;
cache: boolean;
enableCookies: boolean;
downloadFilePath: string;
acceptHeader: string;
paramToString(param: any): string;
buildUrl(path: string, pathParams: Record<string, string>): string;
isJsonMime(code: string): boolean;
jsonPreferredMime(contentTypes: string[]): string;
isFileParam(param: any): boolean;
normalizeParams(params: Record<string, any>): Record<string, any>;
buildCollectionParam(param: any[], collectionFormat: CollectionFormatEnum): null | string[];
applyAuthToRequest(request: any, authNames: string[]): void;
deserialize(response: Response, returnType: any): any;
setConfiguration(configObject: Configuration): void;
callAuthenticationHeader(httpMethod: string, requestTarget: string, requestBody: string, headerParams: Record<string, string>): Record<string, string>;
callApi<T = unknown>(path: string, httpMethod: string, pathParam: Record<string, string>, queryParams: Record<string, any>, headerParams: Record<string, any>, formParams: Record<string, any>, bodyParam: Record<string, any>, authNames: string[], contentTypes: string[], accepts: string[], returnType: any, callback: ApiCallback<T>): Request;
buildRequestTarget(path: string, pathParams: Record<string, string>, queryParams: Record<string, any>): string;
static parseDate(str: string): Date;
static convertToType(data: any, type: any): any;
static constructFromObject<T = any>(data: T, obj: T, itemType: any): void;
static CollectionFormatEnum: typeof CollectionFormatEnum;
}
export default ApiClient;