@microsoft/kiota-abstractions
Advanced tools
Comparing version 1.0.0-preview.43 to 1.0.0-preview.44
@@ -1,2 +0,2 @@ | ||
import type { ErrorMappings, PrimitiveTypesForDeserialization, RequestAdapter } from "./requestAdapter"; | ||
import type { ErrorMappings, PrimitiveTypesForDeserialization, RequestAdapter, SendMethods } from "./requestAdapter"; | ||
import { type RequestInformationSetContent } from "./requestInformation"; | ||
@@ -9,3 +9,3 @@ import type { ModelSerializerFunction, Parsable, ParsableFactory } from "./serialization"; | ||
errorMappings?: ErrorMappings; | ||
adapterMethodName?: keyof RequestAdapter; | ||
adapterMethodName?: SendMethods; | ||
responseBodyFactory?: ParsableFactory<Parsable> | PrimitiveTypesForDeserialization; | ||
@@ -12,0 +12,0 @@ requestBodySerializer?: ModelSerializerFunction<Parsable> | PrimitiveTypesForDeserialization; |
@@ -84,26 +84,26 @@ "use strict"; | ||
} | ||
function sendAsync(requestAdapter, requestInfo, metadata) { | ||
function send(requestAdapter, requestInfo, metadata) { | ||
switch (metadata.adapterMethodName) { | ||
case "sendAsync": | ||
case "send": | ||
if (!metadata.responseBodyFactory) { | ||
throw new Error("couldn't find response body factory"); | ||
} | ||
return requestAdapter.sendAsync(requestInfo, metadata.responseBodyFactory, metadata.errorMappings); | ||
case "sendCollectionAsync": | ||
return requestAdapter.send(requestInfo, metadata.responseBodyFactory, metadata.errorMappings); | ||
case "sendCollection": | ||
if (!metadata.responseBodyFactory) { | ||
throw new Error("couldn't find response body factory"); | ||
} | ||
return requestAdapter.sendCollectionAsync(requestInfo, metadata.responseBodyFactory, metadata.errorMappings); | ||
case "sendCollectionOfPrimitiveAsync": | ||
return requestAdapter.sendCollection(requestInfo, metadata.responseBodyFactory, metadata.errorMappings); | ||
case "sendCollectionOfPrimitive": | ||
if (!metadata.responseBodyFactory) { | ||
throw new Error("couldn't find response body factory"); | ||
} | ||
return requestAdapter.sendCollectionOfPrimitiveAsync(requestInfo, metadata.responseBodyFactory, metadata.errorMappings); | ||
case "sendPrimitiveAsync": | ||
return requestAdapter.sendCollectionOfPrimitive(requestInfo, metadata.responseBodyFactory, metadata.errorMappings); | ||
case "sendPrimitive": | ||
if (!metadata.responseBodyFactory) { | ||
throw new Error("couldn't find response body factory"); | ||
} | ||
return requestAdapter.sendPrimitiveAsync(requestInfo, metadata.responseBodyFactory, metadata.errorMappings); | ||
case "sendNoResponseContentAsync": | ||
return requestAdapter.sendNoResponseContentAsync(requestInfo, metadata.errorMappings); | ||
return requestAdapter.sendPrimitive(requestInfo, metadata.responseBodyFactory, metadata.errorMappings); | ||
case "sendNoResponseContent": | ||
return requestAdapter.sendNoResponseContent(requestInfo, metadata.errorMappings); | ||
default: | ||
@@ -137,3 +137,3 @@ throw new Error("couldn't find adapter method"); | ||
const requestInfo = toRequestInformation(metadata.uriTemplate, pathParameters, metadata, requestAdapter, httpMethod_1.HttpMethod.GET, undefined, undefined, requestConfiguration); | ||
return sendAsync(requestAdapter, requestInfo, metadata); | ||
return send(requestAdapter, requestInfo, metadata); | ||
}; | ||
@@ -143,3 +143,3 @@ case "patch": | ||
const requestInfo = toRequestInformation(metadata.uriTemplate, pathParameters, metadata, requestAdapter, httpMethod_1.HttpMethod.PATCH, args.length > 0 ? args[0] : undefined, getRequestMediaTypeUserDefinedValue(metadata, args), getRequestConfigurationValue(args)); | ||
return sendAsync(requestAdapter, requestInfo, metadata); | ||
return send(requestAdapter, requestInfo, metadata); | ||
}; | ||
@@ -149,3 +149,3 @@ case "put": | ||
const requestInfo = toRequestInformation(metadata.uriTemplate, pathParameters, metadata, requestAdapter, httpMethod_1.HttpMethod.PUT, args.length > 0 ? args[0] : undefined, getRequestMediaTypeUserDefinedValue(metadata, args), getRequestConfigurationValue(args)); | ||
return sendAsync(requestAdapter, requestInfo, metadata); | ||
return send(requestAdapter, requestInfo, metadata); | ||
}; | ||
@@ -155,3 +155,3 @@ case "delete": | ||
const requestInfo = toRequestInformation(metadata.uriTemplate, pathParameters, metadata, requestAdapter, httpMethod_1.HttpMethod.DELETE, args.length > 0 ? args[0] : undefined, getRequestMediaTypeUserDefinedValue(metadata, args), getRequestConfigurationValue(args)); | ||
return sendAsync(requestAdapter, requestInfo, metadata); | ||
return send(requestAdapter, requestInfo, metadata); | ||
}; | ||
@@ -161,3 +161,3 @@ case "post": | ||
const requestInfo = toRequestInformation(metadata.uriTemplate, pathParameters, metadata, requestAdapter, httpMethod_1.HttpMethod.POST, args.length > 0 ? args[0] : undefined, getRequestMediaTypeUserDefinedValue(metadata, args), getRequestConfigurationValue(args)); | ||
return sendAsync(requestAdapter, requestInfo, metadata); | ||
return send(requestAdapter, requestInfo, metadata); | ||
}; | ||
@@ -164,0 +164,0 @@ case "toGetRequestInformation": |
@@ -9,4 +9,4 @@ import type { ErrorMappings } from "./requestAdapter"; | ||
errorMappings: ErrorMappings | undefined; | ||
handleResponseAsync<NativeResponseType, ModelType>(response: NativeResponseType, errorMappings: ErrorMappings | undefined): Promise<ModelType>; | ||
handleResponse<NativeResponseType, ModelType>(response: NativeResponseType, errorMappings: ErrorMappings | undefined): Promise<ModelType>; | ||
} | ||
//# sourceMappingURL=nativeResponseHandler.d.ts.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
class NativeResponseHandler { | ||
handleResponseAsync(response, errorMappings) { | ||
handleResponse(response, errorMappings) { | ||
this.value = response; | ||
@@ -9,0 +9,0 @@ this.errorMappings = errorMappings; |
@@ -22,3 +22,3 @@ import type { DateOnly } from "./dateOnly"; | ||
*/ | ||
sendAsync<ModelType extends Parsable>(requestInfo: RequestInformation, type: ParsableFactory<ModelType>, errorMappings: ErrorMappings | undefined): Promise<ModelType | undefined>; | ||
send<ModelType extends Parsable>(requestInfo: RequestInformation, type: ParsableFactory<ModelType>, errorMappings: ErrorMappings | undefined): Promise<ModelType | undefined>; | ||
/** | ||
@@ -32,3 +32,3 @@ * Executes the HTTP request specified by the given RequestInformation and returns the deserialized response model collection. | ||
*/ | ||
sendCollectionAsync<ModelType extends Parsable>(requestInfo: RequestInformation, type: ParsableFactory<ModelType>, errorMappings: ErrorMappings | undefined): Promise<ModelType[] | undefined>; | ||
sendCollection<ModelType extends Parsable>(requestInfo: RequestInformation, type: ParsableFactory<ModelType>, errorMappings: ErrorMappings | undefined): Promise<ModelType[] | undefined>; | ||
/** | ||
@@ -43,3 +43,3 @@ * Executes the HTTP request specified by the given RequestInformation and returns the deserialized response model collection. | ||
*/ | ||
sendCollectionOfPrimitiveAsync<ResponseType extends Exclude<PrimitiveTypesForDeserializationType, ArrayBuffer>>(requestInfo: RequestInformation, responseType: Exclude<PrimitiveTypesForDeserialization, "ArrayBuffer">, errorMappings: ErrorMappings | undefined): Promise<ResponseType[] | undefined>; | ||
sendCollectionOfPrimitive<ResponseType extends Exclude<PrimitiveTypesForDeserializationType, ArrayBuffer>>(requestInfo: RequestInformation, responseType: Exclude<PrimitiveTypesForDeserialization, "ArrayBuffer">, errorMappings: ErrorMappings | undefined): Promise<ResponseType[] | undefined>; | ||
/** | ||
@@ -53,3 +53,3 @@ * Executes the HTTP request specified by the given RequestInformation and returns the deserialized primitive response model. | ||
*/ | ||
sendPrimitiveAsync<ResponseType extends PrimitiveTypesForDeserializationType>(requestInfo: RequestInformation, responseType: PrimitiveTypesForDeserialization, errorMappings: ErrorMappings | undefined): Promise<ResponseType | undefined>; | ||
sendPrimitive<ResponseType extends PrimitiveTypesForDeserializationType>(requestInfo: RequestInformation, responseType: PrimitiveTypesForDeserialization, errorMappings: ErrorMappings | undefined): Promise<ResponseType | undefined>; | ||
/** | ||
@@ -61,3 +61,3 @@ * Executes the HTTP request specified by the given RequestInformation and returns the deserialized primitive response model. | ||
*/ | ||
sendNoResponseContentAsync(requestInfo: RequestInformation, errorMappings: ErrorMappings | undefined): Promise<void>; | ||
sendNoResponseContent(requestInfo: RequestInformation, errorMappings: ErrorMappings | undefined): Promise<void>; | ||
/** | ||
@@ -76,3 +76,3 @@ * Enables the backing store proxies for the SerializationWriters and ParseNodes in use. | ||
*/ | ||
convertToNativeRequestAsync<T>(requestInfo: RequestInformation): Promise<T>; | ||
convertToNativeRequest<T>(requestInfo: RequestInformation): Promise<T>; | ||
} | ||
@@ -87,2 +87,3 @@ export interface ErrorMappings { | ||
export type PrimitiveTypesForDeserialization = "string" | "number" | "boolean" | "Date" | "DateOnly" | "TimeOnly" | "Duration" | "ArrayBuffer"; | ||
export type SendMethods = Exclude<keyof RequestAdapter, "enableBackingStore" | "getSerializationWriterFactory" | "convertToNativeRequest" | "baseUrl">; | ||
//# sourceMappingURL=requestAdapter.d.ts.map |
@@ -12,4 +12,4 @@ import { type ErrorMappings } from "./requestAdapter"; | ||
*/ | ||
handleResponseAsync<NativeResponseType, ModelType>(response: NativeResponseType, errorMappings: ErrorMappings | undefined): Promise<ModelType>; | ||
handleResponse<NativeResponseType, ModelType>(response: NativeResponseType, errorMappings: ErrorMappings | undefined): Promise<ModelType>; | ||
} | ||
//# sourceMappingURL=responseHandler.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import type { ErrorMappings, PrimitiveTypesForDeserialization, RequestAdapter } from "./requestAdapter"; | ||
import type { ErrorMappings, PrimitiveTypesForDeserialization, RequestAdapter, SendMethods } from "./requestAdapter"; | ||
import { type RequestInformationSetContent } from "./requestInformation"; | ||
@@ -9,3 +9,3 @@ import type { ModelSerializerFunction, Parsable, ParsableFactory } from "./serialization"; | ||
errorMappings?: ErrorMappings; | ||
adapterMethodName?: keyof RequestAdapter; | ||
adapterMethodName?: SendMethods; | ||
responseBodyFactory?: ParsableFactory<Parsable> | PrimitiveTypesForDeserialization; | ||
@@ -12,0 +12,0 @@ requestBodySerializer?: ModelSerializerFunction<Parsable> | PrimitiveTypesForDeserialization; |
@@ -81,26 +81,26 @@ import { getPathParameters } from "./getPathParameters"; | ||
} | ||
function sendAsync(requestAdapter, requestInfo, metadata) { | ||
function send(requestAdapter, requestInfo, metadata) { | ||
switch (metadata.adapterMethodName) { | ||
case "sendAsync": | ||
case "send": | ||
if (!metadata.responseBodyFactory) { | ||
throw new Error("couldn't find response body factory"); | ||
} | ||
return requestAdapter.sendAsync(requestInfo, metadata.responseBodyFactory, metadata.errorMappings); | ||
case "sendCollectionAsync": | ||
return requestAdapter.send(requestInfo, metadata.responseBodyFactory, metadata.errorMappings); | ||
case "sendCollection": | ||
if (!metadata.responseBodyFactory) { | ||
throw new Error("couldn't find response body factory"); | ||
} | ||
return requestAdapter.sendCollectionAsync(requestInfo, metadata.responseBodyFactory, metadata.errorMappings); | ||
case "sendCollectionOfPrimitiveAsync": | ||
return requestAdapter.sendCollection(requestInfo, metadata.responseBodyFactory, metadata.errorMappings); | ||
case "sendCollectionOfPrimitive": | ||
if (!metadata.responseBodyFactory) { | ||
throw new Error("couldn't find response body factory"); | ||
} | ||
return requestAdapter.sendCollectionOfPrimitiveAsync(requestInfo, metadata.responseBodyFactory, metadata.errorMappings); | ||
case "sendPrimitiveAsync": | ||
return requestAdapter.sendCollectionOfPrimitive(requestInfo, metadata.responseBodyFactory, metadata.errorMappings); | ||
case "sendPrimitive": | ||
if (!metadata.responseBodyFactory) { | ||
throw new Error("couldn't find response body factory"); | ||
} | ||
return requestAdapter.sendPrimitiveAsync(requestInfo, metadata.responseBodyFactory, metadata.errorMappings); | ||
case "sendNoResponseContentAsync": | ||
return requestAdapter.sendNoResponseContentAsync(requestInfo, metadata.errorMappings); | ||
return requestAdapter.sendPrimitive(requestInfo, metadata.responseBodyFactory, metadata.errorMappings); | ||
case "sendNoResponseContent": | ||
return requestAdapter.sendNoResponseContent(requestInfo, metadata.errorMappings); | ||
default: | ||
@@ -134,3 +134,3 @@ throw new Error("couldn't find adapter method"); | ||
const requestInfo = toRequestInformation(metadata.uriTemplate, pathParameters, metadata, requestAdapter, HttpMethod.GET, undefined, undefined, requestConfiguration); | ||
return sendAsync(requestAdapter, requestInfo, metadata); | ||
return send(requestAdapter, requestInfo, metadata); | ||
}; | ||
@@ -140,3 +140,3 @@ case "patch": | ||
const requestInfo = toRequestInformation(metadata.uriTemplate, pathParameters, metadata, requestAdapter, HttpMethod.PATCH, args.length > 0 ? args[0] : undefined, getRequestMediaTypeUserDefinedValue(metadata, args), getRequestConfigurationValue(args)); | ||
return sendAsync(requestAdapter, requestInfo, metadata); | ||
return send(requestAdapter, requestInfo, metadata); | ||
}; | ||
@@ -146,3 +146,3 @@ case "put": | ||
const requestInfo = toRequestInformation(metadata.uriTemplate, pathParameters, metadata, requestAdapter, HttpMethod.PUT, args.length > 0 ? args[0] : undefined, getRequestMediaTypeUserDefinedValue(metadata, args), getRequestConfigurationValue(args)); | ||
return sendAsync(requestAdapter, requestInfo, metadata); | ||
return send(requestAdapter, requestInfo, metadata); | ||
}; | ||
@@ -152,3 +152,3 @@ case "delete": | ||
const requestInfo = toRequestInformation(metadata.uriTemplate, pathParameters, metadata, requestAdapter, HttpMethod.DELETE, args.length > 0 ? args[0] : undefined, getRequestMediaTypeUserDefinedValue(metadata, args), getRequestConfigurationValue(args)); | ||
return sendAsync(requestAdapter, requestInfo, metadata); | ||
return send(requestAdapter, requestInfo, metadata); | ||
}; | ||
@@ -158,3 +158,3 @@ case "post": | ||
const requestInfo = toRequestInformation(metadata.uriTemplate, pathParameters, metadata, requestAdapter, HttpMethod.POST, args.length > 0 ? args[0] : undefined, getRequestMediaTypeUserDefinedValue(metadata, args), getRequestConfigurationValue(args)); | ||
return sendAsync(requestAdapter, requestInfo, metadata); | ||
return send(requestAdapter, requestInfo, metadata); | ||
}; | ||
@@ -161,0 +161,0 @@ case "toGetRequestInformation": |
@@ -9,4 +9,4 @@ import type { ErrorMappings } from "./requestAdapter"; | ||
errorMappings: ErrorMappings | undefined; | ||
handleResponseAsync<NativeResponseType, ModelType>(response: NativeResponseType, errorMappings: ErrorMappings | undefined): Promise<ModelType>; | ||
handleResponse<NativeResponseType, ModelType>(response: NativeResponseType, errorMappings: ErrorMappings | undefined): Promise<ModelType>; | ||
} | ||
//# sourceMappingURL=nativeResponseHandler.d.ts.map |
/** Default response handler to access the native response object. */ | ||
export class NativeResponseHandler { | ||
handleResponseAsync(response, errorMappings) { | ||
handleResponse(response, errorMappings) { | ||
this.value = response; | ||
@@ -5,0 +5,0 @@ this.errorMappings = errorMappings; |
@@ -22,3 +22,3 @@ import type { DateOnly } from "./dateOnly"; | ||
*/ | ||
sendAsync<ModelType extends Parsable>(requestInfo: RequestInformation, type: ParsableFactory<ModelType>, errorMappings: ErrorMappings | undefined): Promise<ModelType | undefined>; | ||
send<ModelType extends Parsable>(requestInfo: RequestInformation, type: ParsableFactory<ModelType>, errorMappings: ErrorMappings | undefined): Promise<ModelType | undefined>; | ||
/** | ||
@@ -32,3 +32,3 @@ * Executes the HTTP request specified by the given RequestInformation and returns the deserialized response model collection. | ||
*/ | ||
sendCollectionAsync<ModelType extends Parsable>(requestInfo: RequestInformation, type: ParsableFactory<ModelType>, errorMappings: ErrorMappings | undefined): Promise<ModelType[] | undefined>; | ||
sendCollection<ModelType extends Parsable>(requestInfo: RequestInformation, type: ParsableFactory<ModelType>, errorMappings: ErrorMappings | undefined): Promise<ModelType[] | undefined>; | ||
/** | ||
@@ -43,3 +43,3 @@ * Executes the HTTP request specified by the given RequestInformation and returns the deserialized response model collection. | ||
*/ | ||
sendCollectionOfPrimitiveAsync<ResponseType extends Exclude<PrimitiveTypesForDeserializationType, ArrayBuffer>>(requestInfo: RequestInformation, responseType: Exclude<PrimitiveTypesForDeserialization, "ArrayBuffer">, errorMappings: ErrorMappings | undefined): Promise<ResponseType[] | undefined>; | ||
sendCollectionOfPrimitive<ResponseType extends Exclude<PrimitiveTypesForDeserializationType, ArrayBuffer>>(requestInfo: RequestInformation, responseType: Exclude<PrimitiveTypesForDeserialization, "ArrayBuffer">, errorMappings: ErrorMappings | undefined): Promise<ResponseType[] | undefined>; | ||
/** | ||
@@ -53,3 +53,3 @@ * Executes the HTTP request specified by the given RequestInformation and returns the deserialized primitive response model. | ||
*/ | ||
sendPrimitiveAsync<ResponseType extends PrimitiveTypesForDeserializationType>(requestInfo: RequestInformation, responseType: PrimitiveTypesForDeserialization, errorMappings: ErrorMappings | undefined): Promise<ResponseType | undefined>; | ||
sendPrimitive<ResponseType extends PrimitiveTypesForDeserializationType>(requestInfo: RequestInformation, responseType: PrimitiveTypesForDeserialization, errorMappings: ErrorMappings | undefined): Promise<ResponseType | undefined>; | ||
/** | ||
@@ -61,3 +61,3 @@ * Executes the HTTP request specified by the given RequestInformation and returns the deserialized primitive response model. | ||
*/ | ||
sendNoResponseContentAsync(requestInfo: RequestInformation, errorMappings: ErrorMappings | undefined): Promise<void>; | ||
sendNoResponseContent(requestInfo: RequestInformation, errorMappings: ErrorMappings | undefined): Promise<void>; | ||
/** | ||
@@ -76,3 +76,3 @@ * Enables the backing store proxies for the SerializationWriters and ParseNodes in use. | ||
*/ | ||
convertToNativeRequestAsync<T>(requestInfo: RequestInformation): Promise<T>; | ||
convertToNativeRequest<T>(requestInfo: RequestInformation): Promise<T>; | ||
} | ||
@@ -87,2 +87,3 @@ export interface ErrorMappings { | ||
export type PrimitiveTypesForDeserialization = "string" | "number" | "boolean" | "Date" | "DateOnly" | "TimeOnly" | "Duration" | "ArrayBuffer"; | ||
export type SendMethods = Exclude<keyof RequestAdapter, "enableBackingStore" | "getSerializationWriterFactory" | "convertToNativeRequest" | "baseUrl">; | ||
//# sourceMappingURL=requestAdapter.d.ts.map |
@@ -12,4 +12,4 @@ import { type ErrorMappings } from "./requestAdapter"; | ||
*/ | ||
handleResponseAsync<NativeResponseType, ModelType>(response: NativeResponseType, errorMappings: ErrorMappings | undefined): Promise<ModelType>; | ||
handleResponse<NativeResponseType, ModelType>(response: NativeResponseType, errorMappings: ErrorMappings | undefined): Promise<ModelType>; | ||
} | ||
//# sourceMappingURL=responseHandler.d.ts.map |
{ | ||
"name": "@microsoft/kiota-abstractions", | ||
"version": "1.0.0-preview.43", | ||
"version": "1.0.0-preview.44", | ||
"description": "Core abstractions for kiota generated libraries in TypeScript and JavaScript", | ||
@@ -47,3 +47,3 @@ "main": "dist/cjs/src/index.js", | ||
}, | ||
"gitHead": "dd167e6041af0c44387672076ebb3a1c0079edc2" | ||
"gitHead": "98776bbe189b55218a14ba4759d0a3acd93297d8" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
657253
7356