Skip to content

Add create requestOpts method to {{classname}}Interface #21708 #21709

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,20 @@ export interface {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterIn
*/
export interface {{classname}}Interface {
{{#operation}}
/**
* Creates request options for {{nickname}} without sending the request
{{#allParams}}
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
{{/allParams}}
* @param {*} [options] Override http request option.
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
* @throws {RequiredError}
* @memberof {{classname}}Interface
*/
{{nickname}}RequestOpts({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request, {{/allParams.0}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.RequestOpts>;

/**
* {{&notes}}
{{#summary}}
Expand Down Expand Up @@ -95,17 +109,12 @@ export class {{classname}} extends runtime.BaseAPI {

{{#operation}}
/**
{{#notes}}
* {{&notes}}
{{/notes}}
{{#summary}}
* {{&summary}}
{{/summary}}
* Creates request options for {{nickname}} without sending the request
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
*/
async {{nickname}}Raw({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request, {{/allParams.0}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<{{{returnType}}}{{^returnType}}void{{/returnType}}>> {
async {{nickname}}RequestOpts({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request, {{/allParams.0}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.RequestOpts> {
{{#allParams}}
{{#required}}
if (requestParameters['{{paramName}}'] == null) {
Expand Down Expand Up @@ -302,7 +311,7 @@ export class {{classname}} extends runtime.BaseAPI {
{{/isDateTimeType}}
{{/pathParams}}

const response = await this.request({
return {
path: urlPath,
method: '{{httpMethod}}',
headers: headerParameters,
Expand Down Expand Up @@ -335,7 +344,23 @@ export class {{classname}} extends runtime.BaseAPI {
{{#hasFormParams}}
body: formParams,
{{/hasFormParams}}
}, initOverrides);
};
}

/**
{{#notes}}
* {{&notes}}
{{/notes}}
{{#summary}}
* {{&summary}}
{{/summary}}
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
*/
async {{nickname}}Raw({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request, {{/allParams.0}}initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<{{{returnType}}}{{^returnType}}void{{/returnType}}>> {
const requestConfig = await this.{{nickname}}RequestConfig({{#allParams.0}}requestParameters, {{/allParams.0}}initOverrides);
const response = await this.request(requestConfig, initOverrides);

{{#returnType}}
{{#isResponseFile}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ export interface ListRequest {
export class DefaultApi extends runtime.BaseAPI {

/**
* Creates request options for list without sending the request
*/
async listRaw(requestParameters: ListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Club>> {
async listRequestOpts(requestParameters: ListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.RequestOpts> {
if (requestParameters['personId'] == null) {
throw new runtime.RequiredError(
'personId',
Expand All @@ -49,12 +50,19 @@ export class DefaultApi extends runtime.BaseAPI {
let urlPath = `/person/display/{personId}`;
urlPath = urlPath.replace(`{${"personId"}}`, encodeURIComponent(String(requestParameters['personId'])));

const response = await this.request({
return {
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
};
}

/**
*/
async listRaw(requestParameters: ListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Club>> {
const requestConfig = await this.listRequestConfig(requestParameters, initOverrides);
const response = await this.request(requestConfig, initOverrides);

return new runtime.JSONApiResponse(response, (jsonValue) => ClubFromJSON(jsonValue));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ export interface ListRequest {
export class DefaultApi extends runtime.BaseAPI {

/**
* Creates request options for list without sending the request
*/
async listRaw(requestParameters: ListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Club>> {
async listRequestOpts(requestParameters: ListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.RequestOpts> {
if (requestParameters['personId'] == null) {
throw new runtime.RequiredError(
'personId',
Expand All @@ -49,12 +50,19 @@ export class DefaultApi extends runtime.BaseAPI {
let urlPath = `/person/display/{personId}`;
urlPath = urlPath.replace(`{${"personId"}}`, encodeURIComponent(String(requestParameters['personId'])));

const response = await this.request({
return {
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
};
}

/**
*/
async listRaw(requestParameters: ListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Club>> {
const requestConfig = await this.listRequestConfig(requestParameters, initOverrides);
const response = await this.request(requestConfig, initOverrides);

return new runtime.JSONApiResponse(response, (jsonValue) => ClubFromJSON(jsonValue));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ export interface 123testSpecialTagsRequest {
export class AnotherFakeApi extends runtime.BaseAPI {

/**
* To test special tags and operation ID starting with number
* To test special tags
* Creates request options for _123testSpecialTags without sending the request
*/
async _123testSpecialTagsRaw(requestParameters: 123testSpecialTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Client>> {
async _123testSpecialTagsRequestOpts(requestParameters: 123testSpecialTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.RequestOpts> {
if (requestParameters['client'] == null) {
throw new runtime.RequiredError(
'client',
Expand All @@ -52,13 +51,22 @@ export class AnotherFakeApi extends runtime.BaseAPI {

let urlPath = `/another-fake/dummy`;

const response = await this.request({
return {
path: urlPath,
method: 'PATCH',
headers: headerParameters,
query: queryParameters,
body: ClientToJSON(requestParameters['client']),
}, initOverrides);
};
}

/**
* To test special tags and operation ID starting with number
* To test special tags
*/
async _123testSpecialTagsRaw(requestParameters: 123testSpecialTagsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Client>> {
const requestConfig = await this._123testSpecialTagsRequestConfig(requestParameters, initOverrides);
const response = await this.request(requestConfig, initOverrides);

return new runtime.JSONApiResponse(response, (jsonValue) => ClientFromJSON(jsonValue));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,29 @@ import {
export class DefaultApi extends runtime.BaseAPI {

/**
* Creates request options for fooGet without sending the request
*/
async fooGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<FooGetDefaultResponse>> {
async fooGetRequestOpts(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.RequestOpts> {
const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};


let urlPath = `/foo`;

const response = await this.request({
return {
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
};
}

/**
*/
async fooGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<FooGetDefaultResponse>> {
const requestConfig = await this.fooGetRequestConfig(initOverrides);
const response = await this.request(requestConfig, initOverrides);

return new runtime.JSONApiResponse(response, (jsonValue) => FooGetDefaultResponseFromJSON(jsonValue));
}
Expand Down
Loading