Skip to content

Commit 9e68b8d

Browse files
committed
ci: regenerated with OpenAPI Doc 0.3.0, Speakeay CLI 1.7.1
1 parent f9721a6 commit 9e68b8d

File tree

14 files changed

+122
-131
lines changed

14 files changed

+122
-131
lines changed

RELEASES.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,12 @@ Based on:
110110
- OpenAPI Doc 0.3.0 https://docs.speakeasyapi.dev/openapi.yaml
111111
- Speakeasy CLI 1.6.0 https://github.com/speakeasy-api/speakeasy
112112
### Releases
113-
- [NPM v1.6.0] https://www.npmjs.com/package/@speakeasy-api/speakeasy-client-sdk-typescript/v/1.6.0 - .
113+
- [NPM v1.6.0] https://www.npmjs.com/package/@speakeasy-api/speakeasy-client-sdk-typescript/v/1.6.0 - .
114+
115+
## 2023-03-02 00:12:32
116+
### Changes
117+
Based on:
118+
- OpenAPI Doc 0.3.0 https://docs.speakeasyapi.dev/openapi.yaml
119+
- Speakeasy CLI 1.7.1 https://github.com/speakeasy-api/speakeasy
120+
### Releases
121+
- [NPM v1.7.0] https://www.npmjs.com/package/@speakeasy-api/speakeasy-client-sdk-typescript/v/1.7.0 - .

gen.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ configVersion: 1.0.0
22
management:
33
docChecksum: 2bba3b8f9d211b02569b3f9aff0d34b4
44
docVersion: 0.3.0
5-
speakeasyVersion: 1.6.0
5+
speakeasyVersion: 1.7.1
66
generation:
77
telemetryEnabled: true
88
sdkClassName: SDK
99
sdkFlattening: false
1010
typescript:
11-
version: 1.6.0
11+
version: 1.7.0
1212
author: Speakeasy
1313
packageName: '@speakeasy-api/speakeasy-client-sdk-typescript'

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@speakeasy-api/speakeasy-client-sdk-typescript",
3-
"version": "1.6.0",
3+
"version": "1.7.0",
44
"author": "Speakeasy",
55
"scripts": {
66
"prepare": "tsc --build"

src/internal/utils/requestbody.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export function serializeRequestBody(request: any): [object, any] {
5656
case "text/json":
5757
[requestHeaders, requestBody] = [
5858
{ "Content-Type": `${requestDecorator.MediaType}` },
59-
{ ...requestBodyObj[fname] },
59+
requestBodyObj[fname],
6060
];
6161
break;
6262

src/internal/utils/security.ts

Lines changed: 93 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,17 @@ function parseSecurityClass(
6161
const securityDecorator: SecurityDecorator =
6262
parseSecurityDecorator(securityAnn);
6363
if (securityDecorator == null) return;
64+
65+
const value = security[fname];
66+
6467
if (securityDecorator.Option) {
65-
return parseSecurityOption(client, security[fname]);
68+
return parseSecurityOption(client, value);
6669
} else if (securityDecorator.Scheme) {
67-
return parseSecurityScheme(client, securityDecorator, security[fname]);
70+
if (securityDecorator.SubType === "basic" && value !== Object(value)) {
71+
return parseSecurityScheme(client, securityDecorator, security);
72+
} else {
73+
client = parseSecurityScheme(client, securityDecorator, value);
74+
}
6875
}
6976
});
7077

@@ -85,10 +92,8 @@ function parseSecurityOption(
8592
if (securityAnn == null) return;
8693
const securityDecorator: SecurityDecorator =
8794
parseSecurityDecorator(securityAnn);
88-
if (securityDecorator != null && securityDecorator.Scheme) return;
89-
if (securityDecorator.Scheme) {
90-
return parseSecurityScheme(client, securityDecorator, optionType[fname]);
91-
}
95+
if (securityDecorator == null || !securityDecorator.Scheme) return;
96+
return parseSecurityScheme(client, securityDecorator, optionType[fname]);
9297
});
9398

