Skip to content

[TypeScript-fetch] expose the path of each method (e.g. testing purposes) #11362

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 1 commit 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 @@ -91,6 +91,8 @@ export class {{classname}} extends runtime.BaseAPI {
* {{&summary}}
{{/summary}}
*/
readonly {{nickname}}Path = '{{path}}'

async {{nickname}}Raw({{#allParams.0}}requestParameters: {{#prefixParameterInterfaces}}{{classname}}{{/prefixParameterInterfaces}}{{operationIdCamelCase}}Request, {{/allParams.0}}initOverrides?: RequestInit): Promise<runtime.ApiResponse<{{{returnType}}}{{^returnType}}void{{/returnType}}>> {
{{#allParams}}
{{#required}}
Expand Down Expand Up @@ -252,7 +254,7 @@ export class {{classname}} extends runtime.BaseAPI {
{{/formParams}}
{{/hasFormParams}}
const response = await this.request({
path: `{{{path}}}`{{#pathParams}}.replace(`{${"{{baseName}}"}}`, encodeURIComponent(String(requestParameters.{{paramName}}))){{/pathParams}},
path: this.{{nickname}}Path{{#pathParams}}.replace(`{${"{{baseName}}"}}`, encodeURIComponent(String(requestParameters.{{paramName}}))){{/pathParams}},
method: '{{httpMethod}}',
headers: headerParameters,
query: queryParameters,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export class AnotherFakeApi extends runtime.BaseAPI {
* To test special tags and operation ID starting with number
* To test special tags
*/
readonly _123testSpecialTagsPath = '/another-fake/dummy'

async _123testSpecialTagsRaw(requestParameters: 123testSpecialTagsRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<Client>> {
if (requestParameters.client === null || requestParameters.client === undefined) {
throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling _123testSpecialTags.');
Expand All @@ -45,7 +47,7 @@ export class AnotherFakeApi extends runtime.BaseAPI {
headerParameters['Content-Type'] = 'application/json';

const response = await this.request({
path: `/another-fake/dummy`,
path: this._123testSpecialTagsPath,
method: 'PATCH',
headers: headerParameters,
query: queryParameters,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ export class DefaultApi extends runtime.BaseAPI {

/**
*/
readonly fooGetPath = '/foo'

async fooGetRaw(initOverrides?: RequestInit): Promise<runtime.ApiResponse<InlineResponseDefault>> {
const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

const response = await this.request({
path: `/foo`,
path: this.fooGetPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,15 @@ export class FakeApi extends runtime.BaseAPI {
/**
* Health check endpoint
*/
readonly fakeHealthGetPath = '/fake/health'

async fakeHealthGetRaw(initOverrides?: RequestInit): Promise<runtime.ApiResponse<HealthCheckResult>> {
const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

const response = await this.request({
path: `/fake/health`,
path: this.fakeHealthGetPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
Expand All @@ -171,6 +173,8 @@ export class FakeApi extends runtime.BaseAPI {
/**
* test http signature authentication
*/
readonly fakeHttpSignatureTestPath = '/fake/http-signature-test'

async fakeHttpSignatureTestRaw(requestParameters: FakeHttpSignatureTestRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> {
if (requestParameters.pet === null || requestParameters.pet === undefined) {
throw new runtime.RequiredError('pet','Required parameter requestParameters.pet was null or undefined when calling fakeHttpSignatureTest.');
Expand All @@ -191,7 +195,7 @@ export class FakeApi extends runtime.BaseAPI {
}

const response = await this.request({
path: `/fake/http-signature-test`,
path: this.fakeHttpSignatureTestPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
Expand All @@ -211,6 +215,8 @@ export class FakeApi extends runtime.BaseAPI {
/**
* Test serialization of outer boolean types
*/
readonly fakeOuterBooleanSerializePath = '/fake/outer/boolean'

async fakeOuterBooleanSerializeRaw(requestParameters: FakeOuterBooleanSerializeRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<boolean>> {
const queryParameters: any = {};

Expand All @@ -219,7 +225,7 @@ export class FakeApi extends runtime.BaseAPI {
headerParameters['Content-Type'] = 'application/json';

const response = await this.request({
path: `/fake/outer/boolean`,
path: this.fakeOuterBooleanSerializePath,
method: 'POST',
headers: headerParameters,
query: queryParameters,
Expand All @@ -240,6 +246,8 @@ export class FakeApi extends runtime.BaseAPI {
/**
* Test serialization of object with outer number type
*/
readonly fakeOuterCompositeSerializePath = '/fake/outer/composite'

async fakeOuterCompositeSerializeRaw(requestParameters: FakeOuterCompositeSerializeRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<OuterComposite>> {
const queryParameters: any = {};

Expand All @@ -248,7 +256,7 @@ export class FakeApi extends runtime.BaseAPI {
headerParameters['Content-Type'] = 'application/json';

const response = await this.request({
path: `/fake/outer/composite`,
path: this.fakeOuterCompositeSerializePath,
method: 'POST',
headers: headerParameters,
query: queryParameters,
Expand All @@ -269,6 +277,8 @@ export class FakeApi extends runtime.BaseAPI {
/**
* Test serialization of outer number types
*/
readonly fakeOuterNumberSerializePath = '/fake/outer/number'

async fakeOuterNumberSerializeRaw(requestParameters: FakeOuterNumberSerializeRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<number>> {
const queryParameters: any = {};

Expand All @@ -277,7 +287,7 @@ export class FakeApi extends runtime.BaseAPI {
headerParameters['Content-Type'] = 'application/json';

const response = await this.request({
path: `/fake/outer/number`,
path: this.fakeOuterNumberSerializePath,
method: 'POST',
headers: headerParameters,
query: queryParameters,
Expand All @@ -298,6 +308,8 @@ export class FakeApi extends runtime.BaseAPI {
/**
* Test serialization of outer string types
*/
readonly fakeOuterStringSerializePath = '/fake/outer/string'

async fakeOuterStringSerializeRaw(requestParameters: FakeOuterStringSerializeRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<string>> {
const queryParameters: any = {};

Expand All @@ -306,7 +318,7 @@ export class FakeApi extends runtime.BaseAPI {
headerParameters['Content-Type'] = 'application/json';

const response = await this.request({
path: `/fake/outer/string`,
path: this.fakeOuterStringSerializePath,
method: 'POST',
headers: headerParameters,
query: queryParameters,
Expand All @@ -327,6 +339,8 @@ export class FakeApi extends runtime.BaseAPI {
/**
* Test serialization of enum (int) properties with examples
*/
readonly fakePropertyEnumIntegerSerializePath = '/fake/property/enum-int'

async fakePropertyEnumIntegerSerializeRaw(requestParameters: FakePropertyEnumIntegerSerializeRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<OuterObjectWithEnumProperty>> {
if (requestParameters.outerObjectWithEnumProperty === null || requestParameters.outerObjectWithEnumProperty === undefined) {
throw new runtime.RequiredError('outerObjectWithEnumProperty','Required parameter requestParameters.outerObjectWithEnumProperty was null or undefined when calling fakePropertyEnumIntegerSerialize.');
Expand All @@ -339,7 +353,7 @@ export class FakeApi extends runtime.BaseAPI {
headerParameters['Content-Type'] = 'application/json';

const response = await this.request({
path: `/fake/property/enum-int`,
path: this.fakePropertyEnumIntegerSerializePath,
method: 'POST',
headers: headerParameters,
query: queryParameters,
Expand All @@ -360,6 +374,8 @@ export class FakeApi extends runtime.BaseAPI {
/**
* For this test, the body has to be a binary file.
*/
readonly testBodyWithBinaryPath = '/fake/body-with-binary'

async testBodyWithBinaryRaw(requestParameters: TestBodyWithBinaryRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> {
if (requestParameters.body === null || requestParameters.body === undefined) {
throw new runtime.RequiredError('body','Required parameter requestParameters.body was null or undefined when calling testBodyWithBinary.');
Expand All @@ -372,7 +388,7 @@ export class FakeApi extends runtime.BaseAPI {
headerParameters['Content-Type'] = 'image/png';

const response = await this.request({
path: `/fake/body-with-binary`,
path: this.testBodyWithBinaryPath,
method: 'PUT',
headers: headerParameters,
query: queryParameters,
Expand All @@ -392,6 +408,8 @@ export class FakeApi extends runtime.BaseAPI {
/**
* For this test, the body for this request must reference a schema named `File`.
*/
readonly testBodyWithFileSchemaPath = '/fake/body-with-file-schema'

async testBodyWithFileSchemaRaw(requestParameters: TestBodyWithFileSchemaRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> {
if (requestParameters.fileSchemaTestClass === null || requestParameters.fileSchemaTestClass === undefined) {
throw new runtime.RequiredError('fileSchemaTestClass','Required parameter requestParameters.fileSchemaTestClass was null or undefined when calling testBodyWithFileSchema.');
Expand All @@ -404,7 +422,7 @@ export class FakeApi extends runtime.BaseAPI {
headerParameters['Content-Type'] = 'application/json';

const response = await this.request({
path: `/fake/body-with-file-schema`,
path: this.testBodyWithFileSchemaPath,
method: 'PUT',
headers: headerParameters,
query: queryParameters,
Expand All @@ -423,6 +441,8 @@ export class FakeApi extends runtime.BaseAPI {

/**
*/
readonly testBodyWithQueryParamsPath = '/fake/body-with-query-params'

async testBodyWithQueryParamsRaw(requestParameters: TestBodyWithQueryParamsRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> {
if (requestParameters.query === null || requestParameters.query === undefined) {
throw new runtime.RequiredError('query','Required parameter requestParameters.query was null or undefined when calling testBodyWithQueryParams.');
Expand All @@ -443,7 +463,7 @@ export class FakeApi extends runtime.BaseAPI {
headerParameters['Content-Type'] = 'application/json';

const response = await this.request({
path: `/fake/body-with-query-params`,
path: this.testBodyWithQueryParamsPath,
method: 'PUT',
headers: headerParameters,
query: queryParameters,
Expand All @@ -463,6 +483,8 @@ export class FakeApi extends runtime.BaseAPI {
* To test \"client\" model
* To test \"client\" model
*/
readonly testClientModelPath = '/fake'

async testClientModelRaw(requestParameters: TestClientModelRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<Client>> {
if (requestParameters.client === null || requestParameters.client === undefined) {
throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling testClientModel.');
Expand All @@ -475,7 +497,7 @@ export class FakeApi extends runtime.BaseAPI {
headerParameters['Content-Type'] = 'application/json';

const response = await this.request({
path: `/fake`,
path: this.testClientModelPath,
method: 'PATCH',
headers: headerParameters,
query: queryParameters,
Expand All @@ -498,6 +520,8 @@ export class FakeApi extends runtime.BaseAPI {
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
* Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
*/
readonly testEndpointParametersPath = '/fake'

async testEndpointParametersRaw(requestParameters: TestEndpointParametersRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> {
if (requestParameters.number === null || requestParameters.number === undefined) {
throw new runtime.RequiredError('number','Required parameter requestParameters.number was null or undefined when calling testEndpointParameters.');
Expand Down Expand Up @@ -595,7 +619,7 @@ export class FakeApi extends runtime.BaseAPI {
}

const response = await this.request({
path: `/fake`,
path: this.testEndpointParametersPath,
method: 'POST',
headers: headerParameters,
query: queryParameters,
Expand All @@ -617,6 +641,8 @@ export class FakeApi extends runtime.BaseAPI {
* To test enum parameters
* To test enum parameters
*/
readonly testEnumParametersPath = '/fake'

async testEnumParametersRaw(requestParameters: TestEnumParametersRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> {
const queryParameters: any = {};

Expand Down Expand Up @@ -669,7 +695,7 @@ export class FakeApi extends runtime.BaseAPI {
}

const response = await this.request({
path: `/fake`,
path: this.testEnumParametersPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
Expand All @@ -691,6 +717,8 @@ export class FakeApi extends runtime.BaseAPI {
* Fake endpoint to test group parameters (optional)
* Fake endpoint to test group parameters (optional)
*/
readonly testGroupParametersPath = '/fake'

async testGroupParametersRaw(requestParameters: TestGroupParametersRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> {
if (requestParameters.requiredStringGroup === null || requestParameters.requiredStringGroup === undefined) {
throw new runtime.RequiredError('requiredStringGroup','Required parameter requestParameters.requiredStringGroup was null or undefined when calling testGroupParameters.');
Expand Down Expand Up @@ -741,7 +769,7 @@ export class FakeApi extends runtime.BaseAPI {
}
}
const response = await this.request({
path: `/fake`,
path: this.testGroupParametersPath,
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
Expand All @@ -761,6 +789,8 @@ export class FakeApi extends runtime.BaseAPI {
/**
* test inline additionalProperties
*/
readonly testInlineAdditionalPropertiesPath = '/fake/inline-additionalProperties'

async testInlineAdditionalPropertiesRaw(requestParameters: TestInlineAdditionalPropertiesRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> {
if (requestParameters.requestBody === null || requestParameters.requestBody === undefined) {
throw new runtime.RequiredError('requestBody','Required parameter requestParameters.requestBody was null or undefined when calling testInlineAdditionalProperties.');
Expand All @@ -773,7 +803,7 @@ export class FakeApi extends runtime.BaseAPI {
headerParameters['Content-Type'] = 'application/json';

const response = await this.request({
path: `/fake/inline-additionalProperties`,
path: this.testInlineAdditionalPropertiesPath,
method: 'POST',
headers: headerParameters,
query: queryParameters,
Expand All @@ -793,6 +823,8 @@ export class FakeApi extends runtime.BaseAPI {
/**
* test json serialization of form data
*/
readonly testJsonFormDataPath = '/fake/jsonFormData'

async testJsonFormDataRaw(requestParameters: TestJsonFormDataRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> {
if (requestParameters.param === null || requestParameters.param === undefined) {
throw new runtime.RequiredError('param','Required parameter requestParameters.param was null or undefined when calling testJsonFormData.');
Expand Down Expand Up @@ -829,7 +861,7 @@ export class FakeApi extends runtime.BaseAPI {
}

const response = await this.request({
path: `/fake/jsonFormData`,
path: this.testJsonFormDataPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
Expand All @@ -849,6 +881,8 @@ export class FakeApi extends runtime.BaseAPI {
/**
* To test the collection format in query parameters
*/
readonly testQueryParameterCollectionFormatPath = '/fake/test-query-parameters'

async testQueryParameterCollectionFormatRaw(requestParameters: TestQueryParameterCollectionFormatRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> {
if (requestParameters.pipe === null || requestParameters.pipe === undefined) {
throw new runtime.RequiredError('pipe','Required parameter requestParameters.pipe was null or undefined when calling testQueryParameterCollectionFormat.');
Expand Down Expand Up @@ -907,7 +941,7 @@ export class FakeApi extends runtime.BaseAPI {
const headerParameters: runtime.HTTPHeaders = {};

const response = await this.request({
path: `/fake/test-query-parameters`,
path: this.testQueryParameterCollectionFormatPath,
method: 'PUT',
headers: headerParameters,
query: queryParameters,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export class FakeClassnameTags123Api extends runtime.BaseAPI {
* To test class name in snake case
* To test class name in snake case
*/
readonly testClassnamePath = '/fake_classname_test'

async testClassnameRaw(requestParameters: TestClassnameRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<Client>> {
if (requestParameters.client === null || requestParameters.client === undefined) {
throw new runtime.RequiredError('client','Required parameter requestParameters.client was null or undefined when calling testClassname.');
Expand All @@ -49,7 +51,7 @@ export class FakeClassnameTags123Api extends runtime.BaseAPI {
}

const response = await this.request({
path: `/fake_classname_test`,
path: this.testClassnamePath,
method: 'PATCH',
headers: headerParameters,
query: queryParameters,
Expand Down
Loading