@@ -165,6 +165,170 @@ export class AdminApi {
165165 } ) ;
166166 } ) ;
167167 }
168+ /**
169+ * Admin-only API to delete an organization. If `fullDeletion` is set, it deletes the organization\'s identifiable information and files. Otherwise, it soft deletes the organization by setting its `delete_date` value.
170+ * @summary Delete an organization
171+ * @param organizationId Organization ID
172+ * @param fullDeletion Set to true for full deletion
173+ */
174+ public async adminDeleteOrganization ( organizationId : number , fullDeletion ?: boolean , options : { headers : { [ name : string ] : string } } = { headers : { } } ) : Promise < GenericApiResponse > {
175+ const localVarPath = this . basePath + '/api/admin/organizations/{organizationId}'
176+ . replace ( '{' + 'organizationId' + '}' , encodeURIComponent ( String ( organizationId ) ) ) ;
177+ let localVarQueryParameters : any = { } ;
178+ let localVarHeaderParams : any = ( < any > Object ) . assign ( { } , this . defaultHeaders ) ;
179+ const produces = [ 'application/json' ] ;
180+ // give precedence to 'application/json'
181+ if ( produces . indexOf ( 'application/json' ) >= 0 ) {
182+ localVarHeaderParams . Accept = 'application/json' ;
183+ } else {
184+ localVarHeaderParams . Accept = produces . join ( ',' ) ;
185+ }
186+ let localVarFormParams : any = { } ;
187+
188+ // verify required parameter 'organizationId' is not null or undefined
189+ if ( organizationId === null || organizationId === undefined ) {
190+ throw new Error ( 'Required parameter organizationId was null or undefined when calling adminDeleteOrganization.' ) ;
191+ }
192+
193+ if ( fullDeletion !== undefined ) {
194+ localVarQueryParameters [ 'fullDeletion' ] = ObjectSerializer . serialize ( fullDeletion , "boolean" ) ;
195+ }
196+
197+ ( < any > Object ) . assign ( localVarHeaderParams , options . headers ) ;
198+
199+ let localVarUseFormData = false ;
200+
201+ let localVarRequestOptions : localVarRequest . Options = {
202+ method : 'DELETE' ,
203+ qs : localVarQueryParameters ,
204+ headers : localVarHeaderParams ,
205+ uri : localVarPath ,
206+ useQuerystring : this . _useQuerystring ,
207+ agentOptions : { keepAlive : false } ,
208+ json : true ,
209+ } ;
210+
211+ let authenticationPromise = Promise . resolve ( ) ;
212+ authenticationPromise = authenticationPromise . then ( ( ) => this . authentications . ApiKeyAuthentication . applyToRequest ( localVarRequestOptions ) ) ;
213+
214+ authenticationPromise = authenticationPromise . then ( ( ) => this . authentications . JWTAuthentication . applyToRequest ( localVarRequestOptions ) ) ;
215+
216+ authenticationPromise = authenticationPromise . then ( ( ) => this . authentications . JWTHttpHeaderAuthentication . applyToRequest ( localVarRequestOptions ) ) ;
217+
218+ authenticationPromise = authenticationPromise . then ( ( ) => this . authentications . default . applyToRequest ( localVarRequestOptions ) ) ;
219+ return authenticationPromise . then ( ( ) => {
220+ if ( Object . keys ( localVarFormParams ) . length ) {
221+ if ( localVarUseFormData ) {
222+ ( < any > localVarRequestOptions ) . formData = localVarFormParams ;
223+ } else {
224+ localVarRequestOptions . form = localVarFormParams ;
225+ }
226+ }
227+ return new Promise < GenericApiResponse > ( ( resolve , reject ) => {
228+ localVarRequest ( localVarRequestOptions , ( error , response , body ) => {
229+ if ( error ) {
230+ reject ( error ) ;
231+ } else {
232+ body = ObjectSerializer . deserialize ( body , "GenericApiResponse" ) ;
233+
234+ const errString = `Failed to call "${ localVarPath } ", returned ${ response . statusCode } : ` + response . body ;
235+
236+ if ( typeof body . success === 'boolean' && ! body . success ) {
237+ reject ( new Error ( body . error || errString ) ) ;
238+ }
239+ else if ( response . statusCode && response . statusCode >= 200 && response . statusCode <= 299 ) {
240+ resolve ( body ) ;
241+ }
242+ else {
243+ reject ( errString ) ;
244+ }
245+ }
246+ } ) ;
247+ } ) ;
248+ } ) ;
249+ }
250+ /**
251+ * Admin-only API to delete a user. If `fullDeletion` is set, it deletes the user\'s identifiable information and files. Otherwise, it soft deletes the user by setting it\'s `delete_date` value.
252+ * @summary Delete a user
253+ * @param userId User ID
254+ * @param fullDeletion Set to true for full deletion
255+ */
256+ public async adminDeleteUser ( userId : number , fullDeletion ?: boolean , options : { headers : { [ name : string ] : string } } = { headers : { } } ) : Promise < GenericApiResponse > {
257+ const localVarPath = this . basePath + '/api/admin/users/{userId}'
258+ . replace ( '{' + 'userId' + '}' , encodeURIComponent ( String ( userId ) ) ) ;
259+ let localVarQueryParameters : any = { } ;
260+ let localVarHeaderParams : any = ( < any > Object ) . assign ( { } , this . defaultHeaders ) ;
261+ const produces = [ 'application/json' ] ;
262+ // give precedence to 'application/json'
263+ if ( produces . indexOf ( 'application/json' ) >= 0 ) {
264+ localVarHeaderParams . Accept = 'application/json' ;
265+ } else {
266+ localVarHeaderParams . Accept = produces . join ( ',' ) ;
267+ }
268+ let localVarFormParams : any = { } ;
269+
270+ // verify required parameter 'userId' is not null or undefined
271+ if ( userId === null || userId === undefined ) {
272+ throw new Error ( 'Required parameter userId was null or undefined when calling adminDeleteUser.' ) ;
273+ }
274+
275+ if ( fullDeletion !== undefined ) {
276+ localVarQueryParameters [ 'fullDeletion' ] = ObjectSerializer . serialize ( fullDeletion , "boolean" ) ;
277+ }
278+
279+ ( < any > Object ) . assign ( localVarHeaderParams , options . headers ) ;
280+
281+ let localVarUseFormData = false ;
282+
283+ let localVarRequestOptions : localVarRequest . Options = {
284+ method : 'DELETE' ,
285+ qs : localVarQueryParameters ,
286+ headers : localVarHeaderParams ,
287+ uri : localVarPath ,
288+ useQuerystring : this . _useQuerystring ,
289+ agentOptions : { keepAlive : false } ,
290+ json : true ,
291+ } ;
292+
293+ let authenticationPromise = Promise . resolve ( ) ;
294+ authenticationPromise = authenticationPromise . then ( ( ) => this . authentications . ApiKeyAuthentication . applyToRequest ( localVarRequestOptions ) ) ;
295+
296+ authenticationPromise = authenticationPromise . then ( ( ) => this . authentications . JWTAuthentication . applyToRequest ( localVarRequestOptions ) ) ;
297+
298+ authenticationPromise = authenticationPromise . then ( ( ) => this . authentications . JWTHttpHeaderAuthentication . applyToRequest ( localVarRequestOptions ) ) ;
299+
300+ authenticationPromise = authenticationPromise . then ( ( ) => this . authentications . default . applyToRequest ( localVarRequestOptions ) ) ;
301+ return authenticationPromise . then ( ( ) => {
302+ if ( Object . keys ( localVarFormParams ) . length ) {
303+ if ( localVarUseFormData ) {
304+ ( < any > localVarRequestOptions ) . formData = localVarFormParams ;
305+ } else {
306+ localVarRequestOptions . form = localVarFormParams ;
307+ }
308+ }
309+ return new Promise < GenericApiResponse > ( ( resolve , reject ) => {
310+ localVarRequest ( localVarRequestOptions , ( error , response , body ) => {
311+ if ( error ) {
312+ reject ( error ) ;
313+ } else {
314+ body = ObjectSerializer . deserialize ( body , "GenericApiResponse" ) ;
315+
316+ const errString = `Failed to call "${ localVarPath } ", returned ${ response . statusCode } : ` + response . body ;
317+
318+ if ( typeof body . success === 'boolean' && ! body . success ) {
319+ reject ( new Error ( body . error || errString ) ) ;
320+ }
321+ else if ( response . statusCode && response . statusCode >= 200 && response . statusCode <= 299 ) {
322+ resolve ( body ) ;
323+ }
324+ else {
325+ reject ( errString ) ;
326+ }
327+ }
328+ } ) ;
329+ } ) ;
330+ } ) ;
331+ }
168332 /**
169333 * Admin-only API to find a user by username or email address.
170334 * @summary Find a user
0 commit comments