11import { BaseApi } from '../../BaseApi' ;
22import { StreamResponse } from '../../types' ;
33import {
4+ BlockUsersRequest ,
5+ BlockUsersResponse ,
46 CheckExternalStorageResponse ,
57 CheckPushRequest ,
68 CheckPushResponse ,
79 CheckSNSRequest ,
810 CheckSNSResponse ,
911 CheckSQSRequest ,
1012 CheckSQSResponse ,
13+ CreateBlockListRequest ,
1114 CreateDeviceRequest ,
1215 CreateExternalStorageRequest ,
1316 CreateExternalStorageResponse ,
@@ -30,11 +33,14 @@ import {
3033 ExportUsersRequest ,
3134 ExportUsersResponse ,
3235 GetApplicationResponse ,
36+ GetBlockListResponse ,
37+ GetBlockedUsersResponse ,
3338 GetCustomPermissionResponse ,
3439 GetImportResponse ,
3540 GetOGResponse ,
3641 GetRateLimitsResponse ,
3742 GetTaskResponse ,
43+ ListBlockListResponse ,
3844 ListDevicesResponse ,
3945 ListExternalStorageResponse ,
4046 ListImportsResponse ,
@@ -49,7 +55,10 @@ import {
4955 ReactivateUsersResponse ,
5056 Response ,
5157 RestoreUsersRequest ,
58+ UnblockUsersRequest ,
59+ UnblockUsersResponse ,
5260 UpdateAppRequest ,
61+ UpdateBlockListRequest ,
5362 UpdateExternalStorageRequest ,
5463 UpdateExternalStorageResponse ,
5564 UpdateUsersPartialRequest ,
@@ -135,6 +144,96 @@ export class CommonApi extends BaseApi {
135144 return { ...response . body , metadata : response . metadata } ;
136145 } ;
137146
147+ listBlockLists = async ( ) : Promise < StreamResponse < ListBlockListResponse > > => {
148+ const response = await this . sendRequest <
149+ StreamResponse < ListBlockListResponse >
150+ > ( 'GET' , '/api/v2/blocklists' , undefined , undefined ) ;
151+
152+ decoders . ListBlockListResponse ?.( response . body ) ;
153+
154+ return { ...response . body , metadata : response . metadata } ;
155+ } ;
156+
157+ createBlockList = async (
158+ request : CreateBlockListRequest ,
159+ ) : Promise < StreamResponse < Response > > => {
160+ const body = {
161+ name : request ?. name ,
162+ words : request ?. words ,
163+ type : request ?. type ,
164+ } ;
165+
166+ const response = await this . sendRequest < StreamResponse < Response > > (
167+ 'POST' ,
168+ '/api/v2/blocklists' ,
169+ undefined ,
170+ undefined ,
171+ body ,
172+ ) ;
173+
174+ decoders . Response ?.( response . body ) ;
175+
176+ return { ...response . body , metadata : response . metadata } ;
177+ } ;
178+
179+ deleteBlockList = async ( request : {
180+ name : string ;
181+ } ) : Promise < StreamResponse < Response > > => {
182+ const pathParams = {
183+ name : request ?. name ,
184+ } ;
185+
186+ const response = await this . sendRequest < StreamResponse < Response > > (
187+ 'DELETE' ,
188+ '/api/v2/blocklists/{name}' ,
189+ pathParams ,
190+ undefined ,
191+ ) ;
192+
193+ decoders . Response ?.( response . body ) ;
194+
195+ return { ...response . body , metadata : response . metadata } ;
196+ } ;
197+
198+ getBlockList = async ( request : {
199+ name : string ;
200+ } ) : Promise < StreamResponse < GetBlockListResponse > > => {
201+ const pathParams = {
202+ name : request ?. name ,
203+ } ;
204+
205+ const response = await this . sendRequest <
206+ StreamResponse < GetBlockListResponse >
207+ > ( 'GET' , '/api/v2/blocklists/{name}' , pathParams , undefined ) ;
208+
209+ decoders . GetBlockListResponse ?.( response . body ) ;
210+
211+ return { ...response . body , metadata : response . metadata } ;
212+ } ;
213+
214+ updateBlockList = async (
215+ request : UpdateBlockListRequest & { name : string } ,
216+ ) : Promise < StreamResponse < Response > > => {
217+ const pathParams = {
218+ name : request ?. name ,
219+ } ;
220+ const body = {
221+ words : request ?. words ,
222+ } ;
223+
224+ const response = await this . sendRequest < StreamResponse < Response > > (
225+ 'PUT' ,
226+ '/api/v2/blocklists/{name}' ,
227+ pathParams ,
228+ undefined ,
229+ body ,
230+ ) ;
231+
232+ decoders . Response ?.( response . body ) ;
233+
234+ return { ...response . body , metadata : response . metadata } ;
235+ } ;
236+
138237 checkPush = async (
139238 request ?: CheckPushRequest ,
140239 ) : Promise < StreamResponse < CheckPushResponse > > => {
@@ -695,6 +794,44 @@ export class CommonApi extends BaseApi {
695794 return { ...response . body , metadata : response . metadata } ;
696795 } ;
697796
797+ getBlockedUsers = async ( request ?: {
798+ user_id ?: string ;
799+ } ) : Promise < StreamResponse < GetBlockedUsersResponse > > => {
800+ const queryParams = {
801+ user_id : request ?. user_id ,
802+ } ;
803+
804+ const response = await this . sendRequest <
805+ StreamResponse < GetBlockedUsersResponse >
806+ > ( 'GET' , '/api/v2/users/block' , undefined , queryParams ) ;
807+
808+ decoders . GetBlockedUsersResponse ?.( response . body ) ;
809+
810+ return { ...response . body , metadata : response . metadata } ;
811+ } ;
812+
813+ blockUsers = async (
814+ request : BlockUsersRequest ,
815+ ) : Promise < StreamResponse < BlockUsersResponse > > => {
816+ const body = {
817+ blocked_user_id : request ?. blocked_user_id ,
818+ user_id : request ?. user_id ,
819+ user : request ?. user ,
820+ } ;
821+
822+ const response = await this . sendRequest < StreamResponse < BlockUsersResponse > > (
823+ 'POST' ,
824+ '/api/v2/users/block' ,
825+ undefined ,
826+ undefined ,
827+ body ,
828+ ) ;
829+
830+ decoders . BlockUsersResponse ?.( response . body ) ;
831+
832+ return { ...response . body , metadata : response . metadata } ;
833+ } ;
834+
698835 deactivateUsers = async (
699836 request : DeactivateUsersRequest ,
700837 ) : Promise < StreamResponse < DeactivateUsersResponse > > => {
@@ -775,6 +912,24 @@ export class CommonApi extends BaseApi {
775912 return { ...response . body , metadata : response . metadata } ;
776913 } ;
777914
915+ unblockUsers = async (
916+ request : UnblockUsersRequest ,
917+ ) : Promise < StreamResponse < UnblockUsersResponse > > => {
918+ const body = {
919+ blocked_user_id : request ?. blocked_user_id ,
920+ user_id : request ?. user_id ,
921+ user : request ?. user ,
922+ } ;
923+
924+ const response = await this . sendRequest <
925+ StreamResponse < UnblockUsersResponse >
926+ > ( 'POST' , '/api/v2/users/unblock' , undefined , undefined , body ) ;
927+
928+ decoders . UnblockUsersResponse ?.( response . body ) ;
929+
930+ return { ...response . body , metadata : response . metadata } ;
931+ } ;
932+
778933 deactivateUser = async (
779934 request : DeactivateUserRequest & { user_id : string } ,
780935 ) : Promise < StreamResponse < DeactivateUserResponse > > => {
0 commit comments