From 353a009a19e715cdfc0d4ebc490a76651174d1ad Mon Sep 17 00:00:00 2001 From: Zita Szupera Date: Tue, 16 Apr 2024 16:06:42 +0200 Subject: [PATCH 1/6] feat!: use serverside v2 API spec --- .eslintignore | 1 - .eslintrc.js | 15 + .prettierignore | 1 - .yarn/releases/yarn-1.22.22.cjs | 10 +- CHANGELOG.md | 35 +- CONTRIBUTING.md | 9 - __tests__/block-lists.test.ts | 25 +- __tests__/call-members.test.ts | 21 +- __tests__/call-types.test.ts | 54 +- __tests__/call.test.ts | 173 +- __tests__/channel-types.test.ts | 19 +- __tests__/channel.test.ts | 44 +- __tests__/command.test.ts | 3 +- __tests__/date-transform.test.ts | 123 + __tests__/devices-push.test.ts | 22 +- ...orage.test.ts => external-storage.test.ts} | 13 +- __tests__/messages.test.ts | 67 +- __tests__/permissions-app-settings.test.ts | 18 +- __tests__/rate-limit.test.ts | 71 + __tests__/teams.test.ts | 44 +- __tests__/user-compat.test.ts | 22 +- __tests__/users.test.ts | 85 +- __tests__/webhook.test.ts | 2 +- generate-openapi.sh | 100 +- index.ts | 5 +- package.json | 7 +- src/BaseApi.ts | 113 + src/StreamCall.ts | 208 +- src/StreamChannel.ts | 269 +- src/StreamChatClient.ts | 125 +- src/StreamClient.ts | 397 +- src/StreamModerationClient.ts | 3 + src/StreamVideoClient.ts | 98 +- src/gen/chat/.openapi-generator-ignore | 23 - src/gen/chat/.openapi-generator/FILES | 6 - src/gen/chat/.openapi-generator/VERSION | 1 - src/gen/chat/ChannelApi.ts | 270 + src/gen/chat/ChatApi.ts | 1853 ++ src/gen/chat/apis/ProductchatApi.ts | 7007 -------- src/gen/chat/apis/index.ts | 3 - src/gen/chat/index.ts | 5 - src/gen/chat/models/index.ts | 14766 ---------------- src/gen/chat/runtime.ts | 415 - src/gen/common/CommonApi.ts | 1003 ++ src/gen/model-decoders/index.ts | 1890 ++ src/gen/models/index.ts | 6696 +++++++ src/gen/moderation/ModerationApi.ts | 440 + src/gen/video/.openapi-generator-ignore | 23 - src/gen/video/.openapi-generator/FILES | 6 - src/gen/video/.openapi-generator/VERSION | 1 - src/gen/video/CallApi.ts | 275 + src/gen/video/VideoApi.ts | 923 + src/gen/video/apis/ProductvideoApi.ts | 2575 --- src/gen/video/apis/index.ts | 3 - src/gen/video/index.ts | 5 - src/gen/video/models/index.ts | 5000 ------ src/gen/video/runtime.ts | 415 - src/types.ts | 35 + src/utils/rate-limit.ts | 21 + test-cleanup.js | 25 +- yarn.lock | 12 + 61 files changed, 14147 insertions(+), 31752 deletions(-) create mode 100644 __tests__/date-transform.test.ts rename __tests__/{external-recording-storage.test.ts => external-storage.test.ts} (75%) create mode 100644 __tests__/rate-limit.test.ts create mode 100644 src/BaseApi.ts create mode 100644 src/StreamModerationClient.ts delete mode 100644 src/gen/chat/.openapi-generator-ignore delete mode 100644 src/gen/chat/.openapi-generator/FILES delete mode 100644 src/gen/chat/.openapi-generator/VERSION create mode 100644 src/gen/chat/ChannelApi.ts create mode 100644 src/gen/chat/ChatApi.ts delete mode 100644 src/gen/chat/apis/ProductchatApi.ts delete mode 100644 src/gen/chat/apis/index.ts delete mode 100644 src/gen/chat/index.ts delete mode 100644 src/gen/chat/models/index.ts delete mode 100644 src/gen/chat/runtime.ts create mode 100644 src/gen/common/CommonApi.ts create mode 100644 src/gen/model-decoders/index.ts create mode 100644 src/gen/models/index.ts create mode 100644 src/gen/moderation/ModerationApi.ts delete mode 100644 src/gen/video/.openapi-generator-ignore delete mode 100644 src/gen/video/.openapi-generator/FILES delete mode 100644 src/gen/video/.openapi-generator/VERSION create mode 100644 src/gen/video/CallApi.ts create mode 100644 src/gen/video/VideoApi.ts delete mode 100644 src/gen/video/apis/ProductvideoApi.ts delete mode 100644 src/gen/video/apis/index.ts delete mode 100644 src/gen/video/index.ts delete mode 100644 src/gen/video/models/index.ts delete mode 100644 src/gen/video/runtime.ts create mode 100644 src/utils/rate-limit.ts diff --git a/.eslintignore b/.eslintignore index 207227f..c925c21 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,2 @@ /dist /node_modules -/src/gen diff --git a/.eslintrc.js b/.eslintrc.js index b5b8bc5..6858d74 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -4,6 +4,7 @@ module.exports = { es2021: true, }, extends: ["standard-with-typescript", "prettier"], + plugins: ["unused-imports"], overrides: [ { env: { @@ -33,5 +34,19 @@ module.exports = { "@typescript-eslint/strict-boolean-expressions": "off", "@typescript-eslint/no-non-null-assertion": "off", "@typescript-eslint/no-confusing-void-expression": "off", + "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": "off", + "unused-imports/no-unused-imports": "error", + "unused-imports/no-unused-vars": [ + "error", + { + vars: "all", + varsIgnorePattern: "^_", + args: "after-used", + argsIgnorePattern: "^_", + }, + ], + "@typescript-eslint/no-empty-interface": "off", + eqeqeq: ["error", "smart"], }, }; diff --git a/.prettierignore b/.prettierignore index 88464b9..1521c8b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1 @@ dist -src/gen diff --git a/.yarn/releases/yarn-1.22.22.cjs b/.yarn/releases/yarn-1.22.22.cjs index 9883640..9bcd5a8 100755 --- a/.yarn/releases/yarn-1.22.22.cjs +++ b/.yarn/releases/yarn-1.22.22.cjs @@ -79525,9 +79525,9 @@ declare var __webpack_require__: mixed; function isHexCode(c) { return ( - (0x30 /* 0 */ <= c && c <= 0x39 /* 9 */) || - (0x41 /* A */ <= c && c <= 0x46 /* F */) || - (0x61 /* a */ <= c && c <= 0x66 /* f */) + (0x30 /* 0 */ <= c && c <= 0x39) /* 9 */ || + (0x41 /* A */ <= c && c <= 0x46) /* F */ || + (0x61 /* a */ <= c && c <= 0x66) /* f */ ); } @@ -155112,8 +155112,8 @@ util.inherits(module.exports.ISO_8859_7, sbcs); var bucket = this._getEncodeBucket(uCode); var low = uCode & 0xff; if (bucket[low] <= SEQ_START) - this.encodeTableSeq[SEQ_START - bucket[low]][DEF_CHAR] = - dbcsCode; // There's already a sequence, set a single-char subsequence of it. + this.encodeTableSeq[SEQ_START - bucket[low]][DEF_CHAR] = dbcsCode; + // There's already a sequence, set a single-char subsequence of it. else if (bucket[low] == UNASSIGNED) bucket[low] = dbcsCode; }; diff --git a/CHANGELOG.md b/CHANGELOG.md index 95c423c..09401ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,68 +55,59 @@ ## [0.2.1](https://github.com/GetStream/stream-node/compare/v0.2.0...v0.2.1) (2024-05-15) - ### Bug Fixes -* custom event signature ([#32](https://github.com/GetStream/stream-node/issues/32)) ([5e02b9b](https://github.com/GetStream/stream-node/commit/5e02b9bb333c5f7fa2a171e60a02ce997091c2ad)) +- custom event signature ([#32](https://github.com/GetStream/stream-node/issues/32)) ([5e02b9b](https://github.com/GetStream/stream-node/commit/5e02b9bb333c5f7fa2a171e60a02ce997091c2ad)) ## [0.2.0](https://github.com/GetStream/stream-node/compare/v0.1.13...v0.2.0) (2024-05-14) - ### ⚠ BREAKING CHANGES -* upgrade to API v113.0.0 ([#28](https://github.com/GetStream/stream-node/issues/28)) +- upgrade to API v113.0.0 ([#28](https://github.com/GetStream/stream-node/issues/28)) ### Features -* delete recording and transcription methods ([#30](https://github.com/GetStream/stream-node/issues/30)) ([beb89ac](https://github.com/GetStream/stream-node/commit/beb89ac2f4470e0255b4a8c99cc5e1f5e9bb27d8)) -* upgrade to API v113.0.0 ([#28](https://github.com/GetStream/stream-node/issues/28)) ([cc0d00d](https://github.com/GetStream/stream-node/commit/cc0d00ddfa18eaa01907310382cbce125655f586)) +- delete recording and transcription methods ([#30](https://github.com/GetStream/stream-node/issues/30)) ([beb89ac](https://github.com/GetStream/stream-node/commit/beb89ac2f4470e0255b4a8c99cc5e1f5e9bb27d8)) +- upgrade to API v113.0.0 ([#28](https://github.com/GetStream/stream-node/issues/28)) ([cc0d00d](https://github.com/GetStream/stream-node/commit/cc0d00ddfa18eaa01907310382cbce125655f586)) ## [0.1.13](https://github.com/GetStream/stream-node/compare/v0.1.12...v0.1.13) (2024-03-26) - ### Features -* listTranscriptions API ([#24](https://github.com/GetStream/stream-node/issues/24)) ([a170fd6](https://github.com/GetStream/stream-node/commit/a170fd6133b1fbeb01ba27987ffb8b50dd2c95fc)) +- listTranscriptions API ([#24](https://github.com/GetStream/stream-node/issues/24)) ([a170fd6](https://github.com/GetStream/stream-node/commit/a170fd6133b1fbeb01ba27987ffb8b50dd2c95fc)) ## [0.1.12](https://github.com/GetStream/stream-node/compare/v0.1.11...v0.1.12) (2024-03-08) - ### Features -* update video to api v100.4.3 ([#22](https://github.com/GetStream/stream-node/issues/22)) ([2424b2d](https://github.com/GetStream/stream-node/commit/2424b2db10353dc46cd9c78c543666732228d5c7)) - +- update video to api v100.4.3 ([#22](https://github.com/GetStream/stream-node/issues/22)) ([2424b2d](https://github.com/GetStream/stream-node/commit/2424b2db10353dc46cd9c78c543666732228d5c7)) ### Bug Fixes -* basePath not stored properly ([#20](https://github.com/GetStream/stream-node/issues/20)) ([3221ba0](https://github.com/GetStream/stream-node/commit/3221ba0ec1fe0bf002c6cf21794f23f1d6a818fd)) +- basePath not stored properly ([#20](https://github.com/GetStream/stream-node/issues/20)) ([3221ba0](https://github.com/GetStream/stream-node/commit/3221ba0ec1fe0bf002c6cf21794f23f1d6a818fd)) ## [0.1.11](https://github.com/GetStream/stream-node/compare/v0.1.10...v0.1.11) (2024-02-29) - ### Bug Fixes -* add missing dependencies ([#18](https://github.com/GetStream/stream-node/issues/18)) ([5a1a75b](https://github.com/GetStream/stream-node/commit/5a1a75b8125be825788f3f520f29ac1d6024b2b7)) -* persist [@ts-expect-error](https://github.com/ts-expect-error) comments in typing files ([#16](https://github.com/GetStream/stream-node/issues/16)) ([b1d3051](https://github.com/GetStream/stream-node/commit/b1d3051d8146031f7cb6b5f88bc07ee5a916d921)) +- add missing dependencies ([#18](https://github.com/GetStream/stream-node/issues/18)) ([5a1a75b](https://github.com/GetStream/stream-node/commit/5a1a75b8125be825788f3f520f29ac1d6024b2b7)) +- persist [@ts-expect-error](https://github.com/ts-expect-error) comments in typing files ([#16](https://github.com/GetStream/stream-node/issues/16)) ([b1d3051](https://github.com/GetStream/stream-node/commit/b1d3051d8146031f7cb6b5f88bc07ee5a916d921)) ## [0.1.10](https://github.com/GetStream/stream-node/compare/v0.1.9...v0.1.10) (2024-02-12) - ### Features -* add verifyWebhook method ([#12](https://github.com/GetStream/stream-node/issues/12)) ([e79f53c](https://github.com/GetStream/stream-node/commit/e79f53cdbed202428a99b5a0cf7df6baf200333c)) -* update open api and implement external storage endpoints ([#15](https://github.com/GetStream/stream-node/issues/15)) ([fcd75e0](https://github.com/GetStream/stream-node/commit/fcd75e06d7a1c55021dc2ee47e12415e5b18a1b5)) +- add verifyWebhook method ([#12](https://github.com/GetStream/stream-node/issues/12)) ([e79f53c](https://github.com/GetStream/stream-node/commit/e79f53cdbed202428a99b5a0cf7df6baf200333c)) +- update open api and implement external storage endpoints ([#15](https://github.com/GetStream/stream-node/issues/15)) ([fcd75e0](https://github.com/GetStream/stream-node/commit/fcd75e06d7a1c55021dc2ee47e12415e5b18a1b5)) ## [0.1.9](https://github.com/GetStream/stream-node/compare/v0.1.8...v0.1.9) (2023-12-01) - ### Features -* update open api ([#10](https://github.com/GetStream/stream-node/issues/10)) ([05fbbf6](https://github.com/GetStream/stream-node/commit/05fbbf667039079b97f04ffef850bf624256fb09)) +- update open api ([#10](https://github.com/GetStream/stream-node/issues/10)) ([05fbbf6](https://github.com/GetStream/stream-node/commit/05fbbf667039079b97f04ffef850bf624256fb09)) ## [0.1.8](https://github.com/GetStream/stream-node/compare/v0.1.7...v0.1.8) (2023-12-01) - ### Features -* Update open api ([4c461e7](https://github.com/GetStream/stream-node/commit/4c461e7e0d46a5c3c214d31934ac4ebc8b2a4ede)) +- Update open api ([4c461e7](https://github.com/GetStream/stream-node/commit/4c461e7e0d46a5c3c214d31934ac4ebc8b2a4ede)) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d6ed500..68a4679 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -41,15 +41,6 @@ $ yarn generate:open-api $ yarn generate:open-api:dev ``` -If you want to update only chat or video you need to define the `PRODUCT` env variable like this: - -```shell -$ PRODUCT=video yarn generate:open-api -$ PRODUCT=chat yarn generate:open-api:dev -``` - -The current chat open API contains some issues, to fix some of them apply the following commit manually after updating the chat open API: [87f8672f9c302138d2c19f07b9b5236e3ba98714](https://github.com/GetStream/stream-node/pull/42/commits/87f8672f9c302138d2c19f07b9b5236e3ba98714) - ## Release (for Stream developers) Releasing this package involves two GitHub Action steps: diff --git a/__tests__/block-lists.test.ts b/__tests__/block-lists.test.ts index 568f1a7..103d96f 100644 --- a/__tests__/block-lists.test.ts +++ b/__tests__/block-lists.test.ts @@ -2,10 +2,7 @@ import { beforeAll, describe, expect, it } from 'vitest'; import { v4 as uuidv4 } from 'uuid'; import { createTestClient } from './create-test-client'; import { StreamClient } from '../src/StreamClient'; -import { - CreateBlockListRequest, - CreateBlockListRequestTypeEnum, -} from '../src/gen/chat'; +import { CreateBlockListRequest } from '../src/gen/models'; describe('block lists CRUD API', () => { let client: StreamClient; @@ -16,38 +13,38 @@ describe('block lists CRUD API', () => { blockList = { name: 'streamnodetest-F1' + uuidv4(), words: ['Ricciardo should retire'], - type: CreateBlockListRequestTypeEnum.WORD, }; }); it('create', async () => { - const response = await client.chat.createBlockList(blockList); + const response = await client.createBlockList({ + ...blockList, + }); expect(response).toBeDefined(); }); it('list', async () => { - const listResponse = await client.chat.listBlockLists(); + const listResponse = await client.listBlockLists(); expect( listResponse.blocklists.find((b) => b.name === blockList.name), ).toBeDefined(); - const getResponse = await client.chat.getBlockList({ - name: blockList.name, - }); + const getResponse = await client.getBlockList({ name: blockList.name }); expect(getResponse.blocklist?.name).toBe(blockList.name); }); it('update', async () => { - const response = await client.chat.updateBlockList(blockList.name, { + const response = await client.updateBlockList({ + name: blockList.name, words: [...blockList.words, 'R1cciardo should retire'], }); expect(response).toBeDefined(); - const updatedBlockList = await client.chat.getBlockList({ + const updatedBlockList = await client.getBlockList({ name: blockList.name, }); @@ -55,9 +52,7 @@ describe('block lists CRUD API', () => { }); it('delete', async () => { - const response = await client.chat.deleteBlockList({ - name: blockList.name, - }); + const response = await client.deleteBlockList({ name: blockList.name }); expect(response).toBeDefined(); }); }); diff --git a/__tests__/call-members.test.ts b/__tests__/call-members.test.ts index 9106acb..fd323c3 100644 --- a/__tests__/call-members.test.ts +++ b/__tests__/call-members.test.ts @@ -3,7 +3,7 @@ import { v4 as uuidv4 } from 'uuid'; import { createTestClient } from './create-test-client'; import { StreamCall } from '../src/StreamCall'; import { StreamClient } from '../src/StreamClient'; -import { VideoOwnCapability } from '../src/gen/video'; +import { OwnCapability } from '../src/gen/models'; describe('call members API', () => { let client: StreamClient; @@ -15,14 +15,12 @@ describe('call members API', () => { call = client.video.call('default', callId); - await client.upsertUsers({ - users: { - john: { name: 'John', id: 'john' }, - jack: { name: 'Jack', id: 'jack' }, - jane: { name: 'Jane', id: 'jane' }, - sara: { name: 'Sara', id: 'sara' }, - }, - }); + await client.upsertUsers([ + { name: 'John', id: 'john' }, + { name: 'Jack', id: 'jack' }, + { name: 'Jane', id: 'jane' }, + { name: 'Sara', id: 'sara' }, + ]); }); it('create with members', async () => { @@ -98,14 +96,14 @@ describe('call members API', () => { it('grant and revoke permissions', async () => { const revokeResponse = await call.updateUserPermissions({ user_id: 'sara', - revoke_permissions: [VideoOwnCapability.SEND_AUDIO], + revoke_permissions: [OwnCapability.SEND_AUDIO], }); expect(revokeResponse).toBeDefined(); const grantResponse = await call.updateUserPermissions({ user_id: 'sara', - grant_permissions: [VideoOwnCapability.SEND_AUDIO], + grant_permissions: [OwnCapability.SEND_AUDIO], }); expect(grantResponse).toBeDefined(); @@ -126,6 +124,7 @@ describe('call members API', () => { expect(members.length).toBe(3); const queryMembersReq = { + filter_conditions: {}, sort: [{ field: 'user_id', direction: 1 }], limit: 2, }; diff --git a/__tests__/call-types.test.ts b/__tests__/call-types.test.ts index 27a3bae..333cad1 100644 --- a/__tests__/call-types.test.ts +++ b/__tests__/call-types.test.ts @@ -2,12 +2,7 @@ import { beforeAll, describe, expect, it } from 'vitest'; import { v4 as uuidv4 } from 'uuid'; import { createTestClient } from './create-test-client'; import { StreamClient } from '../src/StreamClient'; -import { - VideoLayoutSettingsRequestNameEnum, - VideoOwnCapability, - VideoRecordSettingsRequestModeEnum, - VideoRecordSettingsRequestQualityEnum, -} from '../src/gen/video'; +import { OwnCapability } from '../src/gen/models'; describe('call types CRUD API', () => { let client: StreamClient; @@ -44,9 +39,9 @@ describe('call types CRUD API', () => { }, grants: { admin: [ - VideoOwnCapability.SEND_AUDIO, - VideoOwnCapability.SEND_VIDEO, - VideoOwnCapability.MUTE_USERS, + OwnCapability.SEND_AUDIO, + OwnCapability.SEND_VIDEO, + OwnCapability.MUTE_USERS, ], }, }); @@ -86,45 +81,43 @@ describe('call types CRUD API', () => { callTypeName ]; const userGrants = callType.grants.user.filter( - (c) => c !== VideoOwnCapability.JOIN_CALL, + (c) => c !== OwnCapability.JOIN_CALL, ); const callMemberGrants = callType.grants.call_member; - if (!callMemberGrants.includes(VideoOwnCapability.JOIN_CALL)) { - callMemberGrants.push(VideoOwnCapability.JOIN_CALL); + if (!callMemberGrants.includes(OwnCapability.JOIN_CALL)) { + callMemberGrants.push(OwnCapability.JOIN_CALL); } - await client.video.updateCallType(callTypeName, { + await client.video.updateCallType({ + name: callTypeName, grants: { user: userGrants, call_member: callMemberGrants }, }); callType = (await client.video.listCallTypes()).call_types[callTypeName]; - expect(callType.grants.user.includes(VideoOwnCapability.JOIN_CALL)).toBe( - false, + expect(callType.grants.user.includes(OwnCapability.JOIN_CALL)).toBe(false); + expect(callType.grants.call_member.includes(OwnCapability.JOIN_CALL)).toBe( + true, ); - expect( - callType.grants.call_member.includes(VideoOwnCapability.JOIN_CALL), - ).toBe(true); }); it('update', async () => { - const updateResponse = await client.video.updateCallType(callTypeName, { + const updateResponse = await client.video.updateCallType({ + name: callTypeName, settings: { audio: { mic_default_on: false, default_device: 'earpiece' }, recording: { - mode: VideoRecordSettingsRequestModeEnum.DISABLED, + mode: 'disabled', // FIXME OL: these props shouldn't be required to be set when recording is disabled audio_only: false, - quality: VideoRecordSettingsRequestQualityEnum._1080P, + quality: '1080p', }, }, }); expect(updateResponse.settings.audio.mic_default_on).toBeFalsy(); expect(updateResponse.settings.audio.default_device).toBe('earpiece'); - expect(updateResponse.settings.recording.mode).toBe( - VideoRecordSettingsRequestModeEnum.DISABLED, - ); + expect(updateResponse.settings.recording.mode).toBe('disabled'); }); it('update layout options', async () => { @@ -144,23 +137,22 @@ describe('call types CRUD API', () => { 'participant_label.background_color': 'transparent', }; - const response = await client.video.updateCallType(callTypeName, { + const response = await client.video.updateCallType({ + name: callTypeName, settings: { recording: { - mode: VideoRecordSettingsRequestModeEnum.AVAILABLE, + mode: 'available', audio_only: false, - quality: VideoRecordSettingsRequestQualityEnum._1080P, + quality: '1080p', layout: { - name: VideoLayoutSettingsRequestNameEnum.SPOTLIGHT, + name: 'spotlight', options: layoutOptions, }, }, }, }); - expect(response.settings.recording.layout.name).toBe( - VideoLayoutSettingsRequestNameEnum.SPOTLIGHT, - ); + expect(response.settings.recording.layout.name).toBe('spotlight'); Object.keys(layoutOptions).forEach((key) => { expect(response.settings.recording.layout.options![key]).toEqual( (layoutOptions as any)[key], diff --git a/__tests__/call.test.ts b/__tests__/call.test.ts index 51c442a..c2cdd9a 100644 --- a/__tests__/call.test.ts +++ b/__tests__/call.test.ts @@ -3,11 +3,6 @@ import { v4 as uuidv4 } from 'uuid'; import { createTestClient } from './create-test-client'; import { StreamCall } from '../src/StreamCall'; import { StreamClient } from '../src/StreamClient'; -import { - VideoDeleteCallResponse, - VideoRecordSettingsRequestModeEnum, - VideoRecordSettingsRequestQualityEnum, -} from '../src/gen/video'; describe('call API', () => { let client: StreamClient; @@ -19,11 +14,7 @@ describe('call API', () => { call = client.video.call('default', callId); - await client.upsertUsers({ - users: { - john: { name: 'John', id: 'john' }, - }, - }); + await client.upsertUsers([{ name: 'John', id: 'john' }]); }); it('create', async () => { @@ -51,7 +42,7 @@ describe('call API', () => { }); it('send custom event', async () => { - const response = await call.sendCustomEvent({ + const response = await call.sendCallEvent({ custom: { 'render-animation': 'balloons', }, @@ -79,13 +70,11 @@ describe('call API', () => { // userId of existing user const userId = 'jane'; - await client.upsertUsers({ - users: { - [userId]: { - id: userId, - }, + await client.upsertUsers([ + { + id: userId, }, - }); + ]); const token = client.createToken(userId); const rtmpURL = resp.call.ingress.rtmp.address; const streamKey = token; @@ -146,12 +135,12 @@ describe('call API', () => { }); it('query call stats', async () => { - const response = await client.video.queryCallStatistics(); + const response = await client.video.queryCallStats(); expect(response.reports.length).toBeGreaterThan(0); await expect(() => - call.getSessionStatistics({ + call.getCallStats({ session: '', }), ).rejects.toThrowError( @@ -159,73 +148,60 @@ describe('call API', () => { ); }); - it('enable call recording', async () => { - let response = await call.update({ - settings_override: { - recording: { - mode: VideoRecordSettingsRequestModeEnum.DISABLED, - audio_only: true, - }, - }, + it('query call stats - single call', async () => { + const response = await client.video.queryCallStats({ + filter_conditions: { call_cid: call.cid }, }); - let settings = response.call.settings.recording; - expect(settings.mode).toBe(VideoRecordSettingsRequestModeEnum.DISABLED); + expect(response.reports).toBeDefined(); + }); - response = await call.update({ - settings_override: { - recording: { - mode: VideoRecordSettingsRequestModeEnum.AVAILABLE, + describe('recording', () => { + it('enable call recording', async () => { + let response = await call.update({ + settings_override: { + recording: { + mode: 'disabled', + audio_only: true, + }, }, - }, - }); + }); + let settings = response.call.settings.recording; - settings = response.call.settings.recording; - expect(settings.mode).toBe(VideoRecordSettingsRequestModeEnum.AVAILABLE); + expect(settings.mode).toBe('disabled'); - response = await call.update({ - settings_override: { - recording: { - audio_only: false, - quality: VideoRecordSettingsRequestQualityEnum._1080P, - mode: VideoRecordSettingsRequestModeEnum.AUTO_ON, + response = await call.update({ + settings_override: { + recording: { + mode: 'available', + }, }, - }, - }); - - settings = response.call.settings.recording; - expect(settings.audio_only).toBe(false); - expect(settings.quality).toBe(VideoRecordSettingsRequestQualityEnum._1080P); - }); + }); - it('start recording', async () => { - // somewhat dummy test, we should do a proper test in the future where we join a call and start recording - await expect(() => call.startRecording()).rejects.toThrowError( - 'Stream error code 4: StartRecording failed with error: "there is no active session"', - ); - }); + settings = response.call.settings.recording; + expect(settings.mode).toBe('available'); - it('stop recording', async () => { - // somewhat dummy test, we should do a proper test in the future - await expect(() => call.stopRecording()).rejects.toThrowError( - 'Stream error code 4: StopRecording failed with error: "call is not being recorded"', - ); - }); - - it('delete recording', async () => { - // somewhat dummy test, we should do a proper test in the future - await expect(() => - call.deleteRecording({ session: 'test', filename: 'test' }), - ).rejects.toThrowError( - `Stream error code 16: DeleteRecording failed with error: "recording doesn't exist"`, - ); - }); + response = await call.update({ + settings_override: { + recording: { + audio_only: false, + quality: '1080p', + mode: 'auto-on', + }, + }, + }); - it('query recordings', async () => { - // somewhat dummy test, we should do a proper test in the future - const response = await call.listRecordings(); + settings = response.call.settings.recording; + expect(settings.audio_only).toBe(false); + expect(settings.quality).toBe('1080p'); + }); - expect(response.recordings).toBeDefined(); + it('start recording', async () => { + // somewhat dummy test, we should do a proper test in the future where we join a call and start recording + await expect(() => call.startRecording()).rejects.toThrowError( + 'Stream error code 4: StartRecording failed with error: "there is no active session"', + ); + }); }); it('enable backstage mode', async () => { @@ -252,33 +228,34 @@ describe('call API', () => { expect(response.call.backstage).toBe(true); }); - it('start transcribing', async () => { - // somewhat dummy test, we should do a proper test in the future where we join a call and start recording - await expect(() => call.startTranscription()).rejects.toThrowError( - 'Stream error code 4: StartTranscription failed with error: "there is no active session"', - ); - }); + describe('transcriptions', () => { + it('start transcribing', async () => { + // somewhat dummy test, we should do a proper test in the future where we join a call and start recording + await expect(() => call.startTranscription()).rejects.toThrowError( + 'Stream error code 4: StartTranscription failed with error: "there is no active session"', + ); + }); - it('stop transcribing', async () => { - // somewhat dummy test, we should do a proper test in the future - await expect(() => call.stopTranscription()).rejects.toThrowError( - 'Stream error code 4: StopTranscription failed with error: "call is not being transcribed"', - ); - }); + it('stop transcribing', async () => { + // somewhat dummy test, we should do a proper test in the future + await expect(() => call.stopTranscription()).rejects.toThrowError( + 'Stream error code 4: StopTranscription failed with error: "call is not being transcribed"', + ); + }); - it('delete transcription', async () => { - // somewhat dummy test, we should do a proper test in the future - await expect(() => - call.deleteTranscription({ session: 'test', filename: 'test' }), - ).rejects.toThrowError( - `Stream error code 16: DeleteTranscription failed with error: "transcription doesn't exist"`, - ); + it('delete transcription', async () => { + // somewhat dummy test, we should do a proper test in the future + await expect(() => + call.deleteTranscription({ session: 'test', filename: 'test' }), + ).rejects.toThrowError( + `Stream error code 16: DeleteTranscription failed with error: "transcription doesn't exist"`, + ); + }); }); it('delete call', async () => { - let response: VideoDeleteCallResponse; try { - response = await call.delete({ hard: true }); + await call.delete({ hard: true }); } catch (e) { // the first request fails on backend sometimes // retry it @@ -286,9 +263,7 @@ describe('call API', () => { setTimeout(() => resolve(), 2000); }); - response = await call.delete({ hard: true }); + await call.delete({ hard: true }); } - - expect(response.duration).toBeDefined(); }); }); diff --git a/__tests__/channel-types.test.ts b/__tests__/channel-types.test.ts index d54baaf..b12caa6 100644 --- a/__tests__/channel-types.test.ts +++ b/__tests__/channel-types.test.ts @@ -1,7 +1,6 @@ import { beforeAll, describe, expect, it } from 'vitest'; import { v4 as uuidv4 } from 'uuid'; import { createTestClient } from './create-test-client'; -import { CreateChannelTypeRequestAutomodEnum } from '../src/gen/chat/models'; import { StreamClient } from '../src/StreamClient'; describe('channel types CRUD API', () => { @@ -15,9 +14,9 @@ describe('channel types CRUD API', () => { it('create', async () => { const response = await client.chat.createChannelType({ name: channelType, - automod: CreateChannelTypeRequestAutomodEnum.DISABLED, + automod: 'disabled', automod_behavior: 'block', - max_message_length: 1200, + max_message_length: 30000, }); expect(response.name).toBe(channelType); @@ -30,20 +29,18 @@ describe('channel types CRUD API', () => { }); it('update', async () => { - const response = await client.chat.updateChannelType(channelType, { - automod: CreateChannelTypeRequestAutomodEnum.SIMPLE, + const response = await client.chat.updateChannelType({ + name: channelType, + automod: 'simple', automod_behavior: 'block', - max_message_length: 1200, + max_message_length: 20000, }); - expect(response.automod).toBe(CreateChannelTypeRequestAutomodEnum.SIMPLE); + expect(response.automod).toBe('simple'); const getResponse = await client.chat.getChannelType({ name: channelType }); - // Property 'automod' does not exist on type 'Response'. - expect(getResponse.automod).toBe( - CreateChannelTypeRequestAutomodEnum.SIMPLE, - ); + expect(getResponse.automod).toBe('simple'); }); it('delete', async () => { diff --git a/__tests__/channel.test.ts b/__tests__/channel.test.ts index ee8ea31..4d9c705 100644 --- a/__tests__/channel.test.ts +++ b/__tests__/channel.test.ts @@ -22,25 +22,19 @@ describe('channel API', () => { beforeAll(async () => { client = createTestClient(); - await client.upsertUsers({ - users: { - [user.id]: { ...user }, - [user2.id]: { ...user2 }, - }, - }); + await client.upsertUsers([user, user2]); channel = client.chat.channel('messaging', channelId); }); it('create', async () => { const response = await channel.getOrCreate({ - // Type error: Object literal may only specify known properties, and 'name' does not exist in type 'ChannelInput'. - data: { created_by_id: user.id, name: channelId }, + data: { created_by_id: user.id, custom: { name: channelId } }, }); expect(response.channel?.cid).toBe(`${channel.type}:${channel.id}`); // Type error: Property 'name' does not exist on type 'ChannelResponse' - expect(response.channel?.name).toBe(channelId); + expect(response.channel?.custom?.name).toBe(channelId); }); it('create - without id', async () => { @@ -48,8 +42,6 @@ describe('channel API', () => { const response = await channelWithoutId.getOrCreate({ data: { created_by_id: user.id, - // Type error: Type '{ user_id: string; }' is missing the following properties from type 'ChannelMember': - // banned, channel_role, created_at, notifications_muted, and 2 more. members: [{ user_id: user.id }, { user_id: user2.id }], }, }); @@ -71,7 +63,7 @@ describe('channel API', () => { }); it('update partial', async () => { - const response = await channel.updatePartial({ + const response = await channel.updateChannelPartial({ set: { cooldown: 100 }, unset: [], }); @@ -92,13 +84,15 @@ describe('channel API', () => { const channelFromResponse = filteredResponse.channels[0]; - expect(channelFromResponse.channel?.name).toBe(channelId); + expect(channelFromResponse.channel?.custom?.name).toBe(channelId); }); it('query members', async () => { const response = await channel.queryMembers({ - filter_conditions: { - name: { $autocomplete: '2' }, + payload: { + filter_conditions: { + name: { $autocomplete: '2' }, + }, }, }); @@ -126,11 +120,17 @@ describe('channel API', () => { }); it('mute and unmute', async () => { - const muteResponse = await channel.mute({ user_id: user2.id }); + const muteResponse = await client.chat.muteChannel({ + user_id: user2.id, + channel_cids: [channel.cid], + }); expect(muteResponse.channel_mute?.channel?.id).toBe(channel.id); - await channel.unmute({ user_id: user2.id }); + await client.chat.unmuteChannel({ + user_id: user2.id, + channel_cids: [channel.cid], + }); const queryResponse = await client.chat.queryChannels({ filter_conditions: { muted: true }, @@ -147,7 +147,7 @@ describe('channel API', () => { const response = await client.chat.exportChannels({ channels: [{ cid: channel.cid }], }); - const statusResponse = await client.chat.getExportStatus({ + const statusResponse = await client.chat.getExportChannelsStatus({ id: response.task_id, }); @@ -155,9 +155,11 @@ describe('channel API', () => { }); it('custom event', async () => { - const response = await channel.sendCustomEvent({ - type: 'my-event', - user_id: user.id, + const response = await channel.sendEvent({ + event: { + type: 'my-event', + user_id: user.id, + }, }); expect(response.event?.type).toBe('my-event'); diff --git a/__tests__/command.test.ts b/__tests__/command.test.ts index 370c3cf..e10cca2 100644 --- a/__tests__/command.test.ts +++ b/__tests__/command.test.ts @@ -29,7 +29,8 @@ describe('commands CRUD API', () => { }); it('update', async () => { - const response = await client.chat.updateCommand(commandName, { + const response = await client.chat.updateCommand({ + name: commandName, description: 'Updated descrpition', }); diff --git a/__tests__/date-transform.test.ts b/__tests__/date-transform.test.ts new file mode 100644 index 0000000..4a14b7b --- /dev/null +++ b/__tests__/date-transform.test.ts @@ -0,0 +1,123 @@ +import { beforeAll, describe, expect, it } from 'vitest'; +import { v4 as uuidv4 } from 'uuid'; +import { createTestClient } from './create-test-client'; +import { StreamClient } from '../src/StreamClient'; +import { UserRequest } from '../src/gen/models'; + +describe('Date conversion', () => { + let client: StreamClient; + const user = { + id: 'stream-node-test-user', + role: 'admin', + name: 'Test User for user API compatibily', + custom: { + note: 'compatibilty test', + }, + }; + + beforeAll(async () => { + client = createTestClient(); + await client.upsertUsers([user]); + }); + + it('call + members', async () => { + const id = uuidv4(); + const call = client.video.call('default', id); + const startsAt = new Date(); + const response = await call.create({ + data: { + created_by: user, + starts_at: startsAt, + members: [{ user_id: 'jack' }], + }, + }); + const now = Date.now(); + const oneMin = 60 * 1000; + + const createdAt = response.call.created_at; + + expect(createdAt instanceof Date).toBe(true); + expect(now - createdAt.getTime()).toBeLessThan(oneMin); + + expect(response.call.starts_at instanceof Date).toBe(true); + expect(startsAt.getTime()).toEqual(response.call.starts_at?.getTime()); + + expect(response.call.ended_at).toBeNull(); + + expect(response.members.length).toBeGreaterThan(0); + + response.members.forEach((m) => { + expect(m.created_at instanceof Date).toBe(true); + }); + + const queryResult = await client.video.queryCalls({ + filter_conditions: { + starts_at: { $lte: startsAt.toISOString() }, + }, + }); + + expect(queryResult.calls.find((c) => c.call.id === id)).toBeDefined(); + + await call.delete(); + }); + + it('channel + members', async () => { + const id = uuidv4(); + const channel = client.chat.channel('messaging', id); + const response = await channel.getOrCreate({ + data: { + created_by_id: user.id, + members: [{ user_id: 'jack' }], + }, + }); + const now = Date.now(); + const oneMin = 60 * 1000; + + const createdAt = response.channel!.created_at; + + expect(createdAt instanceof Date).toBe(true); + expect(now - createdAt.getTime()).toBeLessThan(oneMin); + + expect(response.channel!.deleted_at).toBeUndefined(); + + expect(response.members.length).toBeGreaterThan(0); + + response.members.forEach((m) => { + expect(m.created_at instanceof Date).toBe(true); + }); + + const queryResult = await client.chat.queryChannels({ + filter_conditions: { + created_at: { $lte: createdAt.toISOString() }, + }, + limit: 10, + }); + + queryResult.channels.forEach((c) => { + expect(c.channel!.created_at.getTime()).toBeLessThanOrEqual( + createdAt.getTime(), + ); + }); + + await channel.delete(); + }); + + it('users', async () => { + const newUser: UserRequest = { + id: uuidv4(), + custom: { + created_at: new Date(), + }, + }; + + const response = await client.upsertUsers([newUser]); + + expect(response.users[newUser.id].created_at instanceof Date).toBe(true); + + expect( + typeof response.users[newUser.id].custom.created_at === 'string', + ).toBe(true); + + await client.deleteUsers({ user_ids: [newUser.id] }); + }); +}); diff --git a/__tests__/devices-push.test.ts b/__tests__/devices-push.test.ts index 4c57a3b..d564dd6 100644 --- a/__tests__/devices-push.test.ts +++ b/__tests__/devices-push.test.ts @@ -1,12 +1,8 @@ import { beforeAll, describe, expect, it } from 'vitest'; import { v4 as uuidv4 } from 'uuid'; -import { - CreateDeviceRequest, - CreateDeviceRequestPushProviderEnum, - PushProvider, -} from '../src/gen/chat'; import { createTestClient } from './create-test-client'; import { StreamClient } from '../src/StreamClient'; +import { CreateDeviceRequest, PushProvider } from '../src/gen/models'; describe('devices and push', () => { let client: StreamClient; @@ -16,12 +12,10 @@ describe('devices and push', () => { }; const device: CreateDeviceRequest = { id: uuidv4(), - push_provider: CreateDeviceRequestPushProviderEnum.FIREBASE, + push_provider: 'firebase', push_provider_name: 'firebase', user_id: user.id, }; - // Type '{ name: string; type: string; xiaomi_app_secret: string; xiaomi_package_name: string; }' - // is missing the following properties from type 'PushProvider': created_at, updated_at const pushProvider: PushProvider = { name: 'test-push-provider', type: 'xiaomi', @@ -31,11 +25,7 @@ describe('devices and push', () => { beforeAll(async () => { client = createTestClient(); - await client.upsertUsers({ - users: { - [user.id]: { ...user }, - }, - }); + await client.upsertUsers([user]); }); it('create device', async () => { @@ -43,7 +33,7 @@ describe('devices and push', () => { }); it('list devices', async () => { - const response = await client.listDevices({ userId: user.id }); + const response = await client.listDevices({ user_id: user.id }); expect(response.devices.find((d) => d.id === device.id)).toBeDefined(); }); @@ -51,7 +41,7 @@ describe('devices and push', () => { it('delete device', async () => { const response = await client.deleteDevice({ id: device.id, - userId: user.id, + user_id: user.id, }); expect(response).toBeDefined(); @@ -60,7 +50,7 @@ describe('devices and push', () => { it('create push provider', async () => { // Can't properly test upsert without valid credentials await expect(() => - client.upsertPushProvider(pushProvider), + client.upsertPushProvider({ push_provider: pushProvider }), ).rejects.toThrowError( 'Stream error code 4: UpsertPushProvider failed with error: "xiaomi credentials are invalid"', ); diff --git a/__tests__/external-recording-storage.test.ts b/__tests__/external-storage.test.ts similarity index 75% rename from __tests__/external-recording-storage.test.ts rename to __tests__/external-storage.test.ts index 0551180..d2c4750 100644 --- a/__tests__/external-recording-storage.test.ts +++ b/__tests__/external-storage.test.ts @@ -12,17 +12,17 @@ describe('external storage CRUD API', () => { }); it('create', async () => { - const response = await client.video.createExternalStorage({ + const response = await client.createExternalStorage({ name: storageName, bucket: 'test', - storage_type: 'abs', + storage_type: 's3', }); expect(response).toBeDefined(); }); it('read', async () => { - const readResponse = await client.video.listExternalStorages(); + const readResponse = await client.listExternalStorage(); expect(readResponse.external_storages).toBeDefined(); expect(readResponse.external_storages[storageName]).toBeDefined(); @@ -30,7 +30,8 @@ describe('external storage CRUD API', () => { it('update', async () => { const newBucket = 'new bucket'; - const response = await client.video.updateExternalStorage(storageName, { + const response = await client.updateExternalStorage({ + name: storageName, bucket: newBucket, storage_type: 'abs', }); @@ -39,9 +40,7 @@ describe('external storage CRUD API', () => { }); it('delete', async () => { - const response = await client.video.deleteExternalStorage({ - name: storageName, - }); + const response = await client.deleteExternalStorage({ name: storageName }); expect(response).toBeDefined(); }); diff --git a/__tests__/messages.test.ts b/__tests__/messages.test.ts index 4314acf..d40dae0 100644 --- a/__tests__/messages.test.ts +++ b/__tests__/messages.test.ts @@ -3,7 +3,6 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { createTestClient } from './create-test-client'; import { StreamChannel } from '../src/StreamChannel'; import { StreamClient } from '../src/StreamClient'; -import { TranslateMessageRequestLanguageEnum } from '../src/gen/chat'; import { v4 as uuidv4 } from 'uuid'; describe('messages API', () => { @@ -25,12 +24,7 @@ describe('messages API', () => { beforeAll(async () => { client = createTestClient(); - await client.upsertUsers({ - users: { - [user.id]: { ...user }, - [user2.id]: { ...user2 }, - }, - }); + await client.upsertUsers([user, user2]); channel = client.chat.channel('messaging', channelId); await channel.getOrCreate({ @@ -53,22 +47,23 @@ describe('messages API', () => { expect(response.message?.text).toBe('Hello from Stream Node SDK'); - messageId = response.message?.id; + messageId = response.message.id; - const getResponse = await channel.getManyMessages({ ids: [messageId] }); + const getResponse = await channel.getManyMessages({ + ids: [messageId, messageId], + }); expect(getResponse.messages.length).toBe(1); }); it('update message', async () => { - const urlAttachment = await channel.getOpenGraphData({ - url: 'https://getstream.io/', - }); - const response = await channel.updateMessage(messageId!, { + const urlAttachment = await client.getOG({ url: 'https://getstream.io/' }); + + const response = await client.chat.updateMessage({ + id: messageId!, message: { text: 'https://getstream.io/', - // Property 'custom' is missing in type '{ image_url: string; }' but required in type 'Attachment' - attachments: [urlAttachment], + attachments: [{ title_link: urlAttachment.title_link }], user_id: user.id, }, }); @@ -80,7 +75,8 @@ describe('messages API', () => { }); it('update partial', async () => { - const response = await channel.updateMessagePartial(messageId!, { + const response = await client.chat.updateMessagePartial({ + id: messageId!, set: { text: 'check this out: https://getstream.io/', }, @@ -97,11 +93,12 @@ describe('messages API', () => { }); it('translate', async () => { - const response = await channel.translateMessage(messageId!, { - language: TranslateMessageRequestLanguageEnum.HU, + const response = await client.chat.translateMessage({ + id: messageId!, + language: 'hu', }); - // Property 'message' does not exist on type 'MessageResponse'. + // @ts-expect-error expect(response.message?.i18n?.hu_text).toBeDefined(); }); @@ -119,7 +116,8 @@ describe('messages API', () => { }); it('send reaction', async () => { - const response = await channel.sendMessageReaction(messageId!, { + const response = await client.chat.sendReaction({ + id: messageId!, reaction: { type: 'like', user_id: user.id }, }); @@ -129,15 +127,16 @@ describe('messages API', () => { }); it('get reactions', async () => { - const response = await channel.getMessageReactions(messageId!); + const response = await client.chat.getReactions({ id: messageId! }); expect(response.reactions.length).toBe(1); }); it('delete reaction', async () => { - const response = await channel.deleteMessageReaction(messageId!, { + const response = await client.chat.deleteReaction({ + id: messageId!, type: 'like', - userId: user.id, + user_id: user.id, }); expect(response.message?.id).toBe(messageId); @@ -145,21 +144,25 @@ describe('messages API', () => { }); it('search', async () => { - const response = await client.chat.searchMessages({ - filter_conditions: { members: { $in: [user2.id] } }, - message_filter_conditions: { text: { $autocomplete: 'check' } }, + const response = await client.chat.search({ + payload: { + filter_conditions: { members: { $in: [user2.id] } }, + message_filter_conditions: { text: { $autocomplete: 'check' } }, + }, }); expect(response.results).toBeDefined(); }); it('flag', async () => { - const response = await client.flag({ - target_message_id: messageId!, + const response = await client.moderation.flag({ + entity_type: 'stream:chat:v1:message', + entity_id: messageId!, user_id: user.id, + reason: 'hate', }); - expect(response.flag?.target_message_id).toBe(messageId!); + expect(response.item_id).toBeDefined(); }); it('truncate', async () => { @@ -171,7 +174,7 @@ describe('messages API', () => { }); it('delete message', async () => { - const response = await channel.deleteMessage({ + const response = await client.chat.deleteMessage({ id: messageId!, hard: true, }); @@ -179,13 +182,13 @@ describe('messages API', () => { expect(response.message?.id).toBe(messageId); await expect(() => - channel.getMessage({ id: messageId! }), + client.chat.getMessage({ id: messageId! }), ).rejects.toThrowError( `Stream error code 4: GetMessage failed with error: "Message with id ${messageId} doesn't exist"`, ); }); afterAll(async () => { - await channel.delete({ hardDelete: true }); + await channel.delete({ hard_delete: true }); }); }); diff --git a/__tests__/permissions-app-settings.test.ts b/__tests__/permissions-app-settings.test.ts index 8318b40..5350b5e 100644 --- a/__tests__/permissions-app-settings.test.ts +++ b/__tests__/permissions-app-settings.test.ts @@ -2,8 +2,7 @@ import { beforeAll, describe, expect, it } from 'vitest'; import { v4 as uuidv4 } from 'uuid'; import { createTestClient } from './create-test-client'; import { StreamClient } from '../src/StreamClient'; -import { CreateRoleRequest } from '../src/gen/chat'; -import { VideoOwnCapability } from '../src/gen/video'; +import { CreateRoleRequest, OwnCapability } from '../src/gen/models'; describe('permissions and app settings API', () => { let client: StreamClient; @@ -41,24 +40,23 @@ describe('permissions and app settings API', () => { }); it('update role', async () => { - const response = await client.updateAppSettings({ + const response = await client.updateApp({ grants: { - [role.name]: [VideoOwnCapability.CREATE_CALL], + [role.name]: [OwnCapability.CREATE_CALL], }, }); expect(response).toBeDefined(); - // temporary disable due to rate limit issues - // const appSettings = await client.getAppSettings(); + const appSettings = await client.getApp(); - // expect( - // appSettings.app.grants[role.name].includes(VideoOwnCapability.CREATE_CALL) - // ).toBe(true); + expect( + appSettings.app.grants[role.name].includes(OwnCapability.CREATE_CALL), + ).toBe(true); }); it('delete role', async () => { - await client.updateAppSettings({ + await client.updateApp({ grants: { [role.name]: [], }, diff --git a/__tests__/rate-limit.test.ts b/__tests__/rate-limit.test.ts new file mode 100644 index 0000000..6cf36fe --- /dev/null +++ b/__tests__/rate-limit.test.ts @@ -0,0 +1,71 @@ +import { beforeAll, describe, expect, it } from 'vitest'; +import { createTestClient } from './create-test-client'; +import { StreamClient } from '../src/StreamClient'; + +describe('rate limit', () => { + let client: StreamClient; + + beforeAll(async () => { + client = createTestClient(); + }); + + it('should inspect rate limit', async () => { + const response = await client.getRateLimits({ + server_side: true, + }); + + expect(response.server_side).toBeDefined(); + }); + + it('should get rate limit from response header', async () => { + let response = await client.getApp(); + const rateLimit = response.metadata.rateLimit; + const now = Date.now(); + + expect(typeof rateLimit.rateLimit).toBe('number'); + expect(typeof rateLimit.rateLimitRemaining).toBe('number'); + expect(rateLimit.rateLimitReset instanceof Date).toBe(true); + + expect(rateLimit.rateLimit).toBe( + +response.metadata.responseHeaders.get('x-ratelimit-limit')!, + ); + expect(rateLimit.rateLimitRemaining).toBe( + +response.metadata.responseHeaders.get('x-ratelimit-remaining')!, + ); + expect(rateLimit.rateLimitReset!.getTime()).toBe( + new Date( + +response.metadata.responseHeaders.get('x-ratelimit-reset')! * 1000, + ).getTime(), + ); + + // Some basic tests for date parsing + expect(rateLimit.rateLimitReset!.getTime()).toBeGreaterThanOrEqual(now); + expect(rateLimit.rateLimitReset!.getTime()).toBeLessThan( + now + 1000 * 60 * 60 * 24, + ); + + response = await client.getApp(); + const rateLimit2 = response.metadata.rateLimit; + + // It might fail in some rare cases, but since we retry every test 3x, this shouldn't be a problem + expect(rateLimit2.rateLimitRemaining).toBeLessThan( + rateLimit.rateLimitRemaining!, + ); + }); + + it('should include rate limit in errors as well', async () => { + const call = client.video.call('default', 'test'); + try { + await call.startTranscription(); + throw new Error(`Method didn't throw`); + } catch (error) { + expect(error.code).toBeDefined(); + expect(error.metadata).toBeDefined(); + expect(error.metadata.responseCode).toBe(404); + + const rateLimit = error.metadata.rateLimit; + + expect(rateLimit.rateLimit).toBeDefined(); + } + }); +}); diff --git a/__tests__/teams.test.ts b/__tests__/teams.test.ts index 329aaec..010ecf4 100644 --- a/__tests__/teams.test.ts +++ b/__tests__/teams.test.ts @@ -2,13 +2,13 @@ import { beforeAll, describe, expect, it } from 'vitest'; import { v4 as uuidv4 } from 'uuid'; import { createTestClient } from './create-test-client'; import { StreamClient } from '../src/StreamClient'; -import { UserObjectRequest } from '../src/gen/chat'; import { StreamCall } from '../src/StreamCall'; +import { UserRequest } from '../src/gen/models'; describe('teams', () => { let client: StreamClient; const userId = 'streamnodetest' + uuidv4(); - const newUser: UserObjectRequest = { + const newUser: UserRequest = { id: userId, role: 'user', custom: { @@ -27,32 +27,24 @@ describe('teams', () => { beforeAll(async () => { client = createTestClient(); - await client.upsertUsers({ - users: { - [user.id]: { ...user }, - }, - }); - await client.updateAppSettings({ multi_tenant_enabled: true }); + await client.upsertUsers([user]); + await client.updateApp({ multi_tenant_enabled: true }); call = client.video.call('default', callId); }); it('create user with team', async () => { - const response = await client.upsertUsers({ - users: { - [newUser.id]: { - ...newUser, - }, - }, - }); + const response = await client.upsertUsers([newUser]); const createdUser = response.users[newUser.id]; expect(createdUser.teams).toEqual(['red', 'blue']); const queryResponse = await client.queryUsers({ - sort: [], - filter_conditions: { - id: { $eq: newUser.id }, + payload: { + sort: [], + filter_conditions: { + id: { $eq: newUser.id }, + }, }, }); @@ -63,18 +55,22 @@ describe('teams', () => { it('search users with teams', async () => { let response = await client.queryUsers({ - filter_conditions: { - name: userId, - teams: { $in: ['blue', 'green'] }, + payload: { + filter_conditions: { + name: userId, + teams: { $in: ['blue', 'green'] }, + }, }, }); expect(response.users[0].id).toBe(userId); response = await client.queryUsers({ - filter_conditions: { - name: userId, - teams: null, + payload: { + filter_conditions: { + name: userId, + teams: null, + }, }, }); diff --git a/__tests__/user-compat.test.ts b/__tests__/user-compat.test.ts index c255cd6..62e6281 100644 --- a/__tests__/user-compat.test.ts +++ b/__tests__/user-compat.test.ts @@ -14,27 +14,9 @@ describe('user-video compatibility API', () => { }, }; - beforeAll(() => { + beforeAll(async () => { client = createTestClient(); - }); - - it('upsert user', async () => { - const user = { - id: uuidv4(), - role: 'admin', - name: 'Test User for user API compatibily', - custom: { - note: 'compatibilty test', - }, - }; - - const response = await client.upsertUsers({ - users: { - [user.id]: { ...user }, - }, - }); - - expect(response.users[user.id].custom.note).toBe('compatibilty test'); + await client.upsertUsers([user]); }); it('create call', async () => { diff --git a/__tests__/users.test.ts b/__tests__/users.test.ts index 4463761..c344c3f 100644 --- a/__tests__/users.test.ts +++ b/__tests__/users.test.ts @@ -2,7 +2,7 @@ import { beforeAll, describe, expect, it } from 'vitest'; import { v4 as uuidv4 } from 'uuid'; import { createTestClient } from './create-test-client'; import { StreamClient } from '../src/StreamClient'; -import { UserRequest } from '../src/gen/chat'; +import { UserRequest } from '../src/gen/models'; describe('user API', () => { let client: StreamClient; @@ -23,25 +23,25 @@ describe('user API', () => { beforeAll(async () => { client = createTestClient(); - await client.upsertUsers({ - users: { - [user.id]: { ...user }, - }, - }); + await client.upsertUsers([user]); }); it('query users', async () => { let response = await client.queryUsers({ - sort: [{ field: 'name', direction: 1 }], - filter_conditions: {}, + payload: { + sort: [{ field: 'name', direction: 1 }], + filter_conditions: {}, + }, }); expect(response.users).toBeDefined(); response = await client.queryUsers({ - sort: [{ field: 'name', direction: 1 }], - filter_conditions: { - id: { $eq: 'zitaszuperagetstreamio' }, + payload: { + sort: [{ field: 'name', direction: 1 }], + filter_conditions: { + id: { $eq: 'zitaszuperagetstreamio' }, + }, }, }); @@ -49,24 +49,22 @@ describe('user API', () => { }); it('create', async () => { - const response = await client.upsertUsers({ - users: { - [newUser.id]: { - ...newUser, - }, - }, - }); + const response = await client.upsertUsers([newUser]); const createdUser = response.users[newUser.id]; expect(createdUser.id).toBe(newUser.id); expect(createdUser.role).toBe(newUser.role); + expect(createdUser.name).toBe(newUser.name); + expect(createdUser.image).toBe(newUser.image); expect(createdUser.custom.color).toBe('red'); const queryResponse = await client.queryUsers({ - sort: [], - filter_conditions: { - id: { $eq: newUser.id }, + payload: { + sort: [], + filter_conditions: { + id: { $eq: newUser.id }, + }, }, }); @@ -78,10 +76,12 @@ describe('user API', () => { }); it('create guest', async () => { - await client.updateAppSettings({ multi_tenant_enabled: false }); + await client.updateApp({ multi_tenant_enabled: false }); const guest: UserRequest = { id: uuidv4(), + name: 'Guest 3', + image: ': )', custom: { color: 'red', }, @@ -91,31 +91,33 @@ describe('user API', () => { expect(response.user?.role).toBe('guest'); expect(response.user?.custom.color).toBe('red'); + expect(response.user?.name).toBe('Guest 3'); + expect(response.user?.image).toBe(': )'); - await client.updateAppSettings({ multi_tenant_enabled: true }); + await client.updateApp({ multi_tenant_enabled: true }); }); it('ban and unban', async () => { - await client.banUser({ + await client.moderation.ban({ target_user_id: newUser.id, - user_id: user.id, + banned_by_id: user.id, }); let queryResponse = await client.queryBannedUsers({ - filter_conditions: {}, + payload: { filter_conditions: {} }, }); expect( queryResponse.bans.find((b) => b.user?.id === newUser.id), ).toBeDefined(); - await client.unbanUser({ - targetUserId: newUser.id, - id: user.id, + await client.moderation.unban({ + target_user_id: newUser.id, + created_by: user.id, }); queryResponse = await client.queryBannedUsers({ - filter_conditions: {}, + payload: { filter_conditions: {} }, }); expect( @@ -124,14 +126,15 @@ describe('user API', () => { }); it('mute and unmute', async () => { - const muteResponse = await client.muteUser({ + const muteResponse = await client.moderation.mute({ target_ids: [newUser.id], user_id: user.id, + timeout: 5, }); - expect(muteResponse.mute?.target?.id).toBe(newUser.id); + expect(muteResponse.mutes?.[0]?.target?.id).toBe(newUser.id); - const unmuteResponse = await client.unmuteUser({ + const unmuteResponse = await client.moderation.unmute({ target_ids: [newUser.id], user_id: user.id, }); @@ -144,7 +147,7 @@ describe('user API', () => { id: 'bad-alice', name: 'Alice', }; - await client.upsertUsers({ users: { [badUser.id]: badUser } }); + await client.upsertUsers([badUser]); const blockResponse = await client.blockUsers({ blocked_user_id: badUser.id, @@ -153,7 +156,7 @@ describe('user API', () => { expect(blockResponse.blocked_user_id).toBe(badUser.id); - const blockedUsers = await client.getBlockedUsers({ userId: user.id }); + const blockedUsers = await client.getBlockedUsers({ user_id: user.id }); expect( blockedUsers.blocks.find((b) => b.blocked_user_id === badUser.id), @@ -168,8 +171,9 @@ describe('user API', () => { }); it('send custom event', async () => { - const response = await client.sendCustomEventToUser(newUser.id, { - type: 'my-custom-event', + const response = await client.chat.sendUserCustomEvent({ + user_id: newUser.id, + event: { type: 'my-custom-event' }, }); expect(response).toBeDefined(); @@ -195,7 +199,8 @@ describe('user API', () => { expect(userResponse.name).toBeFalsy(); expect(userResponse.role).toBe('admin'); - expect(userResponse.custom.color).toBe('blue'); + // TODO: backend issue + // expect(userResponse.custom.color).toBe('blue'); }); it('deactivate and reactivate', async () => { @@ -211,9 +216,7 @@ describe('user API', () => { expect(reactivateResponse.task_id).toBeDefined(); - const response = await client.getTaskStatus({ - id: reactivateResponse.task_id, - }); + const response = await client.getTask({ id: reactivateResponse.task_id }); expect(response.status).toBeDefined(); }); diff --git a/__tests__/webhook.test.ts b/__tests__/webhook.test.ts index aebe455..393e5ce 100644 --- a/__tests__/webhook.test.ts +++ b/__tests__/webhook.test.ts @@ -1,5 +1,5 @@ import { beforeAll, describe, expect, it } from 'vitest'; -import { StreamClient } from '../'; +import { StreamClient } from '../src/StreamClient'; import { createTestClient } from './create-test-client'; describe('webhooks', () => { diff --git a/generate-openapi.sh b/generate-openapi.sh index 5ed1366..e790a11 100755 --- a/generate-openapi.sh +++ b/generate-openapi.sh @@ -1,101 +1,11 @@ #!/bin/bash set -euo pipefail -FROM_REPO=$1; -DEFAULT_PRODUCT="all"; -PRODUCT="${2:-$DEFAULT_PRODUCT}"; +OUTPUT_DIR="../stream-node/src/gen" +CHAT_DIR="../chat" -echo $PRODUCT; +rm -rf $OUTPUT_DIR -if [ "$PRODUCT" != 'chat' ] && [ "$PRODUCT" != 'video' ] && [ "$PRODUCT" != 'all' ]; then - echo "Invalid product option $PRODUCT" - exit 1 -fi +( cd $CHAT_DIR ; make openapi ; go run ./cmd/chat-manager openapi generate-client --language ts --spec ./releases/v2/serverside-api.yaml --output $OUTPUT_DIR ) -TEMP_OUTPUT_DIR="./openapi-temp" - -if [ "$PRODUCT" == 'video' ] || [ "$PRODUCT" == 'all' ] ; then - if [ "$FROM_REPO" == 'chat' ]; then - PROTOCOL_REPO_DIR="../chat" - else - PROTOCOL_REPO_DIR="../protocol" - fi - if [ "$FROM_REPO" == 'chat' ]; then - SCHEMA_FILE="$PROTOCOL_REPO_DIR/releases/v2/video-openapi.yaml" - else - SCHEMA_FILE="$PROTOCOL_REPO_DIR/openapi/video-openapi.yaml" - fi - - if [ "$FROM_REPO" == 'chat' ]; then - # Generate the Coordinator OpenAPI schema - make -C $PROTOCOL_REPO_DIR openapi - fi - - OUTPUT_DIR="./src/gen/video" - - # Clean previous output - rm -rf $TEMP_OUTPUT_DIR - rm -rf $OUTPUT_DIR - - mkdir $OUTPUT_DIR - - # NOTE: https://openapi-generator.tech/docs/generators/typescript-fetch/ - # Generate the Coordinator API models - yarn openapi-generator-cli generate \ - -i "$SCHEMA_FILE" \ - -g typescript-fetch \ - -o "$TEMP_OUTPUT_DIR" \ - --additional-properties=supportsES6=true \ - --additional-properties=modelPropertyNaming=original \ - --additional-properties=enumPropertyNaming=UPPERCASE \ - --additional-properties=withoutRuntimeChecks=true \ - --model-name-prefix=Video - - # Remove the generated API client, just keep the models - cp -r $TEMP_OUTPUT_DIR/ $OUTPUT_DIR - rm -rf $TEMP_OUTPUT_DIR -fi - - -if [ "$PRODUCT" == 'chat' ] || [ "$PRODUCT" == 'all' ]; then - if [ "$FROM_REPO" == 'chat' ]; then - PROTOCOL_REPO_DIR="../chat" - else - PROTOCOL_REPO_DIR="../protocol" - fi - if [ "$FROM_REPO" == 'chat' ]; then - SCHEMA_FILE="$PROTOCOL_REPO_DIR/releases/v2/chat-serverside-api.yaml" - else - SCHEMA_FILE="$PROTOCOL_REPO_DIR/openapi/chat-openapi.yaml" - fi - - if [ "$FROM_REPO" == 'chat' ]; then - # Generate the Coordinator OpenAPI schema - make -C $PROTOCOL_REPO_DIR openapi - fi - - OUTPUT_DIR="./src/gen/chat" - - # Clean previous output - rm -rf $TEMP_OUTPUT_DIR - rm -rf $OUTPUT_DIR - - mkdir $OUTPUT_DIR - - # NOTE: https://openapi-generator.tech/docs/generators/typescript-fetch/ - # Generate the Coordinator API models - yarn openapi-generator-cli generate \ - -i "$SCHEMA_FILE" \ - -g typescript-fetch \ - -o "$TEMP_OUTPUT_DIR" \ - --additional-properties=supportsES6=true \ - --additional-properties=modelPropertyNaming=original \ - --additional-properties=enumPropertyNaming=UPPERCASE \ - --additional-properties=withoutRuntimeChecks=true \ - --global-property=skipFormModel=false \ - --skip-validate-spec - - # Remove the generated API client, just keep the models - cp -r $TEMP_OUTPUT_DIR/ $OUTPUT_DIR - rm -rf $TEMP_OUTPUT_DIR -fi +yarn lint:gen \ No newline at end of file diff --git a/index.ts b/index.ts index 8737e13..9950667 100644 --- a/index.ts +++ b/index.ts @@ -1,7 +1,6 @@ -export * from './src/gen/chat/models'; -export * from './src/gen/video/models'; +export * from './src/gen/models'; export * from './src/StreamClient'; -export * from './src/StreamVideoClient'; export * from './src/StreamCall'; export * from './src/StreamChatClient'; export * from './src/StreamChannel'; +export * from './src/StreamVideoClient'; diff --git a/package.json b/package.json index 7679534..6986689 100644 --- a/package.json +++ b/package.json @@ -25,11 +25,11 @@ "test:bun": "bun run vitest", "start": "rollup -w -c", "build": "rm -rf dist && rollup -c", - "generate:open-api": "./generate-openapi.sh protocol $PRODUCT", - "generate:open-api:dev": "./generate-openapi.sh chat $PRODUCT", + "generate:open-api": "./generate-openapi.sh", "lint": "eslint **/*.ts", "lint:fix": "eslint --fix **/*.ts", - "prettier:fix": "prettier . --write" + "prettier:fix": "prettier . --write", + "lint:gen": "eslint --fix src/gen/**/*ts && prettier src/gen/**/*.ts --write" }, "lint-staged": { "**/*": [ @@ -58,6 +58,7 @@ "eslint-plugin-import": "^2.25.2", "eslint-plugin-n": "^15.0.0 || ^16.0.0 ", "eslint-plugin-promise": "^6.0.0", + "eslint-plugin-unused-imports": "^4.0.1", "husky": "^8.0.3", "lint-staged": "^15.1.0", "prettier": "^3.1.0", diff --git a/src/BaseApi.ts b/src/BaseApi.ts new file mode 100644 index 0000000..1aa256f --- /dev/null +++ b/src/BaseApi.ts @@ -0,0 +1,113 @@ +import { v4 as uuidv4 } from 'uuid'; +import { ApiConfig, RequestMetadata, StreamError } from './types'; +import { APIError } from './gen/models'; +import { getRateLimitFromResponseHeader } from './utils/rate-limit'; + +export class BaseApi { + constructor(private readonly apiConfig: ApiConfig) {} + + protected sendRequest = async ( + method: string, + url: string, + pathParams?: Record, + queryParams?: Record, + body?: any, + ) => { + queryParams = queryParams ?? {}; + queryParams.api_key = this.apiConfig.apiKey; + const encodedParams = this.queryParamsStringify(queryParams); + if (pathParams) { + Object.keys(pathParams).forEach((paramName) => { + url = url.replace(`{${paramName}}`, pathParams[paramName]); + }); + } + url += `?${encodedParams}`; + const clientRequestId = uuidv4(); + const headers = { + Authorization: this.apiConfig.token, + 'stream-auth-type': 'jwt', + 'Content-Type': 'application/json', + 'X-Stream-Client': 'stream-node-' + process.env.PKG_VERSION, + 'Accept-Encoding': 'gzip', + 'x-client-request-id': clientRequestId, + }; + + const signal = AbortSignal.timeout(this.apiConfig.timeout); + + try { + const response = await fetch(`${this.apiConfig.baseUrl}${url}`, { + signal, + method, + body: JSON.stringify(body), + headers, + }); + + const responseHeaders = response.headers; + + const metadata: RequestMetadata = { + clientRequestId, + responseHeaders, + responseCode: response.status, + rateLimit: getRateLimitFromResponseHeader(responseHeaders), + }; + + if (response.status < 200 || response.status >= 300) { + const error = (await response.json()) as APIError; + throw new StreamError( + `Stream error code ${error.code}: ${error.message}`, + metadata, + error.code, + undefined, + ); + } + + const responseBody = (await response.json()) as T; + + return { body: responseBody, metadata }; + } catch (error: any) { + if (error instanceof StreamError) { + throw error; + } + const metadata: Partial = { + clientRequestId, + responseCode: error.status, + }; + if (error.name === 'AbortError' || error.name === 'TimeoutError') { + throw new StreamError( + `The request was aborted due to to the ${this.apiConfig.timeout}ms timeout, you can set the timeout in the StreamClient constructor`, + metadata, + undefined, + error, + ); + } else { + throw new StreamError( + `The request failed due to an unexpected error`, + metadata, + error, + ); + } + } + }; + + protected queryParamsStringify = (params: Record) => { + const newParams = []; + for (const k in params) { + const param = params[k]; + if (Array.isArray(param)) { + newParams.push(`${k}=${encodeURIComponent(param.join(','))}`); + } else if (typeof param === 'object') { + newParams.push(`${k}=${encodeURIComponent(JSON.stringify(param))}`); + } else { + if ( + typeof param === 'string' || + typeof param === 'number' || + typeof param === 'boolean' + ) { + newParams.push(`${k}=${encodeURIComponent(param)}`); + } + } + } + + return newParams.join('&'); + }; +} diff --git a/src/StreamCall.ts b/src/StreamCall.ts index 21ceb57..d7b16f6 100644 --- a/src/StreamCall.ts +++ b/src/StreamCall.ts @@ -1,209 +1,19 @@ -import { StreamClient } from './StreamClient'; -import { - DeleteRecordingRequest, - DeleteTranscriptionRequest, - GetCallRequest, - GetCallStatsRequest, - ProductvideoApi, - VideoBlockUserRequest, - VideoDeleteCallRequest, - VideoGetOrCreateCallRequest, - VideoGoLiveRequest, - VideoMuteUsersRequest, - VideoPinRequest, - VideoQueryCallMembersRequest, - VideoSendCallEventRequest, - VideoStartRecordingRequest, - VideoStartTranscriptionRequest, - VideoUnblockUserRequest, - VideoUnpinRequest, - VideoUpdateCallMembersRequest, - VideoUpdateCallRequest, - VideoUpdateUserPermissionsRequest, -} from './gen/video'; +import { QueryCallMembersRequest } from './gen/models'; +import { CallApi } from './gen/video/CallApi'; import { OmitTypeId } from './types'; -export class StreamCall { - private readonly baseRequest: { type: string; id: string }; - private readonly apiClient: ProductvideoApi; - - constructor( - private readonly streamClient: StreamClient, - public readonly type: string, - public readonly id: string, - ) { - this.baseRequest = { id: this.id, type: this.type }; - const configuration = this.streamClient.getConfiguration('video'); - this.apiClient = new ProductvideoApi(configuration); - } - +export class StreamCall extends CallApi { get cid() { return `${this.type}:${this.id}`; } - blockUser = (videoBlockUserRequest: VideoBlockUserRequest) => { - return this.apiClient.blockUser({ - ...this.baseRequest, - videoBlockUserRequest, - }); - }; - - endCall = () => { - return this.apiClient.endCall({ ...this.baseRequest }); - }; - - get = (request?: OmitTypeId) => { - return this.apiClient.getCall({ ...(request ?? {}), ...this.baseRequest }); - }; - - delete = (videoDeleteCallRequest?: VideoDeleteCallRequest) => { - return this.apiClient.deleteCall({ - ...this.baseRequest, - videoDeleteCallRequest: videoDeleteCallRequest ?? null, - }); - }; - - getOrCreate = (videoGetOrCreateCallRequest?: VideoGetOrCreateCallRequest) => { - return this.apiClient.getOrCreateCall({ - ...this.baseRequest, - videoGetOrCreateCallRequest: videoGetOrCreateCallRequest ?? {}, - }); - }; - - getSessionStatistics = (request: OmitTypeId) => { - return this.apiClient.getCallStats({ ...this.baseRequest, ...request }); - }; - - create = (getOrCreateCallRequest?: VideoGetOrCreateCallRequest) => { - return this.getOrCreate(getOrCreateCallRequest); - }; - - goLive = (videoGoLiveRequest?: VideoGoLiveRequest) => { - return this.apiClient.goLive({ - ...this.baseRequest, - videoGoLiveRequest: videoGoLiveRequest ?? {}, - }); - }; - - listRecordings = () => { - return this.apiClient.listRecordings({ - ...this.baseRequest, - }); - }; - - deleteRecording = (request: OmitTypeId) => { - return this.apiClient.deleteRecording({ ...this.baseRequest, ...request }); - }; - - listTranscriptions = () => { - return this.apiClient.listTranscriptions({ - ...this.baseRequest, - }); - }; - - muteUsers = (videoMuteUsersRequest: VideoMuteUsersRequest) => { - return this.apiClient.muteUsers({ - ...this.baseRequest, - videoMuteUsersRequest, - }); - }; - - queryMembers = (request?: OmitTypeId) => { - return this.apiClient.queryCallMembers({ - videoQueryCallMembersRequest: { ...(request ?? {}), ...this.baseRequest }, - }); - }; - - sendCustomEvent = (videoSendCallEventRequest: VideoSendCallEventRequest) => { - return this.apiClient.sendCallEvent({ - videoSendCallEventRequest, - ...this.baseRequest, - }); - }; - - startHLSBroadcasting = () => { - return this.apiClient.startHLSBroadcasting({ ...this.baseRequest }); - }; - - startRecording = (request?: VideoStartRecordingRequest) => { - return this.apiClient.startRecording({ - ...this.baseRequest, - videoStartRecordingRequest: request ?? {}, - }); - }; - - startTranscription = ( - videoStartTranscriptionRequest: VideoStartTranscriptionRequest = {}, - ) => { - return this.apiClient.startTranscription({ - ...this.baseRequest, - videoStartTranscriptionRequest, - }); - }; - - deleteTranscription = (request: OmitTypeId) => { - return this.apiClient.deleteTranscription({ - ...this.baseRequest, - ...request, - }); - }; - - stopHLSBroadcasting = () => { - return this.apiClient.stopHLSBroadcasting({ ...this.baseRequest }); - }; - - stopLive = () => { - return this.apiClient.stopLive({ ...this.baseRequest }); - }; - - stopRecording = () => { - return this.apiClient.stopRecording({ ...this.baseRequest }); - }; - - stopTranscription = () => { - return this.apiClient.stopTranscription({ ...this.baseRequest }); - }; - - unblockUser = (videoUnblockUserRequest: VideoUnblockUserRequest) => { - return this.apiClient.unblockUser({ - videoUnblockUserRequest, - ...this.baseRequest, - }); - }; - - update = (videoUpdateCallRequest: VideoUpdateCallRequest) => { - return this.apiClient.updateCall({ - videoUpdateCallRequest, - ...this.baseRequest, - }); - }; - - updateCallMembers = ( - videoUpdateCallMembersRequest: VideoUpdateCallMembersRequest, - ) => { - return this.apiClient.updateCallMembers({ - videoUpdateCallMembersRequest, - ...this.baseRequest, - }); - }; - - updateUserPermissions = ( - videoUpdateUserPermissionsRequest: VideoUpdateUserPermissionsRequest, - ) => { - return this.apiClient.updateUserPermissions({ - videoUpdateUserPermissionsRequest, - ...this.baseRequest, - }); - }; - - pinVideo = (videoPinRequest: VideoPinRequest) => { - return this.apiClient.videoPin({ videoPinRequest, ...this.baseRequest }); - }; + create = this.getOrCreate; - unpinVideo = (videoUnpinRequest: VideoUnpinRequest) => { - return this.apiClient.videoUnpin({ - videoUnpinRequest, - ...this.baseRequest, + queryMembers = (request?: OmitTypeId) => { + return this.videoApi.queryCallMembers({ + id: this.id, + type: this.type, + ...(request ?? {}), }); }; } diff --git a/src/StreamChannel.ts b/src/StreamChannel.ts index 85571b7..52aa66a 100644 --- a/src/StreamChannel.ts +++ b/src/StreamChannel.ts @@ -1,262 +1,39 @@ -import { StreamClient } from './StreamClient'; -import { - ChannelGetOrCreateRequest, - DeleteChannelRequest, - DeleteMessageRequest, - DeleteReactionRequest, - EventRequest, - GetManyMessagesRequest, - GetMessageRequest, - GetOGRequest, - GetReactionsRequest, - GetRepliesRequest, - HideChannelRequest, - MarkReadRequest, - MarkUnreadRequest, - MuteChannelRequest, - ProductchatApi, - QueryMembersRequest, - SendMessageRequest, - SendReactionRequest, - ShowChannelRequest, - TranslateMessageRequest, - TruncateChannelRequest, - UnmuteChannelRequest, - UpdateChannelPartialRequest, - UpdateChannelRequest, - UpdateMessagePartialRequest, - UpdateMessageRequest, -} from './gen/chat'; +import { ChannelApi } from './gen/chat/ChannelApi'; +import { ChannelGetOrCreateRequest, QueryMembersRequest } from './gen/models'; import { OmitTypeId } from './types'; -export class StreamChannel { - private readonly chatApi: ProductchatApi; - - constructor( - private readonly streamClient: StreamClient, - public readonly type: string, - public id?: string, - ) { - const configuration = this.streamClient.getConfiguration(); - /** @ts-expect-error */ - this.chatApi = new ProductchatApi(configuration); - } - +export class StreamChannel extends ChannelApi { get cid() { - return `${this.baseRequest.type}:${this.baseRequest.id}`; + return `${this.type}:${this.id}`; } - delete = (request?: OmitTypeId) => { - return this.chatApi.deleteChannel({ - ...this.baseRequest, - ...(request ?? {}), - }); - }; - - update = (updateChannelRequest: OmitTypeId) => { - return this.chatApi.updateChannel({ - ...this.baseRequest, - updateChannelRequest, - }); - }; - - updatePartial = ( - updateChannelPartialRequest: OmitTypeId, - ) => { - return this.chatApi.updateChannelPartial({ - ...this.baseRequest, - updateChannelPartialRequest, - }); - }; - - getOrCreate = async ( - channelGetOrCreateRequest?: ChannelGetOrCreateRequest, - ) => { - if (this.id) { - return await this.chatApi.getOrCreateChannel({ - ...this.baseRequest, - channelGetOrCreateRequest: channelGetOrCreateRequest ?? {}, - }); + getOrCreate = (channel_get_or_create_request?: ChannelGetOrCreateRequest) => { + if (!this.id) { + return this.chatApi + .getOrCreateDistinctChannel({ + type: this.type, + ...channel_get_or_create_request, + }) + .then((response) => { + this.id = response.channel?.id; + return response; + }); } else { - if (!channelGetOrCreateRequest?.data?.members) { - throw new Error( - 'You need to provide members to create a channel without ID', - ); - } - const response = await this.chatApi.getOrCreateDistinctChannel({ + return this.chatApi.getOrCreateChannel({ + id: this.id, type: this.type, - channelGetOrCreateRequest, + ...channel_get_or_create_request, }); - this.id = response.channel?.id; - return response; } }; - markRead = (markReadRequest: MarkReadRequest) => { - return this.chatApi.markRead({ ...this.baseRequest, markReadRequest }); - }; - - markUnread = (markUnreadRequest: MarkUnreadRequest) => { - return this.chatApi.markUnread({ - ...this.baseRequest, - markUnreadRequest, - }); - }; - - show = (showChannelRequest: ShowChannelRequest) => { - return this.chatApi.showChannel({ - ...this.baseRequest, - showChannelRequest, - }); - }; - - hide = (hideChannelRequest: HideChannelRequest) => { - return this.chatApi.hideChannel({ - ...this.baseRequest, - hideChannelRequest, - }); - }; - - truncate = (truncateChannelRequest: TruncateChannelRequest) => { - return this.chatApi.truncateChannel({ - ...this.baseRequest, - truncateChannelRequest, - }); - }; - - queryMembers = (request: OmitTypeId) => { + queryMembers(request?: { payload?: OmitTypeId }) { return this.chatApi.queryMembers({ - payload: { ...this.baseRequest, ...request }, - }); - }; - - mute = (muteChannelRequest: Omit) => { - return this.chatApi.muteChannel({ - muteChannelRequest: { ...muteChannelRequest, channel_cids: [this.cid] }, - }); - }; - - unmute = ( - unmuteChannelRequest: Omit< - UnmuteChannelRequest, - 'channel_cids' | 'channel_cid' - >, - ) => { - return this.chatApi.unmuteChannel({ - unmuteChannelRequest: { - ...unmuteChannelRequest, - channel_cids: [this.cid], + payload: { + id: this.id, + type: this.type, + ...(request?.payload ?? { filter_conditions: {} }), }, }); - }; - - // TODO: there is probably an issue with the generated code here - // uploadFile = (options: Omit, 'file'>, file: Buffer) => { - // return this.chatApi.uploadFile({...options, ...this.baseRequest, file: file as any as string}); - // } - - // deleteFile = (request: OmitTypeId) => { - // return this.chatApi.deleteFile({...request, ...this.baseRequest}); - // } - - // uploadImage = (request: OmitTypeId) => { - // return this.chatApi.uploadImage({...request, ...this.baseRequest}); - // } - - // deleteImage = (request: OmitTypeId) => { - // return this.chatApi.deleteImage({...request, ...this.baseRequest}); - // } - - sendMessage = (sendMessageRequest: SendMessageRequest) => { - return this.chatApi.sendMessage({ - ...this.baseRequest, - sendMessageRequest, - }); - }; - - deleteMessage = (request: DeleteMessageRequest) => { - return this.chatApi.deleteMessage(request); - }; - - updateMessage = (id: string, updateMessageRequest: UpdateMessageRequest) => { - return this.chatApi.updateMessage({ id, updateMessageRequest }); - }; - - updateMessagePartial = ( - id: string, - updateMessagePartialRequest: UpdateMessagePartialRequest, - ) => { - return this.chatApi.updateMessagePartial({ - id, - updateMessagePartialRequest, - }); - }; - - getMessage = (request: GetMessageRequest) => { - return this.chatApi.getMessage(request); - }; - - getManyMessages = (request: OmitTypeId) => { - return this.chatApi.getManyMessages({ - ...request, - ...this.baseRequest, - }); - }; - - translateMessage = ( - id: string, - translateMessageRequest: TranslateMessageRequest, - ) => { - return this.chatApi.translateMessage({ id, translateMessageRequest }); - }; - - getMessagesAround = (request: GetRepliesRequest) => { - return this.chatApi.getReplies(request); - }; - - getOpenGraphData = (request: GetOGRequest) => { - return this.chatApi.getOG(request); - }; - - sendMessageReaction = ( - messageId: string, - sendReactionRequest: SendReactionRequest, - ) => { - return this.chatApi.sendReaction({ - id: messageId, - sendReactionRequest, - }); - }; - - deleteMessageReaction = ( - messageId: string, - request: Omit, - ) => { - return this.chatApi.deleteReaction({ ...request, id: messageId }); - }; - - getMessageReactions = ( - messageId: string, - request?: Omit, - ) => { - return this.chatApi.getReactions({ ...(request ?? {}), id: messageId }); - }; - - sendCustomEvent = (event: EventRequest) => { - return this.chatApi.sendEvent({ - ...this.baseRequest, - sendEventRequest: { event }, - }); - }; - - private get baseRequest() { - if (!this.id) { - throw new Error('You need to initialize the channel with `getOrCreate`'); - } - - return { - id: this.id, - type: this.type, - }; } } diff --git a/src/StreamChatClient.ts b/src/StreamChatClient.ts index e0627fc..dc82a27 100644 --- a/src/StreamChatClient.ts +++ b/src/StreamChatClient.ts @@ -1,127 +1,8 @@ +import { ChatApi } from './gen/chat/ChatApi'; import { StreamChannel } from './StreamChannel'; -import { StreamClient } from './StreamClient'; -import { - CreateBlockListRequest, - CreateChannelTypeRequest, - CreateCommandRequest, - DeleteBlockListRequest, - DeleteChannelTypeRequest, - DeleteCommandRequest, - ExportChannelsRequest, - GetBlockListRequest, - GetChannelTypeRequest, - GetCommandRequest, - GetExportChannelsStatusRequest, - ProductchatApi, - QueryChannelsRequest, - SearchRequest, - UpdateBlockListRequest, - UpdateChannelTypeRequest, - UpdateCommandRequest, -} from './gen/chat'; - -export class StreamChatClient { - private readonly chatApi: ProductchatApi; - - constructor(private readonly streamClient: StreamClient) { - const configuration = this.streamClient.getConfiguration(); - /** @ts-expect-error */ - this.chatApi = new ProductchatApi(configuration); - } +export class StreamChatClient extends ChatApi { channel = (type: string, id?: string) => { - return new StreamChannel(this.streamClient, type, id); - }; - - createBlockList = (createBlockListRequest: CreateBlockListRequest) => { - return this.chatApi.createBlockList({ createBlockListRequest }); - }; - - listBlockLists = () => { - return this.chatApi.listBlockLists(); - }; - - getBlockList = (request: GetBlockListRequest) => { - return this.chatApi.getBlockList(request); - }; - - updateBlockList = ( - name: string, - updateBlockListRequest: UpdateBlockListRequest, - ) => { - return this.chatApi.updateBlockList({ name, updateBlockListRequest }); - }; - - deleteBlockList = (request: DeleteBlockListRequest) => { - return this.chatApi.deleteBlockList(request); - }; - - createChannelType = (createChannelTypeRequest: CreateChannelTypeRequest) => { - return this.chatApi.createChannelType({ createChannelTypeRequest }); - }; - - deleteChannelType = (request: DeleteChannelTypeRequest) => { - return this.chatApi.deleteChannelType(request); - }; - - getChannelType = (request: GetChannelTypeRequest) => { - return this.chatApi.getChannelType(request); - }; - - listChannelTypes = () => { - return this.chatApi.listChannelTypes(); - }; - - updateChannelType = ( - name: string, - updateChannelTypeRequest: UpdateChannelTypeRequest, - ) => { - return this.chatApi.updateChannelType({ - name, - updateChannelTypeRequest, - }); - }; - - queryChannels = (queryChannelsRequest?: QueryChannelsRequest) => { - return this.chatApi.queryChannels({ - queryChannelsRequest: queryChannelsRequest ?? {}, - }); - }; - - searchMessages = (payload?: SearchRequest) => { - return this.chatApi.search({ payload }); - }; - - exportChannels = (exportChannelsRequest?: ExportChannelsRequest) => { - return this.chatApi.exportChannels({ - exportChannelsRequest: exportChannelsRequest ?? null, - }); - }; - - getExportStatus = (request: GetExportChannelsStatusRequest) => { - return this.chatApi.getExportChannelsStatus(request); - }; - - listCommands = () => { - return this.chatApi.listCommands(); - }; - - createCommand = (createCommandRequest: CreateCommandRequest) => { - return this.chatApi.createCommand({ createCommandRequest }); - }; - - getCommand = (getCommandRequest: GetCommandRequest) => { - return this.chatApi.getCommand(getCommandRequest); - }; - - updateCommand = ( - name: string, - updateCommandRequest: UpdateCommandRequest, - ) => { - return this.chatApi.updateCommand({ name, updateCommandRequest }); - }; - - deleteCommand = (request: DeleteCommandRequest) => { - return this.chatApi.deleteCommand(request); + return new StreamChannel(this, type, id); }; } diff --git a/src/StreamClient.ts b/src/StreamClient.ts index 9f93937..165c1c3 100644 --- a/src/StreamClient.ts +++ b/src/StreamClient.ts @@ -1,129 +1,96 @@ -import { StreamChatClient } from './StreamChatClient'; -import { StreamVideoClient } from './StreamVideoClient'; -import { - APIError, - BanRequest, - BlockUsersRequest, - CheckPushRequest, - CreateDeviceRequest, - CreateGuestRequest, - CreateRoleRequest, - DeactivateUserRequest, - DeactivateUsersRequest, - DeleteDeviceRequest, - DeletePushProviderRequest, - DeleteRoleRequest, - DeleteUsersRequest, - ExportUserRequest, - ExportUsersRequest, - FlagRequest, - GetBlockedUsersRequest, - GetPermissionRequest, - GetTaskRequest, - ListDevicesRequest, - MuteUserRequest, - ProductchatApi, - PushProvider, - QueryBannedUsersRequest, - QueryUsersPayload, - ReactivateUserRequest, - ReactivateUsersRequest, - RestoreUsersRequest, - UnbanRequest, - UnblockUsersRequest, - UnmuteUserRequest, - UpdateAppRequest, - UpdateUserPartialRequest, - UpdateUsersRequest, - UserCustomEventRequest, -} from './gen/chat'; -import { - Configuration, - ErrorContext, - FetchError, - HTTPQuery, - JSONApiResponse, - RequestContext, - ResponseContext, -} from './gen/video'; -import { v4 as uuidv4 } from 'uuid'; import { JWTServerToken, JWTUserToken } from './utils/create-token'; +import { CommonApi } from './gen/common/CommonApi'; +import { StreamVideoClient } from './StreamVideoClient'; import crypto from 'crypto'; +import { StreamChatClient } from './StreamChatClient'; import { CallTokenPayload, UserTokenPayload } from './types'; +import { QueryBannedUsersRequest, UserRequest } from './gen/models'; +import { StreamModerationClient } from './StreamModerationClient'; export interface StreamClientOptions { timeout?: number; basePath?: string; } -export class StreamClient { +export class StreamClient extends CommonApi { public readonly video: StreamVideoClient; public readonly chat: StreamChatClient; + public readonly moderation: StreamModerationClient; public readonly options: StreamClientOptions = {}; - private readonly chatApi: ProductchatApi; - private readonly token: string; + private static readonly DEFAULT_TIMEOUT = 3000; /** * * @param apiKey * @param secret - * @param config can be a string, which will be interpreted as base path (deprecated), or a config object + * @param config config object */ constructor( - private readonly apiKey: string, + readonly apiKey: string, private readonly secret: string, - readonly config?: string | StreamClientOptions, + readonly config?: StreamClientOptions, ) { - this.token = JWTServerToken(this.secret); + const token = JWTServerToken(secret); + const timeout = config?.timeout ?? StreamClient.DEFAULT_TIMEOUT; + const chatBaseUrl = config?.basePath ?? 'https://chat.stream-io-api.com'; + const videoBaseUrl = config?.basePath ?? 'https://video.stream-io-api.com'; + super({ apiKey, token, timeout, baseUrl: chatBaseUrl }); + + this.video = new StreamVideoClient({ + apiKey, + token, + timeout, + baseUrl: videoBaseUrl, + }); + this.chat = new StreamChatClient({ + apiKey, + token, + timeout, + baseUrl: chatBaseUrl, + }); + this.moderation = new StreamModerationClient({ + apiKey, + token, + timeout, + baseUrl: chatBaseUrl, + }); + } - if (typeof config === 'string') { - this.options.basePath = config; - this.options.timeout = StreamClient.DEFAULT_TIMEOUT; - } else { - if (config) { - this.options = config; - } - this.options.timeout = config?.timeout ?? StreamClient.DEFAULT_TIMEOUT; - } + upsertUsers = (users: UserRequest[]) => { + const payload: Record = {}; - this.video = new StreamVideoClient(this); - this.chat = new StreamChatClient(this); + users.forEach((u) => { + payload[u.id] = u; + }); - const chatConfiguration = this.getConfiguration(); - /** @ts-expect-error */ - this.chatApi = new ProductchatApi(chatConfiguration); - } + return this.updateUsers({ users: payload }); + }; + + queryBannedUsers = (request?: { payload?: QueryBannedUsersRequest }) => { + return this.chat.queryBannedUsers(request); + }; /** * * @param userID * @param exp * @param iat deprecated, the default date will be set internally - * @param call_cids this parameter is deprecated use `createCallToken` for call tokens * @returns */ - createToken( + createToken = ( userID: string, exp = Math.round(Date.now() / 1000) + 60 * 60, iat = Math.floor((Date.now() - 1000) / 1000), - call_cids?: string[], - ) { + ) => { const payload: UserTokenPayload = { user_id: userID, exp, iat, }; - if (call_cids) { - console.warn( - `Use createCallToken method for creating call tokens, the "call_cids" param will be removed from the createToken method with version 0.2.0`, - ); - payload.call_cids = call_cids; - } - return JWTUserToken(this.secret, payload); - } + }; /** * @@ -133,12 +100,12 @@ export class StreamClient { * @param iat this is deprecated, the current date will be set internally * @returns */ - createCallToken( + createCallToken = ( userIdOrObject: string | { user_id: string; role?: string }, call_cids: string[], exp = Math.round(Date.now() / 1000) + 60 * 60, iat = Math.floor((Date.now() - 1000) / 1000), - ) { + ) => { const payload: CallTokenPayload = { exp, iat, @@ -154,163 +121,6 @@ export class StreamClient { } return JWTUserToken(this.secret, payload); - } - - createDevice = (createDeviceRequest: CreateDeviceRequest) => { - return this.chatApi.createDevice({ createDeviceRequest }); - }; - - deleteDevice = (requestParameters: DeleteDeviceRequest) => { - return this.chatApi.deleteDevice(requestParameters); - }; - - listDevices = (requestParameters: ListDevicesRequest) => { - return this.chatApi.listDevices(requestParameters); - }; - - listPushProviders = () => { - return this.chatApi.listPushProviders(); - }; - - deletePushProvider = (request: DeletePushProviderRequest) => { - return this.chatApi.deletePushProvider(request); - }; - - upsertPushProvider = (request: PushProvider) => { - return this.chatApi.upsertPushProvider({ - upsertPushProviderRequest: { push_provider: request }, - }); - }; - - checkPush = (checkPushRequest: CheckPushRequest) => { - return this.chatApi.checkPush({ checkPushRequest }); - }; - - createGuest = (createGuestRequest: CreateGuestRequest) => { - return this.chatApi.createGuest({ createGuestRequest }); - }; - - banUser = (banRequest: BanRequest) => { - return this.chatApi.ban({ banRequest }); - }; - - deactivateUser = ( - deactivateUserRequest: DeactivateUserRequest & { user_id: string }, - ) => { - return this.chatApi.deactivateUser({ - deactivateUserRequest, - userId: deactivateUserRequest.user_id, - }); - }; - - deactivateUsers = (deactivateUsersRequest: DeactivateUsersRequest) => { - return this.chatApi.deactivateUsers({ deactivateUsersRequest }); - }; - - deleteUsers = (deleteUsersRequest: DeleteUsersRequest) => { - return this.chatApi.deleteUsers({ deleteUsersRequest }); - }; - - exportUser = (request: ExportUserRequest) => { - return this.chatApi.exportUser(request); - }; - - exportUsers = (exportUsersRequest: ExportUsersRequest) => { - return this.chatApi.exportUsers({ exportUsersRequest }); - }; - - flag = (flagRequest: FlagRequest) => { - return this.chatApi.flag({ flagRequest }); - }; - - queryBannedUsers = (payload: QueryBannedUsersRequest) => { - return this.chatApi.queryBannedUsers({ payload }); - }; - - queryUsers = (payload: QueryUsersPayload) => { - return this.chatApi.queryUsers({ payload }); - }; - - reactivateUser = ( - reactivateUserRequest: ReactivateUserRequest & { user_id: string }, - ) => { - return this.chatApi.reactivateUser({ - reactivateUserRequest, - userId: reactivateUserRequest.user_id, - }); - }; - - reactivateUsers = (reactivateUsersRequest: ReactivateUsersRequest) => { - return this.chatApi.reactivateUsers({ reactivateUsersRequest }); - }; - - restoreUsers = (restoreUsersRequest: RestoreUsersRequest) => { - return this.chatApi.restoreUsers({ restoreUsersRequest }); - }; - - unbanUser = (request: UnbanRequest) => { - return this.chatApi.unban(request); - }; - - upsertUsers = (updateUsersRequest: UpdateUsersRequest) => { - return this.chatApi.updateUsers({ updateUsersRequest }); - }; - - updateUsersPartial = (request: { users: UpdateUserPartialRequest[] }) => { - return this.chatApi.updateUsersPartial({ - updateUsersPartialRequest: request, - }); - }; - - muteUser = (muteUserRequest: MuteUserRequest) => { - return this.chatApi.muteUser({ muteUserRequest }); - }; - - unmuteUser = (unmuteUserRequest: UnmuteUserRequest) => { - return this.chatApi.unmuteUser({ unmuteUserRequest }); - }; - - sendCustomEventToUser = (userId: string, event: UserCustomEventRequest) => { - return this.chatApi.sendUserCustomEvent({ - userId, - sendUserCustomEventRequest: { event }, - }); - }; - - createRole = (createRoleRequest: CreateRoleRequest) => { - return this.chatApi.createRole({ createRoleRequest }); - }; - - deleteRole = (request: DeleteRoleRequest) => { - return this.chatApi.deleteRole(request); - }; - - getPermission = (request: GetPermissionRequest) => { - return this.chatApi.getPermission(request); - }; - - listPermissions = () => { - return this.chatApi.listPermissions(); - }; - - listRoles = () => { - return this.chatApi.listRoles(); - }; - - getAppSettings = () => { - return this.chatApi.getApp(); - }; - - updateAppSettings = (updateAppRequest: UpdateAppRequest) => { - return this.chatApi.updateApp({ updateAppRequest }); - }; - - getRateLimits = () => { - return this.chatApi.getRateLimits(); - }; - - getTaskStatus = (request: GetTaskRequest) => { - return this.chatApi.getTask(request); }; verifyWebhook = (requestBody: string | Buffer, xSignature: string) => { @@ -326,107 +136,4 @@ export class StreamClient { return false; } }; - - blockUsers = (blockUsersRequest: BlockUsersRequest) => { - return this.chatApi.blockUsers({ blockUsersRequest }); - }; - - unblockUsers = (unblockUsersRequest: UnblockUsersRequest) => { - return this.chatApi.unblockUsers({ unblockUsersRequest }); - }; - - getBlockedUsers = (request: GetBlockedUsersRequest) => { - return this.chatApi.getBlockedUsers(request); - }; - - getConfiguration = (product: 'chat' | 'video' = 'chat') => { - return new Configuration({ - apiKey: (name: string) => { - const mapping: Record = { - 'Stream-Auth-Type': 'jwt', - api_key: this.apiKey, - Authorization: this.token, - }; - - return mapping[name]; - }, - basePath: - this.options.basePath ?? - (product === 'chat' - ? 'https://chat.stream-io-api.com' - : 'https://video.stream-io-api.com'), - headers: { - 'X-Stream-Client': 'stream-node-' + process.env.PKG_VERSION, - }, - middleware: [ - { - pre: (context: RequestContext) => { - context.init.headers = { - ...context.init.headers, - 'x-client-request-id': uuidv4(), - 'Accept-Encoding': 'gzip', - }; - - return Promise.resolve(context); - }, - }, - { - // This should be the last post middleware because that will throw an error - // The Fetch API won't throw an error for HTTP error responses, which means the "onError" middleware won't be called so we need to throw error from "post" middleware - post: async (context: ResponseContext) => { - if ( - (context.response && context.response.status < 200) || - context.response.status >= 300 - ) { - const response = new JSONApiResponse(context.response); - const value = (await response.value()) as APIError; - throw new Error( - `Stream error code ${value.code}: ${value.message}`, - ); - } - }, - }, - { - pre: (context: RequestContext) => { - context.init.signal = AbortSignal.timeout(this.options.timeout!); - - return Promise.resolve(context); - }, - onError: (context: ErrorContext) => { - const error = context.error as DOMException; - if (error.name === 'AbortError' || error.name === 'TimeoutError') { - throw new FetchError( - error, - `The request was aborted due to to the ${this.options.timeout}ms timeout, you can set the timeout in the StreamClient constructor`, - ); - } - - return Promise.resolve(context.response); - }, - }, - ], - // https://github.com/OpenAPITools/openapi-generator/issues/13222 - queryParamsStringify: (params: HTTPQuery) => { - const newParams = []; - for (const k in params) { - const param = params[k]; - if (Array.isArray(param)) { - newParams.push(`${k}=${encodeURIComponent(param.join(','))}`); - } else if (typeof param === 'object') { - newParams.push(`${k}=${encodeURIComponent(JSON.stringify(param))}`); - } else { - if ( - typeof param === 'string' || - typeof param === 'number' || - typeof param === 'boolean' - ) { - newParams.push(`${k}=${encodeURIComponent(param)}`); - } - } - } - - return newParams.join('&'); - }, - }); - }; } diff --git a/src/StreamModerationClient.ts b/src/StreamModerationClient.ts new file mode 100644 index 0000000..6e62397 --- /dev/null +++ b/src/StreamModerationClient.ts @@ -0,0 +1,3 @@ +import { ModerationApi } from './gen/moderation/ModerationApi'; + +export class StreamModerationClient extends ModerationApi {} diff --git a/src/StreamVideoClient.ts b/src/StreamVideoClient.ts index 1e19c5d..e231854 100644 --- a/src/StreamVideoClient.ts +++ b/src/StreamVideoClient.ts @@ -1,100 +1,8 @@ +import { VideoApi } from './gen/video/VideoApi'; import { StreamCall } from './StreamCall'; -import { StreamClient } from './StreamClient'; -import { - CheckExternalStorageRequest, - DeleteCallTypeRequest, - DeleteExternalStorageRequest, - GetCallTypeRequest, - ProductvideoApi, - VideoCreateCallTypeRequest, - VideoCreateExternalStorageRequest, - VideoQueryCallStatsRequest, - VideoQueryCallsRequest, - VideoUpdateCallTypeRequest, - VideoUpdateExternalStorageRequest, -} from './gen/video'; - -export class StreamVideoClient { - private readonly apiClient: ProductvideoApi; - - constructor(private readonly streamClient: StreamClient) { - const configuration = this.streamClient.getConfiguration('video'); - this.apiClient = new ProductvideoApi(configuration); - } +export class StreamVideoClient extends VideoApi { call = (type: string, id: string) => { - return new StreamCall(this.streamClient, type, id); - }; - - queryCalls = (request?: VideoQueryCallsRequest) => { - return this.apiClient.queryCalls({ - videoQueryCallsRequest: request ?? {}, - }); - }; - - queryCallStatistics = ( - videoQueryCallStatsRequest?: VideoQueryCallStatsRequest, - ) => { - return this.apiClient.queryCallStats({ - videoQueryCallStatsRequest: videoQueryCallStatsRequest ?? {}, - }); - }; - - createCallType = (videoCreateCallTypeRequest: VideoCreateCallTypeRequest) => { - return this.apiClient.createCallType({ - videoCreateCallTypeRequest, - }); - }; - - deleteCallType = (request: DeleteCallTypeRequest) => { - return this.apiClient.deleteCallType(request); - }; - - getCallType = (request: GetCallTypeRequest) => { - return this.apiClient.getCallType(request); - }; - - listCallTypes = () => { - return this.apiClient.listCallTypes(); - }; - - updateCallType = ( - name: string, - videoUpdateCallTypeRequest: VideoUpdateCallTypeRequest, - ) => { - return this.apiClient.updateCallType({ - name, - videoUpdateCallTypeRequest, - }); - }; - - listExternalStorages = () => { - return this.apiClient.listExternalStorage(); - }; - - createExternalStorage = ( - videoCreateExternalStorageRequest: VideoCreateExternalStorageRequest, - ) => { - return this.apiClient.createExternalStorage({ - videoCreateExternalStorageRequest, - }); - }; - - deleteExternalStorage = (request: DeleteExternalStorageRequest) => { - return this.apiClient.deleteExternalStorage(request); - }; - - updateExternalStorage = ( - name: string, - videoUpdateExternalStorageRequest: VideoUpdateExternalStorageRequest, - ) => { - return this.apiClient.updateExternalStorage({ - name, - videoUpdateExternalStorageRequest, - }); - }; - - checkExternalStorage = (request: CheckExternalStorageRequest) => { - return this.apiClient.checkExternalStorage(request); + return new StreamCall(this, type, id); }; } diff --git a/src/gen/chat/.openapi-generator-ignore b/src/gen/chat/.openapi-generator-ignore deleted file mode 100644 index 7484ee5..0000000 --- a/src/gen/chat/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/src/gen/chat/.openapi-generator/FILES b/src/gen/chat/.openapi-generator/FILES deleted file mode 100644 index abe13fd..0000000 --- a/src/gen/chat/.openapi-generator/FILES +++ /dev/null @@ -1,6 +0,0 @@ -.openapi-generator-ignore -apis/ProductchatApi.ts -apis/index.ts -index.ts -models/index.ts -runtime.ts diff --git a/src/gen/chat/.openapi-generator/VERSION b/src/gen/chat/.openapi-generator/VERSION deleted file mode 100644 index cd802a1..0000000 --- a/src/gen/chat/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -6.6.0 \ No newline at end of file diff --git a/src/gen/chat/ChannelApi.ts b/src/gen/chat/ChannelApi.ts new file mode 100644 index 0000000..5270302 --- /dev/null +++ b/src/gen/chat/ChannelApi.ts @@ -0,0 +1,270 @@ +import { ChatApi } from './ChatApi'; +import { StreamResponse } from '../../types'; +import { + ChannelGetOrCreateRequest, + ChannelStateResponse, + DeleteChannelResponse, + EventResponse, + FileUploadRequest, + FileUploadResponse, + GetManyMessagesResponse, + HideChannelRequest, + HideChannelResponse, + ImageUploadRequest, + ImageUploadResponse, + MarkReadRequest, + MarkReadResponse, + MarkUnreadRequest, + Response, + SendEventRequest, + SendMessageRequest, + SendMessageResponse, + ShowChannelRequest, + ShowChannelResponse, + TruncateChannelRequest, + TruncateChannelResponse, + UpdateChannelPartialRequest, + UpdateChannelPartialResponse, + UpdateChannelRequest, + UpdateChannelResponse, +} from '../models'; + +export class ChannelApi { + constructor( + protected chatApi: ChatApi, + public readonly type: string, + public id?: string, + ) {} + + delete = (request?: { + hard_delete?: boolean; + }): Promise> => { + if (!this.id) { + throw new Error( + `Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`, + ); + } + return this.chatApi.deleteChannel({ + id: this.id, + type: this.type, + ...request, + }); + }; + + updateChannelPartial = ( + request?: UpdateChannelPartialRequest, + ): Promise> => { + if (!this.id) { + throw new Error( + `Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`, + ); + } + return this.chatApi.updateChannelPartial({ + id: this.id, + type: this.type, + ...request, + }); + }; + + update = ( + request?: UpdateChannelRequest, + ): Promise> => { + if (!this.id) { + throw new Error( + `Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`, + ); + } + return this.chatApi.updateChannel({ + id: this.id, + type: this.type, + ...request, + }); + }; + + sendEvent = ( + request: SendEventRequest, + ): Promise> => { + if (!this.id) { + throw new Error( + `Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`, + ); + } + return this.chatApi.sendEvent({ id: this.id, type: this.type, ...request }); + }; + + deleteFile = (request?: { + url?: string; + }): Promise> => { + if (!this.id) { + throw new Error( + `Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`, + ); + } + return this.chatApi.deleteFile({ + id: this.id, + type: this.type, + ...request, + }); + }; + + uploadFile = ( + request?: FileUploadRequest, + ): Promise> => { + if (!this.id) { + throw new Error( + `Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`, + ); + } + return this.chatApi.uploadFile({ + id: this.id, + type: this.type, + ...request, + }); + }; + + hide = ( + request?: HideChannelRequest, + ): Promise> => { + if (!this.id) { + throw new Error( + `Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`, + ); + } + return this.chatApi.hideChannel({ + id: this.id, + type: this.type, + ...request, + }); + }; + + deleteImage = (request?: { + url?: string; + }): Promise> => { + if (!this.id) { + throw new Error( + `Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`, + ); + } + return this.chatApi.deleteImage({ + id: this.id, + type: this.type, + ...request, + }); + }; + + uploadImage = ( + request?: ImageUploadRequest, + ): Promise> => { + if (!this.id) { + throw new Error( + `Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`, + ); + } + return this.chatApi.uploadImage({ + id: this.id, + type: this.type, + ...request, + }); + }; + + sendMessage = ( + request: SendMessageRequest, + ): Promise> => { + if (!this.id) { + throw new Error( + `Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`, + ); + } + return this.chatApi.sendMessage({ + id: this.id, + type: this.type, + ...request, + }); + }; + + getManyMessages = (request: { + ids: string[]; + }): Promise> => { + if (!this.id) { + throw new Error( + `Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`, + ); + } + return this.chatApi.getManyMessages({ + id: this.id, + type: this.type, + ...request, + }); + }; + + getOrCreate = ( + request?: ChannelGetOrCreateRequest, + ): Promise> => { + if (!this.id) { + throw new Error( + `Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`, + ); + } + return this.chatApi.getOrCreateChannel({ + id: this.id, + type: this.type, + ...request, + }); + }; + + markRead = ( + request?: MarkReadRequest, + ): Promise> => { + if (!this.id) { + throw new Error( + `Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`, + ); + } + return this.chatApi.markRead({ id: this.id, type: this.type, ...request }); + }; + + show = ( + request?: ShowChannelRequest, + ): Promise> => { + if (!this.id) { + throw new Error( + `Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`, + ); + } + return this.chatApi.showChannel({ + id: this.id, + type: this.type, + ...request, + }); + }; + + truncate = ( + request?: TruncateChannelRequest, + ): Promise> => { + if (!this.id) { + throw new Error( + `Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`, + ); + } + return this.chatApi.truncateChannel({ + id: this.id, + type: this.type, + ...request, + }); + }; + + markUnread = ( + request?: MarkUnreadRequest, + ): Promise> => { + if (!this.id) { + throw new Error( + `Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`, + ); + } + return this.chatApi.markUnread({ + id: this.id, + type: this.type, + ...request, + }); + }; +} diff --git a/src/gen/chat/ChatApi.ts b/src/gen/chat/ChatApi.ts new file mode 100644 index 0000000..3ed10b6 --- /dev/null +++ b/src/gen/chat/ChatApi.ts @@ -0,0 +1,1853 @@ +import { BaseApi } from '../../BaseApi'; +import { StreamResponse } from '../../types'; +import { + CastPollVoteRequest, + ChannelGetOrCreateRequest, + ChannelStateResponse, + CommitMessageRequest, + CreateChannelTypeRequest, + CreateChannelTypeResponse, + CreateCommandRequest, + CreateCommandResponse, + CreatePollOptionRequest, + CreatePollRequest, + DeleteChannelResponse, + DeleteChannelsRequest, + DeleteChannelsResponse, + DeleteCommandResponse, + DeleteMessageResponse, + EventResponse, + ExportChannelsRequest, + ExportChannelsResponse, + FileUploadRequest, + FileUploadResponse, + GetChannelTypeResponse, + GetCommandResponse, + GetExportChannelsStatusResponse, + GetManyMessagesResponse, + GetMessageResponse, + GetReactionsResponse, + GetRepliesResponse, + GetThreadResponse, + HideChannelRequest, + HideChannelResponse, + ImageUploadRequest, + ImageUploadResponse, + ListChannelTypesResponse, + ListCommandsResponse, + MarkChannelsReadRequest, + MarkReadRequest, + MarkReadResponse, + MarkUnreadRequest, + MembersResponse, + MessageActionRequest, + MessageResponse, + MuteChannelRequest, + MuteChannelResponse, + PollOptionResponse, + PollResponse, + PollVoteResponse, + PollVotesResponse, + QueryBannedUsersRequest, + QueryBannedUsersResponse, + QueryChannelsRequest, + QueryChannelsResponse, + QueryMembersRequest, + QueryMessageFlagsRequest, + QueryMessageFlagsResponse, + QueryMessageHistoryRequest, + QueryMessageHistoryResponse, + QueryPollVotesRequest, + QueryPollsRequest, + QueryPollsResponse, + QueryReactionsRequest, + QueryReactionsResponse, + QueryThreadsRequest, + QueryThreadsResponse, + ReactionRemovalResponse, + Response, + SearchRequest, + SearchResponse, + SendEventRequest, + SendMessageRequest, + SendMessageResponse, + SendReactionRequest, + SendReactionResponse, + SendUserCustomEventRequest, + ShowChannelRequest, + ShowChannelResponse, + SortParamRequest, + TranslateMessageRequest, + TruncateChannelRequest, + TruncateChannelResponse, + UnmuteChannelRequest, + UnmuteResponse, + UnreadCountsBatchRequest, + UnreadCountsBatchResponse, + UpdateChannelPartialRequest, + UpdateChannelPartialResponse, + UpdateChannelRequest, + UpdateChannelResponse, + UpdateChannelTypeRequest, + UpdateChannelTypeResponse, + UpdateCommandRequest, + UpdateCommandResponse, + UpdateMessagePartialRequest, + UpdateMessagePartialResponse, + UpdateMessageRequest, + UpdateMessageResponse, + UpdatePollOptionRequest, + UpdatePollPartialRequest, + UpdatePollRequest, + UpdateThreadPartialRequest, + UpdateThreadPartialResponse, + WrappedUnreadCountsResponse, +} from '../models'; +import { decoders } from '../model-decoders'; + +export class ChatApi extends BaseApi { + queryChannels = async ( + request?: QueryChannelsRequest, + ): Promise> => { + const body = { + limit: request?.limit, + member_limit: request?.member_limit, + message_limit: request?.message_limit, + offset: request?.offset, + state: request?.state, + user_id: request?.user_id, + sort: request?.sort, + filter_conditions: request?.filter_conditions, + user: request?.user, + }; + + const response = await this.sendRequest< + StreamResponse + >('POST', '/api/v2/chat/channels', undefined, undefined, body); + + decoders.QueryChannelsResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + deleteChannels = async ( + request: DeleteChannelsRequest, + ): Promise> => { + const body = { + cids: request?.cids, + hard_delete: request?.hard_delete, + }; + + const response = await this.sendRequest< + StreamResponse + >('POST', '/api/v2/chat/channels/delete', undefined, undefined, body); + + decoders.DeleteChannelsResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + markChannelsRead = async ( + request?: MarkChannelsReadRequest, + ): Promise> => { + const body = { + user_id: request?.user_id, + read_by_channel: request?.read_by_channel, + user: request?.user, + }; + + const response = await this.sendRequest>( + 'POST', + '/api/v2/chat/channels/read', + undefined, + undefined, + body, + ); + + decoders.MarkReadResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + getOrCreateDistinctChannel = async ( + request: ChannelGetOrCreateRequest & { type: string }, + ): Promise> => { + const pathParams = { + type: request?.type, + }; + const body = { + hide_for_creator: request?.hide_for_creator, + state: request?.state, + thread_unread_counts: request?.thread_unread_counts, + data: request?.data, + members: request?.members, + messages: request?.messages, + watchers: request?.watchers, + }; + + const response = await this.sendRequest< + StreamResponse + >( + 'POST', + '/api/v2/chat/channels/{type}/query', + pathParams, + undefined, + body, + ); + + decoders.ChannelStateResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + deleteChannel = async (request: { + type: string; + id: string; + hard_delete?: boolean; + }): Promise> => { + const queryParams = { + hard_delete: request?.hard_delete, + }; + const pathParams = { + type: request?.type, + id: request?.id, + }; + + const response = await this.sendRequest< + StreamResponse + >('DELETE', '/api/v2/chat/channels/{type}/{id}', pathParams, queryParams); + + decoders.DeleteChannelResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + updateChannelPartial = async ( + request: UpdateChannelPartialRequest & { type: string; id: string }, + ): Promise> => { + const pathParams = { + type: request?.type, + id: request?.id, + }; + const body = { + user_id: request?.user_id, + unset: request?.unset, + set: request?.set, + user: request?.user, + }; + + const response = await this.sendRequest< + StreamResponse + >( + 'PATCH', + '/api/v2/chat/channels/{type}/{id}', + pathParams, + undefined, + body, + ); + + decoders.UpdateChannelPartialResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + updateChannel = async ( + request: UpdateChannelRequest & { type: string; id: string }, + ): Promise> => { + const pathParams = { + type: request?.type, + id: request?.id, + }; + const body = { + accept_invite: request?.accept_invite, + cooldown: request?.cooldown, + hide_history: request?.hide_history, + reject_invite: request?.reject_invite, + skip_push: request?.skip_push, + user_id: request?.user_id, + add_members: request?.add_members, + add_moderators: request?.add_moderators, + assign_roles: request?.assign_roles, + demote_moderators: request?.demote_moderators, + invites: request?.invites, + remove_members: request?.remove_members, + data: request?.data, + message: request?.message, + user: request?.user, + }; + + const response = await this.sendRequest< + StreamResponse + >('POST', '/api/v2/chat/channels/{type}/{id}', pathParams, undefined, body); + + decoders.UpdateChannelResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + sendEvent = async ( + request: SendEventRequest & { type: string; id: string }, + ): Promise> => { + const pathParams = { + type: request?.type, + id: request?.id, + }; + const body = { + event: request?.event, + }; + + const response = await this.sendRequest>( + 'POST', + '/api/v2/chat/channels/{type}/{id}/event', + pathParams, + undefined, + body, + ); + + decoders.EventResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + deleteFile = async (request: { + type: string; + id: string; + url?: string; + }): Promise> => { + const queryParams = { + url: request?.url, + }; + const pathParams = { + type: request?.type, + id: request?.id, + }; + + const response = await this.sendRequest>( + 'DELETE', + '/api/v2/chat/channels/{type}/{id}/file', + pathParams, + queryParams, + ); + + decoders.Response?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + uploadFile = async ( + request: FileUploadRequest & { type: string; id: string }, + ): Promise> => { + const pathParams = { + type: request?.type, + id: request?.id, + }; + const body = { + file: request?.file, + user: request?.user, + }; + + const response = await this.sendRequest>( + 'POST', + '/api/v2/chat/channels/{type}/{id}/file', + pathParams, + undefined, + body, + ); + + decoders.FileUploadResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + hideChannel = async ( + request: HideChannelRequest & { type: string; id: string }, + ): Promise> => { + const pathParams = { + type: request?.type, + id: request?.id, + }; + const body = { + clear_history: request?.clear_history, + user_id: request?.user_id, + user: request?.user, + }; + + const response = await this.sendRequest< + StreamResponse + >( + 'POST', + '/api/v2/chat/channels/{type}/{id}/hide', + pathParams, + undefined, + body, + ); + + decoders.HideChannelResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + deleteImage = async (request: { + type: string; + id: string; + url?: string; + }): Promise> => { + const queryParams = { + url: request?.url, + }; + const pathParams = { + type: request?.type, + id: request?.id, + }; + + const response = await this.sendRequest>( + 'DELETE', + '/api/v2/chat/channels/{type}/{id}/image', + pathParams, + queryParams, + ); + + decoders.Response?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + uploadImage = async ( + request: ImageUploadRequest & { type: string; id: string }, + ): Promise> => { + const pathParams = { + type: request?.type, + id: request?.id, + }; + const body = { + file: request?.file, + upload_sizes: request?.upload_sizes, + user: request?.user, + }; + + const response = await this.sendRequest< + StreamResponse + >( + 'POST', + '/api/v2/chat/channels/{type}/{id}/image', + pathParams, + undefined, + body, + ); + + decoders.ImageUploadResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + sendMessage = async ( + request: SendMessageRequest & { type: string; id: string }, + ): Promise> => { + const pathParams = { + type: request?.type, + id: request?.id, + }; + const body = { + message: request?.message, + force_moderation: request?.force_moderation, + keep_channel_hidden: request?.keep_channel_hidden, + pending: request?.pending, + skip_enrich_url: request?.skip_enrich_url, + skip_push: request?.skip_push, + pending_message_metadata: request?.pending_message_metadata, + }; + + const response = await this.sendRequest< + StreamResponse + >( + 'POST', + '/api/v2/chat/channels/{type}/{id}/message', + pathParams, + undefined, + body, + ); + + decoders.SendMessageResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + getManyMessages = async (request: { + type: string; + id: string; + ids: string[]; + }): Promise> => { + const queryParams = { + ids: request?.ids, + }; + const pathParams = { + type: request?.type, + id: request?.id, + }; + + const response = await this.sendRequest< + StreamResponse + >( + 'GET', + '/api/v2/chat/channels/{type}/{id}/messages', + pathParams, + queryParams, + ); + + decoders.GetManyMessagesResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + getOrCreateChannel = async ( + request: ChannelGetOrCreateRequest & { type: string; id: string }, + ): Promise> => { + const pathParams = { + type: request?.type, + id: request?.id, + }; + const body = { + hide_for_creator: request?.hide_for_creator, + state: request?.state, + thread_unread_counts: request?.thread_unread_counts, + data: request?.data, + members: request?.members, + messages: request?.messages, + watchers: request?.watchers, + }; + + const response = await this.sendRequest< + StreamResponse + >( + 'POST', + '/api/v2/chat/channels/{type}/{id}/query', + pathParams, + undefined, + body, + ); + + decoders.ChannelStateResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + markRead = async ( + request: MarkReadRequest & { type: string; id: string }, + ): Promise> => { + const pathParams = { + type: request?.type, + id: request?.id, + }; + const body = { + message_id: request?.message_id, + thread_id: request?.thread_id, + user_id: request?.user_id, + user: request?.user, + }; + + const response = await this.sendRequest>( + 'POST', + '/api/v2/chat/channels/{type}/{id}/read', + pathParams, + undefined, + body, + ); + + decoders.MarkReadResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + showChannel = async ( + request: ShowChannelRequest & { type: string; id: string }, + ): Promise> => { + const pathParams = { + type: request?.type, + id: request?.id, + }; + const body = { + user_id: request?.user_id, + user: request?.user, + }; + + const response = await this.sendRequest< + StreamResponse + >( + 'POST', + '/api/v2/chat/channels/{type}/{id}/show', + pathParams, + undefined, + body, + ); + + decoders.ShowChannelResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + truncateChannel = async ( + request: TruncateChannelRequest & { type: string; id: string }, + ): Promise> => { + const pathParams = { + type: request?.type, + id: request?.id, + }; + const body = { + hard_delete: request?.hard_delete, + skip_push: request?.skip_push, + truncated_at: request?.truncated_at, + user_id: request?.user_id, + message: request?.message, + user: request?.user, + }; + + const response = await this.sendRequest< + StreamResponse + >( + 'POST', + '/api/v2/chat/channels/{type}/{id}/truncate', + pathParams, + undefined, + body, + ); + + decoders.TruncateChannelResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + markUnread = async ( + request: MarkUnreadRequest & { type: string; id: string }, + ): Promise> => { + const pathParams = { + type: request?.type, + id: request?.id, + }; + const body = { + message_id: request?.message_id, + thread_id: request?.thread_id, + user_id: request?.user_id, + user: request?.user, + }; + + const response = await this.sendRequest>( + 'POST', + '/api/v2/chat/channels/{type}/{id}/unread', + pathParams, + undefined, + body, + ); + + decoders.Response?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + listChannelTypes = async (): Promise< + StreamResponse + > => { + const response = await this.sendRequest< + StreamResponse + >('GET', '/api/v2/chat/channeltypes', undefined, undefined); + + decoders.ListChannelTypesResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + createChannelType = async ( + request: CreateChannelTypeRequest, + ): Promise> => { + const body = { + automod: request?.automod, + automod_behavior: request?.automod_behavior, + max_message_length: request?.max_message_length, + name: request?.name, + blocklist: request?.blocklist, + blocklist_behavior: request?.blocklist_behavior, + connect_events: request?.connect_events, + custom_events: request?.custom_events, + mark_messages_pending: request?.mark_messages_pending, + message_retention: request?.message_retention, + mutes: request?.mutes, + polls: request?.polls, + push_notifications: request?.push_notifications, + reactions: request?.reactions, + read_events: request?.read_events, + replies: request?.replies, + search: request?.search, + typing_events: request?.typing_events, + uploads: request?.uploads, + url_enrichment: request?.url_enrichment, + blocklists: request?.blocklists, + commands: request?.commands, + permissions: request?.permissions, + grants: request?.grants, + }; + + const response = await this.sendRequest< + StreamResponse + >('POST', '/api/v2/chat/channeltypes', undefined, undefined, body); + + decoders.CreateChannelTypeResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + deleteChannelType = async (request: { + name: string; + }): Promise> => { + const pathParams = { + name: request?.name, + }; + + const response = await this.sendRequest>( + 'DELETE', + '/api/v2/chat/channeltypes/{name}', + pathParams, + undefined, + ); + + decoders.Response?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + getChannelType = async (request: { + name: string; + }): Promise> => { + const pathParams = { + name: request?.name, + }; + + const response = await this.sendRequest< + StreamResponse + >('GET', '/api/v2/chat/channeltypes/{name}', pathParams, undefined); + + decoders.GetChannelTypeResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + updateChannelType = async ( + request: UpdateChannelTypeRequest & { name: string }, + ): Promise> => { + const pathParams = { + name: request?.name, + }; + const body = { + automod: request?.automod, + automod_behavior: request?.automod_behavior, + max_message_length: request?.max_message_length, + blocklist: request?.blocklist, + blocklist_behavior: request?.blocklist_behavior, + connect_events: request?.connect_events, + custom_events: request?.custom_events, + mark_messages_pending: request?.mark_messages_pending, + mutes: request?.mutes, + polls: request?.polls, + push_notifications: request?.push_notifications, + quotes: request?.quotes, + reactions: request?.reactions, + read_events: request?.read_events, + reminders: request?.reminders, + replies: request?.replies, + search: request?.search, + typing_events: request?.typing_events, + uploads: request?.uploads, + url_enrichment: request?.url_enrichment, + allowed_flag_reasons: request?.allowed_flag_reasons, + blocklists: request?.blocklists, + commands: request?.commands, + permissions: request?.permissions, + automod_thresholds: request?.automod_thresholds, + grants: request?.grants, + }; + + const response = await this.sendRequest< + StreamResponse + >('PUT', '/api/v2/chat/channeltypes/{name}', pathParams, undefined, body); + + decoders.UpdateChannelTypeResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + listCommands = async (): Promise> => { + const response = await this.sendRequest< + StreamResponse + >('GET', '/api/v2/chat/commands', undefined, undefined); + + decoders.ListCommandsResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + createCommand = async ( + request: CreateCommandRequest, + ): Promise> => { + const body = { + description: request?.description, + name: request?.name, + args: request?.args, + set: request?.set, + }; + + const response = await this.sendRequest< + StreamResponse + >('POST', '/api/v2/chat/commands', undefined, undefined, body); + + decoders.CreateCommandResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + deleteCommand = async (request: { + name: string; + }): Promise> => { + const pathParams = { + name: request?.name, + }; + + const response = await this.sendRequest< + StreamResponse + >('DELETE', '/api/v2/chat/commands/{name}', pathParams, undefined); + + decoders.DeleteCommandResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + getCommand = async (request: { + name: string; + }): Promise> => { + const pathParams = { + name: request?.name, + }; + + const response = await this.sendRequest>( + 'GET', + '/api/v2/chat/commands/{name}', + pathParams, + undefined, + ); + + decoders.GetCommandResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + updateCommand = async ( + request: UpdateCommandRequest & { name: string }, + ): Promise> => { + const pathParams = { + name: request?.name, + }; + const body = { + description: request?.description, + args: request?.args, + set: request?.set, + }; + + const response = await this.sendRequest< + StreamResponse + >('PUT', '/api/v2/chat/commands/{name}', pathParams, undefined, body); + + decoders.UpdateCommandResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + exportChannels = async ( + request: ExportChannelsRequest, + ): Promise> => { + const body = { + channels: request?.channels, + clear_deleted_message_text: request?.clear_deleted_message_text, + export_users: request?.export_users, + include_soft_deleted_channels: request?.include_soft_deleted_channels, + include_truncated_messages: request?.include_truncated_messages, + version: request?.version, + }; + + const response = await this.sendRequest< + StreamResponse + >('POST', '/api/v2/chat/export_channels', undefined, undefined, body); + + decoders.ExportChannelsResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + getExportChannelsStatus = async (request: { + id: string; + }): Promise> => { + const pathParams = { + id: request?.id, + }; + + const response = await this.sendRequest< + StreamResponse + >('GET', '/api/v2/chat/export_channels/{id}', pathParams, undefined); + + decoders.GetExportChannelsStatusResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + queryMembers = async (request?: { + payload?: QueryMembersRequest; + }): Promise> => { + const queryParams = { + payload: request?.payload, + }; + + const response = await this.sendRequest>( + 'GET', + '/api/v2/chat/members', + undefined, + queryParams, + ); + + decoders.MembersResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + queryMessageHistory = async ( + request: QueryMessageHistoryRequest, + ): Promise> => { + const body = { + filter: request?.filter, + limit: request?.limit, + next: request?.next, + prev: request?.prev, + sort: request?.sort, + }; + + const response = await this.sendRequest< + StreamResponse + >('POST', '/api/v2/chat/messages/history', undefined, undefined, body); + + decoders.QueryMessageHistoryResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + deleteMessage = async (request: { + id: string; + hard?: boolean; + deleted_by?: string; + }): Promise> => { + const queryParams = { + hard: request?.hard, + deleted_by: request?.deleted_by, + }; + const pathParams = { + id: request?.id, + }; + + const response = await this.sendRequest< + StreamResponse + >('DELETE', '/api/v2/chat/messages/{id}', pathParams, queryParams); + + decoders.DeleteMessageResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + getMessage = async (request: { + id: string; + show_deleted_message?: boolean; + }): Promise> => { + const queryParams = { + show_deleted_message: request?.show_deleted_message, + }; + const pathParams = { + id: request?.id, + }; + + const response = await this.sendRequest>( + 'GET', + '/api/v2/chat/messages/{id}', + pathParams, + queryParams, + ); + + decoders.GetMessageResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + updateMessage = async ( + request: UpdateMessageRequest & { id: string }, + ): Promise> => { + const pathParams = { + id: request?.id, + }; + const body = { + message: request?.message, + skip_enrich_url: request?.skip_enrich_url, + }; + + const response = await this.sendRequest< + StreamResponse + >('POST', '/api/v2/chat/messages/{id}', pathParams, undefined, body); + + decoders.UpdateMessageResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + updateMessagePartial = async ( + request: UpdateMessagePartialRequest & { id: string }, + ): Promise> => { + const pathParams = { + id: request?.id, + }; + const body = { + skip_enrich_url: request?.skip_enrich_url, + user_id: request?.user_id, + unset: request?.unset, + set: request?.set, + user: request?.user, + }; + + const response = await this.sendRequest< + StreamResponse + >('PUT', '/api/v2/chat/messages/{id}', pathParams, undefined, body); + + decoders.UpdateMessagePartialResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + runMessageAction = async ( + request: MessageActionRequest & { id: string }, + ): Promise> => { + const pathParams = { + id: request?.id, + }; + const body = { + form_data: request?.form_data, + user_id: request?.user_id, + user: request?.user, + }; + + const response = await this.sendRequest>( + 'POST', + '/api/v2/chat/messages/{id}/action', + pathParams, + undefined, + body, + ); + + decoders.MessageResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + commitMessage = async ( + request: CommitMessageRequest & { id: string }, + ): Promise> => { + const pathParams = { + id: request?.id, + }; + const body = {}; + + const response = await this.sendRequest>( + 'POST', + '/api/v2/chat/messages/{id}/commit', + pathParams, + undefined, + body, + ); + + decoders.MessageResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + sendReaction = async ( + request: SendReactionRequest & { id: string }, + ): Promise> => { + const pathParams = { + id: request?.id, + }; + const body = { + reaction: request?.reaction, + enforce_unique: request?.enforce_unique, + skip_push: request?.skip_push, + }; + + const response = await this.sendRequest< + StreamResponse + >( + 'POST', + '/api/v2/chat/messages/{id}/reaction', + pathParams, + undefined, + body, + ); + + decoders.SendReactionResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + deleteReaction = async (request: { + id: string; + type: string; + user_id?: string; + }): Promise> => { + const queryParams = { + user_id: request?.user_id, + }; + const pathParams = { + id: request?.id, + type: request?.type, + }; + + const response = await this.sendRequest< + StreamResponse + >( + 'DELETE', + '/api/v2/chat/messages/{id}/reaction/{type}', + pathParams, + queryParams, + ); + + decoders.ReactionRemovalResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + getReactions = async (request: { + id: string; + limit?: number; + offset?: number; + }): Promise> => { + const queryParams = { + limit: request?.limit, + offset: request?.offset, + }; + const pathParams = { + id: request?.id, + }; + + const response = await this.sendRequest< + StreamResponse + >('GET', '/api/v2/chat/messages/{id}/reactions', pathParams, queryParams); + + decoders.GetReactionsResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + queryReactions = async ( + request: QueryReactionsRequest & { id: string }, + ): Promise> => { + const pathParams = { + id: request?.id, + }; + const body = { + limit: request?.limit, + next: request?.next, + prev: request?.prev, + user_id: request?.user_id, + sort: request?.sort, + filter: request?.filter, + user: request?.user, + }; + + const response = await this.sendRequest< + StreamResponse + >( + 'POST', + '/api/v2/chat/messages/{id}/reactions', + pathParams, + undefined, + body, + ); + + decoders.QueryReactionsResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + translateMessage = async ( + request: TranslateMessageRequest & { id: string }, + ): Promise> => { + const pathParams = { + id: request?.id, + }; + const body = { + language: request?.language, + }; + + const response = await this.sendRequest>( + 'POST', + '/api/v2/chat/messages/{id}/translate', + pathParams, + undefined, + body, + ); + + decoders.MessageResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + undeleteMessage = async ( + request: UpdateMessageRequest & { id: string }, + ): Promise> => { + const pathParams = { + id: request?.id, + }; + const body = { + message: request?.message, + skip_enrich_url: request?.skip_enrich_url, + }; + + const response = await this.sendRequest< + StreamResponse + >( + 'POST', + '/api/v2/chat/messages/{id}/undelete', + pathParams, + undefined, + body, + ); + + decoders.UpdateMessageResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + castPollVote = async ( + request: CastPollVoteRequest & { message_id: string; poll_id: string }, + ): Promise> => { + const pathParams = { + message_id: request?.message_id, + poll_id: request?.poll_id, + }; + const body = { + user_id: request?.user_id, + user: request?.user, + vote: request?.vote, + }; + + const response = await this.sendRequest>( + 'POST', + '/api/v2/chat/messages/{message_id}/polls/{poll_id}/vote', + pathParams, + undefined, + body, + ); + + decoders.PollVoteResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + removePollVote = async (request: { + message_id: string; + poll_id: string; + vote_id: string; + user_id?: string; + }): Promise> => { + const queryParams = { + user_id: request?.user_id, + }; + const pathParams = { + message_id: request?.message_id, + poll_id: request?.poll_id, + vote_id: request?.vote_id, + }; + + const response = await this.sendRequest>( + 'DELETE', + '/api/v2/chat/messages/{message_id}/polls/{poll_id}/vote/{vote_id}', + pathParams, + queryParams, + ); + + decoders.PollVoteResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + getReplies = async (request: { + parent_id: string; + limit?: number; + offset?: number; + id_gte?: string; + id_gt?: string; + id_lte?: string; + id_lt?: string; + created_at_after_or_equal?: Date; + created_at_after?: Date; + created_at_before_or_equal?: Date; + created_at_before?: Date; + id_around?: string; + created_at_around?: Date; + sort?: SortParamRequest[]; + }): Promise> => { + const queryParams = { + limit: request?.limit, + offset: request?.offset, + id_gte: request?.id_gte, + id_gt: request?.id_gt, + id_lte: request?.id_lte, + id_lt: request?.id_lt, + created_at_after_or_equal: request?.created_at_after_or_equal, + created_at_after: request?.created_at_after, + created_at_before_or_equal: request?.created_at_before_or_equal, + created_at_before: request?.created_at_before, + id_around: request?.id_around, + created_at_around: request?.created_at_around, + sort: request?.sort, + }; + const pathParams = { + parent_id: request?.parent_id, + }; + + const response = await this.sendRequest>( + 'GET', + '/api/v2/chat/messages/{parent_id}/replies', + pathParams, + queryParams, + ); + + decoders.GetRepliesResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + queryMessageFlags = async (request?: { + payload?: QueryMessageFlagsRequest; + }): Promise> => { + const queryParams = { + payload: request?.payload, + }; + + const response = await this.sendRequest< + StreamResponse + >('GET', '/api/v2/chat/moderation/flags/message', undefined, queryParams); + + decoders.QueryMessageFlagsResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + muteChannel = async ( + request?: MuteChannelRequest, + ): Promise> => { + const body = { + expiration: request?.expiration, + user_id: request?.user_id, + channel_cids: request?.channel_cids, + user: request?.user, + }; + + const response = await this.sendRequest< + StreamResponse + >( + 'POST', + '/api/v2/chat/moderation/mute/channel', + undefined, + undefined, + body, + ); + + decoders.MuteChannelResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + unmuteChannel = async ( + request?: UnmuteChannelRequest, + ): Promise> => { + const body = { + expiration: request?.expiration, + user_id: request?.user_id, + channel_cids: request?.channel_cids, + user: request?.user, + }; + + const response = await this.sendRequest>( + 'POST', + '/api/v2/chat/moderation/unmute/channel', + undefined, + undefined, + body, + ); + + decoders.UnmuteResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + createPoll = async ( + request: CreatePollRequest, + ): Promise> => { + const body = { + name: request?.name, + allow_answers: request?.allow_answers, + allow_user_suggested_options: request?.allow_user_suggested_options, + description: request?.description, + enforce_unique_vote: request?.enforce_unique_vote, + id: request?.id, + is_closed: request?.is_closed, + max_votes_allowed: request?.max_votes_allowed, + user_id: request?.user_id, + voting_visibility: request?.voting_visibility, + options: request?.options, + custom: request?.custom, + user: request?.user, + }; + + const response = await this.sendRequest>( + 'POST', + '/api/v2/chat/polls', + undefined, + undefined, + body, + ); + + decoders.PollResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + updatePoll = async ( + request: UpdatePollRequest, + ): Promise> => { + const body = { + id: request?.id, + name: request?.name, + allow_answers: request?.allow_answers, + allow_user_suggested_options: request?.allow_user_suggested_options, + description: request?.description, + enforce_unique_vote: request?.enforce_unique_vote, + is_closed: request?.is_closed, + max_votes_allowed: request?.max_votes_allowed, + user_id: request?.user_id, + voting_visibility: request?.voting_visibility, + options: request?.options, + custom: request?.custom, + user: request?.user, + }; + + const response = await this.sendRequest>( + 'PUT', + '/api/v2/chat/polls', + undefined, + undefined, + body, + ); + + decoders.PollResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + queryPolls = async ( + request?: QueryPollsRequest & { user_id?: string }, + ): Promise> => { + const queryParams = { + user_id: request?.user_id, + }; + const body = { + limit: request?.limit, + next: request?.next, + prev: request?.prev, + sort: request?.sort, + filter: request?.filter, + }; + + const response = await this.sendRequest>( + 'POST', + '/api/v2/chat/polls/query', + undefined, + queryParams, + body, + ); + + decoders.QueryPollsResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + deletePoll = async (request: { + poll_id: string; + user_id?: string; + }): Promise> => { + const queryParams = { + user_id: request?.user_id, + }; + const pathParams = { + poll_id: request?.poll_id, + }; + + const response = await this.sendRequest>( + 'DELETE', + '/api/v2/chat/polls/{poll_id}', + pathParams, + queryParams, + ); + + decoders.Response?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + getPoll = async (request: { + poll_id: string; + user_id?: string; + }): Promise> => { + const queryParams = { + user_id: request?.user_id, + }; + const pathParams = { + poll_id: request?.poll_id, + }; + + const response = await this.sendRequest>( + 'GET', + '/api/v2/chat/polls/{poll_id}', + pathParams, + queryParams, + ); + + decoders.PollResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + updatePollPartial = async ( + request: UpdatePollPartialRequest & { poll_id: string }, + ): Promise> => { + const pathParams = { + poll_id: request?.poll_id, + }; + const body = { + user_id: request?.user_id, + unset: request?.unset, + set: request?.set, + user: request?.user, + }; + + const response = await this.sendRequest>( + 'PATCH', + '/api/v2/chat/polls/{poll_id}', + pathParams, + undefined, + body, + ); + + decoders.PollResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + createPollOption = async ( + request: CreatePollOptionRequest & { poll_id: string }, + ): Promise> => { + const pathParams = { + poll_id: request?.poll_id, + }; + const body = { + text: request?.text, + position: request?.position, + user_id: request?.user_id, + custom: request?.custom, + user: request?.user, + }; + + const response = await this.sendRequest>( + 'POST', + '/api/v2/chat/polls/{poll_id}/options', + pathParams, + undefined, + body, + ); + + decoders.PollOptionResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + updatePollOption = async ( + request: UpdatePollOptionRequest & { poll_id: string }, + ): Promise> => { + const pathParams = { + poll_id: request?.poll_id, + }; + const body = { + id: request?.id, + text: request?.text, + user_id: request?.user_id, + custom: request?.custom, + user: request?.user, + }; + + const response = await this.sendRequest>( + 'PUT', + '/api/v2/chat/polls/{poll_id}/options', + pathParams, + undefined, + body, + ); + + decoders.PollOptionResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + deletePollOption = async (request: { + poll_id: string; + option_id: string; + user_id?: string; + }): Promise> => { + const queryParams = { + user_id: request?.user_id, + }; + const pathParams = { + poll_id: request?.poll_id, + option_id: request?.option_id, + }; + + const response = await this.sendRequest>( + 'DELETE', + '/api/v2/chat/polls/{poll_id}/options/{option_id}', + pathParams, + queryParams, + ); + + decoders.Response?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + getPollOption = async (request: { + poll_id: string; + option_id: string; + user_id?: string; + }): Promise> => { + const queryParams = { + user_id: request?.user_id, + }; + const pathParams = { + poll_id: request?.poll_id, + option_id: request?.option_id, + }; + + const response = await this.sendRequest>( + 'GET', + '/api/v2/chat/polls/{poll_id}/options/{option_id}', + pathParams, + queryParams, + ); + + decoders.PollOptionResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + queryPollVotes = async ( + request: QueryPollVotesRequest & { poll_id: string; user_id?: string }, + ): Promise> => { + const queryParams = { + user_id: request?.user_id, + }; + const pathParams = { + poll_id: request?.poll_id, + }; + const body = { + limit: request?.limit, + next: request?.next, + prev: request?.prev, + sort: request?.sort, + filter: request?.filter, + }; + + const response = await this.sendRequest>( + 'POST', + '/api/v2/chat/polls/{poll_id}/votes', + pathParams, + queryParams, + body, + ); + + decoders.PollVotesResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + queryBannedUsers = async (request?: { + payload?: QueryBannedUsersRequest; + }): Promise> => { + const queryParams = { + payload: request?.payload, + }; + + const response = await this.sendRequest< + StreamResponse + >('GET', '/api/v2/chat/query_banned_users', undefined, queryParams); + + decoders.QueryBannedUsersResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + search = async (request?: { + payload?: SearchRequest; + }): Promise> => { + const queryParams = { + payload: request?.payload, + }; + + const response = await this.sendRequest>( + 'GET', + '/api/v2/chat/search', + undefined, + queryParams, + ); + + decoders.SearchResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + queryThreads = async ( + request?: QueryThreadsRequest, + ): Promise> => { + const body = { + limit: request?.limit, + member_limit: request?.member_limit, + next: request?.next, + participant_limit: request?.participant_limit, + prev: request?.prev, + reply_limit: request?.reply_limit, + user_id: request?.user_id, + user: request?.user, + }; + + const response = await this.sendRequest< + StreamResponse + >('POST', '/api/v2/chat/threads', undefined, undefined, body); + + decoders.QueryThreadsResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + getThread = async (request: { + message_id: string; + connection_id?: string; + reply_limit?: number; + participant_limit?: number; + member_limit?: number; + }): Promise> => { + const queryParams = { + connection_id: request?.connection_id, + reply_limit: request?.reply_limit, + participant_limit: request?.participant_limit, + member_limit: request?.member_limit, + }; + const pathParams = { + message_id: request?.message_id, + }; + + const response = await this.sendRequest>( + 'GET', + '/api/v2/chat/threads/{message_id}', + pathParams, + queryParams, + ); + + decoders.GetThreadResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + updateThreadPartial = async ( + request: UpdateThreadPartialRequest & { message_id: string }, + ): Promise> => { + const pathParams = { + message_id: request?.message_id, + }; + const body = { + user_id: request?.user_id, + unset: request?.unset, + set: request?.set, + user: request?.user, + }; + + const response = await this.sendRequest< + StreamResponse + >( + 'PATCH', + '/api/v2/chat/threads/{message_id}', + pathParams, + undefined, + body, + ); + + decoders.UpdateThreadPartialResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + unreadCounts = async (): Promise< + StreamResponse + > => { + const response = await this.sendRequest< + StreamResponse + >('GET', '/api/v2/chat/unread', undefined, undefined); + + decoders.WrappedUnreadCountsResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + unreadCountsBatch = async ( + request: UnreadCountsBatchRequest, + ): Promise> => { + const body = { + user_ids: request?.user_ids, + }; + + const response = await this.sendRequest< + StreamResponse + >('POST', '/api/v2/chat/unread_batch', undefined, undefined, body); + + decoders.UnreadCountsBatchResponse?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; + + sendUserCustomEvent = async ( + request: SendUserCustomEventRequest & { user_id: string }, + ): Promise> => { + const pathParams = { + user_id: request?.user_id, + }; + const body = { + event: request?.event, + }; + + const response = await this.sendRequest>( + 'POST', + '/api/v2/chat/users/{user_id}/event', + pathParams, + undefined, + body, + ); + + decoders.Response?.(response.body); + + return { ...response.body, metadata: response.metadata }; + }; +} diff --git a/src/gen/chat/apis/ProductchatApi.ts b/src/gen/chat/apis/ProductchatApi.ts deleted file mode 100644 index f8576e6..0000000 --- a/src/gen/chat/apis/ProductchatApi.ts +++ /dev/null @@ -1,7007 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * Stream API - * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - * - * The version of the OpenAPI document: v122.3.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -import * as runtime from '../runtime'; -import type { - APIError, - BanRequest, - BlockUsersRequest, - BlockUsersResponse, - CastPollVoteRequest, - ChannelGetOrCreateRequest, - ChannelStateResponse, - CheckExternalStorageResponse, - CheckPushRequest, - CheckPushResponse, - CheckSNSRequest, - CheckSNSResponse, - CheckSQSRequest, - CheckSQSResponse, - CreateBlockListRequest, - CreateCallRequest, - CreateCallResponse, - CreateChannelTypeRequest, - CreateChannelTypeResponse, - CreateCommandRequest, - CreateCommandResponse, - CreateDeviceRequest, - CreateExternalStorageRequest, - CreateExternalStorageResponse, - CreateGuestRequest, - CreateGuestResponse, - CreateImportRequest, - CreateImportResponse, - CreateImportURLRequest, - CreateImportURLResponse, - CreatePollOptionRequest, - CreatePollRequest, - CreateRoleRequest, - CreateRoleResponse, - DeactivateUserRequest, - DeactivateUserResponse, - DeactivateUsersRequest, - DeactivateUsersResponse, - DeleteChannelResponse, - DeleteChannelsRequest, - DeleteChannelsResponse, - DeleteCommandResponse, - DeleteExternalStorageResponse, - DeleteMessageResponse, - DeleteUsersRequest, - DeleteUsersResponse, - EventResponse, - ExportChannelsRequest, - ExportChannelsResponse, - ExportUserResponse, - ExportUsersRequest, - ExportUsersResponse, - FileDeleteResponse, - FileUploadResponse, - FlagRequest, - FlagResponse, - GetApplicationResponse, - GetBlockListResponse, - GetBlockedUsersResponse, - GetCallTokenRequest, - GetCallTokenResponse, - GetCommandResponse, - GetCustomPermissionResponse, - GetExportChannelsStatusResponse, - GetImportResponse, - GetManyMessagesResponse, - GetMessageResponse, - GetOGResponse, - GetRateLimitsResponse, - GetReactionsResponse, - GetRepliesResponse, - GetTaskResponse, - GetThreadResponse, - HideChannelRequest, - HideChannelResponse, - ImageSize, - ImageUploadResponse, - ListBlockListResponse, - ListChannelTypesResponse, - ListCommandsResponse, - ListDevicesResponse, - ListExternalStorageResponse, - ListImportsResponse, - ListPermissionsResponse, - ListPushProvidersResponse, - ListRolesResponse, - MarkChannelsReadRequest, - MarkReadRequest, - MarkReadResponse, - MarkUnreadRequest, - MembersResponse, - MessageActionRequest, - MessageResponse, - MuteChannelRequest, - MuteChannelResponse, - MuteUserRequest, - MuteUserResponse, - OnlyUserID, - PollOptionResponse, - PollResponse, - PollVoteResponse, - PollVotesResponse, - QueryBannedUsersRequest, - QueryBannedUsersResponse, - QueryChannelsRequest, - QueryChannelsResponse, - QueryMembersRequest, - QueryMessageFlagsRequest, - QueryMessageFlagsResponse, - QueryMessageHistoryRequest, - QueryMessageHistoryResponse, - QueryPollVotesRequest, - QueryPollsRequest, - QueryPollsResponse, - QueryReactionsRequest, - QueryReactionsResponse, - QueryThreadsRequest, - QueryThreadsResponse, - QueryUsersPayload, - QueryUsersResponse, - ReactionRemovalResponse, - ReactivateUserRequest, - ReactivateUserResponse, - ReactivateUsersRequest, - ReactivateUsersResponse, - Response, - RestoreUsersRequest, - SearchRequest, - SearchResponse, - SendEventRequest, - SendMessageRequest, - SendMessageResponse, - SendReactionRequest, - SendReactionResponse, - SendUserCustomEventRequest, - ShowChannelRequest, - ShowChannelResponse, - SortParam, - TranslateMessageRequest, - TruncateChannelRequest, - TruncateChannelResponse, - UnblockUsersRequest, - UnblockUsersResponse, - UnmuteChannelRequest, - UnmuteResponse, - UnmuteUserRequest, - UnreadCountsBatchRequest, - UnreadCountsBatchResponse, - UpdateAppRequest, - UpdateBlockListRequest, - UpdateChannelPartialRequest, - UpdateChannelPartialResponse, - UpdateChannelRequest, - UpdateChannelResponse, - UpdateChannelTypeRequest, - UpdateChannelTypeResponse, - UpdateCommandRequest, - UpdateCommandResponse, - UpdateExternalStorageRequest, - UpdateExternalStorageResponse, - UpdateMessagePartialRequest, - UpdateMessagePartialResponse, - UpdateMessageRequest, - UpdateMessageResponse, - UpdatePollOptionRequest, - UpdatePollPartialRequest, - UpdatePollRequest, - UpdateThreadPartialRequest, - UpdateThreadPartialResponse, - UpdateUsersPartialRequest, - UpdateUsersRequest, - UpdateUsersResponse, - UpsertPushProviderRequest, - UpsertPushProviderResponse, - WrappedUnreadCountsResponse, -} from '../models'; - -export interface BanOperationRequest { - banRequest: BanRequest | null; -} - -export interface BlockUsersOperationRequest { - blockUsersRequest: BlockUsersRequest | null; -} - -export interface CastPollVoteOperationRequest { - messageId: string; - pollId: string; - castPollVoteRequest: CastPollVoteRequest | null; -} - -export interface CheckExternalStorageRequest { - name: string; -} - -export interface CheckPushOperationRequest { - checkPushRequest: CheckPushRequest | null; -} - -export interface CheckSNSOperationRequest { - checkSNSRequest: CheckSNSRequest | null; -} - -export interface CheckSQSOperationRequest { - checkSQSRequest: CheckSQSRequest | null; -} - -export interface CommitMessageRequest { - id: string; -} - -export interface CreateBlockListOperationRequest { - createBlockListRequest: CreateBlockListRequest | null; -} - -export interface CreateCallOperationRequest { - type: string; - id: string; - createCallRequest: CreateCallRequest | null; -} - -export interface CreateChannelTypeOperationRequest { - createChannelTypeRequest: CreateChannelTypeRequest | null; -} - -export interface CreateCommandOperationRequest { - createCommandRequest: CreateCommandRequest | null; -} - -export interface CreateDeviceOperationRequest { - createDeviceRequest: CreateDeviceRequest | null; -} - -export interface CreateExternalStorageOperationRequest { - createExternalStorageRequest: CreateExternalStorageRequest | null; -} - -export interface CreateGuestOperationRequest { - createGuestRequest: CreateGuestRequest | null; -} - -export interface CreateImportOperationRequest { - createImportRequest: CreateImportRequest | null; -} - -export interface CreateImportURLOperationRequest { - createImportURLRequest: CreateImportURLRequest | null; -} - -export interface CreatePollOperationRequest { - createPollRequest: CreatePollRequest | null; -} - -export interface CreatePollOptionOperationRequest { - pollId: string; - createPollOptionRequest: CreatePollOptionRequest | null; -} - -export interface CreateRoleOperationRequest { - createRoleRequest: CreateRoleRequest | null; -} - -export interface DeactivateUserOperationRequest { - userId: string; - deactivateUserRequest: DeactivateUserRequest | null; -} - -export interface DeactivateUsersOperationRequest { - deactivateUsersRequest: DeactivateUsersRequest | null; -} - -export interface DeleteBlockListRequest { - name: string; -} - -export interface DeleteChannelRequest { - type: string; - id: string; - hardDelete?: boolean; -} - -export interface DeleteChannelTypeRequest { - name: string; -} - -export interface DeleteChannelsOperationRequest { - deleteChannelsRequest: DeleteChannelsRequest | null; -} - -export interface DeleteCommandRequest { - name: string; -} - -export interface DeleteDeviceRequest { - id: string; - userId?: string; -} - -export interface DeleteExternalStorageRequest { - name: string; -} - -export interface DeleteFileRequest { - type: string; - id: string; - url?: string; -} - -export interface DeleteImageRequest { - type: string; - id: string; - url?: string; -} - -export interface DeleteMessageRequest { - id: string; - hard?: boolean; - deletedBy?: string; -} - -export interface DeletePollRequest { - pollId: string; - userId?: string; -} - -export interface DeletePollOptionRequest { - pollId: string; - optionId: string; - userId?: string; -} - -export interface DeletePushProviderRequest { - type: DeletePushProviderTypeEnum; - name: string; -} - -export interface DeleteReactionRequest { - id: string; - type: string; - userId?: string; -} - -export interface DeleteRoleRequest { - name: string; -} - -export interface DeleteUsersOperationRequest { - deleteUsersRequest: DeleteUsersRequest | null; -} - -export interface ExportChannelsOperationRequest { - exportChannelsRequest: ExportChannelsRequest | null; -} - -export interface ExportUserRequest { - userId: string; -} - -export interface ExportUsersOperationRequest { - exportUsersRequest: ExportUsersRequest | null; -} - -export interface FlagOperationRequest { - flagRequest: FlagRequest | null; -} - -export interface GetBlockListRequest { - name: string; -} - -export interface GetBlockedUsersRequest { - userId?: string; -} - -export interface GetCallTokenOperationRequest { - getCallTokenRequest: GetCallTokenRequest | null; -} - -export interface GetCallToken0Request { - callId: string; - getCallTokenRequest: GetCallTokenRequest | null; -} - -export interface GetChannelTypeRequest { - name: string; -} - -export interface GetCommandRequest { - name: string; -} - -export interface GetExportChannelsStatusRequest { - id: string; -} - -export interface GetImportRequest { - id: string; -} - -export interface GetManyMessagesRequest { - type: string; - id: string; - ids: Array; -} - -export interface GetMessageRequest { - id: string; - showDeletedMessage?: boolean; -} - -export interface GetOGRequest { - url: string; -} - -export interface GetOrCreateChannelRequest { - type: string; - id: string; - channelGetOrCreateRequest: ChannelGetOrCreateRequest | null; -} - -export interface GetOrCreateDistinctChannelRequest { - type: string; - channelGetOrCreateRequest: ChannelGetOrCreateRequest | null; -} - -export interface GetPermissionRequest { - id: string; -} - -export interface GetPollRequest { - pollId: string; - userId?: string; -} - -export interface GetPollOptionRequest { - pollId: string; - optionId: string; - userId?: string; -} - -export interface GetRateLimitsRequest { - serverSide?: boolean; - android?: boolean; - ios?: boolean; - web?: boolean; - endpoints?: string; -} - -export interface GetReactionsRequest { - id: string; - limit?: number; - offset?: number; -} - -export interface GetRepliesRequest { - parentId: string; - sort?: Array; - limit?: number; - offset?: number; - idGte?: string; - idGt?: string; - idLte?: string; - idLt?: string; - createdAtAfterOrEqual?: string; - createdAtAfter?: string; - createdAtBeforeOrEqual?: string; - createdAtBefore?: string; - idAround?: string; - createdAtAround?: string; -} - -export interface GetTaskRequest { - id: string; -} - -export interface GetThreadRequest { - messageId: string; - connectionId?: string; - replyLimit?: number; - participantLimit?: number; - memberLimit?: number; -} - -export interface HideChannelOperationRequest { - type: string; - id: string; - hideChannelRequest: HideChannelRequest | null; -} - -export interface ListDevicesRequest { - userId?: string; -} - -export interface MarkChannelsReadOperationRequest { - markChannelsReadRequest: MarkChannelsReadRequest | null; -} - -export interface MarkReadOperationRequest { - type: string; - id: string; - markReadRequest: MarkReadRequest | null; -} - -export interface MarkUnreadOperationRequest { - type: string; - id: string; - markUnreadRequest: MarkUnreadRequest | null; -} - -export interface MuteChannelOperationRequest { - muteChannelRequest: MuteChannelRequest | null; -} - -export interface MuteUserOperationRequest { - muteUserRequest: MuteUserRequest | null; -} - -export interface QueryBannedUsersOperationRequest { - payload?: QueryBannedUsersRequest; -} - -export interface QueryChannelsOperationRequest { - queryChannelsRequest: QueryChannelsRequest | null; -} - -export interface QueryMembersOperationRequest { - payload?: QueryMembersRequest; -} - -export interface QueryMessageFlagsOperationRequest { - payload?: QueryMessageFlagsRequest; -} - -export interface QueryMessageHistoryOperationRequest { - queryMessageHistoryRequest: QueryMessageHistoryRequest | null; -} - -export interface QueryPollVotesOperationRequest { - pollId: string; - queryPollVotesRequest: QueryPollVotesRequest | null; - userId?: string; -} - -export interface QueryPollsOperationRequest { - queryPollsRequest: QueryPollsRequest | null; - userId?: string; -} - -export interface QueryReactionsOperationRequest { - id: string; - queryReactionsRequest: QueryReactionsRequest; -} - -export interface QueryThreadsOperationRequest { - queryThreadsRequest: QueryThreadsRequest | null; -} - -export interface QueryUsersRequest { - payload?: QueryUsersPayload; -} - -export interface ReactivateUserOperationRequest { - userId: string; - reactivateUserRequest: ReactivateUserRequest | null; -} - -export interface ReactivateUsersOperationRequest { - reactivateUsersRequest: ReactivateUsersRequest | null; -} - -export interface RemovePollVoteRequest { - messageId: string; - pollId: string; - voteId: string; - userId?: string; -} - -export interface RestoreUsersOperationRequest { - restoreUsersRequest: RestoreUsersRequest | null; -} - -export interface RunMessageActionRequest { - id: string; - messageActionRequest: MessageActionRequest | null; -} - -export interface SearchOperationRequest { - payload?: SearchRequest; -} - -export interface SendEventOperationRequest { - type: string; - id: string; - sendEventRequest: SendEventRequest | null; -} - -export interface SendMessageOperationRequest { - type: string; - id: string; - sendMessageRequest: SendMessageRequest | null; -} - -export interface SendReactionOperationRequest { - id: string; - sendReactionRequest: SendReactionRequest | null; -} - -export interface SendUserCustomEventOperationRequest { - userId: string; - sendUserCustomEventRequest: SendUserCustomEventRequest | null; -} - -export interface ShowChannelOperationRequest { - type: string; - id: string; - showChannelRequest: ShowChannelRequest | null; -} - -export interface TranslateMessageOperationRequest { - id: string; - translateMessageRequest: TranslateMessageRequest | null; -} - -export interface TruncateChannelOperationRequest { - type: string; - id: string; - truncateChannelRequest: TruncateChannelRequest | null; -} - -export interface UnbanRequest { - targetUserId: string; - channelCid?: string; - createdBy?: string; -} - -export interface UnblockUsersOperationRequest { - unblockUsersRequest: UnblockUsersRequest | null; -} - -export interface UndeleteMessageRequest { - id: string; - updateMessageRequest: UpdateMessageRequest | null; -} - -export interface UnmuteChannelOperationRequest { - unmuteChannelRequest: UnmuteChannelRequest | null; -} - -export interface UnmuteUserOperationRequest { - unmuteUserRequest: UnmuteUserRequest | null; -} - -export interface UnreadCountsBatchOperationRequest { - unreadCountsBatchRequest: UnreadCountsBatchRequest | null; -} - -export interface UpdateAppOperationRequest { - updateAppRequest: UpdateAppRequest | null; -} - -export interface UpdateBlockListOperationRequest { - name: string; - updateBlockListRequest: UpdateBlockListRequest | null; -} - -export interface UpdateChannelOperationRequest { - type: string; - id: string; - updateChannelRequest: UpdateChannelRequest | null; -} - -export interface UpdateChannelPartialOperationRequest { - type: string; - id: string; - updateChannelPartialRequest: UpdateChannelPartialRequest | null; -} - -export interface UpdateChannelTypeOperationRequest { - name: string; - updateChannelTypeRequest: UpdateChannelTypeRequest | null; -} - -export interface UpdateCommandOperationRequest { - name: string; - updateCommandRequest: UpdateCommandRequest | null; -} - -export interface UpdateExternalStorageOperationRequest { - name: string; - updateExternalStorageRequest: UpdateExternalStorageRequest | null; -} - -export interface UpdateMessageOperationRequest { - id: string; - updateMessageRequest: UpdateMessageRequest | null; -} - -export interface UpdateMessagePartialOperationRequest { - id: string; - updateMessagePartialRequest: UpdateMessagePartialRequest | null; -} - -export interface UpdatePollOperationRequest { - updatePollRequest: UpdatePollRequest | null; -} - -export interface UpdatePollOptionOperationRequest { - pollId: string; - updatePollOptionRequest: UpdatePollOptionRequest | null; -} - -export interface UpdatePollPartialOperationRequest { - pollId: string; - updatePollPartialRequest: UpdatePollPartialRequest | null; -} - -export interface UpdateThreadPartialOperationRequest { - messageId: string; - updateThreadPartialRequest: UpdateThreadPartialRequest | null; -} - -export interface UpdateUsersOperationRequest { - updateUsersRequest: UpdateUsersRequest | null; -} - -export interface UpdateUsersPartialOperationRequest { - updateUsersPartialRequest: UpdateUsersPartialRequest | null; -} - -export interface UploadFileRequest { - type: string; - id: string; - file?: string; - user?: OnlyUserID; -} - -export interface UploadImageRequest { - type: string; - id: string; - file?: string; - uploadSizes?: Array; - user?: OnlyUserID; -} - -export interface UpsertPushProviderOperationRequest { - upsertPushProviderRequest: UpsertPushProviderRequest | null; -} - -/** - * - */ -export class ProductchatApi extends runtime.BaseAPI { - - /** - * Restricts user activity either in specific channel or globally Sends events: - user.banned Required permissions: - BanChannelMember - BanUser - * Ban user - */ - async banRaw(requestParameters: BanOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.banRequest === null || requestParameters.banRequest === undefined) { - throw new runtime.RequiredError('banRequest','Required parameter requestParameters.banRequest was null or undefined when calling ban.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/moderation/ban`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.banRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Restricts user activity either in specific channel or globally Sends events: - user.banned Required permissions: - BanChannelMember - BanUser - * Ban user - */ - async ban(requestParameters: BanOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.banRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Block users - * Block user - */ - async blockUsersRaw(requestParameters: BlockUsersOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.blockUsersRequest === null || requestParameters.blockUsersRequest === undefined) { - throw new runtime.RequiredError('blockUsersRequest','Required parameter requestParameters.blockUsersRequest was null or undefined when calling blockUsers.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/users/block`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.blockUsersRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Block users - * Block user - */ - async blockUsers(requestParameters: BlockUsersOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.blockUsersRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Cast a vote on a poll Sends events: - poll.vote_casted Required permissions: - CastVote - * Cast vote - */ - async castPollVoteRaw(requestParameters: CastPollVoteOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.messageId === null || requestParameters.messageId === undefined) { - throw new runtime.RequiredError('messageId','Required parameter requestParameters.messageId was null or undefined when calling castPollVote.'); - } - - if (requestParameters.pollId === null || requestParameters.pollId === undefined) { - throw new runtime.RequiredError('pollId','Required parameter requestParameters.pollId was null or undefined when calling castPollVote.'); - } - - if (requestParameters.castPollVoteRequest === null || requestParameters.castPollVoteRequest === undefined) { - throw new runtime.RequiredError('castPollVoteRequest','Required parameter requestParameters.castPollVoteRequest was null or undefined when calling castPollVote.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/messages/{message_id}/polls/{poll_id}/vote`.replace(`{${"message_id"}}`, encodeURIComponent(String(requestParameters.messageId))).replace(`{${"poll_id"}}`, encodeURIComponent(String(requestParameters.pollId))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.castPollVoteRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Cast a vote on a poll Sends events: - poll.vote_casted Required permissions: - CastVote - * Cast vote - */ - async castPollVote(requestParameters: CastPollVoteOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.castPollVoteRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * - * Check External Storage - */ - async checkExternalStorageRaw(requestParameters: CheckExternalStorageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.name === null || requestParameters.name === undefined) { - throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling checkExternalStorage.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/external_storage/{name}/check`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * - * Check External Storage - */ - async checkExternalStorage(requestParameters: CheckExternalStorageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.checkExternalStorageRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Sends a test message via push, this is a test endpoint to verify your push settings - * Check push - */ - async checkPushRaw(requestParameters: CheckPushOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.checkPushRequest === null || requestParameters.checkPushRequest === undefined) { - throw new runtime.RequiredError('checkPushRequest','Required parameter requestParameters.checkPushRequest was null or undefined when calling checkPush.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/check_push`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.checkPushRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Sends a test message via push, this is a test endpoint to verify your push settings - * Check push - */ - async checkPush(requestParameters: CheckPushOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.checkPushRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Validates Amazon SNS configuration - * Check SNS - */ - async checkSNSRaw(requestParameters: CheckSNSOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.checkSNSRequest === null || requestParameters.checkSNSRequest === undefined) { - throw new runtime.RequiredError('checkSNSRequest','Required parameter requestParameters.checkSNSRequest was null or undefined when calling checkSNS.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/check_sns`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.checkSNSRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Validates Amazon SNS configuration - * Check SNS - */ - async checkSNS(requestParameters: CheckSNSOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.checkSNSRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Validates Amazon SQS credentials - * Check SQS - */ - async checkSQSRaw(requestParameters: CheckSQSOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.checkSQSRequest === null || requestParameters.checkSQSRequest === undefined) { - throw new runtime.RequiredError('checkSQSRequest','Required parameter requestParameters.checkSQSRequest was null or undefined when calling checkSQS.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/check_sqs`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.checkSQSRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Validates Amazon SQS credentials - * Check SQS - */ - async checkSQS(requestParameters: CheckSQSOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.checkSQSRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Commits a pending message, which will make it visible in the channel Sends events: - message.new - message.updated - * Commit message - */ - async commitMessageRaw(requestParameters: CommitMessageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling commitMessage.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/messages/{id}/commit`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Commits a pending message, which will make it visible in the channel Sends events: - message.new - message.updated - * Commit message - */ - async commitMessage(requestParameters: CommitMessageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.commitMessageRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Creates a new application blocklist, once created the blocklist can be used by any channel type - * Create block list - */ - async createBlockListRaw(requestParameters: CreateBlockListOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.createBlockListRequest === null || requestParameters.createBlockListRequest === undefined) { - throw new runtime.RequiredError('createBlockListRequest','Required parameter requestParameters.createBlockListRequest was null or undefined when calling createBlockList.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/blocklists`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.createBlockListRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Creates a new application blocklist, once created the blocklist can be used by any channel type - * Create block list - */ - async createBlockList(requestParameters: CreateBlockListOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.createBlockListRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Creates a call Required permissions: - CreateCall - ReadChannel - * Create a call - */ - async createCallRaw(requestParameters: CreateCallOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.type === null || requestParameters.type === undefined) { - throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling createCall.'); - } - - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling createCall.'); - } - - if (requestParameters.createCallRequest === null || requestParameters.createCallRequest === undefined) { - throw new runtime.RequiredError('createCallRequest','Required parameter requestParameters.createCallRequest was null or undefined when calling createCall.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/channels/{type}/{id}/call`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.createCallRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Creates a call Required permissions: - CreateCall - ReadChannel - * Create a call - */ - async createCall(requestParameters: CreateCallOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.createCallRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Creates new channel type - * Create channel type - */ - async createChannelTypeRaw(requestParameters: CreateChannelTypeOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.createChannelTypeRequest === null || requestParameters.createChannelTypeRequest === undefined) { - throw new runtime.RequiredError('createChannelTypeRequest','Required parameter requestParameters.createChannelTypeRequest was null or undefined when calling createChannelType.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/channeltypes`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.createChannelTypeRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Creates new channel type - * Create channel type - */ - async createChannelType(requestParameters: CreateChannelTypeOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.createChannelTypeRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Creates custom chat command - * Create command - */ - async createCommandRaw(requestParameters: CreateCommandOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.createCommandRequest === null || requestParameters.createCommandRequest === undefined) { - throw new runtime.RequiredError('createCommandRequest','Required parameter requestParameters.createCommandRequest was null or undefined when calling createCommand.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/commands`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.createCommandRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Creates custom chat command - * Create command - */ - async createCommand(requestParameters: CreateCommandOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.createCommandRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Adds a new device to a user, if the same device already exists the call will have no effect - * Create device - */ - async createDeviceRaw(requestParameters: CreateDeviceOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.createDeviceRequest === null || requestParameters.createDeviceRequest === undefined) { - throw new runtime.RequiredError('createDeviceRequest','Required parameter requestParameters.createDeviceRequest was null or undefined when calling createDevice.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/devices`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.createDeviceRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Adds a new device to a user, if the same device already exists the call will have no effect - * Create device - */ - async createDevice(requestParameters: CreateDeviceOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.createDeviceRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Creates new external storage - * Create external storage - */ - async createExternalStorageRaw(requestParameters: CreateExternalStorageOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.createExternalStorageRequest === null || requestParameters.createExternalStorageRequest === undefined) { - throw new runtime.RequiredError('createExternalStorageRequest','Required parameter requestParameters.createExternalStorageRequest was null or undefined when calling createExternalStorage.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/external_storage`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.createExternalStorageRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Creates new external storage - * Create external storage - */ - async createExternalStorage(requestParameters: CreateExternalStorageOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.createExternalStorageRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * - * Create Guest - */ - async createGuestRaw(requestParameters: CreateGuestOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.createGuestRequest === null || requestParameters.createGuestRequest === undefined) { - throw new runtime.RequiredError('createGuestRequest','Required parameter requestParameters.createGuestRequest was null or undefined when calling createGuest.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/guest`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.createGuestRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * - * Create Guest - */ - async createGuest(requestParameters: CreateGuestOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.createGuestRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Creates a new import - * Create import - */ - async createImportRaw(requestParameters: CreateImportOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.createImportRequest === null || requestParameters.createImportRequest === undefined) { - throw new runtime.RequiredError('createImportRequest','Required parameter requestParameters.createImportRequest was null or undefined when calling createImport.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/imports`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.createImportRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Creates a new import - * Create import - */ - async createImport(requestParameters: CreateImportOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.createImportRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Creates a new import URL - * Create import URL - */ - async createImportURLRaw(requestParameters: CreateImportURLOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.createImportURLRequest === null || requestParameters.createImportURLRequest === undefined) { - throw new runtime.RequiredError('createImportURLRequest','Required parameter requestParameters.createImportURLRequest was null or undefined when calling createImportURL.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/import_urls`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.createImportURLRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Creates a new import URL - * Create import URL - */ - async createImportURL(requestParameters: CreateImportURLOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.createImportURLRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Creates a new poll Required permissions: - CreatePoll - * Create poll - */ - async createPollRaw(requestParameters: CreatePollOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.createPollRequest === null || requestParameters.createPollRequest === undefined) { - throw new runtime.RequiredError('createPollRequest','Required parameter requestParameters.createPollRequest was null or undefined when calling createPoll.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/polls`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.createPollRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Creates a new poll Required permissions: - CreatePoll - * Create poll - */ - async createPoll(requestParameters: CreatePollOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.createPollRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Creates a poll option Sends events: - poll.updated Required permissions: - CastVote - UpdatePoll - * Create poll option - */ - async createPollOptionRaw(requestParameters: CreatePollOptionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.pollId === null || requestParameters.pollId === undefined) { - throw new runtime.RequiredError('pollId','Required parameter requestParameters.pollId was null or undefined when calling createPollOption.'); - } - - if (requestParameters.createPollOptionRequest === null || requestParameters.createPollOptionRequest === undefined) { - throw new runtime.RequiredError('createPollOptionRequest','Required parameter requestParameters.createPollOptionRequest was null or undefined when calling createPollOption.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/polls/{poll_id}/options`.replace(`{${"poll_id"}}`, encodeURIComponent(String(requestParameters.pollId))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.createPollOptionRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Creates a poll option Sends events: - poll.updated Required permissions: - CastVote - UpdatePoll - * Create poll option - */ - async createPollOption(requestParameters: CreatePollOptionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.createPollOptionRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Creates custom role - * Create role - */ - async createRoleRaw(requestParameters: CreateRoleOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.createRoleRequest === null || requestParameters.createRoleRequest === undefined) { - throw new runtime.RequiredError('createRoleRequest','Required parameter requestParameters.createRoleRequest was null or undefined when calling createRole.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/roles`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.createRoleRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Creates custom role - * Create role - */ - async createRole(requestParameters: CreateRoleOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.createRoleRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Deactivates user with possibility to activate it back Sends events: - user.deactivated - * Deactivate user - */ - async deactivateUserRaw(requestParameters: DeactivateUserOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.userId === null || requestParameters.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling deactivateUser.'); - } - - if (requestParameters.deactivateUserRequest === null || requestParameters.deactivateUserRequest === undefined) { - throw new runtime.RequiredError('deactivateUserRequest','Required parameter requestParameters.deactivateUserRequest was null or undefined when calling deactivateUser.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/users/{user_id}/deactivate`.replace(`{${"user_id"}}`, encodeURIComponent(String(requestParameters.userId))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.deactivateUserRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Deactivates user with possibility to activate it back Sends events: - user.deactivated - * Deactivate user - */ - async deactivateUser(requestParameters: DeactivateUserOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deactivateUserRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Deactivate users in batches Sends events: - user.deactivated - * Deactivate users - */ - async deactivateUsersRaw(requestParameters: DeactivateUsersOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.deactivateUsersRequest === null || requestParameters.deactivateUsersRequest === undefined) { - throw new runtime.RequiredError('deactivateUsersRequest','Required parameter requestParameters.deactivateUsersRequest was null or undefined when calling deactivateUsers.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/users/deactivate`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.deactivateUsersRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Deactivate users in batches Sends events: - user.deactivated - * Deactivate users - */ - async deactivateUsers(requestParameters: DeactivateUsersOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deactivateUsersRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Deletes previously created application blocklist - * Delete block list - */ - async deleteBlockListRaw(requestParameters: DeleteBlockListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.name === null || requestParameters.name === undefined) { - throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling deleteBlockList.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/blocklists/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Deletes previously created application blocklist - * Delete block list - */ - async deleteBlockList(requestParameters: DeleteBlockListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deleteBlockListRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Deletes channel Sends events: - channel.deleted Required permissions: - DeleteChannel - * Delete channel - */ - async deleteChannelRaw(requestParameters: DeleteChannelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.type === null || requestParameters.type === undefined) { - throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling deleteChannel.'); - } - - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling deleteChannel.'); - } - - const queryParameters: any = {}; - - if (requestParameters.hardDelete !== undefined) { - queryParameters['hard_delete'] = requestParameters.hardDelete; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/channels/{type}/{id}`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Deletes channel Sends events: - channel.deleted Required permissions: - DeleteChannel - * Delete channel - */ - async deleteChannel(requestParameters: DeleteChannelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deleteChannelRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Deletes channel type - * Delete channel type - */ - async deleteChannelTypeRaw(requestParameters: DeleteChannelTypeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.name === null || requestParameters.name === undefined) { - throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling deleteChannelType.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/channeltypes/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Deletes channel type - * Delete channel type - */ - async deleteChannelType(requestParameters: DeleteChannelTypeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deleteChannelTypeRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Allows to delete several channels at once asynchronously Sends events: - channel.deleted Required permissions: - DeleteChannel - * Deletes channels asynchronously - */ - async deleteChannelsRaw(requestParameters: DeleteChannelsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.deleteChannelsRequest === null || requestParameters.deleteChannelsRequest === undefined) { - throw new runtime.RequiredError('deleteChannelsRequest','Required parameter requestParameters.deleteChannelsRequest was null or undefined when calling deleteChannels.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/channels/delete`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.deleteChannelsRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Allows to delete several channels at once asynchronously Sends events: - channel.deleted Required permissions: - DeleteChannel - * Deletes channels asynchronously - */ - async deleteChannels(requestParameters: DeleteChannelsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deleteChannelsRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Deletes custom chat command - * Delete command - */ - async deleteCommandRaw(requestParameters: DeleteCommandRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.name === null || requestParameters.name === undefined) { - throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling deleteCommand.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/commands/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Deletes custom chat command - * Delete command - */ - async deleteCommand(requestParameters: DeleteCommandRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deleteCommandRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Deletes one device - * Delete device - */ - async deleteDeviceRaw(requestParameters: DeleteDeviceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling deleteDevice.'); - } - - const queryParameters: any = {}; - - if (requestParameters.id !== undefined) { - queryParameters['id'] = requestParameters.id; - } - - if (requestParameters.userId !== undefined) { - queryParameters['user_id'] = requestParameters.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/devices`, - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Deletes one device - * Delete device - */ - async deleteDevice(requestParameters: DeleteDeviceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deleteDeviceRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Deletes external storage - * Delete external storage - */ - async deleteExternalStorageRaw(requestParameters: DeleteExternalStorageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.name === null || requestParameters.name === undefined) { - throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling deleteExternalStorage.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/external_storage/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Deletes external storage - * Delete external storage - */ - async deleteExternalStorage(requestParameters: DeleteExternalStorageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deleteExternalStorageRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Deletes previously uploaded file Required permissions: - DeleteAttachment - * Delete file - */ - async deleteFileRaw(requestParameters: DeleteFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.type === null || requestParameters.type === undefined) { - throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling deleteFile.'); - } - - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling deleteFile.'); - } - - const queryParameters: any = {}; - - if (requestParameters.url !== undefined) { - queryParameters['url'] = requestParameters.url; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/channels/{type}/{id}/file`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Deletes previously uploaded file Required permissions: - DeleteAttachment - * Delete file - */ - async deleteFile(requestParameters: DeleteFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deleteFileRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Deletes previously uploaded image Required permissions: - DeleteAttachment - * Delete image - */ - async deleteImageRaw(requestParameters: DeleteImageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.type === null || requestParameters.type === undefined) { - throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling deleteImage.'); - } - - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling deleteImage.'); - } - - const queryParameters: any = {}; - - if (requestParameters.url !== undefined) { - queryParameters['url'] = requestParameters.url; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/channels/{type}/{id}/image`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Deletes previously uploaded image Required permissions: - DeleteAttachment - * Delete image - */ - async deleteImage(requestParameters: DeleteImageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deleteImageRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Deletes message Sends events: - message.deleted Required permissions: - DeleteMessage - * Delete message - */ - async deleteMessageRaw(requestParameters: DeleteMessageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling deleteMessage.'); - } - - const queryParameters: any = {}; - - if (requestParameters.hard !== undefined) { - queryParameters['hard'] = requestParameters.hard; - } - - if (requestParameters.deletedBy !== undefined) { - queryParameters['deleted_by'] = requestParameters.deletedBy; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/messages/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Deletes message Sends events: - message.deleted Required permissions: - DeleteMessage - * Delete message - */ - async deleteMessage(requestParameters: DeleteMessageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deleteMessageRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Deletes a poll Sends events: - poll.deleted Required permissions: - DeletePoll - * Delete poll - */ - async deletePollRaw(requestParameters: DeletePollRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.pollId === null || requestParameters.pollId === undefined) { - throw new runtime.RequiredError('pollId','Required parameter requestParameters.pollId was null or undefined when calling deletePoll.'); - } - - const queryParameters: any = {}; - - if (requestParameters.userId !== undefined) { - queryParameters['user_id'] = requestParameters.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/polls/{poll_id}`.replace(`{${"poll_id"}}`, encodeURIComponent(String(requestParameters.pollId))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Deletes a poll Sends events: - poll.deleted Required permissions: - DeletePoll - * Delete poll - */ - async deletePoll(requestParameters: DeletePollRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deletePollRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Deletes a poll option Sends events: - poll.updated Required permissions: - UpdatePoll - * Delete poll option - */ - async deletePollOptionRaw(requestParameters: DeletePollOptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.pollId === null || requestParameters.pollId === undefined) { - throw new runtime.RequiredError('pollId','Required parameter requestParameters.pollId was null or undefined when calling deletePollOption.'); - } - - if (requestParameters.optionId === null || requestParameters.optionId === undefined) { - throw new runtime.RequiredError('optionId','Required parameter requestParameters.optionId was null or undefined when calling deletePollOption.'); - } - - const queryParameters: any = {}; - - if (requestParameters.userId !== undefined) { - queryParameters['user_id'] = requestParameters.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/polls/{poll_id}/options/{option_id}`.replace(`{${"poll_id"}}`, encodeURIComponent(String(requestParameters.pollId))).replace(`{${"option_id"}}`, encodeURIComponent(String(requestParameters.optionId))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Deletes a poll option Sends events: - poll.updated Required permissions: - UpdatePoll - * Delete poll option - */ - async deletePollOption(requestParameters: DeletePollOptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deletePollOptionRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Delete a push provider from v2 with multi bundle/package support. v1 isn\'t supported in this endpoint - * Delete a push provider - */ - async deletePushProviderRaw(requestParameters: DeletePushProviderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.type === null || requestParameters.type === undefined) { - throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling deletePushProvider.'); - } - - if (requestParameters.name === null || requestParameters.name === undefined) { - throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling deletePushProvider.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/push_providers/{type}/{name}`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Delete a push provider from v2 with multi bundle/package support. v1 isn\'t supported in this endpoint - * Delete a push provider - */ - async deletePushProvider(requestParameters: DeletePushProviderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deletePushProviderRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Removes user reaction from the message Sends events: - reaction.deleted Required permissions: - DeleteReaction - * Delete reaction - */ - async deleteReactionRaw(requestParameters: DeleteReactionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling deleteReaction.'); - } - - if (requestParameters.type === null || requestParameters.type === undefined) { - throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling deleteReaction.'); - } - - const queryParameters: any = {}; - - if (requestParameters.userId !== undefined) { - queryParameters['user_id'] = requestParameters.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/messages/{id}/reaction/{type}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))).replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Removes user reaction from the message Sends events: - reaction.deleted Required permissions: - DeleteReaction - * Delete reaction - */ - async deleteReaction(requestParameters: DeleteReactionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deleteReactionRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Deletes custom role - * Delete role - */ - async deleteRoleRaw(requestParameters: DeleteRoleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.name === null || requestParameters.name === undefined) { - throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling deleteRole.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/roles/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Deletes custom role - * Delete role - */ - async deleteRole(requestParameters: DeleteRoleRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deleteRoleRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Deletes users and optionally all their belongings asynchronously. Sends events: - channel.deleted - user.deleted - * Delete Users - */ - async deleteUsersRaw(requestParameters: DeleteUsersOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.deleteUsersRequest === null || requestParameters.deleteUsersRequest === undefined) { - throw new runtime.RequiredError('deleteUsersRequest','Required parameter requestParameters.deleteUsersRequest was null or undefined when calling deleteUsers.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/users/delete`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.deleteUsersRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Deletes users and optionally all their belongings asynchronously. Sends events: - channel.deleted - user.deleted - * Delete Users - */ - async deleteUsers(requestParameters: DeleteUsersOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.deleteUsersRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Exports channel data to JSON file - * Export channels - */ - async exportChannelsRaw(requestParameters: ExportChannelsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.exportChannelsRequest === null || requestParameters.exportChannelsRequest === undefined) { - throw new runtime.RequiredError('exportChannelsRequest','Required parameter requestParameters.exportChannelsRequest was null or undefined when calling exportChannels.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/export_channels`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.exportChannelsRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Exports channel data to JSON file - * Export channels - */ - async exportChannels(requestParameters: ExportChannelsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.exportChannelsRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Exports the user\'s profile, reactions and messages. Raises an error if a user has more than 10k messages or reactions - * Export user - */ - async exportUserRaw(requestParameters: ExportUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.userId === null || requestParameters.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling exportUser.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/users/{user_id}/export`.replace(`{${"user_id"}}`, encodeURIComponent(String(requestParameters.userId))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Exports the user\'s profile, reactions and messages. Raises an error if a user has more than 10k messages or reactions - * Export user - */ - async exportUser(requestParameters: ExportUserRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.exportUserRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Exports user profile, reactions and messages for list of given users - * Export users - */ - async exportUsersRaw(requestParameters: ExportUsersOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.exportUsersRequest === null || requestParameters.exportUsersRequest === undefined) { - throw new runtime.RequiredError('exportUsersRequest','Required parameter requestParameters.exportUsersRequest was null or undefined when calling exportUsers.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/export/users`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.exportUsersRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Exports user profile, reactions and messages for list of given users - * Export users - */ - async exportUsers(requestParameters: ExportUsersOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.exportUsersRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Reports message or user for review by moderators Sends events: - message.flagged - user.flagged Required permissions: - FlagMessage - FlagUser - * Flag - */ - async flagRaw(requestParameters: FlagOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.flagRequest === null || requestParameters.flagRequest === undefined) { - throw new runtime.RequiredError('flagRequest','Required parameter requestParameters.flagRequest was null or undefined when calling flag.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/moderation/flag`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.flagRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Reports message or user for review by moderators Sends events: - message.flagged - user.flagged Required permissions: - FlagMessage - FlagUser - * Flag - */ - async flag(requestParameters: FlagOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.flagRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * This Method returns the application settings - * Get App Settings - */ - async getAppRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/app`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * This Method returns the application settings - * Get App Settings - */ - async getApp(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getAppRaw(initOverrides); - return await response.value(); - } - - /** - * Returns block list by given name - * Get block list - */ - async getBlockListRaw(requestParameters: GetBlockListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.name === null || requestParameters.name === undefined) { - throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling getBlockList.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/blocklists/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Returns block list by given name - * Get block list - */ - async getBlockList(requestParameters: GetBlockListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getBlockListRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Get list of blocked Users - * Get list of blocked Users - */ - async getBlockedUsersRaw(requestParameters: GetBlockedUsersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - if (requestParameters.userId !== undefined) { - queryParameters['user_id'] = requestParameters.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/users/block`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Get list of blocked Users - * Get list of blocked Users - */ - async getBlockedUsers(requestParameters: GetBlockedUsersRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getBlockedUsersRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Retrieves the token to join a call Required permissions: - JoinCall - ReadChannel - * Get Call Token - */ - async getCallTokenRaw(requestParameters: GetCallTokenOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.getCallTokenRequest === null || requestParameters.getCallTokenRequest === undefined) { - throw new runtime.RequiredError('getCallTokenRequest','Required parameter requestParameters.getCallTokenRequest was null or undefined when calling getCallToken.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/calls`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.getCallTokenRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Retrieves the token to join a call Required permissions: - JoinCall - ReadChannel - * Get Call Token - */ - async getCallToken(requestParameters: GetCallTokenOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getCallTokenRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Retrieves the token to join a call Required permissions: - JoinCall - ReadChannel - * Get Call Token - */ - async getCallToken_1Raw(requestParameters: GetCallToken0Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.callId === null || requestParameters.callId === undefined) { - throw new runtime.RequiredError('callId','Required parameter requestParameters.callId was null or undefined when calling getCallToken_1.'); - } - - if (requestParameters.getCallTokenRequest === null || requestParameters.getCallTokenRequest === undefined) { - throw new runtime.RequiredError('getCallTokenRequest','Required parameter requestParameters.getCallTokenRequest was null or undefined when calling getCallToken_1.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/calls/{call_id}`.replace(`{${"call_id"}}`, encodeURIComponent(String(requestParameters.callId))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.getCallTokenRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Retrieves the token to join a call Required permissions: - JoinCall - ReadChannel - * Get Call Token - */ - async getCallToken_1(requestParameters: GetCallToken0Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getCallToken_1Raw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Gets channel type - * Get channel type - */ - async getChannelTypeRaw(requestParameters: GetChannelTypeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.name === null || requestParameters.name === undefined) { - throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling getChannelType.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/channeltypes/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Gets channel type - * Get channel type - */ - async getChannelType(requestParameters: GetChannelTypeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getChannelTypeRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Returns custom command by its name - * Get command - */ - async getCommandRaw(requestParameters: GetCommandRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.name === null || requestParameters.name === undefined) { - throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling getCommand.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/commands/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Returns custom command by its name - * Get command - */ - async getCommand(requestParameters: GetCommandRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getCommandRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * - * Export channels status - */ - async getExportChannelsStatusRaw(requestParameters: GetExportChannelsStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling getExportChannelsStatus.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/export_channels/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * - * Export channels status - */ - async getExportChannelsStatus(requestParameters: GetExportChannelsStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getExportChannelsStatusRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Gets an import - * Get import - */ - async getImportRaw(requestParameters: GetImportRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling getImport.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/imports/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Gets an import - * Get import - */ - async getImport(requestParameters: GetImportRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getImportRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Returns list messages found by IDs Required permissions: - ReadChannel - * Get many messages - */ - async getManyMessagesRaw(requestParameters: GetManyMessagesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.type === null || requestParameters.type === undefined) { - throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling getManyMessages.'); - } - - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling getManyMessages.'); - } - - if (requestParameters.ids === null || requestParameters.ids === undefined) { - throw new runtime.RequiredError('ids','Required parameter requestParameters.ids was null or undefined when calling getManyMessages.'); - } - - const queryParameters: any = {}; - - if (requestParameters.ids) { - queryParameters['ids'] = requestParameters.ids; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/channels/{type}/{id}/messages`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Returns list messages found by IDs Required permissions: - ReadChannel - * Get many messages - */ - async getManyMessages(requestParameters: GetManyMessagesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getManyMessagesRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Returns message by ID Required permissions: - ReadChannel - * Get message - */ - async getMessageRaw(requestParameters: GetMessageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling getMessage.'); - } - - const queryParameters: any = {}; - - if (requestParameters.showDeletedMessage !== undefined) { - queryParameters['show_deleted_message'] = requestParameters.showDeletedMessage; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/messages/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Returns message by ID Required permissions: - ReadChannel - * Get message - */ - async getMessage(requestParameters: GetMessageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getMessageRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Get an OpenGraph attachment for a link - * Get OG - */ - async getOGRaw(requestParameters: GetOGRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.url === null || requestParameters.url === undefined) { - throw new runtime.RequiredError('url','Required parameter requestParameters.url was null or undefined when calling getOG.'); - } - - const queryParameters: any = {}; - - if (requestParameters.url !== undefined) { - queryParameters['url'] = requestParameters.url; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/og`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Get an OpenGraph attachment for a link - * Get OG - */ - async getOG(requestParameters: GetOGRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getOGRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * This Method creates a channel or returns an existing one with matching attributes Sends events: - channel.created - member.added - member.removed - member.updated - user.watching.start - * Get or create channel - */ - async getOrCreateChannelRaw(requestParameters: GetOrCreateChannelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.type === null || requestParameters.type === undefined) { - throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling getOrCreateChannel.'); - } - - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling getOrCreateChannel.'); - } - - if (requestParameters.channelGetOrCreateRequest === null || requestParameters.channelGetOrCreateRequest === undefined) { - throw new runtime.RequiredError('channelGetOrCreateRequest','Required parameter requestParameters.channelGetOrCreateRequest was null or undefined when calling getOrCreateChannel.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/channels/{type}/{id}/query`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.channelGetOrCreateRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * This Method creates a channel or returns an existing one with matching attributes Sends events: - channel.created - member.added - member.removed - member.updated - user.watching.start - * Get or create channel - */ - async getOrCreateChannel(requestParameters: GetOrCreateChannelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getOrCreateChannelRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * This Method creates a channel or returns an existing one with matching attributes Sends events: - channel.created - member.added - member.removed - member.updated - user.watching.start - * Get or create channel - */ - async getOrCreateDistinctChannelRaw(requestParameters: GetOrCreateDistinctChannelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.type === null || requestParameters.type === undefined) { - throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling getOrCreateDistinctChannel.'); - } - - if (requestParameters.channelGetOrCreateRequest === null || requestParameters.channelGetOrCreateRequest === undefined) { - throw new runtime.RequiredError('channelGetOrCreateRequest','Required parameter requestParameters.channelGetOrCreateRequest was null or undefined when calling getOrCreateDistinctChannel.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/channels/{type}/query`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.channelGetOrCreateRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * This Method creates a channel or returns an existing one with matching attributes Sends events: - channel.created - member.added - member.removed - member.updated - user.watching.start - * Get or create channel - */ - async getOrCreateDistinctChannel(requestParameters: GetOrCreateDistinctChannelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getOrCreateDistinctChannelRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Gets custom permission - * Get permission - */ - async getPermissionRaw(requestParameters: GetPermissionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling getPermission.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/permissions/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Gets custom permission - * Get permission - */ - async getPermission(requestParameters: GetPermissionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getPermissionRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Retrieves a poll - * Get poll - */ - async getPollRaw(requestParameters: GetPollRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.pollId === null || requestParameters.pollId === undefined) { - throw new runtime.RequiredError('pollId','Required parameter requestParameters.pollId was null or undefined when calling getPoll.'); - } - - const queryParameters: any = {}; - - if (requestParameters.userId !== undefined) { - queryParameters['user_id'] = requestParameters.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/polls/{poll_id}`.replace(`{${"poll_id"}}`, encodeURIComponent(String(requestParameters.pollId))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Retrieves a poll - * Get poll - */ - async getPoll(requestParameters: GetPollRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getPollRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Retrieves a poll option - * Get poll option - */ - async getPollOptionRaw(requestParameters: GetPollOptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.pollId === null || requestParameters.pollId === undefined) { - throw new runtime.RequiredError('pollId','Required parameter requestParameters.pollId was null or undefined when calling getPollOption.'); - } - - if (requestParameters.optionId === null || requestParameters.optionId === undefined) { - throw new runtime.RequiredError('optionId','Required parameter requestParameters.optionId was null or undefined when calling getPollOption.'); - } - - const queryParameters: any = {}; - - if (requestParameters.userId !== undefined) { - queryParameters['user_id'] = requestParameters.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/polls/{poll_id}/options/{option_id}`.replace(`{${"poll_id"}}`, encodeURIComponent(String(requestParameters.pollId))).replace(`{${"option_id"}}`, encodeURIComponent(String(requestParameters.optionId))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Retrieves a poll option - * Get poll option - */ - async getPollOption(requestParameters: GetPollOptionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getPollOptionRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Get rate limits usage and quotas - * Get rate limits - */ - async getRateLimitsRaw(requestParameters: GetRateLimitsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - if (requestParameters.serverSide !== undefined) { - queryParameters['server_side'] = requestParameters.serverSide; - } - - if (requestParameters.android !== undefined) { - queryParameters['android'] = requestParameters.android; - } - - if (requestParameters.ios !== undefined) { - queryParameters['ios'] = requestParameters.ios; - } - - if (requestParameters.web !== undefined) { - queryParameters['web'] = requestParameters.web; - } - - if (requestParameters.endpoints !== undefined) { - queryParameters['endpoints'] = requestParameters.endpoints; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/rate_limits`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Get rate limits usage and quotas - * Get rate limits - */ - async getRateLimits(requestParameters: GetRateLimitsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getRateLimitsRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Returns list of reactions of specific message Required permissions: - ReadChannel - * Get reactions - */ - async getReactionsRaw(requestParameters: GetReactionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling getReactions.'); - } - - const queryParameters: any = {}; - - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; - } - - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/messages/{id}/reactions`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Returns list of reactions of specific message Required permissions: - ReadChannel - * Get reactions - */ - async getReactions(requestParameters: GetReactionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getReactionsRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Returns replies (thread) of the message Required permissions: - ReadChannel - * Get replies - */ - async getRepliesRaw(requestParameters: GetRepliesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.parentId === null || requestParameters.parentId === undefined) { - throw new runtime.RequiredError('parentId','Required parameter requestParameters.parentId was null or undefined when calling getReplies.'); - } - - const queryParameters: any = {}; - - if (requestParameters.sort) { - queryParameters['sort'] = requestParameters.sort; - } - - if (requestParameters.limit !== undefined) { - queryParameters['limit'] = requestParameters.limit; - } - - if (requestParameters.offset !== undefined) { - queryParameters['offset'] = requestParameters.offset; - } - - if (requestParameters.idGte !== undefined) { - queryParameters['id_gte'] = requestParameters.idGte; - } - - if (requestParameters.idGt !== undefined) { - queryParameters['id_gt'] = requestParameters.idGt; - } - - if (requestParameters.idLte !== undefined) { - queryParameters['id_lte'] = requestParameters.idLte; - } - - if (requestParameters.idLt !== undefined) { - queryParameters['id_lt'] = requestParameters.idLt; - } - - if (requestParameters.createdAtAfterOrEqual !== undefined) { - queryParameters['created_at_after_or_equal'] = requestParameters.createdAtAfterOrEqual; - } - - if (requestParameters.createdAtAfter !== undefined) { - queryParameters['created_at_after'] = requestParameters.createdAtAfter; - } - - if (requestParameters.createdAtBeforeOrEqual !== undefined) { - queryParameters['created_at_before_or_equal'] = requestParameters.createdAtBeforeOrEqual; - } - - if (requestParameters.createdAtBefore !== undefined) { - queryParameters['created_at_before'] = requestParameters.createdAtBefore; - } - - if (requestParameters.idAround !== undefined) { - queryParameters['id_around'] = requestParameters.idAround; - } - - if (requestParameters.createdAtAround !== undefined) { - queryParameters['created_at_around'] = requestParameters.createdAtAround; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/messages/{parent_id}/replies`.replace(`{${"parent_id"}}`, encodeURIComponent(String(requestParameters.parentId))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Returns replies (thread) of the message Required permissions: - ReadChannel - * Get replies - */ - async getReplies(requestParameters: GetRepliesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getRepliesRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Gets status of a task - * Get status of a task - */ - async getTaskRaw(requestParameters: GetTaskRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling getTask.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/tasks/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Gets status of a task - * Get status of a task - */ - async getTask(requestParameters: GetTaskRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getTaskRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Return a specific thread Required permissions: - ReadChannel - * Get Thread - */ - async getThreadRaw(requestParameters: GetThreadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.messageId === null || requestParameters.messageId === undefined) { - throw new runtime.RequiredError('messageId','Required parameter requestParameters.messageId was null or undefined when calling getThread.'); - } - - const queryParameters: any = {}; - - if (requestParameters.connectionId !== undefined) { - queryParameters['connection_id'] = requestParameters.connectionId; - } - - if (requestParameters.replyLimit !== undefined) { - queryParameters['reply_limit'] = requestParameters.replyLimit; - } - - if (requestParameters.participantLimit !== undefined) { - queryParameters['participant_limit'] = requestParameters.participantLimit; - } - - if (requestParameters.memberLimit !== undefined) { - queryParameters['member_limit'] = requestParameters.memberLimit; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/threads/{message_id}`.replace(`{${"message_id"}}`, encodeURIComponent(String(requestParameters.messageId))), - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Return a specific thread Required permissions: - ReadChannel - * Get Thread - */ - async getThread(requestParameters: GetThreadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.getThreadRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Marks channel as hidden for current user Sends events: - channel.hidden Required permissions: - ReadChannel - * Hide channel - */ - async hideChannelRaw(requestParameters: HideChannelOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.type === null || requestParameters.type === undefined) { - throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling hideChannel.'); - } - - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling hideChannel.'); - } - - if (requestParameters.hideChannelRequest === null || requestParameters.hideChannelRequest === undefined) { - throw new runtime.RequiredError('hideChannelRequest','Required parameter requestParameters.hideChannelRequest was null or undefined when calling hideChannel.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/channels/{type}/{id}/hide`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.hideChannelRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Marks channel as hidden for current user Sends events: - channel.hidden Required permissions: - ReadChannel - * Hide channel - */ - async hideChannel(requestParameters: HideChannelOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.hideChannelRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Returns all available block lists - * List block lists - */ - async listBlockListsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/blocklists`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Returns all available block lists - * List block lists - */ - async listBlockLists(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.listBlockListsRaw(initOverrides); - return await response.value(); - } - - /** - * Lists all available channel types - * List channel types - */ - async listChannelTypesRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/channeltypes`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Lists all available channel types - * List channel types - */ - async listChannelTypes(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.listChannelTypesRaw(initOverrides); - return await response.value(); - } - - /** - * Returns all custom commands - * List commands - */ - async listCommandsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/commands`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Returns all custom commands - * List commands - */ - async listCommands(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.listCommandsRaw(initOverrides); - return await response.value(); - } - - /** - * Returns all available devices - * List devices - */ - async listDevicesRaw(requestParameters: ListDevicesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - if (requestParameters.userId !== undefined) { - queryParameters['user_id'] = requestParameters.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/devices`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Returns all available devices - * List devices - */ - async listDevices(requestParameters: ListDevicesRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.listDevicesRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Lists external storage - * List external storage - */ - async listExternalStorageRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/external_storage`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Lists external storage - * List external storage - */ - async listExternalStorage(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.listExternalStorageRaw(initOverrides); - return await response.value(); - } - - /** - * Gets an import - * Get import - */ - async listImportsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/imports`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Gets an import - * Get import - */ - async listImports(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.listImportsRaw(initOverrides); - return await response.value(); - } - - /** - * Lists all available permissions - * List permissions - */ - async listPermissionsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/permissions`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Lists all available permissions - * List permissions - */ - async listPermissions(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.listPermissionsRaw(initOverrides); - return await response.value(); - } - - /** - * List details of all push providers. - * List push providers - */ - async listPushProvidersRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/push_providers`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * List details of all push providers. - * List push providers - */ - async listPushProviders(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.listPushProvidersRaw(initOverrides); - return await response.value(); - } - - /** - * Lists all available roles - * List roles - */ - async listRolesRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/roles`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Lists all available roles - * List roles - */ - async listRoles(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.listRolesRaw(initOverrides); - return await response.value(); - } - - /** - * Marks channels as read up to the specific message. If no channels is given, mark all channel as read Sends events: - message.read Required permissions: - ReadChannel - * Mark channels as read - */ - async markChannelsReadRaw(requestParameters: MarkChannelsReadOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.markChannelsReadRequest === null || requestParameters.markChannelsReadRequest === undefined) { - throw new runtime.RequiredError('markChannelsReadRequest','Required parameter requestParameters.markChannelsReadRequest was null or undefined when calling markChannelsRead.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/channels/read`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.markChannelsReadRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Marks channels as read up to the specific message. If no channels is given, mark all channel as read Sends events: - message.read Required permissions: - ReadChannel - * Mark channels as read - */ - async markChannelsRead(requestParameters: MarkChannelsReadOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.markChannelsReadRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Marks channel as read up to the specific message Sends events: - message.read Required permissions: - ReadChannel - * Mark read - */ - async markReadRaw(requestParameters: MarkReadOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.type === null || requestParameters.type === undefined) { - throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling markRead.'); - } - - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling markRead.'); - } - - if (requestParameters.markReadRequest === null || requestParameters.markReadRequest === undefined) { - throw new runtime.RequiredError('markReadRequest','Required parameter requestParameters.markReadRequest was null or undefined when calling markRead.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/channels/{type}/{id}/read`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.markReadRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Marks channel as read up to the specific message Sends events: - message.read Required permissions: - ReadChannel - * Mark read - */ - async markRead(requestParameters: MarkReadOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.markReadRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Marks channel as unread from a specific message Required permissions: - ReadChannel - * Mark unread - */ - async markUnreadRaw(requestParameters: MarkUnreadOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.type === null || requestParameters.type === undefined) { - throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling markUnread.'); - } - - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling markUnread.'); - } - - if (requestParameters.markUnreadRequest === null || requestParameters.markUnreadRequest === undefined) { - throw new runtime.RequiredError('markUnreadRequest','Required parameter requestParameters.markUnreadRequest was null or undefined when calling markUnread.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/channels/{type}/{id}/unread`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.markUnreadRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Marks channel as unread from a specific message Required permissions: - ReadChannel - * Mark unread - */ - async markUnread(requestParameters: MarkUnreadOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.markUnreadRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Mutes channel for user Sends events: - channel.muted Required permissions: - MuteChannel - * Mute channel - */ - async muteChannelRaw(requestParameters: MuteChannelOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.muteChannelRequest === null || requestParameters.muteChannelRequest === undefined) { - throw new runtime.RequiredError('muteChannelRequest','Required parameter requestParameters.muteChannelRequest was null or undefined when calling muteChannel.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/moderation/mute/channel`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.muteChannelRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Mutes channel for user Sends events: - channel.muted Required permissions: - MuteChannel - * Mute channel - */ - async muteChannel(requestParameters: MuteChannelOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.muteChannelRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Mutes one or several users Sends events: - user.muted Required permissions: - MuteUser - * Mute user - */ - async muteUserRaw(requestParameters: MuteUserOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.muteUserRequest === null || requestParameters.muteUserRequest === undefined) { - throw new runtime.RequiredError('muteUserRequest','Required parameter requestParameters.muteUserRequest was null or undefined when calling muteUser.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/moderation/mute`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.muteUserRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Mutes one or several users Sends events: - user.muted Required permissions: - MuteUser - * Mute user - */ - async muteUser(requestParameters: MuteUserOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.muteUserRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Find and filter channel scoped or global user bans Required permissions: - ReadChannel - * Query Banned Users - */ - async queryBannedUsersRaw(requestParameters: QueryBannedUsersOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - if (requestParameters.payload !== undefined) { - queryParameters['payload'] = requestParameters.payload; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/query_banned_users`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Find and filter channel scoped or global user bans Required permissions: - ReadChannel - * Query Banned Users - */ - async queryBannedUsers(requestParameters: QueryBannedUsersOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.queryBannedUsersRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Query channels with filter query Required permissions: - ReadChannel - * Query channels - */ - async queryChannelsRaw(requestParameters: QueryChannelsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.queryChannelsRequest === null || requestParameters.queryChannelsRequest === undefined) { - throw new runtime.RequiredError('queryChannelsRequest','Required parameter requestParameters.queryChannelsRequest was null or undefined when calling queryChannels.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/channels`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.queryChannelsRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Query channels with filter query Required permissions: - ReadChannel - * Query channels - */ - async queryChannels(requestParameters: QueryChannelsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.queryChannelsRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Find and filter channel members Required permissions: - ReadChannel - * Query members - */ - async queryMembersRaw(requestParameters: QueryMembersOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - if (requestParameters.payload !== undefined) { - queryParameters['payload'] = requestParameters.payload; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/members`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Find and filter channel members Required permissions: - ReadChannel - * Query members - */ - async queryMembers(requestParameters: QueryMembersOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.queryMembersRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Find and filter message flags Required permissions: - ReadMessageFlags - * Query Message Flags - */ - async queryMessageFlagsRaw(requestParameters: QueryMessageFlagsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - if (requestParameters.payload !== undefined) { - queryParameters['payload'] = requestParameters.payload; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/moderation/flags/message`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Find and filter message flags Required permissions: - ReadMessageFlags - * Query Message Flags - */ - async queryMessageFlags(requestParameters: QueryMessageFlagsOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.queryMessageFlagsRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Queries history for one message - * Query message history - */ - async queryMessageHistoryRaw(requestParameters: QueryMessageHistoryOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.queryMessageHistoryRequest === null || requestParameters.queryMessageHistoryRequest === undefined) { - throw new runtime.RequiredError('queryMessageHistoryRequest','Required parameter requestParameters.queryMessageHistoryRequest was null or undefined when calling queryMessageHistory.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/messages/history`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.queryMessageHistoryRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Queries history for one message - * Query message history - */ - async queryMessageHistory(requestParameters: QueryMessageHistoryOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.queryMessageHistoryRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Queries votes - * Query votes - */ - async queryPollVotesRaw(requestParameters: QueryPollVotesOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.pollId === null || requestParameters.pollId === undefined) { - throw new runtime.RequiredError('pollId','Required parameter requestParameters.pollId was null or undefined when calling queryPollVotes.'); - } - - if (requestParameters.queryPollVotesRequest === null || requestParameters.queryPollVotesRequest === undefined) { - throw new runtime.RequiredError('queryPollVotesRequest','Required parameter requestParameters.queryPollVotesRequest was null or undefined when calling queryPollVotes.'); - } - - const queryParameters: any = {}; - - if (requestParameters.userId !== undefined) { - queryParameters['user_id'] = requestParameters.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/polls/{poll_id}/votes`.replace(`{${"poll_id"}}`, encodeURIComponent(String(requestParameters.pollId))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.queryPollVotesRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Queries votes - * Query votes - */ - async queryPollVotes(requestParameters: QueryPollVotesOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.queryPollVotesRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Queries polls - * Query polls - */ - async queryPollsRaw(requestParameters: QueryPollsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.queryPollsRequest === null || requestParameters.queryPollsRequest === undefined) { - throw new runtime.RequiredError('queryPollsRequest','Required parameter requestParameters.queryPollsRequest was null or undefined when calling queryPolls.'); - } - - const queryParameters: any = {}; - - if (requestParameters.userId !== undefined) { - queryParameters['user_id'] = requestParameters.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/polls/query`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.queryPollsRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Queries polls - * Query polls - */ - async queryPolls(requestParameters: QueryPollsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.queryPollsRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Get reactions on a message Required permissions: - ReadChannel - */ - async queryReactionsRaw(requestParameters: QueryReactionsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling queryReactions.'); - } - - if (requestParameters.queryReactionsRequest === null || requestParameters.queryReactionsRequest === undefined) { - throw new runtime.RequiredError('queryReactionsRequest','Required parameter requestParameters.queryReactionsRequest was null or undefined when calling queryReactions.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/messages/{id}/reactions`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.queryReactionsRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Get reactions on a message Required permissions: - ReadChannel - */ - async queryReactions(requestParameters: QueryReactionsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.queryReactionsRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Returns the list of threads for specific user Required permissions: - ReadChannel - * Query Threads - */ - async queryThreadsRaw(requestParameters: QueryThreadsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.queryThreadsRequest === null || requestParameters.queryThreadsRequest === undefined) { - throw new runtime.RequiredError('queryThreadsRequest','Required parameter requestParameters.queryThreadsRequest was null or undefined when calling queryThreads.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/threads`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.queryThreadsRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Returns the list of threads for specific user Required permissions: - ReadChannel - * Query Threads - */ - async queryThreads(requestParameters: QueryThreadsOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.queryThreadsRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Find and filter users Required permissions: - SearchUser - * Query users - */ - async queryUsersRaw(requestParameters: QueryUsersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - if (requestParameters.payload !== undefined) { - queryParameters['payload'] = requestParameters.payload; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/users`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Find and filter users Required permissions: - SearchUser - * Query users - */ - async queryUsers(requestParameters: QueryUsersRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.queryUsersRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Activates user who\'s been deactivated previously Sends events: - user.reactivated - * Reactivate user - */ - async reactivateUserRaw(requestParameters: ReactivateUserOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.userId === null || requestParameters.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling reactivateUser.'); - } - - if (requestParameters.reactivateUserRequest === null || requestParameters.reactivateUserRequest === undefined) { - throw new runtime.RequiredError('reactivateUserRequest','Required parameter requestParameters.reactivateUserRequest was null or undefined when calling reactivateUser.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/users/{user_id}/reactivate`.replace(`{${"user_id"}}`, encodeURIComponent(String(requestParameters.userId))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.reactivateUserRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Activates user who\'s been deactivated previously Sends events: - user.reactivated - * Reactivate user - */ - async reactivateUser(requestParameters: ReactivateUserOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.reactivateUserRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Reactivate users in batches Sends events: - user.reactivated - * Reactivate users - */ - async reactivateUsersRaw(requestParameters: ReactivateUsersOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.reactivateUsersRequest === null || requestParameters.reactivateUsersRequest === undefined) { - throw new runtime.RequiredError('reactivateUsersRequest','Required parameter requestParameters.reactivateUsersRequest was null or undefined when calling reactivateUsers.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/users/reactivate`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.reactivateUsersRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Reactivate users in batches Sends events: - user.reactivated - * Reactivate users - */ - async reactivateUsers(requestParameters: ReactivateUsersOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.reactivateUsersRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Delete a vote from a poll Sends events: - poll.vote_removed Required permissions: - CastVote - * Delete vote - */ - async removePollVoteRaw(requestParameters: RemovePollVoteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.messageId === null || requestParameters.messageId === undefined) { - throw new runtime.RequiredError('messageId','Required parameter requestParameters.messageId was null or undefined when calling removePollVote.'); - } - - if (requestParameters.pollId === null || requestParameters.pollId === undefined) { - throw new runtime.RequiredError('pollId','Required parameter requestParameters.pollId was null or undefined when calling removePollVote.'); - } - - if (requestParameters.voteId === null || requestParameters.voteId === undefined) { - throw new runtime.RequiredError('voteId','Required parameter requestParameters.voteId was null or undefined when calling removePollVote.'); - } - - const queryParameters: any = {}; - - if (requestParameters.userId !== undefined) { - queryParameters['user_id'] = requestParameters.userId; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/messages/{message_id}/polls/{poll_id}/vote/{vote_id}`.replace(`{${"message_id"}}`, encodeURIComponent(String(requestParameters.messageId))).replace(`{${"poll_id"}}`, encodeURIComponent(String(requestParameters.pollId))).replace(`{${"vote_id"}}`, encodeURIComponent(String(requestParameters.voteId))), - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Delete a vote from a poll Sends events: - poll.vote_removed Required permissions: - CastVote - * Delete vote - */ - async removePollVote(requestParameters: RemovePollVoteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.removePollVoteRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Restore soft deleted users - * Restore users - */ - async restoreUsersRaw(requestParameters: RestoreUsersOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.restoreUsersRequest === null || requestParameters.restoreUsersRequest === undefined) { - throw new runtime.RequiredError('restoreUsersRequest','Required parameter requestParameters.restoreUsersRequest was null or undefined when calling restoreUsers.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/users/restore`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.restoreUsersRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Restore soft deleted users - * Restore users - */ - async restoreUsers(requestParameters: RestoreUsersOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.restoreUsersRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Executes message command action with given parameters Sends events: - message.new Required permissions: - RunMessageAction - * Run message command action - */ - async runMessageActionRaw(requestParameters: RunMessageActionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling runMessageAction.'); - } - - if (requestParameters.messageActionRequest === null || requestParameters.messageActionRequest === undefined) { - throw new runtime.RequiredError('messageActionRequest','Required parameter requestParameters.messageActionRequest was null or undefined when calling runMessageAction.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/messages/{id}/action`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.messageActionRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Executes message command action with given parameters Sends events: - message.new Required permissions: - RunMessageAction - * Run message command action - */ - async runMessageAction(requestParameters: RunMessageActionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.runMessageActionRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Search messages across channels Required permissions: - ReadChannel - * Search messages - */ - async searchRaw(requestParameters: SearchOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - if (requestParameters.payload !== undefined) { - queryParameters['payload'] = requestParameters.payload; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/search`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Search messages across channels Required permissions: - ReadChannel - * Search messages - */ - async search(requestParameters: SearchOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.searchRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Sends event to the channel Required permissions: - SendCustomEvent - * Send event - */ - async sendEventRaw(requestParameters: SendEventOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.type === null || requestParameters.type === undefined) { - throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling sendEvent.'); - } - - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling sendEvent.'); - } - - if (requestParameters.sendEventRequest === null || requestParameters.sendEventRequest === undefined) { - throw new runtime.RequiredError('sendEventRequest','Required parameter requestParameters.sendEventRequest was null or undefined when calling sendEvent.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/channels/{type}/{id}/event`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.sendEventRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Sends event to the channel Required permissions: - SendCustomEvent - * Send event - */ - async sendEvent(requestParameters: SendEventOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.sendEventRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Sends new message to the specified channel Sends events: - message.new - message.updated Required permissions: - AddLinks - CreateMessage - PinMessage - SkipChannelCooldown - SkipMessageModeration - UseFrozenChannel - * Send new message - */ - async sendMessageRaw(requestParameters: SendMessageOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.type === null || requestParameters.type === undefined) { - throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling sendMessage.'); - } - - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling sendMessage.'); - } - - if (requestParameters.sendMessageRequest === null || requestParameters.sendMessageRequest === undefined) { - throw new runtime.RequiredError('sendMessageRequest','Required parameter requestParameters.sendMessageRequest was null or undefined when calling sendMessage.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/channels/{type}/{id}/message`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.sendMessageRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Sends new message to the specified channel Sends events: - message.new - message.updated Required permissions: - AddLinks - CreateMessage - PinMessage - SkipChannelCooldown - SkipMessageModeration - UseFrozenChannel - * Send new message - */ - async sendMessage(requestParameters: SendMessageOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.sendMessageRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Sends reaction to specified message Sends events: - reaction.new - reaction.updated Required permissions: - CreateReaction - UseFrozenChannel - * Send reaction - */ - async sendReactionRaw(requestParameters: SendReactionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling sendReaction.'); - } - - if (requestParameters.sendReactionRequest === null || requestParameters.sendReactionRequest === undefined) { - throw new runtime.RequiredError('sendReactionRequest','Required parameter requestParameters.sendReactionRequest was null or undefined when calling sendReaction.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/messages/{id}/reaction`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.sendReactionRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Sends reaction to specified message Sends events: - reaction.new - reaction.updated Required permissions: - CreateReaction - UseFrozenChannel - * Send reaction - */ - async sendReaction(requestParameters: SendReactionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.sendReactionRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Sends a custom event to a user Sends events: - * - * Send user event - */ - async sendUserCustomEventRaw(requestParameters: SendUserCustomEventOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.userId === null || requestParameters.userId === undefined) { - throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling sendUserCustomEvent.'); - } - - if (requestParameters.sendUserCustomEventRequest === null || requestParameters.sendUserCustomEventRequest === undefined) { - throw new runtime.RequiredError('sendUserCustomEventRequest','Required parameter requestParameters.sendUserCustomEventRequest was null or undefined when calling sendUserCustomEvent.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/users/{user_id}/event`.replace(`{${"user_id"}}`, encodeURIComponent(String(requestParameters.userId))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.sendUserCustomEventRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Sends a custom event to a user Sends events: - * - * Send user event - */ - async sendUserCustomEvent(requestParameters: SendUserCustomEventOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.sendUserCustomEventRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Shows previously hidden channel Sends events: - channel.visible - * Show channel - */ - async showChannelRaw(requestParameters: ShowChannelOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.type === null || requestParameters.type === undefined) { - throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling showChannel.'); - } - - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling showChannel.'); - } - - if (requestParameters.showChannelRequest === null || requestParameters.showChannelRequest === undefined) { - throw new runtime.RequiredError('showChannelRequest','Required parameter requestParameters.showChannelRequest was null or undefined when calling showChannel.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/channels/{type}/{id}/show`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.showChannelRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Shows previously hidden channel Sends events: - channel.visible - * Show channel - */ - async showChannel(requestParameters: ShowChannelOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.showChannelRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Translates message to a given language using automated translation software Sends events: - message.updated Required permissions: - ReadChannel - * Translate message - */ - async translateMessageRaw(requestParameters: TranslateMessageOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling translateMessage.'); - } - - if (requestParameters.translateMessageRequest === null || requestParameters.translateMessageRequest === undefined) { - throw new runtime.RequiredError('translateMessageRequest','Required parameter requestParameters.translateMessageRequest was null or undefined when calling translateMessage.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/messages/{id}/translate`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.translateMessageRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Translates message to a given language using automated translation software Sends events: - message.updated Required permissions: - ReadChannel - * Translate message - */ - async translateMessage(requestParameters: TranslateMessageOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.translateMessageRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Truncates channel Sends events: - channel.truncated Required permissions: - DeleteChannel - TruncateChannel - * Truncate channel - */ - async truncateChannelRaw(requestParameters: TruncateChannelOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.type === null || requestParameters.type === undefined) { - throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling truncateChannel.'); - } - - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling truncateChannel.'); - } - - if (requestParameters.truncateChannelRequest === null || requestParameters.truncateChannelRequest === undefined) { - throw new runtime.RequiredError('truncateChannelRequest','Required parameter requestParameters.truncateChannelRequest was null or undefined when calling truncateChannel.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/channels/{type}/{id}/truncate`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.truncateChannelRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Truncates channel Sends events: - channel.truncated Required permissions: - DeleteChannel - TruncateChannel - * Truncate channel - */ - async truncateChannel(requestParameters: TruncateChannelOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.truncateChannelRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Removes previously applied ban Sends events: - user.unbanned Required permissions: - BanChannelMember - BanUser - * Unban user - */ - async unbanRaw(requestParameters: UnbanRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.targetUserId === null || requestParameters.targetUserId === undefined) { - throw new runtime.RequiredError('targetUserId','Required parameter requestParameters.targetUserId was null or undefined when calling unban.'); - } - - const queryParameters: any = {}; - - if (requestParameters.targetUserId !== undefined) { - queryParameters['target_user_id'] = requestParameters.targetUserId; - } - - if (requestParameters.channelCid !== undefined) { - queryParameters['channel_cid'] = requestParameters.channelCid; - } - - if (requestParameters.createdBy !== undefined) { - queryParameters['created_by'] = requestParameters.createdBy; - } - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/moderation/ban`, - method: 'DELETE', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Removes previously applied ban Sends events: - user.unbanned Required permissions: - BanChannelMember - BanUser - * Unban user - */ - async unban(requestParameters: UnbanRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.unbanRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Unblock users - * Unblock user - */ - async unblockUsersRaw(requestParameters: UnblockUsersOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.unblockUsersRequest === null || requestParameters.unblockUsersRequest === undefined) { - throw new runtime.RequiredError('unblockUsersRequest','Required parameter requestParameters.unblockUsersRequest was null or undefined when calling unblockUsers.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/users/unblock`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.unblockUsersRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Unblock users - * Unblock user - */ - async unblockUsers(requestParameters: UnblockUsersOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.unblockUsersRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Undelete a message that was previously soft-deleted Sends events: - message.undeleted - * Undelete message - */ - async undeleteMessageRaw(requestParameters: UndeleteMessageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling undeleteMessage.'); - } - - if (requestParameters.updateMessageRequest === null || requestParameters.updateMessageRequest === undefined) { - throw new runtime.RequiredError('updateMessageRequest','Required parameter requestParameters.updateMessageRequest was null or undefined when calling undeleteMessage.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/messages/{id}/undelete`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.updateMessageRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Undelete a message that was previously soft-deleted Sends events: - message.undeleted - * Undelete message - */ - async undeleteMessage(requestParameters: UndeleteMessageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.undeleteMessageRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Unmutes channel for user Sends events: - channel.unmuted Required permissions: - MuteChannel - * Unmute channel - */ - async unmuteChannelRaw(requestParameters: UnmuteChannelOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.unmuteChannelRequest === null || requestParameters.unmuteChannelRequest === undefined) { - throw new runtime.RequiredError('unmuteChannelRequest','Required parameter requestParameters.unmuteChannelRequest was null or undefined when calling unmuteChannel.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/moderation/unmute/channel`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.unmuteChannelRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Unmutes channel for user Sends events: - channel.unmuted Required permissions: - MuteChannel - * Unmute channel - */ - async unmuteChannel(requestParameters: UnmuteChannelOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.unmuteChannelRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Unmutes previously muted user Sends events: - user.unmuted Required permissions: - MuteUser - * Unmute user - */ - async unmuteUserRaw(requestParameters: UnmuteUserOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.unmuteUserRequest === null || requestParameters.unmuteUserRequest === undefined) { - throw new runtime.RequiredError('unmuteUserRequest','Required parameter requestParameters.unmuteUserRequest was null or undefined when calling unmuteUser.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/moderation/unmute`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.unmuteUserRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Unmutes previously muted user Sends events: - user.unmuted Required permissions: - MuteUser - * Unmute user - */ - async unmuteUser(requestParameters: UnmuteUserOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.unmuteUserRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Fetch unread counts for a single user - * Unread counts - */ - async unreadCountsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/unread`, - method: 'GET', - headers: headerParameters, - query: queryParameters, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Fetch unread counts for a single user - * Unread counts - */ - async unreadCounts(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.unreadCountsRaw(initOverrides); - return await response.value(); - } - - /** - * Fetch unread counts in batch for multiple users in one call - * Batch unread counts - */ - async unreadCountsBatchRaw(requestParameters: UnreadCountsBatchOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.unreadCountsBatchRequest === null || requestParameters.unreadCountsBatchRequest === undefined) { - throw new runtime.RequiredError('unreadCountsBatchRequest','Required parameter requestParameters.unreadCountsBatchRequest was null or undefined when calling unreadCountsBatch.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/unread_batch`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.unreadCountsBatchRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Fetch unread counts in batch for multiple users in one call - * Batch unread counts - */ - async unreadCountsBatch(requestParameters: UnreadCountsBatchOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.unreadCountsBatchRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * This Method updates one or more application settings - * Update App Settings - */ - async updateAppRaw(requestParameters: UpdateAppOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.updateAppRequest === null || requestParameters.updateAppRequest === undefined) { - throw new runtime.RequiredError('updateAppRequest','Required parameter requestParameters.updateAppRequest was null or undefined when calling updateApp.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/app`, - method: 'PATCH', - headers: headerParameters, - query: queryParameters, - body: requestParameters.updateAppRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * This Method updates one or more application settings - * Update App Settings - */ - async updateApp(requestParameters: UpdateAppOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.updateAppRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Updates contents of the block list - * Update block list - */ - async updateBlockListRaw(requestParameters: UpdateBlockListOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.name === null || requestParameters.name === undefined) { - throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling updateBlockList.'); - } - - if (requestParameters.updateBlockListRequest === null || requestParameters.updateBlockListRequest === undefined) { - throw new runtime.RequiredError('updateBlockListRequest','Required parameter requestParameters.updateBlockListRequest was null or undefined when calling updateBlockList.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/blocklists/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))), - method: 'PUT', - headers: headerParameters, - query: queryParameters, - body: requestParameters.updateBlockListRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Updates contents of the block list - * Update block list - */ - async updateBlockList(requestParameters: UpdateBlockListOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.updateBlockListRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Change channel data Sends events: - channel.updated - member.added - member.removed - member.updated - message.new Required permissions: - AddOwnChannelMembership - RemoveOwnChannelMembership - UpdateChannel - UpdateChannelCooldown - UpdateChannelFrozen - UpdateChannelMembers - * Update channel - */ - async updateChannelRaw(requestParameters: UpdateChannelOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.type === null || requestParameters.type === undefined) { - throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling updateChannel.'); - } - - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling updateChannel.'); - } - - if (requestParameters.updateChannelRequest === null || requestParameters.updateChannelRequest === undefined) { - throw new runtime.RequiredError('updateChannelRequest','Required parameter requestParameters.updateChannelRequest was null or undefined when calling updateChannel.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/channels/{type}/{id}`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.updateChannelRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Change channel data Sends events: - channel.updated - member.added - member.removed - member.updated - message.new Required permissions: - AddOwnChannelMembership - RemoveOwnChannelMembership - UpdateChannel - UpdateChannelCooldown - UpdateChannelFrozen - UpdateChannelMembers - * Update channel - */ - async updateChannel(requestParameters: UpdateChannelOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.updateChannelRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Updates certain fields of the channel Sends events: - channel.updated Required permissions: - UpdateChannel - UpdateChannelCooldown - UpdateChannelFrozen - * Partially update channel - */ - async updateChannelPartialRaw(requestParameters: UpdateChannelPartialOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.type === null || requestParameters.type === undefined) { - throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling updateChannelPartial.'); - } - - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling updateChannelPartial.'); - } - - if (requestParameters.updateChannelPartialRequest === null || requestParameters.updateChannelPartialRequest === undefined) { - throw new runtime.RequiredError('updateChannelPartialRequest','Required parameter requestParameters.updateChannelPartialRequest was null or undefined when calling updateChannelPartial.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/channels/{type}/{id}`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'PATCH', - headers: headerParameters, - query: queryParameters, - body: requestParameters.updateChannelPartialRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Updates certain fields of the channel Sends events: - channel.updated Required permissions: - UpdateChannel - UpdateChannelCooldown - UpdateChannelFrozen - * Partially update channel - */ - async updateChannelPartial(requestParameters: UpdateChannelPartialOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.updateChannelPartialRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Updates channel type - * Update channel type - */ - async updateChannelTypeRaw(requestParameters: UpdateChannelTypeOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.name === null || requestParameters.name === undefined) { - throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling updateChannelType.'); - } - - if (requestParameters.updateChannelTypeRequest === null || requestParameters.updateChannelTypeRequest === undefined) { - throw new runtime.RequiredError('updateChannelTypeRequest','Required parameter requestParameters.updateChannelTypeRequest was null or undefined when calling updateChannelType.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/channeltypes/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))), - method: 'PUT', - headers: headerParameters, - query: queryParameters, - body: requestParameters.updateChannelTypeRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Updates channel type - * Update channel type - */ - async updateChannelType(requestParameters: UpdateChannelTypeOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.updateChannelTypeRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Updates custom chat command - * Update command - */ - async updateCommandRaw(requestParameters: UpdateCommandOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.name === null || requestParameters.name === undefined) { - throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling updateCommand.'); - } - - if (requestParameters.updateCommandRequest === null || requestParameters.updateCommandRequest === undefined) { - throw new runtime.RequiredError('updateCommandRequest','Required parameter requestParameters.updateCommandRequest was null or undefined when calling updateCommand.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/commands/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))), - method: 'PUT', - headers: headerParameters, - query: queryParameters, - body: requestParameters.updateCommandRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Updates custom chat command - * Update command - */ - async updateCommand(requestParameters: UpdateCommandOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.updateCommandRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * - * Update External Storage - */ - async updateExternalStorageRaw(requestParameters: UpdateExternalStorageOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.name === null || requestParameters.name === undefined) { - throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling updateExternalStorage.'); - } - - if (requestParameters.updateExternalStorageRequest === null || requestParameters.updateExternalStorageRequest === undefined) { - throw new runtime.RequiredError('updateExternalStorageRequest','Required parameter requestParameters.updateExternalStorageRequest was null or undefined when calling updateExternalStorage.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/external_storage/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))), - method: 'PUT', - headers: headerParameters, - query: queryParameters, - body: requestParameters.updateExternalStorageRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * - * Update External Storage - */ - async updateExternalStorage(requestParameters: UpdateExternalStorageOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.updateExternalStorageRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Updates message with new data Sends events: - message.updated Required permissions: - AddLinks - PinMessage - SkipMessageModeration - UpdateMessage - * Update message - */ - async updateMessageRaw(requestParameters: UpdateMessageOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling updateMessage.'); - } - - if (requestParameters.updateMessageRequest === null || requestParameters.updateMessageRequest === undefined) { - throw new runtime.RequiredError('updateMessageRequest','Required parameter requestParameters.updateMessageRequest was null or undefined when calling updateMessage.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/messages/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.updateMessageRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Updates message with new data Sends events: - message.updated Required permissions: - AddLinks - PinMessage - SkipMessageModeration - UpdateMessage - * Update message - */ - async updateMessage(requestParameters: UpdateMessageOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.updateMessageRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Updates certain fields of the message Sends events: - message.updated Required permissions: - AddLinks - PinMessage - SkipMessageModeration - UpdateMessage - * Partially message update - */ - async updateMessagePartialRaw(requestParameters: UpdateMessagePartialOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling updateMessagePartial.'); - } - - if (requestParameters.updateMessagePartialRequest === null || requestParameters.updateMessagePartialRequest === undefined) { - throw new runtime.RequiredError('updateMessagePartialRequest','Required parameter requestParameters.updateMessagePartialRequest was null or undefined when calling updateMessagePartial.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/messages/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'PUT', - headers: headerParameters, - query: queryParameters, - body: requestParameters.updateMessagePartialRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Updates certain fields of the message Sends events: - message.updated Required permissions: - AddLinks - PinMessage - SkipMessageModeration - UpdateMessage - * Partially message update - */ - async updateMessagePartial(requestParameters: UpdateMessagePartialOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.updateMessagePartialRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Updates a poll Sends events: - poll.closed - poll.updated Required permissions: - UpdatePoll - * Update poll - */ - async updatePollRaw(requestParameters: UpdatePollOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.updatePollRequest === null || requestParameters.updatePollRequest === undefined) { - throw new runtime.RequiredError('updatePollRequest','Required parameter requestParameters.updatePollRequest was null or undefined when calling updatePoll.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/polls`, - method: 'PUT', - headers: headerParameters, - query: queryParameters, - body: requestParameters.updatePollRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Updates a poll Sends events: - poll.closed - poll.updated Required permissions: - UpdatePoll - * Update poll - */ - async updatePoll(requestParameters: UpdatePollOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.updatePollRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Updates a poll option Sends events: - poll.updated Required permissions: - UpdatePoll - * Update poll option - */ - async updatePollOptionRaw(requestParameters: UpdatePollOptionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.pollId === null || requestParameters.pollId === undefined) { - throw new runtime.RequiredError('pollId','Required parameter requestParameters.pollId was null or undefined when calling updatePollOption.'); - } - - if (requestParameters.updatePollOptionRequest === null || requestParameters.updatePollOptionRequest === undefined) { - throw new runtime.RequiredError('updatePollOptionRequest','Required parameter requestParameters.updatePollOptionRequest was null or undefined when calling updatePollOption.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/polls/{poll_id}/options`.replace(`{${"poll_id"}}`, encodeURIComponent(String(requestParameters.pollId))), - method: 'PUT', - headers: headerParameters, - query: queryParameters, - body: requestParameters.updatePollOptionRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Updates a poll option Sends events: - poll.updated Required permissions: - UpdatePoll - * Update poll option - */ - async updatePollOption(requestParameters: UpdatePollOptionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.updatePollOptionRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Updates a poll partially Sends events: - poll.updated Required permissions: - UpdatePoll - * Partial update poll - */ - async updatePollPartialRaw(requestParameters: UpdatePollPartialOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.pollId === null || requestParameters.pollId === undefined) { - throw new runtime.RequiredError('pollId','Required parameter requestParameters.pollId was null or undefined when calling updatePollPartial.'); - } - - if (requestParameters.updatePollPartialRequest === null || requestParameters.updatePollPartialRequest === undefined) { - throw new runtime.RequiredError('updatePollPartialRequest','Required parameter requestParameters.updatePollPartialRequest was null or undefined when calling updatePollPartial.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/polls/{poll_id}`.replace(`{${"poll_id"}}`, encodeURIComponent(String(requestParameters.pollId))), - method: 'PATCH', - headers: headerParameters, - query: queryParameters, - body: requestParameters.updatePollPartialRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Updates a poll partially Sends events: - poll.updated Required permissions: - UpdatePoll - * Partial update poll - */ - async updatePollPartial(requestParameters: UpdatePollPartialOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.updatePollPartialRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Updates certain fields of the thread Sends events: - thread.updated Required permissions: - ReadChannel - UpdateThread - * Partially update thread - */ - async updateThreadPartialRaw(requestParameters: UpdateThreadPartialOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.messageId === null || requestParameters.messageId === undefined) { - throw new runtime.RequiredError('messageId','Required parameter requestParameters.messageId was null or undefined when calling updateThreadPartial.'); - } - - if (requestParameters.updateThreadPartialRequest === null || requestParameters.updateThreadPartialRequest === undefined) { - throw new runtime.RequiredError('updateThreadPartialRequest','Required parameter requestParameters.updateThreadPartialRequest was null or undefined when calling updateThreadPartial.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/threads/{message_id}`.replace(`{${"message_id"}}`, encodeURIComponent(String(requestParameters.messageId))), - method: 'PATCH', - headers: headerParameters, - query: queryParameters, - body: requestParameters.updateThreadPartialRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Updates certain fields of the thread Sends events: - thread.updated Required permissions: - ReadChannel - UpdateThread - * Partially update thread - */ - async updateThreadPartial(requestParameters: UpdateThreadPartialOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.updateThreadPartialRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Update or create users in bulk Sends events: - user.updated - * Upsert users - */ - async updateUsersRaw(requestParameters: UpdateUsersOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.updateUsersRequest === null || requestParameters.updateUsersRequest === undefined) { - throw new runtime.RequiredError('updateUsersRequest','Required parameter requestParameters.updateUsersRequest was null or undefined when calling updateUsers.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/users`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.updateUsersRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Update or create users in bulk Sends events: - user.updated - * Upsert users - */ - async updateUsers(requestParameters: UpdateUsersOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.updateUsersRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Updates certain fields of the user Sends events: - user.presence.changed - user.updated - * Partially update user - */ - async updateUsersPartialRaw(requestParameters: UpdateUsersPartialOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.updateUsersPartialRequest === null || requestParameters.updateUsersPartialRequest === undefined) { - throw new runtime.RequiredError('updateUsersPartialRequest','Required parameter requestParameters.updateUsersPartialRequest was null or undefined when calling updateUsersPartial.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/users`, - method: 'PATCH', - headers: headerParameters, - query: queryParameters, - body: requestParameters.updateUsersPartialRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Updates certain fields of the user Sends events: - user.presence.changed - user.updated - * Partially update user - */ - async updateUsersPartial(requestParameters: UpdateUsersPartialOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.updateUsersPartialRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Uploads file Required permissions: - UploadAttachment - * Upload file - */ - async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.type === null || requestParameters.type === undefined) { - throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling uploadFile.'); - } - - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling uploadFile.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const consumes: runtime.Consume[] = [ - { contentType: 'multipart/form-data' }, - ]; - // @ts-ignore: canConsumeForm may be unused - const canConsumeForm = runtime.canConsumeForm(consumes); - - let formParams: { append(param: string, value: any): any }; - let useForm = false; - if (useForm) { - formParams = new FormData(); - } else { - formParams = new URLSearchParams(); - } - - if (requestParameters.file !== undefined) { - formParams.append('file', requestParameters.file as any); - } - - if (requestParameters.user !== undefined) { - - formParams.append('user', new Blob([JSON.stringify(requestParameters.user)], { type: "application/json", })); - } - - const response = await this.request({ - path: `/channels/{type}/{id}/file`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: formParams, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Uploads file Required permissions: - UploadAttachment - * Upload file - */ - async uploadFile(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.uploadFileRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Uploads image Required permissions: - UploadAttachment - * Upload image - */ - async uploadImageRaw(requestParameters: UploadImageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.type === null || requestParameters.type === undefined) { - throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling uploadImage.'); - } - - if (requestParameters.id === null || requestParameters.id === undefined) { - throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling uploadImage.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const consumes: runtime.Consume[] = [ - { contentType: 'multipart/form-data' }, - ]; - // @ts-ignore: canConsumeForm may be unused - const canConsumeForm = runtime.canConsumeForm(consumes); - - let formParams: { append(param: string, value: any): any }; - let useForm = false; - if (useForm) { - formParams = new FormData(); - } else { - formParams = new URLSearchParams(); - } - - if (requestParameters.file !== undefined) { - formParams.append('file', requestParameters.file as any); - } - - if (requestParameters.uploadSizes) { - formParams.append('upload_sizes', requestParameters.uploadSizes.join(runtime.COLLECTION_FORMATS["csv"])); - } - - if (requestParameters.user !== undefined) { - - formParams.append('user', new Blob([JSON.stringify(requestParameters.user)], { type: "application/json", })); - } - - const response = await this.request({ - path: `/channels/{type}/{id}/image`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))), - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: formParams, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Uploads image Required permissions: - UploadAttachment - * Upload image - */ - async uploadImage(requestParameters: UploadImageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.uploadImageRaw(requestParameters, initOverrides); - return await response.value(); - } - - /** - * Upsert a push provider for v2 with multi bundle/package support - * Upsert a push provider - */ - async upsertPushProviderRaw(requestParameters: UpsertPushProviderOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { - if (requestParameters.upsertPushProviderRequest === null || requestParameters.upsertPushProviderRequest === undefined) { - throw new runtime.RequiredError('upsertPushProviderRequest','Required parameter requestParameters.upsertPushProviderRequest was null or undefined when calling upsertPushProvider.'); - } - - const queryParameters: any = {}; - - const headerParameters: runtime.HTTPHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication - } - - if (this.configuration && this.configuration.apiKey) { - queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } - - if (this.configuration && this.configuration.apiKey) { - headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication - } - - const response = await this.request({ - path: `/push_providers`, - method: 'POST', - headers: headerParameters, - query: queryParameters, - body: requestParameters.upsertPushProviderRequest, - }, initOverrides); - - return new runtime.JSONApiResponse(response); - } - - /** - * Upsert a push provider for v2 with multi bundle/package support - * Upsert a push provider - */ - async upsertPushProvider(requestParameters: UpsertPushProviderOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { - const response = await this.upsertPushProviderRaw(requestParameters, initOverrides); - return await response.value(); - } - -} - -/** - * @export - */ -export const DeletePushProviderTypeEnum = { - APN: 'apn', - FIREBASE: 'firebase', - HUAWEI: 'huawei', - XIAOMI: 'xiaomi' -} as const; -export type DeletePushProviderTypeEnum = typeof DeletePushProviderTypeEnum[keyof typeof DeletePushProviderTypeEnum]; diff --git a/src/gen/chat/apis/index.ts b/src/gen/chat/apis/index.ts deleted file mode 100644 index 0c76241..0000000 --- a/src/gen/chat/apis/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export * from './ProductchatApi'; diff --git a/src/gen/chat/index.ts b/src/gen/chat/index.ts deleted file mode 100644 index be9d1ed..0000000 --- a/src/gen/chat/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -export * from './runtime'; -export * from './apis'; -export * from './models'; diff --git a/src/gen/chat/models/index.ts b/src/gen/chat/models/index.ts deleted file mode 100644 index 57a38a4..0000000 --- a/src/gen/chat/models/index.ts +++ /dev/null @@ -1,14766 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/** - * - * @export - * @interface APIError - */ -export interface APIError { - /** - * Response HTTP status code - * @type {number} - * @memberof APIError - */ - StatusCode: number; - /** - * API error code - * @type {number} - * @memberof APIError - */ - code: number; - /** - * Additional error-specific information - * @type {Array} - * @memberof APIError - */ - details: Array; - /** - * Request duration - * @type {string} - * @memberof APIError - */ - duration: string; - /** - * Additional error info - * @type {{ [key: string]: string; }} - * @memberof APIError - */ - exception_fields?: { [key: string]: string; }; - /** - * Message describing an error - * @type {string} - * @memberof APIError - */ - message: string; - /** - * URL with additional information - * @type {string} - * @memberof APIError - */ - more_info: string; -} -/** - * - * @export - * @interface APNConfig - */ -export interface APNConfig { - /** - * - * @type {boolean} - * @memberof APNConfig - */ - Disabled?: boolean; - /** - * - * @type {string} - * @memberof APNConfig - */ - auth_key?: string; - /** - * - * @type {string} - * @memberof APNConfig - */ - auth_type?: APNConfigAuthTypeEnum; - /** - * - * @type {string} - * @memberof APNConfig - */ - bundle_id?: string; - /** - * - * @type {boolean} - * @memberof APNConfig - */ - development?: boolean; - /** - * - * @type {string} - * @memberof APNConfig - */ - host?: string; - /** - * - * @type {string} - * @memberof APNConfig - */ - key_id?: string; - /** - * - * @type {string} - * @memberof APNConfig - */ - notification_template?: string; - /** - * - * @type {string} - * @memberof APNConfig - */ - p12_cert?: string; - /** - * - * @type {string} - * @memberof APNConfig - */ - team_id?: string; -} - - -/** - * @export - */ -export const APNConfigAuthTypeEnum = { - CERTIFICATE: 'certificate', - TOKEN: 'token' -} as const; -export type APNConfigAuthTypeEnum = typeof APNConfigAuthTypeEnum[keyof typeof APNConfigAuthTypeEnum]; - -/** - * - * @export - * @interface APNConfigFields - */ -export interface APNConfigFields { - /** - * - * @type {string} - * @memberof APNConfigFields - */ - auth_key?: string; - /** - * - * @type {string} - * @memberof APNConfigFields - */ - auth_type?: string; - /** - * - * @type {string} - * @memberof APNConfigFields - */ - bundle_id?: string; - /** - * - * @type {boolean} - * @memberof APNConfigFields - */ - development: boolean; - /** - * - * @type {boolean} - * @memberof APNConfigFields - */ - enabled: boolean; - /** - * - * @type {string} - * @memberof APNConfigFields - */ - host?: string; - /** - * - * @type {string} - * @memberof APNConfigFields - */ - key_id?: string; - /** - * - * @type {string} - * @memberof APNConfigFields - */ - notification_template: string; - /** - * - * @type {string} - * @memberof APNConfigFields - */ - p12_cert?: string; - /** - * - * @type {string} - * @memberof APNConfigFields - */ - team_id?: string; -} -/** - * - * @export - * @interface APNS - */ -export interface APNS { - /** - * - * @type {string} - * @memberof APNS - */ - body: string; - /** - * - * @type {string} - * @memberof APNS - */ - title: string; -} -/** - * - * @export - * @interface Action - */ -export interface Action { - /** - * - * @type {string} - * @memberof Action - */ - name: string; - /** - * - * @type {string} - * @memberof Action - */ - style?: string; - /** - * - * @type {string} - * @memberof Action - */ - text: string; - /** - * - * @type {string} - * @memberof Action - */ - type: string; - /** - * - * @type {string} - * @memberof Action - */ - value?: string; -} -/** - * - * @export - * @interface AgoraCall - */ -export interface AgoraCall { - /** - * - * @type {string} - * @memberof AgoraCall - */ - channel: string; -} -/** - * - * @export - * @interface AppResponseFields - */ -export interface AppResponseFields { - /** - * - * @type {Config} - * @memberof AppResponseFields - */ - agora_options?: Config; - /** - * - * @type {Array} - * @memberof AppResponseFields - */ - allowed_flag_reasons?: Array; - /** - * - * @type {boolean} - * @memberof AppResponseFields - */ - async_url_enrich_enabled: boolean; - /** - * - * @type {boolean} - * @memberof AppResponseFields - */ - auto_translation_enabled: boolean; - /** - * - * @type {string} - * @memberof AppResponseFields - */ - before_message_send_hook_url?: string; - /** - * - * @type {{ [key: string]: CallType; }} - * @memberof AppResponseFields - */ - call_types: { [key: string]: CallType; }; - /** - * - * @type {boolean} - * @memberof AppResponseFields - */ - campaign_enabled: boolean; - /** - * - * @type {number} - * @memberof AppResponseFields - */ - cdn_expiration_seconds: number; - /** - * - * @type {{ [key: string]: ChannelConfig; }} - * @memberof AppResponseFields - */ - channel_configs: { [key: string]: ChannelConfig; }; - /** - * - * @type {string} - * @memberof AppResponseFields - */ - custom_action_handler_url: string; - /** - * - * @type {DataDogInfo} - * @memberof AppResponseFields - */ - datadog_info?: DataDogInfo; - /** - * - * @type {boolean} - * @memberof AppResponseFields - */ - disable_auth_checks: boolean; - /** - * - * @type {boolean} - * @memberof AppResponseFields - */ - disable_permissions_checks: boolean; - /** - * - * @type {string} - * @memberof AppResponseFields - */ - enforce_unique_usernames: string; - /** - * - * @type {FileUploadConfig} - * @memberof AppResponseFields - */ - file_upload_config: FileUploadConfig; - /** - * - * @type {Array} - * @memberof AppResponseFields - */ - geofences?: Array; - /** - * - * @type {{ [key: string]: Array; }} - * @memberof AppResponseFields - */ - grants: { [key: string]: Array; }; - /** - * - * @type {Config} - * @memberof AppResponseFields - */ - hms_options?: Config; - /** - * - * @type {boolean} - * @memberof AppResponseFields - */ - image_moderation_enabled: boolean; - /** - * - * @type {Array} - * @memberof AppResponseFields - */ - image_moderation_labels?: Array; - /** - * - * @type {FileUploadConfig} - * @memberof AppResponseFields - */ - image_upload_config: FileUploadConfig; - /** - * - * @type {boolean} - * @memberof AppResponseFields - */ - multi_tenant_enabled: boolean; - /** - * - * @type {string} - * @memberof AppResponseFields - */ - name: string; - /** - * - * @type {string} - * @memberof AppResponseFields - */ - organization: string; - /** - * - * @type {string} - * @memberof AppResponseFields - */ - permission_version: string; - /** - * - * @type {{ [key: string]: Array; }} - * @memberof AppResponseFields - */ - policies: { [key: string]: Array; }; - /** - * - * @type {boolean} - * @memberof AppResponseFields - */ - polls_enabled: boolean; - /** - * - * @type {PushNotificationFields} - * @memberof AppResponseFields - */ - push_notifications: PushNotificationFields; - /** - * - * @type {number} - * @memberof AppResponseFields - */ - reminders_interval: number; - /** - * - * @type {string} - * @memberof AppResponseFields - */ - revoke_tokens_issued_before?: string; - /** - * - * @type {string} - * @memberof AppResponseFields - */ - sns_key: string; - /** - * - * @type {string} - * @memberof AppResponseFields - */ - sns_secret: string; - /** - * - * @type {string} - * @memberof AppResponseFields - */ - sns_topic_arn: string; - /** - * - * @type {string} - * @memberof AppResponseFields - */ - sqs_key: string; - /** - * - * @type {string} - * @memberof AppResponseFields - */ - sqs_secret: string; - /** - * - * @type {string} - * @memberof AppResponseFields - */ - sqs_url: string; - /** - * - * @type {boolean} - * @memberof AppResponseFields - */ - suspended: boolean; - /** - * - * @type {string} - * @memberof AppResponseFields - */ - suspended_explanation: string; - /** - * - * @type {Array} - * @memberof AppResponseFields - */ - user_search_disallowed_roles: Array; - /** - * - * @type {string} - * @memberof AppResponseFields - */ - video_provider: string; - /** - * - * @type {Array} - * @memberof AppResponseFields - */ - webhook_events: Array; - /** - * - * @type {string} - * @memberof AppResponseFields - */ - webhook_url: string; -} -/** - * - * @export - * @interface AsyncModerationCallbackConfig - */ -export interface AsyncModerationCallbackConfig { - /** - * - * @type {string} - * @memberof AsyncModerationCallbackConfig - */ - mode?: AsyncModerationCallbackConfigModeEnum; - /** - * - * @type {string} - * @memberof AsyncModerationCallbackConfig - */ - server_url?: string; -} - - -/** - * @export - */ -export const AsyncModerationCallbackConfigModeEnum = { - NONE: 'CALLBACK_MODE_NONE', - REST: 'CALLBACK_MODE_REST', - TWIRP: 'CALLBACK_MODE_TWIRP' -} as const; -export type AsyncModerationCallbackConfigModeEnum = typeof AsyncModerationCallbackConfigModeEnum[keyof typeof AsyncModerationCallbackConfigModeEnum]; - -/** - * - * @export - * @interface AsyncModerationConfiguration - */ -export interface AsyncModerationConfiguration { - /** - * - * @type {AsyncModerationCallbackConfig} - * @memberof AsyncModerationConfiguration - */ - callback?: AsyncModerationCallbackConfig; - /** - * - * @type {number} - * @memberof AsyncModerationConfiguration - */ - timeout_ms?: number; -} -/** - * - * @export - * @interface Attachment - */ -export interface Attachment { - /** - * - * @type {Array} - * @memberof Attachment - */ - actions?: Array; - /** - * - * @type {string} - * @memberof Attachment - */ - asset_url?: string; - /** - * - * @type {string} - * @memberof Attachment - */ - author_icon?: string; - /** - * - * @type {string} - * @memberof Attachment - */ - author_link?: string; - /** - * - * @type {string} - * @memberof Attachment - */ - author_name?: string; - /** - * - * @type {string} - * @memberof Attachment - */ - color?: string; - /** - * - * @type {{ [key: string]: any; }} - * @memberof Attachment - */ - custom: { [key: string]: any; }; - /** - * - * @type {string} - * @memberof Attachment - */ - fallback?: string; - /** - * - * @type {Array} - * @memberof Attachment - */ - fields?: Array; - /** - * - * @type {string} - * @memberof Attachment - */ - footer?: string; - /** - * - * @type {string} - * @memberof Attachment - */ - footer_icon?: string; - /** - * - * @type {Images} - * @memberof Attachment - */ - giphy?: Images; - /** - * - * @type {string} - * @memberof Attachment - */ - image_url?: string; - /** - * - * @type {string} - * @memberof Attachment - */ - og_scrape_url?: string; - /** - * - * @type {number} - * @memberof Attachment - */ - original_height?: number; - /** - * - * @type {number} - * @memberof Attachment - */ - original_width?: number; - /** - * - * @type {string} - * @memberof Attachment - */ - pretext?: string; - /** - * - * @type {string} - * @memberof Attachment - */ - text?: string; - /** - * - * @type {string} - * @memberof Attachment - */ - thumb_url?: string; - /** - * - * @type {string} - * @memberof Attachment - */ - title?: string; - /** - * - * @type {string} - * @memberof Attachment - */ - title_link?: string; - /** - * Attachment type (e.g. image, video, url, poll) - * @type {string} - * @memberof Attachment - */ - type?: string; -} -/** - * - * @export - * @interface AudioSettings - */ -export interface AudioSettings { - /** - * - * @type {boolean} - * @memberof AudioSettings - */ - access_request_enabled: boolean; - /** - * - * @type {string} - * @memberof AudioSettings - */ - default_device: AudioSettingsDefaultDeviceEnum; - /** - * - * @type {boolean} - * @memberof AudioSettings - */ - mic_default_on: boolean; - /** - * - * @type {NoiseCancellationSettings} - * @memberof AudioSettings - */ - noise_cancellation?: NoiseCancellationSettings; - /** - * - * @type {boolean} - * @memberof AudioSettings - */ - opus_dtx_enabled: boolean; - /** - * - * @type {boolean} - * @memberof AudioSettings - */ - redundant_coding_enabled: boolean; - /** - * - * @type {boolean} - * @memberof AudioSettings - */ - speaker_default_on: boolean; -} - - -/** - * @export - */ -export const AudioSettingsDefaultDeviceEnum = { - SPEAKER: 'speaker', - EARPIECE: 'earpiece' -} as const; -export type AudioSettingsDefaultDeviceEnum = typeof AudioSettingsDefaultDeviceEnum[keyof typeof AudioSettingsDefaultDeviceEnum]; - -/** - * - * @export - * @interface AutomodDetails - */ -export interface AutomodDetails { - /** - * - * @type {string} - * @memberof AutomodDetails - */ - action?: string; - /** - * - * @type {Array} - * @memberof AutomodDetails - */ - image_labels?: Array; - /** - * - * @type {FlagMessageDetails} - * @memberof AutomodDetails - */ - message_details?: FlagMessageDetails; - /** - * - * @type {string} - * @memberof AutomodDetails - */ - original_message_type?: string; - /** - * - * @type {MessageModerationResult} - * @memberof AutomodDetails - */ - result?: MessageModerationResult; -} -/** - * - * @export - * @interface AzureRequest - */ -export interface AzureRequest { - /** - * - * @type {string} - * @memberof AzureRequest - */ - abs_account_name: string; - /** - * - * @type {string} - * @memberof AzureRequest - */ - abs_client_id: string; - /** - * - * @type {string} - * @memberof AzureRequest - */ - abs_client_secret: string; - /** - * - * @type {string} - * @memberof AzureRequest - */ - abs_tenant_id: string; -} -/** - * - * @export - * @interface BackstageSettings - */ -export interface BackstageSettings { - /** - * - * @type {boolean} - * @memberof BackstageSettings - */ - enabled: boolean; - /** - * - * @type {number} - * @memberof BackstageSettings - */ - join_ahead_time_seconds?: number; -} -/** - * - * @export - * @interface BanRequest - */ -export interface BanRequest { - /** - * - * @type {UserRequest} - * @memberof BanRequest - */ - banned_by?: UserRequest; - /** - * User ID who issued a ban - * @type {string} - * @memberof BanRequest - */ - banned_by_id?: string; - /** - * Channel CID to ban user in eg. messaging:123 - * @type {string} - * @memberof BanRequest - */ - channel_cid?: string; - /** - * Whether to perform IP ban or not - * @type {boolean} - * @memberof BanRequest - */ - ip_ban?: boolean; - /** - * Ban reason - * @type {string} - * @memberof BanRequest - */ - reason?: string; - /** - * Whether to perform shadow ban or not - * @type {boolean} - * @memberof BanRequest - */ - shadow?: boolean; - /** - * ID of user to ban - * @type {string} - * @memberof BanRequest - */ - target_user_id: string; - /** - * Timeout of ban in minutes. User will be unbanned after this period of time - * @type {number} - * @memberof BanRequest - */ - timeout?: number; - /** - * - * @type {UserRequest} - * @memberof BanRequest - */ - user?: UserRequest; - /** - * - * @type {string} - * @memberof BanRequest - */ - user_id?: string; -} -/** - * - * @export - * @interface BanResponse - */ -export interface BanResponse { - /** - * - * @type {UserObject} - * @memberof BanResponse - */ - banned_by?: UserObject; - /** - * - * @type {ChannelResponse} - * @memberof BanResponse - */ - channel?: ChannelResponse; - /** - * - * @type {string} - * @memberof BanResponse - */ - created_at: string; - /** - * - * @type {string} - * @memberof BanResponse - */ - expires?: string; - /** - * - * @type {string} - * @memberof BanResponse - */ - reason?: string; - /** - * - * @type {boolean} - * @memberof BanResponse - */ - shadow?: boolean; - /** - * - * @type {UserObject} - * @memberof BanResponse - */ - user?: UserObject; -} -/** - * Block list contains restricted words - * @export - * @interface BlockList - */ -export interface BlockList { - /** - * Date/time of creation - * @type {string} - * @memberof BlockList - */ - created_at?: string; - /** - * Block list name - * @type {string} - * @memberof BlockList - */ - name: string; - /** - * Block list type. - * @type {string} - * @memberof BlockList - */ - type: string; - /** - * Date/time of the last update - * @type {string} - * @memberof BlockList - */ - updated_at?: string; - /** - * List of words to block - * @type {Array} - * @memberof BlockList - */ - words: Array; -} -/** - * - * @export - * @interface BlockListOptions - */ -export interface BlockListOptions { - /** - * - * @type {string} - * @memberof BlockListOptions - */ - behavior: BlockListOptionsBehaviorEnum; - /** - * - * @type {string} - * @memberof BlockListOptions - */ - blocklist: string; -} - - -/** - * @export - */ -export const BlockListOptionsBehaviorEnum = { - FLAG: 'flag', - BLOCK: 'block', - SHADOW_BLOCK: 'shadow_block' -} as const; -export type BlockListOptionsBehaviorEnum = typeof BlockListOptionsBehaviorEnum[keyof typeof BlockListOptionsBehaviorEnum]; - -/** - * - * @export - * @interface BlockUsersRequest - */ -export interface BlockUsersRequest { - /** - * User id to block - * @type {string} - * @memberof BlockUsersRequest - */ - blocked_user_id: string; - /** - * - * @type {UserRequest} - * @memberof BlockUsersRequest - */ - user?: UserRequest; - /** - * - * @type {string} - * @memberof BlockUsersRequest - */ - user_id?: string; -} -/** - * - * @export - * @interface BlockUsersResponse - */ -export interface BlockUsersResponse { - /** - * - * @type {string} - * @memberof BlockUsersResponse - */ - blocked_by_user_id: string; - /** - * - * @type {string} - * @memberof BlockUsersResponse - */ - blocked_user_id: string; - /** - * - * @type {string} - * @memberof BlockUsersResponse - */ - created_at: string; - /** - * Duration of the request in human-readable format - * @type {string} - * @memberof BlockUsersResponse - */ - duration: string; -} -/** - * - * @export - * @interface BlockedUserResponse - */ -export interface BlockedUserResponse { - /** - * - * @type {UserResponse} - * @memberof BlockedUserResponse - */ - blocked_user: UserResponse; - /** - * ID of the user who got blocked - * @type {string} - * @memberof BlockedUserResponse - */ - blocked_user_id: string; - /** - * - * @type {string} - * @memberof BlockedUserResponse - */ - created_at: string; - /** - * - * @type {UserResponse} - * @memberof BlockedUserResponse - */ - user: UserResponse; - /** - * ID of the user who blocked another user - * @type {string} - * @memberof BlockedUserResponse - */ - user_id: string; -} -/** - * - * @export - * @interface BroadcastSettings - */ -export interface BroadcastSettings { - /** - * - * @type {boolean} - * @memberof BroadcastSettings - */ - enabled: boolean; - /** - * - * @type {HLSSettings} - * @memberof BroadcastSettings - */ - hls: HLSSettings; -} -/** - * - * @export - * @interface Call - */ -export interface Call { - /** - * - * @type {AgoraCall} - * @memberof Call - */ - agora?: AgoraCall; - /** - * - * @type {HMSCall} - * @memberof Call - */ - hms?: HMSCall; - /** - * - * @type {string} - * @memberof Call - */ - id: string; - /** - * - * @type {string} - * @memberof Call - */ - provider: string; - /** - * - * @type {string} - * @memberof Call - */ - type: string; -} -/** - * - * @export - * @interface CallSettings - */ -export interface CallSettings { - /** - * - * @type {AudioSettings} - * @memberof CallSettings - */ - audio?: AudioSettings; - /** - * - * @type {BackstageSettings} - * @memberof CallSettings - */ - backstage?: BackstageSettings; - /** - * - * @type {BroadcastSettings} - * @memberof CallSettings - */ - broadcasting?: BroadcastSettings; - /** - * - * @type {GeofenceSettings} - * @memberof CallSettings - */ - geofencing?: GeofenceSettings; - /** - * - * @type {LimitsSettings} - * @memberof CallSettings - */ - limits?: LimitsSettings; - /** - * - * @type {RecordSettings} - * @memberof CallSettings - */ - recording?: RecordSettings; - /** - * - * @type {RingSettings} - * @memberof CallSettings - */ - ring?: RingSettings; - /** - * - * @type {ScreensharingSettings} - * @memberof CallSettings - */ - screensharing?: ScreensharingSettings; - /** - * - * @type {ThumbnailsSettings} - * @memberof CallSettings - */ - thumbnails?: ThumbnailsSettings; - /** - * - * @type {TranscriptionSettings} - * @memberof CallSettings - */ - transcription?: TranscriptionSettings; - /** - * - * @type {VideoSettings} - * @memberof CallSettings - */ - video?: VideoSettings; -} -/** - * - * @export - * @interface CallType - */ -export interface CallType { - /** - * - * @type {number} - * @memberof CallType - */ - AppPK: number; - /** - * - * @type {string} - * @memberof CallType - */ - CreatedAt: string; - /** - * - * @type {string} - * @memberof CallType - */ - ExternalStorage: string; - /** - * - * @type {string} - * @memberof CallType - */ - Name: string; - /** - * - * @type {NotificationSettings} - * @memberof CallType - */ - NotificationSettings?: NotificationSettings; - /** - * - * @type {number} - * @memberof CallType - */ - PK: number; - /** - * - * @type {CallSettings} - * @memberof CallType - */ - Settings?: CallSettings; - /** - * - * @type {string} - * @memberof CallType - */ - UpdatedAt: string; -} -/** - * - * @export - * @interface CastPollVoteRequest - */ -export interface CastPollVoteRequest { - /** - * - * @type {UserRequest} - * @memberof CastPollVoteRequest - */ - user?: UserRequest; - /** - * - * @type {string} - * @memberof CastPollVoteRequest - */ - user_id?: string; - /** - * - * @type {VoteData} - * @memberof CastPollVoteRequest - */ - vote?: VoteData; -} -/** - * - * @export - * @interface Channel - */ -export interface Channel { - /** - * - * @type {boolean} - * @memberof Channel - */ - auto_translation_enabled?: boolean; - /** - * - * @type {string} - * @memberof Channel - */ - auto_translation_language: string; - /** - * - * @type {string} - * @memberof Channel - */ - cid: string; - /** - * - * @type {ChannelConfig} - * @memberof Channel - */ - config?: ChannelConfig; - /** - * - * @type {ChannelConfig} - * @memberof Channel - */ - config_overrides?: ChannelConfig; - /** - * - * @type {number} - * @memberof Channel - */ - cooldown?: number; - /** - * - * @type {string} - * @memberof Channel - */ - created_at: string; - /** - * - * @type {UserObject} - * @memberof Channel - */ - created_by?: UserObject; - /** - * - * @type {{ [key: string]: any; }} - * @memberof Channel - */ - custom: { [key: string]: any; }; - /** - * - * @type {string} - * @memberof Channel - */ - deleted_at?: string; - /** - * - * @type {boolean} - * @memberof Channel - */ - disabled: boolean; - /** - * - * @type {boolean} - * @memberof Channel - */ - frozen: boolean; - /** - * - * @type {string} - * @memberof Channel - */ - id: string; - /** - * - * @type {Array} - * @memberof Channel - */ - invites?: Array; - /** - * - * @type {string} - * @memberof Channel - */ - last_message_at?: string; - /** - * - * @type {number} - * @memberof Channel - */ - member_count?: number; - /** - * - * @type {Array} - * @memberof Channel - */ - members?: Array; - /** - * - * @type {string} - * @memberof Channel - */ - team?: string; - /** - * - * @type {UserObject} - * @memberof Channel - */ - truncated_by?: UserObject; - /** - * - * @type {string} - * @memberof Channel - */ - type: string; - /** - * - * @type {string} - * @memberof Channel - */ - updated_at: string; -} -/** - * - * @export - * @interface ChannelConfig - */ -export interface ChannelConfig { - /** - * - * @type {Array} - * @memberof ChannelConfig - */ - allowed_flag_reasons?: Array; - /** - * - * @type {string} - * @memberof ChannelConfig - */ - automod: ChannelConfigAutomodEnum; - /** - * - * @type {string} - * @memberof ChannelConfig - */ - automod_behavior: ChannelConfigAutomodBehaviorEnum; - /** - * - * @type {Thresholds} - * @memberof ChannelConfig - */ - automod_thresholds?: Thresholds; - /** - * - * @type {string} - * @memberof ChannelConfig - */ - blocklist?: string; - /** - * - * @type {string} - * @memberof ChannelConfig - */ - blocklist_behavior?: ChannelConfigBlocklistBehaviorEnum; - /** - * - * @type {Array} - * @memberof ChannelConfig - */ - blocklists?: Array; - /** - * List of commands that channel supports - * @type {Array} - * @memberof ChannelConfig - */ - commands: Array; - /** - * - * @type {boolean} - * @memberof ChannelConfig - */ - connect_events: boolean; - /** - * - * @type {string} - * @memberof ChannelConfig - */ - created_at: string; - /** - * - * @type {boolean} - * @memberof ChannelConfig - */ - custom_events: boolean; - /** - * - * @type {boolean} - * @memberof ChannelConfig - */ - mark_messages_pending: boolean; - /** - * - * @type {number} - * @memberof ChannelConfig - */ - max_message_length: number; - /** - * - * @type {boolean} - * @memberof ChannelConfig - */ - mutes: boolean; - /** - * - * @type {string} - * @memberof ChannelConfig - */ - name: string; - /** - * - * @type {boolean} - * @memberof ChannelConfig - */ - polls: boolean; - /** - * - * @type {boolean} - * @memberof ChannelConfig - */ - push_notifications: boolean; - /** - * - * @type {boolean} - * @memberof ChannelConfig - */ - quotes: boolean; - /** - * - * @type {boolean} - * @memberof ChannelConfig - */ - reactions: boolean; - /** - * - * @type {boolean} - * @memberof ChannelConfig - */ - read_events: boolean; - /** - * - * @type {boolean} - * @memberof ChannelConfig - */ - reminders: boolean; - /** - * - * @type {boolean} - * @memberof ChannelConfig - */ - replies: boolean; - /** - * - * @type {boolean} - * @memberof ChannelConfig - */ - search: boolean; - /** - * - * @type {boolean} - * @memberof ChannelConfig - */ - typing_events: boolean; - /** - * - * @type {string} - * @memberof ChannelConfig - */ - updated_at: string; - /** - * - * @type {boolean} - * @memberof ChannelConfig - */ - uploads: boolean; - /** - * - * @type {boolean} - * @memberof ChannelConfig - */ - url_enrichment: boolean; -} - - -/** - * @export - */ -export const ChannelConfigAutomodEnum = { - DISABLED: 'disabled', - SIMPLE: 'simple', - AI: 'AI' -} as const; -export type ChannelConfigAutomodEnum = typeof ChannelConfigAutomodEnum[keyof typeof ChannelConfigAutomodEnum]; - -/** - * @export - */ -export const ChannelConfigAutomodBehaviorEnum = { - FLAG: 'flag', - BLOCK: 'block', - SHADOW_BLOCK: 'shadow_block' -} as const; -export type ChannelConfigAutomodBehaviorEnum = typeof ChannelConfigAutomodBehaviorEnum[keyof typeof ChannelConfigAutomodBehaviorEnum]; - -/** - * @export - */ -export const ChannelConfigBlocklistBehaviorEnum = { - FLAG: 'flag', - BLOCK: 'block', - SHADOW_BLOCK: 'shadow_block' -} as const; -export type ChannelConfigBlocklistBehaviorEnum = typeof ChannelConfigBlocklistBehaviorEnum[keyof typeof ChannelConfigBlocklistBehaviorEnum]; - -/** - * - * @export - * @interface ChannelConfigWithInfo - */ -export interface ChannelConfigWithInfo { - /** - * - * @type {Array} - * @memberof ChannelConfigWithInfo - */ - allowed_flag_reasons?: Array; - /** - * - * @type {string} - * @memberof ChannelConfigWithInfo - */ - automod: ChannelConfigWithInfoAutomodEnum; - /** - * - * @type {string} - * @memberof ChannelConfigWithInfo - */ - automod_behavior: ChannelConfigWithInfoAutomodBehaviorEnum; - /** - * - * @type {Thresholds} - * @memberof ChannelConfigWithInfo - */ - automod_thresholds?: Thresholds; - /** - * - * @type {string} - * @memberof ChannelConfigWithInfo - */ - blocklist?: string; - /** - * - * @type {string} - * @memberof ChannelConfigWithInfo - */ - blocklist_behavior?: ChannelConfigWithInfoBlocklistBehaviorEnum; - /** - * - * @type {Array} - * @memberof ChannelConfigWithInfo - */ - blocklists?: Array; - /** - * - * @type {Array} - * @memberof ChannelConfigWithInfo - */ - commands: Array; - /** - * - * @type {boolean} - * @memberof ChannelConfigWithInfo - */ - connect_events: boolean; - /** - * - * @type {string} - * @memberof ChannelConfigWithInfo - */ - created_at: string; - /** - * - * @type {boolean} - * @memberof ChannelConfigWithInfo - */ - custom_events: boolean; - /** - * - * @type {{ [key: string]: Array; }} - * @memberof ChannelConfigWithInfo - */ - grants?: { [key: string]: Array; }; - /** - * - * @type {boolean} - * @memberof ChannelConfigWithInfo - */ - mark_messages_pending: boolean; - /** - * - * @type {number} - * @memberof ChannelConfigWithInfo - */ - max_message_length: number; - /** - * - * @type {boolean} - * @memberof ChannelConfigWithInfo - */ - mutes: boolean; - /** - * - * @type {string} - * @memberof ChannelConfigWithInfo - */ - name: string; - /** - * - * @type {boolean} - * @memberof ChannelConfigWithInfo - */ - polls: boolean; - /** - * - * @type {boolean} - * @memberof ChannelConfigWithInfo - */ - push_notifications: boolean; - /** - * - * @type {boolean} - * @memberof ChannelConfigWithInfo - */ - quotes: boolean; - /** - * - * @type {boolean} - * @memberof ChannelConfigWithInfo - */ - reactions: boolean; - /** - * - * @type {boolean} - * @memberof ChannelConfigWithInfo - */ - read_events: boolean; - /** - * - * @type {boolean} - * @memberof ChannelConfigWithInfo - */ - reminders: boolean; - /** - * - * @type {boolean} - * @memberof ChannelConfigWithInfo - */ - replies: boolean; - /** - * - * @type {boolean} - * @memberof ChannelConfigWithInfo - */ - search: boolean; - /** - * - * @type {boolean} - * @memberof ChannelConfigWithInfo - */ - typing_events: boolean; - /** - * - * @type {string} - * @memberof ChannelConfigWithInfo - */ - updated_at: string; - /** - * - * @type {boolean} - * @memberof ChannelConfigWithInfo - */ - uploads: boolean; - /** - * - * @type {boolean} - * @memberof ChannelConfigWithInfo - */ - url_enrichment: boolean; -} - - -/** - * @export - */ -export const ChannelConfigWithInfoAutomodEnum = { - DISABLED: 'disabled', - SIMPLE: 'simple', - AI: 'AI' -} as const; -export type ChannelConfigWithInfoAutomodEnum = typeof ChannelConfigWithInfoAutomodEnum[keyof typeof ChannelConfigWithInfoAutomodEnum]; - -/** - * @export - */ -export const ChannelConfigWithInfoAutomodBehaviorEnum = { - FLAG: 'flag', - BLOCK: 'block', - SHADOW_BLOCK: 'shadow_block' -} as const; -export type ChannelConfigWithInfoAutomodBehaviorEnum = typeof ChannelConfigWithInfoAutomodBehaviorEnum[keyof typeof ChannelConfigWithInfoAutomodBehaviorEnum]; - -/** - * @export - */ -export const ChannelConfigWithInfoBlocklistBehaviorEnum = { - FLAG: 'flag', - BLOCK: 'block', - SHADOW_BLOCK: 'shadow_block' -} as const; -export type ChannelConfigWithInfoBlocklistBehaviorEnum = typeof ChannelConfigWithInfoBlocklistBehaviorEnum[keyof typeof ChannelConfigWithInfoBlocklistBehaviorEnum]; - -/** - * - * @export - * @interface ChannelExport - */ -export interface ChannelExport { - /** - * - * @type {string} - * @memberof ChannelExport - */ - cid?: string; - /** - * Channel ID - * @type {string} - * @memberof ChannelExport - */ - id?: string; - /** - * Date to export messages since - * @type {string} - * @memberof ChannelExport - */ - messages_since?: string; - /** - * Date to export messages until - * @type {string} - * @memberof ChannelExport - */ - messages_until?: string; - /** - * Channel type - * @type {string} - * @memberof ChannelExport - */ - type?: string; -} -/** - * - * @export - * @interface ChannelGetOrCreateRequest - */ -export interface ChannelGetOrCreateRequest { - /** - * - * @type {ChannelInput} - * @memberof ChannelGetOrCreateRequest - */ - data?: ChannelInput; - /** - * Whether this channel will be hidden for the user who created the channel or not - * @type {boolean} - * @memberof ChannelGetOrCreateRequest - */ - hide_for_creator?: boolean; - /** - * - * @type {PaginationParams} - * @memberof ChannelGetOrCreateRequest - */ - members?: PaginationParams; - /** - * - * @type {object} - * @memberof ChannelGetOrCreateRequest - */ - messages?: object; - /** - * Refresh channel state - * @type {boolean} - * @memberof ChannelGetOrCreateRequest - */ - state?: boolean; - /** - * - * @type {boolean} - * @memberof ChannelGetOrCreateRequest - */ - thread_unread_counts?: boolean; - /** - * - * @type {PaginationParams} - * @memberof ChannelGetOrCreateRequest - */ - watchers?: PaginationParams; -} -/** - * - * @export - * @interface ChannelInput - */ -export interface ChannelInput { - [key: string]: any; - /** - * Enable or disable auto translation - * @type {boolean} - * @memberof ChannelInput - */ - auto_translation_enabled?: boolean; - /** - * Switch auto translation language - * @type {string} - * @memberof ChannelInput - */ - auto_translation_language?: string; - /** - * - * @type {ChannelConfig} - * @memberof ChannelInput - */ - config_overrides?: ChannelConfig; - /** - * - * @type {UserObject} - * @memberof ChannelInput - */ - created_by?: UserObject; - /** - * - * @type {string} - * @memberof ChannelInput - */ - created_by_id?: string; - /** - * - * @type {{ [key: string]: any; }} - * @memberof ChannelInput - */ - custom?: { [key: string]: any; }; - /** - * - * @type {boolean} - * @memberof ChannelInput - */ - disabled?: boolean; - /** - * Freeze or unfreeze the channel - * @type {boolean} - * @memberof ChannelInput - */ - frozen?: boolean; - /** - * - * @type {Array} - * @memberof ChannelInput - */ - invites?: Array; - /** - * - * @type {Array} - * @memberof ChannelInput - */ - members?: Array>; - /** - * Team the channel belongs to (if multi-tenant mode is enabled) - * @type {string} - * @memberof ChannelInput - */ - team?: string; - /** - * - * @type {string} - * @memberof ChannelInput - */ - truncated_by_id?: string; -} -/** - * - * @export - * @interface ChannelMember - */ -export interface ChannelMember { - /** - * Expiration date of the ban - * @type {string} - * @memberof ChannelMember - */ - ban_expires?: string; - /** - * Whether member is banned this channel or not - * @type {boolean} - * @memberof ChannelMember - */ - banned: boolean; - /** - * Role of the member in the channel - * @type {string} - * @memberof ChannelMember - */ - channel_role: string; - /** - * Date/time of creation - * @type {string} - * @memberof ChannelMember - */ - created_at: string; - /** - * - * @type {string} - * @memberof ChannelMember - */ - deleted_at?: string; - /** - * Date when invite was accepted - * @type {string} - * @memberof ChannelMember - */ - invite_accepted_at?: string; - /** - * Date when invite was rejected - * @type {string} - * @memberof ChannelMember - */ - invite_rejected_at?: string; - /** - * Whether member was invited or not - * @type {boolean} - * @memberof ChannelMember - */ - invited?: boolean; - /** - * Whether member is channel moderator or not - * @type {boolean} - * @memberof ChannelMember - */ - is_moderator?: boolean; - /** - * - * @type {boolean} - * @memberof ChannelMember - */ - notifications_muted: boolean; - /** - * Whether member is shadow banned in this channel or not - * @type {boolean} - * @memberof ChannelMember - */ - shadow_banned: boolean; - /** - * - * @type {string} - * @memberof ChannelMember - */ - status?: string; - /** - * Date/time of the last update - * @type {string} - * @memberof ChannelMember - */ - updated_at: string; - /** - * - * @type {UserObject} - * @memberof ChannelMember - */ - user?: UserObject; - /** - * - * @type {string} - * @memberof ChannelMember - */ - user_id?: string; -} -/** - * - * @export - * @interface ChannelMute - */ -export interface ChannelMute { - /** - * - * @type {ChannelResponse} - * @memberof ChannelMute - */ - channel?: ChannelResponse; - /** - * Date/time of creation - * @type {string} - * @memberof ChannelMute - */ - created_at: string; - /** - * Date/time of mute expiration - * @type {string} - * @memberof ChannelMute - */ - expires?: string; - /** - * Date/time of the last update - * @type {string} - * @memberof ChannelMute - */ - updated_at: string; - /** - * - * @type {UserObject} - * @memberof ChannelMute - */ - user?: UserObject; -} -/** - * Represents channel in chat - * @export - * @interface ChannelResponse - */ -export interface ChannelResponse { - [key: string]: any; - /** - * Whether auto translation is enabled or not - * @type {boolean} - * @memberof ChannelResponse - */ - auto_translation_enabled?: boolean; - /** - * Language to translate to when auto translation is active - * @type {string} - * @memberof ChannelResponse - */ - auto_translation_language?: string; - /** - * Whether this channel is blocked by current user or not - * @type {boolean} - * @memberof ChannelResponse - */ - blocked?: boolean; - /** - * Channel CID (:) - * @type {string} - * @memberof ChannelResponse - */ - cid: string; - /** - * - * @type {ChannelConfigWithInfo} - * @memberof ChannelResponse - */ - config?: ChannelConfigWithInfo; - /** - * Cooldown period after sending each message - * @type {number} - * @memberof ChannelResponse - */ - cooldown?: number; - /** - * Date/time of creation - * @type {string} - * @memberof ChannelResponse - */ - created_at: string; - /** - * - * @type {UserObject} - * @memberof ChannelResponse - */ - created_by?: UserObject; - /** - * - * @type {{ [key: string]: any; }} - * @memberof ChannelResponse - */ - custom: { [key: string]: any; }; - /** - * Date/time of deletion - * @type {string} - * @memberof ChannelResponse - */ - deleted_at?: string; - /** - * - * @type {boolean} - * @memberof ChannelResponse - */ - disabled: boolean; - /** - * Whether channel is frozen or not - * @type {boolean} - * @memberof ChannelResponse - */ - frozen: boolean; - /** - * Whether this channel is hidden by current user or not - * @type {boolean} - * @memberof ChannelResponse - */ - hidden?: boolean; - /** - * Date since when the message history is accessible - * @type {string} - * @memberof ChannelResponse - */ - hide_messages_before?: string; - /** - * Channel unique ID - * @type {string} - * @memberof ChannelResponse - */ - id: string; - /** - * Date of the last message sent - * @type {string} - * @memberof ChannelResponse - */ - last_message_at?: string; - /** - * Number of members in the channel - * @type {number} - * @memberof ChannelResponse - */ - member_count?: number; - /** - * List of channel members (max 100) - * @type {Array} - * @memberof ChannelResponse - */ - members?: Array>; - /** - * Date of mute expiration - * @type {string} - * @memberof ChannelResponse - */ - mute_expires_at?: string; - /** - * Whether this channel is muted or not - * @type {boolean} - * @memberof ChannelResponse - */ - muted?: boolean; - /** - * List of channel capabilities of authenticated user - * @type {Array} - * @memberof ChannelResponse - */ - own_capabilities?: Array; - /** - * Team the channel belongs to (multi-tenant only) - * @type {string} - * @memberof ChannelResponse - */ - team?: string; - /** - * Date of the latest truncation of the channel - * @type {string} - * @memberof ChannelResponse - */ - truncated_at?: string; - /** - * - * @type {UserObject} - * @memberof ChannelResponse - */ - truncated_by?: UserObject; - /** - * Type of the channel - * @type {string} - * @memberof ChannelResponse - */ - type: string; - /** - * Date/time of the last update - * @type {string} - * @memberof ChannelResponse - */ - updated_at: string; -} -/** - * - * @export - * @interface ChannelStateResponse - */ -export interface ChannelStateResponse { - /** - * - * @type {ChannelResponse} - * @memberof ChannelStateResponse - */ - channel?: ChannelResponse; - /** - * - * @type {string} - * @memberof ChannelStateResponse - */ - duration: string; - /** - * - * @type {boolean} - * @memberof ChannelStateResponse - */ - hidden?: boolean; - /** - * - * @type {string} - * @memberof ChannelStateResponse - */ - hide_messages_before?: string; - /** - * - * @type {Array} - * @memberof ChannelStateResponse - */ - members: Array; - /** - * - * @type {ChannelMember} - * @memberof ChannelStateResponse - */ - membership?: ChannelMember | null; - /** - * - * @type {Array} - * @memberof ChannelStateResponse - */ - messages: Array; - /** - * - * @type {Array} - * @memberof ChannelStateResponse - */ - pending_messages?: Array; - /** - * - * @type {Array} - * @memberof ChannelStateResponse - */ - pinned_messages: Array; - /** - * - * @type {Array} - * @memberof ChannelStateResponse - */ - read?: Array; - /** - * - * @type {Array} - * @memberof ChannelStateResponse - */ - threads: Array; - /** - * - * @type {number} - * @memberof ChannelStateResponse - */ - watcher_count?: number; - /** - * - * @type {Array} - * @memberof ChannelStateResponse - */ - watchers?: Array; -} -/** - * - * @export - * @interface ChannelStateResponseFields - */ -export interface ChannelStateResponseFields { - /** - * - * @type {ChannelResponse} - * @memberof ChannelStateResponseFields - */ - channel?: ChannelResponse; - /** - * Whether this channel is hidden or not - * @type {boolean} - * @memberof ChannelStateResponseFields - */ - hidden?: boolean; - /** - * Messages before this date are hidden from the user - * @type {string} - * @memberof ChannelStateResponseFields - */ - hide_messages_before?: string; - /** - * List of channel members - * @type {Array} - * @memberof ChannelStateResponseFields - */ - members: Array; - /** - * - * @type {ChannelMember} - * @memberof ChannelStateResponseFields - */ - membership?: ChannelMember | null; - /** - * List of channel messages - * @type {Array} - * @memberof ChannelStateResponseFields - */ - messages: Array; - /** - * Pending messages that this user has sent - * @type {Array} - * @memberof ChannelStateResponseFields - */ - pending_messages?: Array; - /** - * List of pinned messages in the channel - * @type {Array} - * @memberof ChannelStateResponseFields - */ - pinned_messages: Array; - /** - * List of read states - * @type {Array} - * @memberof ChannelStateResponseFields - */ - read?: Array; - /** - * - * @type {Array} - * @memberof ChannelStateResponseFields - */ - threads: Array; - /** - * Number of channel watchers - * @type {number} - * @memberof ChannelStateResponseFields - */ - watcher_count?: number; - /** - * List of user who is watching the channel - * @type {Array} - * @memberof ChannelStateResponseFields - */ - watchers?: Array; -} -/** - * - * @export - * @interface ChannelTypeConfig - */ -export interface ChannelTypeConfig { - /** - * - * @type {Array} - * @memberof ChannelTypeConfig - */ - allowed_flag_reasons?: Array; - /** - * - * @type {string} - * @memberof ChannelTypeConfig - */ - automod: ChannelTypeConfigAutomodEnum; - /** - * - * @type {string} - * @memberof ChannelTypeConfig - */ - automod_behavior: ChannelTypeConfigAutomodBehaviorEnum; - /** - * - * @type {Thresholds} - * @memberof ChannelTypeConfig - */ - automod_thresholds?: Thresholds; - /** - * - * @type {string} - * @memberof ChannelTypeConfig - */ - blocklist?: string; - /** - * - * @type {string} - * @memberof ChannelTypeConfig - */ - blocklist_behavior?: ChannelTypeConfigBlocklistBehaviorEnum; - /** - * - * @type {Array} - * @memberof ChannelTypeConfig - */ - blocklists?: Array; - /** - * List of commands that channel supports - * @type {Array} - * @memberof ChannelTypeConfig - */ - commands: Array; - /** - * - * @type {boolean} - * @memberof ChannelTypeConfig - */ - connect_events: boolean; - /** - * - * @type {string} - * @memberof ChannelTypeConfig - */ - created_at: string; - /** - * - * @type {boolean} - * @memberof ChannelTypeConfig - */ - custom_events: boolean; - /** - * - * @type {{ [key: string]: Array; }} - * @memberof ChannelTypeConfig - */ - grants: { [key: string]: Array; }; - /** - * - * @type {boolean} - * @memberof ChannelTypeConfig - */ - mark_messages_pending: boolean; - /** - * - * @type {number} - * @memberof ChannelTypeConfig - */ - max_message_length: number; - /** - * - * @type {boolean} - * @memberof ChannelTypeConfig - */ - mutes: boolean; - /** - * - * @type {string} - * @memberof ChannelTypeConfig - */ - name: string; - /** - * - * @type {Array} - * @memberof ChannelTypeConfig - */ - permissions: Array; - /** - * - * @type {boolean} - * @memberof ChannelTypeConfig - */ - polls: boolean; - /** - * - * @type {boolean} - * @memberof ChannelTypeConfig - */ - push_notifications: boolean; - /** - * - * @type {boolean} - * @memberof ChannelTypeConfig - */ - quotes: boolean; - /** - * - * @type {boolean} - * @memberof ChannelTypeConfig - */ - reactions: boolean; - /** - * - * @type {boolean} - * @memberof ChannelTypeConfig - */ - read_events: boolean; - /** - * - * @type {boolean} - * @memberof ChannelTypeConfig - */ - reminders: boolean; - /** - * - * @type {boolean} - * @memberof ChannelTypeConfig - */ - replies: boolean; - /** - * - * @type {boolean} - * @memberof ChannelTypeConfig - */ - search: boolean; - /** - * - * @type {boolean} - * @memberof ChannelTypeConfig - */ - typing_events: boolean; - /** - * - * @type {string} - * @memberof ChannelTypeConfig - */ - updated_at: string; - /** - * - * @type {boolean} - * @memberof ChannelTypeConfig - */ - uploads: boolean; - /** - * - * @type {boolean} - * @memberof ChannelTypeConfig - */ - url_enrichment: boolean; -} - - -/** - * @export - */ -export const ChannelTypeConfigAutomodEnum = { - DISABLED: 'disabled', - SIMPLE: 'simple', - AI: 'AI' -} as const; -export type ChannelTypeConfigAutomodEnum = typeof ChannelTypeConfigAutomodEnum[keyof typeof ChannelTypeConfigAutomodEnum]; - -/** - * @export - */ -export const ChannelTypeConfigAutomodBehaviorEnum = { - FLAG: 'flag', - BLOCK: 'block', - SHADOW_BLOCK: 'shadow_block' -} as const; -export type ChannelTypeConfigAutomodBehaviorEnum = typeof ChannelTypeConfigAutomodBehaviorEnum[keyof typeof ChannelTypeConfigAutomodBehaviorEnum]; - -/** - * @export - */ -export const ChannelTypeConfigBlocklistBehaviorEnum = { - FLAG: 'flag', - BLOCK: 'block', - SHADOW_BLOCK: 'shadow_block' -} as const; -export type ChannelTypeConfigBlocklistBehaviorEnum = typeof ChannelTypeConfigBlocklistBehaviorEnum[keyof typeof ChannelTypeConfigBlocklistBehaviorEnum]; - -/** - * - * @export - * @interface CheckExternalStorageResponse - */ -export interface CheckExternalStorageResponse { - /** - * Duration of the request in human-readable format - * @type {string} - * @memberof CheckExternalStorageResponse - */ - duration: string; - /** - * - * @type {string} - * @memberof CheckExternalStorageResponse - */ - file_url: string; -} -/** - * - * @export - * @interface CheckPushRequest - */ -export interface CheckPushRequest { - /** - * Push message template for APN - * @type {string} - * @memberof CheckPushRequest - */ - apn_template?: string; - /** - * Push message data template for Firebase - * @type {string} - * @memberof CheckPushRequest - */ - firebase_data_template?: string; - /** - * Push message template for Firebase - * @type {string} - * @memberof CheckPushRequest - */ - firebase_template?: string; - /** - * Message ID to send push notification for - * @type {string} - * @memberof CheckPushRequest - */ - message_id?: string; - /** - * Name of push provider - * @type {string} - * @memberof CheckPushRequest - */ - push_provider_name?: string; - /** - * Push provider type - * @type {string} - * @memberof CheckPushRequest - */ - push_provider_type?: CheckPushRequestPushProviderTypeEnum; - /** - * Don't require existing devices to render templates - * @type {boolean} - * @memberof CheckPushRequest - */ - skip_devices?: boolean; - /** - * - * @type {UserRequest} - * @memberof CheckPushRequest - */ - user?: UserRequest; - /** - * - * @type {string} - * @memberof CheckPushRequest - */ - user_id?: string; -} - - -/** - * @export - */ -export const CheckPushRequestPushProviderTypeEnum = { - FIREBASE: 'firebase', - APN: 'apn', - HUAWEI: 'huawei', - XIAOMI: 'xiaomi' -} as const; -export type CheckPushRequestPushProviderTypeEnum = typeof CheckPushRequestPushProviderTypeEnum[keyof typeof CheckPushRequestPushProviderTypeEnum]; - -/** - * - * @export - * @interface CheckPushResponse - */ -export interface CheckPushResponse { - /** - * Object with device errors - * @type {{ [key: string]: DeviceErrorInfo; }} - * @memberof CheckPushResponse - */ - device_errors?: { [key: string]: DeviceErrorInfo; }; - /** - * - * @type {string} - * @memberof CheckPushResponse - */ - duration: string; - /** - * List of general errors - * @type {Array} - * @memberof CheckPushResponse - */ - general_errors?: Array; - /** - * - * @type {string} - * @memberof CheckPushResponse - */ - rendered_apn_template?: string; - /** - * - * @type {string} - * @memberof CheckPushResponse - */ - rendered_firebase_template?: string; - /** - * - * @type {{ [key: string]: string; }} - * @memberof CheckPushResponse - */ - rendered_message?: { [key: string]: string; }; - /** - * Don't require existing devices to render templates - * @type {boolean} - * @memberof CheckPushResponse - */ - skip_devices?: boolean; -} -/** - * - * @export - * @interface CheckSNSRequest - */ -export interface CheckSNSRequest { - /** - * AWS SNS access key - * @type {string} - * @memberof CheckSNSRequest - */ - sns_key?: string; - /** - * AWS SNS key secret - * @type {string} - * @memberof CheckSNSRequest - */ - sns_secret?: string; - /** - * AWS SNS topic ARN - * @type {string} - * @memberof CheckSNSRequest - */ - sns_topic_arn?: string; -} -/** - * - * @export - * @interface CheckSNSResponse - */ -export interface CheckSNSResponse { - /** - * Error data - * @type {{ [key: string]: any; }} - * @memberof CheckSNSResponse - */ - data?: { [key: string]: any; }; - /** - * - * @type {string} - * @memberof CheckSNSResponse - */ - duration: string; - /** - * Error text - * @type {string} - * @memberof CheckSNSResponse - */ - error?: string; - /** - * Validation result - * @type {string} - * @memberof CheckSNSResponse - */ - status: CheckSNSResponseStatusEnum; -} - - -/** - * @export - */ -export const CheckSNSResponseStatusEnum = { - OK: 'ok', - ERROR: 'error' -} as const; -export type CheckSNSResponseStatusEnum = typeof CheckSNSResponseStatusEnum[keyof typeof CheckSNSResponseStatusEnum]; - -/** - * - * @export - * @interface CheckSQSRequest - */ -export interface CheckSQSRequest { - /** - * AWS SQS access key - * @type {string} - * @memberof CheckSQSRequest - */ - sqs_key?: string; - /** - * AWS SQS key secret - * @type {string} - * @memberof CheckSQSRequest - */ - sqs_secret?: string; - /** - * AWS SQS endpoint URL - * @type {string} - * @memberof CheckSQSRequest - */ - sqs_url?: string; -} -/** - * - * @export - * @interface CheckSQSResponse - */ -export interface CheckSQSResponse { - /** - * Error data - * @type {{ [key: string]: any; }} - * @memberof CheckSQSResponse - */ - data?: { [key: string]: any; }; - /** - * - * @type {string} - * @memberof CheckSQSResponse - */ - duration: string; - /** - * Error text - * @type {string} - * @memberof CheckSQSResponse - */ - error?: string; - /** - * Validation result - * @type {string} - * @memberof CheckSQSResponse - */ - status: CheckSQSResponseStatusEnum; -} - - -/** - * @export - */ -export const CheckSQSResponseStatusEnum = { - OK: 'ok', - ERROR: 'error' -} as const; -export type CheckSQSResponseStatusEnum = typeof CheckSQSResponseStatusEnum[keyof typeof CheckSQSResponseStatusEnum]; - -/** - * Represents custom chat command - * @export - * @interface Command - */ -export interface Command { - /** - * Arguments help text, shown in commands auto-completion - * @type {string} - * @memberof Command - */ - args: string; - /** - * Date/time of creation - * @type {string} - * @memberof Command - */ - readonly created_at?: string; - /** - * Description, shown in commands auto-completion - * @type {string} - * @memberof Command - */ - description: string; - /** - * Unique command name - * @type {string} - * @memberof Command - */ - name: string; - /** - * Set name used for grouping commands - * @type {string} - * @memberof Command - */ - set: string; - /** - * Date/time of the last update - * @type {string} - * @memberof Command - */ - readonly updated_at?: string; -} -/** - * - * @export - * @interface Config - */ -export interface Config { - /** - * - * @type {string} - * @memberof Config - */ - app_certificate: string; - /** - * - * @type {string} - * @memberof Config - */ - app_id: string; - /** - * - * @type {string} - * @memberof Config - */ - default_role?: ConfigDefaultRoleEnum; - /** - * - * @type {{ [key: string]: string; }} - * @memberof Config - */ - role_map?: { [key: string]: string; }; -} - - -/** - * @export - */ -export const ConfigDefaultRoleEnum = { - ATTENDEE: 'attendee', - PUBLISHER: 'publisher', - SUBSCRIBER: 'subscriber', - ADMIN: 'admin' -} as const; -export type ConfigDefaultRoleEnum = typeof ConfigDefaultRoleEnum[keyof typeof ConfigDefaultRoleEnum]; - -/** - * Block list contains restricted words - * @export - * @interface CreateBlockListRequest - */ -export interface CreateBlockListRequest { - /** - * Block list name - * @type {string} - * @memberof CreateBlockListRequest - */ - name: string; - /** - * Block list type. - * @type {string} - * @memberof CreateBlockListRequest - */ - type?: CreateBlockListRequestTypeEnum; - /** - * List of words to block - * @type {Array} - * @memberof CreateBlockListRequest - */ - words: Array; -} - - -/** - * @export - */ -export const CreateBlockListRequestTypeEnum = { - REGEX: 'regex', - DOMAIN: 'domain', - EMAIL: 'email', - WORD: 'word' -} as const; -export type CreateBlockListRequestTypeEnum = typeof CreateBlockListRequestTypeEnum[keyof typeof CreateBlockListRequestTypeEnum]; - -/** - * - * @export - * @interface CreateCallRequest - */ -export interface CreateCallRequest { - /** - * - * @type {string} - * @memberof CreateCallRequest - */ - id: string; - /** - * - * @type {{ [key: string]: any; }} - * @memberof CreateCallRequest - */ - options?: { [key: string]: any; }; - /** - * - * @type {string} - * @memberof CreateCallRequest - */ - type: CreateCallRequestTypeEnum; - /** - * - * @type {UserRequest} - * @memberof CreateCallRequest - */ - user?: UserRequest; - /** - * - * @type {string} - * @memberof CreateCallRequest - */ - user_id?: string; -} - - -/** - * @export - */ -export const CreateCallRequestTypeEnum = { - AUDIO: 'audio', - VIDEO: 'video' -} as const; -export type CreateCallRequestTypeEnum = typeof CreateCallRequestTypeEnum[keyof typeof CreateCallRequestTypeEnum]; - -/** - * - * @export - * @interface CreateCallResponse - */ -export interface CreateCallResponse { - /** - * - * @type {string} - * @memberof CreateCallResponse - */ - agora_app_id?: string; - /** - * - * @type {number} - * @memberof CreateCallResponse - */ - agora_uid?: number; - /** - * - * @type {Call} - * @memberof CreateCallResponse - */ - call?: Call; - /** - * Duration of the request in human-readable format - * @type {string} - * @memberof CreateCallResponse - */ - duration: string; - /** - * - * @type {string} - * @memberof CreateCallResponse - */ - token: string; -} -/** - * - * @export - * @interface CreateChannelTypeRequest - */ -export interface CreateChannelTypeRequest { - /** - * Enables automatic message moderation - * @type {string} - * @memberof CreateChannelTypeRequest - */ - automod: CreateChannelTypeRequestAutomodEnum; - /** - * Sets behavior of automatic moderation - * @type {string} - * @memberof CreateChannelTypeRequest - */ - automod_behavior: CreateChannelTypeRequestAutomodBehaviorEnum; - /** - * Name of the blocklist to use - * @type {string} - * @memberof CreateChannelTypeRequest - */ - blocklist?: string; - /** - * Sets behavior of blocklist - * @type {string} - * @memberof CreateChannelTypeRequest - */ - blocklist_behavior?: CreateChannelTypeRequestBlocklistBehaviorEnum; - /** - * - * @type {Array} - * @memberof CreateChannelTypeRequest - */ - blocklists?: Array; - /** - * List of commands that channel supports - * @type {Array} - * @memberof CreateChannelTypeRequest - */ - commands?: Array; - /** - * Connect events support - * @type {boolean} - * @memberof CreateChannelTypeRequest - */ - connect_events?: boolean; - /** - * Enables custom events - * @type {boolean} - * @memberof CreateChannelTypeRequest - */ - custom_events?: boolean; - /** - * - * @type {{ [key: string]: Array; }} - * @memberof CreateChannelTypeRequest - */ - grants?: { [key: string]: Array; }; - /** - * Marks messages as pending by default - * @type {boolean} - * @memberof CreateChannelTypeRequest - */ - mark_messages_pending?: boolean; - /** - * Number of maximum message characters - * @type {number} - * @memberof CreateChannelTypeRequest - */ - max_message_length: number; - /** - * - * @type {string} - * @memberof CreateChannelTypeRequest - */ - message_retention?: string; - /** - * Enables mutes - * @type {boolean} - * @memberof CreateChannelTypeRequest - */ - mutes?: boolean; - /** - * Channel type name - * @type {string} - * @memberof CreateChannelTypeRequest - */ - name: string; - /** - * List of permissions for the channel type - * @type {Array} - * @memberof CreateChannelTypeRequest - */ - permissions?: Array; - /** - * Enables polls - * @type {boolean} - * @memberof CreateChannelTypeRequest - */ - polls?: boolean; - /** - * Enables push notifications - * @type {boolean} - * @memberof CreateChannelTypeRequest - */ - push_notifications?: boolean; - /** - * Enables message reactions - * @type {boolean} - * @memberof CreateChannelTypeRequest - */ - reactions?: boolean; - /** - * Read events support - * @type {boolean} - * @memberof CreateChannelTypeRequest - */ - read_events?: boolean; - /** - * Enables message replies (threads) - * @type {boolean} - * @memberof CreateChannelTypeRequest - */ - replies?: boolean; - /** - * Enables message search - * @type {boolean} - * @memberof CreateChannelTypeRequest - */ - search?: boolean; - /** - * Typing events support - * @type {boolean} - * @memberof CreateChannelTypeRequest - */ - typing_events?: boolean; - /** - * Enables file uploads - * @type {boolean} - * @memberof CreateChannelTypeRequest - */ - uploads?: boolean; - /** - * Enables URL enrichment - * @type {boolean} - * @memberof CreateChannelTypeRequest - */ - url_enrichment?: boolean; -} - - -/** - * @export - */ -export const CreateChannelTypeRequestAutomodEnum = { - DISABLED: 'disabled', - SIMPLE: 'simple', - AI: 'AI' -} as const; -export type CreateChannelTypeRequestAutomodEnum = typeof CreateChannelTypeRequestAutomodEnum[keyof typeof CreateChannelTypeRequestAutomodEnum]; - -/** - * @export - */ -export const CreateChannelTypeRequestAutomodBehaviorEnum = { - FLAG: 'flag', - BLOCK: 'block' -} as const; -export type CreateChannelTypeRequestAutomodBehaviorEnum = typeof CreateChannelTypeRequestAutomodBehaviorEnum[keyof typeof CreateChannelTypeRequestAutomodBehaviorEnum]; - -/** - * @export - */ -export const CreateChannelTypeRequestBlocklistBehaviorEnum = { - FLAG: 'flag', - BLOCK: 'block', - SHADOW_BLOCK: 'shadow_block' -} as const; -export type CreateChannelTypeRequestBlocklistBehaviorEnum = typeof CreateChannelTypeRequestBlocklistBehaviorEnum[keyof typeof CreateChannelTypeRequestBlocklistBehaviorEnum]; - -/** - * - * @export - * @interface CreateChannelTypeResponse - */ -export interface CreateChannelTypeResponse { - /** - * - * @type {Array} - * @memberof CreateChannelTypeResponse - */ - allowed_flag_reasons?: Array; - /** - * - * @type {string} - * @memberof CreateChannelTypeResponse - */ - automod: CreateChannelTypeResponseAutomodEnum; - /** - * - * @type {string} - * @memberof CreateChannelTypeResponse - */ - automod_behavior: CreateChannelTypeResponseAutomodBehaviorEnum; - /** - * - * @type {Thresholds} - * @memberof CreateChannelTypeResponse - */ - automod_thresholds?: Thresholds; - /** - * - * @type {string} - * @memberof CreateChannelTypeResponse - */ - blocklist?: string; - /** - * - * @type {string} - * @memberof CreateChannelTypeResponse - */ - blocklist_behavior?: CreateChannelTypeResponseBlocklistBehaviorEnum; - /** - * - * @type {Array} - * @memberof CreateChannelTypeResponse - */ - blocklists?: Array; - /** - * - * @type {Array} - * @memberof CreateChannelTypeResponse - */ - commands: Array; - /** - * - * @type {boolean} - * @memberof CreateChannelTypeResponse - */ - connect_events: boolean; - /** - * - * @type {string} - * @memberof CreateChannelTypeResponse - */ - created_at: string; - /** - * - * @type {boolean} - * @memberof CreateChannelTypeResponse - */ - custom_events: boolean; - /** - * - * @type {string} - * @memberof CreateChannelTypeResponse - */ - duration: string; - /** - * - * @type {{ [key: string]: Array; }} - * @memberof CreateChannelTypeResponse - */ - grants: { [key: string]: Array; }; - /** - * - * @type {boolean} - * @memberof CreateChannelTypeResponse - */ - mark_messages_pending: boolean; - /** - * - * @type {number} - * @memberof CreateChannelTypeResponse - */ - max_message_length: number; - /** - * - * @type {boolean} - * @memberof CreateChannelTypeResponse - */ - mutes: boolean; - /** - * - * @type {string} - * @memberof CreateChannelTypeResponse - */ - name: string; - /** - * - * @type {Array} - * @memberof CreateChannelTypeResponse - */ - permissions: Array; - /** - * - * @type {boolean} - * @memberof CreateChannelTypeResponse - */ - polls: boolean; - /** - * - * @type {boolean} - * @memberof CreateChannelTypeResponse - */ - push_notifications: boolean; - /** - * - * @type {boolean} - * @memberof CreateChannelTypeResponse - */ - quotes: boolean; - /** - * - * @type {boolean} - * @memberof CreateChannelTypeResponse - */ - reactions: boolean; - /** - * - * @type {boolean} - * @memberof CreateChannelTypeResponse - */ - read_events: boolean; - /** - * - * @type {boolean} - * @memberof CreateChannelTypeResponse - */ - reminders: boolean; - /** - * - * @type {boolean} - * @memberof CreateChannelTypeResponse - */ - replies: boolean; - /** - * - * @type {boolean} - * @memberof CreateChannelTypeResponse - */ - search: boolean; - /** - * - * @type {boolean} - * @memberof CreateChannelTypeResponse - */ - typing_events: boolean; - /** - * - * @type {string} - * @memberof CreateChannelTypeResponse - */ - updated_at: string; - /** - * - * @type {boolean} - * @memberof CreateChannelTypeResponse - */ - uploads: boolean; - /** - * - * @type {boolean} - * @memberof CreateChannelTypeResponse - */ - url_enrichment: boolean; -} - - -/** - * @export - */ -export const CreateChannelTypeResponseAutomodEnum = { - DISABLED: 'disabled', - SIMPLE: 'simple', - AI: 'AI' -} as const; -export type CreateChannelTypeResponseAutomodEnum = typeof CreateChannelTypeResponseAutomodEnum[keyof typeof CreateChannelTypeResponseAutomodEnum]; - -/** - * @export - */ -export const CreateChannelTypeResponseAutomodBehaviorEnum = { - FLAG: 'flag', - BLOCK: 'block', - SHADOW_BLOCK: 'shadow_block' -} as const; -export type CreateChannelTypeResponseAutomodBehaviorEnum = typeof CreateChannelTypeResponseAutomodBehaviorEnum[keyof typeof CreateChannelTypeResponseAutomodBehaviorEnum]; - -/** - * @export - */ -export const CreateChannelTypeResponseBlocklistBehaviorEnum = { - FLAG: 'flag', - BLOCK: 'block', - SHADOW_BLOCK: 'shadow_block' -} as const; -export type CreateChannelTypeResponseBlocklistBehaviorEnum = typeof CreateChannelTypeResponseBlocklistBehaviorEnum[keyof typeof CreateChannelTypeResponseBlocklistBehaviorEnum]; - -/** - * Represents custom chat command - * @export - * @interface CreateCommandRequest - */ -export interface CreateCommandRequest { - /** - * Arguments help text, shown in commands auto-completion - * @type {string} - * @memberof CreateCommandRequest - */ - args?: string; - /** - * Description, shown in commands auto-completion - * @type {string} - * @memberof CreateCommandRequest - */ - description: string; - /** - * Unique command name - * @type {string} - * @memberof CreateCommandRequest - */ - name: string; - /** - * Set name used for grouping commands - * @type {string} - * @memberof CreateCommandRequest - */ - set?: string; -} -/** - * - * @export - * @interface CreateCommandResponse - */ -export interface CreateCommandResponse { - /** - * - * @type {Command} - * @memberof CreateCommandResponse - */ - command?: Command | null; - /** - * Duration of the request in human-readable format - * @type {string} - * @memberof CreateCommandResponse - */ - duration: string; -} -/** - * - * @export - * @interface CreateDeviceRequest - */ -export interface CreateDeviceRequest { - /** - * - * @type {string} - * @memberof CreateDeviceRequest - */ - id: string; - /** - * - * @type {string} - * @memberof CreateDeviceRequest - */ - push_provider: CreateDeviceRequestPushProviderEnum; - /** - * - * @type {string} - * @memberof CreateDeviceRequest - */ - push_provider_name?: string; - /** - * - * @type {UserRequest} - * @memberof CreateDeviceRequest - */ - user?: UserRequest; - /** - * - * @type {string} - * @memberof CreateDeviceRequest - */ - user_id?: string; - /** - * - * @type {boolean} - * @memberof CreateDeviceRequest - */ - voip_token?: boolean; -} - - -/** - * @export - */ -export const CreateDeviceRequestPushProviderEnum = { - FIREBASE: 'firebase', - APN: 'apn', - HUAWEI: 'huawei', - XIAOMI: 'xiaomi' -} as const; -export type CreateDeviceRequestPushProviderEnum = typeof CreateDeviceRequestPushProviderEnum[keyof typeof CreateDeviceRequestPushProviderEnum]; - -/** - * - * @export - * @interface CreateExternalStorageRequest - */ -export interface CreateExternalStorageRequest { - /** - * - * @type {S3Request} - * @memberof CreateExternalStorageRequest - */ - aws_s3?: S3Request; - /** - * - * @type {AzureRequest} - * @memberof CreateExternalStorageRequest - */ - azure_blob?: AzureRequest; - /** - * - * @type {string} - * @memberof CreateExternalStorageRequest - */ - bucket: string; - /** - * - * @type {string} - * @memberof CreateExternalStorageRequest - */ - gcs_credentials?: string; - /** - * - * @type {string} - * @memberof CreateExternalStorageRequest - */ - name: string; - /** - * - * @type {string} - * @memberof CreateExternalStorageRequest - */ - path?: string; - /** - * - * @type {string} - * @memberof CreateExternalStorageRequest - */ - storage_type: CreateExternalStorageRequestStorageTypeEnum; -} - - -/** - * @export - */ -export const CreateExternalStorageRequestStorageTypeEnum = { - S3: 's3', - GCS: 'gcs', - ABS: 'abs' -} as const; -export type CreateExternalStorageRequestStorageTypeEnum = typeof CreateExternalStorageRequestStorageTypeEnum[keyof typeof CreateExternalStorageRequestStorageTypeEnum]; - -/** - * - * @export - * @interface CreateExternalStorageResponse - */ -export interface CreateExternalStorageResponse { - /** - * Duration of the request in human-readable format - * @type {string} - * @memberof CreateExternalStorageResponse - */ - duration: string; -} -/** - * - * @export - * @interface CreateGuestRequest - */ -export interface CreateGuestRequest { - /** - * - * @type {UserRequest} - * @memberof CreateGuestRequest - */ - user: UserRequest; -} -/** - * - * @export - * @interface CreateGuestResponse - */ -export interface CreateGuestResponse { - /** - * the access token to authenticate the user - * @type {string} - * @memberof CreateGuestResponse - */ - access_token: string; - /** - * - * @type {string} - * @memberof CreateGuestResponse - */ - duration: string; - /** - * - * @type {UserResponse} - * @memberof CreateGuestResponse - */ - user: UserResponse; -} -/** - * - * @export - * @interface CreateImportRequest - */ -export interface CreateImportRequest { - /** - * - * @type {string} - * @memberof CreateImportRequest - */ - mode: CreateImportRequestModeEnum; - /** - * - * @type {string} - * @memberof CreateImportRequest - */ - path: string; -} - - -/** - * @export - */ -export const CreateImportRequestModeEnum = { - INSERT: 'insert', - UPSERT: 'upsert' -} as const; -export type CreateImportRequestModeEnum = typeof CreateImportRequestModeEnum[keyof typeof CreateImportRequestModeEnum]; - -/** - * - * @export - * @interface CreateImportResponse - */ -export interface CreateImportResponse { - /** - * Duration of the request in human-readable format - * @type {string} - * @memberof CreateImportResponse - */ - duration: string; - /** - * - * @type {ImportTask} - * @memberof CreateImportResponse - */ - import_task?: ImportTask; -} -/** - * - * @export - * @interface CreateImportURLRequest - */ -export interface CreateImportURLRequest { - /** - * - * @type {string} - * @memberof CreateImportURLRequest - */ - filename?: string; -} -/** - * - * @export - * @interface CreateImportURLResponse - */ -export interface CreateImportURLResponse { - /** - * Duration of the request in human-readable format - * @type {string} - * @memberof CreateImportURLResponse - */ - duration: string; - /** - * - * @type {string} - * @memberof CreateImportURLResponse - */ - path: string; - /** - * - * @type {string} - * @memberof CreateImportURLResponse - */ - upload_url: string; -} -/** - * - * @export - * @interface CreatePollOptionRequest - */ -export interface CreatePollOptionRequest { - /** - * - * @type {{ [key: string]: any; }} - * @memberof CreatePollOptionRequest - */ - Custom?: { [key: string]: any; }; - /** - * - * @type {number} - * @memberof CreatePollOptionRequest - */ - position?: number; - /** - * - * @type {string} - * @memberof CreatePollOptionRequest - */ - text: string; - /** - * - * @type {UserRequest} - * @memberof CreatePollOptionRequest - */ - user?: UserRequest; - /** - * - * @type {string} - * @memberof CreatePollOptionRequest - */ - user_id?: string; -} -/** - * Contains all information needed to create a new poll - * @export - * @interface CreatePollRequest - */ -export interface CreatePollRequest { - /** - * - * @type {{ [key: string]: any; }} - * @memberof CreatePollRequest - */ - Custom?: { [key: string]: any; }; - /** - * Indicates whether users can suggest user defined answers - * @type {boolean} - * @memberof CreatePollRequest - */ - allow_answers?: boolean; - /** - * - * @type {boolean} - * @memberof CreatePollRequest - */ - allow_user_suggested_options?: boolean; - /** - * A description of the poll - * @type {string} - * @memberof CreatePollRequest - */ - description?: string; - /** - * Indicates whether users can cast multiple votes - * @type {boolean} - * @memberof CreatePollRequest - */ - enforce_unique_vote?: boolean; - /** - * - * @type {string} - * @memberof CreatePollRequest - */ - id?: string; - /** - * Indicates whether the poll is open for voting - * @type {boolean} - * @memberof CreatePollRequest - */ - is_closed?: boolean; - /** - * Indicates the maximum amount of votes a user can cast - * @type {number} - * @memberof CreatePollRequest - */ - max_votes_allowed?: number; - /** - * The name of the poll - * @type {string} - * @memberof CreatePollRequest - */ - name: string; - /** - * - * @type {Array} - * @memberof CreatePollRequest - */ - options?: Array; - /** - * - * @type {UserRequest} - * @memberof CreatePollRequest - */ - user?: UserRequest; - /** - * - * @type {string} - * @memberof CreatePollRequest - */ - user_id?: string; - /** - * - * @type {string} - * @memberof CreatePollRequest - */ - voting_visibility?: CreatePollRequestVotingVisibilityEnum; -} - - -/** - * @export - */ -export const CreatePollRequestVotingVisibilityEnum = { - ANONYMOUS: 'anonymous', - PUBLIC: 'public' -} as const; -export type CreatePollRequestVotingVisibilityEnum = typeof CreatePollRequestVotingVisibilityEnum[keyof typeof CreatePollRequestVotingVisibilityEnum]; - -/** - * - * @export - * @interface CreateRoleRequest - */ -export interface CreateRoleRequest { - /** - * Role name - * @type {string} - * @memberof CreateRoleRequest - */ - name: string; -} -/** - * - * @export - * @interface CreateRoleResponse - */ -export interface CreateRoleResponse { - /** - * Duration of the request in human-readable format - * @type {string} - * @memberof CreateRoleResponse - */ - duration: string; - /** - * - * @type {Role} - * @memberof CreateRoleResponse - */ - role: Role; -} -/** - * - * @export - * @interface DataDogInfo - */ -export interface DataDogInfo { - /** - * - * @type {string} - * @memberof DataDogInfo - */ - api_key?: string; - /** - * - * @type {boolean} - * @memberof DataDogInfo - */ - enabled?: boolean; - /** - * - * @type {string} - * @memberof DataDogInfo - */ - site?: string; -} -/** - * - * @export - * @interface DeactivateUserRequest - */ -export interface DeactivateUserRequest { - /** - * ID of the user who deactivated the user - * @type {string} - * @memberof DeactivateUserRequest - */ - created_by_id?: string; - /** - * Makes messages appear to be deleted - * @type {boolean} - * @memberof DeactivateUserRequest - */ - mark_messages_deleted?: boolean; -} -/** - * - * @export - * @interface DeactivateUserResponse - */ -export interface DeactivateUserResponse { - /** - * Duration of the request in human-readable format - * @type {string} - * @memberof DeactivateUserResponse - */ - duration: string; - /** - * - * @type {UserObject} - * @memberof DeactivateUserResponse - */ - user?: UserObject; -} -/** - * - * @export - * @interface DeactivateUsersRequest - */ -export interface DeactivateUsersRequest { - /** - * ID of the user who deactivated the users - * @type {string} - * @memberof DeactivateUsersRequest - */ - created_by_id?: string; - /** - * - * @type {boolean} - * @memberof DeactivateUsersRequest - */ - mark_channels_deleted?: boolean; - /** - * Makes messages appear to be deleted - * @type {boolean} - * @memberof DeactivateUsersRequest - */ - mark_messages_deleted?: boolean; - /** - * User IDs to deactivate - * @type {Array} - * @memberof DeactivateUsersRequest - */ - user_ids: Array; -} -/** - * - * @export - * @interface DeactivateUsersResponse - */ -export interface DeactivateUsersResponse { - /** - * Duration of the request in human-readable format - * @type {string} - * @memberof DeactivateUsersResponse - */ - duration: string; - /** - * - * @type {string} - * @memberof DeactivateUsersResponse - */ - task_id: string; -} -/** - * - * @export - * @interface DeleteChannelResponse - */ -export interface DeleteChannelResponse { - /** - * - * @type {ChannelResponse} - * @memberof DeleteChannelResponse - */ - channel?: ChannelResponse; - /** - * Duration of the request in human-readable format - * @type {string} - * @memberof DeleteChannelResponse - */ - duration: string; -} -/** - * - * @export - * @interface DeleteChannelsRequest - */ -export interface DeleteChannelsRequest { - /** - * All channels that should be deleted - * @type {Array} - * @memberof DeleteChannelsRequest - */ - cids: Array; - /** - * Specify if channels and all ressources should be hard deleted - * @type {boolean} - * @memberof DeleteChannelsRequest - */ - hard_delete?: boolean; -} -/** - * - * @export - * @interface DeleteChannelsResponse - */ -export interface DeleteChannelsResponse { - /** - * Duration of the request in human-readable format - * @type {string} - * @memberof DeleteChannelsResponse - */ - duration: string; - /** - * - * @type {{ [key: string]: DeleteChannelsResult; }} - * @memberof DeleteChannelsResponse - */ - result?: { [key: string]: DeleteChannelsResult; }; - /** - * - * @type {string} - * @memberof DeleteChannelsResponse - */ - task_id?: string; -} -/** - * - * @export - * @interface DeleteChannelsResult - */ -export interface DeleteChannelsResult { - /** - * - * @type {string} - * @memberof DeleteChannelsResult - */ - error?: string; - /** - * - * @type {string} - * @memberof DeleteChannelsResult - */ - status: string; -} -/** - * - * @export - * @interface DeleteCommandResponse - */ -export interface DeleteCommandResponse { - /** - * Duration of the request in human-readable format - * @type {string} - * @memberof DeleteCommandResponse - */ - duration: string; - /** - * - * @type {string} - * @memberof DeleteCommandResponse - */ - name: string; -} -/** - * - * @export - * @interface DeleteExternalStorageResponse - */ -export interface DeleteExternalStorageResponse { - /** - * Duration of the request in human-readable format - * @type {string} - * @memberof DeleteExternalStorageResponse - */ - duration: string; -} -/** - * - * @export - * @interface DeleteMessageResponse - */ -export interface DeleteMessageResponse { - /** - * Duration of the request in human-readable format - * @type {string} - * @memberof DeleteMessageResponse - */ - duration: string; - /** - * - * @type {MessageResponse} - * @memberof DeleteMessageResponse - */ - message: MessageResponse; -} -/** - * - * @export - * @interface DeleteUsersRequest - */ -export interface DeleteUsersRequest { - /** - * Calls delete mode. - * Affected calls are those that include exactly two members, one of whom is the user being deleted. - * - * * null or empty string - doesn't delete any calls - * * soft - marks user's calls and their related data as deleted (soft-delete) - * * hard - deletes user's calls and their data completely (hard-delete) - * @type {string} - * @memberof DeleteUsersRequest - */ - calls?: DeleteUsersRequestCallsEnum; - /** - * Conversation channels delete mode. - * Conversation channel is any channel which only has two members one of which is the user being deleted. - * - * * null or empty string - doesn't delete any conversation channels - * * soft - marks all conversation channels as deleted (same effect as Delete Channels with 'hard' option disabled) - * * hard - deletes channel and all its data completely including messages (same effect as Delete Channels with 'hard' option enabled) - * @type {string} - * @memberof DeleteUsersRequest - */ - conversations?: DeleteUsersRequestConversationsEnum; - /** - * Message delete mode. - * - * * null or empty string - doesn't delete user messages - * * soft - marks all user messages as deleted without removing any related message data - * * pruning - marks all user messages as deleted, nullifies message information and removes some message data such as reactions and flags - * * hard - deletes messages completely with all related information - * @type {string} - * @memberof DeleteUsersRequest - */ - messages?: DeleteUsersRequestMessagesEnum; - /** - * - * @type {string} - * @memberof DeleteUsersRequest - */ - new_call_owner_id?: string; - /** - * - * @type {string} - * @memberof DeleteUsersRequest - */ - new_channel_owner_id?: string; - /** - * User delete mode. - * - * * soft - marks user as deleted and retains all user data - * * pruning - marks user as deleted and nullifies user information - * * hard - deletes user completely. Requires 'hard' option for messages and conversations as well - * @type {string} - * @memberof DeleteUsersRequest - */ - user?: DeleteUsersRequestUserEnum; - /** - * IDs of users to delete - * @type {Array} - * @memberof DeleteUsersRequest - */ - user_ids: Array; -} - - -/** - * @export - */ -export const DeleteUsersRequestCallsEnum = { - SOFT: 'soft', - HARD: 'hard' -} as const; -export type DeleteUsersRequestCallsEnum = typeof DeleteUsersRequestCallsEnum[keyof typeof DeleteUsersRequestCallsEnum]; - -/** - * @export - */ -export const DeleteUsersRequestConversationsEnum = { - SOFT: 'soft', - HARD: 'hard' -} as const; -export type DeleteUsersRequestConversationsEnum = typeof DeleteUsersRequestConversationsEnum[keyof typeof DeleteUsersRequestConversationsEnum]; - -/** - * @export - */ -export const DeleteUsersRequestMessagesEnum = { - SOFT: 'soft', - PRUNING: 'pruning', - HARD: 'hard' -} as const; -export type DeleteUsersRequestMessagesEnum = typeof DeleteUsersRequestMessagesEnum[keyof typeof DeleteUsersRequestMessagesEnum]; - -/** - * @export - */ -export const DeleteUsersRequestUserEnum = { - SOFT: 'soft', - PRUNING: 'pruning', - HARD: 'hard' -} as const; -export type DeleteUsersRequestUserEnum = typeof DeleteUsersRequestUserEnum[keyof typeof DeleteUsersRequestUserEnum]; - -/** - * - * @export - * @interface DeleteUsersResponse - */ -export interface DeleteUsersResponse { - /** - * Duration of the request in human-readable format - * @type {string} - * @memberof DeleteUsersResponse - */ - duration: string; - /** - * - * @type {string} - * @memberof DeleteUsersResponse - */ - task_id: string; -} -/** - * - * @export - * @interface Device - */ -export interface Device { - /** - * - * @type {string} - * @memberof Device - */ - created_at: string; - /** - * - * @type {boolean} - * @memberof Device - */ - disabled?: boolean; - /** - * - * @type {string} - * @memberof Device - */ - disabled_reason?: string; - /** - * Device ID - * @type {string} - * @memberof Device - */ - id: string; - /** - * - * @type {string} - * @memberof Device - */ - push_provider: DevicePushProviderEnum; - /** - * Name of the push provider configuration - * @type {string} - * @memberof Device - */ - push_provider_name?: string; - /** - * - * @type {string} - * @memberof Device - */ - user_id: string; - /** - * - * @type {boolean} - * @memberof Device - */ - voip?: boolean; -} - - -/** - * @export - */ -export const DevicePushProviderEnum = { - FIREBASE: 'firebase', - APN: 'apn', - HUAWEI: 'huawei', - XIAOMI: 'xiaomi' -} as const; -export type DevicePushProviderEnum = typeof DevicePushProviderEnum[keyof typeof DevicePushProviderEnum]; - -/** - * - * @export - * @interface DeviceErrorInfo - */ -export interface DeviceErrorInfo { - /** - * - * @type {string} - * @memberof DeviceErrorInfo - */ - error_message: string; - /** - * - * @type {string} - * @memberof DeviceErrorInfo - */ - provider: string; - /** - * - * @type {string} - * @memberof DeviceErrorInfo - */ - provider_name: string; -} -/** - * - * @export - * @interface ErrorResult - */ -export interface ErrorResult { - /** - * - * @type {string} - * @memberof ErrorResult - */ - stacktrace?: string; - /** - * - * @type {string} - * @memberof ErrorResult - */ - type: string; - /** - * - * @type {string} - * @memberof ErrorResult - */ - version?: string; -} -/** - * - * @export - * @interface EventNotificationSettings - */ -export interface EventNotificationSettings { - /** - * - * @type {APNS} - * @memberof EventNotificationSettings - */ - apns: APNS; - /** - * - * @type {boolean} - * @memberof EventNotificationSettings - */ - enabled: boolean; -} -/** - * - * @export - * @interface EventRequest - */ -export interface EventRequest { - /** - * - * @type {{ [key: string]: any; }} - * @memberof EventRequest - */ - custom?: { [key: string]: any; }; - /** - * - * @type {string} - * @memberof EventRequest - */ - parent_id?: string; - /** - * - * @type {string} - * @memberof EventRequest - */ - type: string; - /** - * - * @type {UserRequest} - * @memberof EventRequest - */ - user?: UserRequest; - /** - * - * @type {string} - * @memberof EventRequest - */ - user_id?: string; -} -/** - * - * @export - * @interface EventResponse - */ -export interface EventResponse { - /** - * Duration of the request in human-readable format - * @type {string} - * @memberof EventResponse - */ - duration: string; - /** - * - * @type {WSEvent} - * @memberof EventResponse - */ - event: WSEvent; -} -/** - * - * @export - * @interface ExportChannelsRequest - */ -export interface ExportChannelsRequest { - /** - * Export options for channels - * @type {Array} - * @memberof ExportChannelsRequest - */ - channels: Array; - /** - * Set if deleted message text should be cleared - * @type {boolean} - * @memberof ExportChannelsRequest - */ - clear_deleted_message_text?: boolean; - /** - * - * @type {boolean} - * @memberof ExportChannelsRequest - */ - export_users?: boolean; - /** - * Set if you want to include deleted channels - * @type {boolean} - * @memberof ExportChannelsRequest - */ - include_soft_deleted_channels?: boolean; - /** - * Set if you want to include truncated messages - * @type {boolean} - * @memberof ExportChannelsRequest - */ - include_truncated_messages?: boolean; - /** - * - * @type {string} - * @memberof ExportChannelsRequest - */ - version?: string; -} -/** - * - * @export - * @interface ExportChannelsResponse - */ -export interface ExportChannelsResponse { - /** - * Duration of the request in human-readable format - * @type {string} - * @memberof ExportChannelsResponse - */ - duration: string; - /** - * - * @type {string} - * @memberof ExportChannelsResponse - */ - task_id: string; -} -/** - * - * @export - * @interface ExportChannelsResult - */ -export interface ExportChannelsResult { - /** - * S3 path of result - * @type {string} - * @memberof ExportChannelsResult - */ - path?: string; - /** - * S3 bucket name result - * @type {string} - * @memberof ExportChannelsResult - */ - s3_bucket_name?: string; - /** - * URL of result - * @type {string} - * @memberof ExportChannelsResult - */ - url: string; -} -/** - * - * @export - * @interface ExportUserResponse - */ -export interface ExportUserResponse { - /** - * Duration of the request in human-readable format - * @type {string} - * @memberof ExportUserResponse - */ - duration: string; - /** - * - * @type {Array} - * @memberof ExportUserResponse - */ - messages?: Array; - /** - * - * @type {Array} - * @memberof ExportUserResponse - */ - reactions?: Array; - /** - * - * @type {UserObject} - * @memberof ExportUserResponse - */ - user?: UserObject; -} -/** - * - * @export - * @interface ExportUsersRequest - */ -export interface ExportUsersRequest { - /** - * - * @type {Array} - * @memberof ExportUsersRequest - */ - user_ids: Array; -} -/** - * - * @export - * @interface ExportUsersResponse - */ -export interface ExportUsersResponse { - /** - * Duration of the request in human-readable format - * @type {string} - * @memberof ExportUsersResponse - */ - duration: string; - /** - * - * @type {string} - * @memberof ExportUsersResponse - */ - task_id: string; -} -/** - * - * @export - * @interface ExternalStorageResponse - */ -export interface ExternalStorageResponse { - /** - * - * @type {string} - * @memberof ExternalStorageResponse - */ - bucket: string; - /** - * - * @type {string} - * @memberof ExternalStorageResponse - */ - name: string; - /** - * - * @type {string} - * @memberof ExternalStorageResponse - */ - path: string; - /** - * - * @type {string} - * @memberof ExternalStorageResponse - */ - type: ExternalStorageResponseTypeEnum; -} - - -/** - * @export - */ -export const ExternalStorageResponseTypeEnum = { - S3: 's3', - GCS: 'gcs', - ABS: 'abs' -} as const; -export type ExternalStorageResponseTypeEnum = typeof ExternalStorageResponseTypeEnum[keyof typeof ExternalStorageResponseTypeEnum]; - -/** - * - * @export - * @interface Field - */ -export interface Field { - /** - * - * @type {boolean} - * @memberof Field - */ - _short: boolean; - /** - * - * @type {string} - * @memberof Field - */ - title: string; - /** - * - * @type {string} - * @memberof Field - */ - value: string; -} -/** - * - * @export - * @interface FileDeleteResponse - */ -export interface FileDeleteResponse { - /** - * Duration of the request in human-readable format - * @type {string} - * @memberof FileDeleteResponse - */ - duration: string; -} -/** - * - * @export - * @interface FileUploadConfig - */ -export interface FileUploadConfig { - /** - * - * @type {Array} - * @memberof FileUploadConfig - */ - allowed_file_extensions?: Array; - /** - * - * @type {Array} - * @memberof FileUploadConfig - */ - allowed_mime_types?: Array; - /** - * - * @type {Array} - * @memberof FileUploadConfig - */ - blocked_file_extensions?: Array; - /** - * - * @type {Array} - * @memberof FileUploadConfig - */ - blocked_mime_types?: Array; - /** - * - * @type {number} - * @memberof FileUploadConfig - */ - size_limit: number; -} -/** - * - * @export - * @interface FileUploadRequest - */ -export interface FileUploadRequest { - /** - * file field - * @type {string} - * @memberof FileUploadRequest - */ - file?: string; - /** - * - * @type {OnlyUserID} - * @memberof FileUploadRequest - */ - user?: OnlyUserID; -} -/** - * - * @export - * @interface FileUploadResponse - */ -export interface FileUploadResponse { - /** - * - * @type {string} - * @memberof FileUploadResponse - */ - duration: string; - /** - * URL to the uploaded asset. Should be used to put to `asset_url` attachment field - * @type {string} - * @memberof FileUploadResponse - */ - file?: string; - /** - * URL of the file thumbnail for supported file formats. Should be put to `thumb_url` attachment field - * @type {string} - * @memberof FileUploadResponse - */ - thumb_url?: string; -} -/** - * - * @export - * @interface FirebaseConfig - */ -export interface FirebaseConfig { - /** - * - * @type {boolean} - * @memberof FirebaseConfig - */ - Disabled?: boolean; - /** - * - * @type {string} - * @memberof FirebaseConfig - */ - apn_template?: string; - /** - * - * @type {string} - * @memberof FirebaseConfig - */ - credentials_json?: string; - /** - * - * @type {string} - * @memberof FirebaseConfig - */ - data_template?: string; - /** - * - * @type {string} - * @memberof FirebaseConfig - */ - notification_template?: string; - /** - * - * @type {string} - * @memberof FirebaseConfig - */ - server_key?: string; -} -/** - * - * @export - * @interface FirebaseConfigFields - */ -export interface FirebaseConfigFields { - /** - * - * @type {string} - * @memberof FirebaseConfigFields - */ - apn_template: string; - /** - * - * @type {string} - * @memberof FirebaseConfigFields - */ - credentials_json?: string; - /** - * - * @type {string} - * @memberof FirebaseConfigFields - */ - data_template: string; - /** - * - * @type {boolean} - * @memberof FirebaseConfigFields - */ - enabled: boolean; - /** - * - * @type {string} - * @memberof FirebaseConfigFields - */ - notification_template: string; - /** - * - * @type {string} - * @memberof FirebaseConfigFields - */ - server_key?: string; -} -/** - * Contains information about flagged user or message - * @export - * @interface Flag - */ -export interface Flag { - /** - * Date of the approval - * @type {string} - * @memberof Flag - */ - approved_at?: string; - /** - * Date/time of creation - * @type {string} - * @memberof Flag - */ - created_at: string; - /** - * - * @type {boolean} - * @memberof Flag - */ - created_by_automod: boolean; - /** - * - * @type {{ [key: string]: any; }} - * @memberof Flag - */ - custom?: { [key: string]: any; }; - /** - * - * @type {FlagDetails} - * @memberof Flag - */ - details?: FlagDetails; - /** - * - * @type {string} - * @memberof Flag - */ - reason?: string; - /** - * Date of the rejection - * @type {string} - * @memberof Flag - */ - rejected_at?: string; - /** - * Date of the review - * @type {string} - * @memberof Flag - */ - reviewed_at?: string; - /** - * - * @type {string} - * @memberof Flag - */ - reviewed_by?: string; - /** - * - * @type {Message} - * @memberof Flag - */ - target_message?: Message; - /** - * ID of flagged message - * @type {string} - * @memberof Flag - */ - target_message_id?: string; - /** - * - * @type {UserObject} - * @memberof Flag - */ - target_user?: UserObject; - /** - * Date/time of the last update - * @type {string} - * @memberof Flag - */ - updated_at: string; - /** - * - * @type {UserObject} - * @memberof Flag - */ - user?: UserObject; -} -/** - * - * @export - * @interface FlagDetails - */ -export interface FlagDetails { - /** - * - * @type {{ [key: string]: any; }} - * @memberof FlagDetails - */ - Extra: { [key: string]: any; }; - /** - * - * @type {AutomodDetails} - * @memberof FlagDetails - */ - automod?: AutomodDetails; - /** - * - * @type {string} - * @memberof FlagDetails - */ - original_text: string; -} -/** - * - * @export - * @interface FlagFeedback - */ -export interface FlagFeedback { - /** - * - * @type {string} - * @memberof FlagFeedback - */ - created_at: string; - /** - * - * @type {Array