Skip to content

Commit 2624063

Browse files
committed
ci: regenerated with OpenAPI Doc 0.2.0, Speakeay CLI 0.20.1
1 parent 9ab57eb commit 2624063

File tree

7 files changed

+71
-10
lines changed

7 files changed

+71
-10
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ sdk.Apis.getApis(request).then((res: GetApisResponse | AxiosError) => {
5757
<!-- Start SDK Available Operations -->
5858
## SDK Available Operations
5959

60+
### SDK SDK
61+
62+
* `validateApiKey` - Validate the current api key.
63+
6064
### ApiEndpoints
6165

6266
* `deleteApiEndpoint` - Delete an ApiEndpoint.

gen.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
management:
2-
openapi-checksum: 8e8183d84cace76310a3208e63cd7855
3-
openapi-version: 0.1.0
4-
speakeasy-version: 0.20.0
2+
openapi-checksum: 2c73ed56562b78c36624b5eaddb0249b
3+
openapi-version: 0.2.0
4+
speakeasy-version: 0.20.1
55
telemetryenabled: null
66
typescript:
77
author: Speakeasy
88
packagename: '@speakeasy-api/speakeasy-client-sdk-typescript'
9-
version: 0.10.0
9+
version: 0.11.0

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": "0.10.0",
3+
"version": "0.11.0",
44
"author": "Speakeasy",
55
"scripts": {
66
"prepare": "tsc --build"

src/sdk/models/operations/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ export * from "./registerschema";
2929
export * from "./revokeembedaccesstoken";
3030
export * from "./upsertapi";
3131
export * from "./upsertapiendpoint";
32+
export * from "./validateapikey";
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { SpeakeasyMetadata, SpeakeasyBase } from "../../../internal/utils";
2+
import * as shared from "../shared";
3+
4+
5+
6+
export class ValidateApiKeyResponse extends SpeakeasyBase {
7+
@SpeakeasyMetadata()
8+
contentType: string;
9+
10+
@SpeakeasyMetadata()
11+
error?: shared.ErrorT;
12+
13+
@SpeakeasyMetadata()
14+
statusCode: number;
15+
}

src/sdk/sdk.ts

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import axios, { AxiosInstance } from "axios";
1+
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from "axios";
2+
import * as operations from "./models/operations";
23
import * as utils from "../internal/utils";
34
import { Security } from "./models/shared";
45

6+
57
import { ApiEndpoints } from "./apiendpoints";
68
import { Apis } from "./apis";
79
import { Embeds } from "./embeds";
@@ -39,8 +41,8 @@ export class SDK {
3941
public _securityClient: AxiosInstance;
4042
public _serverURL: string;
4143
private _language = "typescript";
42-
private _sdkVersion = "0.10.0";
43-
private _genVersion = "0.20.0";
44+
private _sdkVersion = "0.11.0";
45+
private _genVersion = "0.20.1";
4446

4547
constructor(props: SDKProps) {
4648
this._serverURL = props.serverUrl ?? ServerList[ServerProd];
@@ -58,6 +60,7 @@ export class SDK {
5860
this._securityClient = this._defaultClient;
5961
}
6062

63+
6164
this.apiEndpoints = new ApiEndpoints(
6265
this._defaultClient,
6366
this._securityClient,
@@ -112,4 +115,42 @@ export class SDK {
112115
this._genVersion
113116
);
114117
}
118+
119+
/**
120+
* validateApiKey - Validate the current api key.
121+
**/
122+
validateApiKey(
123+
config?: AxiosRequestConfig
124+
): Promise<operations.ValidateApiKeyResponse> {
125+
const baseURL: string = this._serverURL;
126+
const url: string = baseURL.replace(/\/$/, "") + "/v1/auth/validate";
127+
128+
const client: AxiosInstance = this._securityClient!;
129+
130+
131+
const r = client.request({
132+
url: url,
133+
method: "get",
134+
...config,
135+
});
136+
137+
return r.then((httpRes: AxiosResponse) => {
138+
const contentType: string = httpRes?.headers?.["content-type"] ?? "";
139+
140+
if (httpRes?.status == null) throw new Error(`status code not found in response: ${httpRes}`);
141+
const res: operations.ValidateApiKeyResponse = {statusCode: httpRes.status, contentType: contentType};
142+
switch (true) {
143+
case httpRes?.status == 200:
144+
break;
145+
default:
146+
if (utils.matchContentType(contentType, `application/json`)) {
147+
res.error = httpRes?.data;
148+
}
149+
break;
150+
}
151+
152+
return res;
153+
})
154+
}
155+
115156
}

0 commit comments

Comments
 (0)