@microsoft/kiota-abstractions
Version:
Core abstractions for kiota generated libraries in TypeScript and JavaScript
108 lines • 5.22 kB
TypeScript
import { Headers } from "./headers.js";
import { type HttpMethod } from "./httpMethod.js";
import type { PrimitiveTypesForDeserializationType, RequestAdapter } from "./requestAdapter.js";
import type { RequestConfiguration } from "./requestConfiguration.js";
import type { RequestOption } from "./requestOption.js";
import type { ModelSerializerFunction, Parsable } from "./serialization/index.js";
/** This class represents an abstract HTTP request. */
export declare class RequestInformation implements RequestInformationSetContent {
/**
* Initializes a request information instance with the provided values.
* @param httpMethod The HTTP method for the request.
* @param urlTemplate The URL template for the request.
* @param pathParameters The path parameters for the request.
*/
constructor(httpMethod?: HttpMethod, urlTemplate?: string, pathParameters?: Record<string, unknown>);
/** The URI of the request. */
private uri?;
/** The path parameters for the request. */
pathParameters: Record<string, unknown>;
/** The URL template for the request */
urlTemplate?: string;
/**
* Gets the URL of the request
* @returns the url string
*/
get URL(): string;
/** Sets the URL of the request */
set URL(url: string);
static readonly raw_url_key = "request-raw-url";
/** The HTTP method for the request */
httpMethod?: HttpMethod;
/** The Request Body. */
content?: ArrayBuffer;
/** The Query Parameters of the request. */
queryParameters: Record<string, string | number | boolean | string[] | number[] | undefined>;
/** The Request Headers. */
headers: Headers;
private _requestOptions;
/**
* Gets the request options for the request.
* @returns the request options.
*/
getRequestOptions(): Record<string, RequestOption>;
/**
* Adds the headers for the request.
* @param source The source collection to add the headers to
*/
addRequestHeaders(source: Record<string, string | string[]> | undefined): void;
/**
* Adds the request options for the request.
* @param options the options to add.
*/
addRequestOptions(options: RequestOption[] | undefined): void;
/**
* Removes the request options for the request.
* @param options the options to remove.
*/
removeRequestOptions(...options: RequestOption[]): void;
private static readonly binaryContentType;
private static readonly contentTypeHeader;
private static readonly tracerKey;
private static readonly requestTypeKey;
/**
* Sets the request body from a model with the specified content type.
* @param requestAdapter The adapter service to get the serialization writer from.
* @param contentType the content type.
* @param value the models.
* @param modelSerializerFunction the serialization function for the model type.
*/
setContentFromParsable: <T extends Parsable>(requestAdapter?: RequestAdapter, contentType?: string, value?: T[] | T, modelSerializerFunction?: ModelSerializerFunction<T>) => void;
private readonly setContentAndContentType;
private readonly getSerializationWriter;
/**
* Sets the request body from a model with the specified content type.
* @param requestAdapter The adapter service to get the serialization writer from.
* @param contentType the content type.
* @param value the scalar values to serialize.
*/
setContentFromScalar: <T extends PrimitiveTypesForDeserializationType>(requestAdapter: RequestAdapter | undefined, contentType: string | undefined, value: T[] | T) => void;
/**
* Sets the request body to be a binary stream.
* @param value the binary stream
* @param contentType the content type.
*/
setStreamContent: (value: ArrayBuffer, contentType?: string) => void;
private normalizeValue;
/**
* Sets the query string parameters from a raw object.
* @param q parameters the parameters.
* @param p the mapping from code symbol to URI template parameter name.
*/
setQueryStringParametersFromRawObject<T extends object>(q?: T, p?: Record<string, string>): void;
/**
* Configure the current request with headers, query parameters and options.
* @param config the configuration object to use.
* @param queryParametersMapper mapping between code symbols and URI template parameter names.
*/
configure<T extends object>(config?: RequestConfiguration<T>, queryParametersMapper?: Record<string, string>): void;
}
/**
* Describes the contract of request adapter set content methods so it can be used in request metadata.
*/
export interface RequestInformationSetContent {
setStreamContent(value: ArrayBuffer, contentType?: string): void;
setContentFromScalar<T extends PrimitiveTypesForDeserializationType>(requestAdapter: RequestAdapter | undefined, contentType: string | undefined, value: T[] | T): void;
setContentFromParsable<T extends Parsable>(requestAdapter?: RequestAdapter, contentType?: string, value?: T[] | T, modelSerializerFunction?: ModelSerializerFunction<T>): void;
}
//# sourceMappingURL=requestInformation.d.ts.map