diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 6550805..e8f5af0 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -3,10 +3,10 @@ id: 599a9576-4665-431e-be1e-44cc13ef28aa management: docChecksum: dd4d04e62622de8f631720b5be68964d docVersion: latest - speakeasyVersion: 1.385.0 - generationVersion: 2.407.2 - releaseVersion: 0.7.2 - configChecksum: ed711ed185d766c457022634eb07a389 + speakeasyVersion: 1.390.1 + generationVersion: 2.409.0 + releaseVersion: 0.8.0 + configChecksum: ce348b09a6bede0bd69fc04a63e32148 repoURL: https://github.com/LukeHagar/discoursejs.git repoSubDirectory: . installationURL: https://github.com/LukeHagar/discoursejs @@ -16,7 +16,7 @@ features: additionalDependencies: 0.1.0 additionalProperties: 0.1.1 constsAndDefaults: 0.1.11 - core: 3.14.2 + core: 3.16.0 defaultEnabledRetries: 0.1.0 deprecations: 2.81.1 envVarSecurityUsage: 0.1.1 @@ -27,6 +27,7 @@ features: responseFormat: 0.2.3 retries: 2.83.0 sdkHooks: 0.1.0 + uploadStreams: 0.1.0 generatedFiles: - src/funcs/backupsCreateBackup.ts - src/funcs/backupsDownloadBackup.ts @@ -156,6 +157,7 @@ generatedFiles: - src/lib/config.ts - src/lib/dlv.ts - src/lib/encodings.ts + - src/lib/files.ts - src/lib/http.ts - src/lib/is-plain-object.ts - src/lib/logger.ts @@ -177,6 +179,7 @@ generatedFiles: - src/sdk/types/index.ts - src/sdk/types/operations.ts - src/sdk/types/rfcdate.ts + - src/sdk/types/streams.ts - tsconfig.json - src/sdk/models/operations/createbackup.ts - src/sdk/models/operations/downloadbackup.ts diff --git a/RELEASES.md b/RELEASES.md index 8390e31..4d9545e 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -248,4 +248,14 @@ Based on: ### Generated - [typescript v0.7.2] . ### Releases -- [NPM v0.7.2] https://www.npmjs.com/package/@lukehagar/discoursejs/v/0.7.2 - . \ No newline at end of file +- [NPM v0.7.2] https://www.npmjs.com/package/@lukehagar/discoursejs/v/0.7.2 - . + +## 2024-09-04 00:23:41 +### Changes +Based on: +- OpenAPI Doc latest +- Speakeasy CLI 1.390.1 (2.409.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [typescript v0.8.0] . +### Releases +- [NPM v0.8.0] https://www.npmjs.com/package/@lukehagar/discoursejs/v/0.8.0 - . \ No newline at end of file diff --git a/docs/sdk/models/operations/createuploadrequestbody.md b/docs/sdk/models/operations/createuploadrequestbody.md index dc1c81d..f1a47fd 100644 --- a/docs/sdk/models/operations/createuploadrequestbody.md +++ b/docs/sdk/models/operations/createuploadrequestbody.md @@ -5,9 +5,7 @@ ```typescript import { CreateUploadRequestBody } from "@lukehagar/discoursejs/sdk/models/operations"; -let value: CreateUploadRequestBody = { - type: "custom_emoji", -}; +// No examples available for this model ``` ## Fields diff --git a/docs/sdk/models/operations/createuploadresponsebody.md b/docs/sdk/models/operations/createuploadresponsebody.md index 518facb..350ed2b 100644 --- a/docs/sdk/models/operations/createuploadresponsebody.md +++ b/docs/sdk/models/operations/createuploadresponsebody.md @@ -8,19 +8,19 @@ file uploaded import { CreateUploadResponseBody } from "@lukehagar/discoursejs/sdk/models/operations"; let value: CreateUploadResponseBody = { - extension: "mp4v", - filesize: 311486, - height: 416692, + extension: "jpg", + filesize: 567846, + height: 172195, humanFilesize: "", - id: 888616, + id: 621169, originalFilename: "", retainHours: "", shortPath: "", shortUrl: "", - thumbnailHeight: 810839, - thumbnailWidth: 697274, - url: "http://juvenile-cougar.biz", - width: 59383, + thumbnailHeight: 85076, + thumbnailWidth: 498180, + url: "http://tragic-tuba.name", + width: 763165, }; ``` diff --git a/docs/sdk/models/operations/filet.md b/docs/sdk/models/operations/filet.md index d19776d..a6a2d26 100644 --- a/docs/sdk/models/operations/filet.md +++ b/docs/sdk/models/operations/filet.md @@ -5,15 +5,12 @@ ```typescript import { FileT } from "@lukehagar/discoursejs/sdk/models/operations"; -let value: FileT = { - content: new TextEncoder().encode("0x79ac3d1a9D"), - fileName: "your_file_here", -}; +// No examples available for this model ``` ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `content` | *Uint8Array* | :heavy_check_mark: | N/A | -| `fileName` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | +| `content` | *ReadableStream* | :heavy_check_mark: | N/A | +| `fileName` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/sdk/models/operations/generatepresignedputrequestbody.md b/docs/sdk/models/operations/generatepresignedputrequestbody.md index af9c29e..a992c0c 100644 --- a/docs/sdk/models/operations/generatepresignedputrequestbody.md +++ b/docs/sdk/models/operations/generatepresignedputrequestbody.md @@ -8,7 +8,7 @@ import { GeneratePresignedPutRequestBody } from "@lukehagar/discoursejs/sdk/mode let value: GeneratePresignedPutRequestBody = { fileName: "IMG_2021.jpeg", fileSize: 4096, - type: "composer", + type: "profile_background", }; ``` diff --git a/docs/sdk/models/operations/type.md b/docs/sdk/models/operations/type.md index f9a08b2..9ff065c 100644 --- a/docs/sdk/models/operations/type.md +++ b/docs/sdk/models/operations/type.md @@ -5,7 +5,7 @@ ```typescript import { Type } from "@lukehagar/discoursejs/sdk/models/operations"; -let value: Type = "composer"; +let value: Type = "profile_background"; ``` ## Values diff --git a/docs/sdks/admin/README.md b/docs/sdks/admin/README.md index b300499..ff564e9 100644 --- a/docs/sdks/admin/README.md +++ b/docs/sdks/admin/README.md @@ -516,7 +516,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.admin.refreshGravatar(""); + const result = await sdk.admin.refreshGravatar("Frances39"); // Handle the result console.log(result) @@ -538,7 +538,7 @@ import { adminRefreshGravatar } from "@lukehagar/discoursejs/funcs/adminRefreshG const sdk = new SDKCore(); async function run() { - const res = await adminRefreshGravatar(sdk, ""); + const res = await adminRefreshGravatar(sdk, "Jody_Pfannerstill"); if (!res.ok) { throw res.error; diff --git a/docs/sdks/backups/README.md b/docs/sdks/backups/README.md index 14134d7..86de17c 100644 --- a/docs/sdks/backups/README.md +++ b/docs/sdks/backups/README.md @@ -91,7 +91,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - await sdk.backups.downloadBackup("", ""); + await sdk.backups.downloadBackup("your_file_here", ""); } @@ -112,7 +112,7 @@ import { backupsDownloadBackup } from "@lukehagar/discoursejs/funcs/backupsDownl const sdk = new SDKCore(); async function run() { - const res = await backupsDownloadBackup(sdk, "", ""); + const res = await backupsDownloadBackup(sdk, "your_file_here", ""); if (!res.ok) { throw res.error; @@ -227,7 +227,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - await sdk.backups.sendDownloadBackupEmail(""); + await sdk.backups.sendDownloadBackupEmail("your_file_here"); } @@ -248,7 +248,7 @@ import { backupsSendDownloadBackupEmail } from "@lukehagar/discoursejs/funcs/bac const sdk = new SDKCore(); async function run() { - const res = await backupsSendDownloadBackupEmail(sdk, ""); + const res = await backupsSendDownloadBackupEmail(sdk, "your_file_here"); if (!res.ok) { throw res.error; diff --git a/docs/sdks/badges/README.md b/docs/sdks/badges/README.md index 068a614..3efbc6f 100644 --- a/docs/sdks/badges/README.md +++ b/docs/sdks/badges/README.md @@ -227,7 +227,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.badges.listUserBadges(""); + const result = await sdk.badges.listUserBadges("Faustino28"); // Handle the result console.log(result) @@ -249,7 +249,7 @@ import { badgesListUserBadges } from "@lukehagar/discoursejs/funcs/badgesListUse const sdk = new SDKCore(); async function run() { - const res = await badgesListUserBadges(sdk, ""); + const res = await badgesListUserBadges(sdk, "Eloisa_Davis"); if (!res.ok) { throw res.error; diff --git a/docs/sdks/invites/README.md b/docs/sdks/invites/README.md index cc0fee5..16cadca 100644 --- a/docs/sdks/invites/README.md +++ b/docs/sdks/invites/README.md @@ -101,7 +101,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.invites.inviteToTopic("", "", ""); + const result = await sdk.invites.inviteToTopic("", "", ""); // Handle the result console.log(result) @@ -123,7 +123,7 @@ import { invitesInviteToTopic } from "@lukehagar/discoursejs/funcs/invitesInvite const sdk = new SDKCore(); async function run() { - const res = await invitesInviteToTopic(sdk, "", "", ""); + const res = await invitesInviteToTopic(sdk, "", "", ""); if (!res.ok) { throw res.error; diff --git a/docs/sdks/posts/README.md b/docs/sdks/posts/README.md index 150823a..55fd6ae 100644 --- a/docs/sdks/posts/README.md +++ b/docs/sdks/posts/README.md @@ -180,7 +180,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.posts.getPost(""); + const result = await sdk.posts.getPost(""); // Handle the result console.log(result) @@ -202,7 +202,7 @@ import { postsGetPost } from "@lukehagar/discoursejs/funcs/postsGetPost.js"; const sdk = new SDKCore(); async function run() { - const res = await postsGetPost(sdk, ""); + const res = await postsGetPost(sdk, ""); if (!res.ok) { throw res.error; @@ -320,7 +320,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.posts.lockPost("", "", ""); + const result = await sdk.posts.lockPost("", "", ""); // Handle the result console.log(result) @@ -342,7 +342,7 @@ import { postsLockPost } from "@lukehagar/discoursejs/funcs/postsLockPost.js"; const sdk = new SDKCore(); async function run() { - const res = await postsLockPost(sdk, "", "", ""); + const res = await postsLockPost(sdk, "", "", ""); if (!res.ok) { throw res.error; @@ -463,7 +463,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.posts.postReplies(""); + const result = await sdk.posts.postReplies(""); // Handle the result console.log(result) @@ -485,7 +485,7 @@ import { postsPostReplies } from "@lukehagar/discoursejs/funcs/postsPostReplies. const sdk = new SDKCore(); async function run() { - const res = await postsPostReplies(sdk, ""); + const res = await postsPostReplies(sdk, ""); if (!res.ok) { throw res.error; @@ -532,7 +532,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.posts.updatePost(""); + const result = await sdk.posts.updatePost(""); // Handle the result console.log(result) @@ -554,7 +554,7 @@ import { postsUpdatePost } from "@lukehagar/discoursejs/funcs/postsUpdatePost.js const sdk = new SDKCore(); async function run() { - const res = await postsUpdatePost(sdk, ""); + const res = await postsUpdatePost(sdk, ""); if (!res.ok) { throw res.error; diff --git a/docs/sdks/privatemessages/README.md b/docs/sdks/privatemessages/README.md index 291cf49..82cb9ce 100644 --- a/docs/sdks/privatemessages/README.md +++ b/docs/sdks/privatemessages/README.md @@ -98,7 +98,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.privateMessages.getUserSentPrivateMessages(""); + const result = await sdk.privateMessages.getUserSentPrivateMessages("Nathanial38"); // Handle the result console.log(result) @@ -120,7 +120,7 @@ import { privateMessagesGetUserSentPrivateMessages } from "@lukehagar/discoursej const sdk = new SDKCore(); async function run() { - const res = await privateMessagesGetUserSentPrivateMessages(sdk, ""); + const res = await privateMessagesGetUserSentPrivateMessages(sdk, "Ebba.Grant22"); if (!res.ok) { throw res.error; @@ -167,7 +167,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.privateMessages.listUserPrivateMessages(""); + const result = await sdk.privateMessages.listUserPrivateMessages("Liliana_West71"); // Handle the result console.log(result) @@ -189,7 +189,7 @@ import { privateMessagesListUserPrivateMessages } from "@lukehagar/discoursejs/f const sdk = new SDKCore(); async function run() { - const res = await privateMessagesListUserPrivateMessages(sdk, ""); + const res = await privateMessagesListUserPrivateMessages(sdk, "Bonnie55"); if (!res.ok) { throw res.error; diff --git a/docs/sdks/tags/README.md b/docs/sdks/tags/README.md index 3c3464d..2e9c241 100644 --- a/docs/sdks/tags/README.md +++ b/docs/sdks/tags/README.md @@ -162,7 +162,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.tags.getTagGroup(""); + const result = await sdk.tags.getTagGroup(""); // Handle the result console.log(result) @@ -184,7 +184,7 @@ import { tagsGetTagGroup } from "@lukehagar/discoursejs/funcs/tagsGetTagGroup.js const sdk = new SDKCore(); async function run() { - const res = await tagsGetTagGroup(sdk, ""); + const res = await tagsGetTagGroup(sdk, ""); if (!res.ok) { throw res.error; @@ -367,7 +367,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.tags.updateTagGroup(""); + const result = await sdk.tags.updateTagGroup(""); // Handle the result console.log(result) @@ -389,7 +389,7 @@ import { tagsUpdateTagGroup } from "@lukehagar/discoursejs/funcs/tagsUpdateTagGr const sdk = new SDKCore(); async function run() { - const res = await tagsUpdateTagGroup(sdk, ""); + const res = await tagsUpdateTagGroup(sdk, ""); if (!res.ok) { throw res.error; diff --git a/docs/sdks/topics/README.md b/docs/sdks/topics/README.md index 236d5b2..27a662b 100644 --- a/docs/sdks/topics/README.md +++ b/docs/sdks/topics/README.md @@ -31,7 +31,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - await sdk.topics.bookmarkTopic("", "", ""); + await sdk.topics.bookmarkTopic("", "", ""); } @@ -52,7 +52,7 @@ import { topicsBookmarkTopic } from "@lukehagar/discoursejs/funcs/topicsBookmark const sdk = new SDKCore(); async function run() { - const res = await topicsBookmarkTopic(sdk, "", "", ""); + const res = await topicsBookmarkTopic(sdk, "", "", ""); if (!res.ok) { throw res.error; @@ -177,7 +177,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.topics.createTopicTimer("", "", "", { + const result = await sdk.topics.createTopicTimer("", "", "", { time: "", }); @@ -201,7 +201,7 @@ import { topicsCreateTopicTimer } from "@lukehagar/discoursejs/funcs/topicsCreat const sdk = new SDKCore(); async function run() { - const res = await topicsCreateTopicTimer(sdk, "", "", "", { + const res = await topicsCreateTopicTimer(sdk, "", "", "", { time: "", }); @@ -253,7 +253,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.topics.getTopic("", "", ""); + const result = await sdk.topics.getTopic("", "", ""); // Handle the result console.log(result) @@ -275,7 +275,7 @@ import { topicsGetTopic } from "@lukehagar/discoursejs/funcs/topicsGetTopic.js"; const sdk = new SDKCore(); async function run() { - const res = await topicsGetTopic(sdk, "", "", ""); + const res = await topicsGetTopic(sdk, "", "", ""); if (!res.ok) { throw res.error; @@ -391,7 +391,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.topics.inviteToTopic("", "", ""); + const result = await sdk.topics.inviteToTopic("", "", ""); // Handle the result console.log(result) @@ -413,7 +413,7 @@ import { topicsInviteToTopic } from "@lukehagar/discoursejs/funcs/topicsInviteTo const sdk = new SDKCore(); async function run() { - const res = await topicsInviteToTopic(sdk, "", "", ""); + const res = await topicsInviteToTopic(sdk, "", "", ""); if (!res.ok) { throw res.error; @@ -606,7 +606,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - await sdk.topics.removeTopic("", "", ""); + await sdk.topics.removeTopic("", "", ""); } @@ -627,7 +627,7 @@ import { topicsRemoveTopic } from "@lukehagar/discoursejs/funcs/topicsRemoveTopi const sdk = new SDKCore(); async function run() { - const res = await topicsRemoveTopic(sdk, "", "", ""); + const res = await topicsRemoveTopic(sdk, "", "", ""); if (!res.ok) { throw res.error; @@ -675,7 +675,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.topics.setNotificationLevel("", "", ""); + const result = await sdk.topics.setNotificationLevel("", "", ""); // Handle the result console.log(result) @@ -697,7 +697,7 @@ import { topicsSetNotificationLevel } from "@lukehagar/discoursejs/funcs/topicsS const sdk = new SDKCore(); async function run() { - const res = await topicsSetNotificationLevel(sdk, "", "", ""); + const res = await topicsSetNotificationLevel(sdk, "", "", ""); if (!res.ok) { throw res.error; @@ -747,7 +747,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.topics.updateTopic("", "", ""); + const result = await sdk.topics.updateTopic("", "", ""); // Handle the result console.log(result) @@ -769,7 +769,7 @@ import { topicsUpdateTopic } from "@lukehagar/discoursejs/funcs/topicsUpdateTopi const sdk = new SDKCore(); async function run() { - const res = await topicsUpdateTopic(sdk, "", "", ""); + const res = await topicsUpdateTopic(sdk, "", "", ""); if (!res.ok) { throw res.error; @@ -819,7 +819,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.topics.updateTopicStatus("", "", "", { + const result = await sdk.topics.updateTopicStatus("", "", "", { enabled: "false", status: "pinned_globally", until: "2030-12-31", @@ -845,7 +845,7 @@ import { topicsUpdateTopicStatus } from "@lukehagar/discoursejs/funcs/topicsUpda const sdk = new SDKCore(); async function run() { - const res = await topicsUpdateTopicStatus(sdk, "", "", "", { + const res = await topicsUpdateTopicStatus(sdk, "", "", "", { enabled: "true", status: "visible", until: "2030-12-31", @@ -899,7 +899,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.topics.updateTopicTimestamp("", "", "", { + const result = await sdk.topics.updateTopicTimestamp("", "", "", { timestamp: "1594291380", }); @@ -923,7 +923,7 @@ import { topicsUpdateTopicTimestamp } from "@lukehagar/discoursejs/funcs/topicsU const sdk = new SDKCore(); async function run() { - const res = await topicsUpdateTopicTimestamp(sdk, "", "", "", { + const res = await topicsUpdateTopicTimestamp(sdk, "", "", "", { timestamp: "1594291380", }); diff --git a/docs/sdks/users/README.md b/docs/sdks/users/README.md index 74959d7..a0a8090 100644 --- a/docs/sdks/users/README.md +++ b/docs/sdks/users/README.md @@ -600,7 +600,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.users.getUser("", "", ""); + const result = await sdk.users.getUser("", "", "Ned56"); // Handle the result console.log(result) @@ -622,7 +622,7 @@ import { usersGetUser } from "@lukehagar/discoursejs/funcs/usersGetUser.js"; const sdk = new SDKCore(); async function run() { - const res = await usersGetUser(sdk, "", "", ""); + const res = await usersGetUser(sdk, "", "", "Herta61"); if (!res.ok) { throw res.error; @@ -671,7 +671,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.users.getUserEmails(""); + const result = await sdk.users.getUserEmails("Winifred_OConner64"); // Handle the result console.log(result) @@ -693,7 +693,7 @@ import { usersGetUserEmails } from "@lukehagar/discoursejs/funcs/usersGetUserEma const sdk = new SDKCore(); async function run() { - const res = await usersGetUserEmails(sdk, ""); + const res = await usersGetUserEmails(sdk, "Blair_Luettgen46"); if (!res.ok) { throw res.error; @@ -883,7 +883,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.users.listUserActions("", 620550, ""); + const result = await sdk.users.listUserActions("", 620550, "Deondre75"); // Handle the result console.log(result) @@ -905,7 +905,7 @@ import { usersListUserActions } from "@lukehagar/discoursejs/funcs/usersListUser const sdk = new SDKCore(); async function run() { - const res = await usersListUserActions(sdk, "", 257087, ""); + const res = await usersListUserActions(sdk, "", 13410, "Augustus_Wuckert48"); if (!res.ok) { throw res.error; @@ -954,7 +954,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.users.listUserBadges(""); + const result = await sdk.users.listUserBadges("Faustino28"); // Handle the result console.log(result) @@ -976,7 +976,7 @@ import { usersListUserBadges } from "@lukehagar/discoursejs/funcs/usersListUserB const sdk = new SDKCore(); async function run() { - const res = await usersListUserBadges(sdk, ""); + const res = await usersListUserBadges(sdk, "Eloisa_Davis"); if (!res.ok) { throw res.error; @@ -1164,7 +1164,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.users.refreshGravatar(""); + const result = await sdk.users.refreshGravatar("Frances39"); // Handle the result console.log(result) @@ -1186,7 +1186,7 @@ import { usersRefreshGravatar } from "@lukehagar/discoursejs/funcs/usersRefreshG const sdk = new SDKCore(); async function run() { - const res = await usersRefreshGravatar(sdk, ""); + const res = await usersRefreshGravatar(sdk, "Jody_Pfannerstill"); if (!res.ok) { throw res.error; @@ -1456,7 +1456,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.users.updateAvatar(""); + const result = await sdk.users.updateAvatar("Kadin32"); // Handle the result console.log(result) @@ -1478,7 +1478,7 @@ import { usersUpdateAvatar } from "@lukehagar/discoursejs/funcs/usersUpdateAvata const sdk = new SDKCore(); async function run() { - const res = await usersUpdateAvatar(sdk, ""); + const res = await usersUpdateAvatar(sdk, "Zion66"); if (!res.ok) { throw res.error; @@ -1526,7 +1526,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - await sdk.users.updateEmail(""); + await sdk.users.updateEmail("Hobart_Lakin34"); } @@ -1547,7 +1547,7 @@ import { usersUpdateEmail } from "@lukehagar/discoursejs/funcs/usersUpdateEmail. const sdk = new SDKCore(); async function run() { - const res = await usersUpdateEmail(sdk, ""); + const res = await usersUpdateEmail(sdk, "Madalyn90"); if (!res.ok) { throw res.error; @@ -1594,7 +1594,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - const result = await sdk.users.updateUser("", "", ""); + const result = await sdk.users.updateUser("", "", "Dandre.Jast32"); // Handle the result console.log(result) @@ -1616,7 +1616,7 @@ import { usersUpdateUser } from "@lukehagar/discoursejs/funcs/usersUpdateUser.js const sdk = new SDKCore(); async function run() { - const res = await usersUpdateUser(sdk, "", "", ""); + const res = await usersUpdateUser(sdk, "", "", "Cora.Gislason"); if (!res.ok) { throw res.error; @@ -1666,7 +1666,7 @@ import { SDK } from "@lukehagar/discoursejs"; const sdk = new SDK(); async function run() { - await sdk.users.updateUsername(""); + await sdk.users.updateUsername("Avis_Tremblay74"); } @@ -1687,7 +1687,7 @@ import { usersUpdateUsername } from "@lukehagar/discoursejs/funcs/usersUpdateUse const sdk = new SDKCore(); async function run() { - const res = await usersUpdateUsername(sdk, ""); + const res = await usersUpdateUsername(sdk, "Taurean_Flatley"); if (!res.ok) { throw res.error; diff --git a/gen.yaml b/gen.yaml index 55d4bd5..a75e775 100644 --- a/gen.yaml +++ b/gen.yaml @@ -11,7 +11,7 @@ generation: auth: oAuth2ClientCredentialsEnabled: false typescript: - version: 0.7.2 + version: 0.8.0 additionalDependencies: dependencies: {} devDependencies: {} diff --git a/jsr.json b/jsr.json index 2935742..7443ec6 100644 --- a/jsr.json +++ b/jsr.json @@ -2,7 +2,7 @@ { "name": "@lukehagar/discoursejs", - "version": "0.7.2", + "version": "0.8.0", "exports": { ".": "./src/index.ts", "./sdk/models/errors": "./src/sdk/models/errors/index.ts", diff --git a/package.json b/package.json index e722967..ad595c6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lukehagar/discoursejs", - "version": "0.7.2", + "version": "0.8.0", "author": "LukeHagar", "main": "./index.js", "sideEffects": false, @@ -18,6 +18,7 @@ "zod": ">= 3" }, "devDependencies": { + "@types/node": "^18.19.3", "@typescript-eslint/eslint-plugin": "^7.7.1", "@typescript-eslint/parser": "^7.7.1", "eslint": "^8.57.0", diff --git a/src/funcs/uploadsCreateUpload.ts b/src/funcs/uploadsCreateUpload.ts index f06f952..f1ac644 100644 --- a/src/funcs/uploadsCreateUpload.ts +++ b/src/funcs/uploadsCreateUpload.ts @@ -3,6 +3,7 @@ */ import { SDKCore } from "../core.js"; +import { readableStreamToArrayBuffer } from "../lib/files.js"; import * as m$ from "../lib/matchers.js"; import * as schemas$ from "../lib/schemas.js"; import { RequestOptions } from "../lib/sdks.js"; @@ -19,6 +20,7 @@ import { SDKValidationError } from "../sdk/models/errors/sdkvalidationerror.js"; import * as operations from "../sdk/models/operations/index.js"; import { isBlobLike } from "../sdk/types/blobs.js"; import { Result } from "../sdk/types/fp.js"; +import { isReadableStream } from "../sdk/types/streams.js"; /** * Creates an upload @@ -56,6 +58,10 @@ export async function uploadsCreateUpload( if (payload$?.file !== undefined) { if (isBlobLike(payload$?.file)) { body$.append("file", payload$?.file); + } else if (isReadableStream(payload$?.file.content)) { + const buffer = await readableStreamToArrayBuffer(payload$?.file.content); + const blob = new Blob([buffer], { type: "application/octet-stream" }); + body$.append("file", blob); } else { body$.append( "file", diff --git a/src/index.ts b/src/index.ts index ceb6380..c6fc7f0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,3 +4,4 @@ export * from "./sdk/sdk.js"; export * from "./lib/config.js"; +export * as files from "./lib/files.js"; diff --git a/src/lib/config.ts b/src/lib/config.ts index efd4e07..2de1fc1 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -60,7 +60,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", openapiDocVersion: "latest", - sdkVersion: "0.7.2", - genVersion: "2.407.2", - userAgent: "speakeasy-sdk/typescript 0.7.2 2.407.2 latest @lukehagar/discoursejs", + sdkVersion: "0.8.0", + genVersion: "2.409.0", + userAgent: "speakeasy-sdk/typescript 0.8.0 2.409.0 latest @lukehagar/discoursejs", } as const; diff --git a/src/lib/files.ts b/src/lib/files.ts new file mode 100644 index 0000000..69028c7 --- /dev/null +++ b/src/lib/files.ts @@ -0,0 +1,58 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { Readable } from "stream"; +import { createReadStream } from "fs"; +import { readFile } from "fs/promises"; + +export function toStream(filePath: string): ReadableStream { + return Readable.toWeb( + createReadStream(filePath), + ) as ReadableStream; +} + +export async function toByteArray(filePath: string): Promise { + return readFile(filePath); +} + +export async function toString(filePath: string): Promise { + return readFile(filePath, "utf8"); +} + +/** + * Consumes a stream and returns a concatenated array buffer. Useful in + * situations where we need to read the whole file because it forms part of a + * larger payload containing other fields, and we can't modify the underlying + * request structure. + */ +export async function readableStreamToArrayBuffer( + readable: ReadableStream, +): Promise { + const reader = readable.getReader(); + const chunks: Uint8Array[] = []; + + let totalLength = 0; + let done = false; + + while (!done) { + const { value, done: doneReading } = await reader.read(); + + if (doneReading) { + done = true; + } else { + chunks.push(value); + totalLength += value.length; + } + } + + const concatenatedChunks = new Uint8Array(totalLength); + let offset = 0; + + for (const chunk of chunks) { + concatenatedChunks.set(chunk, offset); + offset += chunk.length; + } + + return concatenatedChunks.buffer; +} diff --git a/src/lib/sdks.ts b/src/lib/sdks.ts index 08399af..4a53181 100644 --- a/src/lib/sdks.ts +++ b/src/lib/sdks.ts @@ -181,6 +181,18 @@ export class ClientSDK { } } + if (conf.body instanceof ReadableStream) { + if (!fetchOptions) { + fetchOptions = { + // @ts-expect-error see https://github.com/node-fetch/node-fetch/issues/1769 + duplex: "half", + }; + } else { + // @ts-expect-error see https://github.com/node-fetch/node-fetch/issues/1769 + fetchOptions.duplex = "half"; + } + } + let input; try { input = this.hooks$.beforeCreateRequest(context, { diff --git a/src/sdk/models/operations/createupload.ts b/src/sdk/models/operations/createupload.ts index 050dc19..1a61319 100644 --- a/src/sdk/models/operations/createupload.ts +++ b/src/sdk/models/operations/createupload.ts @@ -2,14 +2,13 @@ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ -import * as b64$ from "../../../lib/base64.js"; import { remap as remap$ } from "../../../lib/primitives.js"; import { blobLikeSchema } from "../../types/blobs.js"; import { ClosedEnum } from "../../types/enums.js"; import * as z from "zod"; export type FileT = { - content: Uint8Array | string; + content: ReadableStream | Blob | ArrayBuffer | Buffer; fileName: string; }; @@ -57,19 +56,29 @@ export type CreateUploadResponseBody = { /** @internal */ export const FileT$inboundSchema: z.ZodType = z.object({ - content: b64$.zodInbound, + content: z.union([ + z.instanceof(ReadableStream), + z.instanceof(Blob), + z.instanceof(ArrayBuffer), + z.instanceof(Buffer), + ]), fileName: z.string(), }); /** @internal */ export type FileT$Outbound = { - content: Uint8Array; + content: ReadableStream | Blob | ArrayBuffer | Buffer; fileName: string; }; /** @internal */ export const FileT$outboundSchema: z.ZodType = z.object({ - content: b64$.zodOutbound, + content: z.union([ + z.instanceof(ReadableStream), + z.instanceof(Blob), + z.instanceof(ArrayBuffer), + z.instanceof(Buffer), + ]), fileName: z.string(), }); diff --git a/src/sdk/types/streams.ts b/src/sdk/types/streams.ts new file mode 100644 index 0000000..a0163e7 --- /dev/null +++ b/src/sdk/types/streams.ts @@ -0,0 +1,21 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +export function isReadableStream( + val: unknown, +): val is ReadableStream { + if (typeof val !== "object" || val === null) { + return false; + } + + // Check for the presence of methods specific to ReadableStream + const stream = val as ReadableStream; + + // ReadableStream has methods like getReader, cancel, and tee + return ( + typeof stream.getReader === "function" && + typeof stream.cancel === "function" && + typeof stream.tee === "function" + ); +}