@sap-cloud-sdk/core
Version:
SAP Cloud SDK for JavaScript core
56 lines • 2.46 kB
TypeScript
import { HttpResponse } from '../../../http-client';
/**
* Detects the system dependent line break in a string.
* @param str - The string to check for line breaks. Should have at least two lines, otherwise an error will be thrown.
* @returns The system dependent line break
*/
export declare function detectNewLineSymbol(str: string): string;
/**
* Get the response body from the string representation of a response.
* @param response - String representation of a response.
* @returns The response body as a one line string.
*/
export declare function getResponseBody(response: string): string;
/**
* Split a batch response into an array of sub responses for the retrieve requests and changesets.
* @param response - The raw HTTP response.
* @returns A list of sub responses represented as strings.
*/
export declare function splitBatchResponse(response: HttpResponse): string[];
/**
* Split a changeset (sub) response into an array of sub responses.
* @param changeSetResponse - The string representation of a change set response.
* @returns A list of sub responses represented as strings.
*/
export declare function splitChangeSetResponse(changeSetResponse: string): string[];
/**
* Split a string representation of a response into sub responses given its boundary.
* @param response - The string representation of the response to split.
* @param boundary - The boundary to split by.
* @returns A list of sub responses represented as strings.
*/
export declare function splitResponse(response: string, boundary: string): string[];
/**
* Parse the HTTP code of response.
* @param response - String representation of the response.
* @returns The HTTP code.
*/
export declare function parseHttpCode(response: string): number;
/**
* Parse the body and http code of a batch sub response.
* @param response - A batch sub response.
* @returns The parsed response.s
*/
export declare function parseResponseData(response: string): ResponseData;
/**
* Parse the complete batch HTTP response.
* @param batchResponse - HTTP response of a batch request.
* @returns An array of parsed sub responses of the batch response.
*/
export declare function parseBatchResponse(batchResponse: HttpResponse): (ResponseData | ResponseData[])[];
export declare function isHttpSuccessCode(httpCode: number): boolean;
export interface ResponseData {
body: Record<string, any>;
httpCode: number;
}
//# sourceMappingURL=batch-response-parser.d.ts.map