import { Policy, BodyDescriptor } from '@unireq/core'; /** * @unireq/xml - XML parser policy using fast-xml-parser */ /** XML parser options (fast-xml-parser X2jOptions) */ interface XMLParserOptions { readonly ignoreAttributes?: boolean; readonly attributeNamePrefix?: string; readonly textNodeName?: string; readonly [key: string]: unknown; } /** XML builder options (fast-xml-parser XmlBuilderOptions) */ interface XMLBuilderOptions { readonly ignoreAttributes?: boolean; readonly attributeNamePrefix?: string; readonly textNodeName?: string; readonly format?: boolean; readonly indentBy?: string; readonly [key: string]: unknown; } /** * Creates an XML parser policy * @param options - fast-xml-parser options * @returns Policy that parses XML responses * * @example * ```ts * const xmlPolicy = xml({ * ignoreAttributes: false, * attributeNamePrefix: '@_' * }); * ``` */ declare function xml(options?: XMLParserOptions): Policy; /** * Create an XML body descriptor * Serializes an object to XML string using fast-xml-parser * * @param data - Data to serialize as XML * @param options - fast-xml-parser builder options * @returns BodyDescriptor for XML content * * @example * ```ts * import { xmlBody } from '@unireq/xml'; * import { client } from '@unireq/core'; * import { http } from '@unireq/http'; * * const api = client(http('https://api.example.com')); * const response = await api.post('/users', xmlBody({ user: { name: 'John', email: 'john@example.com' } })); * ``` */ declare function xmlBody(data: T, options?: XMLBuilderOptions): BodyDescriptor; export { type XMLBuilderOptions, type XMLParserOptions, xml, xmlBody };