Skip to content

Commit 54b230b

Browse files
committed
ci: regenerated with OpenAPI Doc 0.3.0, Speakeay CLI 1.5.4
1 parent b59276d commit 54b230b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1430
-637
lines changed

RELEASES.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,12 @@ Based on:
9494
- OpenAPI Doc 0.3.0 https://docs.speakeasyapi.dev/openapi.yaml
9595
- Speakeasy CLI 1.5.3 https://github.com/speakeasy-api/speakeasy
9696
### Releases
97-
- [NPM v1.5.2] https://www.npmjs.com/package/@speakeasy-api/speakeasy-client-sdk-typescript/v/1.5.2 - .
97+
- [NPM v1.5.2] https://www.npmjs.com/package/@speakeasy-api/speakeasy-client-sdk-typescript/v/1.5.2 - .
98+
99+
## 2023-02-28 00:11:30
100+
### Changes
101+
Based on:
102+
- OpenAPI Doc 0.3.0 https://docs.speakeasyapi.dev/openapi.yaml
103+
- Speakeasy CLI 1.5.4 https://github.com/speakeasy-api/speakeasy
104+
### Releases
105+
- [NPM v1.5.3] https://www.npmjs.com/package/@speakeasy-api/speakeasy-client-sdk-typescript/v/1.5.3 - .

files.gen

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ src/sdk/plugins.ts
66
src/sdk/requests.ts
77
src/sdk/schemas.ts
88
src/sdk/sdk.ts
9+
jest.config.js
910
package-lock.json
1011
package.json
1112
src/index.ts

gen.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
configVersion: 1.0.0
22
management:
3-
docChecksum: 2bba3b8f9d211b02569b3f9aff0d34b4
4-
docVersion: 0.3.0
5-
speakeasyVersion: 1.5.3
3+
docChecksum: 2bba3b8f9d211b02569b3f9aff0d34b4
4+
docVersion: 0.3.0
5+
speakeasyVersion: 1.5.4
66
generation:
7-
telemetryEnabled: true
8-
sdkClassName: SDK
7+
telemetryEnabled: true
8+
sdkClassName: SDK
9+
sdkFlattening: false
910
typescript:
10-
version: 1.5.2
11-
author: Speakeasy
12-
packageName: '@speakeasy-api/speakeasy-client-sdk-typescript'
11+
version: 1.5.3
12+
author: Speakeasy
13+
packageName: '@speakeasy-api/speakeasy-client-sdk-typescript'

jest.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = {
2+
preset: 'ts-jest',
3+
testEnvironment: 'node',
4+
verbose: false,
5+
testPathIgnorePatterns: [
6+
"<rootDir>/__tests__/helpers.ts"
7+
]
8+
};

