UNPKG

2.46 kBTypeScriptView Raw
1import { HttpResponse } from '../../../http-client';
2/**
3 * Detects the system dependent line break in a string.
4 * @param str - The string to check for line breaks. Should have at least two lines, otherwise an error will be thrown.
5 * @returns The system dependent line break
6 */
7export declare function detectNewLineSymbol(str: string): string;
8/**
9 * Get the response body from the string representation of a response.
10 * @param response - String representation of a response.
11 * @returns The response body as a one line string.
12 */
13export declare function getResponseBody(response: string): string;
14/**
15 * Split a batch response into an array of sub responses for the retrieve requests and changesets.
16 * @param response - The raw HTTP response.
17 * @returns A list of sub responses represented as strings.
18 */
19export declare function splitBatchResponse(response: HttpResponse): string[];
20/**
21 * Split a changeset (sub) response into an array of sub responses.
22 * @param changeSetResponse - The string representation of a change set response.
23 * @returns A list of sub responses represented as strings.
24 */
25export declare function splitChangeSetResponse(changeSetResponse: string): string[];
26/**
27 * Split a string representation of a response into sub responses given its boundary.
28 * @param response - The string representation of the response to split.
29 * @param boundary - The boundary to split by.
30 * @returns A list of sub responses represented as strings.
31 */
32export declare function splitResponse(response: string, boundary: string): string[];
33/**
34 * Parse the HTTP code of response.
35 * @param response - String representation of the response.
36 * @returns The HTTP code.
37 */
38export declare function parseHttpCode(response: string): number;
39/**
40 * Parse the body and http code of a batch sub response.
41 * @param response - A batch sub response.
42 * @returns The parsed response.s
43 */
44export declare function parseResponseData(response: string): ResponseData;
45/**
46 * Parse the complete batch HTTP response.
47 * @param batchResponse - HTTP response of a batch request.
48 * @returns An array of parsed sub responses of the batch response.
49 */
50export declare function parseBatchResponse(batchResponse: HttpResponse): (ResponseData | ResponseData[])[];
51export declare function isHttpSuccessCode(httpCode: number): boolean;
52export interface ResponseData {
53 body: Record<string, any>;
54 httpCode: number;
55}
56//# sourceMappingURL=batch-response-parser.d.ts.map
\No newline at end of file