Skip to content

Commit 197bd82

Browse files
committed
closed caption endpoints
1 parent 61ca08d commit 197bd82

File tree

7 files changed

+1792
-259
lines changed

7 files changed

+1792
-259
lines changed

src/gen/chat/ChatApi.ts

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import { BaseApi } from '../../BaseApi';
22
import { StreamResponse } from '../../types';
33
import {
4+
BlockUsersRequest,
5+
BlockUsersResponse,
46
CampaignResponse,
57
CastPollVoteRequest,
68
ChannelGetOrCreateRequest,
79
ChannelStateResponse,
810
CommitMessageRequest,
11+
CreateBlockListRequest,
912
CreateChannelTypeRequest,
1013
CreateChannelTypeResponse,
1114
CreateCommandRequest,
@@ -23,6 +26,8 @@ import {
2326
ExportChannelsResponse,
2427
FileUploadRequest,
2528
FileUploadResponse,
29+
GetBlockListResponse,
30+
GetBlockedUsersResponse,
2631
GetCampaignResponse,
2732
GetChannelTypeResponse,
2833
GetCommandResponse,
@@ -37,6 +42,7 @@ import {
3742
HideChannelResponse,
3843
ImageUploadRequest,
3944
ImageUploadResponse,
45+
ListBlockListResponse,
4046
ListChannelTypesResponse,
4147
ListCommandsResponse,
4248
MarkChannelsReadRequest,
@@ -93,10 +99,13 @@ import {
9399
TranslateMessageRequest,
94100
TruncateChannelRequest,
95101
TruncateChannelResponse,
102+
UnblockUsersRequest,
103+
UnblockUsersResponse,
96104
UnmuteChannelRequest,
97105
UnmuteResponse,
98106
UnreadCountsBatchRequest,
99107
UnreadCountsBatchResponse,
108+
UpdateBlockListRequest,
100109
UpdateChannelPartialRequest,
101110
UpdateChannelPartialResponse,
102111
UpdateChannelRequest,
@@ -121,6 +130,96 @@ import {
121130
import { decoders } from '../model-decoders';
122131

123132
export class ChatApi extends BaseApi {
133+
listBlockLists = async (): Promise<StreamResponse<ListBlockListResponse>> => {
134+
const response = await this.sendRequest<
135+
StreamResponse<ListBlockListResponse>
136+
>('GET', '/api/v2/chat/blocklists', undefined, undefined);
137+
138+
decoders.ListBlockListResponse?.(response.body);
139+
140+
return { ...response.body, metadata: response.metadata };
141+
};
142+
143+
createBlockList = async (
144+
request: CreateBlockListRequest,
145+
): Promise<StreamResponse<Response>> => {
146+
const body = {
147+
name: request?.name,
148+
words: request?.words,
149+
type: request?.type,
150+
};
151+
152+
const response = await this.sendRequest<StreamResponse<Response>>(
153+
'POST',
154+
'/api/v2/chat/blocklists',
155+
undefined,
156+
undefined,
157+
body,
158+
);
159+
160+
decoders.Response?.(response.body);
161+
162+
return { ...response.body, metadata: response.metadata };
163+
};
164+
165+
deleteBlockList = async (request: {
166+
name: string;
167+
}): Promise<StreamResponse<Response>> => {
168+
const pathParams = {
169+
name: request?.name,
170+
};
171+
172+
const response = await this.sendRequest<StreamResponse<Response>>(
173+
'DELETE',
174+
'/api/v2/chat/blocklists/{name}',
175+
pathParams,
176+
undefined,
177+
);
178+
179+
decoders.Response?.(response.body);
180+
181+
return { ...response.body, metadata: response.metadata };
182+
};
183+
184+
getBlockList = async (request: {
185+
name: string;
186+
}): Promise<StreamResponse<GetBlockListResponse>> => {
187+
const pathParams = {
188+
name: request?.name,
189+
};
190+
191+
const response = await this.sendRequest<
192+
StreamResponse<GetBlockListResponse>
193+
>('GET', '/api/v2/chat/blocklists/{name}', pathParams, undefined);
194+
195+
decoders.GetBlockListResponse?.(response.body);
196+
197+
return { ...response.body, metadata: response.metadata };
198+
};
199+
200+
updateBlockList = async (
201+
request: UpdateBlockListRequest & { name: string },
202+
): Promise<StreamResponse<Response>> => {
203+
const pathParams = {
204+
name: request?.name,
205+
};
206+
const body = {
207+
words: request?.words,
208+
};
209+
210+
const response = await this.sendRequest<StreamResponse<Response>>(
211+
'PUT',
212+
'/api/v2/chat/blocklists/{name}',
213+
pathParams,
214+
undefined,
215+
body,
216+
);
217+
218+
decoders.Response?.(response.body);
219+
220+
return { ...response.body, metadata: response.metadata };
221+
};
222+
124223
queryCampaigns = async (
125224
request?: QueryCampaignsRequest,
126225
): Promise<StreamResponse<QueryCampaignsResponse>> => {
@@ -2089,6 +2188,62 @@ export class ChatApi extends BaseApi {
20892188
return { ...response.body, metadata: response.metadata };
20902189
};
20912190

2191+
getBlockedUsers = async (request?: {
2192+
user_id?: string;
2193+
}): Promise<StreamResponse<GetBlockedUsersResponse>> => {
2194+
const queryParams = {
2195+
user_id: request?.user_id,
2196+
};
2197+
2198+
const response = await this.sendRequest<
2199+
StreamResponse<GetBlockedUsersResponse>
2200+
>('GET', '/api/v2/chat/users/block', undefined, queryParams);
2201+
2202+
decoders.GetBlockedUsersResponse?.(response.body);
2203+
2204+
return { ...response.body, metadata: response.metadata };
2205+
};
2206+
2207+
blockUsers = async (
2208+
request: BlockUsersRequest,
2209+
): Promise<StreamResponse<BlockUsersResponse>> => {
2210+
const body = {
2211+
blocked_user_id: request?.blocked_user_id,
2212+
user_id: request?.user_id,
2213+
user: request?.user,
2214+
};
2215+
2216+
const response = await this.sendRequest<StreamResponse<BlockUsersResponse>>(
2217+
'POST',
2218+
'/api/v2/chat/users/block',
2219+
undefined,
2220+
undefined,
2221+
body,
2222+
);
2223+
2224+
decoders.BlockUsersResponse?.(response.body);
2225+
2226+
return { ...response.body, metadata: response.metadata };
2227+
};
2228+
2229+
unblockUsers = async (
2230+
request: UnblockUsersRequest,
2231+
): Promise<StreamResponse<UnblockUsersResponse>> => {
2232+
const body = {
2233+
blocked_user_id: request?.blocked_user_id,
2234+
user_id: request?.user_id,
2235+
user: request?.user,
2236+
};
2237+
2238+
const response = await this.sendRequest<
2239+
StreamResponse<UnblockUsersResponse>
2240+
>('POST', '/api/v2/chat/users/unblock', undefined, undefined, body);
2241+
2242+
decoders.UnblockUsersResponse?.(response.body);
2243+
2244+
return { ...response.body, metadata: response.metadata };
2245+
};
2246+
20922247
sendUserCustomEvent = async (
20932248
request: SendUserCustomEventRequest & { user_id: string },
20942249
): Promise<StreamResponse<Response>> => {

0 commit comments

Comments
 (0)