Skip to content

Commit

Permalink
ci: regenerated with OpenAPI Doc 0.1.0, Speakeay CLI 0.10.5
Browse files Browse the repository at this point in the history
  • Loading branch information
speakeasy-ci committed Nov 9, 2022
1 parent 16cfdc7 commit 6419c87
Show file tree
Hide file tree
Showing 18 changed files with 265 additions and 120 deletions.
4 changes: 2 additions & 2 deletions gen.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
management:
openapi-checksum: 46093b002f359f8049d6b8210be2bc73
openapi-version: 0.1.0
speakeasy-version: 0.10.2
speakeasy-version: 0.10.5
typescript:
author: Speakeasy
packagename: '@speakeasy-api/speakeasy-client-sdk-typescript'
version: 0.1.5
version: 0.1.6
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@speakeasy-api/speakeasy-client-sdk-typescript",
"version": "0.1.4",
"version": "0.1.5",
"author": "Speakeasy",
"scripts": {
"lint:fix": "tsc --noemit && eslint \"./src\" --ext .ts,.tsx --fix",
"build": "tsc",
"build": "tsc --build",
"prepare": "npm run build"
},
"dependencies": {
Expand All @@ -21,7 +21,6 @@
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.7.1",
"typescript": "^4.8.4",
"@types/reflect-metadata": "^0.1.0"
"typescript": "^4.8.4"
}
}
17 changes: 11 additions & 6 deletions src/internal/utils/queryparams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ export const qpMetadataKey = "queryParam";
export function GetQueryParamSerializer(
queryParams: any
): ParamsSerializerOptions {
if (queryParams == null) return { encode: FormSerializerExplode };
let paramsSerializer: ParamsSerializerOptions = {
encode: FormSerializerExplode,
};
if (queryParams == null) return paramsSerializer;
const fieldNames: string[] = Object.getOwnPropertyNames(queryParams);
fieldNames.forEach((fname) => {
const qpAnn: string = Reflect.getMetadata(
Expand All @@ -25,36 +28,38 @@ export function GetQueryParamSerializer(
);
if (qpDecorator == null) return;
if (qpDecorator.Serialization === "json")
return {
paramsSerializer = {
encode: (params: unknown) => {
return JSON.stringify(params);
},
};
else {
switch (qpDecorator.Style) {
case "deepObject":
return {
paramsSerializer = {
encode: (params: unknown) => {
return qs.stringify(params, { arrayFormat: "repeat" });
},
};
break;
case "form":
if (qpDecorator.Explode) {
return {
paramsSerializer = {
encode: FormSerializerExplode,
};
} else {
return {
paramsSerializer = {
encode: FormSerializer,
};
}
break;
default:
// go to next query parameter field, assume first implemented serializer will serialize all query parameters for this request
return;
}
}
});
return { encode: FormSerializerExplode };
return paramsSerializer;
}

function FormSerializer(params: unknown): string {
Expand Down
36 changes: 15 additions & 21 deletions src/internal/utils/security.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import axios, { AxiosInstance } from "axios";

import { Security } from "../../sdk/models/shared/security";
import { AxiosInstance } from "axios";

const securityMetadataKey = "security";

export function CreateSecurityClient(
serverURL: string,
security: Security
client: AxiosInstance,
security: any
): AxiosInstance {
return ParseSecurityClass(serverURL, security);
return ParseSecurityClass(client, security);
}

function ParseSecurityDecorator(securityAnn: string): SecurityDecorator {
Expand Down Expand Up @@ -48,8 +46,10 @@ function ParseSecurityDecorator(securityAnn: string): SecurityDecorator {
);
}

function ParseSecurityClass(serverURL: string, security: any): AxiosInstance {
let client: AxiosInstance = axios.create({ baseURL: serverURL });
function ParseSecurityClass(
client: AxiosInstance,
security: any
): AxiosInstance {
const fieldNames: string[] = Object.getOwnPropertyNames(security);
fieldNames.forEach((fname) => {
const securityAnn: string = Reflect.getMetadata(
Expand All @@ -62,17 +62,17 @@ function ParseSecurityClass(serverURL: string, security: any): AxiosInstance {
ParseSecurityDecorator(securityAnn);
if (securityDecorator == null) return;
if (securityDecorator.Option) {
client = ParseSecurityOption(serverURL, security[fname]);
return ParseSecurityOption(client, security[fname]);
} else if (securityDecorator.Scheme) {
client = ParseSecurityScheme(serverURL, securityDecorator, security[fname]);
return ParseSecurityScheme(client, securityDecorator, security[fname]);
}
});

return client;
}

function ParseSecurityOption(
serverURL: string,
client: AxiosInstance,
optionType: any
): AxiosInstance {
const fieldNames: string[] = Object.getOwnPropertyNames(optionType);
Expand All @@ -87,23 +87,17 @@ function ParseSecurityOption(
ParseSecurityDecorator(securityAnn);
if (securityDecorator != null && securityDecorator.Scheme) return;
if (securityDecorator.Scheme)
return ParseSecurityScheme(
serverURL,
securityDecorator,
optionType[fname]
);
return ParseSecurityScheme(client, securityDecorator, optionType[fname]);
});

return axios.create({ baseURL: serverURL });
return client;
}

function ParseSecurityScheme(
serverURL: string,
client: AxiosInstance,
schemeDecorator: SecurityDecorator,
scheme: any
): AxiosInstance {
const client: AxiosInstance = axios.create({ baseURL: serverURL });

const fieldNames: string[] = Object.getOwnPropertyNames(scheme);
fieldNames.forEach((fname) => {
const securityAnn: string = Reflect.getMetadata(
Expand Down Expand Up @@ -182,4 +176,4 @@ class SecurityDecorator {
this.Scheme = Scheme;
this.SubType = SubType;
}
}
}
2 changes: 1 addition & 1 deletion src/sdk/models/operations/downloadschema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class DownloadSchemaResponse extends SpeakeasyBase {
error?: shared.Error;

@Metadata()
schema?: string;
schema?: Uint8Array;

@Metadata()
statusCode: number;
Expand Down
2 changes: 1 addition & 1 deletion src/sdk/models/operations/downloadschemarevision.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class DownloadSchemaRevisionResponse extends SpeakeasyBase {
error?: shared.Error;

@Metadata()
schema?: string;
schema?: Uint8Array;

@Metadata()
statusCode: number;
Expand Down
2 changes: 1 addition & 1 deletion src/sdk/models/operations/generatepostmancollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class GeneratePostmanCollectionResponse extends SpeakeasyBase {
error?: shared.Error;

@Metadata()
postmanCollection?: string;
postmanCollection?: Uint8Array;

@Metadata()
statusCode: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class GeneratePostmanCollectionForApiEndpointResponse extends SpeakeasyBa
error?: shared.Error;

@Metadata()
postmanCollection?: string;
postmanCollection?: Uint8Array;

@Metadata()
statusCode: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class GenerateRequestPostmanCollectionResponse extends SpeakeasyBase {
error?: shared.Error;

@Metadata()
postmanCollection?: string;
postmanCollection?: Uint8Array;

@Metadata()
statusCode: number;
Expand Down
2 changes: 1 addition & 1 deletion src/sdk/models/operations/registerschema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class RegisterSchemaPathParams extends SpeakeasyBase {

export class RegisterSchemaRequestBodyFile extends SpeakeasyBase {
@Metadata({ data: "multipart_form, content=true" })
content: string;
content: Uint8Array;

@Metadata({ data: "multipart_form, name=file" })
file: string;
Expand Down
4 changes: 2 additions & 2 deletions src/sdk/models/shared/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class Api extends SpeakeasyBase {
apiId: string;

@Metadata({ data: "json, name=created_at" })
createdAt: string;
createdAt: Date;

@Metadata({ data: "json, name=description" })
description: string;
Expand All @@ -22,7 +22,7 @@ export class Api extends SpeakeasyBase {
metaData?: Map<string, string[]>;

@Metadata({ data: "json, name=updated_at" })
updatedAt: string;
updatedAt: Date;

@Metadata({ data: "json, name=version_id" })
versionId: string;
Expand Down
4 changes: 2 additions & 2 deletions src/sdk/models/shared/apiendpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class ApiEndpoint extends SpeakeasyBase {
apiId: string;

@Metadata({ data: "json, name=created_at" })
createdAt: string;
createdAt: Date;

@Metadata({ data: "json, name=description" })
description: string;
Expand All @@ -31,7 +31,7 @@ export class ApiEndpoint extends SpeakeasyBase {
path: string;

@Metadata({ data: "json, name=updated_at" })
updatedAt: string;
updatedAt: Date;

@Metadata({ data: "json, name=version_id" })
versionId: string;
Expand Down
6 changes: 3 additions & 3 deletions src/sdk/models/shared/boundedrequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class BoundedRequest extends SpeakeasyBase {
apiId: string;

@Metadata({ data: "json, name=created_at" })
createdAt: string;
createdAt: Date;

@Metadata({ data: "json, name=customer_id" })
customerId: string;
Expand All @@ -31,13 +31,13 @@ export class BoundedRequest extends SpeakeasyBase {
path: string;

@Metadata({ data: "json, name=request_finish_time" })
requestFinishTime: string;
requestFinishTime: Date;

@Metadata({ data: "json, name=request_id" })
requestId: string;

@Metadata({ data: "json, name=request_start_time" })
requestStartTime: string;
requestStartTime: Date;

@Metadata({ data: "json, name=status" })
status: number;
Expand Down
8 changes: 4 additions & 4 deletions src/sdk/models/shared/embedtoken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Metadata, SpeakeasyBase } from "../../../internal/utils/utils";
**/
export class EmbedToken extends SpeakeasyBase {
@Metadata({ data: "json, name=created_at" })
createdAt: string;
createdAt: Date;

@Metadata({ data: "json, name=created_by" })
createdBy: string;
Expand All @@ -16,7 +16,7 @@ export class EmbedToken extends SpeakeasyBase {
description: string;

@Metadata({ data: "json, name=expires_at" })
expiresAt: string;
expiresAt: Date;

@Metadata({ data: "json, name=filters" })
filters: string;
Expand All @@ -25,10 +25,10 @@ export class EmbedToken extends SpeakeasyBase {
id: string;

@Metadata({ data: "json, name=last_used" })
lastUsed?: string;
lastUsed?: Date;

@Metadata({ data: "json, name=revoked_at" })
revokedAt?: string;
revokedAt?: Date;

@Metadata({ data: "json, name=revoked_by" })
revokedBy?: string;
Expand Down
2 changes: 1 addition & 1 deletion src/sdk/models/shared/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class Schema extends SpeakeasyBase {
apiId: string;

@Metadata({ data: "json, name=created_at" })
createdAt: string;
createdAt: Date;

@Metadata({ data: "json, name=description" })
description: string;
Expand Down
2 changes: 1 addition & 1 deletion src/sdk/models/shared/unboundedrequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Metadata, SpeakeasyBase } from "../../../internal/utils/utils";
**/
export class UnboundedRequest extends SpeakeasyBase {
@Metadata({ data: "json, name=created_at" })
createdAt: string;
createdAt: Date;

@Metadata({ data: "json, name=har" })
har: string;
Expand Down
2 changes: 1 addition & 1 deletion src/sdk/models/shared/versionmetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class VersionMetadata extends SpeakeasyBase {
apiId: string;

@Metadata({ data: "json, name=created_at" })
createdAt: string;
createdAt: Date;

@Metadata({ data: "json, name=meta_key" })
metaKey: string;
Expand Down
Loading

0 comments on commit 6419c87

Please sign in to comment.