/** * NOTE: This class is auto generated by DANA Indonesia. * Do not edit the class manually. */ export declare const BASE_PATH: string; export declare const Env: { SANDBOX: string; PRODUCTION: string; }; export interface ConfigurationParameters { basePath?: string; fetchApi?: FetchAPI; middleware?: Middleware[]; queryParamsStringify?: (params: HTTPQuery) => string; username?: string; password?: string; apiKey?: string | Promise | ((name: string) => string | Promise); accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string | Promise); headers?: HTTPHeaders; credentials?: RequestCredentials; } export declare class Configuration { private configuration; constructor(configuration?: ConfigurationParameters); set config(configuration: Configuration); get basePath(): string; get fetchApi(): FetchAPI | undefined; get middleware(): Middleware[]; get queryParamsStringify(): (params: HTTPQuery) => string; get username(): string | undefined; get password(): string | undefined; get apiKey(): ((name: string) => string | Promise) | undefined; get accessToken(): ((name?: string, scopes?: string[]) => string | Promise) | undefined; get headers(): HTTPHeaders | undefined; get credentials(): RequestCredentials | undefined; } export declare const DefaultConfig: Configuration; /** * This is the base class for all generated API classes. */ export declare class BaseAPI { protected configuration: Configuration; private static readonly jsonRegex; private middleware; constructor(configuration?: Configuration); withMiddleware(this: T, ...middlewares: Middleware[]): T; withPreMiddleware(this: T, ...preMiddlewares: Array): T; withPostMiddleware(this: T, ...postMiddlewares: Array): T; /** * Check if the given MIME is a JSON MIME. * JSON MIME examples: * application/json * application/json; charset=UTF8 * APPLICATION/JSON * application/vnd.company+json * @param mime - MIME (Multipurpose Internet Mail Extensions) * @return True if the given MIME is JSON, false otherwise. */ protected isJsonMime(mime: string | null | undefined): boolean; protected request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise; private createFetchParams; private fetchApi; /** * Create a shallow clone of `this` by constructing a new instance * and then shallow cloning data members. */ private clone; } export declare class ResponseError extends Error { private response; name: "ResponseError"; rawResponse?: any; status: string; errorCode?: string; errorMessage?: string; constructor(response: any, status: any, statusText: any); } export declare class FetchError extends Error { cause: Error; name: "FetchError"; constructor(cause: Error, msg?: string); } export declare class RequiredError extends Error { field: string; name: "RequiredError"; constructor(field: string, msg?: string); } export declare class ValidationError extends Error { validationErrorContexts: ValidationErrorContext[]; name: "ValidationError"; constructor(validationErrorContexts: ValidationErrorContext[]); } export declare const COLLECTION_FORMATS: { csv: string; ssv: string; tsv: string; pipes: string; }; export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; export type Json = any; export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; export type HTTPHeaders = { [key: string]: string; }; export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery; }; export type HTTPBody = Json | FormData | URLSearchParams; export type HTTPRequestInit = { headers?: HTTPHeaders; method: HTTPMethod; credentials?: RequestCredentials; body?: HTTPBody; }; export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original'; export type InitOverrideFunction = (requestContext: { init: HTTPRequestInit; context: RequestOpts; }) => Promise; export interface FetchParams { url: string; init: RequestInit; } export interface RequestOpts { path: string; method: HTTPMethod; headers: HTTPHeaders; query?: HTTPQuery; body?: HTTPBody; } export declare function getBasePathByEnv(env: string): string; export declare function querystring(params: HTTPQuery, prefix?: string): string; export declare function exists(json: any, key: string): boolean; export declare function mapValues(data: any, fn: (item: any) => any): {}; export declare function canConsumeForm(consumes: Consume[]): boolean; export interface Consume { contentType: string; } export interface RequestContext { fetch: FetchAPI; url: string; init: RequestInit; } export interface ResponseContext { fetch: FetchAPI; url: string; init: RequestInit; response: Response; } export interface PropertyValidationAttribute { maxLength?: number; minLength?: number; pattern?: RegExp; maximum?: number; exclusiveMaximum?: boolean; minimum?: number; exclusiveMinimum?: boolean; multipleOf?: number; maxItems?: number; minItems?: number; uniqueItems?: boolean; maxDate?: string; } export interface ValidationErrorContext { field: string; message: string; } export interface ErrorContext { fetch: FetchAPI; url: string; init: RequestInit; error: unknown; response?: Response; } export interface Middleware { pre?(context: RequestContext): Promise; post?(context: ResponseContext): Promise; onError?(context: ErrorContext): Promise; } export interface ApiResponse { raw: Response; value(): Promise; } export interface ResponseTransformer { (json: any): T; } export declare class JSONApiResponse { raw: Response; private transformer; constructor(raw: Response, transformer?: ResponseTransformer); value(): Promise; } export declare class VoidApiResponse { raw: Response; constructor(raw: Response); value(): Promise; } export declare class BlobApiResponse { raw: Response; constructor(raw: Response); value(): Promise; } export declare class TextApiResponse { raw: Response; constructor(raw: Response); value(): Promise; } export declare class ValidationUtil { /** * Validates a property against a set of validation attributes. * @param field - The name of the field being validated. * @param value - The value of the field to validate. * @param attribute - The validation attributes to apply. * @returns An array of `ValidationErrorContext` objects describing the validation errors. */ static validateProperty(field: string, value: any, attribute: PropertyValidationAttribute): ValidationErrorContext[]; static getValidationErrorMessage(validationErrorContexts: ValidationErrorContext[]): string; } export declare class DanaHeaderUtil { /** * Populates the HTTP headers required for the Snap B2B scenario. * @param headerParameters - The HTTP headers object to populate. * @param httpMethod - The HTTP method (e.g., GET, POST). * @param endpointUrl - The API endpoint URL. * @param requestBody - The request body as a string. * @param privateKey - The private key used for generating the signature. * @param origin - The origin of the request. * @param partnerId - The partner ID. */ static populateSnapB2BScenarioHeader(headerParameters: HTTPHeaders, httpMethod: string, endpointUrl: string, requestBody: string, privateKey: string, origin: string, partnerId: string, debugMode: boolean): void; /** * Populates the HTTP headers required for the Snap B2B scenario. * @param headerParameters - The HTTP headers object to populate. * @param httpMethod - The HTTP method (e.g., GET, POST). * @param endpointUrl - The API endpoint URL. * @param requestBody - The request body as object * @param privateKey - The private key used for generating the signature. * @param clientSecret - The client secret used for generating the signature. * @param partnerId - The partner ID. * @param functionName - The function name. * @param accessToken - Optional access token to include in headers (widget-specific). */ static populateOpenApiScenarioHeader(headerParameters: HTTPHeaders, httpMethod: string, endpointUrl: string, requestBody: Record, privateKey: string, clientSecret: string, partnerId: string, functionName: string, accessToken?: string): void; /** * Populates the HTTP headers required for the Snap Apply Token scenario. * @param headerParameters - The HTTP headers object to populate. * @param privateKey - The private key used for generating the signature. * @param partnerId - The partner ID. */ static populateSnapApplyTokenScenarioHeader(headerParameters: HTTPHeaders, privateKey: string, partnerId: string): void; /** * Populates the HTTP headers required for the Snap Account B2B2C scenario. * @param headerParameters - The HTTP headers object to populate. * @param httpMethod - The HTTP method (e.g., GET, POST). * @param endpointUrl - The API endpoint URL. * @param requestBody - The request body as a string. * @param privateKey - The private key used for generating the signature. * @param origin - The origin of the request. * @param partnerId - The partner ID. * @param accessToken - The access token. * @param endUserIpAddress - The end user IP address. * @param deviceId - The device ID. * @param latitude - The latitude. * @param longitude - The longitude. */ static populateSnapAccountB2B2CScenarioHeader(headerParameters: HTTPHeaders, httpMethod: string, endpointUrl: string, requestBody: string, privateKey: string, origin: string, partnerId: string, accessToken: string, endUserIpAddress: string, deviceId: string, latitude: string, longitude: string): void; } export declare class DanaSignatureUtil { /** * Generates a signature for the Snap B2B scenario. * @param httpMethod - HTTP method (e.g., GET, POST). * @param endpointUrl - The API endpoint URL. * @param requestBody - The request body as a string. * @param privateKey - The private key used for generating the signature. * @param timestamp - The timestamp for the signature. * @returns The Base64-encoded signature. */ static generateSnapB2BScenarioSignature(httpMethod: string, endpointUrl: string, requestBody: string, privateKey: string, timestamp: string): string; /** * Generates a signature for the Snap Apply Token scenario. * @param partnerId - The partner ID. * @param privateKey - The private key used for generating the signature. * @param timestamp - The timestamp for the signature. * @returns The Base64-encoded signature. */ static generateSnapApplyTokenScenarioSignature(partnerId: string, privateKey: string, timestamp: string): string; static generateOpenApiScenarioSignature(privateKey: string, requestBody: string): string; /** * Generates the seamlessSign for Oauth Url * @param seamlessData The data object to be signed * @param privateKey The private key for signing * @returns URL-encoded signature string */ static generateSeamlessSign(seamlessData: object, privateKey: string): string; /** * Generates an asymmetric signature. * @param stringToSign - The string to sign. * @param privateKey - The private key used for generating the signature. * @returns The Base64-encoded signature. */ private static generateAsymmetricSignature; /** * Converts a private/public key to PEM format. * Normalizes line endings (CRLF/CR to LF) and escaped \\n for consistency across environments. * @param key - The key. * @param keyType - The type of key (e.g., PRIVATE, PUBLIC). * @returns The PEM-formatted key. */ static convertToPEM(key: string, keyType: string): string; /** * Splits a string into chunks of a specified size. * @param input - The input string. * @param chunkSize - The size of each chunk. * @returns An array of string chunks. */ private static splitStringIntoChunks; }