Skip to content

Commit bff2e03

Browse files
authored
Merge pull request #305 from intercom/issue/296/invalid-types-for-search-conversations
Issue/296/invalid types for search conversations
2 parents fccdf60 + 2ff8de2 commit bff2e03

File tree

4 files changed

+207
-147
lines changed

4 files changed

+207
-147
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',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "intercom-client",
3-
"version": "3.1.0",
3+
"version": "3.1.1",
44
"description": "Official Node bindings to the Intercom API",
55
"homepage": "https://github.com/intercom/intercom-node",
66
"bugs:": "https://github.com/intercom/intercom-node/issues",

0 commit comments

Comments
 (0)