/** * Helper utilities for working with metadata fields * * The GoCardless API requires metadata values to be strings. * These helpers make it easy to convert other types to strings. */ /** * Convert any value to a string suitable for metadata * * @example * const metadata = { * user_id: toMetadataValue(12345), // "12345" * is_active: toMetadataValue(true), // "true" * settings: toMetadataValue({theme: 'dark'}) // '{"theme":"dark"}' * }; */ export declare function toMetadataValue(value: unknown): string; /** * Convert an object with mixed values to metadata-compatible format * * @example * const metadata = toMetadata({ * user_id: 12345, * is_active: true, * tags: ['vip', 'early_bird'] * }); * // Result: { user_id: "12345", is_active: "true", tags: '["vip","early_bird"]' } */ export declare function toMetadata(obj: Record): { [key: string]: string; }; /** * Type guard to check if an object is valid metadata */ export declare function isValidMetadata(obj: unknown): obj is { [key: string]: string; }; /** * Parse a metadata value back to its original type * Useful for reading metadata from API responses * * @example * const userId = parseMetadataValue(metadata.user_id, 'number'); // 12345 * const isActive = parseMetadataValue(metadata.is_active, 'boolean'); // true */ export declare function parseMetadataValue(value: string, type: 'string'): string; export declare function parseMetadataValue(value: string, type: 'number'): number; export declare function parseMetadataValue(value: string, type: 'boolean'): boolean; export declare function parseMetadataValue(value: string, type: 'json'): unknown; //# sourceMappingURL=metadata-helpers.d.ts.map