Skip to content

Commit ce4db3b

Browse files
VoloVolo
authored andcommitted
Fix invalid types for Search Conversations
1 parent fccdf60 commit ce4db3b

File tree

3 files changed

+1949
-3593
lines changed

3 files changed

+1949
-3593
lines changed

lib/common/common.types.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ export enum Role {
88
LEAD = 'lead',
99
}
1010

11-
export type Paginated<T> = {
11+
export type PaginatedBase = {
1212
type: string;
13-
data: T[];
1413
pages: {
1514
type: 'pages';
1615
next?: {
@@ -24,6 +23,10 @@ export type Paginated<T> = {
2423
total_count: number;
2524
};
2625

26+
export type Paginated<T> = PaginatedBase & {
27+
data: T[];
28+
};
29+
2730
export enum Operators {
2831
AND = 'AND',
2932
OR = 'OR',
@@ -42,12 +45,18 @@ export enum Operators {
4245
interface FlatQuery {
4346
field: string;
4447
operator: Operators;
45-
value: string | number | null;
48+
value: string | number | string[] | number[] | null;
4649
}
4750

4851
interface NestedQueries {
4952
operator: Operators;
50-
value: Array<FlatQuery | NestedQueries> | string | number | null;
53+
value:
54+
| Array<FlatQuery | NestedQueries>
55+
| string
56+
| number
57+
| string[]
58+
| number[]
59+
| null;
5160
}
5261

5362
export interface GenericSearchFilters {

lib/conversation.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
StringifiedTimestamp,
55
GenericSearchFilters,
66
Order,
7+
PaginatedBase,
78
} from './common/common.types';
89
import {
910
ContactType,
@@ -509,7 +510,9 @@ interface SearchConversationRequest {
509510
Partial<SearchConversationOrder>;
510511
}
511512

512-
type SearchConversationResponse = Paginated<ConversationObject>;
513+
type SearchConversationResponse = PaginatedBase & {
514+
conversations: ConversationObject[];
515+
};
513516
//
514517
export enum SortBy {
515518
CreatedAt = 'created_at',

0 commit comments

Comments
 (0)