Skip to content

Commit 8976b59

Browse files
nkarpenkoszuperaz
andauthored
feat: regenerate API clients from OpenAPI specs and fix duplicate cutoff_time (#191)
Co-authored-by: Zita Szupera <[email protected]>
1 parent ea3feff commit 8976b59

File tree

8 files changed

+3049
-2244
lines changed

8 files changed

+3049
-2244
lines changed

src/gen/chat/ChannelApi.ts

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@ import {
44
ChannelStateResponse,
55
DeleteChannelResponse,
66
EventResponse,
7-
FileUploadRequest,
8-
FileUploadResponse,
97
GetDraftResponse,
108
GetManyMessagesResponse,
119
HideChannelRequest,
1210
HideChannelResponse,
13-
ImageUploadRequest,
14-
ImageUploadResponse,
1511
MarkReadRequest,
1612
MarkReadResponse,
1713
MarkUnreadRequest,
@@ -29,6 +25,10 @@ import {
2925
UpdateChannelResponse,
3026
UpdateMemberPartialRequest,
3127
UpdateMemberPartialResponse,
28+
UploadChannelFileRequest,
29+
UploadChannelFileResponse,
30+
UploadChannelRequest,
31+
UploadChannelResponse,
3232
} from '../models';
3333

3434
export class ChannelApi {
@@ -126,30 +126,32 @@ export class ChannelApi {
126126
return this.chatApi.sendEvent({ id: this.id, type: this.type, ...request });
127127
}
128128

129-
deleteFile(request?: { url?: string }): Promise<StreamResponse<Response>> {
129+
deleteChannelFile(request?: {
130+
url?: string;
131+
}): Promise<StreamResponse<Response>> {
130132
if (!this.id) {
131133
throw new Error(
132134
`Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`,
133135
);
134136
}
135137

136-
return this.chatApi.deleteFile({
138+
return this.chatApi.deleteChannelFile({
137139
id: this.id,
138140
type: this.type,
139141
...request,
140142
});
141143
}
142144

143-
uploadFile(
144-
request?: FileUploadRequest,
145-
): Promise<StreamResponse<FileUploadResponse>> {
145+
uploadChannelFile(
146+
request?: UploadChannelFileRequest,
147+
): Promise<StreamResponse<UploadChannelFileResponse>> {
146148
if (!this.id) {
147149
throw new Error(
148150
`Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`,
149151
);
150152
}
151153

152-
return this.chatApi.uploadFile({
154+
return this.chatApi.uploadChannelFile({
153155
id: this.id,
154156
type: this.type,
155157
...request,
@@ -172,30 +174,32 @@ export class ChannelApi {
172174
});
173175
}
174176

175-
deleteImage(request?: { url?: string }): Promise<StreamResponse<Response>> {
177+
deleteChannelImage(request?: {
178+
url?: string;
179+
}): Promise<StreamResponse<Response>> {
176180
if (!this.id) {
177181
throw new Error(
178182
`Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`,
179183
);
180184
}
181185

182-
return this.chatApi.deleteImage({
186+
return this.chatApi.deleteChannelImage({
183187
id: this.id,
184188
type: this.type,
185189
...request,
186190
});
187191
}
188192

189-
uploadImage(
190-
request?: ImageUploadRequest,
191-
): Promise<StreamResponse<ImageUploadResponse>> {
193+
uploadChannelImage(
194+
request?: UploadChannelRequest,
195+
): Promise<StreamResponse<UploadChannelResponse>> {
192196
if (!this.id) {
193197
throw new Error(
194198
`Channel isn't yet created, call getOrCreateDistinctChannel() before this operation`,
195199
);
196200
}
197201

198-
return this.chatApi.uploadImage({
202+
return this.chatApi.uploadChannelImage({
199203
id: this.id,
200204
type: this.type,
201205
...request,

src/gen/chat/ChatApi.ts

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ import {
2121
EventResponse,
2222
ExportChannelsRequest,
2323
ExportChannelsResponse,
24-
FileUploadRequest,
25-
FileUploadResponse,
2624
GetCampaignResponse,
2725
GetChannelTypeResponse,
2826
GetCommandResponse,
@@ -35,8 +33,6 @@ import {
3533
GetThreadResponse,
3634
HideChannelRequest,
3735
HideChannelResponse,
38-
ImageUploadRequest,
39-
ImageUploadResponse,
4036
ListChannelTypesResponse,
4137
ListCommandsResponse,
4238
MarkChannelsReadRequest,
@@ -113,6 +109,10 @@ import {
113109
UpdateReminderResponse,
114110
UpdateThreadPartialRequest,
115111
UpdateThreadPartialResponse,
112+
UploadChannelFileRequest,
113+
UploadChannelFileResponse,
114+
UploadChannelRequest,
115+
UploadChannelResponse,
116116
WrappedUnreadCountsResponse,
117117
} from '../models';
118118
import { decoders } from '../model-decoders/decoders';
@@ -511,7 +511,7 @@ export class ChatApi {
511511
return { ...response.body, metadata: response.metadata };
512512
}
513513

514-
async deleteFile(request: {
514+
async deleteChannelFile(request: {
515515
type: string;
516516
id: string;
517517
url?: string;
@@ -536,9 +536,9 @@ export class ChatApi {
536536
return { ...response.body, metadata: response.metadata };
537537
}
538538

539-
async uploadFile(
540-
request: FileUploadRequest & { type: string; id: string },
541-
): Promise<StreamResponse<FileUploadResponse>> {
539+
async uploadChannelFile(
540+
request: UploadChannelFileRequest & { type: string; id: string },
541+
): Promise<StreamResponse<UploadChannelFileResponse>> {
542542
const pathParams = {
543543
type: request?.type,
544544
id: request?.id,
@@ -549,7 +549,7 @@ export class ChatApi {
549549
};
550550

551551
const response = await this.apiClient.sendRequest<
552-
StreamResponse<FileUploadResponse>
552+
StreamResponse<UploadChannelFileResponse>
553553
>(
554554
'POST',
555555
'/api/v2/chat/channels/{type}/{id}/file',
@@ -559,7 +559,7 @@ export class ChatApi {
559559
'multipart/form-data',
560560
);
561561

562-
decoders.FileUploadResponse?.(response.body);
562+
decoders.UploadChannelFileResponse?.(response.body);
563563

564564
return { ...response.body, metadata: response.metadata };
565565
}
@@ -593,7 +593,7 @@ export class ChatApi {
593593
return { ...response.body, metadata: response.metadata };
594594
}
595595

596-
async deleteImage(request: {
596+
async deleteChannelImage(request: {
597597
type: string;
598598
id: string;
599599
url?: string;
@@ -618,9 +618,9 @@ export class ChatApi {
618618
return { ...response.body, metadata: response.metadata };
619619
}
620620

621-
async uploadImage(
622-
request: ImageUploadRequest & { type: string; id: string },
623-
): Promise<StreamResponse<ImageUploadResponse>> {
621+
async uploadChannelImage(
622+
request: UploadChannelRequest & { type: string; id: string },
623+
): Promise<StreamResponse<UploadChannelResponse>> {
624624
const pathParams = {
625625
type: request?.type,
626626
id: request?.id,
@@ -632,7 +632,7 @@ export class ChatApi {
632632
};
633633

634634
const response = await this.apiClient.sendRequest<
635-
StreamResponse<ImageUploadResponse>
635+
StreamResponse<UploadChannelResponse>
636636
>(
637637
'POST',
638638
'/api/v2/chat/channels/{type}/{id}/image',
@@ -642,7 +642,7 @@ export class ChatApi {
642642
'multipart/form-data',
643643
);
644644

645-
decoders.ImageUploadResponse?.(response.body);
645+
decoders.UploadChannelResponse?.(response.body);
646646

647647
return { ...response.body, metadata: response.metadata };
648648
}
@@ -915,7 +915,9 @@ export class ChatApi {
915915
blocklist: request?.blocklist,
916916
blocklist_behavior: request?.blocklist_behavior,
917917
connect_events: request?.connect_events,
918+
count_messages: request?.count_messages,
918919
custom_events: request?.custom_events,
920+
delivery_events: request?.delivery_events,
919921
mark_messages_pending: request?.mark_messages_pending,
920922
message_retention: request?.message_retention,
921923
mutes: request?.mutes,
@@ -1006,6 +1008,7 @@ export class ChatApi {
10061008
connect_events: request?.connect_events,
10071009
count_messages: request?.count_messages,
10081010
custom_events: request?.custom_events,
1011+
delivery_events: request?.delivery_events,
10091012
mark_messages_pending: request?.mark_messages_pending,
10101013
mutes: request?.mutes,
10111014
partition_size: request?.partition_size,
@@ -1734,32 +1737,20 @@ export class ChatApi {
17341737
async getReplies(request: {
17351738
parent_id: string;
17361739
limit?: number;
1737-
offset?: number;
17381740
id_gte?: string;
17391741
id_gt?: string;
17401742
id_lte?: string;
17411743
id_lt?: string;
1742-
created_at_after_or_equal?: Date;
1743-
created_at_after?: Date;
1744-
created_at_before_or_equal?: Date;
1745-
created_at_before?: Date;
17461744
id_around?: string;
1747-
created_at_around?: Date;
17481745
sort?: SortParamRequest[];
17491746
}): Promise<StreamResponse<GetRepliesResponse>> {
17501747
const queryParams = {
17511748
limit: request?.limit,
1752-
offset: request?.offset,
17531749
id_gte: request?.id_gte,
17541750
id_gt: request?.id_gt,
17551751
id_lte: request?.id_lte,
17561752
id_lt: request?.id_lt,
1757-
created_at_after_or_equal: request?.created_at_after_or_equal,
1758-
created_at_after: request?.created_at_after,
1759-
created_at_before_or_equal: request?.created_at_before_or_equal,
1760-
created_at_before: request?.created_at_before,
17611753
id_around: request?.id_around,
1762-
created_at_around: request?.created_at_around,
17631754
sort: request?.sort,
17641755
};
17651756
const pathParams = {

src/gen/common/CommonApi.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ export class CommonApi {
197197
const body = {
198198
name: request?.name,
199199
words: request?.words,
200+
is_leet_check_enabled: request?.is_leet_check_enabled,
201+
is_plural_check_enabled: request?.is_plural_check_enabled,
200202
team: request?.team,
201203
type: request?.type,
202204
};
@@ -267,6 +269,8 @@ export class CommonApi {
267269
name: request?.name,
268270
};
269271
const body = {
272+
is_leet_check_enabled: request?.is_leet_check_enabled,
273+
is_plural_check_enabled: request?.is_plural_check_enabled,
270274
team: request?.team,
271275
words: request?.words,
272276
};

src/gen/feeds/FeedsApi.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import {
5050
GetFeedGroupResponse,
5151
GetFeedViewResponse,
5252
GetFeedVisibilityResponse,
53+
GetFeedsRateLimitsResponse,
5354
GetFollowSuggestionsResponse,
5455
GetOrCreateFeedGroupRequest,
5556
GetOrCreateFeedGroupResponse,
@@ -61,6 +62,8 @@ import {
6162
ListFeedViewsResponse,
6263
ListFeedVisibilitiesResponse,
6364
MarkActivityRequest,
65+
OwnCapabilitiesBatchRequest,
66+
OwnCapabilitiesBatchResponse,
6467
PinActivityRequest,
6568
PinActivityResponse,
6669
PollVoteResponse,
@@ -1019,6 +1022,7 @@ export class FeedsApi {
10191022
const queryParams = {
10201023
include_soft_deleted: request?.include_soft_deleted,
10211024
};
1025+
10221026
const response = await this.apiClient.sendRequest<
10231027
StreamResponse<ListFeedGroupsResponse>
10241028
>('GET', '/api/v2/feeds/feed_groups', undefined, queryParams);
@@ -1720,6 +1724,31 @@ export class FeedsApi {
17201724
return { ...response.body, metadata: response.metadata };
17211725
}
17221726

1727+
async ownCapabilitiesBatch(
1728+
request: OwnCapabilitiesBatchRequest,
1729+
): Promise<StreamResponse<OwnCapabilitiesBatchResponse>> {
1730+
const body = {
1731+
feeds: request?.feeds,
1732+
user_id: request?.user_id,
1733+
user: request?.user,
1734+
};
1735+
1736+
const response = await this.apiClient.sendRequest<
1737+
StreamResponse<OwnCapabilitiesBatchResponse>
1738+
>(
1739+
'POST',
1740+
'/api/v2/feeds/feeds/own_capabilities/batch',
1741+
undefined,
1742+
undefined,
1743+
body,
1744+
'application/json',
1745+
);
1746+
1747+
decoders.OwnCapabilitiesBatchResponse?.(response.body);
1748+
1749+
return { ...response.body, metadata: response.metadata };
1750+
}
1751+
17231752
protected async _queryFeeds(
17241753
request?: QueryFeedsRequest,
17251754
): Promise<StreamResponse<QueryFeedsResponse>> {
@@ -1748,6 +1777,30 @@ export class FeedsApi {
17481777
return { ...response.body, metadata: response.metadata };
17491778
}
17501779

1780+
async getFeedsRateLimits(request?: {
1781+
endpoints?: string;
1782+
android?: boolean;
1783+
ios?: boolean;
1784+
web?: boolean;
1785+
server_side?: boolean;
1786+
}): Promise<StreamResponse<GetFeedsRateLimitsResponse>> {
1787+
const queryParams = {
1788+
endpoints: request?.endpoints,
1789+
android: request?.android,
1790+
ios: request?.ios,
1791+
web: request?.web,
1792+
server_side: request?.server_side,
1793+
};
1794+
1795+
const response = await this.apiClient.sendRequest<
1796+
StreamResponse<GetFeedsRateLimitsResponse>
1797+
>('GET', '/api/v2/feeds/feeds/rate_limits', undefined, queryParams);
1798+
1799+
decoders.GetFeedsRateLimitsResponse?.(response.body);
1800+
1801+
return { ...response.body, metadata: response.metadata };
1802+
}
1803+
17511804
async updateFollow(
17521805
request: UpdateFollowRequest,
17531806
): Promise<StreamResponse<UpdateFollowResponse>> {

0 commit comments

Comments
 (0)