Skip to content

Commit 263a842

Browse files
committed
feat: update API spec to v167.7.1
1 parent 992a3ea commit 263a842

File tree

5 files changed

+382
-364
lines changed

5 files changed

+382
-364
lines changed

src/gen/chat/ChannelApi.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
EventResponse,
88
FileUploadRequest,
99
FileUploadResponse,
10+
GetDraftResponse,
1011
GetManyMessagesResponse,
1112
HideChannelRequest,
1213
HideChannelResponse,
@@ -83,6 +84,34 @@ export class ChannelApi {
8384
});
8485
};
8586

87+
deleteDraft = (request?: {
88+
parent_id?: string;
89+
user_id?: string;
90+
}): Promise<StreamResponse<Response>> => {
91+
if (!this.id) {
92+
throw new Error(
93+
`Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`,
94+
);
95+
}
96+
return this.chatApi.deleteDraft({
97+
id: this.id,
98+
type: this.type,
99+
...request,
100+
});
101+
};
102+
103+
getDraft = (request?: {
104+
parent_id?: string;
105+
user_id?: string;
106+
}): Promise<StreamResponse<GetDraftResponse>> => {
107+
if (!this.id) {
108+
throw new Error(
109+
`Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`,
110+
);
111+
}
112+
return this.chatApi.getDraft({ id: this.id, type: this.type, ...request });
113+
};
114+
86115
sendEvent = (
87116
request: SendEventRequest,
88117
): Promise<StreamResponse<EventResponse>> => {

src/gen/chat/ChatApi.ts

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
GetCampaignResponse,
2828
GetChannelTypeResponse,
2929
GetCommandResponse,
30+
GetDraftResponse,
3031
GetManyMessagesResponse,
3132
GetMessageResponse,
3233
GetReactionsResponse,
@@ -58,6 +59,8 @@ import {
5859
QueryCampaignsResponse,
5960
QueryChannelsRequest,
6061
QueryChannelsResponse,
62+
QueryDraftsRequest,
63+
QueryDraftsResponse,
6164
QueryMembersPayload,
6265
QueryMessageFlagsPayload,
6366
QueryMessageFlagsResponse,
@@ -129,6 +132,7 @@ export class ChatApi extends BaseApi {
129132
limit: request?.limit,
130133
next: request?.next,
131134
prev: request?.prev,
135+
user_limit: request?.user_limit,
132136
sort: request?.sort,
133137
filter: request?.filter,
134138
};
@@ -144,14 +148,22 @@ export class ChatApi extends BaseApi {
144148

145149
getCampaign = async (request: {
146150
id: string;
151+
prev?: string;
152+
next?: string;
153+
limit?: number;
147154
}): Promise<StreamResponse<GetCampaignResponse>> => {
155+
const queryParams = {
156+
prev: request?.prev,
157+
next: request?.next,
158+
limit: request?.limit,
159+
};
148160
const pathParams = {
149161
id: request?.id,
150162
};
151163

152164
const response = await this.sendRequest<
153165
StreamResponse<GetCampaignResponse>
154-
>('GET', '/api/v2/chat/campaigns/{id}', pathParams, undefined);
166+
>('GET', '/api/v2/chat/campaigns/{id}', pathParams, queryParams);
155167

156168
decoders.GetCampaignResponse?.(response.body);
157169

@@ -378,6 +390,60 @@ export class ChatApi extends BaseApi {
378390
return { ...response.body, metadata: response.metadata };
379391
};
380392

393+
deleteDraft = async (request: {
394+
type: string;
395+
id: string;
396+
parent_id?: string;
397+
user_id?: string;
398+
}): Promise<StreamResponse<Response>> => {
399+
const queryParams = {
400+
parent_id: request?.parent_id,
401+
user_id: request?.user_id,
402+
};
403+
const pathParams = {
404+
type: request?.type,
405+
id: request?.id,
406+
};
407+
408+
const response = await this.sendRequest<StreamResponse<Response>>(
409+
'DELETE',
410+
'/api/v2/chat/channels/{type}/{id}/draft',
411+
pathParams,
412+
queryParams,
413+
);
414+
415+
decoders.Response?.(response.body);
416+
417+
return { ...response.body, metadata: response.metadata };
418+
};
419+
420+
getDraft = async (request: {
421+
type: string;
422+
id: string;
423+
parent_id?: string;
424+
user_id?: string;
425+
}): Promise<StreamResponse<GetDraftResponse>> => {
426+
const queryParams = {
427+
parent_id: request?.parent_id,
428+
user_id: request?.user_id,
429+
};
430+
const pathParams = {
431+
type: request?.type,
432+
id: request?.id,
433+
};
434+
435+
const response = await this.sendRequest<StreamResponse<GetDraftResponse>>(
436+
'GET',
437+
'/api/v2/chat/channels/{type}/{id}/draft',
438+
pathParams,
439+
queryParams,
440+
);
441+
442+
decoders.GetDraftResponse?.(response.body);
443+
444+
return { ...response.body, metadata: response.metadata };
445+
};
446+
381447
sendEvent = async (
382448
request: SendEventRequest & { type: string; id: string },
383449
): Promise<StreamResponse<EventResponse>> => {
@@ -991,6 +1057,28 @@ export class ChatApi extends BaseApi {
9911057
return { ...response.body, metadata: response.metadata };
9921058
};
9931059

1060+
queryDrafts = async (
1061+
request?: QueryDraftsRequest,
1062+
): Promise<StreamResponse<QueryDraftsResponse>> => {
1063+
const body = {
1064+
limit: request?.limit,
1065+
next: request?.next,
1066+
prev: request?.prev,
1067+
user_id: request?.user_id,
1068+
sort: request?.sort,
1069+
filter: request?.filter,
1070+
user: request?.user,
1071+
};
1072+
1073+
const response = await this.sendRequest<
1074+
StreamResponse<QueryDraftsResponse>
1075+
>('POST', '/api/v2/chat/drafts/query', undefined, undefined, body);
1076+
1077+
decoders.QueryDraftsResponse?.(response.body);
1078+
1079+
return { ...response.body, metadata: response.metadata };
1080+
};
1081+
9941082
exportChannels = async (
9951083
request: ExportChannelsRequest,
9961084
): Promise<StreamResponse<ExportChannelsResponse>> => {

0 commit comments

Comments
 (0)