diff --git a/.claude/skills/docs-sync/SKILL.md b/.claude/skills/docs-sync/SKILL.md index b1479a9..20103e7 100644 --- a/.claude/skills/docs-sync/SKILL.md +++ b/.claude/skills/docs-sync/SKILL.md @@ -72,7 +72,7 @@ To check what the node SDK can do, read `src/StreamClient.ts`, `src/StreamChatCl ### Writing the Node.js fence - Mirror the `JavaScript` fence: same comments, structure and placeholder literals (`"user-1"`, `"messaging:general"`). -- Use the node SDK's shapes and types: `client.chat.*` / `client.feeds.*`, request objects (`filter_conditions`, `preferences: [...]`), `Date` where the types say `Date` (not `.toISOString()`), and `user_id` where the client code acts as the connected user (server-side `queryChannels` with `hidden` / `muted`, drafts, devices need it). +- Use the node SDK's shapes and types: `client.chat.*` / `client.feeds.*`, request objects (`filter_conditions`, `preferences: [...]`), `Date` where the request types say `Date` (not `.toISOString()`), the SDK time helpers (`nsToDate`, `nsToMs`) for response timestamps (unix-ns numbers, not `Date`s), and `user_id` where the client code acts as the connected user (server-side `queryChannels` with `hidden` / `muted`, drafts, devices need it). - Don't write a `Node.js (stream-chat-js@9)` fence for it: list the group in the report so the v9 version can be added by hand. - Put it before the group's ``. A fence that isn't in a `` block: wrap it and the new fence in ``. - From `$DOCS_DIR`, run `npx prettier --write ` and `node scripts/tab-lint.mjs ` (it puts the tabs in the canonical order: client SDKs first, then server SDKs). diff --git a/__tests__/docs-snippets/AGENTS.md b/__tests__/docs-snippets/AGENTS.md index 2f38809..6b39333 100644 --- a/__tests__/docs-snippets/AGENTS.md +++ b/__tests__/docs-snippets/AGENTS.md @@ -23,6 +23,7 @@ New entries are added only after the user approves them (agents propose them in - `helpers/call-types.ts`: `createCallType(client, cleanup)` creates a `uniqueId` call type, waits until it reads back, and registers it on `cleanup.callTypes`; `trackCallTypeCreates(client, cleanup)` does the same for fences that create the type themselves (spy, call before the region); `retryOnCallTypeMissing(fn)` retries calls into a new type (successful `getCallType` reads don't prove every node knows it: `getOrCreate` can still fail with code 16 "call type does not exist", wrap it in a spy inside regions). A call type with calls can't be deleted (code 4 "multiple calls of that type exist"): `Cleanup` hard-deletes `cleanup.calls` (waiting for the delete task) before `cleanup.callTypes`. `updateChannelType(client, name, patch)` (`helpers/channel-types.ts`) fills in the fields the request requires; `grantMessagingMembers` (`helpers/grants.ts`) adds `messaging` member grants and registers the restore. `helpers/server.ts` has repeated lookups: `sendServerMessage`, `getServerUser` / `getServerMember` / `getServerChannel` (throw unless exactly one result matches), `deletePollsCreatedBy`, `waitForAppSetting`, `waitForTeamIdSupport` (multi-tenancy toggles) `waitForReviewItem` (review queue item of an entity once its flags are there), `deleteFeedModerationTemplate` (the generated `v2DeleteTemplate()` can't send the name) and `saveAndRestoreEventHooks(client, cleanup)` (saves `event_hooks`, registers the restore, returns `{ original, restore }`; `waitForEventHooks`, `withoutTimestamps`). `helpers/feeds.ts`: `retryOnFeedGroupMissing`, `addActivityOnce`, `copyFeedGroup(client, cleanup, builtInId)` (a `uniqueId` group with a built-in group's settings, on `cleanup.feedGroups`), `notificationTypes` / `waitForNotificationTypes` (a user's built-in `notification` feed). `helpers/uploads.ts`: upload fixtures (`JPEG_BASE64` / `jpeg`, `MINIMAL_PDF`) and `ignoreMissingFile` (swallows the 404 of deleting a gone upload). - One `it` per docs snippet (or per closely related group of snippets in the same tab group). - Add basic `expect`s after each snippet to prove it did what the docs claim. +- **Timestamps**: server-sent dates on responses and events are unix-**nanosecond** numbers (`TimestampNS`), not `Date`s; request date fields still take a `Date`. Use the SDK's time helpers (`nsToMs` for arithmetic against `Date.now()`, `nsToDate` to pass one back in a request, `convertTimestampToDate` for optional ones), assert presence with `expect.any(Number)`, and compare two server timestamps directly. Never `new Date(t)` or `.getTime()` on a response field. ### Test app @@ -134,7 +135,7 @@ New entries are added only after the user approves them (agents propose them in - An app setting that changes API behavior (e.g. `enforce_unique_usernames`) can break later tests in the same file: restore it at the end of the test that changes it, and keep the `cleanup.add` restore as a fallback. - Video calls: create them with `uniqueId` ids and push the cid to `cleanup.calls` (hard deleted, "not found" ignored). Call types: `cleanup.callTypes` (see `helpers/call-types.ts`). - Feeds v3 works on the test app (feed groups `user`, `timeline`, `notification`, ...): create feeds with `uniqueId` ids (`client.feeds.feed(group, id).getOrCreate({ user_id })`) and push the fid (`group:id`) to `cleanup.feeds` (hard deleted, "not found" / "can't be found" ignored, so a snippet may delete it first). After a soft `deleteFeedUserData`, `getActivity` on the user's activity rejects with `metadata.responseCode: 404`. -- Feed groups are app-wide and eventually consistent: create them with a `uniqueId` id (hyphens are accepted) and push it to `cleanup.feedGroups` (deleted after `cleanup.feeds`). Calls into a new group can fail with code 16 "Feed group with ID ... not found" for a while (usually 1–2s): `retryOnFeedGroupMissing(client, ['getOrCreateFeed', 'follow', ...])` (`helpers/feeds.ts`) spies on the generated methods and retries them (`StreamFeed` methods go through `client.feeds`). `addActivity` into a new group can answer "not found" after storing the activity, so a blind retry adds it twice: in setup use `addActivityOnce(client, request)` (explicit id, retries only while `getActivity` doesn't find it). `updateFeedGroup` changes take a few seconds to reach reads: wait for several reads in a row to agree. An `updateFeedGroup` fence that leaves fields out clears them, including `aggregation` and `push_notification.push_types`. Feed group `ranking.type` accepts only `expression` and `interest` (code 4); recency is the default when `ranking` is omitted. `updateFeedGroup({ id })` with no other fields clears `custom` (updates replace every field). `deleteFeedGroup` without `hard_delete` soft-deletes (listed only with `include_soft_deleted: true`). +- Feed groups are app-wide and eventually consistent: create them with a `uniqueId` id (hyphens are accepted) and push it to `cleanup.feedGroups` (deleted after `cleanup.feeds`). Calls into a new group can fail with code 16 "Feed group with ID ... not found" for a while (usually 1–2s): `retryOnFeedGroupMissing(client, ['getOrCreateFeed', 'follow', ...])` (`helpers/feeds.ts`) spies on the generated methods and retries them (`StreamFeed` methods go through `client.feeds`). `addActivity` into a new group can answer "not found" after storing the activity, so a blind retry adds it twice: in setup use `addActivityOnce(client, request)` (explicit id, retries only while `getActivity` doesn't find it). A fence that calls `addActivity` into a group the setup created: `waitForFeedGroup(client, id)` first (several `getFeedGroup` reads in a row). `updateFeedGroup` changes take a few seconds to reach reads: wait for several reads in a row to agree. An `updateFeedGroup` fence that leaves fields out clears them, including `aggregation` and `push_notification.push_types`. Feed group `ranking.type` accepts only `expression` and `interest` (code 4); recency is the default when `ranking` is omitted. `updateFeedGroup({ id })` with no other fields clears `custom` (updates replace every field). `deleteFeedGroup` without `hard_delete` soft-deletes (listed only with `include_soft_deleted: true`). - Feed views are app-wide and eventually consistent: `uniqueId` ids and `cleanup.add(() => client.feeds.deleteFeedView({ id }))` (ignore "not found"). `getFeedView` and `getOrCreate({ view })` answer code 16 "... not found" for 1–3s after a create (`retryOnFeedGroupMissing` / `isFeedGroupMissing` match it), `listFeedViews` lags ~4s, `ranking.type: "recency"` is rejected, `updateFeedView({ id })` replaces every field. To read a spy that `retryOnFeedGroupMissing` installed, call `vi.spyOn(client.feeds, 'method')` again (returns the existing mock); `vi.mocked(client.feeds.method)` fails `unbound-method`. - `updateApp({ max_aggregated_activities_length })` returns 200 but `getApp` keeps 0 and the limit isn't applied (2026-10-16); values over 100 are rejected (code 4). - Feed ranking: ranked results settle within ~1–3s; make test popularity the reverse of recency so a passing order proves the ranking. Popularity = reactions (one per type per user: use several types) + shares × 3. Ranking expressions are validated on create (unknown variables such as `externals`, fields without defaults, non-map arguments to map functions, `min_popularity` < 1 for the popular selector). `preference_score` is 0 until the user gives `activityFeedback`. A group created without `activity_selectors` defaults to `current_feed`. Map key order in responses (`ranking.functions`) isn't stable: sort before comparing. A duplicate `createFeedGroup` id (or a built-in id like `timeline`) fails with "already exists": a docs bug. @@ -233,7 +234,7 @@ New entries are added only after the user approves them (agents propose them in - A new channel type starts with empty `guest` grants (no `messaging` defaults). To test removing guest grants on a `uniqueId` type, first copy the guest grants from the built-in type (read only), then `waitForChannelTypePropagation()`; with create + update waits, give that `beforeAll` a 180s timeout. - Uploads are checked by content as well as extension: a tiny CSV (`a,b`) is read as `text/plain` and fails "File type text/plain is not supported" under `allowed_mime_types: ["text/csv"]`. Use a few rows of real CSV. - To prove `disable_auth_checks`, send a dev token (`
..devtoken`, base64url JSON) to `POST /channels?api_key=...` with `stream-auth-type: jwt`: 201 while checks are off, 401 when on. The 401 message differs per API node ("development tokens are not allowed for this application" or "Token signature is invalid", the latter for over a minute on some nodes): accept both, and `retry` until the status matches. -- The same request proves a user token works or is revoked: `POST /channels?api_key=...` with `Authorization: ` and `stream-auth-type: jwt` returns 201 when accepted and 401 code 40 "This token has been revoked, please generate a new token" after a revocation (takes effect within seconds: `retry`). The SDK sets `iat` one second in the past by default, so a token made right after revoking with `new Date()` can still count as revoked: retry the fresh-token check, or give the tokens to revoke an `iat` well in the past. `revoke_tokens_issued_before` reads back as a `Date` that can be 1 ms off: compare with a ±1 ms tolerance. +- The same request proves a user token works or is revoked: `POST /channels?api_key=...` with `Authorization: ` and `stream-auth-type: jwt` returns 201 when accepted and 401 code 40 "This token has been revoked, please generate a new token" after a revocation (takes effect within seconds: `retry`). The SDK sets `iat` one second in the past by default, so a token made right after revoking with `new Date()` can still count as revoked: retry the fresh-token check, or give the tokens to revoke an `iat` well in the past. `revoke_tokens_issued_before` reads back (unix ns) up to 1 ms off the `Date` sent: compare `nsToMs(...)` with a ±1 ms tolerance. - `file_upload_config` / `image_upload_config` come back with every list present (`[]`) and `size_limit: 0`: restore the saved original and `waitForAppSetting` (deep compare) for it. - A new custom role isn't known to every API node right away: `updateUsersPartial({ set: { role } })` just after `createRole` can fail with code 4 `role "..." provided but not defined`. Spy on `client.updateUsersPartial` with a `mockImplementation` that calls the bound original through `retry(..., { retryIf: })`. `deleteRole` right after `createRole` fails the same way with `role "..." does not exist`: retry it like that on `'does not exist'`. - `updateChannelType({ grants: null })` resets grants to the API defaults, which differ from a new type's initial grants (they add e.g. `create-attachment`, `send-poll`, `create-mention`): assert against the update response. New and built-in types start with `guest: []` and `anonymous: []`: to prove a removal snippet works, give those roles grants first. diff --git a/__tests__/docs-snippets/global-setup.ts b/__tests__/docs-snippets/global-setup.ts index 76de494..5a776d2 100644 --- a/__tests__/docs-snippets/global-setup.ts +++ b/__tests__/docs-snippets/global-setup.ts @@ -5,6 +5,7 @@ import { createdAtFromId, DOCS_TEST_PREFIX } from './helpers/ids'; import { describeLeftovers, findLeftovers, + leftoverCreatedAt, removeLeftovers, } from './helpers/leaks'; import type { Leftover } from './helpers/leaks'; @@ -28,7 +29,7 @@ const createdAt = (leftover: Leftover) => { // anything else falls back to the server timestamp. const fromId = createdAtFromId(leftover.id.split(' ')[0]); if (fromId) return fromId; - return leftover.createdAt ? new Date(leftover.createdAt) : undefined; + return leftoverCreatedAt(leftover); }; const loadEnv = () => { diff --git a/__tests__/docs-snippets/helpers/feeds.ts b/__tests__/docs-snippets/helpers/feeds.ts index e791346..4a16b1a 100644 --- a/__tests__/docs-snippets/helpers/feeds.ts +++ b/__tests__/docs-snippets/helpers/feeds.ts @@ -40,6 +40,18 @@ export const retryOnFeedGroupMissing = ( } }; +/** + * Waits until a new feed group can be read back several times in a row, for setup + * before a region that calls `addActivity` into it (which can't be retried blindly). + */ +export const waitForFeedGroup = async (client: StreamClient, id: string) => { + for (let i = 0; i < 5; i++) { + await retry(() => client.feeds.getFeedGroup({ id }), { + retryIf: isFeedGroupMissing, + }); + } +}; + /** * Adds an activity (setup only) into a feed whose group may be new. `addActivity` can * answer "Feed group ... not found" after it already stored the activity, so a blind diff --git a/__tests__/docs-snippets/helpers/leaks.ts b/__tests__/docs-snippets/helpers/leaks.ts index 977fb4d..8acd9bf 100644 --- a/__tests__/docs-snippets/helpers/leaks.ts +++ b/__tests__/docs-snippets/helpers/leaks.ts @@ -1,4 +1,5 @@ -import type { StreamClient } from '../../../index'; +import { nsToDate } from '../../../index'; +import type { StreamClient, TimestampNS } from '../../../index'; import { DOCS_TEST_PREFIX } from './ids'; import { deleteMembershipLevel } from './feeds'; import { @@ -8,12 +9,23 @@ import { import { hardDeleteUsers } from './users'; import { retry, retryOnRateLimit, waitForTask } from './wait'; +/** A leftover's `createdAt` as a `Date`, or `undefined` when it has none. */ +export const leftoverCreatedAt = ({ createdAt }: Leftover) => { + if (createdAt === undefined) return undefined; + return typeof createdAt === 'number' + ? nsToDate(createdAt) + : new Date(createdAt); +}; + /** Something a docs test created and didn't remove. */ export type Leftover = { kind: string; id: string; - /** Used by the sweep to skip resources of runs that may still be in progress. */ - createdAt?: Date | string; + /** + * Used by the sweep to skip resources of runs that may still be in progress. A unix-ns + * timestamp from a response, or an RFC3339 string; read it with `leftoverCreatedAt`. + */ + createdAt?: number | string; remove: () => Promise; /** * Removes many leftovers of this kind in one call (e.g. users in one `deleteUsers`). @@ -112,7 +124,7 @@ const scanners: Record = { async channels(client, { matches, ids: channelIds = [], createdSince }) { const found = new Map(); - const add = (channel: { cid: string; created_at: Date }) => + const add = (channel: { cid: string; created_at: number }) => found.set(channel.cid, { kind: 'channel', id: channel.cid, @@ -402,12 +414,17 @@ const scanners: Record = { // without one it fails with code 4 "cannot specify sort and next/prev at the same // time" (2026-10-16). const scan = async (filter_conditions: Record) => { - let after: Date | undefined; + let after: TimestampNS | undefined; for (;;) { const response = await retryOnRateLimit(() => client.video.queryCalls({ filter_conditions: after - ? { $and: [filter_conditions, { created_at: { $gt: after } }] } + ? { + $and: [ + filter_conditions, + { created_at: { $gt: nsToDate(after) } }, + ], + } : filter_conditions, sort: [{ field: 'created_at', direction: 1 }], limit: 100, diff --git a/__tests__/docs-snippets/maintenance/sweep.ts b/__tests__/docs-snippets/maintenance/sweep.ts index 7a2bc3d..f99d701 100644 --- a/__tests__/docs-snippets/maintenance/sweep.ts +++ b/__tests__/docs-snippets/maintenance/sweep.ts @@ -4,6 +4,7 @@ import { createdAtFromId, DOCS_TEST_PREFIX } from '../helpers/ids'; import { describeLeftovers, findLeftovers, + leftoverCreatedAt, removeLeftovers, } from '../helpers/leaks'; import type { Leftover } from '../helpers/leaks'; @@ -20,9 +21,8 @@ const dryRun = process.env.DOCS_SWEEP_DRY_RUN === '1'; const minAgeMinutes = Number(process.env.DOCS_SWEEP_MIN_AGE ?? 30); const isOldEnough = (leftover: Leftover) => { - const createdAt = leftover.createdAt - ? new Date(leftover.createdAt) - : createdAtFromId(leftover.id.split(' ')[0]); + const createdAt = + leftoverCreatedAt(leftover) ?? createdAtFromId(leftover.id.split(' ')[0]); // Unknown age: only sweep it when explicitly asked to ignore age. if (!createdAt || Number.isNaN(createdAt.getTime())) return minAgeMinutes === 0; diff --git a/__tests__/docs-snippets/pages/activity-feeds/v3-latest/01-basics/01-quickstart.test.ts b/__tests__/docs-snippets/pages/activity-feeds/v3-latest/01-basics/01-quickstart.test.ts index abbb7e4..f73aada 100644 --- a/__tests__/docs-snippets/pages/activity-feeds/v3-latest/01-basics/01-quickstart.test.ts +++ b/__tests__/docs-snippets/pages/activity-feeds/v3-latest/01-basics/01-quickstart.test.ts @@ -185,7 +185,7 @@ describe(DOCS, () => { return response; }); expect(after.notification_status?.unread).toBe(0); - expect(after.notification_status?.last_read_at).toBeInstanceOf(Date); + expect(after.notification_status?.last_read_at).toEqual(expect.any(Number)); }); it('creates a poll, attaches it to an activity and votes', async () => { diff --git a/__tests__/docs-snippets/pages/activity-feeds/v3-latest/03-feed_groups/01-feed-groups.test.ts b/__tests__/docs-snippets/pages/activity-feeds/v3-latest/03-feed_groups/01-feed-groups.test.ts index 24f0d59..3c131a4 100644 --- a/__tests__/docs-snippets/pages/activity-feeds/v3-latest/03-feed_groups/01-feed-groups.test.ts +++ b/__tests__/docs-snippets/pages/activity-feeds/v3-latest/03-feed_groups/01-feed-groups.test.ts @@ -440,6 +440,6 @@ describe(DOCS, () => { }); return all.groups[feedGroupId]; }); - expect(deleted?.deleted_at).toBeInstanceOf(Date); + expect(deleted?.deleted_at).toEqual(expect.any(Number)); }); }); diff --git a/__tests__/docs-snippets/pages/activity-feeds/v3-latest/03-feed_groups/06-notification_feeds.test.ts b/__tests__/docs-snippets/pages/activity-feeds/v3-latest/03-feed_groups/06-notification_feeds.test.ts index 916071e..3cfa8d8 100644 --- a/__tests__/docs-snippets/pages/activity-feeds/v3-latest/03-feed_groups/06-notification_feeds.test.ts +++ b/__tests__/docs-snippets/pages/activity-feeds/v3-latest/03-feed_groups/06-notification_feeds.test.ts @@ -589,10 +589,10 @@ describe(DOCS, () => { // #region snippet docs="activity-feeds/v3-latest/_default/03-feed_groups/06-notification_feeds.md" heading="Legacy: Client-side computation" tab="Node.js" index=1 // Deprecated — use group.is_read / group.is_seen instead const isRead = - (lastReadAt && group.updated_at.getTime() < lastReadAt.getTime()) || + (lastReadAt && group.updated_at < lastReadAt) || readActivities.includes(group.group); const isSeen = - (lastSeenAt && group.updated_at.getTime() < lastSeenAt.getTime()) || + (lastSeenAt && group.updated_at < lastSeenAt) || seenActivities.includes(group.group); // #endregion snippet diff --git a/__tests__/docs-snippets/pages/activity-feeds/v3-latest/03-feed_groups/08-for_you_feed.test.ts b/__tests__/docs-snippets/pages/activity-feeds/v3-latest/03-feed_groups/08-for_you_feed.test.ts index e40b4e2..0be07b4 100644 --- a/__tests__/docs-snippets/pages/activity-feeds/v3-latest/03-feed_groups/08-for_you_feed.test.ts +++ b/__tests__/docs-snippets/pages/activity-feeds/v3-latest/03-feed_groups/08-for_you_feed.test.ts @@ -14,6 +14,7 @@ import { copyFeedGroup, isFeedGroupMissing, retryOnFeedGroupMissing, + waitForFeedGroup, } from '../../../../helpers/feeds'; import { uniqueId } from '../../../../helpers/ids'; import { retry } from '../../../../helpers/wait'; @@ -71,6 +72,8 @@ describe(DOCS, () => { oneFid = await createFeed('user', oneId, oneId); const stockGroupId = newFeedGroupId('stock'); await client.feeds.createFeedGroup({ id: stockGroupId }); + // The fence adds an activity into this group, and addActivity can't be retried. + await waitForFeedGroup(client, stockGroupId); appleFid = await createFeed(stockGroupId, uniqueId('apple'), jackId); }); diff --git a/__tests__/docs-snippets/pages/activity-feeds/v3-latest/03-feed_groups/09-stories.test.ts b/__tests__/docs-snippets/pages/activity-feeds/v3-latest/03-feed_groups/09-stories.test.ts index 8d88078..4b3fd32 100644 --- a/__tests__/docs-snippets/pages/activity-feeds/v3-latest/03-feed_groups/09-stories.test.ts +++ b/__tests__/docs-snippets/pages/activity-feeds/v3-latest/03-feed_groups/09-stories.test.ts @@ -1,4 +1,5 @@ import { afterAll, afterEach, describe, expect, it, vi } from 'vitest'; +import { nsToMs } from '../../../../../../index'; import { getServerClient } from '../../../../helpers/clients'; import { Cleanup } from '../../../../helpers/cleanup'; import { uniqueId } from '../../../../helpers/ids'; @@ -125,7 +126,7 @@ describe(DOCS, () => { ); // The stored time can be 1 ms off the ISO string that was sent. expect( - Math.abs((story.expires_at?.getTime() ?? 0) - tomorrow.getTime()), + Math.abs(nsToMs(story.expires_at ?? 0) - tomorrow.getTime()), ).toBeLessThanOrEqual(1); }); diff --git a/__tests__/docs-snippets/pages/activity-feeds/v3-latest/04-feeds-and-follows/02-search-feeds.test.ts b/__tests__/docs-snippets/pages/activity-feeds/v3-latest/04-feeds-and-follows/02-search-feeds.test.ts index f648642..fc639c8 100644 --- a/__tests__/docs-snippets/pages/activity-feeds/v3-latest/04-feeds-and-follows/02-search-feeds.test.ts +++ b/__tests__/docs-snippets/pages/activity-feeds/v3-latest/04-feeds-and-follows/02-search-feeds.test.ts @@ -95,8 +95,8 @@ describe(DOCS, () => { expect(firstPage.next).toBeTruthy(); expect(secondPage.feeds).toHaveLength(2); expect([...fids(firstPage), ...fids(secondPage)].sort()).toEqual(expected); - const times = [...firstPage.feeds, ...secondPage.feeds].map((f) => - f.created_at.getTime(), + const times = [...firstPage.feeds, ...secondPage.feeds].map( + (f) => f.created_at, ); expect(times).toEqual([...times].sort((a, b) => b - a)); }); diff --git a/__tests__/docs-snippets/pages/activity-feeds/v3-latest/05-activities/01-activities.test.ts b/__tests__/docs-snippets/pages/activity-feeds/v3-latest/05-activities/01-activities.test.ts index 81be65d..8dd19e4 100644 --- a/__tests__/docs-snippets/pages/activity-feeds/v3-latest/05-activities/01-activities.test.ts +++ b/__tests__/docs-snippets/pages/activity-feeds/v3-latest/05-activities/01-activities.test.ts @@ -290,7 +290,7 @@ describe(DOCS, () => { expect(response.activity.custom).toEqual({ color: 'red', size: 'L' }); expect(unsetResponse.activity.text).toBe('Japan has over 6,800 islands.'); expect(unsetResponse.activity.custom).toEqual({ size: 'L' }); - expect(unsetResponse.activity.edited_at).toBeInstanceOf(Date); + expect(unsetResponse.activity.edited_at).toEqual(expect.any(Number)); expect(log).toHaveBeenCalledTimes(2); }); @@ -312,7 +312,7 @@ describe(DOCS, () => { // #endregion snippet expect(response.activity.text).toBe('Updated text'); - expect(response.activity.edited_at).toBeInstanceOf(Date); + expect(response.activity.edited_at).toEqual(expect.any(Number)); expect(log).toHaveBeenCalledWith(response.activity.edited_at); }); @@ -349,7 +349,7 @@ describe(DOCS, () => { id, include_soft_deleted_activities: true, }); - expect(activity.deleted_at).toBeInstanceOf(Date); + expect(activity.deleted_at).toEqual(expect.any(Number)); } }); @@ -399,7 +399,7 @@ describe(DOCS, () => { // #endregion snippet expect(activity.id).toBe(activityId); - expect(activity.deleted_at).toBeInstanceOf(Date); + expect(activity.deleted_at).toEqual(expect.any(Number)); expect(log).toHaveBeenCalledWith(undefined, activity.deleted_at); }); diff --git a/__tests__/docs-snippets/pages/activity-feeds/v3-latest/05-activities/02-querying-activities.test.ts b/__tests__/docs-snippets/pages/activity-feeds/v3-latest/05-activities/02-querying-activities.test.ts index edd2794..ae751f7 100644 --- a/__tests__/docs-snippets/pages/activity-feeds/v3-latest/05-activities/02-querying-activities.test.ts +++ b/__tests__/docs-snippets/pages/activity-feeds/v3-latest/05-activities/02-querying-activities.test.ts @@ -95,7 +95,7 @@ describe(DOCS, () => { expect(response.activities.every((a) => a.type === 'post')).toBe(true); // Newest first: the activity just created comes first. expect(response.activities[0].id).toBe(activityId); - const times = response.activities.map((a) => a.created_at.getTime()); + const times = response.activities.map((a) => a.created_at); expect(times).toEqual([...times].sort((a, b) => b - a)); }); @@ -218,7 +218,7 @@ describe(DOCS, () => { // #endregion snippet const deleted = response.activities.find((a) => a.id === deletedId); - expect(deleted?.deleted_at).toBeInstanceOf(Date); + expect(deleted?.deleted_at).toEqual(expect.any(Number)); }); it('queries moderated activities', async () => { diff --git a/__tests__/docs-snippets/pages/activity-feeds/v3-latest/06-features/03-comments.test.ts b/__tests__/docs-snippets/pages/activity-feeds/v3-latest/06-features/03-comments.test.ts index c8f43d6..18f279d 100644 --- a/__tests__/docs-snippets/pages/activity-feeds/v3-latest/06-features/03-comments.test.ts +++ b/__tests__/docs-snippets/pages/activity-feeds/v3-latest/06-features/03-comments.test.ts @@ -160,7 +160,7 @@ describe(DOCS, () => { // #endregion snippet expect(response.comment.text).toBe('Updated comment'); - expect(response.comment.edited_at).toBeInstanceOf(Date); + expect(response.comment.edited_at).toEqual(expect.any(Number)); expect(log).toHaveBeenCalledWith(response.comment.edited_at); }); diff --git a/__tests__/docs-snippets/pages/activity-feeds/v3-latest/06-features/10-moderation.test.ts b/__tests__/docs-snippets/pages/activity-feeds/v3-latest/06-features/10-moderation.test.ts index 69d3445..0e4c655 100644 --- a/__tests__/docs-snippets/pages/activity-feeds/v3-latest/06-features/10-moderation.test.ts +++ b/__tests__/docs-snippets/pages/activity-feeds/v3-latest/06-features/10-moderation.test.ts @@ -7,6 +7,7 @@ import { it, vi, } from 'vitest'; +import { nsToMs } from '../../../../../../index'; import type { QueryModerationConfigsResponse, QueryReviewQueueResponse, @@ -57,10 +58,7 @@ describe(DOCS, () => { payload: { filter_conditions: { user_id: { $eq: userId } } }, }); expect(bans).toHaveLength(1); - return ( - ((bans[0].expires?.getTime() ?? 0) - bans[0].created_at.getTime()) / - 60_000 - ); + return (nsToMs(bans[0].expires ?? 0) - nsToMs(bans[0].created_at)) / 60_000; }; beforeAll(async () => { diff --git a/__tests__/docs-snippets/pages/chat/03-channels/04-query_members.test.ts b/__tests__/docs-snippets/pages/chat/03-channels/04-query_members.test.ts index 11a4eae..b0afe2d 100644 --- a/__tests__/docs-snippets/pages/chat/03-channels/04-query_members.test.ts +++ b/__tests__/docs-snippets/pages/chat/03-channels/04-query_members.test.ts @@ -1,4 +1,5 @@ import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'; +import { nsToDate } from '../../../../../index'; import type { MembersResponse } from '../../../../../index'; import { getServerClient } from '../../../helpers/clients'; import { Cleanup } from '../../../helpers/cleanup'; @@ -107,7 +108,7 @@ describe(DOCS, () => { filter_conditions: {}, sort: [{ field: 'created_at', direction: -1 }], limit: 100, - created_at_before: lastByCreatedAt.created_at, + created_at_before: nsToDate(lastByCreatedAt.created_at), }, }); diff --git a/__tests__/docs-snippets/pages/chat/03-channels/07-channel_management/10-muting.test.ts b/__tests__/docs-snippets/pages/chat/03-channels/07-channel_management/10-muting.test.ts index dd09d2a..fb6e6d5 100644 --- a/__tests__/docs-snippets/pages/chat/03-channels/07-channel_management/10-muting.test.ts +++ b/__tests__/docs-snippets/pages/chat/03-channels/07-channel_management/10-muting.test.ts @@ -1,4 +1,5 @@ import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'; +import { nsToMs } from '../../../../../../index'; import type { MuteChannelResponse, QueryChannelsResponse, @@ -82,14 +83,12 @@ describe(DOCS, () => { const now = Date.now(); const twoWeeksExpires = muteOf(twoWeeks)?.expires; expect(twoWeeksExpires).toBeDefined(); - expect(new Date(twoWeeksExpires ?? 0).getTime()).toBeGreaterThan( + expect(nsToMs(twoWeeksExpires ?? 0)).toBeGreaterThan( now + 13 * 24 * 60 * 60 * 1000, ); const tenSecondsExpires = muteOf(tenSeconds)?.expires; expect(tenSecondsExpires).toBeDefined(); - expect(new Date(tenSecondsExpires ?? 0).getTime()).toBeLessThan( - now + 60 * 1000, - ); + expect(nsToMs(tenSecondsExpires ?? 0)).toBeLessThan(now + 60 * 1000); expect(await mutedCids()).toEqual([cid]); }); diff --git a/__tests__/docs-snippets/pages/chat/03-channels/07-channel_management/13-deleting.test.ts b/__tests__/docs-snippets/pages/chat/03-channels/07-channel_management/13-deleting.test.ts index 2166fa5..e39093f 100644 --- a/__tests__/docs-snippets/pages/chat/03-channels/07-channel_management/13-deleting.test.ts +++ b/__tests__/docs-snippets/pages/chat/03-channels/07-channel_management/13-deleting.test.ts @@ -102,7 +102,7 @@ describe(DOCS, () => { deleteSpy.mockRestore(); expect(soft.channel?.cid).toBe(cid); - expect(soft.channel?.deleted_at).toBeInstanceOf(Date); + expect(soft.channel?.deleted_at).toEqual(expect.any(Number)); expect(hard.channel?.cid).toBe(otherCid); expect(await countChannels([cid, otherCid])).toBe(0); }); diff --git a/__tests__/docs-snippets/pages/chat/03-channels/07-channel_management/14-freezing.test.ts b/__tests__/docs-snippets/pages/chat/03-channels/07-channel_management/14-freezing.test.ts index 5fd3ffe..18e77f8 100644 --- a/__tests__/docs-snippets/pages/chat/03-channels/07-channel_management/14-freezing.test.ts +++ b/__tests__/docs-snippets/pages/chat/03-channels/07-channel_management/14-freezing.test.ts @@ -121,13 +121,8 @@ describe(DOCS, () => { const adminGrants = [...channelType.grants.admin, 'use-frozen-channel']; - // automod, automod_behavior and max_message_length are required on update and - // are not preserved when omitted, so read them back from the current type. await client.chat.updateChannelType({ name: 'messaging', - automod: channelType.automod, - automod_behavior: channelType.automod_behavior, - max_message_length: channelType.max_message_length, grants: { admin: adminGrants }, }); // #endregion snippet diff --git a/__tests__/docs-snippets/pages/chat/03-channels/07-channel_management/15-truncating.test.ts b/__tests__/docs-snippets/pages/chat/03-channels/07-channel_management/15-truncating.test.ts index 6bc5bff..2ea9270 100644 --- a/__tests__/docs-snippets/pages/chat/03-channels/07-channel_management/15-truncating.test.ts +++ b/__tests__/docs-snippets/pages/chat/03-channels/07-channel_management/15-truncating.test.ts @@ -7,6 +7,7 @@ import { it, vi, } from 'vitest'; +import { nsToMs } from '../../../../../../index'; import type { TruncateChannelResponse } from '../../../../../../index'; import { getServerClient } from '../../../../helpers/clients'; import { Cleanup } from '../../../../helpers/cleanup'; @@ -136,11 +137,9 @@ describe(DOCS, () => { expect(visibleAfter[2]).toEqual([]); // `truncated_at` an hour ago keeps the messages sent since then. const truncatedAt = responses[3].channel?.truncated_at; - expect(truncatedAt).toBeInstanceOf(Date); + expect(truncatedAt).toEqual(expect.any(Number)); if (truncatedAt) { - expect(Date.now() - truncatedAt.getTime()).toBeGreaterThan( - 59 * 60 * 1000, - ); + expect(Date.now() - nsToMs(truncatedAt)).toBeGreaterThan(59 * 60 * 1000); } expect(visibleAfter[3]).toEqual(['recent', 'before-4']); }); diff --git a/__tests__/docs-snippets/pages/chat/04-messages/05-pinned_messages.test.ts b/__tests__/docs-snippets/pages/chat/04-messages/05-pinned_messages.test.ts index 5f95840..7fcb684 100644 --- a/__tests__/docs-snippets/pages/chat/04-messages/05-pinned_messages.test.ts +++ b/__tests__/docs-snippets/pages/chat/04-messages/05-pinned_messages.test.ts @@ -1,4 +1,5 @@ import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'; +import { convertTimestampToDate, nsToMs } from '../../../../../index'; import { getServerClient } from '../../../helpers/clients'; import { Cleanup } from '../../../helpers/cleanup'; import { uniqueId } from '../../../helpers/ids'; @@ -83,10 +84,12 @@ describe(DOCS, () => { expect(message.pinned).toBe(true); expect(message.pinned_by?.id).toBe(john); - expect(message.pin_expires?.toISOString()).toBe('2077-01-01T00:00:00.000Z'); + expect(convertTimestampToDate(message.pin_expires)?.toISOString()).toBe( + '2077-01-01T00:00:00.000Z', + ); expect(timed.message?.pinned).toBe(true); - const timedExpiry = timed.message?.pin_expires?.getTime() ?? 0; + const timedExpiry = nsToMs(timed.message?.pin_expires ?? 0); expect(timedExpiry).toBeGreaterThanOrEqual(before + 110 * 1000); expect(timedExpiry).toBeLessThan(Date.now() + 130 * 1000); diff --git a/__tests__/docs-snippets/pages/chat/04-messages/08-unread_reminders.test.ts b/__tests__/docs-snippets/pages/chat/04-messages/08-unread_reminders.test.ts index 66f3cf7..0da4a8b 100644 --- a/__tests__/docs-snippets/pages/chat/04-messages/08-unread_reminders.test.ts +++ b/__tests__/docs-snippets/pages/chat/04-messages/08-unread_reminders.test.ts @@ -41,16 +41,9 @@ describe(DOCS, () => { // #region snippet docs="chat/_default/04-messages/08-unread_reminders.md" heading="Enabling Unread Reminders" tab="Node.js" index=1 // COPY: channelType="messaging" - // automod, automod_behavior and max_message_length are required here, so read - // the current values and carry them through. - const current = await client.chat.getChannelType({ name: channelType }); - // Enable reminders for the messaging channel type await client.chat.updateChannelType({ name: channelType, - automod: current.automod, - automod_behavior: current.automod_behavior, - max_message_length: current.max_message_length, reminders: true, }); @@ -64,8 +57,8 @@ describe(DOCS, () => { return response; }); expect(updated.reminders).toBe(true); - expect(updated.automod).toBe(current.automod); - expect(updated.max_message_length).toBe(current.max_message_length); + expect(updated.automod).toBe(before.automod); + expect(updated.max_message_length).toBe(before.max_message_length); await waitForAppSetting(client, 'reminders_interval', 3600); const { app } = await client.getApp(); diff --git a/__tests__/docs-snippets/pages/chat/04-messages/09-message_reminders.test.ts b/__tests__/docs-snippets/pages/chat/04-messages/09-message_reminders.test.ts index 22be9d3..a16798c 100644 --- a/__tests__/docs-snippets/pages/chat/04-messages/09-message_reminders.test.ts +++ b/__tests__/docs-snippets/pages/chat/04-messages/09-message_reminders.test.ts @@ -1,4 +1,5 @@ import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'; +import { nsToMs } from '../../../../../index'; import { getServerClient } from '../../../helpers/clients'; import { Cleanup } from '../../../helpers/cleanup'; import { uniqueId } from '../../../helpers/ids'; @@ -104,22 +105,16 @@ describe(DOCS, () => { }); // Enabling it for a channel type. - // automod, automod_behavior and max_message_length are required here, so read - // the current values and carry them through. - const current = await client.chat.getChannelType({ name: channelType }); const update = await client.chat.updateChannelType({ name: channelType, - automod: current.automod, - automod_behavior: current.automod_behavior, - max_message_length: current.max_message_length, user_message_reminders: true, }); // #endregion snippet await waitForChannelTypePropagation(); expect(update.user_message_reminders).toBe(true); - expect(update.automod).toBe(current.automod); - expect(update.max_message_length).toBe(current.max_message_length); + expect(update.automod).toBe(before.automod); + expect(update.max_message_length).toBe(before.max_message_length); const updated = await client.chat.getChannelType({ name: channelType }); expect(updated.user_message_reminders).toBe(true); @@ -168,8 +163,10 @@ describe(DOCS, () => { [messageId, anotherMessageId].sort(), ); const timed = byMessage.get(messageId)?.remind_at; - expect(timed).toBeInstanceOf(Date); - expect(timed?.getTime()).toBeGreaterThanOrEqual(startedAt + 3600000 - 1000); + expect(timed).toEqual(expect.any(Number)); + expect(nsToMs(timed ?? 0)).toBeGreaterThanOrEqual( + startedAt + 3600000 - 1000, + ); expect(byMessage.get(anotherMessageId)?.remind_at ?? null).toBeNull(); }); @@ -203,8 +200,8 @@ describe(DOCS, () => { // #endregion snippet const newDueDate = updated.reminder.remind_at; - expect(newDueDate).toBeInstanceOf(Date); - expect(newDueDate?.getTime()).toBeGreaterThanOrEqual( + expect(newDueDate).toEqual(expect.any(Number)); + expect(nsToMs(newDueDate ?? 0)).toBeGreaterThanOrEqual( startedAt + 7200000 - 1000, ); expect(log.mock.calls[0]).toEqual([newDueDate]); diff --git a/__tests__/docs-snippets/pages/chat/04-messages/10-message_receipts.test.ts b/__tests__/docs-snippets/pages/chat/04-messages/10-message_receipts.test.ts index e9e68f2..a7b6702 100644 --- a/__tests__/docs-snippets/pages/chat/04-messages/10-message_receipts.test.ts +++ b/__tests__/docs-snippets/pages/chat/04-messages/10-message_receipts.test.ts @@ -46,16 +46,8 @@ describe(DOCS, () => { }); // When updating an existing channel type. - // automod, automod_behavior and max_message_length are required here, so read - // the current values and carry them through. - const current = await client.chat.getChannelType({ - name: targetChannelType, - }); await client.chat.updateChannelType({ name: targetChannelType, - automod: current.automod, - automod_behavior: current.automod_behavior, - max_message_length: current.max_message_length, delivery_events: true, }); // #endregion snippet @@ -67,14 +59,13 @@ describe(DOCS, () => { ), ); expect(created.delivery_events).toBe(true); - expect(current.delivery_events).toBe(true); - expect(current.automod).toBe('disabled'); const [updated] = await Promise.all( updateSpy.mock.results.map( (r) => r.value as ReturnType, ), ); expect(updated.delivery_events).toBe(true); + expect(updated.automod).toBe('disabled'); const after = await client.chat.getChannelType({ name: targetChannelType }); expect(after.delivery_events).toBe(true); expect(after.max_message_length).toBe(5000); @@ -120,16 +111,8 @@ describe(DOCS, () => { }); // When updating an existing channel type. - // automod, automod_behavior and max_message_length are required here, so read - // the current values and carry them through. - const current = await client.chat.getChannelType({ - name: targetChannelType, - }); await client.chat.updateChannelType({ name: targetChannelType, - automod: current.automod, - automod_behavior: current.automod_behavior, - max_message_length: current.max_message_length, read_events: true, }); // #endregion snippet @@ -141,13 +124,13 @@ describe(DOCS, () => { ), ); expect(created.read_events).toBe(true); - expect(current.read_events).toBe(true); const [updated] = await Promise.all( updateSpy.mock.results.map( (r) => r.value as ReturnType, ), ); expect(updated.read_events).toBe(true); + expect(updated.automod).toBe('disabled'); const after = await client.chat.getChannelType({ name: targetChannelType }); expect(after.read_events).toBe(true); expect(after.max_message_length).toBe(5000); diff --git a/__tests__/docs-snippets/pages/chat/05-features/03-unread.test.ts b/__tests__/docs-snippets/pages/chat/05-features/03-unread.test.ts index f434306..cbb6d0d 100644 --- a/__tests__/docs-snippets/pages/chat/05-features/03-unread.test.ts +++ b/__tests__/docs-snippets/pages/chat/05-features/03-unread.test.ts @@ -228,7 +228,7 @@ describe(DOCS, () => { ); expect(unreadByUser).toEqual({ [sender]: 0, [userID]: 1, [userID2]: 0 }); expect(log).toHaveBeenCalledTimes(3); - expect(log).toHaveBeenCalledWith(userID, expect.any(Date), 1); + expect(log).toHaveBeenCalledWith(userID, expect.any(Number), 1); }); it('reads the unread messages per channel', async () => { diff --git a/__tests__/docs-snippets/pages/chat/05-features/06-campaign_api.test.ts b/__tests__/docs-snippets/pages/chat/05-features/06-campaign_api.test.ts index 022d11c..dbd3c51 100644 --- a/__tests__/docs-snippets/pages/chat/05-features/06-campaign_api.test.ts +++ b/__tests__/docs-snippets/pages/chat/05-features/06-campaign_api.test.ts @@ -7,6 +7,7 @@ import { it, vi, } from 'vitest'; +import { nsToMs } from '../../../../../index'; import { StreamError } from '../../../../../index'; import type { CampaignResponse, @@ -137,7 +138,7 @@ describe(DOCS, () => { expect(['scheduled', 'in_progress', 'completed']).toContain( campaign?.status, ); - expect(campaign?.scheduled_for?.getTime() ?? 0).toBeLessThan( + expect(nsToMs(campaign?.scheduled_for ?? 0)).toBeLessThan( Date.now() + 60000, ); }; @@ -306,8 +307,8 @@ describe(DOCS, () => { id: anotherCampaignId, }); expect(scheduled?.status).toBe('scheduled'); - expect(scheduled?.scheduled_for).toBeInstanceOf(Date); - expect(scheduled?.stop_at).toBeInstanceOf(Date); + expect(scheduled?.scheduled_for).toEqual(expect.any(Number)); + expect(scheduled?.stop_at).toEqual(expect.any(Number)); }); it('updates, starts, stops, deletes and queries a campaign', async () => { @@ -837,7 +838,7 @@ describe(DOCS, () => { expect(typeof stats?.progress).toBe('number'); expect(typeof stats?.stats_messages_sent).toBe('number'); expect(typeof stats?.stats_users_sent).toBe('number'); - expect(stats?.stats_started_at).toBeInstanceOf(Date); + expect(stats?.stats_started_at).toEqual(expect.any(Number)); }); }); diff --git a/__tests__/docs-snippets/pages/chat/05-features/08-location_sharing.test.ts b/__tests__/docs-snippets/pages/chat/05-features/08-location_sharing.test.ts index f72f065..2566875 100644 --- a/__tests__/docs-snippets/pages/chat/05-features/08-location_sharing.test.ts +++ b/__tests__/docs-snippets/pages/chat/05-features/08-location_sharing.test.ts @@ -8,6 +8,7 @@ import { vi, type MockInstance, } from 'vitest'; +import { nsToMs } from '../../../../../index'; import type { StreamClient } from '../../../../../index'; import { getServerClient } from '../../../helpers/clients'; import { Cleanup } from '../../../helpers/cleanup'; @@ -145,15 +146,8 @@ describe(DOCS, () => { }); // Enabling it for a channel type. - // automod, automod_behavior and max_message_length are required here, so read - // the current values and carry them through. - const current = await client.chat.getChannelType({ name: channelType }); - await client.chat.updateChannelType({ name: channelType, - automod: current.automod, - automod_behavior: current.automod_behavior, - max_message_length: current.max_message_length, shared_locations: true, }); // #endregion snippet @@ -246,7 +240,7 @@ describe(DOCS, () => { longitude: 10, message_id: message.id, }); - expect(message.shared_location?.end_at?.getTime()).toBeGreaterThan( + expect(nsToMs(message.shared_location?.end_at ?? 0)).toBeGreaterThan( Date.now(), ); expect(await activeLiveLocationIds()).toContain(message.id); @@ -274,10 +268,8 @@ describe(DOCS, () => { StreamClient['updateLiveLocation'] >); expect(stopped.message_id).toBe(messageID); - expect(stopped.end_at?.getTime()).toBeLessThanOrEqual(Date.now()); - expect((await storedLocation(messageID))?.end_at?.getTime()).toBe( - stopped.end_at?.getTime(), - ); + expect(nsToMs(stopped.end_at ?? 0)).toBeLessThanOrEqual(Date.now()); + expect((await storedLocation(messageID))?.end_at).toBe(stopped.end_at); expect(await activeLiveLocationIds()).not.toContain(messageID); }); diff --git a/__tests__/docs-snippets/pages/chat/05-features/10-advanced/15-pending_messages.test.ts b/__tests__/docs-snippets/pages/chat/05-features/10-advanced/15-pending_messages.test.ts index 62ee1e0..059b075 100644 --- a/__tests__/docs-snippets/pages/chat/05-features/10-advanced/15-pending_messages.test.ts +++ b/__tests__/docs-snippets/pages/chat/05-features/10-advanced/15-pending_messages.test.ts @@ -83,15 +83,8 @@ describe(DOCS, () => { // #region snippet docs="chat/_default/05-features/10-advanced/15-pending_messages.md" heading="Sending Pending Messages" tab="Node.js" index=1 // COPY: channelType="messaging" - // automod, automod_behavior and max_message_length are required here, so read - // the current values and carry them through. - const current = await client.chat.getChannelType({ name: channelType }); - const response = await client.chat.updateChannelType({ name: channelType, - automod: current.automod, - automod_behavior: current.automod_behavior, - max_message_length: current.max_message_length, mark_messages_pending: true, }); // #endregion snippet diff --git a/__tests__/docs-snippets/pages/chat/05-features/10-advanced/16-dynamic_partitioning.test.ts b/__tests__/docs-snippets/pages/chat/05-features/10-advanced/16-dynamic_partitioning.test.ts index ca72376..614b329 100644 --- a/__tests__/docs-snippets/pages/chat/05-features/10-advanced/16-dynamic_partitioning.test.ts +++ b/__tests__/docs-snippets/pages/chat/05-features/10-advanced/16-dynamic_partitioning.test.ts @@ -103,19 +103,13 @@ describe(DOCS, () => { }); it('updates the partition size', async () => { + const before = await client.chat.getChannelType({ name: channelType }); const updateSpy = vi.spyOn(client.chat, 'updateChannelType'); // #region snippet docs="chat/_default/05-features/10-advanced/16-dynamic_partitioning.md" heading="Updating dynamic partitioning" tab="Node.js" index=1 // COPY: channelType="example" - // automod, automod_behavior and max_message_length are required here, so read - // the current values and carry them through. - const current = await client.chat.getChannelType({ name: channelType }); - await client.chat.updateChannelType({ name: channelType, - automod: current.automod, - automod_behavior: current.automod_behavior, - max_message_length: current.max_message_length, partition_size: 200, }); // #endregion snippet @@ -123,8 +117,8 @@ describe(DOCS, () => { const updated = await (updateSpy.mock.results[0] .value as Promise); expect(updated.partition_size).toBe(200); - expect(updated.automod).toBe(current.automod); - expect(updated.max_message_length).toBe(current.max_message_length); + expect(updated.automod).toBe(before.automod); + expect(updated.max_message_length).toBe(before.max_message_length); await waitForChannelTypePropagation(); const type = await waitForChannelType((r) => r.partition_size === 200); @@ -148,13 +142,8 @@ describe(DOCS, () => { // #region snippet docs="chat/_default/05-features/10-advanced/16-dynamic_partitioning.md" heading="Disabling dynamic partitioning" tab="Node.js" index=1 // COPY: channelType="example" - const current = await client.chat.getChannelType({ name: channelType }); - await client.chat.updateChannelType({ name: channelType, - automod: current.automod, - automod_behavior: current.automod_behavior, - max_message_length: current.max_message_length, partition_size: 0, }); // #endregion snippet @@ -188,13 +177,8 @@ describe(DOCS, () => { // #region snippet docs="chat/_default/05-features/10-advanced/16-dynamic_partitioning.md" heading="Partition TTL" tab="Node.js" index=1 // COPY: channelType="example" - const current = await client.chat.getChannelType({ name: channelType }); - await client.chat.updateChannelType({ name: channelType, - automod: current.automod, - automod_behavior: current.automod_behavior, - max_message_length: current.max_message_length, partition_ttl: '24h', }); // #endregion snippet diff --git a/__tests__/docs-snippets/pages/chat/06-app_and_channel_settings/01-channel_types.test.ts b/__tests__/docs-snippets/pages/chat/06-app_and_channel_settings/01-channel_types.test.ts index 9bd9281..673da12 100644 --- a/__tests__/docs-snippets/pages/chat/06-app_and_channel_settings/01-channel_types.test.ts +++ b/__tests__/docs-snippets/pages/chat/06-app_and_channel_settings/01-channel_types.test.ts @@ -94,15 +94,8 @@ describe(DOCS, () => { // #region snippet docs="chat/_default/06-app_and_channel_settings/01-channel_types.md" heading="Restricting guest access" tab="Node.js" index=1 // COPY: agentType="agent" - // automod, automod_behavior and max_message_length are required here, so read - // the current values and carry them through. - const current = await client.chat.getChannelType({ name: agentType }); - await client.chat.updateChannelType({ name: agentType, - automod: current.automod, - automod_behavior: current.automod_behavior, - max_message_length: current.max_message_length, grants: { guest: [], // guests can no longer create agent channels or act as owners }, @@ -146,8 +139,6 @@ describe(DOCS, () => { // Update an existing channel type await client.chat.updateChannelType({ name: myChannelType, - automod: 'disabled', - automod_behavior: 'flag', max_message_length: 1000, reactions: false, }); @@ -214,15 +205,11 @@ describe(DOCS, () => { }); it('edits commands and replies', async () => { + const before = await client.chat.getChannelType({ name: publicType }); // #region snippet docs="chat/_default/06-app_and_channel_settings/01-channel_types.md" heading="Edit a Channel Type" tab="Node.js" index=1 // COPY: publicType="public" - const current = await client.chat.getChannelType({ name: publicType }); - const update = await client.chat.updateChannelType({ name: publicType, - automod: current.automod, - automod_behavior: current.automod_behavior, - max_message_length: current.max_message_length, replies: false, commands: ['all'], }); @@ -233,7 +220,7 @@ describe(DOCS, () => { expect(update.commands).toEqual( expect.arrayContaining(['ban', 'giphy', 'mute', 'unban', 'unmute']), ); - expect(update.max_message_length).toBe(current.max_message_length); + expect(update.max_message_length).toBe(before.max_message_length); await waitForChannelTypePropagation(); const type = await waitForChannelType(publicType, (r) => !r.replies); @@ -245,13 +232,8 @@ describe(DOCS, () => { it('updates feature flags', async () => { // #region snippet docs="chat/_default/06-app_and_channel_settings/01-channel_types.md" heading="Edit a Channel Type" tab="Node.js" index=2 // COPY: publicType="public" - const current = await client.chat.getChannelType({ name: publicType }); - const update = await client.chat.updateChannelType({ name: publicType, - automod: current.automod, - automod_behavior: current.automod_behavior, - max_message_length: current.max_message_length, typing_events: false, read_events: true, connect_events: true, @@ -283,12 +265,8 @@ describe(DOCS, () => { it('updates settings with new values', async () => { // #region snippet docs="chat/_default/06-app_and_channel_settings/01-channel_types.md" heading="Edit a Channel Type" tab="Node.js" index=3 // COPY: publicType="public" - const current = await client.chat.getChannelType({ name: publicType }); - const update = await client.chat.updateChannelType({ name: publicType, - automod: current.automod, - automod_behavior: current.automod_behavior, max_message_length: 140, // the value this example is changing commands: ['giphy', 'ban'], }); diff --git a/__tests__/docs-snippets/pages/chat/06-app_and_channel_settings/03-chat_permission_policies.test.ts b/__tests__/docs-snippets/pages/chat/06-app_and_channel_settings/03-chat_permission_policies.test.ts index 915ad1c..275a65e 100644 --- a/__tests__/docs-snippets/pages/chat/06-app_and_channel_settings/03-chat_permission_policies.test.ts +++ b/__tests__/docs-snippets/pages/chat/06-app_and_channel_settings/03-chat_permission_policies.test.ts @@ -249,9 +249,6 @@ describe(DOCS, () => { // update "channel_member" role grants in "messaging" scope await client.chat.updateChannelType({ name: channelType, - automod: 'disabled', - automod_behavior: 'flag', - max_message_length: 5000, grants: { channel_member: [ 'read-channel', // allow access to the channel @@ -287,13 +284,8 @@ describe(DOCS, () => { // #region snippet docs="chat/_default/06-app_and_channel_settings/03-chat_permission_policies.md" heading="Granting permissions" tab="Node.js" index=3 // COPY: channelType="messaging" - const current = await client.chat.getChannelType({ name: channelType }); - await client.chat.updateChannelType({ name: channelType, - automod: current.automod, - automod_behavior: current.automod_behavior, - max_message_length: current.max_message_length, grants: { guest: [], // removes all grants of "guest" role anonymous: [], // removes all grants of "anonymous" role @@ -320,15 +312,8 @@ describe(DOCS, () => { // #region snippet docs="chat/_default/06-app_and_channel_settings/03-chat_permission_policies.md" heading="Granting permissions" tab="Node.js" index=4 // COPY: channelType="messaging" - // automod, automod_behavior and max_message_length are required here, so read - // the current values and carry them through. - const current = await client.chat.getChannelType({ name: channelType }); - await client.chat.updateChannelType({ name: channelType, - automod: current.automod, - automod_behavior: current.automod_behavior, - max_message_length: current.max_message_length, grants: null, // resets the whole scope to default settings }); // #endregion snippet diff --git a/__tests__/docs-snippets/pages/chat/12-best_practices/02-moderation.test.ts b/__tests__/docs-snippets/pages/chat/12-best_practices/02-moderation.test.ts index 235908f..adf4e4f 100644 --- a/__tests__/docs-snippets/pages/chat/12-best_practices/02-moderation.test.ts +++ b/__tests__/docs-snippets/pages/chat/12-best_practices/02-moderation.test.ts @@ -103,16 +103,9 @@ describe(DOCS, () => { // #region snippet docs="chat/_default/12-best_practices/02-moderation.md" heading="Disabling the permission to post links or add attachments" tab="Node.js" index=1 // COPY: channelType="messaging" - // automod, automod_behavior and max_message_length are required here, so read - // the current values and carry them through. - const current = await client.chat.getChannelType({ name: channelType }); - // Remove link and attachment permissions for channel_member role await client.chat.updateChannelType({ name: channelType, - automod: current.automod, - automod_behavior: current.automod_behavior, - max_message_length: current.max_message_length, grants: { channel_member: [ 'read-channel', @@ -320,16 +313,9 @@ describe(DOCS, () => { // #region snippet docs="chat/_default/12-best_practices/02-moderation.md" heading="Slash commands for banning" tab="Node.js" index=1 // COPY: channelType="messaging" - // automod, automod_behavior and max_message_length are required here, so read - // the current values and carry them through. - const current = await client.chat.getChannelType({ name: channelType }); - // Enable ban/unban commands for a channel type await client.chat.updateChannelType({ name: channelType, - automod: current.automod, - automod_behavior: current.automod_behavior, - max_message_length: current.max_message_length, commands: ['giphy', 'ban', 'unban', 'mute', 'unmute', 'flag'], }); // #endregion snippet diff --git a/__tests__/docs-snippets/pages/chat/12-best_practices/05-marketplace_best_practices.test.ts b/__tests__/docs-snippets/pages/chat/12-best_practices/05-marketplace_best_practices.test.ts index 1a3ad23..3da6016 100644 --- a/__tests__/docs-snippets/pages/chat/12-best_practices/05-marketplace_best_practices.test.ts +++ b/__tests__/docs-snippets/pages/chat/12-best_practices/05-marketplace_best_practices.test.ts @@ -78,16 +78,9 @@ describe(DOCS, () => { // #region snippet docs="chat/_default/12-best_practices/05-marketplace_best_practices.md" heading="Unread Message Reminders" tab="Node.js" index=1 // COPY: channelType="messaging" - // Enable reminders for the messaging channel type. automod, automod_behavior and - // max_message_length are required on this endpoint, so carry the current values - // through to avoid overwriting them. - const current = await client.chat.getChannelType({ name: channelType }); - + // Enable reminders for the messaging channel type await client.chat.updateChannelType({ name: channelType, - automod: current.automod, - automod_behavior: current.automod_behavior, - max_message_length: current.max_message_length, reminders: true, }); @@ -98,7 +91,7 @@ describe(DOCS, () => { await waitForChannelTypePropagation(); const updated = await client.chat.getChannelType({ name: featuresType }); expect(updated.reminders).toBe(true); - expect(updated.max_message_length).toBe(current.max_message_length); + expect(updated.max_message_length).toBe(before.max_message_length); await waitForAppSetting(client, 'reminders_interval', 3600); }); @@ -151,15 +144,8 @@ describe(DOCS, () => { // #region snippet docs="chat/_default/12-best_practices/05-marketplace_best_practices.md" heading="Pending Messages" tab="Node.js" index=1 // COPY: channelType="messaging" - // automod, automod_behavior and max_message_length are required on this endpoint, - // so carry the current values through to avoid overwriting them. - const current = await client.chat.getChannelType({ name: channelType }); - await client.chat.updateChannelType({ name: channelType, - automod: current.automod, - automod_behavior: current.automod_behavior, - max_message_length: current.max_message_length, mark_messages_pending: true, }); // #endregion snippet @@ -185,15 +171,8 @@ describe(DOCS, () => { // #region snippet docs="chat/_default/12-best_practices/05-marketplace_best_practices.md" heading="Recommended Settings" tab="Node.js" index=1 // COPY: channelType="messaging" - // automod, automod_behavior and max_message_length are required on this endpoint, - // so carry the current values through to avoid overwriting them. - const current = await client.chat.getChannelType({ name: channelType }); - await client.chat.updateChannelType({ name: channelType, - automod: current.automod, - automod_behavior: current.automod_behavior, - max_message_length: current.max_message_length, typing_events: true, // Show when users are typing read_events: true, // Track read status for messages reactions: true, // Allow reactions for quick responses diff --git a/__tests__/docs-snippets/pages/moderation/04-configuration/01-policies.test.ts b/__tests__/docs-snippets/pages/moderation/04-configuration/01-policies.test.ts index 72e70de..0bb79df 100644 --- a/__tests__/docs-snippets/pages/moderation/04-configuration/01-policies.test.ts +++ b/__tests__/docs-snippets/pages/moderation/04-configuration/01-policies.test.ts @@ -150,7 +150,7 @@ describe(DOCS, () => { expect(configs.length).toBeGreaterThan(0); expect(configs.length).toBeLessThanOrEqual(10); // Newest first: the config this file just created is among them. - const createdAt = configs.map(({ created_at }) => created_at.getTime()); + const createdAt = configs.map(({ created_at }) => created_at); expect(createdAt).toEqual([...createdAt].sort((a, b) => b - a)); expect(configs.map(({ key }) => key)).toContain(configKey); }); diff --git a/__tests__/docs-snippets/pages/moderation/05-content-moderation/02-flag-mute-ban.test.ts b/__tests__/docs-snippets/pages/moderation/05-content-moderation/02-flag-mute-ban.test.ts index a7c009f..ed75968 100644 --- a/__tests__/docs-snippets/pages/moderation/05-content-moderation/02-flag-mute-ban.test.ts +++ b/__tests__/docs-snippets/pages/moderation/05-content-moderation/02-flag-mute-ban.test.ts @@ -1,4 +1,5 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest'; +import { nsToMs } from '../../../../../index'; import type { StreamClient, UserResponse } from '../../../../../index'; import { getServerClient } from '../../../helpers/clients'; import { Cleanup } from '../../../helpers/cleanup'; @@ -144,9 +145,9 @@ describe(DOCS, () => { const { mutes } = await getServerUser(client, mutingUserId); expect(mutes.map((m) => m.target?.id)).toEqual([mutedUser]); // 60 minutes - expect( - (mutes[0].expires?.getTime() ?? 0) - mutes[0].created_at.getTime(), - ).toBe(60 * 60 * 1000); + expect(nsToMs(mutes[0].expires ?? 0) - nsToMs(mutes[0].created_at)).toBe( + 60 * 60 * 1000, + ); }); it('unmutes a user', async () => { @@ -194,9 +195,9 @@ describe(DOCS, () => { expect(bans[0].banned_by?.id).toBe(moderatorId); expect(bans[0].channel).toBeUndefined(); // 1440 minutes - expect( - (bans[0].expires?.getTime() ?? 0) - bans[0].created_at.getTime(), - ).toBe(1440 * 60 * 1000); + expect(nsToMs(bans[0].expires ?? 0) - nsToMs(bans[0].created_at)).toBe( + 1440 * 60 * 1000, + ); }); it('bans a user from one channel', async () => { @@ -314,7 +315,9 @@ describe(DOCS, () => { await retry( async () => { const user = await getServerUser(client, expiredBanned); - if ((user.ban_expires?.getTime() ?? Infinity) > Date.now()) { + if ( + (user.ban_expires ? nsToMs(user.ban_expires) : Infinity) > Date.now() + ) { throw new Error('ban not expired yet'); } }, diff --git a/__tests__/docs-snippets/pages/moderation/06-review-queue/02-actions.test.ts b/__tests__/docs-snippets/pages/moderation/06-review-queue/02-actions.test.ts index cfc1de7..542e383 100644 --- a/__tests__/docs-snippets/pages/moderation/06-review-queue/02-actions.test.ts +++ b/__tests__/docs-snippets/pages/moderation/06-review-queue/02-actions.test.ts @@ -1,4 +1,5 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest'; +import { nsToMs } from '../../../../../index'; import type { StreamClient } from '../../../../../index'; import { getServerClient } from '../../../helpers/clients'; import { Cleanup } from '../../../helpers/cleanup'; @@ -134,10 +135,9 @@ describe(DOCS, () => { expect(bans[0].channel?.cid).toBe(cid); expect(bans[0].reason).toBe('Repeated harassment'); expect(bans[0].expires).toBeDefined(); - expect( - new Date(bans[0].expires ?? 0).getTime() - - new Date(bans[0].created_at).getTime(), - ).toBe(1440 * 60 * 1000); + expect(nsToMs(bans[0].expires ?? 0) - nsToMs(bans[0].created_at)).toBe( + 1440 * 60 * 1000, + ); const { users } = await client.queryUsers({ payload: { filter_conditions: { id: creatorId } }, }); diff --git a/__tests__/docs-snippets/pages/platform/02-identity-and-access/01-authentication.test.ts b/__tests__/docs-snippets/pages/platform/02-identity-and-access/01-authentication.test.ts index e3f93b0..0e428d2 100644 --- a/__tests__/docs-snippets/pages/platform/02-identity-and-access/01-authentication.test.ts +++ b/__tests__/docs-snippets/pages/platform/02-identity-and-access/01-authentication.test.ts @@ -9,6 +9,7 @@ import { it, vi, } from 'vitest'; +import { nsToMs } from '../../../../../index'; import { getServerClient } from '../../../helpers/clients'; import { Cleanup } from '../../../helpers/cleanup'; import { uniqueId } from '../../../helpers/ids'; @@ -198,8 +199,7 @@ describe(DOCS, () => { // Stored with sub-millisecond rounding: compare to the millisecond. expect( Math.abs( - (user.revoke_tokens_issued_before?.getTime() ?? 0) - - revokeDate.getTime(), + nsToMs(user.revoke_tokens_issued_before ?? 0) - revokeDate.getTime(), ), ).toBeLessThanOrEqual(1); } diff --git a/__tests__/docs-snippets/pages/platform/02-identity-and-access/02-users.test.ts b/__tests__/docs-snippets/pages/platform/02-identity-and-access/02-users.test.ts index 6ac4459..081a352 100644 --- a/__tests__/docs-snippets/pages/platform/02-identity-and-access/02-users.test.ts +++ b/__tests__/docs-snippets/pages/platform/02-identity-and-access/02-users.test.ts @@ -317,7 +317,7 @@ describe(DOCS, () => { expect(response.users.length).toBeGreaterThan(0); expect(response.users.length).toBeLessThanOrEqual(10); expect(response.users.every((u) => u.role === 'admin')).toBe(true); - const created = response.users.map((u) => u.created_at.getTime()); + const created = response.users.map((u) => u.created_at); expect(created).toEqual([...created].sort((a, b) => b - a)); // The newest admin is the one created just now. expect(response.users.map((u) => u.id)).toContain(adminId); @@ -451,7 +451,7 @@ describe(DOCS, () => { (r) => r.value as Promise, ), ); - expect(deactivated.user?.deactivated_at).toBeInstanceOf(Date); + expect(deactivated.user?.deactivated_at).toEqual(expect.any(Number)); // Bulk reactivation is asynchronous too. const [reactivated] = await Promise.all( reactivateUsers.mock.results.map( @@ -462,7 +462,7 @@ describe(DOCS, () => { expect((await findUser(userId))?.deactivated_at).toBeUndefined(); await waitForTask(client, deactivateResponse.task_id); for (const id of [bulkUser1, bulkUser2]) { - expect((await findUser(id))?.deactivated_at).toBeInstanceOf(Date); + expect((await findUser(id))?.deactivated_at).toEqual(expect.any(Number)); } }); @@ -489,7 +489,7 @@ describe(DOCS, () => { const { message: stored } = await client.chat.getMessage({ id: message.id, }); - expect(stored.deleted_at).toBeInstanceOf(Date); + expect(stored.deleted_at).toEqual(expect.any(Number)); }); return result; }); @@ -511,7 +511,7 @@ describe(DOCS, () => { // #endregion snippet expect(deactivate.user).toMatchObject({ id: userID }); - expect(deactivate.user?.deactivated_at).toBeInstanceOf(Date); + expect(deactivate.user?.deactivated_at).toEqual(expect.any(Number)); expect(reactivate.user).toMatchObject({ id: userID, name: 'I am back' }); expect(reactivate.user?.deactivated_at).toBeUndefined(); await retry(async () => { diff --git a/__tests__/docs-snippets/pages/platform/03-events-and-notifications/04-push-devices.test.ts b/__tests__/docs-snippets/pages/platform/03-events-and-notifications/04-push-devices.test.ts index e427bb8..0d8f5b1 100644 --- a/__tests__/docs-snippets/pages/platform/03-events-and-notifications/04-push-devices.test.ts +++ b/__tests__/docs-snippets/pages/platform/03-events-and-notifications/04-push-devices.test.ts @@ -1,5 +1,5 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest'; -import type { DeviceResponse } from '../../../../../index'; +import type { DeviceResponse, TimestampNS } from '../../../../../index'; import { getServerClient } from '../../../helpers/clients'; import { Cleanup } from '../../../helpers/cleanup'; import { uniqueId } from '../../../helpers/ids'; @@ -128,7 +128,7 @@ describe(DOCS, () => { it('device object (Listing from the feeds client SDKs)', () => { // #region snippet docs="platform/03-events-and-notifications/04-push-devices.md" heading="Listing from the feeds client SDKs" tab="Node.js" index=2 type Device = { - created_at: Date; + created_at: TimestampNS; // unix nanoseconds, nsToDate() converts it id: string; push_provider: string; user_id: string; diff --git a/__tests__/docs-snippets/pages/platform/03-events-and-notifications/05-push-preferences.test.ts b/__tests__/docs-snippets/pages/platform/03-events-and-notifications/05-push-preferences.test.ts index 2fa17b8..45e396e 100644 --- a/__tests__/docs-snippets/pages/platform/03-events-and-notifications/05-push-preferences.test.ts +++ b/__tests__/docs-snippets/pages/platform/03-events-and-notifications/05-push-preferences.test.ts @@ -7,6 +7,7 @@ import { it, vi, } from 'vitest'; +import { nsToMs } from '../../../../../index'; import type { UpsertPushPreferencesResponse } from '../../../../../index'; import { getServerClient } from '../../../helpers/clients'; import { Cleanup } from '../../../helpers/cleanup'; @@ -78,15 +79,8 @@ describe(DOCS, () => { // #region snippet docs="platform/03-events-and-notifications/05-push-preferences.md" heading="Channel Configuration Push Level" tab="Node.js" index=1 // COPY: channelType="messaging", channelId="announcements" // Set push_level on a channel type - // automod, automod_behavior and max_message_length are required on this endpoint, - // so carry the current values through to avoid overwriting them. - const current = await client.chat.getChannelType({ name: channelType }); - await client.chat.updateChannelType({ name: channelType, - automod: current.automod, - automod_behavior: current.automod_behavior, - max_message_length: current.max_message_length, push_level: 'all_mentions', }); @@ -106,8 +100,8 @@ describe(DOCS, () => { return response; }); expect(updated.push_level).toBe('all_mentions'); - expect(updated.automod).toBe(current.automod); - expect(updated.max_message_length).toBe(current.max_message_length); + expect(updated.automod).toBe(before.automod); + expect(updated.max_message_length).toBe(before.max_message_length); // The override wins over the type's `all_mentions` in the merged channel config. const { channel: response } = await channel.getOrCreate({}); @@ -298,8 +292,7 @@ describe(DOCS, () => { expect(preferences?.call_level).toBe('all'); expect( Math.abs( - (preferences?.disabled_until?.getTime() ?? 0) - - oneHourFromNow.getTime(), + nsToMs(preferences?.disabled_until ?? 0) - oneHourFromNow.getTime(), ), ).toBeLessThan(1000); }); diff --git a/__tests__/docs-snippets/pages/video/api/01-basics/03-calls.test.ts b/__tests__/docs-snippets/pages/video/api/01-basics/03-calls.test.ts index 608f5d6..d651c6a 100644 --- a/__tests__/docs-snippets/pages/video/api/01-basics/03-calls.test.ts +++ b/__tests__/docs-snippets/pages/video/api/01-basics/03-calls.test.ts @@ -7,6 +7,7 @@ import { it, vi, } from 'vitest'; +import { nsToMs } from '../../../../../../index'; import { OwnCapability } from '../../../../../../index'; import { getServerClient } from '../../../../helpers/clients'; import { Cleanup } from '../../../../helpers/cleanup'; @@ -315,7 +316,7 @@ describe(DOCS, () => { // #endregion snippet const { call: stored } = await call.get(); - expect(stored.ended_at).toBeInstanceOf(Date); + expect(stored.ended_at).toEqual(expect.any(Number)); }); it('queries calls with sorting and pagination', async () => { @@ -403,7 +404,9 @@ describe(DOCS, () => { >); expect(calls.length).toBeGreaterThan(0); for (const { call } of calls) { - expect(call.starts_at?.getTime()).toBeGreaterThan(inNext30mins.getTime()); + expect(nsToMs(call.starts_at ?? 0)).toBeGreaterThan( + inNext30mins.getTime(), + ); } }); diff --git a/__tests__/docs-snippets/pages/video/api/03-streaming/02-backstage.test.ts b/__tests__/docs-snippets/pages/video/api/03-streaming/02-backstage.test.ts index 8141f4a..b46ceba 100644 --- a/__tests__/docs-snippets/pages/video/api/03-streaming/02-backstage.test.ts +++ b/__tests__/docs-snippets/pages/video/api/03-streaming/02-backstage.test.ts @@ -7,6 +7,7 @@ import { it, vi, } from 'vitest'; +import { nsToMs } from '../../../../../../index'; import { OwnCapability } from '../../../../../../index'; import { createCallType } from '../../../../helpers/call-types'; import { getServerClient } from '../../../../helpers/clients'; @@ -69,7 +70,7 @@ describe(DOCS, () => { >); expect(response.created).toBe(true); expect(response.call.backstage).toBe(true); - expect(response.call.starts_at?.getTime()).toBe(startsAt.getTime()); + expect(nsToMs(response.call.starts_at ?? 0)).toBe(startsAt.getTime()); expect(response.call.join_ahead_time_seconds).toBe(300); expect(response.call.settings.backstage).toMatchObject({ enabled: true, diff --git a/__tests__/docs-snippets/pages/video/api/04-quality/03-stats.test.ts b/__tests__/docs-snippets/pages/video/api/04-quality/03-stats.test.ts index d82e5b5..846e237 100644 --- a/__tests__/docs-snippets/pages/video/api/04-quality/03-stats.test.ts +++ b/__tests__/docs-snippets/pages/video/api/04-quality/03-stats.test.ts @@ -21,11 +21,9 @@ describe(DOCS, () => { // #endregion snippet // The status covers the last minute. - expect(response.start_time).toBeInstanceOf(Date); - expect(response.end_time).toBeInstanceOf(Date); - expect( - response.end_time.getTime() - response.start_time.getTime(), - ).toBeGreaterThan(0); + expect(response.start_time).toEqual(expect.any(Number)); + expect(response.end_time).toEqual(expect.any(Number)); + expect(response.end_time - response.start_time).toBeGreaterThan(0); // The test app usually has no running calls, so the numbers can be 0. expect(typeof response.summary?.active_calls).toBe('number'); expect(typeof response.summary?.active_publishers).toBe('number'); diff --git a/__tests__/docs-snippets/pages/video/api/06-moderation/01-overview.test.ts b/__tests__/docs-snippets/pages/video/api/06-moderation/01-overview.test.ts index bf0d832..f58e92a 100644 --- a/__tests__/docs-snippets/pages/video/api/06-moderation/01-overview.test.ts +++ b/__tests__/docs-snippets/pages/video/api/06-moderation/01-overview.test.ts @@ -14,6 +14,7 @@ import type { GetBlockedUsersResponse, ModerationBanResponse, MuteUsersResponse, + TimestampNS, UpdateUserPermissionsResponse, } from '../../../../../../index'; import { getServerClient } from '../../../../helpers/clients'; @@ -217,7 +218,10 @@ describe(DOCS, () => { const originalBan = client.moderation.ban.bind(client.moderation); const ban = vi.spyOn(client.moderation, 'ban'); const unban = vi.spyOn(client.moderation, 'unban'); - const bansAfterEachCall: Array<{ reason?: string; expires?: Date }> = []; + const bansAfterEachCall: Array<{ + reason?: string; + expires?: TimestampNS; + }> = []; ban.mockImplementation(async (request) => { const response = await originalBan(request); const { bans } = await client.queryBannedUsers({ @@ -267,7 +271,7 @@ describe(DOCS, () => { expect(bansAfterEachCall).toHaveLength(3); expect(bansAfterEachCall[0]).toMatchObject({ reason: banReason }); expect(bansAfterEachCall[0].expires).toBeUndefined(); - expect(bansAfterEachCall[1].expires).toBeInstanceOf(Date); + expect(bansAfterEachCall[1].expires).toEqual(expect.any(Number)); const { bans } = await client.queryBannedUsers({ payload: { filter_conditions: { user_id: badUserId } }, }); @@ -318,7 +322,7 @@ describe(DOCS, () => { expect((await findUser(userId))?.deactivated_at).toBeUndefined(); await waitForTask(client, deactivateResponse.task_id); for (const id of [bulkUser1, bulkUser2]) { - expect((await findUser(id))?.deactivated_at).toBeInstanceOf(Date); + expect((await findUser(id))?.deactivated_at).toEqual(expect.any(Number)); } }); diff --git a/__tests__/docs-snippets/sync/parse.ts b/__tests__/docs-snippets/sync/parse.ts index a7d8ed0..0881620 100644 --- a/__tests__/docs-snippets/sync/parse.ts +++ b/__tests__/docs-snippets/sync/parse.ts @@ -99,7 +99,10 @@ const PAGE_PREFIXES = [ * Sidebar pages that are deliberately not validated (page path relative to * `content/docs`, reason). */ -export const EXCLUDED_PAGES: Record = {}; +export const EXCLUDED_PAGES: Record = { + 'activity-feeds/v3-latest/_default/13-importing_data/03_v2_to_v3_code_migration.md': + 'Feeds v2 to v3 porting guide: before/after code in fences titled "Feeds v2" / "Feeds v3", not SDK tabs (a `label` would replace the visible title)', +}; const FEEDS_V2_CLIENT = 'Feeds v2 code for the `getstream` package (a different SDK), not @stream-io/node-sdk'; diff --git a/__tests__/integration/agent.test.ts b/__tests__/integration/agent.test.ts index fe9c859..2a8802e 100644 --- a/__tests__/integration/agent.test.ts +++ b/__tests__/integration/agent.test.ts @@ -67,7 +67,7 @@ describe.skip('AI agent integration', () => { const [, agent] = await createTestStreamAndRealtimeClients(); let errorEvent: any = null; - agent.on('realtime.event', ({ event }) => { + agent.on('realtime.event', ({ event }: { event: any }) => { if (event.type === 'error') { errorEvent = event; } @@ -147,7 +147,7 @@ describe.skip('AI agent integration', () => { required: ['lat', 'lng', 'location'], }, }, - async ({ lat, lng }) => { + async ({ lat, lng }: { lat: number; lng: number }) => { const result = await fetch( `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lng}¤t=temperature_2m,wind_speed_10m`, ); diff --git a/__tests__/integration/date-transform.test.ts b/__tests__/integration/date-transform.test.ts index 0eb59d8..392e587 100644 --- a/__tests__/integration/date-transform.test.ts +++ b/__tests__/integration/date-transform.test.ts @@ -3,8 +3,9 @@ import { randomUUID } from 'crypto'; import { createTestClient } from './create-test-client'; import { StreamClient } from '../../src/StreamClient'; import { UserRequest } from '../../src/gen/models'; +import { nsToDate, nsToMs } from '../../src/utils/time'; -describe('Date conversion', () => { +describe('dates on responses', () => { let client: StreamClient; const user = { id: 'stream-node-test-user', @@ -36,18 +37,18 @@ describe('Date conversion', () => { const createdAt = response.call.created_at; - expect(createdAt instanceof Date).toBe(true); - expect(now - createdAt.getTime()).toBeLessThan(oneMin); + expect(typeof createdAt).toBe('number'); + expect(now - nsToMs(createdAt)).toBeLessThan(oneMin); - expect(response.call.starts_at instanceof Date).toBe(true); - expect(startsAt.getTime()).toEqual(response.call.starts_at?.getTime()); + expect(typeof response.call.starts_at).toBe('number'); + expect(startsAt.getTime()).toEqual(nsToMs(response.call.starts_at!)); expect(response.call.ended_at).toBeNull(); expect(response.members.length).toBeGreaterThan(0); response.members.forEach((m) => { - expect(m.created_at instanceof Date).toBe(true); + expect(typeof m.created_at).toBe('number'); }); const queryResult = await client.video.queryCalls({ @@ -75,28 +76,26 @@ describe('Date conversion', () => { const createdAt = response.channel!.created_at; - expect(createdAt instanceof Date).toBe(true); - expect(now - createdAt.getTime()).toBeLessThan(oneMin); + expect(typeof createdAt).toBe('number'); + expect(now - nsToMs(createdAt)).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); + expect(typeof m.created_at).toBe('number'); }); const queryResult = await client.chat.queryChannels({ filter_conditions: { - created_at: { $lte: createdAt.toISOString() }, + created_at: { $lte: nsToDate(createdAt).toISOString() }, }, limit: 10, }); queryResult.channels.forEach((c) => { - expect(c.channel!.created_at.getTime()).toBeLessThanOrEqual( - createdAt.getTime(), - ); + expect(c.channel!.created_at).toBeLessThanOrEqual(createdAt); }); await channel.delete(); @@ -113,7 +112,7 @@ describe('Date conversion', () => { const response = await client.upsertUsers([newUser]); - expect(response.users[newUser.id].created_at instanceof Date).toBe(true); + expect(typeof response.users[newUser.id].created_at).toBe('number'); expect( typeof response.users[newUser.id].custom.created_at === 'string', diff --git a/__tests__/integration/devices-push.test.ts b/__tests__/integration/devices-push.test.ts index 30aad6f..c665fde 100644 --- a/__tests__/integration/devices-push.test.ts +++ b/__tests__/integration/devices-push.test.ts @@ -2,7 +2,7 @@ import { beforeAll, describe, expect, it } from 'vitest'; import { randomUUID } from 'crypto'; import { createTestClient } from './create-test-client'; import { StreamClient } from '../../src/StreamClient'; -import { CreateDeviceRequest, PushProvider } from '../../src/gen/models'; +import { CreateDeviceRequest, PushProviderRequest } from '../../src/gen/models'; describe('devices and push', () => { let client: StreamClient; @@ -16,7 +16,7 @@ describe('devices and push', () => { push_provider_name: 'firebase', user_id: user.id, }; - const pushProvider: PushProvider = { + const pushProvider: PushProviderRequest = { name: 'test-push-provider', type: 'xiaomi', xiaomi_app_secret: '', diff --git a/__tests__/integration/messages.test.ts b/__tests__/integration/messages.test.ts index e6fa2db..dafa432 100644 --- a/__tests__/integration/messages.test.ts +++ b/__tests__/integration/messages.test.ts @@ -57,7 +57,6 @@ describe('messages API', () => { }); it('thread replies', async () => { - const now = new Date(); const response = await channel.sendMessage({ message: { text: 'Hello from Stream Node SDK', @@ -77,7 +76,6 @@ describe('messages API', () => { const getResponse = await client.chat.getReplies({ parent_id: response.message.id, - created_at_after: now, }); expect( diff --git a/__tests__/integration/rate-limit.test.ts b/__tests__/integration/rate-limit.test.ts index 425a3d7..361e62b 100644 --- a/__tests__/integration/rate-limit.test.ts +++ b/__tests__/integration/rate-limit.test.ts @@ -1,6 +1,7 @@ import { beforeAll, describe, expect, it } from 'vitest'; import { createTestClient } from './create-test-client'; import { StreamClient } from '../../src/StreamClient'; +import { StreamError } from '../../src/types'; describe('rate limit', () => { let client: StreamClient; @@ -61,12 +62,14 @@ describe('rate limit', () => { try { await call.startTranscription(); throw new Error(`Method didn't throw`); - } catch (error) { + } catch (err) { + const error = err as StreamError; + expect(error.code).toBeDefined(); expect(error.metadata).toBeDefined(); expect(error.metadata.responseCode).toBe(404); - const rateLimit = error.metadata.rateLimit; + const rateLimit = error.metadata.rateLimit!; expect(rateLimit.rateLimit).toBeDefined(); } diff --git a/generate-openapi.sh b/generate-openapi.sh index 7f360b1..0fbc4d2 100755 --- a/generate-openapi.sh +++ b/generate-openapi.sh @@ -6,6 +6,6 @@ CHAT_DIR="../chat" rm -rf $OUTPUT_DIR -( cd $CHAT_DIR ; make openapi ; make -C tools/openapi build ; ./build/openapi generate-client --language ts --spec ./releases/v2/serverside-api.yaml --output $OUTPUT_DIR ) +( cd $CHAT_DIR ; make openapi ; make -C tools/openapi build ; ./build/openapi generate-client --language ts --spec ./releases/v2/serverside-api.yaml --opt response_dates_as_number=true --output $OUTPUT_DIR ) yarn lint:gen diff --git a/index.ts b/index.ts index 969e9ca..6242780 100644 --- a/index.ts +++ b/index.ts @@ -11,4 +11,14 @@ export { InvalidWebhookErrorMessages, verifyAndParseWebhook, } from './src/utils/webhook'; +export { + convertTimestampToDate, + dateToNs, + msToNs, + nowNs, + NS_PER_MS, + nsToDate, + nsToMs, + nsToRfc3339, +} from './src/utils/time'; export { StreamError } from './src/types'; diff --git a/src/gen/chat/ChatApi.ts b/src/gen/chat/ChatApi.ts index ea7c71b..3b1fe17 100644 --- a/src/gen/chat/ChatApi.ts +++ b/src/gen/chat/ChatApi.ts @@ -507,6 +507,7 @@ export class ChatApi { }; const body = { hide_for_creator: request?.hide_for_creator, + include_scheduled_messages: request?.include_scheduled_messages, state: request?.state, thread_unread_counts: request?.thread_unread_counts, member_custom_include: request?.member_custom_include, @@ -1063,6 +1064,7 @@ export class ChatApi { }; const body = { hide_for_creator: request?.hide_for_creator, + include_scheduled_messages: request?.include_scheduled_messages, state: request?.state, thread_unread_counts: request?.thread_unread_counts, member_custom_include: request?.member_custom_include, diff --git a/src/gen/model-decoders/decoders.ts b/src/gen/model-decoders/decoders.ts index 7366104..a43d0fb 100644 --- a/src/gen/model-decoders/decoders.ts +++ b/src/gen/model-decoders/decoders.ts @@ -34,6494 +34,25 @@ const decode = (typeMappings: TypeMapping, input?: Record) => { return input; }; -decoders['AcceptFeedMemberInviteResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - member: { type: 'FeedMemberResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['AcceptFollowResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - follow: { type: 'FollowResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ActionLogResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - review_queue_item: { type: 'ReviewQueueItemResponse', isSingle: true }, - - target_user: { type: 'UserResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ActivityAddedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - activity: { type: 'ActivityResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ActivityDeletedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - activity: { type: 'ActivityResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ActivityFeedbackEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ActivityMarkEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ActivityPinResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - activity: { type: 'ActivityResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ActivityPinnedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - pinned_activity: { type: 'PinActivityResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ActivityReactionAddedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - activity: { type: 'ActivityResponse', isSingle: true }, - - reaction: { type: 'FeedsReactionResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ActivityReactionDeletedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - activity: { type: 'ActivityResponse', isSingle: true }, - - reaction: { type: 'FeedsReactionResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ActivityReactionUpdatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - activity: { type: 'ActivityResponse', isSingle: true }, - - reaction: { type: 'FeedsReactionResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ActivityRemovedFromFeedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - activity: { type: 'ActivityResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ActivityResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - comments: { type: 'CommentResponse', isSingle: false }, - - latest_reactions: { type: 'FeedsReactionResponse', isSingle: false }, - - mentioned_users: { type: 'UserResponse', isSingle: false }, - - own_bookmarks: { type: 'BookmarkResponse', isSingle: false }, - - own_reactions: { type: 'FeedsReactionResponse', isSingle: false }, - - collections: { type: 'EnrichedCollectionResponse', isSingle: false }, - - reaction_groups: { type: 'FeedsReactionGroupResponse', isSingle: false }, - - user: { type: 'UserResponse', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - edited_at: { type: 'DatetimeType', isSingle: true }, - - expires_at: { type: 'DatetimeType', isSingle: true }, - - friend_reactions: { type: 'FeedsReactionResponse', isSingle: false }, - - latest_shares: { type: 'ShareResponse', isSingle: false }, - - current_feed: { type: 'FeedResponse', isSingle: true }, - - parent: { type: 'ActivityResponse', isSingle: true }, - - poll: { type: 'PollResponseData', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ActivityRestoredEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - activity: { type: 'ActivityResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ActivitySelectorConfigResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - cutoff_time: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ActivityUnpinnedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - pinned_activity: { type: 'PinActivityResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ActivityUpdatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - activity: { type: 'ActivityResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['AddActivityResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - activity: { type: 'ActivityResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['AddBookmarkResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - bookmark: { type: 'BookmarkResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['AddCommentBookmarkResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - bookmark: { type: 'BookmarkResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['AddCommentReactionResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - comment: { type: 'CommentResponse', isSingle: true }, - - reaction: { type: 'FeedsReactionResponse', isSingle: true }, - - reference_activity: { type: 'ActivityResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['AddCommentResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - comment: { type: 'CommentResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['AddCommentsBatchResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - comments: { type: 'CommentResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['AddReactionResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - activity: { type: 'ActivityResponse', isSingle: true }, - - reaction: { type: 'FeedsReactionResponse', isSingle: true }, - - reference_activity: { type: 'ActivityResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['AddUserGroupMembersResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - user_group: { type: 'UserGroupResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['AggregatedActivityResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - activities: { type: 'ActivityResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - decoders['AppResponseFields'] = (input?: { [key: string]: any }) => { const typeMappings: TypeMapping = { event_hooks: { type: 'EventHook', isSingle: false }, - - call_types: { type: 'CallType', isSingle: false }, - - channel_configs: { type: 'ChannelConfig', isSingle: false }, - - push_notifications: { type: 'PushNotificationFields', isSingle: true }, - - revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true }, }; return decode(typeMappings, input); }; -decoders['AppealAcceptedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - appeal: { type: 'AppealItemResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['AppealCreatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - appeal: { type: 'AppealItemResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['AppealItemResponse'] = (input?: { [key: string]: any }) => { +decoders['EventHook'] = (input?: { [key: string]: any }) => { const typeMappings: TypeMapping = { created_at: { type: 'DatetimeType', isSingle: true }, updated_at: { type: 'DatetimeType', isSingle: true }, - - actions: { type: 'ActionLogResponse', isSingle: false }, - - flags: { type: 'ModerationFlagResponse', isSingle: false }, - - moderation_action: { type: 'ActionLogResponse', isSingle: true }, - - original_moderation_action: { type: 'ActionLogResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['AppealRejectedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - appeal: { type: 'AppealItemResponse', isSingle: true }, }; return decode(typeMappings, input); }; -decoders['AsyncBulkImageModerationEvent'] = (input?: { - [key: string]: any; -}) => { +decoders['GetApplicationResponse'] = (input?: { [key: string]: any }) => { const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - finished_at: { type: 'DatetimeType', isSingle: true }, - - started_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['AsyncExportChannelsEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - finished_at: { type: 'DatetimeType', isSingle: true }, - - started_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['AsyncExportErrorEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - finished_at: { type: 'DatetimeType', isSingle: true }, - - started_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['AsyncExportLabelResultsEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - finished_at: { type: 'DatetimeType', isSingle: true }, - - started_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['AsyncExportModerationLogsEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - finished_at: { type: 'DatetimeType', isSingle: true }, - - started_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['AsyncExportReviewQueueEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - finished_at: { type: 'DatetimeType', isSingle: true }, - - started_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['AsyncExportUsersEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - finished_at: { type: 'DatetimeType', isSingle: true }, - - started_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['AsyncImportErrorEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - finished_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - started_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['AsyncImportSuccessEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - finished_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - started_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['AutomodDetailsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - result: { type: 'MessageModerationResult', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['BanInfoResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - expires: { type: 'DatetimeType', isSingle: true }, - - channel: { type: 'ChannelMetadata', isSingle: true }, - - created_by: { type: 'UserResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['BanResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - expires: { type: 'DatetimeType', isSingle: true }, - - banned_by: { type: 'UserResponse', isSingle: true }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['BatchQueryActivityReactionsResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - reactions: { type: 'FeedsReactionResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['BatchQueryCommentReactionsResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - reactions: { type: 'FeedsReactionResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['BlockListResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['BlockUsersResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['BlockedUserEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - - blocked_by_user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['BlockedUserResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - blocked_user: { type: 'UserResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['BookmarkAddedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - bookmark: { type: 'BookmarkResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['BookmarkDeletedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - bookmark: { type: 'BookmarkResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['BookmarkFolderDeletedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - bookmark_folder: { type: 'BookmarkFolderResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['BookmarkFolderResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['BookmarkFolderUpdatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - bookmark_folder: { type: 'BookmarkFolderResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['BookmarkResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - activity: { type: 'ActivityResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - - comment: { type: 'CommentResponse', isSingle: true }, - - folder: { type: 'BookmarkFolderResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['BookmarkUpdatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - bookmark: { type: 'BookmarkResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['BulkActionAppealsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - results: { type: 'BulkAppealResult', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['BulkAppealResult'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - appeal_item: { type: 'AppealItemResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallAcceptedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - call: { type: 'CallResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallClosedCaptionsFailedEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallClosedCaptionsStartedEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallClosedCaptionsStoppedEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallCreatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - members: { type: 'MemberResponse', isSingle: false }, - - call: { type: 'CallResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallDTMFEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - timestamp: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallDeletedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - call: { type: 'CallResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallEndedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - call: { type: 'CallResponse', isSingle: true }, - - members: { type: 'MemberResponse', isSingle: false }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallFrameRecordingFailedEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - call: { type: 'CallResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallFrameRecordingFrameReadyEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - captured_at: { type: 'DatetimeType', isSingle: true }, - - created_at: { type: 'DatetimeType', isSingle: true }, - - users: { type: 'UserResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['CallFrameRecordingStartedEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - call: { type: 'CallResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallFrameRecordingStoppedEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - call: { type: 'CallResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallHLSBroadcastingFailedEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallHLSBroadcastingStartedEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - call: { type: 'CallResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallHLSBroadcastingStoppedEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallLiveStartedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - call: { type: 'CallResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallMemberAddedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - members: { type: 'MemberResponse', isSingle: false }, - - call: { type: 'CallResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallMemberRemovedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - call: { type: 'CallResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallMemberUpdatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - members: { type: 'MemberResponse', isSingle: false }, - - call: { type: 'CallResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallMemberUpdatedPermissionEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - members: { type: 'MemberResponse', isSingle: false }, - - call: { type: 'CallResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallMissedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - members: { type: 'MemberResponse', isSingle: false }, - - call: { type: 'CallResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallModerationBlurEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallModerationWarningEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallNotificationEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - members: { type: 'MemberResponse', isSingle: false }, - - call: { type: 'CallResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallParticipantResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - joined_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallParticipantTimeline'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - timestamp: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallReactionEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallRecording'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - end_time: { type: 'DatetimeType', isSingle: true }, - - start_time: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallRecordingFailedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallRecordingReadyEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - call_recording: { type: 'CallRecording', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallRecordingStartedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallRecordingStoppedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallRejectedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - call: { type: 'CallResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallReportResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - ended_at: { type: 'DatetimeType', isSingle: true }, - - started_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - created_by: { type: 'UserResponse', isSingle: true }, - - egress: { type: 'EgressResponse', isSingle: true }, - - ended_at: { type: 'DatetimeType', isSingle: true }, - - starts_at: { type: 'DatetimeType', isSingle: true }, - - session: { type: 'CallSessionResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallRingEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - members: { type: 'MemberResponse', isSingle: false }, - - call: { type: 'CallResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallRingSettledEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - rang_at: { type: 'DatetimeType', isSingle: true }, - - settled_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallRtmpBroadcastFailedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallRtmpBroadcastStartedEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallRtmpBroadcastStoppedEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallSessionEndedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - call: { type: 'CallResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallSessionParticipantCountsUpdatedEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallSessionParticipantJoinedEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - participant: { type: 'CallParticipantResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallSessionParticipantLeftEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - participant: { type: 'CallParticipantResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallSessionResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - participants: { type: 'CallParticipantResponse', isSingle: false }, - - accepted_by: { type: 'DatetimeType', isSingle: false }, - - missed_by: { type: 'DatetimeType', isSingle: false }, - - rejected_by: { type: 'DatetimeType', isSingle: false }, - - ended_at: { type: 'DatetimeType', isSingle: true }, - - live_ended_at: { type: 'DatetimeType', isSingle: true }, - - live_started_at: { type: 'DatetimeType', isSingle: true }, - - started_at: { type: 'DatetimeType', isSingle: true }, - - timer_ends_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallSessionStartedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - call: { type: 'CallResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallStateResponseFields'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - members: { type: 'MemberResponse', isSingle: false }, - - call: { type: 'CallResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallStatsParticipant'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - sessions: { type: 'CallStatsParticipantSession', isSingle: false }, - - latest_activity_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallStatsParticipantSession'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - ended_at: { type: 'DatetimeType', isSingle: true }, - - started_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallStatsReportReadyEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - participants_overview: { type: 'CallStatsParticipant', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['CallStatsReportSummaryResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - first_stats_time: { type: 'DatetimeType', isSingle: true }, - - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallStatsSessionResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - generated_at: { type: 'DatetimeType', isSingle: true }, - - call_ended_at: { type: 'DatetimeType', isSingle: true }, - - call_started_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallTranscription'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - end_time: { type: 'DatetimeType', isSingle: true }, - - start_time: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallTranscriptionFailedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallTranscriptionReadyEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - call_transcription: { type: 'CallTranscription', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallTranscriptionStartedEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallTranscriptionStoppedEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallType'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallTypeResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallUpdatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - call: { type: 'CallResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallUserFeedbackSubmittedEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CallUserMutedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CampaignCompletedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - campaign: { type: 'CampaignResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CampaignResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - segments: { type: 'Segment', isSingle: false }, - - users: { type: 'UserResponse', isSingle: false }, - - stats: { type: 'CampaignStatsResponse', isSingle: true }, - - scheduled_for: { type: 'DatetimeType', isSingle: true }, - - stop_at: { type: 'DatetimeType', isSingle: true }, - - sender: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CampaignStartedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - campaign: { type: 'CampaignResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CampaignStatsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - stats_completed_at: { type: 'DatetimeType', isSingle: true }, - - stats_started_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChangeFeedVisibilityResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - feed: { type: 'FeedResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelBanResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - channel_ban: { type: 'ChannelBanScopeResponse', isSingle: true }, - - future_channel_ban: { type: 'ChannelBanScopeResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelBanScopeResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - expires: { type: 'DatetimeType', isSingle: true }, - - banned_by: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelBatchCompletedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - batch_created_at: { type: 'DatetimeType', isSingle: true }, - - created_at: { type: 'DatetimeType', isSingle: true }, - - finished_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelBatchStartedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - batch_created_at: { type: 'DatetimeType', isSingle: true }, - - created_at: { type: 'DatetimeType', isSingle: true }, - - finished_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelConfig'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelConfigWithInfo'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - commands: { type: 'Command', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelContextResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_by: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelCreatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelDeletedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelFrozenEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelHiddenEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelMemberResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - archived_at: { type: 'DatetimeType', isSingle: true }, - - ban_expires: { type: 'DatetimeType', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - future_channel_ban_expires: { type: 'DatetimeType', isSingle: true }, - - invite_accepted_at: { type: 'DatetimeType', isSingle: true }, - - invite_rejected_at: { type: 'DatetimeType', isSingle: true }, - - pinned_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelMetadata'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - last_message_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelMute'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - expires: { type: 'DatetimeType', isSingle: true }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelMutedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - mutes: { type: 'ChannelMute', isSingle: false }, - - mute: { type: 'ChannelMute', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelPushPreferencesResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - disabled_until: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - hide_messages_before: { type: 'DatetimeType', isSingle: true }, - - last_message_at: { type: 'DatetimeType', isSingle: true }, - - mute_expires_at: { type: 'DatetimeType', isSingle: true }, - - truncated_at: { type: 'DatetimeType', isSingle: true }, - - members: { type: 'ChannelMemberResponse', isSingle: false }, - - config: { type: 'ChannelConfigWithInfo', isSingle: true }, - - created_by: { type: 'UserResponse', isSingle: true }, - - truncated_by: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelStateResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - members: { type: 'ChannelMemberResponse', isSingle: false }, - - messages: { type: 'MessageResponse', isSingle: false }, - - pinned_messages: { type: 'MessageResponse', isSingle: false }, - - threads: { type: 'ThreadStateResponse', isSingle: false }, - - hide_messages_before: { type: 'DatetimeType', isSingle: true }, - - active_live_locations: { - type: 'SharedLocationResponseData', - isSingle: false, - }, - - pending_messages: { type: 'PendingMessageResponse', isSingle: false }, - - read: { type: 'ReadStateResponse', isSingle: false }, - - scheduled_messages: { type: 'ScheduledMessageResponse', isSingle: false }, - - watchers: { type: 'UserResponse', isSingle: false }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - draft: { type: 'DraftResponse', isSingle: true }, - - membership: { type: 'ChannelMemberResponse', isSingle: true }, - - push_preferences: { - type: 'ChannelPushPreferencesResponse', - isSingle: true, - }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelStateResponseFields'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - members: { type: 'ChannelMemberResponse', isSingle: false }, - - messages: { type: 'MessageResponse', isSingle: false }, - - pinned_messages: { type: 'MessageResponse', isSingle: false }, - - threads: { type: 'ThreadStateResponse', isSingle: false }, - - hide_messages_before: { type: 'DatetimeType', isSingle: true }, - - active_live_locations: { - type: 'SharedLocationResponseData', - isSingle: false, - }, - - pending_messages: { type: 'PendingMessageResponse', isSingle: false }, - - read: { type: 'ReadStateResponse', isSingle: false }, - - scheduled_messages: { type: 'ScheduledMessageResponse', isSingle: false }, - - watchers: { type: 'UserResponse', isSingle: false }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - draft: { type: 'DraftResponse', isSingle: true }, - - membership: { type: 'ChannelMemberResponse', isSingle: true }, - - push_preferences: { - type: 'ChannelPushPreferencesResponse', - isSingle: true, - }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelTruncatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - message: { type: 'MessageResponse', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelTypeConfig'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - commands: { type: 'Command', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelUnFrozenEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelUnmutedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - mutes: { type: 'ChannelMute', isSingle: false }, - - mute: { type: 'ChannelMute', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelUpdatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - message: { type: 'MessageResponse', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChannelVisibleEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChatActivityStatsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - messages: { type: 'MessageStatsResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChatDraftPayloadResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - mentioned_users: { type: 'UserResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['ChatDraftResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - message: { type: 'ChatDraftPayloadResponse', isSingle: true }, - - parent_message: { type: 'ChatMessageResponse', isSingle: true }, - - quoted_message: { type: 'ChatMessageResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChatMessageResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - latest_reactions: { type: 'ChatReactionResponse', isSingle: false }, - - mentioned_users: { type: 'UserResponse', isSingle: false }, - - own_reactions: { type: 'ChatReactionResponse', isSingle: false }, - - user: { type: 'UserResponse', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - message_text_updated_at: { type: 'DatetimeType', isSingle: true }, - - pin_expires: { type: 'DatetimeType', isSingle: true }, - - pinned_at: { type: 'DatetimeType', isSingle: true }, - - mentioned_groups: { type: 'UserGroupResponse', isSingle: false }, - - thread_participants: { type: 'UserResponse', isSingle: false }, - - draft: { type: 'ChatDraftResponse', isSingle: true }, - - pinned_by: { type: 'UserResponse', isSingle: true }, - - poll: { type: 'PollResponseData', isSingle: true }, - - quoted_message: { type: 'ChatMessageResponse', isSingle: true }, - - reaction_groups: { type: 'ChatReactionGroupResponse', isSingle: false }, - - reminder: { type: 'ChatReminderResponseData', isSingle: true }, - - shared_location: { type: 'ChatSharedLocationResponseData', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChatReactionGroupResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - first_reaction_at: { type: 'DatetimeType', isSingle: true }, - - last_reaction_at: { type: 'DatetimeType', isSingle: true }, - - latest_reactions_by: { - type: 'ChatReactionGroupUserResponse', - isSingle: false, - }, - }; - return decode(typeMappings, input); -}; - -decoders['ChatReactionGroupUserResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChatReactionResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChatReminderResponseData'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - remind_at: { type: 'DatetimeType', isSingle: true }, - - message: { type: 'ChatMessageResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ChatSharedLocationResponseData'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - end_at: { type: 'DatetimeType', isSingle: true }, - - message: { type: 'ChatMessageResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CheckResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - item: { type: 'ReviewQueueItemResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ClosedCaptionEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CollectionResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['Command'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CommentAddedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - activity: { type: 'ActivityResponse', isSingle: true }, - - comment: { type: 'CommentResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CommentDeletedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - comment: { type: 'CommentResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CommentFeedbackEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CommentReactionAddedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - activity: { type: 'ActivityResponse', isSingle: true }, - - comment: { type: 'CommentResponse', isSingle: true }, - - reaction: { type: 'FeedsReactionResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CommentReactionDeletedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - comment: { type: 'CommentResponse', isSingle: true }, - - reaction: { type: 'FeedsReactionResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CommentReactionUpdatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - activity: { type: 'ActivityResponse', isSingle: true }, - - comment: { type: 'CommentResponse', isSingle: true }, - - reaction: { type: 'FeedsReactionResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CommentResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - mentioned_users: { type: 'UserResponse', isSingle: false }, - - own_reactions: { type: 'FeedsReactionResponse', isSingle: false }, - - user: { type: 'UserResponse', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - edited_at: { type: 'DatetimeType', isSingle: true }, - - latest_reactions: { type: 'FeedsReactionResponse', isSingle: false }, - - reaction_groups: { type: 'FeedsReactionGroupResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['CommentRestoredEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - comment: { type: 'CommentResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CommentUpdatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - comment: { type: 'CommentResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ConfigResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CountByMinuteResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - start_ts: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CreateBlockListResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - blocklist: { type: 'BlockListResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CreateCallTypeResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CreateCampaignResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - campaign: { type: 'CampaignResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CreateChannelTypeResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CreateCollectionsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - collections: { type: 'CollectionResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['CreateCommandResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - command: { type: 'Command', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CreateFeedGroupResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - feed_group: { type: 'FeedGroupResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CreateFeedViewResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - feed_view: { type: 'FeedViewResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CreateFeedsBatchResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - feeds: { type: 'FeedResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['CreateGuestResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CreateImportResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - import_task: { type: 'ImportTask', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CreateImportV2TaskResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CreateMembershipLevelResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - membership_level: { type: 'MembershipLevelResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CreatePredefinedFilterResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - predefined_filter: { type: 'PredefinedFilterResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CreateReminderResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - reminder: { type: 'ReminderResponseData', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CreateRoleResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - role: { type: 'Role', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CreateSIPTrunkResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - sip_trunk: { type: 'SIPTrunkResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CreateSegmentResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - segment: { type: 'SegmentResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CreateUserGroupResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - user_group: { type: 'UserGroupResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CustomCheckResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - item: { type: 'ReviewQueueItemResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CustomEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['CustomVideoEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['DeactivateUserResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['DeleteActivityReactionResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - activity: { type: 'ActivityResponse', isSingle: true }, - - reaction: { type: 'FeedsReactionResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['DeleteBookmarkResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - bookmark: { type: 'BookmarkResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['DeleteCallResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - call: { type: 'CallResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['DeleteChannelResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - channel: { type: 'ChannelResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['DeleteCommentBookmarkResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - bookmark: { type: 'BookmarkResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['DeleteCommentReactionResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - comment: { type: 'CommentResponse', isSingle: true }, - - reaction: { type: 'FeedsReactionResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['DeleteCommentResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - activity: { type: 'ActivityResponse', isSingle: true }, - - comment: { type: 'CommentResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['DeleteMessageResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - message: { type: 'MessageResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['DeleteReactionResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - message: { type: 'MessageResponse', isSingle: true }, - - reaction: { type: 'ReactionResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['DeleteScheduledMessageResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - scheduled_message: { type: 'ScheduledMessageResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['DeviceResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['DraftPayloadResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - mentioned_users: { type: 'UserResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['DraftResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - message: { type: 'DraftPayloadResponse', isSingle: true }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - parent_message: { type: 'MessageResponse', isSingle: true }, - - quoted_message: { type: 'MessageResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['EgressRTMPResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - started_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['EgressResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - rtmps: { type: 'EgressRTMPResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['EnrichedCollectionResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['EntityCreatorResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - ban_expires: { type: 'DatetimeType', isSingle: true }, - - deactivated_at: { type: 'DatetimeType', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - last_active: { type: 'DatetimeType', isSingle: true }, - - revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true }, - - devices: { type: 'DeviceResponse', isSingle: false }, - - push_notifications: { - type: 'PushNotificationSettingsResponse', - isSingle: true, - }, - }; - return decode(typeMappings, input); -}; - -decoders['EventHook'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['EventResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - event: { type: 'WSEvent', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ExportUserResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - messages: { type: 'MessageResponse', isSingle: false }, - - reactions: { type: 'ReactionResponse', isSingle: false }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FeedCreatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - members: { type: 'FeedMemberResponse', isSingle: false }, - - feed: { type: 'FeedResponse', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FeedDeletedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FeedGroupChangedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FeedGroupDeletedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FeedGroupResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - activity_selectors: { - type: 'ActivitySelectorConfigResponse', - isSingle: false, - }, - }; - return decode(typeMappings, input); -}; - -decoders['FeedGroupRestoredEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FeedMemberAddedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - member: { type: 'FeedMemberResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FeedMemberRemovedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FeedMemberResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - - invite_accepted_at: { type: 'DatetimeType', isSingle: true }, - - invite_rejected_at: { type: 'DatetimeType', isSingle: true }, - - membership_level: { type: 'MembershipLevelResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FeedMemberUpdatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - member: { type: 'FeedMemberResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FeedOwnData'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - own_followings: { type: 'FollowResponse', isSingle: false }, - - own_follows: { type: 'FollowResponse', isSingle: false }, - - own_membership: { type: 'FeedMemberResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FeedResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - created_by: { type: 'UserResponse', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - own_followings: { type: 'FollowResponse', isSingle: false }, - - own_follows: { type: 'FollowResponse', isSingle: false }, - - own_membership: { type: 'FeedMemberResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FeedSuggestionResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - created_by: { type: 'UserResponse', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - own_followings: { type: 'FollowResponse', isSingle: false }, - - own_follows: { type: 'FollowResponse', isSingle: false }, - - own_membership: { type: 'FeedMemberResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FeedUpdatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - feed: { type: 'FeedResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FeedViewResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - last_used_at: { type: 'DatetimeType', isSingle: true }, - - activity_selectors: { - type: 'ActivitySelectorConfigResponse', - isSingle: false, - }, - }; - return decode(typeMappings, input); -}; - -decoders['FeedsBookmarkResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FeedsEnrichedCollectionResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FeedsFeedResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - created_by: { type: 'UserResponse', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FeedsReactionGroupResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - first_reaction_at: { type: 'DatetimeType', isSingle: true }, - - last_reaction_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FeedsReactionResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FeedsRetentionPolicy'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - enabled_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FeedsShareResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FeedsV3ActivityResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - comments: { type: 'FeedsV3CommentResponse', isSingle: false }, - - latest_reactions: { type: 'FeedsReactionResponse', isSingle: false }, - - mentioned_users: { type: 'UserResponse', isSingle: false }, - - own_bookmarks: { type: 'FeedsBookmarkResponse', isSingle: false }, - - own_reactions: { type: 'FeedsReactionResponse', isSingle: false }, - - collections: { type: 'FeedsEnrichedCollectionResponse', isSingle: false }, - - reaction_groups: { type: 'FeedsReactionGroupResponse', isSingle: false }, - - user: { type: 'UserResponse', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - edited_at: { type: 'DatetimeType', isSingle: true }, - - expires_at: { type: 'DatetimeType', isSingle: true }, - - friend_reactions: { type: 'FeedsReactionResponse', isSingle: false }, - - latest_shares: { type: 'FeedsShareResponse', isSingle: false }, - - current_feed: { type: 'FeedsFeedResponse', isSingle: true }, - - parent: { type: 'FeedsV3ActivityResponse', isSingle: true }, - - poll: { type: 'PollResponseData', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FeedsV3CommentResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - mentioned_users: { type: 'UserResponse', isSingle: false }, - - own_reactions: { type: 'FeedsReactionResponse', isSingle: false }, - - user: { type: 'UserResponse', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - edited_at: { type: 'DatetimeType', isSingle: true }, - - latest_reactions: { type: 'FeedsReactionResponse', isSingle: false }, - - reaction_groups: { type: 'FeedsReactionGroupResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['FlagDetailsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - automod: { type: 'AutomodDetailsResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FlagFeedbackResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FlagUpdatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - created_by: { type: 'UserResponse', isSingle: true }, - - message: { type: 'MessageResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FollowBatchResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created: { type: 'FollowResponse', isSingle: false }, - - follows: { type: 'FollowResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['FollowCreatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - follow: { type: 'FollowResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FollowDeletedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - follow: { type: 'FollowResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FollowResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - source_feed: { type: 'FeedResponse', isSingle: true }, - - target_feed: { type: 'FeedResponse', isSingle: true }, - - request_accepted_at: { type: 'DatetimeType', isSingle: true }, - - request_rejected_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FollowUpdatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - follow: { type: 'FollowResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FullUserResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - channel_mutes: { type: 'ChannelMute', isSingle: false }, - - devices: { type: 'DeviceResponse', isSingle: false }, - - mutes: { type: 'UserMuteResponse', isSingle: false }, - - ban_expires: { type: 'DatetimeType', isSingle: true }, - - deactivated_at: { type: 'DatetimeType', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - last_active: { type: 'DatetimeType', isSingle: true }, - - revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['FutureChannelBanResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - expires: { type: 'DatetimeType', isSingle: true }, - - banned_by: { type: 'UserResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetActiveCallsStatusResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - end_time: { type: 'DatetimeType', isSingle: true }, - - start_time: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetActivityResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - activity: { type: 'ActivityResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetAppealResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - item: { type: 'AppealItemResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetApplicationResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - app: { type: 'AppResponseFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetBlockListResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - blocklist: { type: 'BlockListResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetBlockedUsersResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - blocks: { type: 'BlockedUserResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['GetCallParticipantSessionMetricsResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - joined_at: { type: 'DatetimeType', isSingle: true }, - - published_tracks: { type: 'PublishedTrackMetrics', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['GetCallReportResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - report: { type: 'ReportResponse', isSingle: true }, - - video_reactions: { type: 'VideoReactionsResponse', isSingle: false }, - - chat_activity: { type: 'ChatActivityStatsResponse', isSingle: true }, - - session: { type: 'CallSessionResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetCallResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - members: { type: 'MemberResponse', isSingle: false }, - - call: { type: 'CallResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetCallSessionParticipantStatsDetailsResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - timeframe: { type: 'ParticipantSeriesTimeframe', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetCallTypeResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetCampaignResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - campaign: { type: 'CampaignResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetChannelTypeResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - commands: { type: 'Command', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['GetCommandResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetCommentRepliesResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - comments: { type: 'ThreadedCommentResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['GetCommentResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - comment: { type: 'CommentResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetCommentsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - comments: { type: 'ThreadedCommentResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['GetConfigResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - config: { type: 'ConfigResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetDraftResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - draft: { type: 'DraftResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetExternalStorageResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetFeedGroupResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - feed_group: { type: 'FeedGroupResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetFeedViewResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - feed_view: { type: 'FeedViewResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetFeedsRetentionPolicyResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - policies: { type: 'FeedsRetentionPolicy', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['GetFollowSuggestionsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - suggestions: { type: 'FeedSuggestionResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['GetImportResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - import_task: { type: 'ImportTask', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetImportV2TaskResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetManyMessagesResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - messages: { type: 'MessageResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['GetMessageResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - message: { type: 'MessageWithChannelResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetModerationRuleResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - rule: { type: 'ModerationRuleV2Response', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetOrCreateCallResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - members: { type: 'MemberResponse', isSingle: false }, - - call: { type: 'CallResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetOrCreateFeedGroupResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - feed_group: { type: 'FeedGroupResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetOrCreateFeedResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - activities: { type: 'ActivityResponse', isSingle: false }, - - aggregated_activities: { - type: 'AggregatedActivityResponse', - isSingle: false, - }, - - followers: { type: 'FollowResponse', isSingle: false }, - - following: { type: 'FollowResponse', isSingle: false }, - - members: { type: 'FeedMemberResponse', isSingle: false }, - - pinned_activities: { type: 'ActivityPinResponse', isSingle: false }, - - feed: { type: 'FeedResponse', isSingle: true }, - - notification_status: { type: 'NotificationStatusResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetOrCreateFeedViewResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - feed_view: { type: 'FeedViewResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetOrCreateFollowResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - follow: { type: 'FollowResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetOrCreateUnfollowResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - follow: { type: 'FollowResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetPinnedMessagesResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - messages: { type: 'MessageResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['GetPredefinedFilterResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - predefined_filter: { type: 'PredefinedFilterResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetPushTemplatesResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - templates: { type: 'PushTemplateResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['GetReactionsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - reactions: { type: 'ReactionResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['GetRepliesResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - messages: { type: 'MessageResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['GetRetentionPolicyResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - policies: { type: 'RetentionPolicy', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['GetReviewQueueItemResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - item: { type: 'ReviewQueueItemResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetSegmentResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - segment: { type: 'SegmentResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetSetupSessionResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - setup_session: { type: 'SetupSession', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetTaskResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetThreadResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - thread: { type: 'ThreadStateResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GetUserGroupResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - user_group: { type: 'UserGroupResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GoLiveResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - call: { type: 'CallResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['GroupedChannelsBucket'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - channels: { type: 'ChannelStateResponseFields', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['GroupedQueryChannelsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - groups: { type: 'GroupedChannelsBucket', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['ImportTask'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - history: { type: 'ImportTaskHistory', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['ImportTaskHistory'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ImportV2TaskItem'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['IngressErrorEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['IngressStartedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['IngressStoppedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['KickedUserEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - - kicked_by_user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['LabelResultResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ListBlockListResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - blocklists: { type: 'BlockListResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['ListCallTypeResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - call_types: { type: 'CallTypeResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['ListChannelTypesResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - channel_types: { type: 'ChannelTypeConfig', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['ListCommandsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - commands: { type: 'Command', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['ListDevicesResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - devices: { type: 'DeviceResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['ListFeedGroupsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - groups: { type: 'FeedGroupResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['ListFeedViewsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - views: { type: 'FeedViewResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['ListImportV2TasksResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - import_tasks: { type: 'ImportV2TaskItem', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['ListImportsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - import_tasks: { type: 'ImportTask', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['ListPushProvidersResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - push_providers: { type: 'PushProviderResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['ListQueuesResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - queues: { type: 'ModerationQueueResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['ListRecordingsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - recordings: { type: 'CallRecording', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['ListRolesResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - roles: { type: 'Role', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['ListSIPInboundRoutingRuleResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - sip_inbound_routing_rules: { - type: 'SIPInboundRoutingRuleResponse', - isSingle: false, - }, - }; - return decode(typeMappings, input); -}; - -decoders['ListSIPTrunksResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - sip_trunks: { type: 'SIPTrunkResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['ListTranscriptionsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - transcriptions: { type: 'CallTranscription', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['ListUserGroupsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - user_groups: { type: 'UserGroupResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['MarkReadResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - event: { type: 'MarkReadResponseEvent', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['MarkReadResponseEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - channel_last_message_at: { type: 'DatetimeType', isSingle: true }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - thread: { type: 'ThreadResponse', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['MaxStreakChangedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['MemberAddedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - member: { type: 'ChannelMemberResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['MemberRemovedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - member: { type: 'ChannelMemberResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['MemberResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['MemberUpdatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - member: { type: 'ChannelMemberResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['MembersResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - members: { type: 'ChannelMemberResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['MembershipLevelResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['MessageActionResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - message: { type: 'MessageResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['MessageDeletedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - message: { type: 'MessageResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['MessageFlagResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - approved_at: { type: 'DatetimeType', isSingle: true }, - - rejected_at: { type: 'DatetimeType', isSingle: true }, - - reviewed_at: { type: 'DatetimeType', isSingle: true }, - - details: { type: 'FlagDetailsResponse', isSingle: true }, - - message: { type: 'MessageResponse', isSingle: true }, - - moderation_feedback: { type: 'FlagFeedbackResponse', isSingle: true }, - - moderation_result: { type: 'MessageModerationResult', isSingle: true }, - - reviewed_by: { type: 'UserResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['MessageFlaggedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - message: { type: 'MessageResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - details: { type: 'MessageModerationResult', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['MessageHistoryEntryResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - message_updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['MessageModerationResult'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['MessageNewEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - message: { type: 'MessageResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - thread_participants: { type: 'UserResponseCommonFields', isSingle: false }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['MessageReadEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - thread: { type: 'ThreadResponse', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['MessageResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - latest_reactions: { type: 'ReactionResponse', isSingle: false }, - - mentioned_users: { type: 'UserResponse', isSingle: false }, - - own_reactions: { type: 'ReactionResponse', isSingle: false }, - - user: { type: 'UserResponse', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - message_text_updated_at: { type: 'DatetimeType', isSingle: true }, - - pin_expires: { type: 'DatetimeType', isSingle: true }, - - pinned_at: { type: 'DatetimeType', isSingle: true }, - - mentioned_groups: { type: 'UserGroupResponse', isSingle: false }, - - thread_participants: { type: 'UserResponse', isSingle: false }, - - draft: { type: 'DraftResponse', isSingle: true }, - - pinned_by: { type: 'UserResponse', isSingle: true }, - - poll: { type: 'PollResponseData', isSingle: true }, - - quoted_message: { type: 'MessageResponse', isSingle: true }, - - reaction_groups: { type: 'ReactionGroupResponse', isSingle: false }, - - reminder: { type: 'ReminderResponseData', isSingle: true }, - - shared_location: { type: 'SharedLocationResponseData', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['MessageStatsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - count_over_time: { type: 'CountByMinuteResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['MessageUnblockedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - message: { type: 'MessageResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['MessageUndeletedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - message: { type: 'MessageResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['MessageUpdatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - message: { type: 'MessageResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['MessageWithChannelResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - latest_reactions: { type: 'ReactionResponse', isSingle: false }, - - mentioned_users: { type: 'UserResponse', isSingle: false }, - - own_reactions: { type: 'ReactionResponse', isSingle: false }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - message_text_updated_at: { type: 'DatetimeType', isSingle: true }, - - pin_expires: { type: 'DatetimeType', isSingle: true }, - - pinned_at: { type: 'DatetimeType', isSingle: true }, - - mentioned_groups: { type: 'UserGroupResponse', isSingle: false }, - - thread_participants: { type: 'UserResponse', isSingle: false }, - - draft: { type: 'DraftResponse', isSingle: true }, - - pinned_by: { type: 'UserResponse', isSingle: true }, - - poll: { type: 'PollResponseData', isSingle: true }, - - quoted_message: { type: 'MessageResponse', isSingle: true }, - - reaction_groups: { type: 'ReactionGroupResponse', isSingle: false }, - - reminder: { type: 'ReminderResponseData', isSingle: true }, - - shared_location: { type: 'SharedLocationResponseData', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ModerationAnalysisFailedEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ModerationCallResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - ended_at: { type: 'DatetimeType', isSingle: true }, - - starts_at: { type: 'DatetimeType', isSingle: true }, - - created_by: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ModerationCheckCompletedEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ModerationCustomActionEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - review_queue_item: { type: 'ReviewQueueItemResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - message: { type: 'MessageResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ModerationFlagResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - content_published_at: { type: 'DatetimeType', isSingle: true }, - - review_queue_item: { type: 'ReviewQueueItemResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ModerationFlaggedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ModerationImageAnalysisCompleteEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ModerationMarkReviewedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - item: { type: 'ReviewQueueItemResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - message: { type: 'MessageResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ModerationQueueResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ModerationRuleV2Response'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ModerationRulesTriggeredEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ModerationTextAnalysisCompleteEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['MuteChannelResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - channel_mutes: { type: 'ChannelMute', isSingle: false }, - - channel_mute: { type: 'ChannelMute', isSingle: true }, - - own_user: { type: 'OwnUserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['MuteResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - mutes: { type: 'UserMuteResponse', isSingle: false }, - - own_user: { type: 'OwnUserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['NotificationFeedUpdatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - aggregated_activities: { - type: 'AggregatedActivityResponse', - isSingle: false, - }, - - notification_status: { type: 'NotificationStatusResponse', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['NotificationMarkUnreadEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - last_read_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['NotificationStatusResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - last_read_at: { type: 'DatetimeType', isSingle: true }, - - last_seen_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['NotificationThreadMessageNewEvent'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - message: { type: 'MessageResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - thread_participants: { type: 'UserResponseCommonFields', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['OwnBatchResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - data: { type: 'FeedOwnData', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['OwnUserResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - channel_mutes: { type: 'ChannelMute', isSingle: false }, - - devices: { type: 'DeviceResponse', isSingle: false }, - - mutes: { type: 'UserMuteResponse', isSingle: false }, - - deactivated_at: { type: 'DatetimeType', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - last_active: { type: 'DatetimeType', isSingle: true }, - - revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true }, - - push_preferences: { type: 'PushPreferencesResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ParticipantCountByMinuteResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - start_ts: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ParticipantCountOverTimeResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - by_minute: { type: 'ParticipantCountByMinuteResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['ParticipantReportResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - count_over_time: { - type: 'ParticipantCountOverTimeResponse', - isSingle: true, - }, - }; - return decode(typeMappings, input); -}; - -decoders['ParticipantSeriesTimeframe'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - since: { type: 'DatetimeType', isSingle: true }, - - until: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ParticipantSessionDetails'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - joined_at: { type: 'DatetimeType', isSingle: true }, - - left_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PendingMessageEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - message: { type: 'MessageResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PendingMessageResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - channel: { type: 'ChannelResponse', isSingle: true }, - - message: { type: 'MessageResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PerformanceAnalysisResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - last_analyzed: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PermissionRequestEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PinActivityResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - activity: { type: 'ActivityResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PolicyTestResult'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PolicyTestRun'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - completed_at: { type: 'DatetimeType', isSingle: true }, - - config_updated_at: { type: 'DatetimeType', isSingle: true }, - - started_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PolicyTestRunResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - results: { type: 'PolicyTestResult', isSingle: false }, - - run: { type: 'PolicyTestRun', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PolicyTestSet'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - last_run: { type: 'PolicyTestRun', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PolicyTestSetListResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - sets: { type: 'PolicyTestSet', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['PolicyTestSetResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - recent_runs: { type: 'PolicyTestRun', isSingle: false }, - - set: { type: 'PolicyTestSet', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PollClosedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - poll: { type: 'PollResponseData', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PollDeletedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - poll: { type: 'PollResponseData', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PollResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - poll: { type: 'PollResponseData', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PollResponseData'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - latest_answers: { type: 'PollVoteResponseData', isSingle: false }, - - own_votes: { type: 'PollVoteResponseData', isSingle: false }, - - created_by: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PollUpdatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - poll: { type: 'PollResponseData', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PollVoteCastedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - poll: { type: 'PollResponseData', isSingle: true }, - - poll_vote: { type: 'PollVoteResponseData', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PollVoteChangedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - poll: { type: 'PollResponseData', isSingle: true }, - - poll_vote: { type: 'PollVoteResponseData', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PollVoteRemovedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - poll: { type: 'PollResponseData', isSingle: true }, - - poll_vote: { type: 'PollVoteResponseData', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PollVoteResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - poll: { type: 'PollResponseData', isSingle: true }, - - vote: { type: 'PollVoteResponseData', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PollVoteResponseData'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PollVotesResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - votes: { type: 'PollVoteResponseData', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['PredefinedFilterResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - performance: { type: 'PerformanceAnalysisResponse', isSingle: true }, - - stats: { type: 'PredefinedFilterStatsResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PredefinedFilterStatsResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - last_seen: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PublishedTrackMetrics'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - warnings: { type: 'SessionWarningResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['PushNotificationFields'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - providers: { type: 'PushProvider', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['PushNotificationSettingsResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - disabled_until: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PushPreferencesResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - disabled_until: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PushProvider'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - disabled_at: { type: 'DatetimeType', isSingle: true }, - - push_templates: { type: 'PushTemplate', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['PushProviderResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - disabled_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PushTemplate'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['PushTemplateResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryActivitiesResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - activities: { type: 'ActivityResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryActivityReactionsResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - reactions: { type: 'FeedsReactionResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryActivitySharesResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - shares: { type: 'ShareResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryAppealsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - items: { type: 'AppealItemResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryBannedUsersResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - bans: { type: 'BanResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryBookmarkFoldersResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - bookmark_folders: { type: 'BookmarkFolderResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryBookmarksResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - bookmarks: { type: 'BookmarkResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryCallMembersResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - members: { type: 'MemberResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryCallParticipantSessionsResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - participants_sessions: { - type: 'ParticipantSessionDetails', - isSingle: false, - }, - - session: { type: 'CallSessionResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryCallParticipantsResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - members: { type: 'MemberResponse', isSingle: false }, - - participants: { type: 'CallParticipantResponse', isSingle: false }, - - call: { type: 'CallResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryCallRingAttemptsResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - ring_attempts: { type: 'RingAttemptResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryCallSessionParticipantStatsResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - participants: { type: 'CallStatsParticipant', isSingle: false }, - - call_ended_at: { type: 'DatetimeType', isSingle: true }, - - call_started_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryCallSessionParticipantStatsTimelineResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - events: { type: 'CallParticipantTimeline', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryCallSessionStatsResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - call_stats: { type: 'CallStatsSessionResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryCallStatsMapResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - call_ended_at: { type: 'DatetimeType', isSingle: true }, - - call_started_at: { type: 'DatetimeType', isSingle: true }, - - end_time: { type: 'DatetimeType', isSingle: true }, - - generated_at: { type: 'DatetimeType', isSingle: true }, - - start_time: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryCallStatsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - reports: { type: 'CallStatsReportSummaryResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryCallsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - calls: { type: 'CallStateResponseFields', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryCampaignsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - campaigns: { type: 'CampaignResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryChannelBansResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - bans: { type: 'ChannelBanResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryChannelsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - channels: { type: 'ChannelStateResponseFields', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryCollectionsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - collections: { type: 'CollectionResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryCommentReactionsResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - reactions: { type: 'FeedsReactionResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryCommentsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - comments: { type: 'CommentResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryDraftsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - drafts: { type: 'DraftResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryFeedMembersResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - members: { type: 'FeedMemberResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryFeedModerationTemplate'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryFeedModerationTemplatesResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - templates: { type: 'QueryFeedModerationTemplate', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryFeedsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - feeds: { type: 'FeedResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryFollowsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - follows: { type: 'FollowResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryFutureChannelBansResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - bans: { type: 'FutureChannelBanResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryLabelResultsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - label_results: { type: 'LabelResultResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryMembershipLevelsResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - membership_levels: { type: 'MembershipLevelResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryMessageFlagsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - flags: { type: 'MessageFlagResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryMessageHistoryResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - message_history: { type: 'MessageHistoryEntryResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryModerationConfigsResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - configs: { type: 'ConfigResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryModerationFlagsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - flags: { type: 'ModerationFlagResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryModerationLogsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - logs: { type: 'ActionLogResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryModerationRulesResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - rules: { type: 'ModerationRuleV2Response', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryPinnedActivitiesResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - pinned_activities: { type: 'ActivityPinResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryPollsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - polls: { type: 'PollResponseData', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryPredefinedFiltersResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - predefined_filters: { type: 'PredefinedFilterResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryReactionsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - reactions: { type: 'ReactionResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryRemindersResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - reminders: { type: 'ReminderResponseData', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryReviewQueueResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - items: { type: 'ReviewQueueItemResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryRevisionHistoryResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - revisions: { type: 'RevisionHistoryResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryScheduledMessagesResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - scheduled_messages: { type: 'ScheduledMessageResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QuerySegmentTargetsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - targets: { type: 'SegmentTargetResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QuerySegmentsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - segments: { type: 'SegmentResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryThreadsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - threads: { type: 'ThreadStateResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueryUsersResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - users: { type: 'FullUserResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['QueueResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - queue: { type: 'ModerationQueueResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['Reaction'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ReactionDeletedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - thread_participants: { type: 'UserResponseCommonFields', isSingle: false }, - - message: { type: 'MessageResponse', isSingle: true }, - - reaction: { type: 'ReactionResponse', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ReactionGroupResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - first_reaction_at: { type: 'DatetimeType', isSingle: true }, - - last_reaction_at: { type: 'DatetimeType', isSingle: true }, - - latest_reactions_by: { type: 'ReactionGroupUserResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['ReactionGroupUserResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ReactionNewEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - thread_participants: { type: 'UserResponseCommonFields', isSingle: false }, - - message: { type: 'MessageResponse', isSingle: true }, - - reaction: { type: 'ReactionResponse', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ReactionResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ReactionUpdatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - message: { type: 'MessageResponse', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - reaction: { type: 'ReactionResponse', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ReactivateUserResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ReadCollectionsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - collections: { type: 'CollectionResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['ReadStateResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - last_read: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - - last_delivered_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['RejectFeedMemberInviteResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - member: { type: 'FeedMemberResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['RejectFollowResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - follow: { type: 'FollowResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ReminderCreatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - reminder: { type: 'ReminderResponseData', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ReminderDeletedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - reminder: { type: 'ReminderResponseData', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ReminderNotificationEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - reminder: { type: 'ReminderResponseData', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ReminderResponseData'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - expires_at: { type: 'DatetimeType', isSingle: true }, - - remind_at: { type: 'DatetimeType', isSingle: true }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - message: { type: 'MessageResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ReminderUpdatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - reminder: { type: 'ReminderResponseData', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['RemoveUserGroupMembersResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - user_group: { type: 'UserGroupResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ReportResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - call: { type: 'CallReportResponse', isSingle: true }, - - participants: { type: 'ParticipantReportResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ResolveSipInboundResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - sip_routing_rule: { type: 'SIPInboundRoutingRuleResponse', isSingle: true }, - - sip_trunk: { type: 'SIPTrunkResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['RestoreActivityResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - activity: { type: 'ActivityResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['RestoreCommentResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - activity: { type: 'ActivityResponse', isSingle: true }, - - comment: { type: 'CommentResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['RestoreFeedGroupResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - feed_group: { type: 'FeedGroupResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['RetentionPolicy'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - enabled_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ReviewQueueItemNewEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - flags: { type: 'ModerationFlagResponse', isSingle: false }, - - action: { type: 'ActionLogResponse', isSingle: true }, - - review_queue_item: { type: 'ReviewQueueItemResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ReviewQueueItemResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - actions: { type: 'ActionLogResponse', isSingle: false }, - - bans: { type: 'BanInfoResponse', isSingle: false }, - - flags: { type: 'ModerationFlagResponse', isSingle: false }, - - completed_at: { type: 'DatetimeType', isSingle: true }, - - escalated_at: { type: 'DatetimeType', isSingle: true }, - - reviewed_at: { type: 'DatetimeType', isSingle: true }, - - appeal: { type: 'AppealItemResponse', isSingle: true }, - - assigned_to: { type: 'UserResponse', isSingle: true }, - - call: { type: 'ModerationCallResponse', isSingle: true }, - - entity_creator: { type: 'EntityCreatorResponse', isSingle: true }, - - feeds_v2_reaction: { type: 'Reaction', isSingle: true }, - - feeds_v3_activity: { type: 'FeedsV3ActivityResponse', isSingle: true }, - - feeds_v3_comment: { type: 'FeedsV3CommentResponse', isSingle: true }, - - message: { type: 'ChatMessageResponse', isSingle: true }, - - poll: { type: 'PollResponseData', isSingle: true }, - - reaction: { type: 'Reaction', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ReviewQueueItemUpdatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - flags: { type: 'ModerationFlagResponse', isSingle: false }, - - action: { type: 'ActionLogResponse', isSingle: true }, - - review_queue_item: { type: 'ReviewQueueItemResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['RevisionHistoryResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['RingAttemptResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - expires_at: { type: 'DatetimeType', isSingle: true }, - - targets: { type: 'RingTargetResponse', isSingle: false }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - settled_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['RingDeliveryResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - sent_at: { type: 'DatetimeType', isSingle: true }, - - acked_at: { type: 'DatetimeType', isSingle: true }, - - displayed_at: { type: 'DatetimeType', isSingle: true }, - - fetched_at: { type: 'DatetimeType', isSingle: true }, - - provider_accepted_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['RingTargetResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - state_at: { type: 'DatetimeType', isSingle: true }, - - deliveries: { type: 'RingDeliveryResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['Role'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['SIPInboundRoutingRuleResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['SIPTrunkResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ScheduledMessageContentResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - pin_expires: { type: 'DatetimeType', isSingle: true }, - - shared_location: { type: 'ScheduledMessageLocation', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ScheduledMessageFailedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - scheduled_message: { type: 'ScheduledMessageResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ScheduledMessageLocation'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - end_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ScheduledMessageResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - scheduled_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - message: { type: 'ScheduledMessageContentResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ScheduledMessageSentEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - scheduled_message: { type: 'ScheduledMessageResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['SearchResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - results: { type: 'SearchResult', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['SearchResult'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - message: { type: 'SearchResultMessage', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['SearchResultMessage'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - latest_reactions: { type: 'ReactionResponse', isSingle: false }, - - mentioned_users: { type: 'UserResponse', isSingle: false }, - - own_reactions: { type: 'ReactionResponse', isSingle: false }, - - user: { type: 'UserResponse', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - message_text_updated_at: { type: 'DatetimeType', isSingle: true }, - - pin_expires: { type: 'DatetimeType', isSingle: true }, - - pinned_at: { type: 'DatetimeType', isSingle: true }, - - mentioned_groups: { type: 'UserGroupResponse', isSingle: false }, - - thread_participants: { type: 'UserResponse', isSingle: false }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - draft: { type: 'DraftResponse', isSingle: true }, - - pinned_by: { type: 'UserResponse', isSingle: true }, - - poll: { type: 'PollResponseData', isSingle: true }, - - quoted_message: { type: 'MessageResponse', isSingle: true }, - - reaction_groups: { type: 'ReactionGroupResponse', isSingle: false }, - - reminder: { type: 'ReminderResponseData', isSingle: true }, - - shared_location: { type: 'SharedLocationResponseData', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['SearchRolesResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - roles: { type: 'Role', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['SearchUserGroupsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - user_groups: { type: 'UserGroupResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['Segment'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['SegmentResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['SegmentTargetResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['SendMessageResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - message: { type: 'MessageResponse', isSingle: true }, - - channel_context: { type: 'ChannelContextResponse', isSingle: true }, - - scheduled_message: { type: 'ScheduledMessageResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['SendReactionResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - message: { type: 'MessageResponse', isSingle: true }, - - reaction: { type: 'ReactionResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['SendScheduledMessageNowResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - scheduled_message: { type: 'ScheduledMessageResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['SessionWarningResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - time: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['SetFeedsRetentionPolicyResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - policy: { type: 'FeedsRetentionPolicy', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['SetRetentionPolicyResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - policy: { type: 'RetentionPolicy', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['SetupSession'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - completed_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ShareResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['SharedLocationResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - end_at: { type: 'DatetimeType', isSingle: true }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - message: { type: 'MessageResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['SharedLocationResponseData'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - end_at: { type: 'DatetimeType', isSingle: true }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - message: { type: 'MessageResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['SharedLocationsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - active_live_locations: { - type: 'SharedLocationResponseData', - isSingle: false, - }, - }; - return decode(typeMappings, input); -}; - -decoders['SingleFollowResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - follow: { type: 'FollowResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['StartCampaignResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - campaign: { type: 'CampaignResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['StopCampaignResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - campaign: { type: 'CampaignResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['StopLiveResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - call: { type: 'CallResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['StoriesFeedUpdatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - activities: { type: 'ActivityResponse', isSingle: false }, - - aggregated_activities: { - type: 'AggregatedActivityResponse', - isSingle: false, - }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['SubmitActionResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - appeal_item: { type: 'AppealItemResponse', isSingle: true }, - - item: { type: 'ReviewQueueItemResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ThreadParticipant'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - last_read_at: { type: 'DatetimeType', isSingle: true }, - - last_thread_message_at: { type: 'DatetimeType', isSingle: true }, - - left_thread_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ThreadResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - last_message_at: { type: 'DatetimeType', isSingle: true }, - - thread_participants: { type: 'ThreadParticipant', isSingle: false }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - created_by: { type: 'UserResponse', isSingle: true }, - - parent_message: { type: 'MessageResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ThreadStateResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - latest_replies: { type: 'MessageResponse', isSingle: false }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - last_message_at: { type: 'DatetimeType', isSingle: true }, - - read: { type: 'ReadStateResponse', isSingle: false }, - - thread_participants: { type: 'ThreadParticipant', isSingle: false }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - created_by: { type: 'UserResponse', isSingle: true }, - - draft: { type: 'DraftResponse', isSingle: true }, - - parent_message: { type: 'MessageResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ThreadUpdatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - thread: { type: 'ThreadResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['ThreadedCommentResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - mentioned_users: { type: 'UserResponse', isSingle: false }, - - own_reactions: { type: 'FeedsReactionResponse', isSingle: false }, - - user: { type: 'UserResponse', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - edited_at: { type: 'DatetimeType', isSingle: true }, - - latest_reactions: { type: 'FeedsReactionResponse', isSingle: false }, - - replies: { type: 'ThreadedCommentResponse', isSingle: false }, - - reaction_groups: { type: 'FeedsReactionGroupResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['TranslateActivityResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - activity: { type: 'ActivityResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['TranslateCommentResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - comment: { type: 'CommentResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['TranslateMessageResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - message: { type: 'MessageResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['TruncateChannelResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - channel: { type: 'ChannelResponse', isSingle: true }, - - message: { type: 'MessageResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UnblockedUserEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UndeleteMessageResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - message: { type: 'MessageResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UnfollowBatchResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - follows: { type: 'FollowResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['UnfollowResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - follow: { type: 'FollowResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UnpinActivityResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - activity: { type: 'ActivityResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UnreadCountsBatchResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - counts_by_user: { type: 'UnreadCountsResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['UnreadCountsChannel'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - last_read: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UnreadCountsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - channels: { type: 'UnreadCountsChannel', isSingle: false }, - - threads: { type: 'UnreadCountsThread', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['UnreadCountsThread'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - last_read: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateActivitiesPartialBatchResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - activities: { type: 'ActivityResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateActivityPartialResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - activity: { type: 'ActivityResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateActivityResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - activity: { type: 'ActivityResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateBlockListResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - blocklist: { type: 'BlockListResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateBookmarkFolderResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - bookmark_folder: { type: 'BookmarkFolderResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateBookmarkResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - bookmark: { type: 'BookmarkResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateCallMembersResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - members: { type: 'MemberResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateCallResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - members: { type: 'MemberResponse', isSingle: false }, - - call: { type: 'CallResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateCallTypeResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateCampaignResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - campaign: { type: 'CampaignResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateChannelPartialResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - members: { type: 'ChannelMemberResponse', isSingle: false }, - - channel: { type: 'ChannelResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateChannelResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - members: { type: 'ChannelMemberResponse', isSingle: false }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - message: { type: 'MessageResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateChannelTypeResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateCollectionsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - collections: { type: 'CollectionResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateCommandResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - command: { type: 'Command', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateCommentBookmarkResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - bookmark: { type: 'BookmarkResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateCommentPartialResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - comment: { type: 'CommentResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateCommentResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - comment: { type: 'CommentResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateFeedGroupResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - feed_group: { type: 'FeedGroupResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateFeedMembersResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - added: { type: 'FeedMemberResponse', isSingle: false }, - - updated: { type: 'FeedMemberResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateFeedResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - feed: { type: 'FeedResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateFeedViewResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - feed_view: { type: 'FeedViewResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateFollowResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - follow: { type: 'FollowResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateMemberPartialResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - channel_member: { type: 'ChannelMemberResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateMembershipLevelResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - membership_level: { type: 'MembershipLevelResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateMessagePartialResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - message: { type: 'MessageResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateMessageResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - message: { type: 'MessageResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdatePredefinedFilterResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - predefined_filter: { type: 'PredefinedFilterResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateReminderResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - reminder: { type: 'ReminderResponseData', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateSIPInboundRoutingRuleResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - sip_inbound_routing_rule: { - type: 'SIPInboundRoutingRuleResponse', - isSingle: true, - }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateSIPTrunkResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - sip_trunk: { type: 'SIPTrunkResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateScheduledMessageResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - scheduled_message: { type: 'ScheduledMessageResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateSegmentResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - segment: { type: 'SegmentResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateThreadPartialResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - thread: { type: 'ThreadResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateUserGroupResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - user_group: { type: 'UserGroupResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdateUsersResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - users: { type: 'FullUserResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['UpdatedCallPermissionsEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpsertActivitiesResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - activities: { type: 'ActivityResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['UpsertCollectionsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - collections: { type: 'CollectionResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['UpsertConfigResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - config: { type: 'ConfigResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpsertModerationRuleResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - rule: { type: 'ModerationRuleV2Response', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpsertModerationTemplateResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpsertPushPreferencesResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - user_preferences: { type: 'PushPreferencesResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['UpsertPushProviderResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - push_provider: { type: 'PushProviderResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpsertPushTemplateResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - template: { type: 'PushTemplateResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UpsertSetupSessionResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - setup_session: { type: 'SetupSession', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UserBannedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - - expiration: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - created_by: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UserDeactivatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - created_by: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UserDeletedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UserFlaggedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - target_user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UserGroupCreatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UserGroupDeletedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UserGroupMember'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UserGroupMemberAddedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UserGroupMemberRemovedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UserGroupResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - members: { type: 'UserGroupMember', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['UserGroupUpdatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UserMessagesDeletedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UserMuteResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - expires: { type: 'DatetimeType', isSingle: true }, - - target: { type: 'UserResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UserMutedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - target_users: { type: 'UserResponseCommonFields', isSingle: false }, - - target_user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UserReactivatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - created_by: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UserResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - ban_expires: { type: 'DatetimeType', isSingle: true }, - - deactivated_at: { type: 'DatetimeType', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - last_active: { type: 'DatetimeType', isSingle: true }, - - revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true }, - - devices: { type: 'DeviceResponse', isSingle: false }, - - push_notifications: { - type: 'PushNotificationSettingsResponse', - isSingle: true, - }, - }; - return decode(typeMappings, input); -}; - -decoders['UserResponseCommonFields'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - updated_at: { type: 'DatetimeType', isSingle: true }, - - deactivated_at: { type: 'DatetimeType', isSingle: true }, - - deleted_at: { type: 'DatetimeType', isSingle: true }, - - last_active: { type: 'DatetimeType', isSingle: true }, - - revoke_tokens_issued_before: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UserUnbannedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - created_by: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UserUnmutedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - - target_users: { type: 'UserResponseCommonFields', isSingle: false }, - - target_user: { type: 'UserResponseCommonFields', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UserUnreadReminderEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - user: { type: 'UserResponseCommonFields', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['UserUpdatedEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - received_at: { type: 'DatetimeType', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['VideoReactionOverTimeResponse'] = (input?: { - [key: string]: any; -}) => { - const typeMappings: TypeMapping = { - by_minute: { type: 'CountByMinuteResponse', isSingle: false }, - }; - return decode(typeMappings, input); -}; - -decoders['VideoReactionsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - count_over_time: { type: 'VideoReactionOverTimeResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['WSEvent'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - created_at: { type: 'DatetimeType', isSingle: true }, - - channel_last_message_at: { type: 'DatetimeType', isSingle: true }, - - channel: { type: 'ChannelResponse', isSingle: true }, - - created_by: { type: 'UserResponse', isSingle: true }, - - me: { type: 'OwnUserResponse', isSingle: true }, - - member: { type: 'ChannelMemberResponse', isSingle: true }, - - message: { type: 'MessageResponse', isSingle: true }, - - poll: { type: 'PollResponseData', isSingle: true }, - - poll_vote: { type: 'PollVoteResponseData', isSingle: true }, - - reaction: { type: 'ReactionResponse', isSingle: true }, - - thread: { type: 'ThreadResponse', isSingle: true }, - - user: { type: 'UserResponse', isSingle: true }, - }; - return decode(typeMappings, input); -}; - -decoders['WrappedUnreadCountsResponse'] = (input?: { [key: string]: any }) => { - const typeMappings: TypeMapping = { - channels: { type: 'UnreadCountsChannel', isSingle: false }, - - threads: { type: 'UnreadCountsThread', isSingle: false }, + app: { type: 'AppResponseFields', isSingle: true }, }; return decode(typeMappings, input); }; diff --git a/src/gen/models/index.ts b/src/gen/models/index.ts index 16ddc68..3b6b025 100644 --- a/src/gen/models/index.ts +++ b/src/gen/models/index.ts @@ -1,3 +1,29 @@ +declare const timestampNsBrand: unique symbol; + +/** + * A unix-nanosecond timestamp, exactly as the server sends it. + * + * NOT milliseconds. `new Date(t)` is out of range and yields an Invalid Date, whose + * `.toISOString()` then throws; `models/timestamp-guard.ts` turns that into a + * compile error. Comparing or sorting two timestamps is fine -- same unit, plain + * numbers. Everything else should go through this SDK's time helpers: + * + * nsToDate(t) a Date + * convertTimestampToDate(t) a Date, or undefined when the value is absent or NaN + * nsToMs(t) epoch ms, for arithmetic against Date.now() + * nsToRfc3339(t) an RFC3339 string keeping sub-millisecond precision + * dateToNs(d), msToNs(ms) back to a wire timestamp + * nowNs() the local clock, wire-comparable + * asTimestampNS(n) brand a number already in ns (DB rows, fixtures) -- no conversion + * + * A request date field is typed `Date`, not this -- pass `nsToDate(t)` when handing a + * server-sent timestamp back to the API, or `nsToRfc3339(t)` where precision matters. + * + * Values above `Number.MAX_SAFE_INTEGER` are quantised to ~256ns, so ordering holds + * but exact equality after a JSON round-trip does not. + */ +export type TimestampNS = number & { readonly [timestampNsBrand]: true }; + export interface AIAudioConfigRequest { /** * Bodyguard credentials profile to classify transcripts with. Applies to the NLP engine only; ignored when LLM configurability is enabled. Empty falls back to the app-pinned profile, then the organization's top-level credentials @@ -209,7 +235,7 @@ export interface ActionLogResponse { /** * Timestamp when the action was taken */ - created_at: Date; + created_at: TimestampNS; /** * Unique identifier of the action log */ @@ -299,7 +325,7 @@ export interface ActivityAddedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; activity: ActivityResponse; custom: Record; @@ -308,7 +334,7 @@ export interface ActivityAddedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -316,7 +342,7 @@ export interface ActivityDeletedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; activity: ActivityResponse; custom: Record; @@ -325,7 +351,7 @@ export interface ActivityDeletedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -333,14 +359,14 @@ export interface ActivityFeedbackEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; activity_feedback: ActivityFeedbackEventPayload; custom: Record; /** * The type of event: "feeds.activity.feedback" in this case */ type: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -356,11 +382,11 @@ export interface ActivityFeedbackEventPayload { /** * When the feedback was created */ - created_at: Date; + created_at: TimestampNS; /** * When the feedback was last updated */ - updated_at: Date; + updated_at: TimestampNS; /** * The feedback value (true/false) */ @@ -410,7 +436,7 @@ export interface ActivityMarkEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; custom: Record; /** @@ -426,7 +452,7 @@ export interface ActivityMarkEvent { * Whether all activities were marked as seen */ mark_all_seen?: boolean; - received_at?: Date; + received_at?: TimestampNS; /** * The IDs of activities marked as read */ @@ -457,7 +483,7 @@ export interface ActivityPinResponse { /** * When the pin was created */ - created_at: Date; + created_at: TimestampNS; /** * ID of the feed where activity is pinned */ @@ -465,7 +491,7 @@ export interface ActivityPinResponse { /** * When the pin was last updated */ - updated_at: Date; + updated_at: TimestampNS; activity: ActivityResponse; /** * User response object @@ -477,7 +503,7 @@ export interface ActivityPinnedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * The ID of the feed */ @@ -489,7 +515,7 @@ export interface ActivityPinnedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -527,7 +553,7 @@ export interface ActivityReactionAddedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; activity: ActivityResponse; custom: Record; @@ -537,7 +563,7 @@ export interface ActivityReactionAddedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -545,7 +571,7 @@ export interface ActivityReactionDeletedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; activity: ActivityResponse; custom: Record; @@ -555,7 +581,7 @@ export interface ActivityReactionDeletedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -563,7 +589,7 @@ export interface ActivityReactionUpdatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; activity: ActivityResponse; custom: Record; @@ -573,7 +599,7 @@ export interface ActivityReactionUpdatedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -581,7 +607,7 @@ export interface ActivityRemovedFromFeedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; activity: ActivityResponse; custom: Record; @@ -590,7 +616,7 @@ export interface ActivityRemovedFromFeedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -703,7 +729,7 @@ export interface ActivityResponse { /** * When the activity was created */ - created_at: Date; + created_at: TimestampNS; /** * If this activity is hidden by this user (using activity feedback) */ @@ -743,7 +769,7 @@ export interface ActivityResponse { /** * When the activity was last updated */ - updated_at: Date; + updated_at: TimestampNS; /** * Visibility setting for the activity. One of: public, private, tag */ @@ -807,15 +833,15 @@ export interface ActivityResponse { /** * When the activity was deleted */ - deleted_at?: Date; + deleted_at?: TimestampNS; /** * When the activity was last edited */ - edited_at?: Date; + edited_at?: TimestampNS; /** * When the activity will expire */ - expires_at?: Date; + expires_at?: TimestampNS; /** * Total count of reactions from friends on this activity */ @@ -872,7 +898,7 @@ export interface ActivityRestoredEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; activity: ActivityResponse; custom: Record; @@ -881,7 +907,7 @@ export interface ActivityRestoredEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -944,7 +970,7 @@ export interface ActivitySelectorConfigResponse { /** * Time threshold for activity selection (timestamp) */ - cutoff_time?: Date; + cutoff_time?: TimestampNS; /** * Flexible relative time window for activity selection (e.g., '1h', '3d', '1y') */ @@ -980,7 +1006,7 @@ export interface ActivityUnpinnedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * The ID of the feed */ @@ -992,7 +1018,7 @@ export interface ActivityUnpinnedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -1000,7 +1026,7 @@ export interface ActivityUpdatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; activity: ActivityResponse; custom: Record; @@ -1009,7 +1035,7 @@ export interface ActivityUpdatedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -1439,7 +1465,7 @@ export interface AggregatedActivityResponse { /** * When the aggregation was created */ - created_at: Date; + created_at: TimestampNS; /** * Grouping identifier */ @@ -1451,7 +1477,7 @@ export interface AggregatedActivityResponse { /** * When the aggregation was last updated */ - updated_at: Date; + updated_at: TimestampNS; /** * Number of unique users in this aggregation */ @@ -1702,7 +1728,7 @@ export interface AppResponseFields { chat_primary_use_case?: string; moderation_onboarding_complete?: boolean; moderation_s3_image_access_role_arn?: string; - revoke_tokens_issued_before?: Date; + revoke_tokens_issued_before?: TimestampNS; video_primary_use_case?: string; allowed_flag_reasons?: Array; geofences?: Array; @@ -1713,18 +1739,18 @@ export interface AppResponseFields { } export interface AppealAcceptedEvent { - created_at: Date; + created_at: TimestampNS; custom: Record; type: string; - received_at?: Date; + received_at?: TimestampNS; appeal?: AppealItemResponse; } export interface AppealCreatedEvent { - created_at: Date; + created_at: TimestampNS; custom: Record; type: string; - received_at?: Date; + received_at?: TimestampNS; appeal?: AppealItemResponse; } @@ -1736,7 +1762,7 @@ export interface AppealItemResponse { /** * When the flag was created */ - created_at: Date; + created_at: TimestampNS; /** * ID of the entity */ @@ -1753,7 +1779,7 @@ export interface AppealItemResponse { /** * When the flag was last updated */ - updated_at: Date; + updated_at: TimestampNS; /** * Text severity level assigned by the AI provider */ @@ -1820,10 +1846,10 @@ export interface AppealItemResponse { } export interface AppealRejectedEvent { - created_at: Date; + created_at: TimestampNS; custom: Record; type: string; - received_at?: Date; + received_at?: TimestampNS; appeal?: AppealItemResponse; } @@ -1868,106 +1894,106 @@ export interface AppealResponse { } export interface AsyncBulkImageModerationEvent { - created_at: Date; - finished_at: Date; - started_at: Date; + created_at: TimestampNS; + finished_at: TimestampNS; + started_at: TimestampNS; task_id: string; url: string; custom: Record; type: string; - received_at?: Date; + received_at?: TimestampNS; } export interface AsyncExportChannelsEvent { - created_at: Date; - finished_at: Date; - started_at: Date; + created_at: TimestampNS; + finished_at: TimestampNS; + started_at: TimestampNS; task_id: string; url: string; custom: Record; type: string; - received_at?: Date; + received_at?: TimestampNS; } export interface AsyncExportErrorEvent { - created_at: Date; + created_at: TimestampNS; error: string; - finished_at: Date; - started_at: Date; + finished_at: TimestampNS; + started_at: TimestampNS; task_id: string; custom: Record; type: string; - received_at?: Date; + received_at?: TimestampNS; } export interface AsyncExportLabelResultsEvent { - created_at: Date; - finished_at: Date; - started_at: Date; + created_at: TimestampNS; + finished_at: TimestampNS; + started_at: TimestampNS; task_id: string; url: string; custom: Record; type: string; - received_at?: Date; + received_at?: TimestampNS; } export interface AsyncExportModerationLogsEvent { - created_at: Date; - finished_at: Date; - started_at: Date; + created_at: TimestampNS; + finished_at: TimestampNS; + started_at: TimestampNS; task_id: string; url: string; custom: Record; type: string; - received_at?: Date; + received_at?: TimestampNS; } export interface AsyncExportReviewQueueEvent { - created_at: Date; - finished_at: Date; - started_at: Date; + created_at: TimestampNS; + finished_at: TimestampNS; + started_at: TimestampNS; task_id: string; url: string; custom: Record; type: string; - received_at?: Date; + received_at?: TimestampNS; } export interface AsyncExportUsersEvent { - created_at: Date; - finished_at: Date; - started_at: Date; + created_at: TimestampNS; + finished_at: TimestampNS; + started_at: TimestampNS; task_id: string; url: string; custom: Record; type: string; - received_at?: Date; + received_at?: TimestampNS; } export interface AsyncImportErrorEvent { - created_at: Date; + created_at: TimestampNS; error: string; error_code: string; - finished_at: Date; + finished_at: TimestampNS; product: string; state: string; task_id: string; custom: Record; type: string; - received_at?: Date; - started_at?: Date; + received_at?: TimestampNS; + started_at?: TimestampNS; } export interface AsyncImportSuccessEvent { - created_at: Date; - finished_at: Date; + created_at: TimestampNS; + finished_at: TimestampNS; product: string; state: string; task_id: string; custom: Record; type: string; - received_at?: Date; - started_at?: Date; + received_at?: TimestampNS; + started_at?: TimestampNS; } export interface AsyncModerationCallbackConfig { @@ -2172,7 +2198,7 @@ export interface BanInfoResponse { /** * When the ban was created */ - created_at: Date; + created_at: TimestampNS; /** * The channel this ban applies to. Empty if this is an app-wide (global) ban rather than a per-channel ban. */ @@ -2180,7 +2206,7 @@ export interface BanInfoResponse { /** * When the ban expires */ - expires?: Date; + expires?: TimestampNS; /** * Reason for the ban */ @@ -2253,8 +2279,8 @@ export interface BanRequest { } export interface BanResponse { - created_at: Date; - expires?: Date; + created_at: TimestampNS; + expires?: TimestampNS; reason?: string; shadow?: boolean; /** @@ -2382,14 +2408,14 @@ export interface BlockListResponse { /** * Date/time of creation */ - created_at?: Date; + created_at?: TimestampNS; id?: string; owner_user_id?: string; team?: string; /** * Date/time of the last update */ - updated_at?: Date; + updated_at?: TimestampNS; } export interface BlockListRule { @@ -2444,7 +2470,7 @@ export interface BlockUsersResponse { /** * Timestamp when the user was blocked */ - created_at: Date; + created_at: TimestampNS; /** * Duration of the request in milliseconds */ @@ -2453,7 +2479,7 @@ export interface BlockUsersResponse { export interface BlockedUserEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * User response object */ @@ -2473,7 +2499,7 @@ export interface BlockedUserResponse { * ID of the user who got blocked */ blocked_user_id: string; - created_at: Date; + created_at: TimestampNS; /** * ID of the user who blocked another user */ @@ -2530,14 +2556,14 @@ export interface BookmarkAddedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; bookmark: BookmarkResponse; custom: Record; /** * The type of event: "feeds.bookmark.added" in this case */ type: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -2545,14 +2571,14 @@ export interface BookmarkDeletedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; bookmark: BookmarkResponse; custom: Record; /** * The type of event: "feeds.bookmark.deleted" in this case */ type: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -2560,14 +2586,14 @@ export interface BookmarkFolderDeletedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; bookmark_folder: BookmarkFolderResponse; custom: Record; /** * The type of event: "feeds.bookmark_folder.deleted" in this case */ type: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -2575,7 +2601,7 @@ export interface BookmarkFolderResponse { /** * When the folder was created */ - created_at: Date; + created_at: TimestampNS; /** * Unique identifier for the folder */ @@ -2587,7 +2613,7 @@ export interface BookmarkFolderResponse { /** * When the folder was last updated */ - updated_at: Date; + updated_at: TimestampNS; /** * User response object */ @@ -2602,14 +2628,14 @@ export interface BookmarkFolderUpdatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; bookmark_folder: BookmarkFolderResponse; custom: Record; /** * The type of event: "feeds.bookmark_folder.updated" in this case */ type: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -2617,7 +2643,7 @@ export interface BookmarkResponse { /** * When the bookmark was created */ - created_at: Date; + created_at: TimestampNS; /** * ID of the bookmarked object */ @@ -2629,7 +2655,7 @@ export interface BookmarkResponse { /** * When the bookmark was last updated */ - updated_at: Date; + updated_at: TimestampNS; activity: ActivityResponse; /** * User response object @@ -2648,14 +2674,14 @@ export interface BookmarkUpdatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; bookmark: BookmarkResponse; custom: Record; /** * The type of event: "feeds.bookmark.updated" in this case */ type: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -2879,7 +2905,7 @@ export interface BypassResponse { export interface CallAcceptedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * Represents a call */ @@ -2905,11 +2931,11 @@ export interface CallActionOptions { } export interface CallClosedCaption { - end_time: Date; + end_time: TimestampNS; id: string; language: string; speaker_id: string; - start_time: Date; + start_time: TimestampNS; text: string; translated: boolean; /** @@ -2921,7 +2947,7 @@ export interface CallClosedCaption { export interface CallClosedCaptionsFailedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * The type of event: "call.closed_captions_failed" in this case */ @@ -2930,7 +2956,7 @@ export interface CallClosedCaptionsFailedEvent { export interface CallClosedCaptionsStartedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * The type of event: "call.closed_captions_started" in this case */ @@ -2939,7 +2965,7 @@ export interface CallClosedCaptionsStartedEvent { export interface CallClosedCaptionsStoppedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * The type of event: "call.transcription_stopped" in this case */ @@ -2948,7 +2974,7 @@ export interface CallClosedCaptionsStoppedEvent { export interface CallCreatedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * the members added to this call */ @@ -2970,7 +2996,7 @@ export interface CallCustomPropertyParameters { export interface CallDTMFEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * The DTMF digit (0-9, *, #, A-D) */ @@ -2986,7 +3012,7 @@ export interface CallDTMFEvent { /** * When the digit press ended and was detected */ - timestamp: Date; + timestamp: TimestampNS; /** * User response object */ @@ -2999,7 +3025,7 @@ export interface CallDTMFEvent { export interface CallDeletedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * Represents a call */ @@ -3020,7 +3046,7 @@ export interface CallDurationReportResponse { export interface CallEndedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * Represents a call */ @@ -3045,7 +3071,7 @@ export interface CallEndedEvent { export interface CallFrameRecordingFailedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; egress_id: string; /** * Represents a call @@ -3062,8 +3088,8 @@ export interface CallFrameRecordingFrameReadyEvent { /** * The time the frame was captured */ - captured_at: Date; - created_at: Date; + captured_at: TimestampNS; + created_at: TimestampNS; egress_id: string; /** * Call session ID @@ -3089,7 +3115,7 @@ export interface CallFrameRecordingFrameReadyEvent { export interface CallFrameRecordingStartedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; egress_id: string; /** * Represents a call @@ -3103,7 +3129,7 @@ export interface CallFrameRecordingStartedEvent { export interface CallFrameRecordingStoppedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; egress_id: string; /** * Represents a call @@ -3117,7 +3143,7 @@ export interface CallFrameRecordingStoppedEvent { export interface CallHLSBroadcastingFailedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * The type of event: "call.hls_broadcasting_failed" in this case */ @@ -3126,7 +3152,7 @@ export interface CallHLSBroadcastingFailedEvent { export interface CallHLSBroadcastingStartedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; hls_playlist_url: string; /** * Represents a call @@ -3140,7 +3166,7 @@ export interface CallHLSBroadcastingStartedEvent { export interface CallHLSBroadcastingStoppedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * The type of event: "call.hls_broadcasting_stopped" in this case */ @@ -3165,7 +3191,7 @@ export interface CallLevelEventPayload { export interface CallLiveStartedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * Represents a call */ @@ -3178,7 +3204,7 @@ export interface CallLiveStartedEvent { export interface CallMemberAddedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * the members added to this call */ @@ -3195,7 +3221,7 @@ export interface CallMemberAddedEvent { export interface CallMemberRemovedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * the list of member IDs removed from the call */ @@ -3212,7 +3238,7 @@ export interface CallMemberRemovedEvent { export interface CallMemberUpdatedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * The list of members that were updated */ @@ -3229,7 +3255,7 @@ export interface CallMemberUpdatedEvent { export interface CallMemberUpdatedPermissionEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * The list of members that were updated */ @@ -3250,7 +3276,7 @@ export interface CallMemberUpdatedPermissionEvent { export interface CallMissedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; notify_user: boolean; /** * Call session ID @@ -3276,7 +3302,7 @@ export interface CallMissedEvent { export interface CallModerationBlurEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * The user ID whose video stream is being blurred */ @@ -3293,7 +3319,7 @@ export interface CallModerationBlurEvent { export interface CallModerationWarningEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * The warning message */ @@ -3314,7 +3340,7 @@ export interface CallModerationWarningEvent { export interface CallNotificationEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * Call session ID */ @@ -3346,7 +3372,7 @@ export interface CallParticipantCountReportResponse { } export interface CallParticipantResponse { - joined_at: Date; + joined_at: TimestampNS; role: string; user_session_id: string; /** @@ -3357,14 +3383,14 @@ export interface CallParticipantResponse { export interface CallParticipantTimeline { severity: string; - timestamp: Date; + timestamp: TimestampNS; type: string; data: Record; } export interface CallReactionEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; reaction: VideoReactionResponse; /** * The type of event: "call.reaction_new" in this case @@ -3373,17 +3399,17 @@ export interface CallReactionEvent { } export interface CallRecording { - end_time: Date; + end_time: TimestampNS; filename: string; recording_type: string; session_id: string; - start_time: Date; + start_time: TimestampNS; url: string; } export interface CallRecordingFailedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; egress_id: string; /** * The type of recording @@ -3397,7 +3423,7 @@ export interface CallRecordingFailedEvent { export interface CallRecordingReadyEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; egress_id: string; /** * The type of recording @@ -3415,7 +3441,7 @@ export interface CallRecordingReadyEvent { export interface CallRecordingStartedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; egress_id: string; /** * The type of recording @@ -3429,7 +3455,7 @@ export interface CallRecordingStartedEvent { export interface CallRecordingStoppedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; egress_id: string; /** * The type of recording @@ -3443,7 +3469,7 @@ export interface CallRecordingStoppedEvent { export interface CallRejectedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * Represents a call */ @@ -3464,8 +3490,8 @@ export interface CallRejectedEvent { export interface CallReportResponse { score: number; - ended_at?: Date; - started_at?: Date; + ended_at?: TimestampNS; + started_at?: TimestampNS; } export interface CallRequest { @@ -3493,7 +3519,7 @@ export interface CallResponse { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; current_session_id: string; /** * Call ID @@ -3509,7 +3535,7 @@ export interface CallResponse { /** * Date/time of the last update */ - updated_at: Date; + updated_at: TimestampNS; blocked_user_ids: Array; /** * User response object @@ -3529,7 +3555,7 @@ export interface CallResponse { /** * Date/time when the call ended */ - ended_at?: Date; + ended_at?: TimestampNS; join_ahead_time_seconds?: number; /** * 10-digit routing number for SIP routing @@ -3538,7 +3564,7 @@ export interface CallResponse { /** * Date/time when the call will start */ - starts_at?: Date; + starts_at?: TimestampNS; team?: string; session?: CallSessionResponse; thumbnails?: ThumbnailResponse; @@ -3546,7 +3572,7 @@ export interface CallResponse { export interface CallRingEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * Call session ID */ @@ -3576,7 +3602,7 @@ export interface CallRingEvent { export interface CallRingSettledEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * ID of the user who rang */ @@ -3588,7 +3614,7 @@ export interface CallRingSettledEvent { /** * When the ring was sent */ - rang_at: Date; + rang_at: TimestampNS; /** * Identifies this ring of the call session, as carried on call.ring */ @@ -3604,7 +3630,7 @@ export interface CallRingSettledEvent { /** * When the outcome left ringing */ - settled_at: Date; + settled_at: TimestampNS; /** * ID of the user whose action closed the ring, or 'server' for the missed-call deadline and automatic ends */ @@ -3627,7 +3653,7 @@ export interface CallRtmpBroadcastFailedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * Name of the given RTMP broadcast */ @@ -3646,7 +3672,7 @@ export interface CallRtmpBroadcastStartedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * Name of the given RTMP broadcast */ @@ -3665,7 +3691,7 @@ export interface CallRtmpBroadcastStoppedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * Name of the given RTMP broadcast */ @@ -3684,7 +3710,7 @@ export interface CallRuleActionSequence { export interface CallSessionEndedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * Call session ID */ @@ -3702,7 +3728,7 @@ export interface CallSessionEndedEvent { export interface CallSessionParticipantCountsUpdatedEvent { anonymous_participant_count: number; call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * Call session ID */ @@ -3716,7 +3742,7 @@ export interface CallSessionParticipantCountsUpdatedEvent { export interface CallSessionParticipantJoinedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * Call session ID */ @@ -3730,7 +3756,7 @@ export interface CallSessionParticipantJoinedEvent { export interface CallSessionParticipantLeftEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * The duration participant was in the session in seconds */ @@ -3754,20 +3780,20 @@ export interface CallSessionResponse { anonymous_participant_count: number; id: string; participants: Array; - accepted_by: Record; - missed_by: Record; + accepted_by: Record; + missed_by: Record; participants_count_by_role: Record; - rejected_by: Record; - ended_at?: Date; - live_ended_at?: Date; - live_started_at?: Date; - started_at?: Date; - timer_ends_at?: Date; + rejected_by: Record; + ended_at?: TimestampNS; + live_ended_at?: TimestampNS; + live_started_at?: TimestampNS; + started_at?: TimestampNS; + timer_ends_at?: TimestampNS; } export interface CallSessionStartedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * Call session ID */ @@ -3918,7 +3944,7 @@ export interface CallStatsMapSubscribers { export interface CallStatsParticipant { user_id: string; sessions: Array; - latest_activity_at?: Date; + latest_activity_at?: TimestampNS; name?: string; roles?: Array; } @@ -3951,7 +3977,7 @@ export interface CallStatsParticipantSession { current_ip?: string; current_sfu?: string; distance_to_sfu_kilometers?: number; - ended_at?: Date; + ended_at?: TimestampNS; freezes_duration_ms?: number; ingress?: string; jitter_ms?: number; @@ -3960,7 +3986,7 @@ export interface CallStatsParticipantSession { publisher_type?: string; sdk?: string; sdk_version?: string; - started_at?: Date; + started_at?: TimestampNS; unified_session_id?: string; webrtc_version?: string; location?: CallStatsLocation; @@ -3968,7 +3994,7 @@ export interface CallStatsParticipantSession { export interface CallStatsReportReadyEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * Call session ID */ @@ -3993,8 +4019,8 @@ export interface CallStatsReportSummaryResponse { call_duration_seconds: number; call_session_id: string; call_status: string; - first_stats_time: Date; - created_at?: Date; + first_stats_time: TimestampNS; + created_at?: TimestampNS; min_user_rating?: number; quality_score?: number; } @@ -4003,23 +4029,23 @@ export interface CallStatsSessionResponse { call_id: string; call_session_id: string; call_type: string; - generated_at: Date; + generated_at: TimestampNS; counts: CallStatsParticipantCounts; - call_ended_at?: Date; - call_started_at?: Date; + call_ended_at?: TimestampNS; + call_started_at?: TimestampNS; } export interface CallTranscription { - end_time: Date; + end_time: TimestampNS; filename: string; session_id: string; - start_time: Date; + start_time: TimestampNS; url: string; } export interface CallTranscriptionFailedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; egress_id: string; /** * The type of event: "call.transcription_failed" in this case @@ -4033,7 +4059,7 @@ export interface CallTranscriptionFailedEvent { export interface CallTranscriptionReadyEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; egress_id: string; /** * CallTranscription represents a transcription of a call. @@ -4047,7 +4073,7 @@ export interface CallTranscriptionReadyEvent { export interface CallTranscriptionStartedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; egress_id: string; /** * The type of event: "call.transcription_started" in this case @@ -4057,7 +4083,7 @@ export interface CallTranscriptionStartedEvent { export interface CallTranscriptionStoppedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; egress_id: string; /** * The type of event: "call.transcription_stopped" in this case @@ -4067,11 +4093,11 @@ export interface CallTranscriptionStoppedEvent { export interface CallType { app: number; - created_at: Date; + created_at: TimestampNS; id: number; name: string; recording_external_storage: string; - updated_at: Date; + updated_at: TimestampNS; notification_settings?: NotificationSettings; settings?: CallSettings; } @@ -4080,7 +4106,7 @@ export interface CallTypeResponse { /** * the time the call type was created */ - created_at: Date; + created_at: TimestampNS; /** * the name of the call type */ @@ -4088,7 +4114,7 @@ export interface CallTypeResponse { /** * the time the call type was last updated */ - updated_at: Date; + updated_at: TimestampNS; /** * the permissions granted to each role */ @@ -4107,7 +4133,7 @@ export interface CallTypeRuleParameters { export interface CallUpdatedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * Represents a call */ @@ -4124,7 +4150,7 @@ export interface CallUpdatedEvent { export interface CallUserFeedbackSubmittedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * The rating given by the user (1-5) */ @@ -4155,7 +4181,7 @@ export interface CallUserFeedbackSubmittedEvent { export interface CallUserMutedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; from_user_id: string; reason: string; muted_user_ids: Array; @@ -4194,10 +4220,10 @@ export interface CampaignChannelTemplate { } export interface CampaignCompletedEvent { - created_at: Date; + created_at: TimestampNS; custom: Record; type: string; - received_at?: Date; + received_at?: TimestampNS; campaign?: CampaignResponse; } @@ -4211,7 +4237,7 @@ export interface CampaignMessageTemplate { export interface CampaignResponse { create_channels: boolean; - created_at: Date; + created_at: TimestampNS; description: string; id: string; name: string; @@ -4222,14 +4248,14 @@ export interface CampaignResponse { skip_push: boolean; skip_webhook: boolean; status: string; - updated_at: Date; + updated_at: TimestampNS; segment_ids: Array; segments: Array; user_ids: Array; users: Array; stats: CampaignStatsResponse; - scheduled_for?: Date; - stop_at?: Date; + scheduled_for?: TimestampNS; + stop_at?: TimestampNS; channel_template?: CampaignChannelTemplate; message_template?: CampaignMessageTemplate; /** @@ -4239,19 +4265,19 @@ export interface CampaignResponse { } export interface CampaignStartedEvent { - created_at: Date; + created_at: TimestampNS; custom: Record; type: string; - received_at?: Date; + received_at?: TimestampNS; campaign?: CampaignResponse; } export interface CampaignStatsResponse { progress: number; stats_channels_created: number; - stats_completed_at: Date; + stats_completed_at: TimestampNS; stats_messages_sent: number; - stats_started_at: Date; + stats_started_at: TimestampNS; stats_users_read: number; stats_users_sent: number; } @@ -4297,7 +4323,7 @@ export interface ChangeFeedVisibilityResponse { } export interface ChannelBanResponse { - created_at: Date; + created_at: TimestampNS; scopes: Array; channel_ban?: ChannelBanScopeResponse; future_channel_ban?: ChannelBanScopeResponse; @@ -4308,9 +4334,9 @@ export interface ChannelBanResponse { } export interface ChannelBanScopeResponse { - created_at: Date; + created_at: TimestampNS; shadow: boolean; - expires?: Date; + expires?: TimestampNS; reason?: string; /** * User response object @@ -4324,9 +4350,9 @@ export interface ChannelBansScopeTotals { } export interface ChannelBatchCompletedEvent { - batch_created_at: Date; - created_at: Date; - finished_at: Date; + batch_created_at: TimestampNS; + created_at: TimestampNS; + finished_at: TimestampNS; operation: string; status: string; success_channels_count: number; @@ -4334,7 +4360,7 @@ export interface ChannelBatchCompletedEvent { failed_channels: Array; custom: Record; type: string; - received_at?: Date; + received_at?: TimestampNS; } export interface ChannelBatchMemberRequest { @@ -4343,9 +4369,9 @@ export interface ChannelBatchMemberRequest { } export interface ChannelBatchStartedEvent { - batch_created_at: Date; - created_at: Date; - finished_at: Date; + batch_created_at: TimestampNS; + created_at: TimestampNS; + finished_at: TimestampNS; operation: string; status: string; success_channels_count: number; @@ -4353,7 +4379,7 @@ export interface ChannelBatchStartedEvent { failed_channels: Array; custom: Record; type: string; - received_at?: Date; + received_at?: TimestampNS; } export interface ChannelBatchUpdateRequest { @@ -4412,7 +4438,7 @@ export interface ChannelConfig { automod_behavior: 'flag' | 'block' | 'shadow_block'; connect_events: boolean; count_messages: boolean; - created_at: Date; + created_at: TimestampNS; custom_events: boolean; delivery_events: boolean; mark_messages_pending: boolean; @@ -4431,7 +4457,7 @@ export interface ChannelConfig { shared_locations: boolean; skip_last_msg_update_for_system_msgs: boolean; typing_events: boolean; - updated_at: Date; + updated_at: TimestampNS; uploads: boolean; url_enrichment: boolean; user_message_reminders: boolean; @@ -4516,7 +4542,7 @@ export interface ChannelConfigWithInfo { automod_behavior: 'flag' | 'block' | 'shadow_block'; connect_events: boolean; count_messages: boolean; - created_at: Date; + created_at: TimestampNS; custom_events: boolean; delivery_events: boolean; mark_messages_pending: boolean; @@ -4535,7 +4561,7 @@ export interface ChannelConfigWithInfo { shared_locations: boolean; skip_last_msg_update_for_system_msgs: boolean; typing_events: boolean; - updated_at: Date; + updated_at: TimestampNS; uploads: boolean; url_enrichment: boolean; user_message_reminders: boolean; @@ -4548,6 +4574,10 @@ export interface ChannelConfigWithInfo { * Sets the push notification level for a channel type */ push_level?: 'all' | 'all_mentions' | 'mentions' | 'direct_mentions' | 'none'; + /** + * Maximum number of scheduled messages (scheduled or sending) a user can have in this channel. Present only when scheduled messages are enabled for the app. Scheduling more returns error code 117 (scheduled_limit_channel) + */ + scheduled_messages_max_per_channel?: number; allowed_flag_reasons?: Array; blocklists?: Array; /** @@ -4581,7 +4611,7 @@ export interface ChannelCreatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * Represents channel in chat */ @@ -4608,7 +4638,7 @@ export interface ChannelCreatedEvent { * The CID of the channel which was created */ cid?: string; - received_at?: Date; + received_at?: TimestampNS; /** * The team ID */ @@ -4634,7 +4664,7 @@ export interface ChannelDeletedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * Represents channel in chat */ @@ -4661,7 +4691,7 @@ export interface ChannelDeletedEvent { * The CID of the channel which was deleted */ cid?: string; - received_at?: Date; + received_at?: TimestampNS; /** * The team ID */ @@ -4694,7 +4724,7 @@ export interface ChannelFrozenEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; custom: Record; /** * The type of event: "channel.frozen" in this case @@ -4712,7 +4742,7 @@ export interface ChannelFrozenEvent { * The CID of the channel which was frozen */ cid?: string; - received_at?: Date; + received_at?: TimestampNS; } export interface ChannelGetOrCreateRequest { @@ -4720,6 +4750,10 @@ export interface ChannelGetOrCreateRequest { * Whether this channel will be hidden for the user who created the channel or not */ hide_for_creator?: boolean; + /** + * Adds scheduled_messages to the response: the acting user's own scheduled, sending and failed messages in this channel (server-side requests name the user with data.created_by_id or data.created_by; without one the field is omitted). Absent from the response when there are more than 100 or they could not be loaded; use the scheduled messages query then + */ + include_scheduled_messages?: boolean; /** * Refresh channel state */ @@ -4743,7 +4777,7 @@ export interface ChannelHiddenEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * Represents channel in chat */ @@ -4770,7 +4804,7 @@ export interface ChannelHiddenEvent { * The CID of the channel which was hidden */ cid?: string; - received_at?: Date; + received_at?: TimestampNS; /** * The team ID */ @@ -4869,7 +4903,7 @@ export interface ChannelMemberResponse { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; notifications_muted: boolean; /** * Whether member is shadow banned in this channel or not @@ -4878,31 +4912,31 @@ export interface ChannelMemberResponse { /** * Date/time of the last update */ - updated_at: Date; + updated_at: TimestampNS; user_id: string; custom: Record; - archived_at?: Date; + archived_at?: TimestampNS; /** * Expiration date of the ban */ - ban_expires?: Date; + ban_expires?: TimestampNS; /** * Whether the member's ban also applies to channels the channel's creator will create in the future (an active future channel ban by the creator targets this member) */ ban_from_future_channels?: boolean; - deleted_at?: Date; + deleted_at?: TimestampNS; /** * Expiration date of the future channel ban; absent when the future channel ban is permanent */ - future_channel_ban_expires?: Date; + future_channel_ban_expires?: TimestampNS; /** * Date when invite was accepted */ - invite_accepted_at?: Date; + invite_accepted_at?: TimestampNS; /** * Date when invite was rejected */ - invite_rejected_at?: Date; + invite_rejected_at?: TimestampNS; /** * Whether member was invited or not */ @@ -4911,7 +4945,7 @@ export interface ChannelMemberResponse { * Whether member is channel moderator or not */ is_moderator?: boolean; - pinned_at?: Date; + pinned_at?: TimestampNS; /** * Permission level of the member in the channel (DEPRECATED: use channel_role instead). One of: member, moderator, admin, owner */ @@ -4945,7 +4979,7 @@ export interface ChannelMetadata { id: string; type: string; custom: Record; - last_message_at?: Date; + last_message_at?: TimestampNS; member_count?: number; message_count?: number; push_level?: string; @@ -4956,15 +4990,15 @@ export interface ChannelMute { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * Date/time of the last update */ - updated_at: Date; + updated_at: TimestampNS; /** * Date/time of mute expiration */ - expires?: Date; + expires?: TimestampNS; /** * Represents channel in chat */ @@ -4979,13 +5013,13 @@ export interface ChannelMutedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; custom: Record; /** * The type of event: "channel.muted" in this case */ type: string; - received_at?: Date; + received_at?: TimestampNS; /** * The mute objects */ @@ -5051,7 +5085,7 @@ export interface ChannelPushPreferencesResponse { /** * If provided the notifications will be disabled until the set date. */ - disabled_until?: Date; + disabled_until?: TimestampNS; chat_preferences?: ChatPreferencesResponse; } @@ -5063,7 +5097,7 @@ export interface ChannelResponse { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; disabled: boolean; /** * Whether channel is frozen or not @@ -5080,7 +5114,7 @@ export interface ChannelResponse { /** * Date/time of the last update */ - updated_at: Date; + updated_at: TimestampNS; /** * Custom data for this object */ @@ -5108,7 +5142,7 @@ export interface ChannelResponse { /** * Date/time of deletion */ - deleted_at?: Date; + deleted_at?: TimestampNS; /** * Whether this channel is hidden by current user or not */ @@ -5116,11 +5150,11 @@ export interface ChannelResponse { /** * Date since when the message history is accessible */ - hide_messages_before?: Date; + hide_messages_before?: TimestampNS; /** * Date of the last message sent */ - last_message_at?: Date; + last_message_at?: TimestampNS; /** * Number of members in the channel */ @@ -5132,7 +5166,7 @@ export interface ChannelResponse { /** * Date of mute expiration */ - mute_expires_at?: Date; + mute_expires_at?: TimestampNS; /** * Whether this channel is muted or not */ @@ -5144,7 +5178,7 @@ export interface ChannelResponse { /** * Date of the latest truncation of the channel */ - truncated_at?: Date; + truncated_at?: TimestampNS; /** * List of filter tags associated with the channel */ @@ -5194,7 +5228,7 @@ export interface ChannelStateResponse { /** * Messages before this date are hidden from the user */ - hide_messages_before?: Date; + hide_messages_before?: TimestampNS; /** * Number of channel watchers */ @@ -5256,7 +5290,7 @@ export interface ChannelStateResponseFields { /** * Messages before this date are hidden from the user */ - hide_messages_before?: Date; + hide_messages_before?: TimestampNS; /** * Number of channel watchers */ @@ -5297,7 +5331,7 @@ export interface ChannelTruncatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * Represents channel in chat */ @@ -5325,7 +5359,7 @@ export interface ChannelTruncatedEvent { */ cid?: string; message_id?: string; - received_at?: Date; + received_at?: TimestampNS; /** * The team ID */ @@ -5343,7 +5377,7 @@ export interface ChannelTypeConfig { automod_behavior: 'flag' | 'block' | 'shadow_block'; connect_events: boolean; count_messages: boolean; - created_at: Date; + created_at: TimestampNS; custom_events: boolean; delivery_events: boolean; mark_messages_pending: boolean; @@ -5362,7 +5396,7 @@ export interface ChannelTypeConfig { shared_locations: boolean; skip_last_msg_update_for_system_msgs: boolean; typing_events: boolean; - updated_at: Date; + updated_at: TimestampNS; uploads: boolean; url_enrichment: boolean; user_message_reminders: boolean; @@ -5390,7 +5424,7 @@ export interface ChannelUnFrozenEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; custom: Record; /** * The type of event: "channel.unfrozen" in this case @@ -5408,20 +5442,20 @@ export interface ChannelUnFrozenEvent { * The CID of the channel which was unfrozen */ cid?: string; - received_at?: Date; + received_at?: TimestampNS; } export interface ChannelUnmutedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; custom: Record; /** * The type of event: "channel.unmuted" in this case */ type: string; - received_at?: Date; + received_at?: TimestampNS; /** * The mute objects */ @@ -5434,7 +5468,7 @@ export interface ChannelUpdatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * Represents channel in chat */ @@ -5462,7 +5496,7 @@ export interface ChannelUpdatedEvent { */ cid?: string; message_id?: string; - received_at?: Date; + received_at?: TimestampNS; /** * The team ID */ @@ -5479,7 +5513,7 @@ export interface ChannelVisibleEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * Represents channel in chat */ @@ -5506,7 +5540,7 @@ export interface ChannelVisibleEvent { * The CID of the channel which was shown */ cid?: string; - received_at?: Date; + received_at?: TimestampNS; /** * The team ID */ @@ -5537,7 +5571,7 @@ export interface ChatDraftPayloadResponse { export interface ChatDraftResponse { channel_cid: string; - created_at: Date; + created_at: TimestampNS; message: ChatDraftPayloadResponse; parent_id?: string; parent_message?: ChatMessageResponse; @@ -5546,7 +5580,7 @@ export interface ChatDraftResponse { export interface ChatMessageResponse { cid: string; - created_at: Date; + created_at: TimestampNS; deleted_reply_count: number; html: string; id: string; @@ -5558,7 +5592,7 @@ export interface ChatMessageResponse { silent: boolean; text: string; type: string; - updated_at: Date; + updated_at: TimestampNS; attachments: Array; latest_reactions: Array; mentioned_users: Array; @@ -5572,13 +5606,13 @@ export interface ChatMessageResponse { */ user: UserResponse; command?: string; - deleted_at?: Date; + deleted_at?: TimestampNS; deleted_for_me?: boolean; - message_text_updated_at?: Date; + message_text_updated_at?: TimestampNS; mml?: string; parent_id?: string; - pin_expires?: Date; - pinned_at?: Date; + pin_expires?: TimestampNS; + pinned_at?: TimestampNS; poll_id?: string; quoted_message_id?: string; show_in_channel?: boolean; @@ -5646,14 +5680,14 @@ export interface ChatPreferencesResponse { export interface ChatReactionGroupResponse { count: number; - first_reaction_at: Date; - last_reaction_at: Date; + first_reaction_at: TimestampNS; + last_reaction_at: TimestampNS; sum_scores: number; latest_reactions_by: Array; } export interface ChatReactionGroupUserResponse { - created_at: Date; + created_at: TimestampNS; user_id: string; /** * User response object @@ -5662,11 +5696,11 @@ export interface ChatReactionGroupUserResponse { } export interface ChatReactionResponse { - created_at: Date; + created_at: TimestampNS; message_id: string; score: number; type: string; - updated_at: Date; + updated_at: TimestampNS; user_id: string; custom: Record; /** @@ -5677,11 +5711,11 @@ export interface ChatReactionResponse { export interface ChatReminderResponseData { channel_cid: string; - created_at: Date; + created_at: TimestampNS; message_id: string; - updated_at: Date; + updated_at: TimestampNS; user_id: string; - remind_at?: Date; + remind_at?: TimestampNS; message?: ChatMessageResponse; /** * User response object @@ -5691,14 +5725,14 @@ export interface ChatReminderResponseData { export interface ChatSharedLocationResponseData { channel_cid: string; - created_at: Date; + created_at: TimestampNS; created_by_device_id: string; latitude: number; longitude: number; message_id: string; - updated_at: Date; + updated_at: TimestampNS; user_id: string; - end_at?: Date; + end_at?: TimestampNS; message?: ChatMessageResponse; } @@ -6118,7 +6152,7 @@ export interface ClientOSDataResponse { export interface ClosedCaptionEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * CallClosedCaption represents a closed caption of a call. */ @@ -6184,11 +6218,11 @@ export interface CollectionResponse { /** * When the collection was created */ - created_at?: Date; + created_at?: TimestampNS; /** * When the collection was last updated */ - updated_at?: Date; + updated_at?: TimestampNS; /** * ID of the user who owns this collection */ @@ -6219,18 +6253,18 @@ export interface Command { /** * Date/time of creation */ - created_at?: Date; + created_at?: TimestampNS; /** * Date/time of the last update */ - updated_at?: Date; + updated_at?: TimestampNS; } export interface CommentAddedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; activity: ActivityResponse; comment: CommentResponse; @@ -6240,7 +6274,7 @@ export interface CommentAddedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -6248,7 +6282,7 @@ export interface CommentDeletedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; comment: CommentResponse; custom: Record; @@ -6257,7 +6291,7 @@ export interface CommentDeletedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -6265,14 +6299,14 @@ export interface CommentFeedbackEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; comment_feedback: CommentFeedbackEventPayload; custom: Record; /** * The type of event: "feeds.comment.feedback" in this case */ type: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -6284,7 +6318,7 @@ export interface CommentFeedbackEventPayload { /** * When the feedback was created */ - created_at: Date; + created_at: TimestampNS; /** * Whether the comment is hidden for the user */ @@ -6292,7 +6326,7 @@ export interface CommentFeedbackEventPayload { /** * When the feedback was last updated */ - updated_at: Date; + updated_at: TimestampNS; /** * User response object */ @@ -6327,7 +6361,7 @@ export interface CommentReactionAddedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; activity: ActivityResponse; comment: CommentResponse; @@ -6338,7 +6372,7 @@ export interface CommentReactionAddedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -6346,7 +6380,7 @@ export interface CommentReactionDeletedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; comment: CommentResponse; custom: Record; @@ -6356,14 +6390,14 @@ export interface CommentReactionDeletedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; } export interface CommentReactionUpdatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; activity: ActivityResponse; comment: CommentResponse; @@ -6374,7 +6408,7 @@ export interface CommentReactionUpdatedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -6387,7 +6421,7 @@ export interface CommentResponse { /** * When the comment was created */ - created_at: Date; + created_at: TimestampNS; /** * Number of downvotes for this comment */ @@ -6427,7 +6461,7 @@ export interface CommentResponse { /** * When the comment was last updated */ - updated_at: Date; + updated_at: TimestampNS; /** * Number of upvotes for this comment */ @@ -6451,11 +6485,11 @@ export interface CommentResponse { /** * When the comment was deleted */ - deleted_at?: Date; + deleted_at?: TimestampNS; /** * When the comment was last edited */ - edited_at?: Date; + edited_at?: TimestampNS; /** * ID of parent comment for nested replies */ @@ -6488,7 +6522,7 @@ export interface CommentRestoredEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; comment: CommentResponse; custom: Record; @@ -6497,7 +6531,7 @@ export interface CommentRestoredEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -6505,7 +6539,7 @@ export interface CommentUpdatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; comment: CommentResponse; custom: Record; @@ -6514,7 +6548,7 @@ export interface CommentUpdatedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -6602,7 +6636,7 @@ export interface ConfigResponse { /** * When the configuration was created */ - created_at: Date; + created_at: TimestampNS; /** * Unique identifier for the moderation configuration */ @@ -6614,7 +6648,7 @@ export interface ConfigResponse { /** * When the configuration was last updated */ - updated_at: Date; + updated_at: TimestampNS; supported_video_call_harm_types: Array; /** * Configurable image moderation label definitions for dashboard rendering @@ -6678,7 +6712,7 @@ export interface CoordinatesResponse { export interface CountByMinuteResponse { count: number; - start_ts: Date; + start_ts: TimestampNS; } export interface Coverage { @@ -6748,7 +6782,7 @@ export interface CreateCallTypeResponse { /** * the time the call type was created */ - created_at: Date; + created_at: TimestampNS; duration: string; /** * the name of the call type @@ -6757,7 +6791,7 @@ export interface CreateCallTypeResponse { /** * the time the call type was last updated */ - updated_at: Date; + updated_at: TimestampNS; /** * the permissions granted to each role */ @@ -6969,7 +7003,7 @@ export interface CreateChannelTypeResponse { automod_behavior: 'flag' | 'block' | 'shadow_block'; connect_events: boolean; count_messages: boolean; - created_at: Date; + created_at: TimestampNS; custom_events: boolean; delivery_events: boolean; /** @@ -6992,7 +7026,7 @@ export interface CreateChannelTypeResponse { shared_locations: boolean; skip_last_msg_update_for_system_msgs: boolean; typing_events: boolean; - updated_at: Date; + updated_at: TimestampNS; uploads: boolean; url_enrichment: boolean; user_message_reminders: boolean; @@ -7272,7 +7306,7 @@ export interface CreateImportV2TaskRequest { export interface CreateImportV2TaskResponse { app_pk: number; - created_at: Date; + created_at: TimestampNS; /** * Duration of the request in milliseconds */ @@ -7280,7 +7314,7 @@ export interface CreateImportV2TaskResponse { id: string; product: string; state: number; - updated_at: Date; + updated_at: TimestampNS; settings: ImportV2TaskSettings; } @@ -7687,15 +7721,15 @@ export interface CustomCheckResponse { } export interface CustomEvent { - created_at: Date; + created_at: TimestampNS; custom: Record; type: string; - received_at?: Date; + received_at?: TimestampNS; } export interface CustomVideoEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * Custom data for this object */ @@ -8462,7 +8496,7 @@ export interface DeviceResponse { /** * The date when the device was created. */ - created_at: Date; + created_at: TimestampNS; /** * The device identifier. */ @@ -8548,7 +8582,7 @@ export interface DraftPayloadResponse { export interface DraftResponse { channel_cid: string; - created_at: Date; + created_at: TimestampNS; /** * Contains the draft message content */ @@ -8603,7 +8637,7 @@ export interface EgressHLSResponse { export interface EgressRTMPResponse { name: string; - started_at: Date; + started_at: TimestampNS; stream_key?: string; stream_url?: string; } @@ -8689,11 +8723,11 @@ export interface EnrichedCollectionResponse { /** * When the collection was created */ - created_at?: Date; + created_at?: TimestampNS; /** * When the collection was last updated */ - updated_at?: Date; + updated_at?: TimestampNS; /** * ID of the user who owns this collection */ @@ -8813,7 +8847,7 @@ export interface EntityCreatorResponse { */ ban_count: number; banned: boolean; - created_at: Date; + created_at: TimestampNS; /** * Number of major actions performed on the user */ @@ -8828,19 +8862,19 @@ export interface EntityCreatorResponse { online: boolean; role: string; shadow_banned: boolean; - updated_at: Date; + updated_at: TimestampNS; blocked_user_ids: Array; teams: Array; custom: Record; avg_response_time?: number; - ban_expires?: Date; + ban_expires?: TimestampNS; bypass_moderation?: boolean; - deactivated_at?: Date; - deleted_at?: Date; + deactivated_at?: TimestampNS; + deleted_at?: TimestampNS; image?: string; - last_active?: Date; + last_active?: TimestampNS; name?: string; - revoke_tokens_issued_before?: Date; + revoke_tokens_issued_before?: TimestampNS; devices?: Array; /** * The privacy settings of the user. @@ -9057,7 +9091,7 @@ export interface FeedCreatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; members: Array; custom: Record; @@ -9068,14 +9102,14 @@ export interface FeedCreatedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; } export interface FeedDeletedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; custom: Record; /** @@ -9083,23 +9117,23 @@ export interface FeedDeletedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } export interface FeedGroup { aggregation_version: number; app_pk: number; - created_at: Date; + created_at: TimestampNS; default_follower_role: string; default_visibility: string; group_id: string; - updated_at: Date; + updated_at: TimestampNS; activity_processors: Array; activity_selectors: Array; custom: Record; - deleted_at?: Date; - last_feed_get_at?: Date; + deleted_at?: TimestampNS; + last_feed_get_at?: TimestampNS; activity_filter?: ActivityFilterConfig; aggregation?: AggregationConfig; notification?: NotificationConfig; @@ -9112,7 +9146,7 @@ export interface FeedGroupChangedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; custom: Record; /** @@ -9120,7 +9154,7 @@ export interface FeedGroupChangedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; feed_group?: FeedGroup; user?: UserResponseCommonFields; } @@ -9129,7 +9163,7 @@ export interface FeedGroupDeletedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; /** * The ID of the feed group that was deleted @@ -9141,14 +9175,14 @@ export interface FeedGroupDeletedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; } export interface FeedGroupResponse { /** * When the feed group was created */ - created_at: Date; + created_at: TimestampNS; /** * Identifier within the group */ @@ -9156,7 +9190,7 @@ export interface FeedGroupResponse { /** * When the feed group was last updated */ - updated_at: Date; + updated_at: TimestampNS; /** * Role new followers of feeds in this group are given. Either a built-in (feed_follower, feed_member_viewer) or any role your app has defined. Empty means feed_follower. Applied when the follow is accepted, so a follow that starts pending picks it up on approval */ @@ -9166,7 +9200,7 @@ export interface FeedGroupResponse { */ default_visibility?: 'public' | 'visible' | 'followers' | 'members' | 'private'; - deleted_at?: Date; + deleted_at?: TimestampNS; /** * Configuration for activity processors */ @@ -9193,7 +9227,7 @@ export interface FeedGroupRestoredEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; /** * The ID of the feed group that was restored @@ -9205,7 +9239,7 @@ export interface FeedGroupRestoredEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; } export interface FeedGroupScope { @@ -9233,7 +9267,7 @@ export interface FeedMemberAddedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; custom: Record; member: FeedMemberResponse; @@ -9242,7 +9276,7 @@ export interface FeedMemberAddedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -9250,7 +9284,7 @@ export interface FeedMemberRemovedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; member_id: string; custom: Record; @@ -9259,7 +9293,7 @@ export interface FeedMemberRemovedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -9290,7 +9324,7 @@ export interface FeedMemberResponse { /** * When the membership was created */ - created_at: Date; + created_at: TimestampNS; /** * Role of the member in the feed */ @@ -9302,7 +9336,7 @@ export interface FeedMemberResponse { /** * When the membership was last updated */ - updated_at: Date; + updated_at: TimestampNS; /** * User response object */ @@ -9310,11 +9344,11 @@ export interface FeedMemberResponse { /** * When the invite was accepted */ - invite_accepted_at?: Date; + invite_accepted_at?: TimestampNS; /** * When the invite was rejected */ - invite_rejected_at?: Date; + invite_rejected_at?: TimestampNS; /** * Custom data for the membership */ @@ -9326,7 +9360,7 @@ export interface FeedMemberUpdatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; custom: Record; member: FeedMemberResponse; @@ -9335,7 +9369,7 @@ export interface FeedMemberUpdatedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -9435,7 +9469,7 @@ export interface FeedResponse { /** * When the feed was created */ - created_at: Date; + created_at: TimestampNS; /** * Description of the feed */ @@ -9475,7 +9509,7 @@ export interface FeedResponse { /** * When the feed was last updated */ - updated_at: Date; + updated_at: TimestampNS; /** * User response object */ @@ -9483,7 +9517,7 @@ export interface FeedResponse { /** * When the feed was deleted */ - deleted_at?: Date; + deleted_at?: TimestampNS; /** * Visibility setting for the feed */ @@ -9517,7 +9551,7 @@ export interface FeedSuggestionResponse { /** * When the feed was created */ - created_at: Date; + created_at: TimestampNS; /** * Description of the feed */ @@ -9557,7 +9591,7 @@ export interface FeedSuggestionResponse { /** * When the feed was last updated */ - updated_at: Date; + updated_at: TimestampNS; /** * User response object */ @@ -9565,7 +9599,7 @@ export interface FeedSuggestionResponse { /** * When the feed was deleted */ - deleted_at?: Date; + deleted_at?: TimestampNS; reason?: string; recommendation_score?: number; /** @@ -9598,7 +9632,7 @@ export interface FeedSuggestionResponse { } export interface FeedUpdatedEvent { - created_at: Date; + created_at: TimestampNS; fid: string; custom: Record; feed: FeedResponse; @@ -9607,7 +9641,7 @@ export interface FeedUpdatedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -9619,7 +9653,7 @@ export interface FeedViewResponse { /** * When the feed view was last used */ - last_used_at?: Date; + last_used_at?: TimestampNS; /** * Configured activity selectors */ @@ -9649,10 +9683,10 @@ export interface FeedsActivityLocation { } export interface FeedsBookmarkResponse { - created_at: Date; + created_at: TimestampNS; object_id: string; object_type: string; - updated_at: Date; + updated_at: TimestampNS; /** * User response object */ @@ -9662,18 +9696,18 @@ export interface FeedsBookmarkResponse { } export interface FeedsEnrichedCollectionResponse { - created_at: Date; + created_at: TimestampNS; id: string; name: string; status: string; - updated_at: Date; + updated_at: TimestampNS; user_id: string; custom: Record; } export interface FeedsFeedResponse { activity_count: number; - created_at: Date; + created_at: TimestampNS; description: string; feed: string; follower_count: number; @@ -9683,12 +9717,12 @@ export interface FeedsFeedResponse { member_count: number; name: string; pin_count: number; - updated_at: Date; + updated_at: TimestampNS; /** * User response object */ created_by: UserResponse; - deleted_at?: Date; + deleted_at?: TimestampNS; visibility?: string; filter_tags?: Array; custom?: Record; @@ -9799,15 +9833,15 @@ export interface FeedsPreferencesResponse { export interface FeedsReactionGroupResponse { count: number; - first_reaction_at: Date; - last_reaction_at: Date; + first_reaction_at: TimestampNS; + last_reaction_at: TimestampNS; } export interface FeedsReactionResponse { activity_id: string; - created_at: Date; + created_at: TimestampNS; type: string; - updated_at: Date; + updated_at: TimestampNS; /** * User response object */ @@ -9818,7 +9852,7 @@ export interface FeedsReactionResponse { export interface FeedsRetentionPolicy { app_pk: number; - enabled_at: Date; + enabled_at: TimestampNS; policy: string; config: FeedsPolicyConfig; } @@ -9832,7 +9866,7 @@ export interface FeedsRetentionRunResponse { export interface FeedsShareResponse { activity_id: string; - created_at: Date; + created_at: TimestampNS; /** * User response object */ @@ -9842,7 +9876,7 @@ export interface FeedsShareResponse { export interface FeedsV3ActivityResponse { bookmark_count: number; comment_count: number; - created_at: Date; + created_at: TimestampNS; hidden: boolean; id: string; popularity: number; @@ -9852,7 +9886,7 @@ export interface FeedsV3ActivityResponse { score: number; share_count: number; type: string; - updated_at: Date; + updated_at: TimestampNS; visibility: string; attachments: Array; comments: Array; @@ -9871,9 +9905,9 @@ export interface FeedsV3ActivityResponse { * User response object */ user: UserResponse; - deleted_at?: Date; - edited_at?: Date; - expires_at?: Date; + deleted_at?: TimestampNS; + edited_at?: TimestampNS; + expires_at?: TimestampNS; friend_reaction_count?: number; is_read?: boolean; is_seen?: boolean; @@ -9898,7 +9932,7 @@ export interface FeedsV3ActivityResponse { export interface FeedsV3CommentResponse { bookmark_count: number; confidence_score: number; - created_at: Date; + created_at: TimestampNS; downvote_count: number; hidden: boolean; id: string; @@ -9908,7 +9942,7 @@ export interface FeedsV3CommentResponse { reply_count: number; score: number; status: string; - updated_at: Date; + updated_at: TimestampNS; upvote_count: number; mentioned_users: Array; own_reactions: Array; @@ -9917,8 +9951,8 @@ export interface FeedsV3CommentResponse { */ user: UserResponse; controversy_score?: number; - deleted_at?: Date; - edited_at?: Date; + deleted_at?: TimestampNS; + edited_at?: TimestampNS; parent_id?: string; text?: string; attachments?: Array; @@ -10035,7 +10069,7 @@ export interface FlagDetailsResponse { } export interface FlagFeedbackResponse { - created_at: Date; + created_at: TimestampNS; message_id: string; labels: Array; } @@ -10085,13 +10119,13 @@ export interface FlagRequest { } export interface FlagResponse { - created_at: Date; + created_at: TimestampNS; created_by_automod: boolean; - updated_at: Date; - approved_at?: Date; + updated_at: TimestampNS; + approved_at?: TimestampNS; reason?: string; - rejected_at?: Date; - reviewed_at?: Date; + rejected_at?: TimestampNS; + reviewed_at?: TimestampNS; reviewed_by?: string; target_message_id?: string; custom?: Record; @@ -10111,10 +10145,10 @@ export interface FlagResponse { } export interface FlagUpdatedEvent { - created_at: Date; + created_at: TimestampNS; custom: Record; type: string; - received_at?: Date; + received_at?: TimestampNS; /** * User response object */ @@ -10209,7 +10243,7 @@ export interface FollowCreatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; custom: Record; follow: FollowResponse; @@ -10218,14 +10252,14 @@ export interface FollowCreatedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; } export interface FollowDeletedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; custom: Record; follow: FollowResponse; @@ -10234,7 +10268,7 @@ export interface FollowDeletedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; } export interface FollowRequest { @@ -10289,7 +10323,7 @@ export interface FollowResponse { /** * When the follow relationship was created */ - created_at: Date; + created_at: TimestampNS; /** * Role of the follower (source user) in the follow relationship, as stored. A reserved name, or a role your app no longer defines, is reported as stored but evaluated as 'feed_follower'. */ @@ -10305,17 +10339,17 @@ export interface FollowResponse { /** * When the follow relationship was last updated */ - updated_at: Date; + updated_at: TimestampNS; source_feed: FeedResponse; target_feed: FeedResponse; /** * When the follow request was accepted */ - request_accepted_at?: Date; + request_accepted_at?: TimestampNS; /** * When the follow request was rejected */ - request_rejected_at?: Date; + request_rejected_at?: TimestampNS; /** * Custom data for the follow relationship */ @@ -10326,7 +10360,7 @@ export interface FollowUpdatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; fid: string; custom: Record; follow: FollowResponse; @@ -10335,7 +10369,7 @@ export interface FollowUpdatedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; } export interface FrameRecordSettings { @@ -10377,7 +10411,7 @@ export interface FriendReactionsOptions { export interface FullUserResponse { banned: boolean; - created_at: Date; + created_at: TimestampNS; id: string; invisible: boolean; language: string; @@ -10392,7 +10426,7 @@ export interface FullUserResponse { */ unread_count: number; unread_threads: number; - updated_at: Date; + updated_at: TimestampNS; blocked_user_ids: Array; channel_mutes: Array; devices: Array; @@ -10400,14 +10434,14 @@ export interface FullUserResponse { teams: Array; custom: Record; avg_response_time?: number; - ban_expires?: Date; + ban_expires?: TimestampNS; bypass_moderation?: boolean; - deactivated_at?: Date; - deleted_at?: Date; + deactivated_at?: TimestampNS; + deleted_at?: TimestampNS; image?: string; - last_active?: Date; + last_active?: TimestampNS; name?: string; - revoke_tokens_issued_before?: Date; + revoke_tokens_issued_before?: TimestampNS; latest_hidden_channels?: Array; /** * The privacy settings of the user. @@ -10417,8 +10451,8 @@ export interface FullUserResponse { } export interface FutureChannelBanResponse { - created_at: Date; - expires?: Date; + created_at: TimestampNS; + expires?: TimestampNS; reason?: string; shadow?: boolean; /** @@ -10463,11 +10497,11 @@ export interface GetActiveCallsStatusResponse { /** * End time of the status period */ - end_time: Date; + end_time: TimestampNS; /** * Start time of the status period */ - start_time: Date; + start_time: TimestampNS; metrics?: ActiveCallsMetrics; summary?: ActiveCallsSummary; } @@ -10519,7 +10553,7 @@ export interface GetCallParticipantSessionMetricsResponse { duration: string; is_publisher?: boolean; is_subscriber?: boolean; - joined_at?: Date; + joined_at?: TimestampNS; publisher_type?: string; user_id?: string; user_session_id?: string; @@ -10567,10 +10601,10 @@ export interface GetCallSessionParticipantStatsDetailsResponse { } export interface GetCallTypeResponse { - created_at: Date; + created_at: TimestampNS; duration: string; name: string; - updated_at: Date; + updated_at: TimestampNS; grants: Record>; notification_settings: NotificationSettingsResponse; settings: CallSettingsResponse; @@ -10591,7 +10625,7 @@ export interface GetChannelTypeResponse { automod_behavior: 'flag' | 'block' | 'shadow_block'; connect_events: boolean; count_messages: boolean; - created_at: Date; + created_at: TimestampNS; custom_events: boolean; delivery_events: boolean; /** @@ -10614,7 +10648,7 @@ export interface GetChannelTypeResponse { shared_locations: boolean; skip_last_msg_update_for_system_msgs: boolean; typing_events: boolean; - updated_at: Date; + updated_at: TimestampNS; uploads: boolean; url_enrichment: boolean; user_message_reminders: boolean; @@ -10644,8 +10678,8 @@ export interface GetCommandResponse { duration: string; name: string; set: string; - created_at?: Date; - updated_at?: Date; + created_at?: TimestampNS; + updated_at?: TimestampNS; } export interface GetCommentRepliesResponse { @@ -10749,13 +10783,13 @@ export interface GetExternalStorageGCSResponse { } export interface GetExternalStorageResponse { - created_at: Date; + created_at: TimestampNS; /** * Duration of the request in milliseconds */ duration: string; type: string; - updated_at: Date; + updated_at: TimestampNS; aws_s3?: GetExternalStorageAWSS3Response; gcs?: GetExternalStorageGCSResponse; } @@ -10894,7 +10928,7 @@ export interface GetImportResponse { export interface GetImportV2TaskResponse { app_pk: number; - created_at: Date; + created_at: TimestampNS; /** * Duration of the request in milliseconds */ @@ -10902,7 +10936,7 @@ export interface GetImportV2TaskResponse { id: string; product: string; state: number; - updated_at: Date; + updated_at: TimestampNS; settings: ImportV2TaskSettings; result?: Record; } @@ -11321,7 +11355,7 @@ export interface GetSetupSessionResponse { } export interface GetTaskResponse { - created_at: Date; + created_at: TimestampNS; duration: string; /** * Current status of task @@ -11331,7 +11365,7 @@ export interface GetTaskResponse { * ID of task */ task_id: string; - updated_at: Date; + updated_at: TimestampNS; error?: ErrorResult; /** * Result produced by task after completion @@ -11625,29 +11659,29 @@ export interface ImportBlockListResponse { } export interface ImportTask { - created_at: Date; + created_at: TimestampNS; id: string; mode: string; path: string; state: string; - updated_at: Date; + updated_at: TimestampNS; history: Array; size?: number; } export interface ImportTaskHistory { - created_at: Date; + created_at: TimestampNS; next_state: string; prev_state: string; } export interface ImportV2TaskItem { app_pk: number; - created_at: Date; + created_at: TimestampNS; id: string; product: string; state: number; - updated_at: Date; + updated_at: TimestampNS; settings: ImportV2TaskSettings; result?: Record; } @@ -11719,7 +11753,7 @@ export interface IngressAudioEncodingResponse { export interface IngressErrorEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * Human-readable error message */ @@ -11780,7 +11814,7 @@ export interface IngressSourceResponse { export interface IngressStartedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * Unique identifier for this stream */ @@ -11813,7 +11847,7 @@ export interface IngressStartedEvent { export interface IngressStoppedEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * Unique identifier for the stream */ @@ -12068,7 +12102,7 @@ export interface KickUserResponse { export interface KickedUserEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * User response object */ @@ -12126,7 +12160,7 @@ export interface LabelResultResponse { /** * Timestamp */ - created_at: Date; + created_at: TimestampNS; /** * High-level harm category */ @@ -12592,9 +12626,9 @@ export interface MarkReadResponseEvent { channel_id: string; channel_type: string; cid: string; - created_at: Date; + created_at: TimestampNS; type: string; - channel_last_message_at?: Date; + channel_last_message_at?: TimestampNS; last_read_message_id?: string; team?: string; /** @@ -12648,7 +12682,7 @@ export interface MatchedContent { /** * `content_published_at` from the contributing `/analyze` request, or server receive time when that field was omitted. */ - published_at: Date; + published_at: TimestampNS; /** * Content type that contributed this entry: `image` or `text`. */ @@ -12673,17 +12707,32 @@ export interface MatchedContent { } export interface MaxStreakChangedEvent { - created_at: Date; + created_at: TimestampNS; custom: Record; type: string; - received_at?: Date; + received_at?: TimestampNS; +} + +export interface MediaDisplayResponse { + /** + * Reveals must be recorded via the reveal media endpoint (blurred CSAM or gore) + */ + audit_reveal: boolean; + /** + * Default rendering before a reveal + */ + mode: 'normal' | 'blur' | 'blur_grayscale'; + /** + * Only users with the RevealProtectedMedia permission may reveal the media (CSAM) + */ + reveal_restricted: boolean; } export interface MemberAddedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * Represents channel in chat */ @@ -12714,7 +12763,7 @@ export interface MemberAddedEvent { * The CID of the channel to which the member was added */ cid?: string; - received_at?: Date; + received_at?: TimestampNS; /** * The team ID */ @@ -12727,7 +12776,7 @@ export interface MemberRemovedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * Represents channel in chat */ @@ -12758,7 +12807,7 @@ export interface MemberRemovedEvent { * The CID of the channel from which the member was removed */ cid?: string; - received_at?: Date; + received_at?: TimestampNS; /** * The team ID */ @@ -12780,11 +12829,11 @@ export interface MemberResponse { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * Date/time of the last update */ - updated_at: Date; + updated_at: TimestampNS; user_id: string; /** * Custom member response data @@ -12797,7 +12846,7 @@ export interface MemberResponse { /** * Date/time of deletion */ - deleted_at?: Date; + deleted_at?: TimestampNS; role?: string; } @@ -12805,7 +12854,7 @@ export interface MemberUpdatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * Represents channel in chat */ @@ -12836,7 +12885,7 @@ export interface MemberUpdatedEvent { * The CID of the channel in which the member was updated */ cid?: string; - received_at?: Date; + received_at?: TimestampNS; /** * The team ID */ @@ -12876,7 +12925,7 @@ export interface MembershipLevelResponse { /** * When the membership level was created */ - created_at: Date; + created_at: TimestampNS; /** * Unique identifier for the membership level */ @@ -12892,7 +12941,7 @@ export interface MembershipLevelResponse { /** * When the membership level was last updated */ - updated_at: Date; + updated_at: TimestampNS; /** * Activity tags this membership level gives access to */ @@ -12946,7 +12995,7 @@ export interface MessageDeletedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * Whether the message was hard deleted */ @@ -12985,7 +13034,7 @@ export interface MessageDeletedEvent { * Whether the message was deleted only for the current user */ deleted_for_me?: boolean; - received_at?: Date; + received_at?: TimestampNS; /** * The team ID */ @@ -12995,13 +13044,13 @@ export interface MessageDeletedEvent { } export interface MessageFlagResponse { - created_at: Date; + created_at: TimestampNS; created_by_automod: boolean; - updated_at: Date; - approved_at?: Date; + updated_at: TimestampNS; + approved_at?: TimestampNS; reason?: string; - rejected_at?: Date; - reviewed_at?: Date; + rejected_at?: TimestampNS; + reviewed_at?: TimestampNS; custom?: Record; details?: FlagDetailsResponse; /** @@ -13027,7 +13076,7 @@ export interface MessageFlaggedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; message_id: string; /** * Represents any chat message @@ -13061,7 +13110,7 @@ export interface MessageFlaggedEvent { * The reason for the flag */ reason?: string; - received_at?: Date; + received_at?: TimestampNS; /** * The team ID */ @@ -13086,7 +13135,7 @@ export interface MessageFlaggedEvent { export interface MessageHistoryEntryResponse { is_deleted: boolean; message_id: string; - message_updated_at: Date; + message_updated_at: TimestampNS; message_updated_by_id: string; text: string; attachments: Array; @@ -13101,7 +13150,7 @@ export interface MessageModerationResult { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * ID of the message */ @@ -13109,7 +13158,7 @@ export interface MessageModerationResult { /** * Date/time of the last update */ - updated_at: Date; + updated_at: TimestampNS; /** * Whether user has bad karma */ @@ -13144,7 +13193,7 @@ export interface MessageNewEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; message_id: string; /** * The number of watchers @@ -13183,7 +13232,7 @@ export interface MessageNewEvent { * The author of the parent message */ parent_author?: string; - received_at?: Date; + received_at?: TimestampNS; /** * The team ID */ @@ -13263,7 +13312,7 @@ export interface MessageReadEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; custom: Record; /** * The type of event: "message.read" in this case @@ -13293,7 +13342,7 @@ export interface MessageReadEvent { * The ID of the last read message */ last_read_message_id?: string; - received_at?: Date; + received_at?: TimestampNS; /** * The team ID */ @@ -13393,7 +13442,7 @@ export interface MessageResponse { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; deleted_reply_count: number; /** * Contains HTML markup of the message. Can only be set when using server-side API @@ -13438,7 +13487,7 @@ export interface MessageResponse { /** * Date/time of the last update */ - updated_at: Date; + updated_at: TimestampNS; /** * Array of message attachments */ @@ -13479,9 +13528,9 @@ export interface MessageResponse { /** * Date/time of deletion */ - deleted_at?: Date; + deleted_at?: TimestampNS; deleted_for_me?: boolean; - message_text_updated_at?: Date; + message_text_updated_at?: TimestampNS; /** * Should be empty if `text` is provided. Can only be set when using server-side API */ @@ -13493,11 +13542,11 @@ export interface MessageResponse { /** * Date when pinned message expires */ - pin_expires?: Date; + pin_expires?: TimestampNS; /** * Date when message got pinned */ - pinned_at?: Date; + pinned_at?: TimestampNS; /** * Identifier of the poll to include in the message */ @@ -13560,7 +13609,7 @@ export interface MessageUnblockedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; message_id: string; custom: Record; /** @@ -13575,7 +13624,7 @@ export interface MessageUnblockedEvent { * The CID of the channel where the message was unblocked */ cid?: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; } @@ -13583,7 +13632,7 @@ export interface MessageUndeletedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; message_id: string; custom: Record; /** @@ -13614,7 +13663,7 @@ export interface MessageUndeletedEvent { * The CID of the channel where the message was sent */ cid?: string; - received_at?: Date; + received_at?: TimestampNS; /** * The team ID */ @@ -13631,7 +13680,7 @@ export interface MessageUpdatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; message_id: string; custom: Record; /** @@ -13662,7 +13711,7 @@ export interface MessageUpdatedEvent { * The CID of the channel where the message was sent */ cid?: string; - received_at?: Date; + received_at?: TimestampNS; /** * The team ID */ @@ -13680,7 +13729,7 @@ export interface MessageWithChannelResponse { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; deleted_reply_count: number; /** * Contains HTML markup of the message. Can only be set when using server-side API @@ -13725,7 +13774,7 @@ export interface MessageWithChannelResponse { /** * Date/time of the last update */ - updated_at: Date; + updated_at: TimestampNS; /** * Array of message attachments */ @@ -13770,9 +13819,9 @@ export interface MessageWithChannelResponse { /** * Date/time of deletion */ - deleted_at?: Date; + deleted_at?: TimestampNS; deleted_for_me?: boolean; - message_text_updated_at?: Date; + message_text_updated_at?: TimestampNS; /** * Should be empty if `text` is provided. Can only be set when using server-side API */ @@ -13784,11 +13833,11 @@ export interface MessageWithChannelResponse { /** * Date when pinned message expires */ - pin_expires?: Date; + pin_expires?: TimestampNS; /** * Date when message got pinned */ - pinned_at?: Date; + pinned_at?: TimestampNS; /** * Identifier of the poll to include in the message */ @@ -13913,7 +13962,7 @@ export interface ModerationActionConfigResponse { } export interface ModerationAnalysisFailedEvent { - created_at: Date; + created_at: TimestampNS; type: string; /** * The moderation policy key the request targeted. @@ -13931,7 +13980,7 @@ export interface ModerationAnalysisFailedEvent { * Echo of the `entity_type` on the /analyze request. */ entity_type?: string; - received_at?: Date; + received_at?: TimestampNS; /** * Echo of the request's `content_ids`, keyed by text/image label. On keyframe and caption streams every request repeats the same entity_type/entity_id/entity_creator_id, so this is what identifies the specific submission that went unscreened. */ @@ -13950,21 +13999,21 @@ export interface ModerationCallResponse { backstage: boolean; captioning: boolean; cid: string; - created_at: Date; + created_at: TimestampNS; current_session_id: string; id: string; recording: boolean; transcribing: boolean; translating: boolean; type: string; - updated_at: Date; + updated_at: TimestampNS; blocked_user_ids: Array; custom: Record; channel_cid?: string; - ended_at?: Date; + ended_at?: TimestampNS; join_ahead_time_seconds?: number; routing_number?: string; - starts_at?: Date; + starts_at?: TimestampNS; team?: string; /** * User response object @@ -13973,7 +14022,7 @@ export interface ModerationCallResponse { } export interface ModerationCheckCompletedEvent { - created_at: Date; + created_at: TimestampNS; /** * The ID of entity which was moderated */ @@ -13992,7 +14041,7 @@ export interface ModerationCheckCompletedEvent { review_queue_item_id: string; custom: Record; type: string; - received_at?: Date; + received_at?: TimestampNS; } export interface ModerationConfig { @@ -14022,11 +14071,11 @@ export interface ModerationCustomActionEvent { * The ID of the custom action that was executed */ action_id: string; - created_at: Date; + created_at: TimestampNS; custom: Record; review_queue_item: ReviewQueueItemResponse; type: string; - received_at?: Date; + received_at?: TimestampNS; /** * Additional options passed to the custom action */ @@ -14049,23 +14098,29 @@ export interface ModerationDashboardPreferences { flag_user_on_flagged_content?: boolean; include_attachment_payload?: boolean; media_queue_blur_enabled?: boolean; + text_redaction_enabled?: boolean; allowed_moderation_action_reasons?: Array; escalation_reasons?: Array; filterable_custom_keys?: Array; keyframe_classifications_map?: Record>; + media_label_display?: Record; overview_dashboard?: OverviewDashboardConfig; } export interface ModerationFlagResponse { - created_at: Date; + created_at: TimestampNS; entity_id: string; entity_type: string; type: string; - updated_at: Date; + updated_at: TimestampNS; user_id: string; result: Array>; - content_published_at?: Date; + content_published_at?: TimestampNS; entity_creator_id?: string; + /** + * Unique identifier of the flag + */ + id?: string; reason?: string; review_queue_item_id?: string; labels?: Array; @@ -14086,18 +14141,18 @@ export interface ModerationFlaggedEvent { * The type of content that was flagged */ content_type: string; - created_at: Date; + created_at: TimestampNS; /** * The ID of the flagged content */ object_id: string; custom: Record; type: string; - received_at?: Date; + received_at?: TimestampNS; } export interface ModerationImageAnalysisCompleteEvent { - created_at: Date; + created_at: TimestampNS; type: string; /** * The moderation policy key that was applied. @@ -14115,7 +14170,7 @@ export interface ModerationImageAnalysisCompleteEvent { * Echo of the `entity_type` on the /analyze request. */ entity_type?: string; - received_at?: Date; + received_at?: TimestampNS; /** * Review queue row ID for deep-linking into the dashboard. */ @@ -14135,11 +14190,11 @@ export interface ModerationImageAnalysisCompleteEvent { } export interface ModerationMarkReviewedEvent { - created_at: Date; + created_at: TimestampNS; custom: Record; item: ReviewQueueItemResponse; type: string; - received_at?: Date; + received_at?: TimestampNS; /** * Represents any chat message */ @@ -14227,14 +14282,14 @@ export interface ModerationPayloadResponse { } export interface ModerationQueueResponse { - created_at: Date; + created_at: TimestampNS; created_by: string; description: string; id: string; item_count: number; name: string; type: string; - updated_at: Date; + updated_at: TimestampNS; sort: Array>; filters: Record; } @@ -14266,14 +14321,14 @@ export interface ModerationRuleInfo { } export interface ModerationRuleV2Response { - created_at: Date; + created_at: TimestampNS; description: string; enabled: boolean; id: string; name: string; rule_type: string; team: string; - updated_at: Date; + updated_at: TimestampNS; config_keys: Array; cooldown_period?: string; logic?: string; @@ -14284,7 +14339,7 @@ export interface ModerationRuleV2Response { } export interface ModerationRulesTriggeredEvent { - created_at: Date; + created_at: TimestampNS; /** * The ID of the entity that triggered the rule */ @@ -14304,7 +14359,7 @@ export interface ModerationRulesTriggeredEvent { custom: Record; rule: ModerationRuleInfo; type: string; - received_at?: Date; + received_at?: TimestampNS; /** * The review queue item ID if applicable */ @@ -14321,7 +14376,7 @@ export interface ModerationRulesTriggeredEvent { } export interface ModerationTextAnalysisCompleteEvent { - created_at: Date; + created_at: TimestampNS; type: string; /** * The moderation policy key that was applied. @@ -14339,7 +14394,7 @@ export interface ModerationTextAnalysisCompleteEvent { * Echo of the `entity_type` on the /analyze request. */ entity_type?: string; - received_at?: Date; + received_at?: TimestampNS; /** * Review queue row ID for deep-linking into the dashboard. */ @@ -14499,7 +14554,7 @@ export interface NotificationFeedUpdatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * The ID of the feed */ @@ -14510,7 +14565,7 @@ export interface NotificationFeedUpdatedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; /** * Aggregated activities for notification feeds */ @@ -14523,7 +14578,7 @@ export interface NotificationMarkUnreadEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; custom: Record; /** * The type of event: "notification.mark_unread" in this case @@ -14553,12 +14608,12 @@ export interface NotificationMarkUnreadEvent { /** * The time when the channel/thread was marked as unread */ - last_read_at?: Date; + last_read_at?: TimestampNS; /** * The ID of the last read message */ last_read_message_id?: string; - received_at?: Date; + received_at?: TimestampNS; /** * The team ID */ @@ -14647,11 +14702,11 @@ export interface NotificationStatusResponse { /** * When notifications were last read */ - last_read_at?: Date; + last_read_at?: TimestampNS; /** * When notifications were last seen */ - last_seen_at?: Date; + last_seen_at?: TimestampNS; /** * Deprecated: use is_read on each activity/group instead. IDs of activities that have been read. Capped at ~101 entries for aggregated feeds. */ @@ -14699,7 +14754,7 @@ export interface NotificationThreadMessageNewEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; message_id: string; /** * The ID of the thread @@ -14737,7 +14792,7 @@ export interface NotificationThreadMessageNewEvent { */ cid?: string; parent_author?: string; - received_at?: Date; + received_at?: TimestampNS; /** * The team ID */ @@ -14855,7 +14910,7 @@ export type OwnCapability = (typeof OwnCapability)[keyof typeof OwnCapability]; export interface OwnUserResponse { banned: boolean; - created_at: Date; + created_at: TimestampNS; id: string; invisible: boolean; language: string; @@ -14869,7 +14924,7 @@ export interface OwnUserResponse { */ unread_count: number; unread_threads: number; - updated_at: Date; + updated_at: TimestampNS; blocked_user_ids: Array; channel_mutes: Array; devices: Array; @@ -14877,12 +14932,12 @@ export interface OwnUserResponse { teams: Array; custom: Record; avg_response_time?: number; - deactivated_at?: Date; - deleted_at?: Date; + deactivated_at?: TimestampNS; + deleted_at?: TimestampNS; image?: string; - last_active?: Date; + last_active?: TimestampNS; name?: string; - revoke_tokens_issued_before?: Date; + revoke_tokens_issued_before?: TimestampNS; latest_hidden_channels?: Array; /** * The privacy settings of the user. @@ -14934,7 +14989,7 @@ export interface ParticipantCountByMinuteResponse { last: number; max: number; min: number; - start_ts: Date; + start_ts: TimestampNS; } export interface ParticipantCountOverTimeResponse { @@ -14979,9 +15034,9 @@ export interface ParticipantSeriesSubscriptionTrackMetrics { export interface ParticipantSeriesTimeframe { max_points: number; - since: Date; + since: TimestampNS; step_seconds: number; - until: Date; + until: TimestampNS; } export interface ParticipantSeriesTrackMetrics { @@ -15009,15 +15064,15 @@ export interface ParticipantSessionDetails { user_session_id: string; roles: Array; duration_in_seconds?: number; - joined_at?: Date; - left_at?: Date; + joined_at?: TimestampNS; + left_at?: TimestampNS; } export interface PendingMessageEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * The method used for the pending message */ @@ -15027,7 +15082,7 @@ export interface PendingMessageEvent { * The type of event: "message.pending" in this case */ type: string; - received_at?: Date; + received_at?: TimestampNS; /** * Represents channel in chat */ @@ -15080,7 +15135,7 @@ export interface PerformanceAnalysisResponse { unindexed_fields: Array; unindexed_sort_fields: Array; warnings: Array; - last_analyzed?: Date; + last_analyzed?: TimestampNS; scan_type?: string; } @@ -15160,7 +15215,7 @@ export interface PermissionRequest { export interface PermissionRequestEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * The list of permissions requested by the user */ @@ -15191,7 +15246,7 @@ export interface PinActivityResponse { /** * When the activity was pinned */ - created_at: Date; + created_at: TimestampNS; duration: string; /** * Fully qualified ID of the feed the activity was pinned to @@ -15230,11 +15285,11 @@ export interface PlatformDataResponse { export interface Policy { action: number; - created_at: Date; + created_at: TimestampNS; name: string; owner: boolean; priority: number; - updated_at: Date; + updated_at: TimestampNS; resources: Array; roles: Array; } @@ -15273,7 +15328,7 @@ export interface PolicyTestLabelDrift { } export interface PolicyTestResult { - created_at: Date; + created_at: TimestampNS; id: number; message_text: string; row_index: number; @@ -15299,7 +15354,7 @@ export interface PolicyTestRow { export interface PolicyTestRun { config_key: string; - created_at: Date; + created_at: TimestampNS; id: string; rows_completed: number; rows_total: number; @@ -15307,10 +15362,10 @@ export interface PolicyTestRun { status: string; task_id: string; triggered_by: string; - completed_at?: Date; - config_updated_at?: Date; + completed_at?: TimestampNS; + config_updated_at?: TimestampNS; error_message?: string; - started_at?: Date; + started_at?: TimestampNS; metrics?: PolicyTestRunMetrics; } @@ -15342,13 +15397,13 @@ export interface PolicyTestSeedSpec { export interface PolicyTestSet { config_key: string; - created_at: Date; + created_at: TimestampNS; created_by: string; id: string; mode: string; name: string; row_count: number; - updated_at: Date; + updated_at: TimestampNS; team?: string; rows?: Array; last_run?: PolicyTestRun; @@ -15387,7 +15442,7 @@ export interface PollClosedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; custom: Record; poll: PollResponseData; /** @@ -15403,14 +15458,14 @@ export interface PollClosedEvent { * The ID of the message containing the poll */ message_id?: string; - received_at?: Date; + received_at?: TimestampNS; } export interface PollDeletedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; custom: Record; poll: PollResponseData; /** @@ -15426,7 +15481,7 @@ export interface PollDeletedEvent { * The ID of the message containing the poll */ message_id?: string; - received_at?: Date; + received_at?: TimestampNS; } export interface PollOptionInput { @@ -15467,13 +15522,13 @@ export interface PollResponseData { allow_answers: boolean; allow_user_suggested_options: boolean; answers_count: number; - created_at: Date; + created_at: TimestampNS; created_by_id: string; description: string; enforce_unique_vote: boolean; id: string; name: string; - updated_at: Date; + updated_at: TimestampNS; vote_count: number; /** * Voting visibility of the poll @@ -15499,7 +15554,7 @@ export interface PollUpdatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; custom: Record; poll: PollResponseData; /** @@ -15515,14 +15570,14 @@ export interface PollUpdatedEvent { * The ID of the message containing the poll */ message_id?: string; - received_at?: Date; + received_at?: TimestampNS; } export interface PollVoteCastedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; custom: Record; poll: PollResponseData; poll_vote: PollVoteResponseData; @@ -15539,14 +15594,14 @@ export interface PollVoteCastedEvent { * The ID of the message containing the poll */ message_id?: string; - received_at?: Date; + received_at?: TimestampNS; } export interface PollVoteChangedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; custom: Record; poll: PollResponseData; poll_vote: PollVoteResponseData; @@ -15563,14 +15618,14 @@ export interface PollVoteChangedEvent { * The ID of the message containing the poll */ message_id?: string; - received_at?: Date; + received_at?: TimestampNS; } export interface PollVoteRemovedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; custom: Record; poll: PollResponseData; poll_vote: PollVoteResponseData; @@ -15587,7 +15642,7 @@ export interface PollVoteRemovedEvent { * The ID of the message containing the poll */ message_id?: string; - received_at?: Date; + received_at?: TimestampNS; } export interface PollVoteResponse { @@ -15600,11 +15655,11 @@ export interface PollVoteResponse { } export interface PollVoteResponseData { - created_at: Date; + created_at: TimestampNS; id: string; option_id: string; poll_id: string; - updated_at: Date; + updated_at: TimestampNS; answer_text?: string; is_answer?: boolean; user_id?: string; @@ -15646,10 +15701,10 @@ export interface PoorTail { } export interface PredefinedFilterResponse { - created_at: Date; + created_at: TimestampNS; name: string; operation: string; - updated_at: Date; + updated_at: TimestampNS; filter: Record; description?: string; query_id?: number; @@ -15661,7 +15716,7 @@ export interface PredefinedFilterResponse { export interface PredefinedFilterStatsResponse { calls: number; max_latency_ms: number; - last_seen?: Date; + last_seen?: TimestampNS; } export interface PrivacySettingsResponse { @@ -15767,7 +15822,7 @@ export interface PushNotificationFields { export interface PushNotificationSettingsResponse { disabled?: boolean; - disabled_until?: Date; + disabled_until?: TimestampNS; } export interface PushPreferenceInput { @@ -15826,7 +15881,7 @@ export interface PushPreferencesResponse { /** * If provided the notifications will be disabled until the set date. */ - disabled_until?: Date; + disabled_until?: TimestampNS; feeds_level?: string; chat_preferences?: ChatPreferencesResponse; feeds_preferences?: FeedsPreferencesResponse; @@ -15837,10 +15892,10 @@ export interface PushPreferencesResponse { } export interface PushProvider { - created_at: Date; + created_at: TimestampNS; name: string; type: string; - updated_at: Date; + updated_at: TimestampNS; apn_auth_key?: string; apn_auth_type?: string; apn_development?: boolean; @@ -15851,7 +15906,7 @@ export interface PushProvider { apn_team_id?: string; apn_topic?: string; description?: string; - disabled_at?: Date; + disabled_at?: TimestampNS; disabled_reason?: string; firebase_apn_template?: string; firebase_credentials?: string; @@ -15895,10 +15950,10 @@ export interface PushProviderRequest { } export interface PushProviderResponse { - created_at: Date; + created_at: TimestampNS; name: string; type: string; - updated_at: Date; + updated_at: TimestampNS; apn_auth_key?: string; apn_auth_type?: string; apn_development?: boolean; @@ -15911,7 +15966,7 @@ export interface PushProviderResponse { apn_team_id?: string; apn_topic?: string; description?: string; - disabled_at?: Date; + disabled_at?: TimestampNS; disabled_reason?: string; firebase_apn_template?: string; firebase_credentials?: string; @@ -15948,7 +16003,7 @@ export interface PushScheduleResponse { } export interface PushTemplate { - created_at: Date; + created_at: TimestampNS; enable_push: boolean; event_type: | 'message.new' @@ -15961,7 +16016,7 @@ export interface PushTemplate { | 'feeds.comment.reaction.added' | 'feeds.follow.created' | 'feeds.notification_feed.updated'; - updated_at: Date; + updated_at: TimestampNS; template?: string; } @@ -15969,7 +16024,7 @@ export interface PushTemplateResponse { /** * Time when the template was created */ - created_at: Date; + created_at: TimestampNS; /** * Whether push notification is enabled for this event */ @@ -15985,7 +16040,7 @@ export interface PushTemplateResponse { /** * Time when the template was last updated */ - updated_at: Date; + updated_at: TimestampNS; /** * The push notification template */ @@ -16366,8 +16421,8 @@ export interface QueryCallSessionParticipantStatsResponse { duration: string; participants: Array; counts: CallStatsParticipantCounts; - call_ended_at?: Date; - call_started_at?: Date; + call_ended_at?: TimestampNS; + call_started_at?: TimestampNS; next?: string; prev?: string; tmp_data_source?: string; @@ -16420,12 +16475,12 @@ export interface QueryCallStatsMapResponse { */ duration: string; counts: CallStatsParticipantCounts; - call_ended_at?: Date; - call_started_at?: Date; + call_ended_at?: TimestampNS; + call_started_at?: TimestampNS; data_source?: string; - end_time?: Date; - generated_at?: Date; - start_time?: Date; + end_time?: TimestampNS; + generated_at?: TimestampNS; + start_time?: TimestampNS; publishers?: CallStatsMapPublishers; sfus?: CallStatsMapSFUs; subscribers?: CallStatsMapSubscribers; @@ -16794,7 +16849,7 @@ export interface QueryFeedModerationTemplate { /** * When the template was created */ - created_at: Date; + created_at: TimestampNS; /** * Name of the moderation template */ @@ -16802,7 +16857,7 @@ export interface QueryFeedModerationTemplate { /** * When the template was last updated */ - updated_at: Date; + updated_at: TimestampNS; /** * Configuration for a feeds moderation template */ @@ -17889,11 +17944,11 @@ export interface RawRecordingSettingsResponse { export interface Reaction { activity_id: string; - created_at: Date; + created_at: TimestampNS; kind: string; - updated_at: Date; + updated_at: TimestampNS; user_id: string; - deleted_at?: Date; + deleted_at?: TimestampNS; id?: string; parent?: string; score?: number; @@ -17911,7 +17966,7 @@ export interface ReactionDeletedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * Represents channel in chat */ @@ -17942,7 +17997,7 @@ export interface ReactionDeletedEvent { */ cid?: string; message_id?: string; - received_at?: Date; + received_at?: TimestampNS; /** * The team ID */ @@ -17968,11 +18023,11 @@ export interface ReactionGroupResponse { /** * FirstReactionAt is the time of the first reaction of this type. This is the same also if all reaction of this type are deleted, because if someone will react again with the same type, will be preserved the sorting. */ - first_reaction_at: Date; + first_reaction_at: TimestampNS; /** * LastReactionAt is the time of the last reaction of this type. */ - last_reaction_at: Date; + last_reaction_at: TimestampNS; /** * SumScores is the sum of all scores of reactions of this type. Medium allows you to clap articles more than once and shows the sum of all claps from all users. For example, you can send `clap` x5 using `score: 5`. */ @@ -17987,7 +18042,7 @@ export interface ReactionGroupUserResponse { /** * The time when the user reacted. */ - created_at: Date; + created_at: TimestampNS; /** * The ID of the user who reacted. */ @@ -18002,7 +18057,7 @@ export interface ReactionNewEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * Represents channel in chat */ @@ -18033,7 +18088,7 @@ export interface ReactionNewEvent { */ cid?: string; message_id?: string; - received_at?: Date; + received_at?: TimestampNS; /** * The team ID */ @@ -18080,7 +18135,7 @@ export interface ReactionResponse { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * Message ID */ @@ -18096,7 +18151,7 @@ export interface ReactionResponse { /** * Date/time of the last update */ - updated_at: Date; + updated_at: TimestampNS; /** * User ID */ @@ -18115,7 +18170,7 @@ export interface ReactionUpdatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; message_id: string; /** * Represents channel in chat @@ -18150,7 +18205,7 @@ export interface ReactionUpdatedEvent { * The CID of the channel containing the message */ cid?: string; - received_at?: Date; + received_at?: TimestampNS; /** * The team ID */ @@ -18223,13 +18278,13 @@ export interface ReadReceiptsResponse { } export interface ReadStateResponse { - last_read: Date; + last_read: TimestampNS; unread_messages: number; /** * User response object */ user: UserResponse; - last_delivered_at?: Date; + last_delivered_at?: TimestampNS; last_delivered_message_id?: string; last_read_message_id?: string; } @@ -18318,7 +18373,7 @@ export interface ReminderCreatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * The ID of the message for which the reminder was created */ @@ -18337,7 +18392,7 @@ export interface ReminderCreatedEvent { * The ID of the parent message, if the reminder is for a thread message */ parent_id?: string; - received_at?: Date; + received_at?: TimestampNS; } export interface ReminderDeletedEvent { @@ -18348,7 +18403,7 @@ export interface ReminderDeletedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * The ID of the message for which the reminder was created */ @@ -18367,7 +18422,7 @@ export interface ReminderDeletedEvent { * The ID of the parent message, if the reminder is for a thread message */ parent_id?: string; - received_at?: Date; + received_at?: TimestampNS; } export interface ReminderNotificationEvent { @@ -18378,7 +18433,7 @@ export interface ReminderNotificationEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * The ID of the message for which the reminder was created */ @@ -18394,17 +18449,17 @@ export interface ReminderNotificationEvent { */ type: string; parent_id?: string; - received_at?: Date; + received_at?: TimestampNS; } export interface ReminderResponseData { channel_cid: string; - created_at: Date; + created_at: TimestampNS; message_id: string; - updated_at: Date; + updated_at: TimestampNS; user_id: string; - expires_at?: Date; - remind_at?: Date; + expires_at?: TimestampNS; + remind_at?: TimestampNS; /** * Represents channel in chat */ @@ -18427,7 +18482,7 @@ export interface ReminderUpdatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * The ID of the message for which the reminder was created */ @@ -18446,7 +18501,7 @@ export interface ReminderUpdatedEvent { * The ID of the parent message, if the reminder is for a thread message */ parent_id?: string; - received_at?: Date; + received_at?: TimestampNS; } export interface RemoveUserGroupMembersRequest { @@ -18648,7 +18703,7 @@ export interface RestoreUsersRequest { export interface RetentionPolicy { app_pk: number; - enabled_at: Date; + enabled_at: TimestampNS; policy: string; config: PolicyConfig; } @@ -18660,11 +18715,31 @@ export interface RetentionRunResponse { stats: RunStats; } +export interface RevealMediaRequest { + /** + * ID of the review queue item whose media is revealed + */ + item_id: string; + user_id?: string; + /** + * User request object + */ + user?: UserRequest; +} + +export interface RevealMediaResponse { + duration: string; + /** + * Display policy for a review queue item's images and video + */ + media_display: MediaDisplayResponse; +} + export interface ReviewQueueItemNewEvent { - created_at: Date; + created_at: TimestampNS; custom: Record; type: string; - received_at?: Date; + received_at?: TimestampNS; /** * The flags associated with this review queue item */ @@ -18681,7 +18756,7 @@ export interface ReviewQueueItemResponse { /** * When the item was created */ - created_at: Date; + created_at: TimestampNS; /** * ID of the entity being reviewed */ @@ -18719,7 +18794,7 @@ export interface ReviewQueueItemResponse { /** * When the item was last updated */ - updated_at: Date; + updated_at: TimestampNS; /** * Moderation actions taken */ @@ -18736,10 +18811,14 @@ export interface ReviewQueueItemResponse { * Detected languages in the content */ languages: Array; + /** + * Display policy for a review queue item's images and video + */ + media_display: MediaDisplayResponse; /** * When the review was completed */ - completed_at?: Date; + completed_at?: TimestampNS; /** * Highest per-label confidence (0-1) any provider reported across the item's flags; absent when no flag carried one */ @@ -18753,7 +18832,7 @@ export interface ReviewQueueItemResponse { /** * When the item was escalated */ - escalated_at?: Date; + escalated_at?: TimestampNS; /** * ID of the moderator who escalated the item */ @@ -18761,7 +18840,11 @@ export interface ReviewQueueItemResponse { /** * When the item was reviewed */ - reviewed_at?: Date; + reviewed_at?: TimestampNS; + /** + * IDs of the item's flags a moderator marked as false positives + */ + false_positive_flags?: Array; /** * Teams associated with this item */ @@ -18789,10 +18872,10 @@ export interface ReviewQueueItemResponse { } export interface ReviewQueueItemUpdatedEvent { - created_at: Date; + created_at: TimestampNS; custom: Record; type: string; - received_at?: Date; + received_at?: TimestampNS; /** * The flags associated with this review queue item */ @@ -18804,7 +18887,7 @@ export interface ReviewQueueItemUpdatedEvent { export interface RevisionHistoryResponse { action_type: string; actor_type: string; - created_at: Date; + created_at: TimestampNS; object_id: string; object_type: string; user_id: string; @@ -18828,11 +18911,11 @@ export interface RingAttemptResponse { /** * When the ring went out */ - created_at: Date; + created_at: TimestampNS; /** * When the ring expires, i.e. when the missed call deadline fires */ - expires_at: Date; + expires_at: TimestampNS; /** * The user that started the ring */ @@ -18868,11 +18951,11 @@ export interface RingAttemptResponse { /** * When the ring was deleted */ - deleted_at?: Date; + deleted_at?: TimestampNS; /** * When the outcome left ringing */ - settled_at?: Date; + settled_at?: TimestampNS; } export interface RingCallRequest { @@ -18910,11 +18993,11 @@ export interface RingDeliveryResponse { /** * When the ring was dispatched */ - sent_at: Date; + sent_at: TimestampNS; /** * When the device acknowledged the ring; not populated yet */ - acked_at?: Date; + acked_at?: TimestampNS; /** * The device the ring was dispatched to, empty for websocket deliveries which fan out to every connection */ @@ -18922,15 +19005,15 @@ export interface RingDeliveryResponse { /** * When the device displayed the ring; not populated yet */ - displayed_at?: Date; + displayed_at?: TimestampNS; /** * When the device fetched the call; not populated yet */ - fetched_at?: Date; + fetched_at?: TimestampNS; /** * When the push provider accepted the dispatch; not populated yet */ - provider_accepted_at?: Date; + provider_accepted_at?: TimestampNS; } export interface RingSettings { @@ -18962,7 +19045,7 @@ export interface RingSettingsResponse { export interface RingSettledTarget { state: string; - state_at: Date; + state_at: TimestampNS; reason?: string; } @@ -18978,7 +19061,7 @@ export interface RingTargetResponse { /** * When the target last changed state */ - state_at: Date; + state_at: TimestampNS; /** * The dispatches of this ring to the target's devices */ @@ -18989,7 +19072,7 @@ export interface Role { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * Whether this is a custom role or built-in */ @@ -19001,7 +19084,7 @@ export interface Role { /** * Date/time of the last update */ - updated_at: Date; + updated_at: TimestampNS; /** * List of scopes where this role is currently present. `.app` means that role is present in app-level grants */ @@ -19358,7 +19441,7 @@ export interface SIPInboundRoutingRuleResponse { /** * Creation timestamp */ - created_at: Date; + created_at: TimestampNS; duration: string; /** * Unique identifier of the SIP Inbound Routing Rule @@ -19371,7 +19454,7 @@ export interface SIPInboundRoutingRuleResponse { /** * Last update timestamp */ - updated_at: Date; + updated_at: TimestampNS; /** * List of called numbers */ @@ -19448,7 +19531,7 @@ export interface SIPTrunkResponse { /** * Creation timestamp */ - created_at: Date; + created_at: TimestampNS; /** * Unique identifier for the SIP trunk */ @@ -19464,7 +19547,7 @@ export interface SIPTrunkResponse { /** * Last update timestamp */ - updated_at: Date; + updated_at: TimestampNS; /** * The URI for the SIP trunk */ @@ -19539,7 +19622,7 @@ export interface ScheduledMessageContentResponse { /** * Date/time the pin expires */ - pin_expires?: Date; + pin_expires?: TimestampNS; /** * Whether the message will be pinned when sent */ @@ -19591,7 +19674,7 @@ export interface ScheduledMessageFailedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; custom: Record; user: UserResponseCommonFields; /** @@ -19602,7 +19685,7 @@ export interface ScheduledMessageFailedEvent { * The CID of the channel the message is scheduled in */ cid?: string; - received_at?: Date; + received_at?: TimestampNS; /** * A message scheduled to be sent later */ @@ -19618,7 +19701,7 @@ export interface ScheduledMessageLocation { * The date when the location sharing ends. * If it's empty, it means the location sharing is static instead of live. */ - end_at?: Date; + end_at?: TimestampNS; /** * The latitude of the location. */ @@ -19637,7 +19720,7 @@ export interface ScheduledMessageResponse { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * Unique identifier of the scheduled message */ @@ -19645,7 +19728,7 @@ export interface ScheduledMessageResponse { /** * Date/time the message is scheduled to be sent */ - scheduled_at: Date; + scheduled_at: TimestampNS; /** * Status of the scheduled message. One of: scheduled, sending, failed, canceled, sent. A message is sending from its first send attempt until it is sent or fails, including while it waits to retry a failed attempt; it cannot be edited, canceled or sent now while sending */ @@ -19653,7 +19736,7 @@ export interface ScheduledMessageResponse { /** * Date/time of the last update */ - updated_at: Date; + updated_at: TimestampNS; /** * The message a scheduled message will send */ @@ -19676,7 +19759,7 @@ export interface ScheduledMessageSentEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * The ID of the message that was sent */ @@ -19691,7 +19774,7 @@ export interface ScheduledMessageSentEvent { * The CID of the channel the message was sent to */ cid?: string; - received_at?: Date; + received_at?: TimestampNS; /** * A message scheduled to be sent later */ @@ -19793,7 +19876,7 @@ export interface SearchResult { export interface SearchResultMessage { cid: string; - created_at: Date; + created_at: TimestampNS; deleted_reply_count: number; html: string; id: string; @@ -19805,7 +19888,7 @@ export interface SearchResultMessage { silent: boolean; text: string; type: string; - updated_at: Date; + updated_at: TimestampNS; attachments: Array; latest_reactions: Array; mentioned_users: Array; @@ -19819,13 +19902,13 @@ export interface SearchResultMessage { */ user: UserResponse; command?: string; - deleted_at?: Date; + deleted_at?: TimestampNS; deleted_for_me?: boolean; - message_text_updated_at?: Date; + message_text_updated_at?: TimestampNS; mml?: string; parent_id?: string; - pin_expires?: Date; - pinned_at?: Date; + pin_expires?: TimestampNS; + pinned_at?: TimestampNS; poll_id?: string; quoted_message_id?: string; show_in_channel?: boolean; @@ -19895,13 +19978,13 @@ export interface SearchWarning { export interface Segment { all_sender_channels: boolean; all_users: boolean; - created_at: Date; + created_at: TimestampNS; id: string; name: string; size: number; type: string; - updated_at: Date; - deleted_at?: Date; + updated_at: TimestampNS; + deleted_at?: TimestampNS; description?: string; task_id?: string; filter?: Record; @@ -19910,20 +19993,20 @@ export interface Segment { export interface SegmentResponse { all_sender_channels: boolean; all_users: boolean; - created_at: Date; - deleted_at: Date; + created_at: TimestampNS; + deleted_at: TimestampNS; description: string; id: string; name: string; size: number; type: string; - updated_at: Date; + updated_at: TimestampNS; filter: Record; } export interface SegmentTargetResponse { app_pk: number; - created_at: Date; + created_at: TimestampNS; segment_id: string; target_id: string; } @@ -20093,7 +20176,7 @@ export interface SessionSettingsResponse { export interface SessionWarningResponse { code: string; warning: string; - time?: Date; + time?: TimestampNS; } export interface SetFeedsRetentionPolicyRequest { @@ -20126,12 +20209,12 @@ export interface SetRetentionPolicyResponse { } export interface SetupSession { - created_at: Date; + created_at: TimestampNS; current_step: string; status: string; - updated_at: Date; + updated_at: TimestampNS; setup_data: Record; - completed_at?: Date; + completed_at?: TimestampNS; } export interface ShadowBlockActionRequestPayload { @@ -20149,7 +20232,7 @@ export interface ShareResponse { /** * When the share occurred */ - created_at: Date; + created_at: TimestampNS; /** * User response object */ @@ -20171,7 +20254,7 @@ export interface SharedLocationResponse { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * Device ID that created the live location */ @@ -20192,7 +20275,7 @@ export interface SharedLocationResponse { /** * Date/time of the last update */ - updated_at: Date; + updated_at: TimestampNS; /** * User ID */ @@ -20200,7 +20283,7 @@ export interface SharedLocationResponse { /** * Time when the live location expires */ - end_at?: Date; + end_at?: TimestampNS; /** * Represents channel in chat */ @@ -20219,7 +20302,7 @@ export interface SharedLocationResponseData { /** * The date when the location was created. */ - created_at: Date; + created_at: TimestampNS; /** * The ID of the device that created the location. */ @@ -20239,7 +20322,7 @@ export interface SharedLocationResponseData { /** * The date when the location was updated. */ - updated_at: Date; + updated_at: TimestampNS; /** * The ID of the user that created the location. */ @@ -20248,7 +20331,7 @@ export interface SharedLocationResponseData { * The date when the location sharing ends. * If it's empty, it means the location sharing is static instead of live. */ - end_at?: Date; + end_at?: TimestampNS; /** * Represents channel in chat */ @@ -20636,7 +20719,7 @@ export interface StoriesFeedUpdatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * The ID of the feed */ @@ -20647,7 +20730,7 @@ export interface StoriesFeedUpdatedEvent { */ type: string; feed_visibility?: string; - received_at?: Date; + received_at?: TimestampNS; /** * Individual activities for stories feeds */ @@ -20793,23 +20876,46 @@ export interface SubmitActionResponse { item?: ReviewQueueItemResponse; } -export interface SubmitModerationFeedbackRequest { +export interface SubmitModerationFeedbackItem { /** - * The moderated content the moderator is providing feedback on + * Action originally produced for this item */ - message: string; + current_recommended_action?: string; + /** + * ID of the moderation flag the feedback is about + */ + flag_id?: string; + /** + * Image URL, required for kind=image + */ + image_url?: string; + /** + * Content kind: text or image + */ + kind?: 'text' | 'image'; + /** + * Identifies this piece of content within the entity (keyframe ID, caption ID, message ID, title, description, thumbnail, ...) + */ + reference?: string; /** - * Original publication time of the moderated content (RFC3339) + * Text content, for kind=text */ - published_at: string; + text?: string; /** - * Provider-side reference identifying the moderated content + * Classifications originally produced for this item */ - reference: string; + current_labels?: Array; +} + +export interface SubmitModerationFeedbackRequest { /** * Optional moderation channel UUID for context */ channel_id?: string; + /** + * Moderator's confidence in this feedback (LOW, MEDIUM, HIGH, VERY_HIGH); forwarded to the moderation provider. Optional + */ + confidence?: 'LOW' | 'MEDIUM' | 'HIGH' | 'VERY_HIGH'; /** * Action originally produced by the moderation system */ @@ -20818,10 +20924,47 @@ export interface SubmitModerationFeedbackRequest { * Optional free-form note explaining why the classification was wrong */ description?: string; + /** + * ID of the user who created the entity + */ + entity_creator_id?: string; + /** + * ID of the entity the items belong to + */ + entity_id?: string; + /** + * Type of the entity the items belong to + */ + entity_type?: string; /** * Optional moderator-supplied action */ expected_recommended_action?: string; + /** + * Whether the referenced flags are marked (true, default) or unmarked (false) as false positives + */ + false_positive?: boolean; + /** + * false_positive (default) disputes existing detections; false_negative reports missed content: items carry the content, expected_labels is required and flag_id is not allowed + */ + feedback_type?: 'false_positive' | 'false_negative'; + /** + * The moderated content the moderator is providing feedback on. Required unless items is provided + */ + message?: string; + /** + * Original publication time of the moderated content (RFC3339). Required unless items is provided + */ + published_at?: string; + /** + * Provider-side reference identifying the moderated content. Required unless items is provided + */ + reference?: string; + /** + * Review queue item the feedback targets, as an alternative to entity_type and entity_id + */ + review_queue_item_id?: string; + user_id?: string; /** * Classifications originally produced by the moderation system */ @@ -20830,10 +20973,34 @@ export interface SubmitModerationFeedbackRequest { * Optional moderator-supplied classifications (up to 16 entries) */ expected_labels?: Array; + /** + * Pieces of content of one entity the feedback is about (1 to 50) + */ + items?: Array; + /** + * User request object + */ + user?: UserRequest; } export interface SubmitModerationFeedbackResponse { duration: string; + /** + * ID of the first stored feedback item, when any was stored + */ + feedback_id?: string; + /** + * Review queue item the feedback was applied to + */ + review_queue_item_id?: string; + /** + * IDs of the item's flags marked as false positives after this request + */ + false_positive_flags?: Array; + /** + * IDs of the stored feedback items, one per submitted item + */ + feedback_item_ids?: Array; } export interface SubscriberAllMetrics { @@ -20975,14 +21142,14 @@ export interface ThreadParticipant { /** * Date/time of creation */ - created_at: Date; - last_read_at: Date; + created_at: TimestampNS; + last_read_at: TimestampNS; custom: Record; - last_thread_message_at?: Date; + last_thread_message_at?: TimestampNS; /** * Left Thread At is the time when the user left the thread */ - left_thread_at?: Date; + left_thread_at?: TimestampNS; /** * Thead ID is unique string identifier of the thread */ @@ -21009,7 +21176,7 @@ export interface ThreadResponse { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * Created By User ID */ @@ -21033,7 +21200,7 @@ export interface ThreadResponse { /** * Date/time of the last update */ - updated_at: Date; + updated_at: TimestampNS; /** * Custom data for this object */ @@ -21041,11 +21208,11 @@ export interface ThreadResponse { /** * Deleted At */ - deleted_at?: Date; + deleted_at?: TimestampNS; /** * Last Message At */ - last_message_at?: Date; + last_message_at?: TimestampNS; /** * Thread Participants */ @@ -21076,7 +21243,7 @@ export interface ThreadStateResponse { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * Created By User ID */ @@ -21100,7 +21267,7 @@ export interface ThreadStateResponse { /** * Date/time of the last update */ - updated_at: Date; + updated_at: TimestampNS; latest_replies: Array; /** * Custom data for this object @@ -21109,11 +21276,11 @@ export interface ThreadStateResponse { /** * Deleted At */ - deleted_at?: Date; + deleted_at?: TimestampNS; /** * Last Message At */ - last_message_at?: Date; + last_message_at?: TimestampNS; read?: Array; /** * Thread Participants @@ -21135,20 +21302,20 @@ export interface ThreadStateResponse { } export interface ThreadUpdatedEvent { - created_at: Date; + created_at: TimestampNS; custom: Record; type: string; channel_id?: string; channel_type?: string; cid?: string; - received_at?: Date; + received_at?: TimestampNS; thread?: ThreadResponse; } export interface ThreadedCommentResponse { bookmark_count: number; confidence_score: number; - created_at: Date; + created_at: TimestampNS; downvote_count: number; hidden: boolean; id: string; @@ -21161,7 +21328,7 @@ export interface ThreadedCommentResponse { * Status of the comment. One of: active, deleted, removed, hidden */ status: 'active' | 'deleted' | 'removed' | 'hidden' | 'shadow_blocked'; - updated_at: Date; + updated_at: TimestampNS; upvote_count: number; mentioned_users: Array; own_reactions: Array; @@ -21170,8 +21337,8 @@ export interface ThreadedCommentResponse { */ user: UserResponse; controversy_score?: number; - deleted_at?: Date; - edited_at?: Date; + deleted_at?: TimestampNS; + edited_at?: TimestampNS; parent_id?: string; text?: string; attachments?: Array; @@ -21680,7 +21847,7 @@ export interface UnblockUsersResponse { export interface UnblockedUserEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * User response object */ @@ -21847,7 +22014,7 @@ export interface UnreadCountsChannel { /** * The date which the current user last read the channel. */ - last_read: Date; + last_read: TimestampNS; /** * The number of unread messages inside the channel. */ @@ -21882,7 +22049,7 @@ export interface UnreadCountsThread { /** * The date which the current user last read the thread. */ - last_read: Date; + last_read: TimestampNS; /** * The id of the last reply which the current user read in the thread. */ @@ -22290,7 +22457,7 @@ export interface UpdateCallTypeResponse { /** * the time the call type was created */ - created_at: Date; + created_at: TimestampNS; duration: string; /** * the name of the call type @@ -22299,7 +22466,7 @@ export interface UpdateCallTypeResponse { /** * the time the call type was last updated */ - updated_at: Date; + updated_at: TimestampNS; /** * the permissions granted to each role */ @@ -22504,7 +22671,7 @@ export interface UpdateChannelTypeResponse { automod_behavior: 'flag' | 'block' | 'shadow_block'; connect_events: boolean; count_messages: boolean; - created_at: Date; + created_at: TimestampNS; custom_events: boolean; delivery_events: boolean; /** @@ -22527,7 +22694,7 @@ export interface UpdateChannelTypeResponse { shared_locations: boolean; skip_last_msg_update_for_system_msgs: boolean; typing_events: boolean; - updated_at: Date; + updated_at: TimestampNS; uploads: boolean; url_enrichment: boolean; user_message_reminders: boolean; @@ -23437,7 +23604,7 @@ export interface UpdateUsersResponse { export interface UpdatedCallPermissionsEvent { call_cid: string; - created_at: Date; + created_at: TimestampNS; /** * The capabilities of the current user */ @@ -23765,7 +23932,7 @@ export interface UpsertModerationTemplateResponse { /** * When the template was created */ - created_at: Date; + created_at: TimestampNS; duration: string; /** * Name of the moderation template @@ -23774,7 +23941,7 @@ export interface UpsertModerationTemplateResponse { /** * When the template was last updated */ - updated_at: Date; + updated_at: TimestampNS; /** * Configuration for a feeds moderation template */ @@ -23903,7 +24070,7 @@ export interface UserBannedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; custom: Record; user: UserResponseCommonFields; /** @@ -23927,12 +24094,12 @@ export interface UserBannedEvent { /** * The expiration date of the ban */ - expiration?: Date; + expiration?: TimestampNS; /** * The reason for the ban */ reason?: string; - received_at?: Date; + received_at?: TimestampNS; /** * ID of the review queue item (flagged message) that triggered the ban, if the ban was applied from the moderation review queue */ @@ -23979,14 +24146,14 @@ export interface UserDeactivatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; custom: Record; user: UserResponseCommonFields; /** * The type of event: "user.deactivated" in this case */ type: string; - received_at?: Date; + received_at?: TimestampNS; created_by?: UserResponseCommonFields; } @@ -23994,7 +24161,7 @@ export interface UserDeletedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * The type of deletion that was used for the user's conversations. One of: hard, soft, pruning, (empty string) */ @@ -24025,7 +24192,7 @@ export interface UserDeletedEvent { * The type of event: "user.deleted" in this case */ type: string; - received_at?: Date; + received_at?: TimestampNS; } export interface UserFeedbackReport { @@ -24053,7 +24220,7 @@ export interface UserFlaggedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * The reason for the flag */ @@ -24067,7 +24234,7 @@ export interface UserFlaggedEvent { * The type of event: "user.flagged" in this case */ type: string; - received_at?: Date; + received_at?: TimestampNS; /** * Custom data */ @@ -24077,10 +24244,10 @@ export interface UserFlaggedEvent { export interface UserGroup { app_pk: number; - created_at: Date; + created_at: TimestampNS; id: string; name: string; - updated_at: Date; + updated_at: TimestampNS; created_by?: string; description?: string; team_id?: string; @@ -24091,13 +24258,13 @@ export interface UserGroupCreatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; custom: Record; /** * The type of event: "user_group.created" in this case */ type: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; user_group?: UserGroup; } @@ -24106,20 +24273,20 @@ export interface UserGroupDeletedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; custom: Record; /** * The type of event: "user_group.deleted" in this case */ type: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; user_group?: UserGroup; } export interface UserGroupMember { app_pk: number; - created_at: Date; + created_at: TimestampNS; group_id: string; is_admin: boolean; user_id: string; @@ -24129,7 +24296,7 @@ export interface UserGroupMemberAddedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * The user IDs that were added */ @@ -24139,7 +24306,7 @@ export interface UserGroupMemberAddedEvent { * The type of event: "user_group.member_added" in this case */ type: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; user_group?: UserGroup; } @@ -24148,7 +24315,7 @@ export interface UserGroupMemberRemovedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * The user IDs that were removed */ @@ -24158,16 +24325,16 @@ export interface UserGroupMemberRemovedEvent { * The type of event: "user_group.member_removed" in this case */ type: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; user_group?: UserGroup; } export interface UserGroupResponse { - created_at: Date; + created_at: TimestampNS; id: string; name: string; - updated_at: Date; + updated_at: TimestampNS; created_by?: string; description?: string; team_id?: string; @@ -24178,13 +24345,13 @@ export interface UserGroupUpdatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; custom: Record; /** * The type of event: "user_group.updated" in this case */ type: string; - received_at?: Date; + received_at?: TimestampNS; user?: UserResponseCommonFields; user_group?: UserGroup; } @@ -24216,7 +24383,7 @@ export interface UserMessagesDeletedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; custom: Record; user: UserResponseCommonFields; /** @@ -24241,7 +24408,7 @@ export interface UserMessagesDeletedEvent { * Whether Messages were hard deleted */ hard_delete?: boolean; - received_at?: Date; + received_at?: TimestampNS; /** * The team of the channel where the target user's messages were deleted */ @@ -24250,9 +24417,9 @@ export interface UserMessagesDeletedEvent { } export interface UserMuteResponse { - created_at: Date; - updated_at: Date; - expires?: Date; + created_at: TimestampNS; + updated_at: TimestampNS; + expires?: TimestampNS; /** * User response object */ @@ -24267,14 +24434,14 @@ export interface UserMutedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; custom: Record; user: UserResponseCommonFields; /** * The type of event: "user.muted" in this case */ type: string; - received_at?: Date; + received_at?: TimestampNS; /** * The target users that were muted */ @@ -24297,14 +24464,14 @@ export interface UserReactivatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; custom: Record; user: UserResponseCommonFields; /** * The type of event: "user.reactivated" in this case */ type: string; - received_at?: Date; + received_at?: TimestampNS; created_by?: UserResponseCommonFields; } @@ -24353,7 +24520,7 @@ export interface UserResponse { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * Unique user identifier */ @@ -24378,7 +24545,7 @@ export interface UserResponse { /** * Date/time of the last update */ - updated_at: Date; + updated_at: TimestampNS; blocked_user_ids: Array; /** * List of teams user is a part of @@ -24392,21 +24559,21 @@ export interface UserResponse { /** * Date when ban expires */ - ban_expires?: Date; + ban_expires?: TimestampNS; bypass_moderation?: boolean; /** * Date of deactivation */ - deactivated_at?: Date; + deactivated_at?: TimestampNS; /** * Date/time of deletion */ - deleted_at?: Date; + deleted_at?: TimestampNS; image?: string; /** * Date of last activity */ - last_active?: Date; + last_active?: TimestampNS; /** * Optional name of user */ @@ -24414,7 +24581,7 @@ export interface UserResponse { /** * Revocation date for tokens */ - revoke_tokens_issued_before?: Date; + revoke_tokens_issued_before?: TimestampNS; /** * List of devices user is using */ @@ -24429,44 +24596,44 @@ export interface UserResponse { export interface UserResponseCommonFields { banned: boolean; - created_at: Date; + created_at: TimestampNS; id: string; language: string; online: boolean; role: string; - updated_at: Date; + updated_at: TimestampNS; blocked_user_ids: Array; teams: Array; custom: Record; avg_response_time?: number; - deactivated_at?: Date; - deleted_at?: Date; + deactivated_at?: TimestampNS; + deleted_at?: TimestampNS; image?: string; - last_active?: Date; + last_active?: TimestampNS; name?: string; - revoke_tokens_issued_before?: Date; + revoke_tokens_issued_before?: TimestampNS; teams_role?: Record; } export interface UserResponsePrivacyFields { banned: boolean; - created_at: Date; + created_at: TimestampNS; id: string; language: string; online: boolean; role: string; - updated_at: Date; + updated_at: TimestampNS; blocked_user_ids: Array; teams: Array; custom: Record; avg_response_time?: number; - deactivated_at?: Date; - deleted_at?: Date; + deactivated_at?: TimestampNS; + deleted_at?: TimestampNS; image?: string; invisible?: boolean; - last_active?: Date; + last_active?: TimestampNS; name?: string; - revoke_tokens_issued_before?: Date; + revoke_tokens_issued_before?: TimestampNS; /** * The privacy settings of the user. */ @@ -24487,7 +24654,7 @@ export interface UserUnbannedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; custom: Record; user: UserResponseCommonFields; /** @@ -24508,7 +24675,7 @@ export interface UserUnbannedEvent { * The CID of the channel where the target user was unbanned */ cid?: string; - received_at?: Date; + received_at?: TimestampNS; /** * Whether the target user was shadow unbanned */ @@ -24525,14 +24692,14 @@ export interface UserUnmutedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; custom: Record; user: UserResponseCommonFields; /** * The type of event: "user.unmuted" in this case */ type: string; - received_at?: Date; + received_at?: TimestampNS; /** * The target users that were unmuted */ @@ -24544,7 +24711,7 @@ export interface UserUnreadReminderEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; /** * The channels with unread messages */ @@ -24555,21 +24722,21 @@ export interface UserUnreadReminderEvent { * The type of event: "user.unread_message_reminder" in this case */ type: string; - received_at?: Date; + received_at?: TimestampNS; } export interface UserUpdatedEvent { /** * Date/time of creation */ - created_at: Date; + created_at: TimestampNS; custom: Record; user: UserResponsePrivacyFields; /** * The type of event: "user.updated" in this case */ type: string; - received_at?: Date; + received_at?: TimestampNS; } export interface ValidateExternalStorageResponse { @@ -24902,12 +25069,12 @@ export interface WHIPIngress { } export interface WSEvent { - created_at: Date; + created_at: TimestampNS; type: string; custom: Record; automoderation?: boolean; channel_id?: string; - channel_last_message_at?: Date; + channel_last_message_at?: TimestampNS; channel_type?: string; cid?: string; connection_id?: string; diff --git a/src/gen/models/timestamp-guard.ts b/src/gen/models/timestamp-guard.ts new file mode 100644 index 0000000..966c56a --- /dev/null +++ b/src/gen/models/timestamp-guard.ts @@ -0,0 +1,27 @@ +import type { TimestampNS } from './index'; + +/** + * Makes `new Date(ns)` a deprecated constructor, and a compile error for a server-sent nanosecond timestamp. + * + * Any tsconfig whose `include` covers this directory picks this file up; `exclude` it to defer. + * + * The `0 extends 1 & T` guard excludes `any`. Without it this overload would capture + * every `new Date()` in the program -- `any` is assignable to the brand, and a + * merged declaration is tried before lib.es5.d.ts -- breaking each `JSON.parse` path + * and index-signature read on the next regeneration. + */ +declare global { + interface DateConstructor { + /** + * @deprecated Unix nanoseconds, not milliseconds. Use SDK's provided nsToDate(t), or nsToMs(t) for arithmetic. + */ + new ( + t: 0 extends 1 & T ? never : T, + ): { + readonly ERROR_use_SDKs_nsToDate_helper_instead: never; + }; + } +} + +// Keeps this a module, which `declare global` requires, independent of the import above. +export {}; diff --git a/src/gen/moderation/ModerationApi.ts b/src/gen/moderation/ModerationApi.ts index 4667a9f..22cf529 100644 --- a/src/gen/moderation/ModerationApi.ts +++ b/src/gen/moderation/ModerationApi.ts @@ -66,6 +66,8 @@ import { QueryReviewQueueResponse, QueueResponse, Response, + RevealMediaRequest, + RevealMediaResponse, SubmitActionRequest, SubmitActionResponse, SubmitModerationFeedbackRequest, @@ -1211,6 +1213,28 @@ export class ModerationApi { return response; } + async revealMedia( + request: RevealMediaRequest, + ): Promise> { + const body = { + item_id: request?.item_id, + user_id: request?.user_id, + user: request?.user, + }; + + const response = await this.apiClient.sendRequest( + 'POST', + '/api/v2/moderation/reveal_media', + undefined, + undefined, + body, + ); + + decoders['RevealMediaResponse']?.(response); + + return response; + } + async queryReviewQueue( request?: QueryReviewQueueRequest, ): Promise> { @@ -1344,18 +1368,28 @@ export class ModerationApi { } async submitModerationFeedback( - request: SubmitModerationFeedbackRequest, + request?: SubmitModerationFeedbackRequest, ): Promise> { const body = { - message: request?.message, - published_at: request?.published_at, - reference: request?.reference, channel_id: request?.channel_id, + confidence: request?.confidence, current_recommended_action: request?.current_recommended_action, description: request?.description, + entity_creator_id: request?.entity_creator_id, + entity_id: request?.entity_id, + entity_type: request?.entity_type, expected_recommended_action: request?.expected_recommended_action, + false_positive: request?.false_positive, + feedback_type: request?.feedback_type, + message: request?.message, + published_at: request?.published_at, + reference: request?.reference, + review_queue_item_id: request?.review_queue_item_id, + user_id: request?.user_id, current_labels: request?.current_labels, expected_labels: request?.expected_labels, + items: request?.items, + user: request?.user, }; const response = diff --git a/src/utils/time.ts b/src/utils/time.ts new file mode 100644 index 0000000..99d0e9e --- /dev/null +++ b/src/utils/time.ts @@ -0,0 +1,84 @@ +/** + * Unit conversions between the API's timestamps and JavaScript's. + * + * **The invariant this module exists to hold:** a timestamp is a unix-**nanosecond** `number` — + * that is what the API puts on the wire and what every server-sent date field on a generated + * response or event type carries. A duration, interval or delay stays in **milliseconds**, because + * that is what `setTimeout` and `ApiConfig.timeout` speak. + * + * Two consequences make the helpers below mandatory rather than convenient: + * + * - **Every `Date`-based path is out of range.** `Date` tops out around 8.64e15 ms while a current + * nanosecond timestamp is ~1.79e18, so a bare wire number read as milliseconds lands on an + * invalid instance: `new Date(ns).toISOString()` throws `RangeError`, and a date library handed + * the same number formats it as the literal string `'Invalid Date'`. Neither is a type error. + * - **A unit mix-up between two `number`s is the silent one.** Comparing a wire timestamp against + * `Date.now()`, or adding a millisecond duration to one, produces a plausible-looking number and + * no complaint at all. + * + * Outgoing **request** date fields are unaffected: they are still typed `Date`, because + * `JSON.stringify` emits RFC3339 for a `Date` and that is the format the request spec declares. + * Use {@link nsToDate} when handing a server-sent timestamp back to the API. + * + * Precision note: nanosecond epoch values exceed `Number.MAX_SAFE_INTEGER` (~9.01e15), so they are + * quantised to roughly 256 ns steps. Ordering is unaffected; exact equality against a value that + * has round-tripped through JSON is not guaranteed. + */ + +/** Nanoseconds per millisecond — the only magic number in this module. */ +export const NS_PER_MS = 1e6; + +/** A wire timestamp as epoch milliseconds, for arithmetic against `Date.now()` or a `Date`. */ +export const nsToMs = (ns: number): number => Math.floor(ns / NS_PER_MS); + +/** Epoch milliseconds as a wire timestamp. */ +export const msToNs = (ms: number): number => ms * NS_PER_MS; + +/** + * The local clock as a wire-comparable timestamp, for building API-shaped objects. + * + * Millisecond resolution, so two calls within the same millisecond produce equal timestamps. + * Callers that order by timestamp must tie-break on something else. + */ +export const nowNs = (): number => msToNs(Date.now()); + +/** A wire timestamp as a `Date`, for request payloads and date libraries. */ +export const nsToDate = (ns: number): Date => new Date(nsToMs(ns)); + +/** + * A wire timestamp as a nanosecond-precision RFC3339 string, for an outgoing request date field. + * {@link nsToDate} is lossy here — `Date` holds only milliseconds. + */ +export const nsToRfc3339 = (ns: number): string => { + const ms = nsToMs(ns); + const subMs = String(ns - ms * NS_PER_MS).padStart(6, '0'); + return new Date(ms).toISOString().replace(/\.(\d{3})Z$/, `.$1${subMs}Z`); +}; + +/** A `Date` as a wire timestamp. */ +export const dateToNs = (date: Date): number => msToNs(date.getTime()); + +/** + * A server-sent timestamp as a `Date`, or `undefined` when there is none. + * + * The guarded companion to {@link nsToDate}, for the boundary where a wire timestamp becomes + * something a date library or a caller consumes. Use {@link nsToDate} when the value is known to + * be present; use this when it comes straight off a response, an event or persisted state. + * + * The guard is the whole point, and it covers two cases that are silent rather than loud: + * + * - **Absent.** Many timestamps are optional in practice even where the generated type marks them + * required. `nsToDate(undefined as never)` yields an `Invalid Date`, and `.toISOString()` on one + * throws `RangeError: Invalid time value`. + * - **Not finite.** A malformed payload or a hand-built fixture can produce `NaN`, which reaches + * the same `RangeError` by a different route. + * + * Returning `undefined` rather than throwing lets a caller fall back to whatever it already does + * for a missing timestamp. + */ +export const convertTimestampToDate = ( + timestamp?: number | null, +): Date | undefined => { + if (timestamp == null || !Number.isFinite(timestamp)) return undefined; + return nsToDate(timestamp); +}; diff --git a/tsconfig.test.json b/tsconfig.test.json new file mode 100644 index 0000000..9436123 --- /dev/null +++ b/tsconfig.test.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "noEmit": true, + "types": ["node", "vitest/globals"] + }, + "include": ["./src", "index.ts", "./__tests__"], + "exclude": ["./__tests__/docs-snippets"] +} diff --git a/vite.config.mts b/vite.config.mts index b6a8cf9..babc25f 100644 --- a/vite.config.mts +++ b/vite.config.mts @@ -41,6 +41,11 @@ export default defineConfig({ }, testTimeout: 60000, include: ["__tests__/integration/**/*.test.ts"], + typecheck: { + enabled: true, + tsconfig: "./tsconfig.test.json", + include: ["__tests__/integration/**/*.test.ts"], + }, includeSource: ["src/**/*.ts"], retry: 3, },