9499
return client;
@@ -99,65 +104,91 @@ function parseSecurityScheme(
99104
schemeDecorator: SecurityDecorator,
100105
scheme: any
101106
): AxiosInstance {
102-
if (schemeDecorator.Type === "http" && schemeDecorator.SubType === "basic") {
103-
return parseBasicAuthScheme(client, scheme);
104-
}
107+
if (scheme === Object(scheme)) {
108+
if (
109+
schemeDecorator.Type === "http" &&
110+
schemeDecorator.SubType === "basic"
111+
) {
112+
return parseBasicAuthScheme(client, scheme);
113+
}
105114

106-
const fieldNames: string[] = Object.getOwnPropertyNames(scheme);
107-
fieldNames.forEach((fname) => {
108-
const securityAnn: string = Reflect.getMetadata(
109-
securityMetadataKey,
110-
scheme,
111-
fname
115+
const fieldNames: string[] = Object.getOwnPropertyNames(scheme);
116+
fieldNames.forEach((fname) => {
117+
const securityAnn: string = Reflect.getMetadata(
118+
securityMetadataKey,
119+
scheme,
120+
fname
121+
);
122+
if (securityAnn == null) return;
123+
const securityDecorator: SecurityDecorator =
124+
parseSecurityDecorator(securityAnn);
125+
if (securityDecorator == null || securityDecorator.Name === "") return;
126+
127+
client = parseSecuritySchemeValue(
128+
client,
129+
schemeDecorator,
130+
securityDecorator,
131+
scheme[fname]
132+
);
133+
});
134+
} else {
135+
client = parseSecuritySchemeValue(
136+
client,
137+
schemeDecorator,
138+
schemeDecorator,
139+
scheme
112140
);
113-
if (securityAnn == null) return;
114-
const securityDecorator: SecurityDecorator =
115-
parseSecurityDecorator(securityAnn);
116-
if (securityDecorator == null || securityDecorator.Name === "") return;
141+
}
117142

118-
switch (schemeDecorator.Type) {
119-
case "apiKey":
120-
switch (schemeDecorator.SubType) {
121-
case "header":
122-
client.defaults.headers.common[securityDecorator.Name] =
123-
scheme[fname];
124-
break;
125-
case "query":
126-
client.defaults.params[securityDecorator.Name] = scheme[fname];
127-
break;
128-
case "cookie":
129-
const securityDecoratorName: string = securityDecorator.Name;
130-
const val: string = scheme[fname];
131-
client.defaults.headers.common[
132-
"Cookie"
133-
] = `${securityDecoratorName}=${val}`;
134-
break;
135-
default:
136-
throw new Error("not supported");
137-
}
138-
break;
139-
case "openIdConnect":
140-
client.defaults.headers.common[securityDecorator.Name] = scheme[fname];
141-
break;
142-
case "oauth2":
143-
client.defaults.headers.common[securityDecorator.Name] = scheme[fname];
144-
break;
145-
case "http":
146-
switch (schemeDecorator.SubType) {
147-
case "basic":
148-
break;
149-
case "bearer":
150-
client.defaults.headers.common[securityDecorator.Name] =
151-
scheme[fname];
152-
break;
153-
default:
154-
throw new Error("not supported");
155-
}
156-
break;
157-
default:
158-
throw new Error("not supported");
159-
}
160-
});
143+
return client;
144+
}
145+
146+
function parseSecuritySchemeValue(
147+
client: AxiosInstance,
148+
schemeDecorator: SecurityDecorator,
149+
securityDecorator: SecurityDecorator,
150+
value: any
151+
): AxiosInstance {
152+
switch (schemeDecorator.Type) {
153+
case "apiKey":
154+
switch (schemeDecorator.SubType) {
155+
case "header":
156+
client.defaults.headers.common[securityDecorator.Name] = value;
157+
break;
158+
case "query":
159+
client.defaults.params[securityDecorator.Name] = value;
160+
break;
161+
case "cookie":
162+
const securityDecoratorName: string = securityDecorator.Name;
163+
const val: string = value;
164+
client.defaults.headers.common[
165+
"Cookie"
166+
] = `${securityDecoratorName}=${val}`;
167+
break;
168+
default:
169+
throw new Error("not supported");
170+
}
171+
break;
172+
case "openIdConnect":
173+
client.defaults.headers.common[securityDecorator.Name] = value;
174+
break;
175+
case "oauth2":
176+
client.defaults.headers.common[securityDecorator.Name] = value;
177+
break;
178+
case "http":
179+
switch (schemeDecorator.SubType) {
180+
case "basic":
181+
break;
182+
case "bearer":
183+
client.defaults.headers.common[securityDecorator.Name] = value;
184+
break;
185+
default:
186+
throw new Error("not supported");
187+
}
188+
break;
189+
default:
190+
throw new Error("not supported");
191+
}
161192

162193
return client;
163194
}

src/sdk/apiendpoints.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,7 @@ export class ApiEndpoints {
285285
switch (true) {
286286
case httpRes?.status == 200:
287287
if (utils.matchContentType(contentType, `application/json`)) {
288-
res.apiEndpoints = plainToInstance(
289-
,
290-
httpRes?.data as ,
291-
{ excludeExtraneousValues: true }
292-
);
288+
res.apiEndpoints = httpRes?.data;
293289
}
294290
break;
295291
default:
@@ -342,11 +338,7 @@ export class ApiEndpoints {
342338
switch (true) {
343339
case httpRes?.status == 200:
344340
if (utils.matchContentType(contentType, `application/json`)) {
345-
res.apiEndpoints = plainToInstance(
346-
,
347-
httpRes?.data as ,
348-
{ excludeExtraneousValues: true }
349-
);
341+
res.apiEndpoints = httpRes?.data;
350342
}
351343
break;
352344
default:

src/sdk/apis.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,7 @@ export class Apis {
229229
switch (true) {
230230
case httpRes?.status == 200:
231231
if (utils.matchContentType(contentType, `application/json`)) {
232-
res.apis = plainToInstance(
233-
,
234-
httpRes?.data as ,
235-
{ excludeExtraneousValues: true }
236-
);
232+
res.apis = httpRes?.data;
237233
}
238234
break;
239235
default:
@@ -290,11 +286,7 @@ export class Apis {
290286
switch (true) {
291287
case httpRes?.status == 200:
292288
if (utils.matchContentType(contentType, `application/json`)) {
293-
res.apis = plainToInstance(
294-
,
295-
httpRes?.data as ,
296-
{ excludeExtraneousValues: true }
297-
);
289+
res.apis = httpRes?.data;
298290
}
299291
break;
300292
default:

src/sdk/embeds.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,7 @@ export class Embeds {
111111
switch (true) {
112112
case httpRes?.status == 200:
113113
if (utils.matchContentType(contentType, `application/json`)) {
114-
res.embedTokens = plainToInstance(
115-
,
116-
httpRes?.data as ,
117-
{ excludeExtraneousValues: true }
118-
);
114+
res.embedTokens = httpRes?.data;
119115
}
120116
break;
121117
default:

src/sdk/metadata.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,7 @@ export class Metadata {
105105
switch (true) {
106106
case httpRes?.status == 200:
107107
if (utils.matchContentType(contentType, `application/json`)) {
108-
res.versionMetadata = plainToInstance(
109-
,
110-
httpRes?.data as ,
111-
{ excludeExtraneousValues: true }
112-
);
108+
res.versionMetadata = httpRes?.data;
113109
}
114110
break;
115111
default:

0 commit comments

Comments
 (0)