Skip to content

Commit 98776bb

Browse files
authored
Merge pull request #1087 from microsoft/remove-async-suffix-for-request-adapter-methods
remove async suffix for request adapter methods
2 parents 0082880 + 3d4e74c commit 98776bb

File tree

62 files changed

+261
-204
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+261
-204
lines changed

package-lock.json

+16-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/abstractions/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/kiota-abstractions",
3-
"version": "1.0.0-preview.43",
3+
"version": "1.0.0-preview.44",
44
"description": "Core abstractions for kiota generated libraries in TypeScript and JavaScript",
55
"main": "dist/cjs/src/index.js",
66
"module": "dist/es/src/index.js",

packages/abstractions/src/apiClientProxifier.ts

+18-17
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type {
55
PrimitiveTypesForDeserialization,
66
PrimitiveTypesForDeserializationType,
77
RequestAdapter,
8+
SendMethods,
89
} from "./requestAdapter";
910
import type { RequestConfiguration } from "./requestConfiguration";
1011
import {
@@ -125,53 +126,53 @@ function getRequestConfigurationValue(args: any[]) {
125126
}
126127
return undefined;
127128
}
128-
function sendAsync(
129+
function send(
129130
requestAdapter: RequestAdapter,
130131
requestInfo: RequestInformation,
131132
metadata: RequestMetadata,
132133
) {
133134
switch (metadata.adapterMethodName) {
134-
case "sendAsync":
135+
case "send":
135136
if (!metadata.responseBodyFactory) {
136137
throw new Error("couldn't find response body factory");
137138
}
138-
return requestAdapter.sendAsync(
139+
return requestAdapter.send(
139140
requestInfo,
140141
metadata.responseBodyFactory as ParsableFactory<Parsable>,
141142
metadata.errorMappings,
142143
);
143-
case "sendCollectionAsync":
144+
case "sendCollection":
144145
if (!metadata.responseBodyFactory) {
145146
throw new Error("couldn't find response body factory");
146147
}
147-
return requestAdapter.sendCollectionAsync(
148+
return requestAdapter.sendCollection(
148149
requestInfo,
149150
metadata.responseBodyFactory as ParsableFactory<Parsable>,
150151
metadata.errorMappings,
151152
);
152-
case "sendCollectionOfPrimitiveAsync":
153+
case "sendCollectionOfPrimitive":
153154
if (!metadata.responseBodyFactory) {
154155
throw new Error("couldn't find response body factory");
155156
}
156-
return requestAdapter.sendCollectionOfPrimitiveAsync(
157+
return requestAdapter.sendCollectionOfPrimitive(
157158
requestInfo,
158159
metadata.responseBodyFactory as Exclude<
159160
PrimitiveTypesForDeserialization,
160161
"ArrayBuffer"
161162
>,
162163
metadata.errorMappings,
163164
);
164-
case "sendPrimitiveAsync":
165+
case "sendPrimitive":
165166
if (!metadata.responseBodyFactory) {
166167
throw new Error("couldn't find response body factory");
167168
}
168-
return requestAdapter.sendPrimitiveAsync(
169+
return requestAdapter.sendPrimitive(
169170
requestInfo,
170171
metadata.responseBodyFactory as PrimitiveTypesForDeserialization,
171172
metadata.errorMappings,
172173
);
173-
case "sendNoResponseContentAsync":
174-
return requestAdapter.sendNoResponseContentAsync(
174+
case "sendNoResponseContent":
175+
return requestAdapter.sendNoResponseContent(
175176
requestInfo,
176177
metadata.errorMappings,
177178
);
@@ -223,7 +224,7 @@ export function apiClientProxifier<T extends object>(
223224
undefined,
224225
requestConfiguration,
225226
);
226-
return sendAsync(requestAdapter, requestInfo, metadata);
227+
return send(requestAdapter, requestInfo, metadata);
227228
};
228229
case "patch":
229230
return (...args: any[]) => {
@@ -237,7 +238,7 @@ export function apiClientProxifier<T extends object>(
237238
getRequestMediaTypeUserDefinedValue(metadata, args),
238239
getRequestConfigurationValue(args),
239240
);
240-
return sendAsync(requestAdapter, requestInfo, metadata);
241+
return send(requestAdapter, requestInfo, metadata);
241242
};
242243
case "put":
243244
return (...args: any[]) => {
@@ -251,7 +252,7 @@ export function apiClientProxifier<T extends object>(
251252
getRequestMediaTypeUserDefinedValue(metadata, args),
252253
getRequestConfigurationValue(args),
253254
);
254-
return sendAsync(requestAdapter, requestInfo, metadata);
255+
return send(requestAdapter, requestInfo, metadata);
255256
};
256257
case "delete":
257258
return (...args: any[]) => {
@@ -265,7 +266,7 @@ export function apiClientProxifier<T extends object>(
265266
getRequestMediaTypeUserDefinedValue(metadata, args),
266267
getRequestConfigurationValue(args),
267268
);
268-
return sendAsync(requestAdapter, requestInfo, metadata);
269+
return send(requestAdapter, requestInfo, metadata);
269270
};
270271
case "post":
271272
return (...args: any[]) => {
@@ -279,7 +280,7 @@ export function apiClientProxifier<T extends object>(
279280
getRequestMediaTypeUserDefinedValue(metadata, args),
280281
getRequestConfigurationValue(args),
281282
);
282-
return sendAsync(requestAdapter, requestInfo, metadata);
283+
return send(requestAdapter, requestInfo, metadata);
283284
};
284285
case "toGetRequestInformation":
285286
return (
@@ -405,7 +406,7 @@ export interface RequestMetadata {
405406
requestBodyContentType?: string;
406407
responseBodyContentType?: string;
407408
errorMappings?: ErrorMappings;
408-
adapterMethodName?: keyof RequestAdapter;
409+
adapterMethodName?: SendMethods;
409410
responseBodyFactory?:
410411
| ParsableFactory<Parsable>
411412
| PrimitiveTypesForDeserialization;

packages/abstractions/src/nativeResponseHandler.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export class NativeResponseHandler implements ResponseHandler {
77
public value?: any;
88
/** The error mappings for the response to use when deserializing failed responses bodies. Where an error code like 401 applies specifically to that status code, a class code like 4XX applies to all status codes within the range if an the specific error code is not present. */
99
public errorMappings: ErrorMappings | undefined;
10-
public handleResponseAsync<NativeResponseType, ModelType>(
10+
public handleResponse<NativeResponseType, ModelType>(
1111
response: NativeResponseType,
1212
errorMappings: ErrorMappings | undefined,
1313
): Promise<ModelType> {

packages/abstractions/src/requestAdapter.ts

+14-6
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export interface RequestAdapter {
2424
* @typeParam ModelType the type of the response model to deserialize the response into.
2525
* @return a {@link Promise} with the deserialized response model.
2626
*/
27-
sendAsync<ModelType extends Parsable>(
27+
send<ModelType extends Parsable>(
2828
requestInfo: RequestInformation,
2929
type: ParsableFactory<ModelType>,
3030
errorMappings: ErrorMappings | undefined,
@@ -37,7 +37,7 @@ export interface RequestAdapter {
3737
* @typeParam ModelType the type of the response model to deserialize the response into.
3838
* @return a {@link Promise} with the deserialized response model collection.
3939
*/
40-
sendCollectionAsync<ModelType extends Parsable>(
40+
sendCollection<ModelType extends Parsable>(
4141
requestInfo: RequestInformation,
4242
type: ParsableFactory<ModelType>,
4343
errorMappings: ErrorMappings | undefined,
@@ -51,7 +51,7 @@ export interface RequestAdapter {
5151
* @typeParam ResponseType the type of the response model to deserialize the response into.
5252
* @return a {@link Promise} with the deserialized response model collection.
5353
*/
54-
sendCollectionOfPrimitiveAsync<
54+
sendCollectionOfPrimitive<
5555
ResponseType extends Exclude<
5656
PrimitiveTypesForDeserializationType,
5757
ArrayBuffer
@@ -69,7 +69,7 @@ export interface RequestAdapter {
6969
* @typeParam ResponseType the type of the response model to deserialize the response into.
7070
* @return a {@link Promise} with the deserialized primitive response model.
7171
*/
72-
sendPrimitiveAsync<ResponseType extends PrimitiveTypesForDeserializationType>(
72+
sendPrimitive<ResponseType extends PrimitiveTypesForDeserializationType>(
7373
requestInfo: RequestInformation,
7474
responseType: PrimitiveTypesForDeserialization,
7575
errorMappings: ErrorMappings | undefined,
@@ -80,7 +80,7 @@ export interface RequestAdapter {
8080
* @param errorMappings the error factories mapping to use in case of a failed request.
8181
* @return a {@link Promise} of void.
8282
*/
83-
sendNoResponseContentAsync(
83+
sendNoResponseContent(
8484
requestInfo: RequestInformation,
8585
errorMappings: ErrorMappings | undefined,
8686
): Promise<void>;
@@ -99,7 +99,7 @@ export interface RequestAdapter {
9999
* @typeParam T the type of the native request.
100100
* @return a {@link Promise} with the native request.
101101
*/
102-
convertToNativeRequestAsync<T>(requestInfo: RequestInformation): Promise<T>;
102+
convertToNativeRequest<T>(requestInfo: RequestInformation): Promise<T>;
103103
}
104104
export interface ErrorMappings {
105105
_4XX?: ParsableFactory<Parsable>;
@@ -127,3 +127,11 @@ export type PrimitiveTypesForDeserialization =
127127
| "TimeOnly"
128128
| "Duration"
129129
| "ArrayBuffer";
130+
131+
export type SendMethods = Exclude<
132+
keyof RequestAdapter,
133+
| "enableBackingStore"
134+
| "getSerializationWriterFactory"
135+
| "convertToNativeRequest"
136+
| "baseUrl"
137+
>;

packages/abstractions/src/responseHandler.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface ResponseHandler {
1010
* @typeParam ModelType The type of the response model object.
1111
* @return A {@link Promise} that represents the asynchronous operation and contains the deserialized response.
1212
*/
13-
handleResponseAsync<NativeResponseType, ModelType>(
13+
handleResponse<NativeResponseType, ModelType>(
1414
response: NativeResponseType,
1515
errorMappings: ErrorMappings | undefined,
1616
): Promise<ModelType>;

packages/authentication/azure/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/kiota-authentication-azure",
3-
"version": "1.0.0-preview.38",
3+
"version": "1.0.0-preview.39",
44
"description": "Authentication provider for Kiota using Azure Identity",
55
"main": "dist/cjs/src/index.js",
66
"module": "dist/es/src/index.js",
@@ -30,7 +30,7 @@
3030
"homepage": "https://github.com/microsoft/kiota-typescript#readme",
3131
"dependencies": {
3232
"@azure/core-auth": "^1.5.0",
33-
"@microsoft/kiota-abstractions": "^1.0.0-preview.43",
33+
"@microsoft/kiota-abstractions": "^1.0.0-preview.44",
3434
"@opentelemetry/api": "^1.7.0",
3535
"tslib": "^2.6.2"
3636
},

packages/authentication/spfx/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/kiota-authentication-spfx",
3-
"version": "1.0.0-preview.33",
3+
"version": "1.0.0-preview.34",
44
"description": "Authentication provider for using Kiota in SPFx solutions",
55
"main": "dist/cjs/src/index.js",
66
"module": "dist/es/src/index.js",
@@ -39,7 +39,7 @@
3939
},
4040
"homepage": "https://github.com/microsoft/kiota-typescript#readme",
4141
"dependencies": {
42-
"@microsoft/kiota-abstractions": "^1.0.0-preview.43",
42+
"@microsoft/kiota-abstractions": "^1.0.0-preview.44",
4343
"@microsoft/sp-http": "^1.15.2",
4444
"@opentelemetry/api": "^1.7.0",
4545
"tslib": "^2.6.2"

packages/http/fetch/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@microsoft/kiota-http-fetchlibrary",
3-
"version": "1.0.0-preview.42",
3+
"version": "1.0.0-preview.43",
44
"description": "Kiota request adapter implementation with fetch",
55
"keywords": [
66
"Kiota",
@@ -38,7 +38,7 @@
3838
"test:cjs": "mocha 'dist/cjs/test/common/**/*.js' && mocha 'dist/cjs/test/node/**/*.js'"
3939
},
4040
"dependencies": {
41-
"@microsoft/kiota-abstractions": "^1.0.0-preview.43",
41+
"@microsoft/kiota-abstractions": "^1.0.0-preview.44",
4242
"@opentelemetry/api": "^1.7.0",
4343
"guid-typescript": "^1.0.9",
4444
"node-fetch": "^2.7.0",

0 commit comments

Comments
 (0)