package-lock.json

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

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
{
22
"name": "@speakeasy-api/speakeasy-client-sdk-typescript",
3-
"version": "1.5.2",
3+
"version": "1.5.3",
44
"author": "Speakeasy",
55
"scripts": {
66
"prepare": "tsc --build"
77
},
88
"dependencies": {
99
"axios": "^1.1.3",
10+
"class-transformer": "^0.5.1",
1011
"form-data": "^4.0.0",
11-
"qs": "^6.11.0",
1212
"reflect-metadata": "^0.1.13"
1313
},
1414
"devDependencies": {
1515
"@types/node": "^18.11.5",
16-
"@types/qs": "^6.9.7",
1716
"typescript": "^4.8.4"
1817
},
1918
"main": "dist/index.js",

src/internal/utils/headers.ts

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,45 @@ import {
55
isNumberRecord,
66
isStringRecord,
77
parseParamDecorator,
8+
ParamDecorator,
9+
convertIfDateObjectToISOString,
810
} from "./utils";
911

10-
import { ParamDecorator } from "./pathparams";
11-
1212
export const headerMetadataKey = "header";
1313

1414
export function getHeadersFromRequest(headerParams: any): any {
1515
if (headerParams == null) return;
16+
1617
let headers: any = {};
18+
1719
const fieldNames: string[] = Object.getOwnPropertyNames(headerParams);
1820
fieldNames.forEach((fname) => {
1921
const headerAnn: string = Reflect.getMetadata(
2022
headerMetadataKey,
2123
headerParams,
2224
fname
2325
);
26+
2427
if (headerAnn == null) return;
28+
2529
const headerDecorator: ParamDecorator = parseParamDecorator(
2630
headerAnn,
2731
fname,
2832
"simple",
2933
false
3034
);
35+
3136
if (headerDecorator == null) return;
37+
3238
const value: string = serializeHeader(
3339
headerParams[fname],
34-
headerDecorator.Explode
40+
headerDecorator.Explode,
41+
headerDecorator.DateTimeFormat
3542
);
43+
3644
if (value != "") headers[headerDecorator.ParamName] = value;
3745
});
46+
3847
return headers;
3948
}
4049

@@ -66,11 +75,16 @@ export function getHeadersFromResponse(
6675
return reponseHeaders;
6776
}
6877

69-
function serializeHeader(header: any, explode: boolean): string {
78+
function serializeHeader(
79+
header: any,
80+
explode: boolean,
81+
dateTimeFormat?: string
82+
): string {
7083
const headerVals: string[] = [];
84+
7185
if (Array.isArray(header)) {
7286
header.forEach((val: any) => {
73-
headerVals.push(String(val));
87+
headerVals.push(convertIfDateObjectToISOString(val, dateTimeFormat));
7488
});
7589
} else if (
7690
isStringRecord(header) ||
@@ -88,16 +102,23 @@ function serializeHeader(header: any, explode: boolean): string {
88102
header,
89103
headerKey
90104
);
105+
91106
if (headerAnn == null) return;
107+
92108
const headerDecorator: ParamDecorator = parseParamDecorator(
93109
headerAnn,
94110
headerKey,
95111
"simple",
96112
explode
97113
);
114+
98115
if (headerDecorator == null) return;
99116

100-
const headerFieldValue = header[headerKey];
117+
const headerFieldValue = convertIfDateObjectToISOString(
118+
header[headerKey],
119+
headerDecorator.DateTimeFormat
120+
);
121+
101122
if (isEmpty(headerFieldValue)) return;
102123
else if (explode)
103124
headerVals.push(`${headerDecorator.ParamName}=${headerFieldValue}`);

src/internal/utils/pathparams.ts

Lines changed: 40 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,46 @@
1-
import { parseParamDecorator } from "./utils";
2-
import { isStringRecord, isNumberRecord, isBooleanRecord, isEmpty } from "./utils";
1+
import {
2+
encodeAndConvertPrimitiveVal,
3+
ParamDecorator,
4+
parseParamDecorator,
5+
} from "./utils";
6+
import {
7+
isStringRecord,
8+
isNumberRecord,
9+
isBooleanRecord,
10+
isEmpty,
11+
} from "./utils";
312

413
export const ppMetadataKey = "pathParam";
514

615
export function getSimplePathParams(
716
paramName: string,
817
paramValue: any,
9-
explode: boolean
18+
explode: boolean,
19+
dateTimeFormat?: string
1020
): Map<string, string> {
1121
const pathParams: Map<string, string> = new Map<string, string>();
1222
const ppVals: string[] = [];
23+
1324
if (Array.isArray(paramValue)) {
1425
paramValue.forEach((param) => {
15-
ppVals.push(String(param));
26+
ppVals.push(encodeAndConvertPrimitiveVal(param, dateTimeFormat));
1627
});
1728
pathParams.set(paramName, ppVals.join(","));
18-
} else if (isStringRecord(paramValue) || isNumberRecord(paramValue) || isBooleanRecord(paramValue)) {
29+
} else if (
30+
isStringRecord(paramValue) ||
31+
isNumberRecord(paramValue) ||
32+
isBooleanRecord(paramValue)
33+
) {
1934
Object.getOwnPropertyNames(paramValue).forEach((paramKey: string) => {
20-
if (explode) ppVals.push(`${paramKey}=${paramValue[paramKey]}`);
21-
else ppVals.push(`${paramKey},${paramValue[paramKey]}`);
35+
const paramFieldValue = encodeAndConvertPrimitiveVal(
36+
paramValue[paramKey],
37+
dateTimeFormat
38+
);
39+
40+
if (explode) ppVals.push(`${paramKey}=${paramFieldValue}`);
41+
else ppVals.push(`${paramKey},${paramFieldValue}`);
2242
});
43+
2344
pathParams.set(paramName, ppVals.join(","));
2445
} else if (paramValue instanceof Object) {
2546
Object.getOwnPropertyNames(paramValue).forEach((paramKey: string) => {
@@ -28,43 +49,35 @@ export function getSimplePathParams(
2849
paramValue,
2950
paramKey
3051
);
52+
3153
if (ppAnn == null) return;
54+
3255
const ppDecorator: ParamDecorator = parseParamDecorator(
3356
ppAnn,
3457
paramKey,
3558
"simple",
3659
explode
3760
);
61+
3862
if (ppDecorator == null) return;
3963

40-
const paramFieldValue = paramValue[paramKey];
64+
const paramFieldValue = encodeAndConvertPrimitiveVal(
65+
paramValue[paramKey],
66+
ppDecorator.DateTimeFormat
67+
);
4168

4269
if (isEmpty(paramFieldValue)) return;
4370
else if (explode)
4471
ppVals.push(`${ppDecorator.ParamName}=${paramFieldValue}`);
4572
else ppVals.push(`${ppDecorator.ParamName},${paramFieldValue}`);
4673
});
74+
4775
pathParams.set(paramName, ppVals.join(","));
4876
} else {
49-
pathParams.set(paramName, String(paramValue));
77+
pathParams.set(
78+
paramName,
79+
encodeAndConvertPrimitiveVal(paramValue, dateTimeFormat)
80+
);
5081
}
5182
return pathParams;
5283
}
53-
54-
export class ParamDecorator {
55-
Style: string;
56-
Explode: boolean;
57-
ParamName: string;
58-
Serialization?: string;
59-
constructor(
60-
Style: string,
61-
Explode: boolean,
62-
ParamName: string,
63-
Serialization?: string
64-
) {
65-
this.Style = Style;
66-
this.Explode = Explode;
67-
this.ParamName = ParamName;
68-
this.Serialization = Serialization;
69-
}
70-
}

0 commit comments

Comments
 (0)