diff --git a/packages/abstractions/src/requestInformation.ts b/packages/abstractions/src/requestInformation.ts index 3b7426fed..f09826689 100644 --- a/packages/abstractions/src/requestInformation.ts +++ b/packages/abstractions/src/requestInformation.ts @@ -69,7 +69,15 @@ export class RequestInformation { public getRequestOptions() { return this._requestOptions; } - public addRequestOptions(...options: RequestOption[]) { + /** Adds the headers for the request. */ + public addRequestHeaders(source: Record | undefined) { + if (!source) return; + for (const key in source) { + this.headers[key] = source[key]; + } + } + /** Adds the request options for the request. */ + public addRequestOptions(options: RequestOption[] | undefined) { if (!options || options.length === 0) return; options.forEach((option) => { this._requestOptions[option.getKey()] = option; @@ -129,7 +137,10 @@ export class RequestInformation { * Sets the query string parameters from a raw object. * @param parameters the parameters. */ - public setQueryStringParametersFromRawObject = (q: object): void => { + public setQueryStringParametersFromRawObject = ( + q: object | undefined + ): void => { + if (!q) return; Object.entries(q).forEach(([k, v]) => { let key = k; if ((q as any).getQueryParameter) { diff --git a/packages/abstractions/test/common/requestInformation.ts b/packages/abstractions/test/common/requestInformation.ts index 2d87a64c9..6dcb09202 100644 --- a/packages/abstractions/test/common/requestInformation.ts +++ b/packages/abstractions/test/common/requestInformation.ts @@ -12,23 +12,22 @@ const assert = chai.assert; import { RequestInformation } from "../../src"; -class GetQueryParameters -{ - select?: string[]; - count?: boolean; - filter?: string; - orderby?: string[]; - search?: string; - getQueryParameter(originalName:string) : string { - switch(originalName.toLowerCase()) { - case 'select': return '%24select'; - case 'count': return '%24count'; - case 'filter': return '%24filter'; - case 'orderby': return '%24orderby'; - case 'search': return '%24search'; - default: return originalName; - } +class GetQueryParameters { + select?: string[]; + count?: boolean; + filter?: string; + orderby?: string[]; + search?: string; + getQueryParameter(originalName: string): string { + switch (originalName.toLowerCase()) { + case 'select': return '%24select'; + case 'count': return '%24count'; + case 'filter': return '%24filter'; + case 'orderby': return '%24orderby'; + case 'search': return '%24search'; + default: return originalName; } + } } describe("RequestInformation", () => { @@ -54,4 +53,14 @@ describe("RequestInformation", () => { assert.equal(requestInformation.URL, "http://localhost/me?%24select=id,displayName"); }); + + it("Adds headers to requestInformation", () => { + const requestInformation = new RequestInformation(); + requestInformation.pathParameters["baseurl"] = baseUrl; + requestInformation.urlTemplate = "http://localhost/me{?%24select}"; + const headers: Record = { ConsistencyLevel: "eventual" }; + requestInformation.addRequestHeaders(headers); + assert.isNotEmpty(requestInformation.headers); + assert.equal("eventual", requestInformation.headers["ConsistencyLevel"]); + }); }); diff --git a/packages/test/generatedCode/models/microsoft/graph/index.ts b/packages/test/generatedCode/models/microsoft/graph/index.ts index 15f61d988..8aa1c6c9e 100644 --- a/packages/test/generatedCode/models/microsoft/graph/index.ts +++ b/packages/test/generatedCode/models/microsoft/graph/index.ts @@ -1,20 +1,20 @@ export * from './entity' export * from './outlookItem' export * from './emailAddress' -export * from './followupFlag' -export * from './itemBody' -export * from './inferenceClassificationOverride' -export * from './message' +export * from './messageRulePredicates' export * from './messageRuleActions' -export * from './inferenceClassification' -export * from './messageRule' +export * from './mailFolder' +export * from './dateTimeTimeZone' +export * from './inferenceClassificationOverride' export * from './attachment' export * from './singleValueLegacyExtendedProperty' -export * from './internetMessageHeader' +export * from './recipient' export * from './sizeRange' +export * from './inferenceClassification' +export * from './followupFlag' export * from './multiValueLegacyExtendedProperty' -export * from './mailFolder' -export * from './recipient' -export * from './messageRulePredicates' -export * from './dateTimeTimeZone' +export * from './message' +export * from './itemBody' export * from './extension' +export * from './messageRule' +export * from './internetMessageHeader' diff --git a/packages/test/generatedCode/users/item/inferenceClassification/inferenceClassificationRequestBuilder.ts b/packages/test/generatedCode/users/item/inferenceClassification/inferenceClassificationRequestBuilder.ts index 0641d94df..5c09f4399 100644 --- a/packages/test/generatedCode/users/item/inferenceClassification/inferenceClassificationRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/inferenceClassification/inferenceClassificationRequestBuilder.ts @@ -1,5 +1,8 @@ import {InferenceClassification} from '../../../models/microsoft/graph/'; import {createInferenceClassificationFromDiscriminatorValue} from '../../../models/microsoft/graph/createInferenceClassificationFromDiscriminatorValue'; +import {InferenceClassificationRequestBuilderDeleteRequestConfiguration} from './inferenceClassificationRequestBuilderDeleteRequestConfiguration'; +import {InferenceClassificationRequestBuilderGetRequestConfiguration} from './inferenceClassificationRequestBuilderGetRequestConfiguration'; +import {InferenceClassificationRequestBuilderPatchRequestConfiguration} from './inferenceClassificationRequestBuilderPatchRequestConfiguration'; import {InferenceClassificationOverrideItemRequestBuilder} from './overrides/item/inferenceClassificationOverrideItemRequestBuilder'; import {OverridesRequestBuilder} from './overrides/overridesRequestBuilder'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; @@ -24,88 +27,83 @@ export class InferenceClassificationRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/inferenceClassification{?select}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/inferenceClassification{?%24select}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * Relevance classification of the user's messages based on explicit designations which override inferred relevance or importance. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createDeleteRequestInformation(headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createDeleteRequestInformation(requestConfiguration?: InferenceClassificationRequestBuilderDeleteRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.DELETE; - if(headers) requestInfo.headers = headers; - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * Relevance classification of the user's messages based on explicit designations which override inferred relevance or importance. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: InferenceClassificationRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * Relevance classification of the user's messages based on explicit designations which override inferred relevance or importance. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPatchRequestInformation(body: InferenceClassification | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPatchRequestInformation(body: InferenceClassification | undefined, requestConfiguration?: InferenceClassificationRequestBuilderPatchRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.PATCH; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * Relevance classification of the user's messages based on explicit designations which override inferred relevance or importance. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public delete(headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public delete(requestConfiguration?: InferenceClassificationRequestBuilderDeleteRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createDeleteRequestInformation( - headers, options + requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * Relevance classification of the user's messages based on explicit designations which override inferred relevance or importance. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of InferenceClassification */ - public get(queryParameters?: { - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: InferenceClassificationRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createInferenceClassificationFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; @@ -117,20 +115,19 @@ export class InferenceClassificationRequestBuilder { public overridesById(id: string) : InferenceClassificationOverrideItemRequestBuilder { if(!id) throw new Error("id cannot be undefined"); const urlTplParams = getPathParameters(this.pathParameters); - urlTplParams["inferenceClassificationOverride_id"] = id + urlTplParams["inferenceClassificationOverride%2Did"] = id return new InferenceClassificationOverrideItemRequestBuilder(urlTplParams, this.requestAdapter); }; /** * Relevance classification of the user's messages based on explicit designations which override inferred relevance or importance. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public patch(body: InferenceClassification | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public patch(body: InferenceClassification | undefined, requestConfiguration?: InferenceClassificationRequestBuilderPatchRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPatchRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/inferenceClassification/inferenceClassificationRequestBuilderDeleteRequestConfiguration.ts b/packages/test/generatedCode/users/item/inferenceClassification/inferenceClassificationRequestBuilderDeleteRequestConfiguration.ts new file mode 100644 index 000000000..d65009936 --- /dev/null +++ b/packages/test/generatedCode/users/item/inferenceClassification/inferenceClassificationRequestBuilderDeleteRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class InferenceClassificationRequestBuilderDeleteRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/inferenceClassification/inferenceClassificationRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/inferenceClassification/inferenceClassificationRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..543d4b73f --- /dev/null +++ b/packages/test/generatedCode/users/item/inferenceClassification/inferenceClassificationRequestBuilderGetQueryParameters.ts @@ -0,0 +1,18 @@ + +/** Relevance classification of the user's messages based on explicit designations which override inferred relevance or importance. */ +export class InferenceClassificationRequestBuilderGetQueryParameters { + /** Select properties to be returned */ + public select?: string[] | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "select": return "%24select"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/inferenceClassification/inferenceClassificationRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/inferenceClassification/inferenceClassificationRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..16a9cc230 --- /dev/null +++ b/packages/test/generatedCode/users/item/inferenceClassification/inferenceClassificationRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {InferenceClassificationRequestBuilderGetQueryParameters} from './inferenceClassificationRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class InferenceClassificationRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: InferenceClassificationRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/inferenceClassification/inferenceClassificationRequestBuilderPatchRequestConfiguration.ts b/packages/test/generatedCode/users/item/inferenceClassification/inferenceClassificationRequestBuilderPatchRequestConfiguration.ts new file mode 100644 index 000000000..2317d2aa3 --- /dev/null +++ b/packages/test/generatedCode/users/item/inferenceClassification/inferenceClassificationRequestBuilderPatchRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class InferenceClassificationRequestBuilderPatchRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/inferenceClassificationOverrideItemRequestBuilder.ts b/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/inferenceClassificationOverrideItemRequestBuilder.ts index 02cafdfd7..e901f828a 100644 --- a/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/inferenceClassificationOverrideItemRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/inferenceClassificationOverrideItemRequestBuilder.ts @@ -1,5 +1,8 @@ import {InferenceClassificationOverride} from '../../../../../models/microsoft/graph/'; import {createInferenceClassificationOverrideFromDiscriminatorValue} from '../../../../../models/microsoft/graph/createInferenceClassificationOverrideFromDiscriminatorValue'; +import {InferenceClassificationOverrideItemRequestBuilderDeleteRequestConfiguration} from './inferenceClassificationOverrideItemRequestBuilderDeleteRequestConfiguration'; +import {InferenceClassificationOverrideItemRequestBuilderGetRequestConfiguration} from './inferenceClassificationOverrideItemRequestBuilderGetRequestConfiguration'; +import {InferenceClassificationOverrideItemRequestBuilderPatchRequestConfiguration} from './inferenceClassificationOverrideItemRequestBuilderPatchRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/inferenceClassification/overrides/{inferenceClassificationOverride-id} */ @@ -18,102 +21,96 @@ export class InferenceClassificationOverrideItemRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/inferenceClassification/overrides/{inferenceClassificationOverride_id}{?select}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/inferenceClassification/overrides/{inferenceClassificationOverride%2Did}{?%24select}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * A set of overrides for a user to always classify messages from specific senders in certain ways: focused, or other. Read-only. Nullable. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createDeleteRequestInformation(headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createDeleteRequestInformation(requestConfiguration?: InferenceClassificationOverrideItemRequestBuilderDeleteRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.DELETE; - if(headers) requestInfo.headers = headers; - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * A set of overrides for a user to always classify messages from specific senders in certain ways: focused, or other. Read-only. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: InferenceClassificationOverrideItemRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * A set of overrides for a user to always classify messages from specific senders in certain ways: focused, or other. Read-only. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPatchRequestInformation(body: InferenceClassificationOverride | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPatchRequestInformation(body: InferenceClassificationOverride | undefined, requestConfiguration?: InferenceClassificationOverrideItemRequestBuilderPatchRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.PATCH; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * A set of overrides for a user to always classify messages from specific senders in certain ways: focused, or other. Read-only. Nullable. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public delete(headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public delete(requestConfiguration?: InferenceClassificationOverrideItemRequestBuilderDeleteRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createDeleteRequestInformation( - headers, options + requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * A set of overrides for a user to always classify messages from specific senders in certain ways: focused, or other. Read-only. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of InferenceClassificationOverride */ - public get(queryParameters?: { - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: InferenceClassificationOverrideItemRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createInferenceClassificationOverrideFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * A set of overrides for a user to always classify messages from specific senders in certain ways: focused, or other. Read-only. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public patch(body: InferenceClassificationOverride | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public patch(body: InferenceClassificationOverride | undefined, requestConfiguration?: InferenceClassificationOverrideItemRequestBuilderPatchRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPatchRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/inferenceClassificationOverrideItemRequestBuilderDeleteRequestConfiguration.ts b/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/inferenceClassificationOverrideItemRequestBuilderDeleteRequestConfiguration.ts new file mode 100644 index 000000000..8cf579ff7 --- /dev/null +++ b/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/inferenceClassificationOverrideItemRequestBuilderDeleteRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class InferenceClassificationOverrideItemRequestBuilderDeleteRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/inferenceClassificationOverrideItemRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/inferenceClassificationOverrideItemRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..c54d8c46c --- /dev/null +++ b/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/inferenceClassificationOverrideItemRequestBuilderGetQueryParameters.ts @@ -0,0 +1,18 @@ + +/** A set of overrides for a user to always classify messages from specific senders in certain ways: focused, or other. Read-only. Nullable. */ +export class InferenceClassificationOverrideItemRequestBuilderGetQueryParameters { + /** Select properties to be returned */ + public select?: string[] | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "select": return "%24select"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/inferenceClassificationOverrideItemRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/inferenceClassificationOverrideItemRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..638148e17 --- /dev/null +++ b/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/inferenceClassificationOverrideItemRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {InferenceClassificationOverrideItemRequestBuilderGetQueryParameters} from './inferenceClassificationOverrideItemRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class InferenceClassificationOverrideItemRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: InferenceClassificationOverrideItemRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/inferenceClassificationOverrideItemRequestBuilderPatchRequestConfiguration.ts b/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/inferenceClassificationOverrideItemRequestBuilderPatchRequestConfiguration.ts new file mode 100644 index 000000000..027141492 --- /dev/null +++ b/packages/test/generatedCode/users/item/inferenceClassification/overrides/item/inferenceClassificationOverrideItemRequestBuilderPatchRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class InferenceClassificationOverrideItemRequestBuilderPatchRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/inferenceClassification/overrides/overridesRequestBuilder.ts b/packages/test/generatedCode/users/item/inferenceClassification/overrides/overridesRequestBuilder.ts index 53a5ffeb2..fbb8d6325 100644 --- a/packages/test/generatedCode/users/item/inferenceClassification/overrides/overridesRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/inferenceClassification/overrides/overridesRequestBuilder.ts @@ -2,6 +2,8 @@ import {InferenceClassificationOverride} from '../../../../models/microsoft/grap import {createInferenceClassificationOverrideFromDiscriminatorValue} from '../../../../models/microsoft/graph/createInferenceClassificationOverrideFromDiscriminatorValue'; import {createOverridesResponseFromDiscriminatorValue} from './createOverridesResponseFromDiscriminatorValue'; import {OverridesResponse} from './index'; +import {OverridesRequestBuilderGetRequestConfiguration} from './overridesRequestBuilderGetRequestConfiguration'; +import {OverridesRequestBuilderPostRequestConfiguration} from './overridesRequestBuilderPostRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/inferenceClassification/overrides */ @@ -20,86 +22,70 @@ export class OverridesRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/inferenceClassification/overrides{?top,skip,filter,count,orderby,select}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/inferenceClassification/overrides{?%24top,%24skip,%24filter,%24count,%24orderby,%24select}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * A set of overrides for a user to always classify messages from specific senders in certain ways: focused, or other. Read-only. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - count?: boolean, - filter?: string, - orderby?: string[], - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: OverridesRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * A set of overrides for a user to always classify messages from specific senders in certain ways: focused, or other. Read-only. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPostRequestInformation(body: InferenceClassificationOverride | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPostRequestInformation(body: InferenceClassificationOverride | undefined, requestConfiguration?: OverridesRequestBuilderPostRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.POST; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * A set of overrides for a user to always classify messages from specific senders in certain ways: focused, or other. Read-only. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of OverridesResponse */ - public get(queryParameters?: { - count?: boolean, - filter?: string, - orderby?: string[], - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: OverridesRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createOverridesResponseFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * A set of overrides for a user to always classify messages from specific senders in certain ways: focused, or other. Read-only. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of InferenceClassificationOverride */ - public post(body: InferenceClassificationOverride | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public post(body: InferenceClassificationOverride | undefined, requestConfiguration?: OverridesRequestBuilderPostRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPostRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createInferenceClassificationOverrideFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/inferenceClassification/overrides/overridesRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/inferenceClassification/overrides/overridesRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..72e2c0747 --- /dev/null +++ b/packages/test/generatedCode/users/item/inferenceClassification/overrides/overridesRequestBuilderGetQueryParameters.ts @@ -0,0 +1,33 @@ + +/** A set of overrides for a user to always classify messages from specific senders in certain ways: focused, or other. Read-only. Nullable. */ +export class OverridesRequestBuilderGetQueryParameters { + /** Include count of items */ + public count?: boolean | undefined; + /** Filter items by property values */ + public filter?: string | undefined; + /** Order items by property values */ + public orderby?: string[] | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** Skip the first n items */ + public skip?: number | undefined; + /** Show only the first n items */ + public top?: number | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "count": return "%24count"; + case "filter": return "%24filter"; + case "orderby": return "%24orderby"; + case "select": return "%24select"; + case "skip": return "%24skip"; + case "top": return "%24top"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/inferenceClassification/overrides/overridesRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/inferenceClassification/overrides/overridesRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..c602d4b9f --- /dev/null +++ b/packages/test/generatedCode/users/item/inferenceClassification/overrides/overridesRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {OverridesRequestBuilderGetQueryParameters} from './overridesRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class OverridesRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: OverridesRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/inferenceClassification/overrides/overridesRequestBuilderPostRequestConfiguration.ts b/packages/test/generatedCode/users/item/inferenceClassification/overrides/overridesRequestBuilderPostRequestConfiguration.ts new file mode 100644 index 000000000..2c903e4a3 --- /dev/null +++ b/packages/test/generatedCode/users/item/inferenceClassification/overrides/overridesRequestBuilderPostRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class OverridesRequestBuilderPostRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/childFoldersRequestBuilder.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/childFoldersRequestBuilder.ts index 9169274c9..49567e5cd 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/childFoldersRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/childFoldersRequestBuilder.ts @@ -1,5 +1,7 @@ import {MailFolder} from '../../../../../models/microsoft/graph/'; import {createMailFolderFromDiscriminatorValue} from '../../../../../models/microsoft/graph/createMailFolderFromDiscriminatorValue'; +import {ChildFoldersRequestBuilderGetRequestConfiguration} from './childFoldersRequestBuilderGetRequestConfiguration'; +import {ChildFoldersRequestBuilderPostRequestConfiguration} from './childFoldersRequestBuilderPostRequestConfiguration'; import {createChildFoldersResponseFromDiscriminatorValue} from './createChildFoldersResponseFromDiscriminatorValue'; import {ChildFoldersResponse} from './index'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; @@ -20,88 +22,70 @@ export class ChildFoldersRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder_id}/childFolders{?top,skip,filter,count,orderby,select,expand}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/childFolders{?%24top,%24skip,%24filter,%24count,%24orderby,%24select,%24expand}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The collection of child folders in the mailFolder. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - count?: boolean, - expand?: string[], - filter?: string, - orderby?: string[], - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: ChildFoldersRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of child folders in the mailFolder. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPostRequestInformation(body: MailFolder | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPostRequestInformation(body: MailFolder | undefined, requestConfiguration?: ChildFoldersRequestBuilderPostRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.POST; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The collection of child folders in the mailFolder. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of ChildFoldersResponse */ - public get(queryParameters?: { - count?: boolean, - expand?: string[], - filter?: string, - orderby?: string[], - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: ChildFoldersRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createChildFoldersResponseFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of child folders in the mailFolder. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of MailFolder */ - public post(body: MailFolder | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public post(body: MailFolder | undefined, requestConfiguration?: ChildFoldersRequestBuilderPostRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPostRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createMailFolderFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/childFoldersRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/childFoldersRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..a2a291640 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/childFoldersRequestBuilderGetQueryParameters.ts @@ -0,0 +1,36 @@ + +/** The collection of child folders in the mailFolder. */ +export class ChildFoldersRequestBuilderGetQueryParameters { + /** Include count of items */ + public count?: boolean | undefined; + /** Expand related entities */ + public expand?: string[] | undefined; + /** Filter items by property values */ + public filter?: string | undefined; + /** Order items by property values */ + public orderby?: string[] | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** Skip the first n items */ + public skip?: number | undefined; + /** Show only the first n items */ + public top?: number | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "count": return "%24count"; + case "expand": return "%24expand"; + case "filter": return "%24filter"; + case "orderby": return "%24orderby"; + case "select": return "%24select"; + case "skip": return "%24skip"; + case "top": return "%24top"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/childFoldersRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/childFoldersRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..140680fcd --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/childFoldersRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {ChildFoldersRequestBuilderGetQueryParameters} from './childFoldersRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class ChildFoldersRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: ChildFoldersRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/childFoldersRequestBuilderPostRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/childFoldersRequestBuilderPostRequestConfiguration.ts new file mode 100644 index 000000000..47c540c6f --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/childFoldersRequestBuilderPostRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class ChildFoldersRequestBuilderPostRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/mailFolderItemRequestBuilder.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/mailFolderItemRequestBuilder.ts index ea438435e..cd5328b97 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/mailFolderItemRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/mailFolderItemRequestBuilder.ts @@ -1,5 +1,8 @@ import {MailFolder} from '../../../../../../models/microsoft/graph/'; import {createMailFolderFromDiscriminatorValue} from '../../../../../../models/microsoft/graph/createMailFolderFromDiscriminatorValue'; +import {MailFolderItemRequestBuilderDeleteRequestConfiguration} from './mailFolderItemRequestBuilderDeleteRequestConfiguration'; +import {MailFolderItemRequestBuilderGetRequestConfiguration} from './mailFolderItemRequestBuilderGetRequestConfiguration'; +import {MailFolderItemRequestBuilderPatchRequestConfiguration} from './mailFolderItemRequestBuilderPatchRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/childFolders/{mailFolder-id1} */ @@ -18,104 +21,96 @@ export class MailFolderItemRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder_id}/childFolders/{mailFolder_id1}{?select,expand}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/childFolders/{mailFolder%2Did1}{?%24select,%24expand}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The collection of child folders in the mailFolder. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createDeleteRequestInformation(headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createDeleteRequestInformation(requestConfiguration?: MailFolderItemRequestBuilderDeleteRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.DELETE; - if(headers) requestInfo.headers = headers; - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of child folders in the mailFolder. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - expand?: string[], - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: MailFolderItemRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of child folders in the mailFolder. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPatchRequestInformation(body: MailFolder | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPatchRequestInformation(body: MailFolder | undefined, requestConfiguration?: MailFolderItemRequestBuilderPatchRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.PATCH; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The collection of child folders in the mailFolder. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public delete(headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public delete(requestConfiguration?: MailFolderItemRequestBuilderDeleteRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createDeleteRequestInformation( - headers, options + requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of child folders in the mailFolder. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of MailFolder */ - public get(queryParameters?: { - expand?: string[], - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: MailFolderItemRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createMailFolderFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of child folders in the mailFolder. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public patch(body: MailFolder | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public patch(body: MailFolder | undefined, requestConfiguration?: MailFolderItemRequestBuilderPatchRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPatchRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/mailFolderItemRequestBuilderDeleteRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/mailFolderItemRequestBuilderDeleteRequestConfiguration.ts new file mode 100644 index 000000000..2cc26639e --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/mailFolderItemRequestBuilderDeleteRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MailFolderItemRequestBuilderDeleteRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/mailFolderItemRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/mailFolderItemRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..03b590c3d --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/mailFolderItemRequestBuilderGetQueryParameters.ts @@ -0,0 +1,21 @@ + +/** The collection of child folders in the mailFolder. */ +export class MailFolderItemRequestBuilderGetQueryParameters { + /** Expand related entities */ + public expand?: string[] | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "expand": return "%24expand"; + case "select": return "%24select"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/mailFolderItemRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/mailFolderItemRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..ad74e6be4 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/mailFolderItemRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {MailFolderItemRequestBuilderGetQueryParameters} from './mailFolderItemRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MailFolderItemRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: MailFolderItemRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/mailFolderItemRequestBuilderPatchRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/mailFolderItemRequestBuilderPatchRequestConfiguration.ts new file mode 100644 index 000000000..d768019bc --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/childFolders/item/mailFolderItemRequestBuilderPatchRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MailFolderItemRequestBuilderPatchRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/mailFolderItemRequestBuilder.ts b/packages/test/generatedCode/users/item/mailFolders/item/mailFolderItemRequestBuilder.ts index 847bb48f5..956f56a6c 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/mailFolderItemRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/mailFolderItemRequestBuilder.ts @@ -2,6 +2,9 @@ import {MailFolder} from '../../../../models/microsoft/graph/'; import {createMailFolderFromDiscriminatorValue} from '../../../../models/microsoft/graph/createMailFolderFromDiscriminatorValue'; import {ChildFoldersRequestBuilder} from './childFolders/childFoldersRequestBuilder'; import {MailFolderItemRequestBuilder as i8ac202ce800aee8ded612d4f0938c62b8e7a6aa154f6abe834c529e35433693a} from './childFolders/item/mailFolderItemRequestBuilder'; +import {MailFolderItemRequestBuilderDeleteRequestConfiguration} from './mailFolderItemRequestBuilderDeleteRequestConfiguration'; +import {MailFolderItemRequestBuilderGetRequestConfiguration} from './mailFolderItemRequestBuilderGetRequestConfiguration'; +import {MailFolderItemRequestBuilderPatchRequestConfiguration} from './mailFolderItemRequestBuilderPatchRequestConfiguration'; import {MessageRuleItemRequestBuilder} from './messageRules/item/messageRuleItemRequestBuilder'; import {MessageRulesRequestBuilder} from './messageRules/messageRulesRequestBuilder'; import {MessageItemRequestBuilder} from './messages/item/messageItemRequestBuilder'; @@ -48,7 +51,7 @@ export class MailFolderItemRequestBuilder { public childFoldersById(id: string) : i8ac202ce800aee8ded612d4f0938c62b8e7a6aa154f6abe834c529e35433693a { if(!id) throw new Error("id cannot be undefined"); const urlTplParams = getPathParameters(this.pathParameters); - urlTplParams["mailFolder_id1"] = id + urlTplParams["mailFolder%2Did1"] = id return new i8ac202ce800aee8ded612d4f0938c62b8e7a6aa154f6abe834c529e35433693a(urlTplParams, this.requestAdapter); }; /** @@ -59,88 +62,83 @@ export class MailFolderItemRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder_id}{?select}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}{?%24select}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The user's mail folders. Read-only. Nullable. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createDeleteRequestInformation(headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createDeleteRequestInformation(requestConfiguration?: MailFolderItemRequestBuilderDeleteRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.DELETE; - if(headers) requestInfo.headers = headers; - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The user's mail folders. Read-only. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: MailFolderItemRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The user's mail folders. Read-only. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPatchRequestInformation(body: MailFolder | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPatchRequestInformation(body: MailFolder | undefined, requestConfiguration?: MailFolderItemRequestBuilderPatchRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.PATCH; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The user's mail folders. Read-only. Nullable. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public delete(headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public delete(requestConfiguration?: MailFolderItemRequestBuilderDeleteRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createDeleteRequestInformation( - headers, options + requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The user's mail folders. Read-only. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of MailFolder */ - public get(queryParameters?: { - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: MailFolderItemRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createMailFolderFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; @@ -152,7 +150,7 @@ export class MailFolderItemRequestBuilder { public messageRulesById(id: string) : MessageRuleItemRequestBuilder { if(!id) throw new Error("id cannot be undefined"); const urlTplParams = getPathParameters(this.pathParameters); - urlTplParams["messageRule_id"] = id + urlTplParams["messageRule%2Did"] = id return new MessageRuleItemRequestBuilder(urlTplParams, this.requestAdapter); }; /** @@ -163,7 +161,7 @@ export class MailFolderItemRequestBuilder { public messagesById(id: string) : MessageItemRequestBuilder { if(!id) throw new Error("id cannot be undefined"); const urlTplParams = getPathParameters(this.pathParameters); - urlTplParams["message_id"] = id + urlTplParams["message%2Did"] = id return new MessageItemRequestBuilder(urlTplParams, this.requestAdapter); }; /** @@ -174,20 +172,19 @@ export class MailFolderItemRequestBuilder { public multiValueExtendedPropertiesById(id: string) : MultiValueLegacyExtendedPropertyItemRequestBuilder { if(!id) throw new Error("id cannot be undefined"); const urlTplParams = getPathParameters(this.pathParameters); - urlTplParams["multiValueLegacyExtendedProperty_id"] = id + urlTplParams["multiValueLegacyExtendedProperty%2Did"] = id return new MultiValueLegacyExtendedPropertyItemRequestBuilder(urlTplParams, this.requestAdapter); }; /** * The user's mail folders. Read-only. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public patch(body: MailFolder | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public patch(body: MailFolder | undefined, requestConfiguration?: MailFolderItemRequestBuilderPatchRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPatchRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; @@ -199,7 +196,7 @@ export class MailFolderItemRequestBuilder { public singleValueExtendedPropertiesById(id: string) : SingleValueLegacyExtendedPropertyItemRequestBuilder { if(!id) throw new Error("id cannot be undefined"); const urlTplParams = getPathParameters(this.pathParameters); - urlTplParams["singleValueLegacyExtendedProperty_id"] = id + urlTplParams["singleValueLegacyExtendedProperty%2Did"] = id return new SingleValueLegacyExtendedPropertyItemRequestBuilder(urlTplParams, this.requestAdapter); }; } diff --git a/packages/test/generatedCode/users/item/mailFolders/item/mailFolderItemRequestBuilderDeleteRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/mailFolderItemRequestBuilderDeleteRequestConfiguration.ts new file mode 100644 index 000000000..2cc26639e --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/mailFolderItemRequestBuilderDeleteRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MailFolderItemRequestBuilderDeleteRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/mailFolderItemRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/mailFolders/item/mailFolderItemRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..5ad20baca --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/mailFolderItemRequestBuilderGetQueryParameters.ts @@ -0,0 +1,18 @@ + +/** The user's mail folders. Read-only. Nullable. */ +export class MailFolderItemRequestBuilderGetQueryParameters { + /** Select properties to be returned */ + public select?: string[] | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "select": return "%24select"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/mailFolderItemRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/mailFolderItemRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..ad74e6be4 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/mailFolderItemRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {MailFolderItemRequestBuilderGetQueryParameters} from './mailFolderItemRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MailFolderItemRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: MailFolderItemRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/mailFolderItemRequestBuilderPatchRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/mailFolderItemRequestBuilderPatchRequestConfiguration.ts new file mode 100644 index 000000000..d768019bc --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/mailFolderItemRequestBuilderPatchRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MailFolderItemRequestBuilderPatchRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/messageRuleItemRequestBuilder.ts b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/messageRuleItemRequestBuilder.ts index d3565f00c..0e6a96383 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/messageRuleItemRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/messageRuleItemRequestBuilder.ts @@ -1,5 +1,8 @@ import {MessageRule} from '../../../../../../models/microsoft/graph/'; import {createMessageRuleFromDiscriminatorValue} from '../../../../../../models/microsoft/graph/createMessageRuleFromDiscriminatorValue'; +import {MessageRuleItemRequestBuilderDeleteRequestConfiguration} from './messageRuleItemRequestBuilderDeleteRequestConfiguration'; +import {MessageRuleItemRequestBuilderGetRequestConfiguration} from './messageRuleItemRequestBuilderGetRequestConfiguration'; +import {MessageRuleItemRequestBuilderPatchRequestConfiguration} from './messageRuleItemRequestBuilderPatchRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/messageRules/{messageRule-id} */ @@ -18,102 +21,96 @@ export class MessageRuleItemRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder_id}/messageRules/{messageRule_id}{?select}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messageRules/{messageRule%2Did}{?%24select}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The collection of rules that apply to the user's Inbox folder. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createDeleteRequestInformation(headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createDeleteRequestInformation(requestConfiguration?: MessageRuleItemRequestBuilderDeleteRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.DELETE; - if(headers) requestInfo.headers = headers; - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of rules that apply to the user's Inbox folder. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: MessageRuleItemRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of rules that apply to the user's Inbox folder. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPatchRequestInformation(body: MessageRule | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPatchRequestInformation(body: MessageRule | undefined, requestConfiguration?: MessageRuleItemRequestBuilderPatchRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.PATCH; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The collection of rules that apply to the user's Inbox folder. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public delete(headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public delete(requestConfiguration?: MessageRuleItemRequestBuilderDeleteRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createDeleteRequestInformation( - headers, options + requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of rules that apply to the user's Inbox folder. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of MessageRule */ - public get(queryParameters?: { - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: MessageRuleItemRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createMessageRuleFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of rules that apply to the user's Inbox folder. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public patch(body: MessageRule | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public patch(body: MessageRule | undefined, requestConfiguration?: MessageRuleItemRequestBuilderPatchRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPatchRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/messageRuleItemRequestBuilderDeleteRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/messageRuleItemRequestBuilderDeleteRequestConfiguration.ts new file mode 100644 index 000000000..630056d2f --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/messageRuleItemRequestBuilderDeleteRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MessageRuleItemRequestBuilderDeleteRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/messageRuleItemRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/messageRuleItemRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..1df75496f --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/messageRuleItemRequestBuilderGetQueryParameters.ts @@ -0,0 +1,18 @@ + +/** The collection of rules that apply to the user's Inbox folder. */ +export class MessageRuleItemRequestBuilderGetQueryParameters { + /** Select properties to be returned */ + public select?: string[] | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "select": return "%24select"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/messageRuleItemRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/messageRuleItemRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..132acc29d --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/messageRuleItemRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {MessageRuleItemRequestBuilderGetQueryParameters} from './messageRuleItemRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MessageRuleItemRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: MessageRuleItemRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/messageRuleItemRequestBuilderPatchRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/messageRuleItemRequestBuilderPatchRequestConfiguration.ts new file mode 100644 index 000000000..e30cf4c8d --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/item/messageRuleItemRequestBuilderPatchRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MessageRuleItemRequestBuilderPatchRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/messageRulesRequestBuilder.ts b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/messageRulesRequestBuilder.ts index d1f252a39..b10237e05 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/messageRulesRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/messageRulesRequestBuilder.ts @@ -2,6 +2,8 @@ import {MessageRule} from '../../../../../models/microsoft/graph/'; import {createMessageRuleFromDiscriminatorValue} from '../../../../../models/microsoft/graph/createMessageRuleFromDiscriminatorValue'; import {createMessageRulesResponseFromDiscriminatorValue} from './createMessageRulesResponseFromDiscriminatorValue'; import {MessageRulesResponse} from './index'; +import {MessageRulesRequestBuilderGetRequestConfiguration} from './messageRulesRequestBuilderGetRequestConfiguration'; +import {MessageRulesRequestBuilderPostRequestConfiguration} from './messageRulesRequestBuilderPostRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/messageRules */ @@ -20,86 +22,70 @@ export class MessageRulesRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder_id}/messageRules{?top,skip,filter,count,orderby,select}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messageRules{?%24top,%24skip,%24filter,%24count,%24orderby,%24select}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The collection of rules that apply to the user's Inbox folder. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - count?: boolean, - filter?: string, - orderby?: string[], - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: MessageRulesRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of rules that apply to the user's Inbox folder. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPostRequestInformation(body: MessageRule | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPostRequestInformation(body: MessageRule | undefined, requestConfiguration?: MessageRulesRequestBuilderPostRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.POST; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The collection of rules that apply to the user's Inbox folder. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of MessageRulesResponse */ - public get(queryParameters?: { - count?: boolean, - filter?: string, - orderby?: string[], - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: MessageRulesRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createMessageRulesResponseFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of rules that apply to the user's Inbox folder. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of MessageRule */ - public post(body: MessageRule | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public post(body: MessageRule | undefined, requestConfiguration?: MessageRulesRequestBuilderPostRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPostRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createMessageRuleFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/messageRulesRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/messageRulesRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..9a2632cbe --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/messageRulesRequestBuilderGetQueryParameters.ts @@ -0,0 +1,33 @@ + +/** The collection of rules that apply to the user's Inbox folder. */ +export class MessageRulesRequestBuilderGetQueryParameters { + /** Include count of items */ + public count?: boolean | undefined; + /** Filter items by property values */ + public filter?: string | undefined; + /** Order items by property values */ + public orderby?: string[] | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** Skip the first n items */ + public skip?: number | undefined; + /** Show only the first n items */ + public top?: number | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "count": return "%24count"; + case "filter": return "%24filter"; + case "orderby": return "%24orderby"; + case "select": return "%24select"; + case "skip": return "%24skip"; + case "top": return "%24top"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/messageRulesRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/messageRulesRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..11c811683 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/messageRulesRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {MessageRulesRequestBuilderGetQueryParameters} from './messageRulesRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MessageRulesRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: MessageRulesRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messageRules/messageRulesRequestBuilderPostRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/messageRulesRequestBuilderPostRequestConfiguration.ts new file mode 100644 index 000000000..93719e86c --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messageRules/messageRulesRequestBuilderPostRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MessageRulesRequestBuilderPostRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/attachmentsRequestBuilder.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/attachmentsRequestBuilder.ts index 49f3d4603..352bd7d99 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/attachmentsRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/attachmentsRequestBuilder.ts @@ -1,5 +1,7 @@ import {Attachment} from '../../../../../../../models/microsoft/graph/'; import {createAttachmentFromDiscriminatorValue} from '../../../../../../../models/microsoft/graph/createAttachmentFromDiscriminatorValue'; +import {AttachmentsRequestBuilderGetRequestConfiguration} from './attachmentsRequestBuilderGetRequestConfiguration'; +import {AttachmentsRequestBuilderPostRequestConfiguration} from './attachmentsRequestBuilderPostRequestConfiguration'; import {createAttachmentsResponseFromDiscriminatorValue} from './createAttachmentsResponseFromDiscriminatorValue'; import {AttachmentsResponse} from './index'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; @@ -20,88 +22,70 @@ export class AttachmentsRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder_id}/messages/{message_id}/attachments{?top,skip,filter,count,orderby,select,expand}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messages/{message%2Did}/attachments{?%24top,%24skip,%24filter,%24count,%24orderby,%24select,%24expand}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The fileAttachment and itemAttachment attachments for the message. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - count?: boolean, - expand?: string[], - filter?: string, - orderby?: string[], - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: AttachmentsRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The fileAttachment and itemAttachment attachments for the message. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPostRequestInformation(body: Attachment | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPostRequestInformation(body: Attachment | undefined, requestConfiguration?: AttachmentsRequestBuilderPostRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.POST; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The fileAttachment and itemAttachment attachments for the message. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of AttachmentsResponse */ - public get(queryParameters?: { - count?: boolean, - expand?: string[], - filter?: string, - orderby?: string[], - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: AttachmentsRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createAttachmentsResponseFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The fileAttachment and itemAttachment attachments for the message. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of Attachment */ - public post(body: Attachment | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public post(body: Attachment | undefined, requestConfiguration?: AttachmentsRequestBuilderPostRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPostRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createAttachmentFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/attachmentsRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/attachmentsRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..564324898 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/attachmentsRequestBuilderGetQueryParameters.ts @@ -0,0 +1,36 @@ + +/** The fileAttachment and itemAttachment attachments for the message. */ +export class AttachmentsRequestBuilderGetQueryParameters { + /** Include count of items */ + public count?: boolean | undefined; + /** Expand related entities */ + public expand?: string[] | undefined; + /** Filter items by property values */ + public filter?: string | undefined; + /** Order items by property values */ + public orderby?: string[] | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** Skip the first n items */ + public skip?: number | undefined; + /** Show only the first n items */ + public top?: number | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "count": return "%24count"; + case "expand": return "%24expand"; + case "filter": return "%24filter"; + case "orderby": return "%24orderby"; + case "select": return "%24select"; + case "skip": return "%24skip"; + case "top": return "%24top"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/attachmentsRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/attachmentsRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..f992d9d97 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/attachmentsRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {AttachmentsRequestBuilderGetQueryParameters} from './attachmentsRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class AttachmentsRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: AttachmentsRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/attachmentsRequestBuilderPostRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/attachmentsRequestBuilderPostRequestConfiguration.ts new file mode 100644 index 000000000..07b0c5a11 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/attachmentsRequestBuilderPostRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class AttachmentsRequestBuilderPostRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/attachmentItemRequestBuilder.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/attachmentItemRequestBuilder.ts index fee50658f..e6070c284 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/attachmentItemRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/attachmentItemRequestBuilder.ts @@ -1,5 +1,8 @@ import {Attachment} from '../../../../../../../../models/microsoft/graph/'; import {createAttachmentFromDiscriminatorValue} from '../../../../../../../../models/microsoft/graph/createAttachmentFromDiscriminatorValue'; +import {AttachmentItemRequestBuilderDeleteRequestConfiguration} from './attachmentItemRequestBuilderDeleteRequestConfiguration'; +import {AttachmentItemRequestBuilderGetRequestConfiguration} from './attachmentItemRequestBuilderGetRequestConfiguration'; +import {AttachmentItemRequestBuilderPatchRequestConfiguration} from './attachmentItemRequestBuilderPatchRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}/attachments/{attachment-id} */ @@ -18,104 +21,96 @@ export class AttachmentItemRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder_id}/messages/{message_id}/attachments/{attachment_id}{?select,expand}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messages/{message%2Did}/attachments/{attachment%2Did}{?%24select,%24expand}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The fileAttachment and itemAttachment attachments for the message. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createDeleteRequestInformation(headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createDeleteRequestInformation(requestConfiguration?: AttachmentItemRequestBuilderDeleteRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.DELETE; - if(headers) requestInfo.headers = headers; - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The fileAttachment and itemAttachment attachments for the message. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - expand?: string[], - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: AttachmentItemRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The fileAttachment and itemAttachment attachments for the message. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPatchRequestInformation(body: Attachment | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPatchRequestInformation(body: Attachment | undefined, requestConfiguration?: AttachmentItemRequestBuilderPatchRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.PATCH; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The fileAttachment and itemAttachment attachments for the message. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public delete(headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public delete(requestConfiguration?: AttachmentItemRequestBuilderDeleteRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createDeleteRequestInformation( - headers, options + requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The fileAttachment and itemAttachment attachments for the message. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of Attachment */ - public get(queryParameters?: { - expand?: string[], - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: AttachmentItemRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createAttachmentFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The fileAttachment and itemAttachment attachments for the message. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public patch(body: Attachment | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public patch(body: Attachment | undefined, requestConfiguration?: AttachmentItemRequestBuilderPatchRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPatchRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/attachmentItemRequestBuilderDeleteRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/attachmentItemRequestBuilderDeleteRequestConfiguration.ts new file mode 100644 index 000000000..7728f0472 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/attachmentItemRequestBuilderDeleteRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class AttachmentItemRequestBuilderDeleteRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/attachmentItemRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/attachmentItemRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..608cb794e --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/attachmentItemRequestBuilderGetQueryParameters.ts @@ -0,0 +1,21 @@ + +/** The fileAttachment and itemAttachment attachments for the message. */ +export class AttachmentItemRequestBuilderGetQueryParameters { + /** Expand related entities */ + public expand?: string[] | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "expand": return "%24expand"; + case "select": return "%24select"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/attachmentItemRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/attachmentItemRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..3fdd8abea --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/attachmentItemRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {AttachmentItemRequestBuilderGetQueryParameters} from './attachmentItemRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class AttachmentItemRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: AttachmentItemRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/attachmentItemRequestBuilderPatchRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/attachmentItemRequestBuilderPatchRequestConfiguration.ts new file mode 100644 index 000000000..a797c0fc7 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/attachments/item/attachmentItemRequestBuilderPatchRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class AttachmentItemRequestBuilderPatchRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/extensionsRequestBuilder.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/extensionsRequestBuilder.ts index cac1d331f..5e7dcdf67 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/extensionsRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/extensionsRequestBuilder.ts @@ -1,6 +1,8 @@ import {Extension} from '../../../../../../../models/microsoft/graph/'; import {createExtensionFromDiscriminatorValue} from '../../../../../../../models/microsoft/graph/createExtensionFromDiscriminatorValue'; import {createExtensionsResponseFromDiscriminatorValue} from './createExtensionsResponseFromDiscriminatorValue'; +import {ExtensionsRequestBuilderGetRequestConfiguration} from './extensionsRequestBuilderGetRequestConfiguration'; +import {ExtensionsRequestBuilderPostRequestConfiguration} from './extensionsRequestBuilderPostRequestConfiguration'; import {ExtensionsResponse} from './index'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; @@ -20,88 +22,70 @@ export class ExtensionsRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder_id}/messages/{message_id}/extensions{?top,skip,filter,count,orderby,select,expand}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messages/{message%2Did}/extensions{?%24top,%24skip,%24filter,%24count,%24orderby,%24select,%24expand}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The collection of open extensions defined for the message. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - count?: boolean, - expand?: string[], - filter?: string, - orderby?: string[], - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: ExtensionsRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of open extensions defined for the message. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPostRequestInformation(body: Extension | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPostRequestInformation(body: Extension | undefined, requestConfiguration?: ExtensionsRequestBuilderPostRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.POST; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The collection of open extensions defined for the message. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of ExtensionsResponse */ - public get(queryParameters?: { - count?: boolean, - expand?: string[], - filter?: string, - orderby?: string[], - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: ExtensionsRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createExtensionsResponseFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of open extensions defined for the message. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of Extension */ - public post(body: Extension | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public post(body: Extension | undefined, requestConfiguration?: ExtensionsRequestBuilderPostRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPostRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createExtensionFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/extensionsRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/extensionsRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..c2fd01fb4 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/extensionsRequestBuilderGetQueryParameters.ts @@ -0,0 +1,36 @@ + +/** The collection of open extensions defined for the message. Nullable. */ +export class ExtensionsRequestBuilderGetQueryParameters { + /** Include count of items */ + public count?: boolean | undefined; + /** Expand related entities */ + public expand?: string[] | undefined; + /** Filter items by property values */ + public filter?: string | undefined; + /** Order items by property values */ + public orderby?: string[] | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** Skip the first n items */ + public skip?: number | undefined; + /** Show only the first n items */ + public top?: number | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "count": return "%24count"; + case "expand": return "%24expand"; + case "filter": return "%24filter"; + case "orderby": return "%24orderby"; + case "select": return "%24select"; + case "skip": return "%24skip"; + case "top": return "%24top"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/extensionsRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/extensionsRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..27d6181fc --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/extensionsRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {ExtensionsRequestBuilderGetQueryParameters} from './extensionsRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class ExtensionsRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: ExtensionsRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/extensionsRequestBuilderPostRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/extensionsRequestBuilderPostRequestConfiguration.ts new file mode 100644 index 000000000..4a22cd949 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/extensionsRequestBuilderPostRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class ExtensionsRequestBuilderPostRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/extensionItemRequestBuilder.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/extensionItemRequestBuilder.ts index b9e2d9c88..c94064a50 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/extensionItemRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/extensionItemRequestBuilder.ts @@ -1,5 +1,8 @@ import {Extension} from '../../../../../../../../models/microsoft/graph/'; import {createExtensionFromDiscriminatorValue} from '../../../../../../../../models/microsoft/graph/createExtensionFromDiscriminatorValue'; +import {ExtensionItemRequestBuilderDeleteRequestConfiguration} from './extensionItemRequestBuilderDeleteRequestConfiguration'; +import {ExtensionItemRequestBuilderGetRequestConfiguration} from './extensionItemRequestBuilderGetRequestConfiguration'; +import {ExtensionItemRequestBuilderPatchRequestConfiguration} from './extensionItemRequestBuilderPatchRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}/extensions/{extension-id} */ @@ -18,104 +21,96 @@ export class ExtensionItemRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder_id}/messages/{message_id}/extensions/{extension_id}{?select,expand}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messages/{message%2Did}/extensions/{extension%2Did}{?%24select,%24expand}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The collection of open extensions defined for the message. Nullable. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createDeleteRequestInformation(headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createDeleteRequestInformation(requestConfiguration?: ExtensionItemRequestBuilderDeleteRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.DELETE; - if(headers) requestInfo.headers = headers; - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of open extensions defined for the message. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - expand?: string[], - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: ExtensionItemRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of open extensions defined for the message. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPatchRequestInformation(body: Extension | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPatchRequestInformation(body: Extension | undefined, requestConfiguration?: ExtensionItemRequestBuilderPatchRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.PATCH; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The collection of open extensions defined for the message. Nullable. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public delete(headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public delete(requestConfiguration?: ExtensionItemRequestBuilderDeleteRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createDeleteRequestInformation( - headers, options + requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of open extensions defined for the message. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of Extension */ - public get(queryParameters?: { - expand?: string[], - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: ExtensionItemRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createExtensionFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of open extensions defined for the message. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public patch(body: Extension | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public patch(body: Extension | undefined, requestConfiguration?: ExtensionItemRequestBuilderPatchRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPatchRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/extensionItemRequestBuilderDeleteRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/extensionItemRequestBuilderDeleteRequestConfiguration.ts new file mode 100644 index 000000000..09d700a6f --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/extensionItemRequestBuilderDeleteRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class ExtensionItemRequestBuilderDeleteRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/extensionItemRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/extensionItemRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..1aa0f6694 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/extensionItemRequestBuilderGetQueryParameters.ts @@ -0,0 +1,21 @@ + +/** The collection of open extensions defined for the message. Nullable. */ +export class ExtensionItemRequestBuilderGetQueryParameters { + /** Expand related entities */ + public expand?: string[] | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "expand": return "%24expand"; + case "select": return "%24select"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/extensionItemRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/extensionItemRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..690bab1d3 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/extensionItemRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {ExtensionItemRequestBuilderGetQueryParameters} from './extensionItemRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class ExtensionItemRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: ExtensionItemRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/extensionItemRequestBuilderPatchRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/extensionItemRequestBuilderPatchRequestConfiguration.ts new file mode 100644 index 000000000..55eda35fc --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/extensions/item/extensionItemRequestBuilderPatchRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class ExtensionItemRequestBuilderPatchRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/messageItemRequestBuilder.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/messageItemRequestBuilder.ts index 1a193f135..f6480fed7 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/messageItemRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/messageItemRequestBuilder.ts @@ -4,6 +4,9 @@ import {AttachmentsRequestBuilder} from './attachments/attachmentsRequestBuilder import {AttachmentItemRequestBuilder} from './attachments/item/attachmentItemRequestBuilder'; import {ExtensionsRequestBuilder} from './extensions/extensionsRequestBuilder'; import {ExtensionItemRequestBuilder} from './extensions/item/extensionItemRequestBuilder'; +import {MessageItemRequestBuilderDeleteRequestConfiguration} from './messageItemRequestBuilderDeleteRequestConfiguration'; +import {MessageItemRequestBuilderGetRequestConfiguration} from './messageItemRequestBuilderGetRequestConfiguration'; +import {MessageItemRequestBuilderPatchRequestConfiguration} from './messageItemRequestBuilderPatchRequestConfiguration'; import {MultiValueLegacyExtendedPropertyItemRequestBuilder} from './multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilder'; import {MultiValueExtendedPropertiesRequestBuilder} from './multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilder'; import {SingleValueLegacyExtendedPropertyItemRequestBuilder} from './singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilder'; @@ -47,7 +50,7 @@ export class MessageItemRequestBuilder { public attachmentsById(id: string) : AttachmentItemRequestBuilder { if(!id) throw new Error("id cannot be undefined"); const urlTplParams = getPathParameters(this.pathParameters); - urlTplParams["attachment_id"] = id + urlTplParams["attachment%2Did"] = id return new AttachmentItemRequestBuilder(urlTplParams, this.requestAdapter); }; /** @@ -58,73 +61,71 @@ export class MessageItemRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder_id}/messages/{message_id}{?select,expand}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messages/{message%2Did}{?%24select,%24expand}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The collection of messages in the mailFolder. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createDeleteRequestInformation(headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createDeleteRequestInformation(requestConfiguration?: MessageItemRequestBuilderDeleteRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.DELETE; - if(headers) requestInfo.headers = headers; - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of messages in the mailFolder. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - expand?: string[], - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: MessageItemRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of messages in the mailFolder. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPatchRequestInformation(body: Message | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPatchRequestInformation(body: Message | undefined, requestConfiguration?: MessageItemRequestBuilderPatchRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.PATCH; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The collection of messages in the mailFolder. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public delete(headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public delete(requestConfiguration?: MessageItemRequestBuilderDeleteRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createDeleteRequestInformation( - headers, options + requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; @@ -136,23 +137,18 @@ export class MessageItemRequestBuilder { public extensionsById(id: string) : ExtensionItemRequestBuilder { if(!id) throw new Error("id cannot be undefined"); const urlTplParams = getPathParameters(this.pathParameters); - urlTplParams["extension_id"] = id + urlTplParams["extension%2Did"] = id return new ExtensionItemRequestBuilder(urlTplParams, this.requestAdapter); }; /** * The collection of messages in the mailFolder. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of Message */ - public get(queryParameters?: { - expand?: string[], - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: MessageItemRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createMessageFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; @@ -164,20 +160,19 @@ export class MessageItemRequestBuilder { public multiValueExtendedPropertiesById(id: string) : MultiValueLegacyExtendedPropertyItemRequestBuilder { if(!id) throw new Error("id cannot be undefined"); const urlTplParams = getPathParameters(this.pathParameters); - urlTplParams["multiValueLegacyExtendedProperty_id"] = id + urlTplParams["multiValueLegacyExtendedProperty%2Did"] = id return new MultiValueLegacyExtendedPropertyItemRequestBuilder(urlTplParams, this.requestAdapter); }; /** * The collection of messages in the mailFolder. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public patch(body: Message | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public patch(body: Message | undefined, requestConfiguration?: MessageItemRequestBuilderPatchRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPatchRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; @@ -189,7 +184,7 @@ export class MessageItemRequestBuilder { public singleValueExtendedPropertiesById(id: string) : SingleValueLegacyExtendedPropertyItemRequestBuilder { if(!id) throw new Error("id cannot be undefined"); const urlTplParams = getPathParameters(this.pathParameters); - urlTplParams["singleValueLegacyExtendedProperty_id"] = id + urlTplParams["singleValueLegacyExtendedProperty%2Did"] = id return new SingleValueLegacyExtendedPropertyItemRequestBuilder(urlTplParams, this.requestAdapter); }; } diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/messageItemRequestBuilderDeleteRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/messageItemRequestBuilderDeleteRequestConfiguration.ts new file mode 100644 index 000000000..11b00b6f2 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/messageItemRequestBuilderDeleteRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MessageItemRequestBuilderDeleteRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/messageItemRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/messageItemRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..7c15d57af --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/messageItemRequestBuilderGetQueryParameters.ts @@ -0,0 +1,21 @@ + +/** The collection of messages in the mailFolder. */ +export class MessageItemRequestBuilderGetQueryParameters { + /** Expand related entities */ + public expand?: string[] | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "expand": return "%24expand"; + case "select": return "%24select"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/messageItemRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/messageItemRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..3d5f0081b --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/messageItemRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {MessageItemRequestBuilderGetQueryParameters} from './messageItemRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MessageItemRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: MessageItemRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/messageItemRequestBuilderPatchRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/messageItemRequestBuilderPatchRequestConfiguration.ts new file mode 100644 index 000000000..1d409cca3 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/messageItemRequestBuilderPatchRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MessageItemRequestBuilderPatchRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilder.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilder.ts index 858d6bc86..42b21ee6c 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilder.ts @@ -1,5 +1,8 @@ import {MultiValueLegacyExtendedProperty} from '../../../../../../../../models/microsoft/graph/'; import {createMultiValueLegacyExtendedPropertyFromDiscriminatorValue} from '../../../../../../../../models/microsoft/graph/createMultiValueLegacyExtendedPropertyFromDiscriminatorValue'; +import {MultiValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration} from './multiValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration'; +import {MultiValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration} from './multiValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration'; +import {MultiValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration} from './multiValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}/multiValueExtendedProperties/{multiValueLegacyExtendedProperty-id} */ @@ -18,104 +21,96 @@ export class MultiValueLegacyExtendedPropertyItemRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder_id}/messages/{message_id}/multiValueExtendedProperties/{multiValueLegacyExtendedProperty_id}{?select,expand}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messages/{message%2Did}/multiValueExtendedProperties/{multiValueLegacyExtendedProperty%2Did}{?%24select,%24expand}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The collection of multi-value extended properties defined for the message. Nullable. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createDeleteRequestInformation(headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createDeleteRequestInformation(requestConfiguration?: MultiValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.DELETE; - if(headers) requestInfo.headers = headers; - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of multi-value extended properties defined for the message. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - expand?: string[], - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: MultiValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of multi-value extended properties defined for the message. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPatchRequestInformation(body: MultiValueLegacyExtendedProperty | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPatchRequestInformation(body: MultiValueLegacyExtendedProperty | undefined, requestConfiguration?: MultiValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.PATCH; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The collection of multi-value extended properties defined for the message. Nullable. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public delete(headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public delete(requestConfiguration?: MultiValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createDeleteRequestInformation( - headers, options + requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of multi-value extended properties defined for the message. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of MultiValueLegacyExtendedProperty */ - public get(queryParameters?: { - expand?: string[], - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: MultiValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createMultiValueLegacyExtendedPropertyFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of multi-value extended properties defined for the message. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public patch(body: MultiValueLegacyExtendedProperty | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public patch(body: MultiValueLegacyExtendedProperty | undefined, requestConfiguration?: MultiValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPatchRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration.ts new file mode 100644 index 000000000..27f9e72e3 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MultiValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..2953020a8 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters.ts @@ -0,0 +1,21 @@ + +/** The collection of multi-value extended properties defined for the message. Nullable. */ +export class MultiValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters { + /** Expand related entities */ + public expand?: string[] | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "expand": return "%24expand"; + case "select": return "%24select"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..aa1b0375b --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {MultiValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters} from './multiValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MultiValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: MultiValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration.ts new file mode 100644 index 000000000..67468d27f --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MultiValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilder.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilder.ts index 20d94feb6..87faf8a78 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilder.ts @@ -2,6 +2,8 @@ import {MultiValueLegacyExtendedProperty} from '../../../../../../../models/micr import {createMultiValueLegacyExtendedPropertyFromDiscriminatorValue} from '../../../../../../../models/microsoft/graph/createMultiValueLegacyExtendedPropertyFromDiscriminatorValue'; import {createMultiValueExtendedPropertiesResponseFromDiscriminatorValue} from './createMultiValueExtendedPropertiesResponseFromDiscriminatorValue'; import {MultiValueExtendedPropertiesResponse} from './index'; +import {MultiValueExtendedPropertiesRequestBuilderGetRequestConfiguration} from './multiValueExtendedPropertiesRequestBuilderGetRequestConfiguration'; +import {MultiValueExtendedPropertiesRequestBuilderPostRequestConfiguration} from './multiValueExtendedPropertiesRequestBuilderPostRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}/multiValueExtendedProperties */ @@ -20,90 +22,70 @@ export class MultiValueExtendedPropertiesRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder_id}/messages/{message_id}/multiValueExtendedProperties{?top,skip,search,filter,count,orderby,select,expand}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messages/{message%2Did}/multiValueExtendedProperties{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select,%24expand}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The collection of multi-value extended properties defined for the message. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - count?: boolean, - expand?: string[], - filter?: string, - orderby?: string[], - search?: string, - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: MultiValueExtendedPropertiesRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of multi-value extended properties defined for the message. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPostRequestInformation(body: MultiValueLegacyExtendedProperty | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPostRequestInformation(body: MultiValueLegacyExtendedProperty | undefined, requestConfiguration?: MultiValueExtendedPropertiesRequestBuilderPostRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.POST; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The collection of multi-value extended properties defined for the message. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of MultiValueExtendedPropertiesResponse */ - public get(queryParameters?: { - count?: boolean, - expand?: string[], - filter?: string, - orderby?: string[], - search?: string, - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: MultiValueExtendedPropertiesRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createMultiValueExtendedPropertiesResponseFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of multi-value extended properties defined for the message. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of MultiValueLegacyExtendedProperty */ - public post(body: MultiValueLegacyExtendedProperty | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public post(body: MultiValueLegacyExtendedProperty | undefined, requestConfiguration?: MultiValueExtendedPropertiesRequestBuilderPostRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPostRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createMultiValueLegacyExtendedPropertyFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..ef32fc476 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderGetQueryParameters.ts @@ -0,0 +1,39 @@ + +/** The collection of multi-value extended properties defined for the message. Nullable. */ +export class MultiValueExtendedPropertiesRequestBuilderGetQueryParameters { + /** Include count of items */ + public count?: boolean | undefined; + /** Expand related entities */ + public expand?: string[] | undefined; + /** Filter items by property values */ + public filter?: string | undefined; + /** Order items by property values */ + public orderby?: string[] | undefined; + /** Search items by search phrases */ + public search?: string | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** Skip the first n items */ + public skip?: number | undefined; + /** Show only the first n items */ + public top?: number | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "count": return "%24count"; + case "expand": return "%24expand"; + case "filter": return "%24filter"; + case "orderby": return "%24orderby"; + case "search": return "%24search"; + case "select": return "%24select"; + case "skip": return "%24skip"; + case "top": return "%24top"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..c3ebde9df --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {MultiValueExtendedPropertiesRequestBuilderGetQueryParameters} from './multiValueExtendedPropertiesRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MultiValueExtendedPropertiesRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: MultiValueExtendedPropertiesRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderPostRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderPostRequestConfiguration.ts new file mode 100644 index 000000000..95a758e07 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderPostRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MultiValueExtendedPropertiesRequestBuilderPostRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilder.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilder.ts index aef6ad300..20d1003a4 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilder.ts @@ -1,5 +1,8 @@ import {SingleValueLegacyExtendedProperty} from '../../../../../../../../models/microsoft/graph/'; import {createSingleValueLegacyExtendedPropertyFromDiscriminatorValue} from '../../../../../../../../models/microsoft/graph/createSingleValueLegacyExtendedPropertyFromDiscriminatorValue'; +import {SingleValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration} from './singleValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration'; +import {SingleValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration} from './singleValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration'; +import {SingleValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration} from './singleValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}/singleValueExtendedProperties/{singleValueLegacyExtendedProperty-id} */ @@ -18,104 +21,96 @@ export class SingleValueLegacyExtendedPropertyItemRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder_id}/messages/{message_id}/singleValueExtendedProperties/{singleValueLegacyExtendedProperty_id}{?select,expand}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messages/{message%2Did}/singleValueExtendedProperties/{singleValueLegacyExtendedProperty%2Did}{?%24select,%24expand}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The collection of single-value extended properties defined for the message. Nullable. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createDeleteRequestInformation(headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createDeleteRequestInformation(requestConfiguration?: SingleValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.DELETE; - if(headers) requestInfo.headers = headers; - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of single-value extended properties defined for the message. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - expand?: string[], - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: SingleValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of single-value extended properties defined for the message. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPatchRequestInformation(body: SingleValueLegacyExtendedProperty | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPatchRequestInformation(body: SingleValueLegacyExtendedProperty | undefined, requestConfiguration?: SingleValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.PATCH; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The collection of single-value extended properties defined for the message. Nullable. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public delete(headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public delete(requestConfiguration?: SingleValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createDeleteRequestInformation( - headers, options + requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of single-value extended properties defined for the message. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of SingleValueLegacyExtendedProperty */ - public get(queryParameters?: { - expand?: string[], - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: SingleValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createSingleValueLegacyExtendedPropertyFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of single-value extended properties defined for the message. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public patch(body: SingleValueLegacyExtendedProperty | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public patch(body: SingleValueLegacyExtendedProperty | undefined, requestConfiguration?: SingleValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPatchRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration.ts new file mode 100644 index 000000000..44c12bae7 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class SingleValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..e59028f62 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters.ts @@ -0,0 +1,21 @@ + +/** The collection of single-value extended properties defined for the message. Nullable. */ +export class SingleValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters { + /** Expand related entities */ + public expand?: string[] | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "expand": return "%24expand"; + case "select": return "%24select"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..1dffa284b --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {SingleValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters} from './singleValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class SingleValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: SingleValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration.ts new file mode 100644 index 000000000..85ca051bf --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class SingleValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilder.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilder.ts index dfe78596c..7af807032 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilder.ts @@ -2,6 +2,8 @@ import {SingleValueLegacyExtendedProperty} from '../../../../../../../models/mic import {createSingleValueLegacyExtendedPropertyFromDiscriminatorValue} from '../../../../../../../models/microsoft/graph/createSingleValueLegacyExtendedPropertyFromDiscriminatorValue'; import {createSingleValueExtendedPropertiesResponseFromDiscriminatorValue} from './createSingleValueExtendedPropertiesResponseFromDiscriminatorValue'; import {SingleValueExtendedPropertiesResponse} from './index'; +import {SingleValueExtendedPropertiesRequestBuilderGetRequestConfiguration} from './singleValueExtendedPropertiesRequestBuilderGetRequestConfiguration'; +import {SingleValueExtendedPropertiesRequestBuilderPostRequestConfiguration} from './singleValueExtendedPropertiesRequestBuilderPostRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}/singleValueExtendedProperties */ @@ -20,90 +22,70 @@ export class SingleValueExtendedPropertiesRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder_id}/messages/{message_id}/singleValueExtendedProperties{?top,skip,search,filter,count,orderby,select,expand}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messages/{message%2Did}/singleValueExtendedProperties{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select,%24expand}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The collection of single-value extended properties defined for the message. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - count?: boolean, - expand?: string[], - filter?: string, - orderby?: string[], - search?: string, - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: SingleValueExtendedPropertiesRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of single-value extended properties defined for the message. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPostRequestInformation(body: SingleValueLegacyExtendedProperty | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPostRequestInformation(body: SingleValueLegacyExtendedProperty | undefined, requestConfiguration?: SingleValueExtendedPropertiesRequestBuilderPostRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.POST; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The collection of single-value extended properties defined for the message. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of SingleValueExtendedPropertiesResponse */ - public get(queryParameters?: { - count?: boolean, - expand?: string[], - filter?: string, - orderby?: string[], - search?: string, - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: SingleValueExtendedPropertiesRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createSingleValueExtendedPropertiesResponseFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of single-value extended properties defined for the message. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of SingleValueLegacyExtendedProperty */ - public post(body: SingleValueLegacyExtendedProperty | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public post(body: SingleValueLegacyExtendedProperty | undefined, requestConfiguration?: SingleValueExtendedPropertiesRequestBuilderPostRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPostRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createSingleValueLegacyExtendedPropertyFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..abc9468a4 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderGetQueryParameters.ts @@ -0,0 +1,39 @@ + +/** The collection of single-value extended properties defined for the message. Nullable. */ +export class SingleValueExtendedPropertiesRequestBuilderGetQueryParameters { + /** Include count of items */ + public count?: boolean | undefined; + /** Expand related entities */ + public expand?: string[] | undefined; + /** Filter items by property values */ + public filter?: string | undefined; + /** Order items by property values */ + public orderby?: string[] | undefined; + /** Search items by search phrases */ + public search?: string | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** Skip the first n items */ + public skip?: number | undefined; + /** Show only the first n items */ + public top?: number | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "count": return "%24count"; + case "expand": return "%24expand"; + case "filter": return "%24filter"; + case "orderby": return "%24orderby"; + case "search": return "%24search"; + case "select": return "%24select"; + case "skip": return "%24skip"; + case "top": return "%24top"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..0fc0196cf --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {SingleValueExtendedPropertiesRequestBuilderGetQueryParameters} from './singleValueExtendedPropertiesRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class SingleValueExtendedPropertiesRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: SingleValueExtendedPropertiesRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderPostRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderPostRequestConfiguration.ts new file mode 100644 index 000000000..22c34144a --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderPostRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class SingleValueExtendedPropertiesRequestBuilderPostRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/value/contentRequestBuilder.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/value/contentRequestBuilder.ts index 939b7df4b..0faae8aba 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/value/contentRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/value/contentRequestBuilder.ts @@ -1,3 +1,5 @@ +import {ContentRequestBuilderGetRequestConfiguration} from './contentRequestBuilderGetRequestConfiguration'; +import {ContentRequestBuilderPutRequestConfiguration} from './contentRequestBuilderPutRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}/$value */ @@ -16,68 +18,68 @@ export class ContentRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder_id}/messages/{message_id}/$value"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messages/{message%2Did}/$value"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * Get media content for the navigation property messages from users - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: ContentRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * Update media content for the navigation property messages in users * @param body Binary request body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPutRequestInformation(body: ArrayBuffer, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPutRequestInformation(body: ArrayBuffer, requestConfiguration?: ContentRequestBuilderPutRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.PUT; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setStreamContent(body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * Get media content for the navigation property messages from users - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of ArrayBuffer */ - public get(headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: ContentRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - headers, options + requestConfiguration ); return this.requestAdapter?.sendPrimitiveAsync(requestInfo, "ArrayBuffer", responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * Update media content for the navigation property messages in users * @param body Binary request body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public put(body: ArrayBuffer, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public put(body: ArrayBuffer, requestConfiguration?: ContentRequestBuilderPutRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPutRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/value/contentRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/value/contentRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..9653077a4 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/value/contentRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class ContentRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/item/value/contentRequestBuilderPutRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/value/contentRequestBuilderPutRequestConfiguration.ts new file mode 100644 index 000000000..18bf72bbb --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/item/value/contentRequestBuilderPutRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class ContentRequestBuilderPutRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/messagesRequestBuilder.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/messagesRequestBuilder.ts index 31d2b2ac2..c5b0b7c20 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/messages/messagesRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/messagesRequestBuilder.ts @@ -2,6 +2,8 @@ import {Message} from '../../../../../models/microsoft/graph/'; import {createMessageFromDiscriminatorValue} from '../../../../../models/microsoft/graph/createMessageFromDiscriminatorValue'; import {createMessagesResponseFromDiscriminatorValue} from './createMessagesResponseFromDiscriminatorValue'; import {MessagesResponse} from './index'; +import {MessagesRequestBuilderGetRequestConfiguration} from './messagesRequestBuilderGetRequestConfiguration'; +import {MessagesRequestBuilderPostRequestConfiguration} from './messagesRequestBuilderPostRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/messages */ @@ -20,90 +22,70 @@ export class MessagesRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder_id}/messages{?top,skip,search,filter,count,orderby,select,expand}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/messages{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select,%24expand}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The collection of messages in the mailFolder. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - count?: boolean, - expand?: string[], - filter?: string, - orderby?: string[], - search?: string, - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: MessagesRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of messages in the mailFolder. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPostRequestInformation(body: Message | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPostRequestInformation(body: Message | undefined, requestConfiguration?: MessagesRequestBuilderPostRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.POST; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The collection of messages in the mailFolder. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of MessagesResponse */ - public get(queryParameters?: { - count?: boolean, - expand?: string[], - filter?: string, - orderby?: string[], - search?: string, - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: MessagesRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createMessagesResponseFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of messages in the mailFolder. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of Message */ - public post(body: Message | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public post(body: Message | undefined, requestConfiguration?: MessagesRequestBuilderPostRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPostRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createMessageFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/messagesRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/messagesRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..aa095eb25 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/messagesRequestBuilderGetQueryParameters.ts @@ -0,0 +1,39 @@ + +/** The collection of messages in the mailFolder. */ +export class MessagesRequestBuilderGetQueryParameters { + /** Include count of items */ + public count?: boolean | undefined; + /** Expand related entities */ + public expand?: string[] | undefined; + /** Filter items by property values */ + public filter?: string | undefined; + /** Order items by property values */ + public orderby?: string[] | undefined; + /** Search items by search phrases */ + public search?: string | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** Skip the first n items */ + public skip?: number | undefined; + /** Show only the first n items */ + public top?: number | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "count": return "%24count"; + case "expand": return "%24expand"; + case "filter": return "%24filter"; + case "orderby": return "%24orderby"; + case "search": return "%24search"; + case "select": return "%24select"; + case "skip": return "%24skip"; + case "top": return "%24top"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/messagesRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/messagesRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..ac520d12c --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/messagesRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {MessagesRequestBuilderGetQueryParameters} from './messagesRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MessagesRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: MessagesRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/messages/messagesRequestBuilderPostRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/messages/messagesRequestBuilderPostRequestConfiguration.ts new file mode 100644 index 000000000..8e9c4ece4 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/messages/messagesRequestBuilderPostRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MessagesRequestBuilderPostRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilder.ts b/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilder.ts index 7964ea788..4e036de22 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilder.ts @@ -1,5 +1,8 @@ import {MultiValueLegacyExtendedProperty} from '../../../../../../models/microsoft/graph/'; import {createMultiValueLegacyExtendedPropertyFromDiscriminatorValue} from '../../../../../../models/microsoft/graph/createMultiValueLegacyExtendedPropertyFromDiscriminatorValue'; +import {MultiValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration} from './multiValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration'; +import {MultiValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration} from './multiValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration'; +import {MultiValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration} from './multiValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/multiValueExtendedProperties/{multiValueLegacyExtendedProperty-id} */ @@ -18,104 +21,96 @@ export class MultiValueLegacyExtendedPropertyItemRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder_id}/multiValueExtendedProperties/{multiValueLegacyExtendedProperty_id}{?select,expand}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/multiValueExtendedProperties/{multiValueLegacyExtendedProperty%2Did}{?%24select,%24expand}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The collection of multi-value extended properties defined for the mailFolder. Read-only. Nullable. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createDeleteRequestInformation(headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createDeleteRequestInformation(requestConfiguration?: MultiValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.DELETE; - if(headers) requestInfo.headers = headers; - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of multi-value extended properties defined for the mailFolder. Read-only. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - expand?: string[], - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: MultiValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of multi-value extended properties defined for the mailFolder. Read-only. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPatchRequestInformation(body: MultiValueLegacyExtendedProperty | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPatchRequestInformation(body: MultiValueLegacyExtendedProperty | undefined, requestConfiguration?: MultiValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.PATCH; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The collection of multi-value extended properties defined for the mailFolder. Read-only. Nullable. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public delete(headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public delete(requestConfiguration?: MultiValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createDeleteRequestInformation( - headers, options + requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of multi-value extended properties defined for the mailFolder. Read-only. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of MultiValueLegacyExtendedProperty */ - public get(queryParameters?: { - expand?: string[], - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: MultiValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createMultiValueLegacyExtendedPropertyFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of multi-value extended properties defined for the mailFolder. Read-only. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public patch(body: MultiValueLegacyExtendedProperty | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public patch(body: MultiValueLegacyExtendedProperty | undefined, requestConfiguration?: MultiValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPatchRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration.ts new file mode 100644 index 000000000..27f9e72e3 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MultiValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..853396fcc --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters.ts @@ -0,0 +1,21 @@ + +/** The collection of multi-value extended properties defined for the mailFolder. Read-only. Nullable. */ +export class MultiValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters { + /** Expand related entities */ + public expand?: string[] | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "expand": return "%24expand"; + case "select": return "%24select"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..aa1b0375b --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {MultiValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters} from './multiValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MultiValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: MultiValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration.ts new file mode 100644 index 000000000..67468d27f --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MultiValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilder.ts b/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilder.ts index d71eb1ea2..72cf02f63 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilder.ts @@ -2,6 +2,8 @@ import {MultiValueLegacyExtendedProperty} from '../../../../../models/microsoft/ import {createMultiValueLegacyExtendedPropertyFromDiscriminatorValue} from '../../../../../models/microsoft/graph/createMultiValueLegacyExtendedPropertyFromDiscriminatorValue'; import {createMultiValueExtendedPropertiesResponseFromDiscriminatorValue} from './createMultiValueExtendedPropertiesResponseFromDiscriminatorValue'; import {MultiValueExtendedPropertiesResponse} from './index'; +import {MultiValueExtendedPropertiesRequestBuilderGetRequestConfiguration} from './multiValueExtendedPropertiesRequestBuilderGetRequestConfiguration'; +import {MultiValueExtendedPropertiesRequestBuilderPostRequestConfiguration} from './multiValueExtendedPropertiesRequestBuilderPostRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/multiValueExtendedProperties */ @@ -20,90 +22,70 @@ export class MultiValueExtendedPropertiesRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder_id}/multiValueExtendedProperties{?top,skip,search,filter,count,orderby,select,expand}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/multiValueExtendedProperties{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select,%24expand}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The collection of multi-value extended properties defined for the mailFolder. Read-only. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - count?: boolean, - expand?: string[], - filter?: string, - orderby?: string[], - search?: string, - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: MultiValueExtendedPropertiesRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of multi-value extended properties defined for the mailFolder. Read-only. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPostRequestInformation(body: MultiValueLegacyExtendedProperty | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPostRequestInformation(body: MultiValueLegacyExtendedProperty | undefined, requestConfiguration?: MultiValueExtendedPropertiesRequestBuilderPostRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.POST; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The collection of multi-value extended properties defined for the mailFolder. Read-only. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of MultiValueExtendedPropertiesResponse */ - public get(queryParameters?: { - count?: boolean, - expand?: string[], - filter?: string, - orderby?: string[], - search?: string, - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: MultiValueExtendedPropertiesRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createMultiValueExtendedPropertiesResponseFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of multi-value extended properties defined for the mailFolder. Read-only. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of MultiValueLegacyExtendedProperty */ - public post(body: MultiValueLegacyExtendedProperty | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public post(body: MultiValueLegacyExtendedProperty | undefined, requestConfiguration?: MultiValueExtendedPropertiesRequestBuilderPostRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPostRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createMultiValueLegacyExtendedPropertyFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..83a593f9b --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderGetQueryParameters.ts @@ -0,0 +1,39 @@ + +/** The collection of multi-value extended properties defined for the mailFolder. Read-only. Nullable. */ +export class MultiValueExtendedPropertiesRequestBuilderGetQueryParameters { + /** Include count of items */ + public count?: boolean | undefined; + /** Expand related entities */ + public expand?: string[] | undefined; + /** Filter items by property values */ + public filter?: string | undefined; + /** Order items by property values */ + public orderby?: string[] | undefined; + /** Search items by search phrases */ + public search?: string | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** Skip the first n items */ + public skip?: number | undefined; + /** Show only the first n items */ + public top?: number | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "count": return "%24count"; + case "expand": return "%24expand"; + case "filter": return "%24filter"; + case "orderby": return "%24orderby"; + case "search": return "%24search"; + case "select": return "%24select"; + case "skip": return "%24skip"; + case "top": return "%24top"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..c3ebde9df --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {MultiValueExtendedPropertiesRequestBuilderGetQueryParameters} from './multiValueExtendedPropertiesRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MultiValueExtendedPropertiesRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: MultiValueExtendedPropertiesRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderPostRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderPostRequestConfiguration.ts new file mode 100644 index 000000000..95a758e07 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderPostRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MultiValueExtendedPropertiesRequestBuilderPostRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilder.ts b/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilder.ts index 03b1b04a6..09a816b73 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilder.ts @@ -1,5 +1,8 @@ import {SingleValueLegacyExtendedProperty} from '../../../../../../models/microsoft/graph/'; import {createSingleValueLegacyExtendedPropertyFromDiscriminatorValue} from '../../../../../../models/microsoft/graph/createSingleValueLegacyExtendedPropertyFromDiscriminatorValue'; +import {SingleValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration} from './singleValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration'; +import {SingleValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration} from './singleValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration'; +import {SingleValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration} from './singleValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/singleValueExtendedProperties/{singleValueLegacyExtendedProperty-id} */ @@ -18,104 +21,96 @@ export class SingleValueLegacyExtendedPropertyItemRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder_id}/singleValueExtendedProperties/{singleValueLegacyExtendedProperty_id}{?select,expand}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/singleValueExtendedProperties/{singleValueLegacyExtendedProperty%2Did}{?%24select,%24expand}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The collection of single-value extended properties defined for the mailFolder. Read-only. Nullable. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createDeleteRequestInformation(headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createDeleteRequestInformation(requestConfiguration?: SingleValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.DELETE; - if(headers) requestInfo.headers = headers; - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of single-value extended properties defined for the mailFolder. Read-only. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - expand?: string[], - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: SingleValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of single-value extended properties defined for the mailFolder. Read-only. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPatchRequestInformation(body: SingleValueLegacyExtendedProperty | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPatchRequestInformation(body: SingleValueLegacyExtendedProperty | undefined, requestConfiguration?: SingleValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.PATCH; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The collection of single-value extended properties defined for the mailFolder. Read-only. Nullable. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public delete(headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public delete(requestConfiguration?: SingleValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createDeleteRequestInformation( - headers, options + requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of single-value extended properties defined for the mailFolder. Read-only. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of SingleValueLegacyExtendedProperty */ - public get(queryParameters?: { - expand?: string[], - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: SingleValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createSingleValueLegacyExtendedPropertyFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of single-value extended properties defined for the mailFolder. Read-only. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public patch(body: SingleValueLegacyExtendedProperty | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public patch(body: SingleValueLegacyExtendedProperty | undefined, requestConfiguration?: SingleValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPatchRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration.ts new file mode 100644 index 000000000..44c12bae7 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class SingleValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..7967305c9 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters.ts @@ -0,0 +1,21 @@ + +/** The collection of single-value extended properties defined for the mailFolder. Read-only. Nullable. */ +export class SingleValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters { + /** Expand related entities */ + public expand?: string[] | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "expand": return "%24expand"; + case "select": return "%24select"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..1dffa284b --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {SingleValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters} from './singleValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class SingleValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: SingleValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration.ts new file mode 100644 index 000000000..85ca051bf --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class SingleValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilder.ts b/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilder.ts index bd5696a2c..123340408 100644 --- a/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilder.ts @@ -2,6 +2,8 @@ import {SingleValueLegacyExtendedProperty} from '../../../../../models/microsoft import {createSingleValueLegacyExtendedPropertyFromDiscriminatorValue} from '../../../../../models/microsoft/graph/createSingleValueLegacyExtendedPropertyFromDiscriminatorValue'; import {createSingleValueExtendedPropertiesResponseFromDiscriminatorValue} from './createSingleValueExtendedPropertiesResponseFromDiscriminatorValue'; import {SingleValueExtendedPropertiesResponse} from './index'; +import {SingleValueExtendedPropertiesRequestBuilderGetRequestConfiguration} from './singleValueExtendedPropertiesRequestBuilderGetRequestConfiguration'; +import {SingleValueExtendedPropertiesRequestBuilderPostRequestConfiguration} from './singleValueExtendedPropertiesRequestBuilderPostRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/mailFolders/{mailFolder-id}/singleValueExtendedProperties */ @@ -20,90 +22,70 @@ export class SingleValueExtendedPropertiesRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder_id}/singleValueExtendedProperties{?top,skip,search,filter,count,orderby,select,expand}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders/{mailFolder%2Did}/singleValueExtendedProperties{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select,%24expand}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The collection of single-value extended properties defined for the mailFolder. Read-only. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - count?: boolean, - expand?: string[], - filter?: string, - orderby?: string[], - search?: string, - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: SingleValueExtendedPropertiesRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of single-value extended properties defined for the mailFolder. Read-only. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPostRequestInformation(body: SingleValueLegacyExtendedProperty | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPostRequestInformation(body: SingleValueLegacyExtendedProperty | undefined, requestConfiguration?: SingleValueExtendedPropertiesRequestBuilderPostRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.POST; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The collection of single-value extended properties defined for the mailFolder. Read-only. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of SingleValueExtendedPropertiesResponse */ - public get(queryParameters?: { - count?: boolean, - expand?: string[], - filter?: string, - orderby?: string[], - search?: string, - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: SingleValueExtendedPropertiesRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createSingleValueExtendedPropertiesResponseFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of single-value extended properties defined for the mailFolder. Read-only. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of SingleValueLegacyExtendedProperty */ - public post(body: SingleValueLegacyExtendedProperty | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public post(body: SingleValueLegacyExtendedProperty | undefined, requestConfiguration?: SingleValueExtendedPropertiesRequestBuilderPostRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPostRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createSingleValueLegacyExtendedPropertyFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..3fb909447 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderGetQueryParameters.ts @@ -0,0 +1,39 @@ + +/** The collection of single-value extended properties defined for the mailFolder. Read-only. Nullable. */ +export class SingleValueExtendedPropertiesRequestBuilderGetQueryParameters { + /** Include count of items */ + public count?: boolean | undefined; + /** Expand related entities */ + public expand?: string[] | undefined; + /** Filter items by property values */ + public filter?: string | undefined; + /** Order items by property values */ + public orderby?: string[] | undefined; + /** Search items by search phrases */ + public search?: string | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** Skip the first n items */ + public skip?: number | undefined; + /** Show only the first n items */ + public top?: number | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "count": return "%24count"; + case "expand": return "%24expand"; + case "filter": return "%24filter"; + case "orderby": return "%24orderby"; + case "search": return "%24search"; + case "select": return "%24select"; + case "skip": return "%24skip"; + case "top": return "%24top"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..0fc0196cf --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {SingleValueExtendedPropertiesRequestBuilderGetQueryParameters} from './singleValueExtendedPropertiesRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class SingleValueExtendedPropertiesRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: SingleValueExtendedPropertiesRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderPostRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderPostRequestConfiguration.ts new file mode 100644 index 000000000..22c34144a --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderPostRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class SingleValueExtendedPropertiesRequestBuilderPostRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/mailFoldersRequestBuilder.ts b/packages/test/generatedCode/users/item/mailFolders/mailFoldersRequestBuilder.ts index e0a2b653f..d28054ca4 100644 --- a/packages/test/generatedCode/users/item/mailFolders/mailFoldersRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/mailFolders/mailFoldersRequestBuilder.ts @@ -2,6 +2,8 @@ import {MailFolder} from '../../../models/microsoft/graph/'; import {createMailFolderFromDiscriminatorValue} from '../../../models/microsoft/graph/createMailFolderFromDiscriminatorValue'; import {createMailFoldersResponseFromDiscriminatorValue} from './createMailFoldersResponseFromDiscriminatorValue'; import {MailFoldersResponse} from './index'; +import {MailFoldersRequestBuilderGetRequestConfiguration} from './mailFoldersRequestBuilderGetRequestConfiguration'; +import {MailFoldersRequestBuilderPostRequestConfiguration} from './mailFoldersRequestBuilderPostRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/mailFolders */ @@ -20,86 +22,70 @@ export class MailFoldersRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders{?top,skip,filter,count,orderby,select}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/mailFolders{?%24top,%24skip,%24filter,%24count,%24orderby,%24select}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The user's mail folders. Read-only. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - count?: boolean, - filter?: string, - orderby?: string[], - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: MailFoldersRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The user's mail folders. Read-only. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPostRequestInformation(body: MailFolder | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPostRequestInformation(body: MailFolder | undefined, requestConfiguration?: MailFoldersRequestBuilderPostRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.POST; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The user's mail folders. Read-only. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of MailFoldersResponse */ - public get(queryParameters?: { - count?: boolean, - filter?: string, - orderby?: string[], - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: MailFoldersRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createMailFoldersResponseFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The user's mail folders. Read-only. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of MailFolder */ - public post(body: MailFolder | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public post(body: MailFolder | undefined, requestConfiguration?: MailFoldersRequestBuilderPostRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPostRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createMailFolderFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/mailFolders/mailFoldersRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/mailFolders/mailFoldersRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..1faebf755 --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/mailFoldersRequestBuilderGetQueryParameters.ts @@ -0,0 +1,33 @@ + +/** The user's mail folders. Read-only. Nullable. */ +export class MailFoldersRequestBuilderGetQueryParameters { + /** Include count of items */ + public count?: boolean | undefined; + /** Filter items by property values */ + public filter?: string | undefined; + /** Order items by property values */ + public orderby?: string[] | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** Skip the first n items */ + public skip?: number | undefined; + /** Show only the first n items */ + public top?: number | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "count": return "%24count"; + case "filter": return "%24filter"; + case "orderby": return "%24orderby"; + case "select": return "%24select"; + case "skip": return "%24skip"; + case "top": return "%24top"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/mailFoldersRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/mailFoldersRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..b91d6b3ef --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/mailFoldersRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {MailFoldersRequestBuilderGetQueryParameters} from './mailFoldersRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MailFoldersRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: MailFoldersRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/mailFolders/mailFoldersRequestBuilderPostRequestConfiguration.ts b/packages/test/generatedCode/users/item/mailFolders/mailFoldersRequestBuilderPostRequestConfiguration.ts new file mode 100644 index 000000000..d7a21ffcc --- /dev/null +++ b/packages/test/generatedCode/users/item/mailFolders/mailFoldersRequestBuilderPostRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MailFoldersRequestBuilderPostRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/attachments/attachmentsRequestBuilder.ts b/packages/test/generatedCode/users/item/messages/item/attachments/attachmentsRequestBuilder.ts index 89dcaa8c9..9c8ac716c 100644 --- a/packages/test/generatedCode/users/item/messages/item/attachments/attachmentsRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/messages/item/attachments/attachmentsRequestBuilder.ts @@ -1,5 +1,7 @@ import {Attachment} from '../../../../../models/microsoft/graph/'; import {createAttachmentFromDiscriminatorValue} from '../../../../../models/microsoft/graph/createAttachmentFromDiscriminatorValue'; +import {AttachmentsRequestBuilderGetRequestConfiguration} from './attachmentsRequestBuilderGetRequestConfiguration'; +import {AttachmentsRequestBuilderPostRequestConfiguration} from './attachmentsRequestBuilderPostRequestConfiguration'; import {createAttachmentsResponseFromDiscriminatorValue} from './createAttachmentsResponseFromDiscriminatorValue'; import {AttachmentsResponse} from './index'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; @@ -20,88 +22,70 @@ export class AttachmentsRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/messages/{message_id}/attachments{?top,skip,filter,count,orderby,select,expand}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/messages/{message%2Did}/attachments{?%24top,%24skip,%24filter,%24count,%24orderby,%24select,%24expand}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The fileAttachment and itemAttachment attachments for the message. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - count?: boolean, - expand?: string[], - filter?: string, - orderby?: string[], - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: AttachmentsRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The fileAttachment and itemAttachment attachments for the message. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPostRequestInformation(body: Attachment | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPostRequestInformation(body: Attachment | undefined, requestConfiguration?: AttachmentsRequestBuilderPostRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.POST; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The fileAttachment and itemAttachment attachments for the message. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of AttachmentsResponse */ - public get(queryParameters?: { - count?: boolean, - expand?: string[], - filter?: string, - orderby?: string[], - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: AttachmentsRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createAttachmentsResponseFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The fileAttachment and itemAttachment attachments for the message. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of Attachment */ - public post(body: Attachment | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public post(body: Attachment | undefined, requestConfiguration?: AttachmentsRequestBuilderPostRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPostRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createAttachmentFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/messages/item/attachments/attachmentsRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/messages/item/attachments/attachmentsRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..564324898 --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/attachments/attachmentsRequestBuilderGetQueryParameters.ts @@ -0,0 +1,36 @@ + +/** The fileAttachment and itemAttachment attachments for the message. */ +export class AttachmentsRequestBuilderGetQueryParameters { + /** Include count of items */ + public count?: boolean | undefined; + /** Expand related entities */ + public expand?: string[] | undefined; + /** Filter items by property values */ + public filter?: string | undefined; + /** Order items by property values */ + public orderby?: string[] | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** Skip the first n items */ + public skip?: number | undefined; + /** Show only the first n items */ + public top?: number | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "count": return "%24count"; + case "expand": return "%24expand"; + case "filter": return "%24filter"; + case "orderby": return "%24orderby"; + case "select": return "%24select"; + case "skip": return "%24skip"; + case "top": return "%24top"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/messages/item/attachments/attachmentsRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/attachments/attachmentsRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..f992d9d97 --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/attachments/attachmentsRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {AttachmentsRequestBuilderGetQueryParameters} from './attachmentsRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class AttachmentsRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: AttachmentsRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/attachments/attachmentsRequestBuilderPostRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/attachments/attachmentsRequestBuilderPostRequestConfiguration.ts new file mode 100644 index 000000000..07b0c5a11 --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/attachments/attachmentsRequestBuilderPostRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class AttachmentsRequestBuilderPostRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/attachments/item/attachmentItemRequestBuilder.ts b/packages/test/generatedCode/users/item/messages/item/attachments/item/attachmentItemRequestBuilder.ts index 55c7a4926..7609d8fc8 100644 --- a/packages/test/generatedCode/users/item/messages/item/attachments/item/attachmentItemRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/messages/item/attachments/item/attachmentItemRequestBuilder.ts @@ -1,5 +1,8 @@ import {Attachment} from '../../../../../../models/microsoft/graph/'; import {createAttachmentFromDiscriminatorValue} from '../../../../../../models/microsoft/graph/createAttachmentFromDiscriminatorValue'; +import {AttachmentItemRequestBuilderDeleteRequestConfiguration} from './attachmentItemRequestBuilderDeleteRequestConfiguration'; +import {AttachmentItemRequestBuilderGetRequestConfiguration} from './attachmentItemRequestBuilderGetRequestConfiguration'; +import {AttachmentItemRequestBuilderPatchRequestConfiguration} from './attachmentItemRequestBuilderPatchRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/messages/{message-id}/attachments/{attachment-id} */ @@ -18,104 +21,96 @@ export class AttachmentItemRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/messages/{message_id}/attachments/{attachment_id}{?select,expand}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/messages/{message%2Did}/attachments/{attachment%2Did}{?%24select,%24expand}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The fileAttachment and itemAttachment attachments for the message. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createDeleteRequestInformation(headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createDeleteRequestInformation(requestConfiguration?: AttachmentItemRequestBuilderDeleteRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.DELETE; - if(headers) requestInfo.headers = headers; - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The fileAttachment and itemAttachment attachments for the message. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - expand?: string[], - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: AttachmentItemRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The fileAttachment and itemAttachment attachments for the message. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPatchRequestInformation(body: Attachment | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPatchRequestInformation(body: Attachment | undefined, requestConfiguration?: AttachmentItemRequestBuilderPatchRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.PATCH; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The fileAttachment and itemAttachment attachments for the message. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public delete(headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public delete(requestConfiguration?: AttachmentItemRequestBuilderDeleteRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createDeleteRequestInformation( - headers, options + requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The fileAttachment and itemAttachment attachments for the message. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of Attachment */ - public get(queryParameters?: { - expand?: string[], - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: AttachmentItemRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createAttachmentFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The fileAttachment and itemAttachment attachments for the message. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public patch(body: Attachment | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public patch(body: Attachment | undefined, requestConfiguration?: AttachmentItemRequestBuilderPatchRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPatchRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/messages/item/attachments/item/attachmentItemRequestBuilderDeleteRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/attachments/item/attachmentItemRequestBuilderDeleteRequestConfiguration.ts new file mode 100644 index 000000000..7728f0472 --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/attachments/item/attachmentItemRequestBuilderDeleteRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class AttachmentItemRequestBuilderDeleteRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/attachments/item/attachmentItemRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/messages/item/attachments/item/attachmentItemRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..608cb794e --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/attachments/item/attachmentItemRequestBuilderGetQueryParameters.ts @@ -0,0 +1,21 @@ + +/** The fileAttachment and itemAttachment attachments for the message. */ +export class AttachmentItemRequestBuilderGetQueryParameters { + /** Expand related entities */ + public expand?: string[] | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "expand": return "%24expand"; + case "select": return "%24select"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/messages/item/attachments/item/attachmentItemRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/attachments/item/attachmentItemRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..3fdd8abea --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/attachments/item/attachmentItemRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {AttachmentItemRequestBuilderGetQueryParameters} from './attachmentItemRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class AttachmentItemRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: AttachmentItemRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/attachments/item/attachmentItemRequestBuilderPatchRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/attachments/item/attachmentItemRequestBuilderPatchRequestConfiguration.ts new file mode 100644 index 000000000..a797c0fc7 --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/attachments/item/attachmentItemRequestBuilderPatchRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class AttachmentItemRequestBuilderPatchRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/extensions/extensionsRequestBuilder.ts b/packages/test/generatedCode/users/item/messages/item/extensions/extensionsRequestBuilder.ts index aa6d32998..9ba84044a 100644 --- a/packages/test/generatedCode/users/item/messages/item/extensions/extensionsRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/messages/item/extensions/extensionsRequestBuilder.ts @@ -1,6 +1,8 @@ import {Extension} from '../../../../../models/microsoft/graph/'; import {createExtensionFromDiscriminatorValue} from '../../../../../models/microsoft/graph/createExtensionFromDiscriminatorValue'; import {createExtensionsResponseFromDiscriminatorValue} from './createExtensionsResponseFromDiscriminatorValue'; +import {ExtensionsRequestBuilderGetRequestConfiguration} from './extensionsRequestBuilderGetRequestConfiguration'; +import {ExtensionsRequestBuilderPostRequestConfiguration} from './extensionsRequestBuilderPostRequestConfiguration'; import {ExtensionsResponse} from './index'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; @@ -20,88 +22,70 @@ export class ExtensionsRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/messages/{message_id}/extensions{?top,skip,filter,count,orderby,select,expand}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/messages/{message%2Did}/extensions{?%24top,%24skip,%24filter,%24count,%24orderby,%24select,%24expand}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The collection of open extensions defined for the message. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - count?: boolean, - expand?: string[], - filter?: string, - orderby?: string[], - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: ExtensionsRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of open extensions defined for the message. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPostRequestInformation(body: Extension | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPostRequestInformation(body: Extension | undefined, requestConfiguration?: ExtensionsRequestBuilderPostRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.POST; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The collection of open extensions defined for the message. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of ExtensionsResponse */ - public get(queryParameters?: { - count?: boolean, - expand?: string[], - filter?: string, - orderby?: string[], - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: ExtensionsRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createExtensionsResponseFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of open extensions defined for the message. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of Extension */ - public post(body: Extension | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public post(body: Extension | undefined, requestConfiguration?: ExtensionsRequestBuilderPostRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPostRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createExtensionFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/messages/item/extensions/extensionsRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/messages/item/extensions/extensionsRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..c2fd01fb4 --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/extensions/extensionsRequestBuilderGetQueryParameters.ts @@ -0,0 +1,36 @@ + +/** The collection of open extensions defined for the message. Nullable. */ +export class ExtensionsRequestBuilderGetQueryParameters { + /** Include count of items */ + public count?: boolean | undefined; + /** Expand related entities */ + public expand?: string[] | undefined; + /** Filter items by property values */ + public filter?: string | undefined; + /** Order items by property values */ + public orderby?: string[] | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** Skip the first n items */ + public skip?: number | undefined; + /** Show only the first n items */ + public top?: number | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "count": return "%24count"; + case "expand": return "%24expand"; + case "filter": return "%24filter"; + case "orderby": return "%24orderby"; + case "select": return "%24select"; + case "skip": return "%24skip"; + case "top": return "%24top"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/messages/item/extensions/extensionsRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/extensions/extensionsRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..27d6181fc --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/extensions/extensionsRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {ExtensionsRequestBuilderGetQueryParameters} from './extensionsRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class ExtensionsRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: ExtensionsRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/extensions/extensionsRequestBuilderPostRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/extensions/extensionsRequestBuilderPostRequestConfiguration.ts new file mode 100644 index 000000000..4a22cd949 --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/extensions/extensionsRequestBuilderPostRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class ExtensionsRequestBuilderPostRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/extensions/item/extensionItemRequestBuilder.ts b/packages/test/generatedCode/users/item/messages/item/extensions/item/extensionItemRequestBuilder.ts index 214043567..5a33916f6 100644 --- a/packages/test/generatedCode/users/item/messages/item/extensions/item/extensionItemRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/messages/item/extensions/item/extensionItemRequestBuilder.ts @@ -1,5 +1,8 @@ import {Extension} from '../../../../../../models/microsoft/graph/'; import {createExtensionFromDiscriminatorValue} from '../../../../../../models/microsoft/graph/createExtensionFromDiscriminatorValue'; +import {ExtensionItemRequestBuilderDeleteRequestConfiguration} from './extensionItemRequestBuilderDeleteRequestConfiguration'; +import {ExtensionItemRequestBuilderGetRequestConfiguration} from './extensionItemRequestBuilderGetRequestConfiguration'; +import {ExtensionItemRequestBuilderPatchRequestConfiguration} from './extensionItemRequestBuilderPatchRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/messages/{message-id}/extensions/{extension-id} */ @@ -18,104 +21,96 @@ export class ExtensionItemRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/messages/{message_id}/extensions/{extension_id}{?select,expand}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/messages/{message%2Did}/extensions/{extension%2Did}{?%24select,%24expand}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The collection of open extensions defined for the message. Nullable. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createDeleteRequestInformation(headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createDeleteRequestInformation(requestConfiguration?: ExtensionItemRequestBuilderDeleteRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.DELETE; - if(headers) requestInfo.headers = headers; - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of open extensions defined for the message. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - expand?: string[], - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: ExtensionItemRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of open extensions defined for the message. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPatchRequestInformation(body: Extension | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPatchRequestInformation(body: Extension | undefined, requestConfiguration?: ExtensionItemRequestBuilderPatchRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.PATCH; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The collection of open extensions defined for the message. Nullable. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public delete(headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public delete(requestConfiguration?: ExtensionItemRequestBuilderDeleteRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createDeleteRequestInformation( - headers, options + requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of open extensions defined for the message. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of Extension */ - public get(queryParameters?: { - expand?: string[], - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: ExtensionItemRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createExtensionFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of open extensions defined for the message. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public patch(body: Extension | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public patch(body: Extension | undefined, requestConfiguration?: ExtensionItemRequestBuilderPatchRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPatchRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/messages/item/extensions/item/extensionItemRequestBuilderDeleteRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/extensions/item/extensionItemRequestBuilderDeleteRequestConfiguration.ts new file mode 100644 index 000000000..09d700a6f --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/extensions/item/extensionItemRequestBuilderDeleteRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class ExtensionItemRequestBuilderDeleteRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/extensions/item/extensionItemRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/messages/item/extensions/item/extensionItemRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..1aa0f6694 --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/extensions/item/extensionItemRequestBuilderGetQueryParameters.ts @@ -0,0 +1,21 @@ + +/** The collection of open extensions defined for the message. Nullable. */ +export class ExtensionItemRequestBuilderGetQueryParameters { + /** Expand related entities */ + public expand?: string[] | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "expand": return "%24expand"; + case "select": return "%24select"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/messages/item/extensions/item/extensionItemRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/extensions/item/extensionItemRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..690bab1d3 --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/extensions/item/extensionItemRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {ExtensionItemRequestBuilderGetQueryParameters} from './extensionItemRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class ExtensionItemRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: ExtensionItemRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/extensions/item/extensionItemRequestBuilderPatchRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/extensions/item/extensionItemRequestBuilderPatchRequestConfiguration.ts new file mode 100644 index 000000000..55eda35fc --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/extensions/item/extensionItemRequestBuilderPatchRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class ExtensionItemRequestBuilderPatchRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/messageItemRequestBuilder.ts b/packages/test/generatedCode/users/item/messages/item/messageItemRequestBuilder.ts index 09ec8723d..2ea8b3dd6 100644 --- a/packages/test/generatedCode/users/item/messages/item/messageItemRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/messages/item/messageItemRequestBuilder.ts @@ -4,6 +4,9 @@ import {AttachmentsRequestBuilder} from './attachments/attachmentsRequestBuilder import {AttachmentItemRequestBuilder} from './attachments/item/attachmentItemRequestBuilder'; import {ExtensionsRequestBuilder} from './extensions/extensionsRequestBuilder'; import {ExtensionItemRequestBuilder} from './extensions/item/extensionItemRequestBuilder'; +import {MessageItemRequestBuilderDeleteRequestConfiguration} from './messageItemRequestBuilderDeleteRequestConfiguration'; +import {MessageItemRequestBuilderGetRequestConfiguration} from './messageItemRequestBuilderGetRequestConfiguration'; +import {MessageItemRequestBuilderPatchRequestConfiguration} from './messageItemRequestBuilderPatchRequestConfiguration'; import {MultiValueLegacyExtendedPropertyItemRequestBuilder} from './multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilder'; import {MultiValueExtendedPropertiesRequestBuilder} from './multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilder'; import {SingleValueLegacyExtendedPropertyItemRequestBuilder} from './singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilder'; @@ -47,7 +50,7 @@ export class MessageItemRequestBuilder { public attachmentsById(id: string) : AttachmentItemRequestBuilder { if(!id) throw new Error("id cannot be undefined"); const urlTplParams = getPathParameters(this.pathParameters); - urlTplParams["attachment_id"] = id + urlTplParams["attachment%2Did"] = id return new AttachmentItemRequestBuilder(urlTplParams, this.requestAdapter); }; /** @@ -58,72 +61,71 @@ export class MessageItemRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/messages/{message_id}{?select}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/messages/{message%2Did}{?%24select}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The messages in a mailbox or folder. Read-only. Nullable. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createDeleteRequestInformation(headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createDeleteRequestInformation(requestConfiguration?: MessageItemRequestBuilderDeleteRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.DELETE; - if(headers) requestInfo.headers = headers; - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The messages in a mailbox or folder. Read-only. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: MessageItemRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The messages in a mailbox or folder. Read-only. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPatchRequestInformation(body: Message | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPatchRequestInformation(body: Message | undefined, requestConfiguration?: MessageItemRequestBuilderPatchRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.PATCH; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The messages in a mailbox or folder. Read-only. Nullable. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public delete(headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public delete(requestConfiguration?: MessageItemRequestBuilderDeleteRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createDeleteRequestInformation( - headers, options + requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; @@ -135,22 +137,18 @@ export class MessageItemRequestBuilder { public extensionsById(id: string) : ExtensionItemRequestBuilder { if(!id) throw new Error("id cannot be undefined"); const urlTplParams = getPathParameters(this.pathParameters); - urlTplParams["extension_id"] = id + urlTplParams["extension%2Did"] = id return new ExtensionItemRequestBuilder(urlTplParams, this.requestAdapter); }; /** * The messages in a mailbox or folder. Read-only. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of Message */ - public get(queryParameters?: { - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: MessageItemRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createMessageFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; @@ -162,20 +160,19 @@ export class MessageItemRequestBuilder { public multiValueExtendedPropertiesById(id: string) : MultiValueLegacyExtendedPropertyItemRequestBuilder { if(!id) throw new Error("id cannot be undefined"); const urlTplParams = getPathParameters(this.pathParameters); - urlTplParams["multiValueLegacyExtendedProperty_id"] = id + urlTplParams["multiValueLegacyExtendedProperty%2Did"] = id return new MultiValueLegacyExtendedPropertyItemRequestBuilder(urlTplParams, this.requestAdapter); }; /** * The messages in a mailbox or folder. Read-only. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public patch(body: Message | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public patch(body: Message | undefined, requestConfiguration?: MessageItemRequestBuilderPatchRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPatchRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; @@ -187,7 +184,7 @@ export class MessageItemRequestBuilder { public singleValueExtendedPropertiesById(id: string) : SingleValueLegacyExtendedPropertyItemRequestBuilder { if(!id) throw new Error("id cannot be undefined"); const urlTplParams = getPathParameters(this.pathParameters); - urlTplParams["singleValueLegacyExtendedProperty_id"] = id + urlTplParams["singleValueLegacyExtendedProperty%2Did"] = id return new SingleValueLegacyExtendedPropertyItemRequestBuilder(urlTplParams, this.requestAdapter); }; } diff --git a/packages/test/generatedCode/users/item/messages/item/messageItemRequestBuilderDeleteRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/messageItemRequestBuilderDeleteRequestConfiguration.ts new file mode 100644 index 000000000..11b00b6f2 --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/messageItemRequestBuilderDeleteRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MessageItemRequestBuilderDeleteRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/messageItemRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/messages/item/messageItemRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..9aa4b7ac5 --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/messageItemRequestBuilderGetQueryParameters.ts @@ -0,0 +1,18 @@ + +/** The messages in a mailbox or folder. Read-only. Nullable. */ +export class MessageItemRequestBuilderGetQueryParameters { + /** Select properties to be returned */ + public select?: string[] | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "select": return "%24select"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/messages/item/messageItemRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/messageItemRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..3d5f0081b --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/messageItemRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {MessageItemRequestBuilderGetQueryParameters} from './messageItemRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MessageItemRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: MessageItemRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/messageItemRequestBuilderPatchRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/messageItemRequestBuilderPatchRequestConfiguration.ts new file mode 100644 index 000000000..1d409cca3 --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/messageItemRequestBuilderPatchRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MessageItemRequestBuilderPatchRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilder.ts b/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilder.ts index 7418994cf..8f0dab4a1 100644 --- a/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilder.ts @@ -1,5 +1,8 @@ import {MultiValueLegacyExtendedProperty} from '../../../../../../models/microsoft/graph/'; import {createMultiValueLegacyExtendedPropertyFromDiscriminatorValue} from '../../../../../../models/microsoft/graph/createMultiValueLegacyExtendedPropertyFromDiscriminatorValue'; +import {MultiValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration} from './multiValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration'; +import {MultiValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration} from './multiValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration'; +import {MultiValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration} from './multiValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/messages/{message-id}/multiValueExtendedProperties/{multiValueLegacyExtendedProperty-id} */ @@ -18,104 +21,96 @@ export class MultiValueLegacyExtendedPropertyItemRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/messages/{message_id}/multiValueExtendedProperties/{multiValueLegacyExtendedProperty_id}{?select,expand}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/messages/{message%2Did}/multiValueExtendedProperties/{multiValueLegacyExtendedProperty%2Did}{?%24select,%24expand}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The collection of multi-value extended properties defined for the message. Nullable. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createDeleteRequestInformation(headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createDeleteRequestInformation(requestConfiguration?: MultiValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.DELETE; - if(headers) requestInfo.headers = headers; - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of multi-value extended properties defined for the message. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - expand?: string[], - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: MultiValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of multi-value extended properties defined for the message. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPatchRequestInformation(body: MultiValueLegacyExtendedProperty | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPatchRequestInformation(body: MultiValueLegacyExtendedProperty | undefined, requestConfiguration?: MultiValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.PATCH; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The collection of multi-value extended properties defined for the message. Nullable. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public delete(headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public delete(requestConfiguration?: MultiValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createDeleteRequestInformation( - headers, options + requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of multi-value extended properties defined for the message. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of MultiValueLegacyExtendedProperty */ - public get(queryParameters?: { - expand?: string[], - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: MultiValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createMultiValueLegacyExtendedPropertyFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of multi-value extended properties defined for the message. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public patch(body: MultiValueLegacyExtendedProperty | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public patch(body: MultiValueLegacyExtendedProperty | undefined, requestConfiguration?: MultiValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPatchRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration.ts new file mode 100644 index 000000000..27f9e72e3 --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MultiValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..2953020a8 --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters.ts @@ -0,0 +1,21 @@ + +/** The collection of multi-value extended properties defined for the message. Nullable. */ +export class MultiValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters { + /** Expand related entities */ + public expand?: string[] | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "expand": return "%24expand"; + case "select": return "%24select"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..aa1b0375b --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {MultiValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters} from './multiValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MultiValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: MultiValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration.ts new file mode 100644 index 000000000..67468d27f --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/item/multiValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MultiValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilder.ts b/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilder.ts index e6edb2ade..7fadfc1d0 100644 --- a/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilder.ts @@ -2,6 +2,8 @@ import {MultiValueLegacyExtendedProperty} from '../../../../../models/microsoft/ import {createMultiValueLegacyExtendedPropertyFromDiscriminatorValue} from '../../../../../models/microsoft/graph/createMultiValueLegacyExtendedPropertyFromDiscriminatorValue'; import {createMultiValueExtendedPropertiesResponseFromDiscriminatorValue} from './createMultiValueExtendedPropertiesResponseFromDiscriminatorValue'; import {MultiValueExtendedPropertiesResponse} from './index'; +import {MultiValueExtendedPropertiesRequestBuilderGetRequestConfiguration} from './multiValueExtendedPropertiesRequestBuilderGetRequestConfiguration'; +import {MultiValueExtendedPropertiesRequestBuilderPostRequestConfiguration} from './multiValueExtendedPropertiesRequestBuilderPostRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/messages/{message-id}/multiValueExtendedProperties */ @@ -20,90 +22,70 @@ export class MultiValueExtendedPropertiesRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/messages/{message_id}/multiValueExtendedProperties{?top,skip,search,filter,count,orderby,select,expand}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/messages/{message%2Did}/multiValueExtendedProperties{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select,%24expand}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The collection of multi-value extended properties defined for the message. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - count?: boolean, - expand?: string[], - filter?: string, - orderby?: string[], - search?: string, - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: MultiValueExtendedPropertiesRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of multi-value extended properties defined for the message. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPostRequestInformation(body: MultiValueLegacyExtendedProperty | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPostRequestInformation(body: MultiValueLegacyExtendedProperty | undefined, requestConfiguration?: MultiValueExtendedPropertiesRequestBuilderPostRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.POST; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The collection of multi-value extended properties defined for the message. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of MultiValueExtendedPropertiesResponse */ - public get(queryParameters?: { - count?: boolean, - expand?: string[], - filter?: string, - orderby?: string[], - search?: string, - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: MultiValueExtendedPropertiesRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createMultiValueExtendedPropertiesResponseFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of multi-value extended properties defined for the message. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of MultiValueLegacyExtendedProperty */ - public post(body: MultiValueLegacyExtendedProperty | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public post(body: MultiValueLegacyExtendedProperty | undefined, requestConfiguration?: MultiValueExtendedPropertiesRequestBuilderPostRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPostRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createMultiValueLegacyExtendedPropertyFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..ef32fc476 --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderGetQueryParameters.ts @@ -0,0 +1,39 @@ + +/** The collection of multi-value extended properties defined for the message. Nullable. */ +export class MultiValueExtendedPropertiesRequestBuilderGetQueryParameters { + /** Include count of items */ + public count?: boolean | undefined; + /** Expand related entities */ + public expand?: string[] | undefined; + /** Filter items by property values */ + public filter?: string | undefined; + /** Order items by property values */ + public orderby?: string[] | undefined; + /** Search items by search phrases */ + public search?: string | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** Skip the first n items */ + public skip?: number | undefined; + /** Show only the first n items */ + public top?: number | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "count": return "%24count"; + case "expand": return "%24expand"; + case "filter": return "%24filter"; + case "orderby": return "%24orderby"; + case "search": return "%24search"; + case "select": return "%24select"; + case "skip": return "%24skip"; + case "top": return "%24top"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..c3ebde9df --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {MultiValueExtendedPropertiesRequestBuilderGetQueryParameters} from './multiValueExtendedPropertiesRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MultiValueExtendedPropertiesRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: MultiValueExtendedPropertiesRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderPostRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderPostRequestConfiguration.ts new file mode 100644 index 000000000..95a758e07 --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/multiValueExtendedProperties/multiValueExtendedPropertiesRequestBuilderPostRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MultiValueExtendedPropertiesRequestBuilderPostRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilder.ts b/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilder.ts index 19067f84f..dfaee9763 100644 --- a/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilder.ts @@ -1,5 +1,8 @@ import {SingleValueLegacyExtendedProperty} from '../../../../../../models/microsoft/graph/'; import {createSingleValueLegacyExtendedPropertyFromDiscriminatorValue} from '../../../../../../models/microsoft/graph/createSingleValueLegacyExtendedPropertyFromDiscriminatorValue'; +import {SingleValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration} from './singleValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration'; +import {SingleValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration} from './singleValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration'; +import {SingleValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration} from './singleValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/messages/{message-id}/singleValueExtendedProperties/{singleValueLegacyExtendedProperty-id} */ @@ -18,104 +21,96 @@ export class SingleValueLegacyExtendedPropertyItemRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/messages/{message_id}/singleValueExtendedProperties/{singleValueLegacyExtendedProperty_id}{?select,expand}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/messages/{message%2Did}/singleValueExtendedProperties/{singleValueLegacyExtendedProperty%2Did}{?%24select,%24expand}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The collection of single-value extended properties defined for the message. Nullable. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createDeleteRequestInformation(headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createDeleteRequestInformation(requestConfiguration?: SingleValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.DELETE; - if(headers) requestInfo.headers = headers; - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of single-value extended properties defined for the message. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - expand?: string[], - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: SingleValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of single-value extended properties defined for the message. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPatchRequestInformation(body: SingleValueLegacyExtendedProperty | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPatchRequestInformation(body: SingleValueLegacyExtendedProperty | undefined, requestConfiguration?: SingleValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.PATCH; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The collection of single-value extended properties defined for the message. Nullable. - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public delete(headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public delete(requestConfiguration?: SingleValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createDeleteRequestInformation( - headers, options + requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of single-value extended properties defined for the message. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of SingleValueLegacyExtendedProperty */ - public get(queryParameters?: { - expand?: string[], - select?: string[] - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: SingleValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createSingleValueLegacyExtendedPropertyFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of single-value extended properties defined for the message. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public patch(body: SingleValueLegacyExtendedProperty | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public patch(body: SingleValueLegacyExtendedProperty | undefined, requestConfiguration?: SingleValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPatchRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration.ts new file mode 100644 index 000000000..44c12bae7 --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class SingleValueLegacyExtendedPropertyItemRequestBuilderDeleteRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..e59028f62 --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters.ts @@ -0,0 +1,21 @@ + +/** The collection of single-value extended properties defined for the message. Nullable. */ +export class SingleValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters { + /** Expand related entities */ + public expand?: string[] | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "expand": return "%24expand"; + case "select": return "%24select"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..1dffa284b --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {SingleValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters} from './singleValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class SingleValueLegacyExtendedPropertyItemRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: SingleValueLegacyExtendedPropertyItemRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration.ts new file mode 100644 index 000000000..85ca051bf --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/item/singleValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class SingleValueLegacyExtendedPropertyItemRequestBuilderPatchRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilder.ts b/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilder.ts index 44c485235..e5197c67a 100644 --- a/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilder.ts @@ -2,6 +2,8 @@ import {SingleValueLegacyExtendedProperty} from '../../../../../models/microsoft import {createSingleValueLegacyExtendedPropertyFromDiscriminatorValue} from '../../../../../models/microsoft/graph/createSingleValueLegacyExtendedPropertyFromDiscriminatorValue'; import {createSingleValueExtendedPropertiesResponseFromDiscriminatorValue} from './createSingleValueExtendedPropertiesResponseFromDiscriminatorValue'; import {SingleValueExtendedPropertiesResponse} from './index'; +import {SingleValueExtendedPropertiesRequestBuilderGetRequestConfiguration} from './singleValueExtendedPropertiesRequestBuilderGetRequestConfiguration'; +import {SingleValueExtendedPropertiesRequestBuilderPostRequestConfiguration} from './singleValueExtendedPropertiesRequestBuilderPostRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/messages/{message-id}/singleValueExtendedProperties */ @@ -20,90 +22,70 @@ export class SingleValueExtendedPropertiesRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/messages/{message_id}/singleValueExtendedProperties{?top,skip,search,filter,count,orderby,select,expand}"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/messages/{message%2Did}/singleValueExtendedProperties{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select,%24expand}"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * The collection of single-value extended properties defined for the message. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: { - count?: boolean, - expand?: string[], - filter?: string, - orderby?: string[], - search?: string, - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: SingleValueExtendedPropertiesRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The collection of single-value extended properties defined for the message. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPostRequestInformation(body: SingleValueLegacyExtendedProperty | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPostRequestInformation(body: SingleValueLegacyExtendedProperty | undefined, requestConfiguration?: SingleValueExtendedPropertiesRequestBuilderPostRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.POST; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The collection of single-value extended properties defined for the message. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of SingleValueExtendedPropertiesResponse */ - public get(queryParameters?: { - count?: boolean, - expand?: string[], - filter?: string, - orderby?: string[], - search?: string, - select?: string[], - skip?: number, - top?: number - } | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: SingleValueExtendedPropertiesRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createSingleValueExtendedPropertiesResponseFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The collection of single-value extended properties defined for the message. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of SingleValueLegacyExtendedProperty */ - public post(body: SingleValueLegacyExtendedProperty | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public post(body: SingleValueLegacyExtendedProperty | undefined, requestConfiguration?: SingleValueExtendedPropertiesRequestBuilderPostRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPostRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createSingleValueLegacyExtendedPropertyFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderGetQueryParameters.ts b/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderGetQueryParameters.ts new file mode 100644 index 000000000..abc9468a4 --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderGetQueryParameters.ts @@ -0,0 +1,39 @@ + +/** The collection of single-value extended properties defined for the message. Nullable. */ +export class SingleValueExtendedPropertiesRequestBuilderGetQueryParameters { + /** Include count of items */ + public count?: boolean | undefined; + /** Expand related entities */ + public expand?: string[] | undefined; + /** Filter items by property values */ + public filter?: string | undefined; + /** Order items by property values */ + public orderby?: string[] | undefined; + /** Search items by search phrases */ + public search?: string | undefined; + /** Select properties to be returned */ + public select?: string[] | undefined; + /** Skip the first n items */ + public skip?: number | undefined; + /** Show only the first n items */ + public top?: number | undefined; + /** + * Maps the query parameters names to their encoded names for the URI template parsing. + * @param originalName The original query parameter name in the class. + * @returns a string + */ + public getQueryParameter(originalName: string | undefined) : string { + if(!originalName) throw new Error("originalName cannot be undefined"); + switch(originalName) { + case "count": return "%24count"; + case "expand": return "%24expand"; + case "filter": return "%24filter"; + case "orderby": return "%24orderby"; + case "search": return "%24search"; + case "select": return "%24select"; + case "skip": return "%24skip"; + case "top": return "%24top"; + default: return originalName; + } + }; +} diff --git a/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..0fc0196cf --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {SingleValueExtendedPropertiesRequestBuilderGetQueryParameters} from './singleValueExtendedPropertiesRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class SingleValueExtendedPropertiesRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: SingleValueExtendedPropertiesRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderPostRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderPostRequestConfiguration.ts new file mode 100644 index 000000000..22c34144a --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/singleValueExtendedProperties/singleValueExtendedPropertiesRequestBuilderPostRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class SingleValueExtendedPropertiesRequestBuilderPostRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/value/contentRequestBuilder.ts b/packages/test/generatedCode/users/item/messages/item/value/contentRequestBuilder.ts index fad7dd34b..110a4fc39 100644 --- a/packages/test/generatedCode/users/item/messages/item/value/contentRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/messages/item/value/contentRequestBuilder.ts @@ -1,3 +1,5 @@ +import {ContentRequestBuilderGetRequestConfiguration} from './contentRequestBuilderGetRequestConfiguration'; +import {ContentRequestBuilderPutRequestConfiguration} from './contentRequestBuilderPutRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/messages/{message-id}/$value */ @@ -16,68 +18,68 @@ export class ContentRequestBuilder { public constructor(pathParameters: Record | string | undefined, requestAdapter: RequestAdapter) { if(!pathParameters) throw new Error("pathParameters cannot be undefined"); if(!requestAdapter) throw new Error("requestAdapter cannot be undefined"); - this.urlTemplate = "{+baseurl}/users/{user%2Did}/messages/{message_id}/$value"; + this.urlTemplate = "{+baseurl}/users/{user%2Did}/messages/{message%2Did}/$value"; const urlTplParams = getPathParameters(pathParameters); this.pathParameters = urlTplParams; this.requestAdapter = requestAdapter; }; /** * Get media content for the navigation property messages from users - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: ContentRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * Update media content for the navigation property messages in users * @param body Binary request body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPutRequestInformation(body: ArrayBuffer, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPutRequestInformation(body: ArrayBuffer, requestConfiguration?: ContentRequestBuilderPutRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.PUT; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setStreamContent(body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * Get media content for the navigation property messages from users - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of ArrayBuffer */ - public get(headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: ContentRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - headers, options + requestConfiguration ); return this.requestAdapter?.sendPrimitiveAsync(requestInfo, "ArrayBuffer", responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * Update media content for the navigation property messages in users * @param body Binary request body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service */ - public put(body: ArrayBuffer, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public put(body: ArrayBuffer, requestConfiguration?: ContentRequestBuilderPutRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPutRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendNoResponseContentAsync(requestInfo, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/messages/item/value/contentRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/value/contentRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..9653077a4 --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/value/contentRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class ContentRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/item/value/contentRequestBuilderPutRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/item/value/contentRequestBuilderPutRequestConfiguration.ts new file mode 100644 index 000000000..18bf72bbb --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/item/value/contentRequestBuilderPutRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class ContentRequestBuilderPutRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/messagesRequestBuilder.ts b/packages/test/generatedCode/users/item/messages/messagesRequestBuilder.ts index fc498178e..eeb9da90e 100644 --- a/packages/test/generatedCode/users/item/messages/messagesRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/messages/messagesRequestBuilder.ts @@ -2,7 +2,8 @@ import {Message} from '../../../models/microsoft/graph/'; import {createMessageFromDiscriminatorValue} from '../../../models/microsoft/graph/createMessageFromDiscriminatorValue'; import {createMessagesResponseFromDiscriminatorValue} from './createMessagesResponseFromDiscriminatorValue'; import {MessagesResponse} from './index'; -import {MessagesRequestBuilderGetQueryParameters} from './messagesRequestBuilderGetQueryParameters'; +import {MessagesRequestBuilderGetRequestConfiguration} from './messagesRequestBuilderGetRequestConfiguration'; +import {MessagesRequestBuilderPostRequestConfiguration} from './messagesRequestBuilderPostRequestConfiguration'; import {getPathParameters, HttpMethod, Parsable, ParsableFactory, RequestAdapter, RequestInformation, RequestOption, ResponseHandler} from '@microsoft/kiota-abstractions'; /** Builds and executes requests for operations under /users/{user-id}/messages */ @@ -28,65 +29,63 @@ export class MessagesRequestBuilder { }; /** * The messages in a mailbox or folder. Read-only. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createGetRequestInformation(queryParameters?: MessagesRequestBuilderGetQueryParameters | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createGetRequestInformation(requestConfiguration?: MessagesRequestBuilderGetRequestConfiguration | undefined) : RequestInformation { const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.GET; - if(headers) requestInfo.headers = headers; - queryParameters && requestInfo.setQueryStringParametersFromRawObject(queryParameters); - options && requestInfo.addRequestOptions(...options); + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters); + requestInfo.addRequestOptions(requestConfiguration.options); + } return requestInfo; }; /** * The messages in a mailbox or folder. Read-only. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @returns a RequestInformation */ - public createPostRequestInformation(body: Message | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined) : RequestInformation { + public createPostRequestInformation(body: Message | undefined, requestConfiguration?: MessagesRequestBuilderPostRequestConfiguration | undefined) : RequestInformation { if(!body) throw new Error("body cannot be undefined"); const requestInfo = new RequestInformation(); requestInfo.urlTemplate = this.urlTemplate; requestInfo.pathParameters = this.pathParameters; requestInfo.httpMethod = HttpMethod.POST; - if(headers) requestInfo.headers = headers; + if (requestConfiguration) { + requestInfo.addRequestHeaders(requestConfiguration.headers); + requestInfo.addRequestOptions(requestConfiguration.options); + } requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body); - options && requestInfo.addRequestOptions(...options); return requestInfo; }; /** * The messages in a mailbox or folder. Read-only. Nullable. - * @param headers Request headers - * @param options Request options - * @param queryParameters Request query parameters + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of MessagesResponse */ - public get(queryParameters?: MessagesRequestBuilderGetQueryParameters | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public get(requestConfiguration?: MessagesRequestBuilderGetRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { const requestInfo = this.createGetRequestInformation( - queryParameters, headers, options + requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createMessagesResponseFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; /** * The messages in a mailbox or folder. Read-only. Nullable. * @param body - * @param headers Request headers - * @param options Request options + * @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options. * @param responseHandler Response handler to use in place of the default response handling provided by the core service * @returns a Promise of Message */ - public post(body: Message | undefined, headers?: Record | undefined, options?: RequestOption[] | undefined, responseHandler?: ResponseHandler | undefined) : Promise { + public post(body: Message | undefined, requestConfiguration?: MessagesRequestBuilderPostRequestConfiguration | undefined, responseHandler?: ResponseHandler | undefined) : Promise { if(!body) throw new Error("body cannot be undefined"); const requestInfo = this.createPostRequestInformation( - body, headers, options + body, requestConfiguration ); return this.requestAdapter?.sendAsync(requestInfo, createMessageFromDiscriminatorValue, responseHandler, undefined) ?? Promise.reject(new Error('http core is null')); }; diff --git a/packages/test/generatedCode/users/item/messages/messagesRequestBuilderGetRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/messagesRequestBuilderGetRequestConfiguration.ts new file mode 100644 index 000000000..ac520d12c --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/messagesRequestBuilderGetRequestConfiguration.ts @@ -0,0 +1,12 @@ +import {MessagesRequestBuilderGetQueryParameters} from './messagesRequestBuilderGetQueryParameters'; +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MessagesRequestBuilderGetRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; + /** Request query parameters */ + public queryParameters?: MessagesRequestBuilderGetQueryParameters | undefined; +} diff --git a/packages/test/generatedCode/users/item/messages/messagesRequestBuilderPostRequestConfiguration.ts b/packages/test/generatedCode/users/item/messages/messagesRequestBuilderPostRequestConfiguration.ts new file mode 100644 index 000000000..8e9c4ece4 --- /dev/null +++ b/packages/test/generatedCode/users/item/messages/messagesRequestBuilderPostRequestConfiguration.ts @@ -0,0 +1,9 @@ +import {RequestOption} from '@microsoft/kiota-abstractions'; + +/** Configuration for the request such as headers, query parameters, and middleware options. */ +export class MessagesRequestBuilderPostRequestConfiguration { + /** Request headers */ + public headers?: Record | undefined; + /** Request options */ + public options?: RequestOption[] | undefined; +} diff --git a/packages/test/generatedCode/users/item/userItemRequestBuilder.ts b/packages/test/generatedCode/users/item/userItemRequestBuilder.ts index 99edf0691..f8a1295f9 100644 --- a/packages/test/generatedCode/users/item/userItemRequestBuilder.ts +++ b/packages/test/generatedCode/users/item/userItemRequestBuilder.ts @@ -46,7 +46,7 @@ export class UserItemRequestBuilder { public mailFoldersById(id: string) : MailFolderItemRequestBuilder { if(!id) throw new Error("id cannot be undefined"); const urlTplParams = getPathParameters(this.pathParameters); - urlTplParams["mailFolder_id"] = id + urlTplParams["mailFolder%2Did"] = id return new MailFolderItemRequestBuilder(urlTplParams, this.requestAdapter); }; /** @@ -57,7 +57,7 @@ export class UserItemRequestBuilder { public messagesById(id: string) : MessageItemRequestBuilder { if(!id) throw new Error("id cannot be undefined"); const urlTplParams = getPathParameters(this.pathParameters); - urlTplParams["message_id"] = id + urlTplParams["message%2Did"] = id return new MessageItemRequestBuilder(urlTplParams, this.requestAdapter); }; }