@microsoft/msgraph-sdk-core
Version:
Core functionalities for the Microsoft Graph JavaScript SDK
98 lines • 3.99 kB
TypeScript
import { RequestAdapter, RequestInformation, ErrorMappings } from "@microsoft/kiota-abstractions";
import { BatchRequestStep, BatchRequestBody } from "./BatchRequestStep.js";
import { BatchResponseContent } from "./BatchResponseContent.js";
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
/**
* @module BatchRequestContent
*/
/**
* Represents the content of a batch request.
*/
export declare class BatchRequestContent {
/**
* @private
* @static
* Limit for number of requests {@link - https://developer.microsoft.com/en-us/graph/docs/concepts/known_issues#json-batching}
*/
private static get requestLimit();
/**
* @public
* To keep track of requests, key will be id of the request and value will be the request json
*/
requests: Map<string, BatchRequestStep>;
/**
* @private
* @static
* Executes the requests in the batch request content
*/
private readonly requestAdapter;
/**
* @private
* @static
* Error mappings to be used while deserializing the response
*/
private readonly errorMappings;
/**
* Creates an instance of BatchRequestContent.
* @param {RequestAdapter} requestAdapter - The request adapter to be used for executing the requests.
* @param {ErrorMappings} errorMappings - The error mappings to be used while deserializing the response.
* @throws {Error} If the request adapter is undefined.
* @throws {Error} If the error mappings are undefined.
*/
constructor(requestAdapter: RequestAdapter, errorMappings: ErrorMappings);
/**
* @private
* @static
* Validates the dependency chain of the requests
*
* Note:
* Individual requests can depend on other individual requests. Currently, requests can only depend on a single other request, and must follow one of these three patterns:
* 1. Parallel - no individual request states a dependency in the dependsOn property.
* 2. Serial - all individual requests depend on the previous individual request.
* 3. Same - all individual requests that state a dependency in the dependsOn property, state the same dependency.
* As JSON batching matures, these limitations will be removed.
* @see {@link https://developer.microsoft.com/en-us/graph/docs/concepts/known_issues#json-batching}
*
* @param {Map<string, BatchRequestStep>} requests - The map of requests.
* @returns The boolean indicating the validation status
*/
private static validateDependencies;
/**
* @public
* Adds a request to the batch request content
* @param {BatchRequestStep} request - The request value
* @returns The id of the added request
*/
private addRequest;
/**
* @public
* Adds multiple requests to the batch request content
* @param {BatchRequestStep[]} requests - The request value
*/
addRequests(requests: BatchRequestStep[]): void;
/**
* @public
* Receives a request information object, converts it and adds it to the batch request execution chain
* @param requestInformation - The request information object
* @param batchId - The batch id to be used for the request
*/
addBatchRequest(requestInformation: RequestInformation, batchId?: string): BatchRequestStep;
/**
* @public
* Gets the content of the batch request
* @returns The batch request collection
*/
readonly getContent: () => BatchRequestBody;
/**
* @public
* @async
* Executes the batch request
*/
postAsync(): Promise<BatchResponseContent | undefined>;
}
//# sourceMappingURL=BatchRequestContent.d.ts.map