1 | /**
|
2 | * -------------------------------------------------------------------------------------------
|
3 | * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
|
4 | * See License in the project root for license information.
|
5 | * -------------------------------------------------------------------------------------------
|
6 | */
|
7 | /**
|
8 | * @module GraphResponseHandler
|
9 | * References - https://fetch.spec.whatwg.org/#responses
|
10 | */
|
11 | import { GraphRequestCallback } from "./IGraphRequestCallback";
|
12 | import { ResponseType } from "./ResponseType";
|
13 | /**
|
14 | * @enum
|
15 | * Enum for document types
|
16 | * @property {string} TEXT_HTML - The text/html content type
|
17 | * @property {string} TEXT_XML - The text/xml content type
|
18 | * @property {string} APPLICATION_XML - The application/xml content type
|
19 | * @property {string} APPLICATION_XHTML - The application/xhml+xml content type
|
20 | */
|
21 | export declare enum DocumentType {
|
22 | TEXT_HTML = "text/html",
|
23 | TEXT_XML = "text/xml",
|
24 | APPLICATION_XML = "application/xml",
|
25 | APPLICATION_XHTML = "application/xhtml+xml"
|
26 | }
|
27 | /**
|
28 | * @class
|
29 | * Class for GraphResponseHandler
|
30 | */
|
31 | export declare class GraphResponseHandler {
|
32 | /**
|
33 | * @private
|
34 | * @static
|
35 | * To parse Document response
|
36 | * @param {Response} rawResponse - The response object
|
37 | * @param {DocumentType} type - The type to which the document needs to be parsed
|
38 | * @returns A promise that resolves to a document content
|
39 | */
|
40 | private static parseDocumentResponse;
|
41 | /**
|
42 | * @private
|
43 | * @static
|
44 | * @async
|
45 | * To convert the native Response to response content
|
46 | * @param {Response} rawResponse - The response object
|
47 | * @param {ResponseType} [responseType] - The response type value
|
48 | * @returns A promise that resolves to the converted response content
|
49 | */
|
50 | private static convertResponse;
|
51 | /**
|
52 | * @public
|
53 | * @static
|
54 | * @async
|
55 | * To get the parsed response
|
56 | * @param {Response} rawResponse - The response object
|
57 | * @param {ResponseType} [responseType] - The response type value
|
58 | * @param {GraphRequestCallback} [callback] - The graph request callback function
|
59 | * @returns The parsed response
|
60 | */
|
61 | static getResponse(rawResponse: Response, responseType?: ResponseType, callback?: GraphRequestCallback): Promise<any>;
|
62 | }
|