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 BatchResponseContent
|
9 | */
|
10 | /**
|
11 | * @interface
|
12 | * Signature represents key value pair object
|
13 | */
|
14 | interface KeyValuePairObject {
|
15 | [key: string]: any;
|
16 | }
|
17 | /**
|
18 | * @interface
|
19 | * Signature representing Batch response body
|
20 | * @property {KeyValuePairObject[]} responses - An array of key value pair representing response object for every request
|
21 | * @property {string} [@odata.nextLink] - The nextLink value to get next set of responses in case of asynchronous batch requests
|
22 | */
|
23 | export interface BatchResponseBody {
|
24 | responses: KeyValuePairObject[];
|
25 | "@odata.nextLink"?: string;
|
26 | }
|
27 | /**
|
28 | * @class
|
29 | * Class that handles BatchResponseContent
|
30 | */
|
31 | export declare class BatchResponseContent {
|
32 | /**
|
33 | * To hold the responses
|
34 | */
|
35 | private responses;
|
36 | /**
|
37 | * Holds the next link url
|
38 | */
|
39 | private nextLink;
|
40 | /**
|
41 | * @public
|
42 | * @constructor
|
43 | * Creates the BatchResponseContent instance
|
44 | * @param {BatchResponseBody} response - The response body returned for batch request from server
|
45 | * @returns An instance of a BatchResponseContent
|
46 | */
|
47 | constructor(response: BatchResponseBody);
|
48 | /**
|
49 | * @private
|
50 | * Creates native Response object from the json representation of it.
|
51 | * @param {KeyValuePairObject} responseJSON - The response json value
|
52 | * Object instance
The Response |
53 | */
|
54 | private createResponseObject;
|
55 | /**
|
56 | * @public
|
57 | * Updates the Batch response content instance with given responses.
|
58 | * @param {BatchResponseBody} response - The response json representing batch response message
|
59 | * @returns Nothing
|
60 | */
|
61 | update(response: BatchResponseBody): void;
|
62 | /**
|
63 | * @public
|
64 | * To get the response of a request for a given request id
|
65 | * @param {string} requestId - The request id value
|
66 | * @returns The Response object instance for the particular request
|
67 | */
|
68 | getResponseById(requestId: string): Response;
|
69 | /**
|
70 | * @public
|
71 | * To get all the responses of the batch request
|
72 | * @returns The Map of id and Response objects
|
73 | */
|
74 | getResponses(): Map<string, Response>;
|
75 | /**
|
76 | * @public
|
77 | * To get the iterator for the responses
|
78 | * @returns The Iterable generator for the response objects
|
79 | */
|
80 | getResponsesIterator(): IterableIterator<[string, Response]>;
|
81 | }
|
82 | export {};
|