diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index ca6ee49..e4028d1 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -3,18 +3,18 @@ id: c1ca526f-aa0e-4e69-8de4-80c2e3eaabd4 management: docChecksum: 9922bc49f897a6971cd384c3440969f1 docVersion: "10" - speakeasyVersion: 1.372.0 - generationVersion: 2.399.0 - releaseVersion: 1.1.1 - configChecksum: deb0d20940de4331e038fe12a171da0f + speakeasyVersion: 1.382.0 + generationVersion: 2.404.11 + releaseVersion: 1.2.0 + configChecksum: ad1e15de86cf3fbf3eeea308598af96e repoURL: https://github.com/speakeasy-sdks/api-summit-2024.git installationURL: https://github.com/speakeasy-sdks/api-summit-2024 published: true features: typescript: additionalDependencies: 0.1.0 - constsAndDefaults: 0.1.8 - core: 3.13.2 + constsAndDefaults: 0.1.11 + core: 3.14.1 defaultEnabledRetries: 0.1.0 devContainers: 2.90.0 envVarSecurityUsage: 0.1.1 diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 483588b..e8c5013 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -15,7 +15,7 @@ generation: auth: oAuth2ClientCredentialsEnabled: false typescript: - version: 1.1.1 + version: 1.2.0 additionalDependencies: dependencies: {} devDependencies: {} diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index e8a19ec..e90101f 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,4 +1,4 @@ -speakeasyVersion: 1.372.0 +speakeasyVersion: 1.382.0 sources: discord-OAS: sourceNamespace: discord-oas diff --git a/README.md b/README.md index 6635564..7ccab39 100644 --- a/README.md +++ b/README.md @@ -415,7 +415,9 @@ run(); ## Debugging -To log HTTP requests and responses, you can pass a logger that matches `console`'s interface as an SDK option. +You can setup your SDK to emit debug logs for SDK requests and responses. + +You can pass a logger that matches `console`'s interface as an SDK option. > [!WARNING] > Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production. diff --git a/RELEASES.md b/RELEASES.md index 7f7e8d5..39a4f27 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -36,4 +36,14 @@ Based on: ### Generated - [typescript v1.1.1] . ### Releases -- [NPM v1.1.1] https://www.npmjs.com/package/@speakeasy-sdks/discord/v/1.1.1 - . \ No newline at end of file +- [NPM v1.1.1] https://www.npmjs.com/package/@speakeasy-sdks/discord/v/1.1.1 - . + +## 2024-08-29 00:22:09 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.382.0 (2.404.11) https://github.com/speakeasy-api/speakeasy +### Generated +- [typescript v1.2.0] . +### Releases +- [NPM v1.2.0] https://www.npmjs.com/package/@speakeasy-sdks/discord/v/1.2.0 - . \ No newline at end of file diff --git a/docs/sdks/channelinvites/README.md b/docs/sdks/channelinvites/README.md index 824fb67..9e481e4 100644 --- a/docs/sdks/channelinvites/README.md +++ b/docs/sdks/channelinvites/README.md @@ -1,6 +1,8 @@ # ChannelInvites (*channelInvites*) +## Overview + ### Available Operations * [list](#list) @@ -29,7 +31,6 @@ async function run() { run(); ``` - ### Standalone function The standalone function version of this method: @@ -71,10 +72,10 @@ run(); | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | - ### Response **Promise\<[operations.ResponseBody[]](../../models/.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -82,6 +83,7 @@ run(); | errors.ErrorResponse | 4XX | application/json | | errors.SDKError | 4xx-5xx | */* | + ## create ### Example Usage @@ -96,7 +98,7 @@ const discord = new Discord({ async function run() { const result = await discord.channelInvites.create({ channelId: "", - requestBody: {}, + requestBody: {}, }); // Handle the result @@ -106,7 +108,6 @@ async function run() { run(); ``` - ### Standalone function The standalone function version of this method: @@ -124,7 +125,7 @@ const discord = new DiscordCore({ async function run() { const res = await channelInvitesCreate(discord, { channelId: "", - requestBody: {}, + requestBody: {}, }); if (!res.ok) { @@ -149,10 +150,10 @@ run(); | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | - ### Response **Promise\<[operations.CreateChannelInviteResponseBody](../../models/operations/createchannelinviteresponsebody.md)\>** + ### Errors | Error Object | Status Code | Content Type | diff --git a/docs/sdks/channels/README.md b/docs/sdks/channels/README.md index 4c73b8c..fdcfcbf 100644 --- a/docs/sdks/channels/README.md +++ b/docs/sdks/channels/README.md @@ -1,6 +1,8 @@ # Channels (*channels*) +## Overview + ### Available Operations * [get](#get) @@ -30,7 +32,6 @@ async function run() { run(); ``` - ### Standalone function The standalone function version of this method: @@ -72,10 +73,10 @@ run(); | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | - ### Response **Promise\<[operations.GetChannelResponseBody](../../models/operations/getchannelresponsebody.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -83,6 +84,7 @@ run(); | errors.ErrorResponse | 4XX | application/json | | errors.SDKError | 4xx-5xx | */* | + ## delete ### Example Usage @@ -106,7 +108,6 @@ async function run() { run(); ``` - ### Standalone function The standalone function version of this method: @@ -148,10 +149,10 @@ run(); | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | - ### Response **Promise\<[operations.DeleteChannelResponseBody](../../models/operations/deletechannelresponsebody.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -159,6 +160,7 @@ run(); | errors.ErrorResponse | 4XX | application/json | | errors.SDKError | 4xx-5xx | */* | + ## update ### Example Usage @@ -173,7 +175,7 @@ const discord = new Discord({ async function run() { const result = await discord.channels.update({ channelId: "", - requestBody: {}, + requestBody: {}, }); // Handle the result @@ -183,7 +185,6 @@ async function run() { run(); ``` - ### Standalone function The standalone function version of this method: @@ -201,7 +202,7 @@ const discord = new DiscordCore({ async function run() { const res = await channelsUpdate(discord, { channelId: "", - requestBody: {}, + requestBody: {}, }); if (!res.ok) { @@ -226,10 +227,10 @@ run(); | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | - ### Response **Promise\<[operations.UpdateChannelResponseBody](../../models/operations/updatechannelresponsebody.md)\>** + ### Errors | Error Object | Status Code | Content Type | diff --git a/docs/sdks/discord/README.md b/docs/sdks/discord/README.md index 3598f48..6073d89 100644 --- a/docs/sdks/discord/README.md +++ b/docs/sdks/discord/README.md @@ -1,11 +1,8 @@ # Discord SDK - ## Overview Discord HTTP API (Preview): Preview of the Discord v10 HTTP API specification. See https://discord.com/developers/docs for more details. Discord Developer Documentation - -### Available Operations - + \ No newline at end of file diff --git a/docs/sdks/messages/README.md b/docs/sdks/messages/README.md index a0df63e..a2661f7 100644 --- a/docs/sdks/messages/README.md +++ b/docs/sdks/messages/README.md @@ -1,6 +1,8 @@ # Messages (*messages*) +## Overview + ### Available Operations * [get](#get) @@ -33,7 +35,6 @@ async function run() { run(); ``` - ### Standalone function The standalone function version of this method: @@ -76,10 +77,10 @@ run(); | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | - ### Response **Promise\<[components.MessageResponse](../../models/components/messageresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -87,6 +88,7 @@ run(); | errors.ErrorResponse | 4XX | application/json | | errors.SDKError | 4xx-5xx | */* | + ## delete ### Example Usage @@ -110,7 +112,6 @@ async function run() { run(); ``` - ### Standalone function The standalone function version of this method: @@ -152,10 +153,10 @@ run(); | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | - ### Response **Promise\** + ### Errors | Error Object | Status Code | Content Type | @@ -163,6 +164,7 @@ run(); | errors.ErrorResponse | 4XX | application/json | | errors.SDKError | 4xx-5xx | */* | + ## update ### Example Usage @@ -188,7 +190,6 @@ async function run() { run(); ``` - ### Standalone function The standalone function version of this method: @@ -232,10 +233,10 @@ run(); | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | - ### Response **Promise\<[components.MessageResponse](../../models/components/messageresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -243,6 +244,7 @@ run(); | errors.ErrorResponse | 4XX | application/json | | errors.SDKError | 4xx-5xx | */* | + ## list ### Example Usage @@ -266,7 +268,6 @@ async function run() { run(); ``` - ### Standalone function The standalone function version of this method: @@ -308,10 +309,10 @@ run(); | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | - ### Response **Promise\<[components.MessageResponse[]](../../models/.md)\>** + ### Errors | Error Object | Status Code | Content Type | @@ -319,6 +320,7 @@ run(); | errors.ErrorResponse | 4XX | application/json | | errors.SDKError | 4xx-5xx | */* | + ## create ### Example Usage @@ -343,7 +345,6 @@ async function run() { run(); ``` - ### Standalone function The standalone function version of this method: @@ -386,10 +387,10 @@ run(); | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | - ### Response **Promise\<[components.MessageResponse](../../models/components/messageresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | diff --git a/docs/sdks/threads/README.md b/docs/sdks/threads/README.md index d988b63..2e532fb 100644 --- a/docs/sdks/threads/README.md +++ b/docs/sdks/threads/README.md @@ -1,6 +1,8 @@ # Threads (*threads*) +## Overview + ### Available Operations * [create](#create) @@ -19,10 +21,10 @@ const discord = new Discord({ async function run() { const result = await discord.threads.create({ channelId: "", - requestBody: { - name: "", - message: {}, - }, + requestBody: { + name: "", + message: {}, + }, }); // Handle the result @@ -32,7 +34,6 @@ async function run() { run(); ``` - ### Standalone function The standalone function version of this method: @@ -50,9 +51,9 @@ const discord = new DiscordCore({ async function run() { const res = await threadsCreate(discord, { channelId: "", - requestBody: { - name: "", - }, + requestBody: { + name: "", + }, }); if (!res.ok) { @@ -77,10 +78,10 @@ run(); | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | - ### Response **Promise\<[components.CreatedThreadResponse](../../models/components/createdthreadresponse.md)\>** + ### Errors | Error Object | Status Code | Content Type | diff --git a/jsr.json b/jsr.json index 8689020..be61655 100644 --- a/jsr.json +++ b/jsr.json @@ -2,7 +2,7 @@ { "name": "@speakeasy-sdks/discord", - "version": "1.1.1", + "version": "1.2.0", "exports": { ".": "./src/index.ts", "./models/errors": "./src/models/errors/index.ts", diff --git a/package-lock.json b/package-lock.json index 000feae..5b1cb53 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@speakeasy-sdks/discord", - "version": "1.1.1", + "version": "1.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@speakeasy-sdks/discord", - "version": "1.1.1", + "version": "1.2.0", "devDependencies": { "@typescript-eslint/eslint-plugin": "^7.7.1", "@typescript-eslint/parser": "^7.7.1", diff --git a/package.json b/package.json index 12a9ad3..a174043 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@speakeasy-sdks/discord", - "version": "1.1.1", + "version": "1.2.0", "author": "Speakeasy", "main": "./index.js", "sideEffects": false, diff --git a/src/hooks/hooks.ts b/src/hooks/hooks.ts index 27751fd..a6b6e17 100644 --- a/src/hooks/hooks.ts +++ b/src/hooks/hooks.ts @@ -17,6 +17,8 @@ import { SDKInitOptions, } from "./types.js"; +import { initHooks } from "./registration.js"; + export class SDKHooks implements Hooks { sdkInitHooks: SDKInitHook[] = []; beforeCreateRequestHooks: BeforeCreateRequestHook[] = []; @@ -24,7 +26,9 @@ export class SDKHooks implements Hooks { afterSuccessHooks: AfterSuccessHook[] = []; afterErrorHooks: AfterErrorHook[] = []; - constructor() {} + constructor() { + initHooks(this); + } registerSDKInitHook(hook: SDKInitHook) { this.sdkInitHooks.push(hook); diff --git a/src/lib/config.ts b/src/lib/config.ts index c0a14e1..3484701 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -52,7 +52,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", openapiDocVersion: "10", - sdkVersion: "1.1.1", - genVersion: "2.399.0", - userAgent: "speakeasy-sdk/typescript 1.1.1 2.399.0 10 @speakeasy-sdks/discord", + sdkVersion: "1.2.0", + genVersion: "2.404.11", + userAgent: "speakeasy-sdk/typescript 1.2.0 2.404.11 10 @speakeasy-sdks/discord", } as const;