Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated models and request builders #442

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
62 changes: 31 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 15 additions & 48 deletions src/admin/adminRequestBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { EdgeRequestBuilder } from './edge/edgeRequestBuilder';
import { PeopleRequestBuilder } from './people/peopleRequestBuilder';
import { ServiceAnnouncementRequestBuilder } from './serviceAnnouncement/serviceAnnouncementRequestBuilder';
import { SharepointRequestBuilder } from './sharepoint/sharepointRequestBuilder';
import { BaseRequestBuilder, HttpMethod, RequestInformation, type Parsable, type ParsableFactory, type RequestAdapter, type RequestOption } from '@microsoft/kiota-abstractions';
import { BaseRequestBuilder, HttpMethod, RequestInformation, type Parsable, type ParsableFactory, type RequestAdapter, type RequestConfiguration, type RequestOption } from '@microsoft/kiota-abstractions';

export interface AdminRequestBuilderGetQueryParameters {
/**
Expand All @@ -20,30 +20,6 @@ export interface AdminRequestBuilderGetQueryParameters {
*/
select?: string[];
}
export interface AdminRequestBuilderGetRequestConfiguration {
/**
* Request headers
*/
headers?: Record<string, string[]>;
/**
* Request options
*/
options?: RequestOption[];
/**
* Request query parameters
*/
queryParameters?: AdminRequestBuilderGetQueryParameters;
}
export interface AdminRequestBuilderPatchRequestConfiguration {
/**
* Request headers
*/
headers?: Record<string, string[]>;
/**
* Request options
*/
options?: RequestOption[];
}
/**
* Provides operations to manage the admin singleton.
*/
Expand Down Expand Up @@ -85,7 +61,7 @@ export class AdminRequestBuilder extends BaseRequestBuilder {
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @returns a Promise of Admin
*/
public get(requestConfiguration?: AdminRequestBuilderGetRequestConfiguration | undefined) : Promise<Admin | undefined> {
public get(requestConfiguration?: RequestConfiguration<AdminRequestBuilderGetQueryParameters> | undefined) : Promise<Admin | undefined> {
const requestInfo = this.toGetRequestInformation(
requestConfiguration
);
Expand All @@ -101,7 +77,7 @@ export class AdminRequestBuilder extends BaseRequestBuilder {
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @returns a Promise of Admin
*/
public patch(body: Admin, requestConfiguration?: AdminRequestBuilderPatchRequestConfiguration | undefined) : Promise<Admin | undefined> {
public patch(body: Admin, requestConfiguration?: RequestConfiguration<object> | undefined) : Promise<Admin | undefined> {
const requestInfo = this.toPatchRequestInformation(
body, requestConfiguration
);
Expand All @@ -116,17 +92,10 @@ export class AdminRequestBuilder extends BaseRequestBuilder {
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @returns a RequestInformation
*/
public toGetRequestInformation(requestConfiguration?: AdminRequestBuilderGetRequestConfiguration | undefined) : RequestInformation {
const requestInfo = new RequestInformation();
if (requestConfiguration) {
requestInfo.addRequestHeaders(requestConfiguration.headers);
requestInfo.setQueryStringParametersFromRawObject(requestConfiguration.queryParameters);
requestInfo.addRequestOptions(requestConfiguration.options);
}
requestInfo.urlTemplate = this.urlTemplate;
requestInfo.pathParameters = this.pathParameters;
requestInfo.httpMethod = HttpMethod.GET;
requestInfo.tryAddRequestHeaders("Accept", "application/json;q=1");
public toGetRequestInformation(requestConfiguration?: RequestConfiguration<AdminRequestBuilderGetQueryParameters> | undefined) : RequestInformation {
const requestInfo = new RequestInformation(HttpMethod.GET, this.urlTemplate, this.pathParameters);
requestInfo.configure(requestConfiguration, adminRequestBuilderGetQueryParametersMapper);
requestInfo.headers.tryAdd("Accept", "application/json");
return requestInfo;
};
/**
Expand All @@ -135,17 +104,11 @@ export class AdminRequestBuilder extends BaseRequestBuilder {
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @returns a RequestInformation
*/
public toPatchRequestInformation(body: Admin, requestConfiguration?: AdminRequestBuilderPatchRequestConfiguration | undefined) : RequestInformation {
public toPatchRequestInformation(body: Admin, requestConfiguration?: RequestConfiguration<object> | undefined) : RequestInformation {
if(!body) throw new Error("body cannot be undefined");
const requestInfo = new RequestInformation();
if (requestConfiguration) {
requestInfo.addRequestHeaders(requestConfiguration.headers);
requestInfo.addRequestOptions(requestConfiguration.options);
}
requestInfo.urlTemplate = this.urlTemplate;
requestInfo.pathParameters = this.pathParameters;
requestInfo.httpMethod = HttpMethod.PATCH;
requestInfo.tryAddRequestHeaders("Accept", "application/json;q=1");
const requestInfo = new RequestInformation(HttpMethod.PATCH, this.urlTemplate, this.pathParameters);
requestInfo.configure(requestConfiguration);
requestInfo.headers.tryAdd("Accept", "application/json");
requestInfo.setContentFromParsable(this.requestAdapter, "application/json", body, serializeAdmin);
return requestInfo;
};
Expand All @@ -159,5 +122,9 @@ export class AdminRequestBuilder extends BaseRequestBuilder {
return new AdminRequestBuilder(rawUrl, this.requestAdapter);
};
}
const adminRequestBuilderGetQueryParametersMapper: Record<string, string> = {
"expand": "%24expand",
"select": "%24select",
};
// tslint:enable
// eslint-enable
Loading
Loading