Skip to content

Commit

Permalink
Add list options for messages and groups
Browse files Browse the repository at this point in the history
  • Loading branch information
rygine committed Nov 1, 2024
1 parent 48368e6 commit ad0fa8e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sdks/browser-sdk/src/utils/conversions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import {
WasmListMessagesOptions,
type WasmConsentEntityType,
type WasmConsentState,
type WasmConversationType,
type WasmDeliveryStatus,
type WasmDirection,
type WasmGroupMembershipState,
type WasmGroupMessageKind,
type WasmGroupPermissionsOptions,
type WasmInboxState,
Expand Down Expand Up @@ -141,6 +144,7 @@ export const toSafeMessage = (message: WasmMessage): SafeMessage => ({

export type SafeListMessagesOptions = {
delivery_status?: WasmDeliveryStatus;
direction?: WasmDirection;
limit?: bigint;
sent_after_ns?: bigint;
sent_before_ns?: bigint;
Expand All @@ -150,6 +154,7 @@ export const toSafeListMessagesOptions = (
options: WasmListMessagesOptions,
): SafeListMessagesOptions => ({
delivery_status: options.delivery_status,
direction: options.direction,
limit: options.limit,
sent_after_ns: options.sent_after_ns,
sent_before_ns: options.sent_before_ns,
Expand All @@ -163,9 +168,12 @@ export const fromSafeListMessagesOptions = (
options.sent_after_ns,
options.limit,
options.delivery_status,
options.direction,
);

export type SafeListConversationsOptions = {
allowed_states?: WasmGroupMembershipState[];
conversation_type?: WasmConversationType;
created_after_ns?: bigint;
created_before_ns?: bigint;
limit?: bigint;
Expand All @@ -183,6 +191,8 @@ export const fromSafeListConversationsOptions = (
options: SafeListConversationsOptions,
): WasmListConversationsOptions =>
new WasmListConversationsOptions(
options.allowed_states,
options.conversation_type,
options.created_after_ns,
options.created_before_ns,
options.limit,
Expand Down

0 comments on commit ad0fa8e

Please sign in to comment.