@adyen/api-library
Version:
The Adyen API Library for NodeJS enables you to work with Adyen APIs.
52 lines (51 loc) • 2.27 kB
TypeScript
export * from "./models";
export declare class ObjectSerializer {
static findCorrectType(data: any, expectedType: string): any;
/**
* Serializes a value into a plain JSON-compatible object based on its type.
*
* Supports primitives, arrays, maps, dates, enums, and classes defined in `typeMap`.
* Falls back to raw data if type is unknown or lacks `getAttributeTypeMap()`.
*
* @param data - The value to serialize.
* @param type - The expected type name as a string.
* @param format - Format hint (e.g. "date" or "date-time"). Default is an empty string.
* @returns A JSON-compatible representation of `data`.
*/
static serialize(data: any, type: string, format?: string): any;
/**
* Deserializes a plain JSON-compatible object into a typed instance.
*
* Handles primitives, arrays, maps, dates, enums, and known classes from `typeMap`.
* Uses discriminators when available to resolve polymorphic types.
* Falls back to raw data if the type is unknown or lacks `getAttributeTypeMap()`.
*
* @param data - The raw input to deserialize.
* @param type - The expected type name as a string.
* @param format - Format hint (e.g. "date" or "date-time"). Default is an empty string.
* @returns A deserialized instance or value of `data`.
*/
static deserialize(data: any, type: string, format?: string): any;
/**
* Normalize media type
*
* We currently do not handle any media types attributes, i.e. anything
* after a semicolon. All content is assumed to be UTF-8 compatible.
*/
static normalizeMediaType(mediaType: string | undefined): string | undefined;
/**
* From a list of possible media types, choose the one we can handle best.
*
* The order of the given media types does not have any impact on the choice
* made.
*/
static getPreferredMediaType(mediaTypes: Array<string>): string;
/**
* Convert data to a string according the given media type
*/
static stringify(data: any, mediaType: string): string;
/**
* Parse data from a string according to the given media type
*/
static parse(rawData: string, mediaType: string | undefined): any;
}