@@ -21,6 +21,7 @@ import http = require('http');
2121/* tslint:disable:no-unused-locals */
2222import { AddMemberRequest } from '../model/addMemberRequest' ;
2323import { AddOrganizationBucketRequest } from '../model/addOrganizationBucketRequest' ;
24+ import { CreateOrganizationResponse } from '../model/createOrganizationResponse' ;
2425import { GenericApiResponse } from '../model/genericApiResponse' ;
2526import { InviteOrganizationMemberRequest } from '../model/inviteOrganizationMemberRequest' ;
2627import { RemoveMemberRequest } from '../model/removeMemberRequest' ;
@@ -29,6 +30,7 @@ import { SetMemberRoleRequest } from '../model/setMemberRoleRequest';
2930import { UpdateOrganizationBucketRequest } from '../model/updateOrganizationBucketRequest' ;
3031import { UpdateOrganizationRequest } from '../model/updateOrganizationRequest' ;
3132import { UploadAssetResponse } from '../model/uploadAssetResponse' ;
33+ import { WhitelabelAdminCreateOrganizationRequest } from '../model/whitelabelAdminCreateOrganizationRequest' ;
3234
3335import { ObjectSerializer , Authentication , VoidAuth } from '../model/models' ;
3436import { HttpBasicAuth , ApiKeyAuth , OAuth } from '../model/models' ;
@@ -1259,6 +1261,90 @@ export class OrganizationRequiresAdminApi {
12591261
12601262 const errString = `Failed to call "${ localVarPath } ", returned ${ response . statusCode } : ` + response . body ;
12611263
1264+ if ( typeof body . success === 'boolean' && ! body . success ) {
1265+ reject ( new Error ( body . error || errString ) ) ;
1266+ }
1267+ else if ( response . statusCode && response . statusCode >= 200 && response . statusCode <= 299 ) {
1268+ resolve ( body ) ;
1269+ }
1270+ else {
1271+ reject ( errString ) ;
1272+ }
1273+ }
1274+ } ) ;
1275+ } ) ;
1276+ } ) ;
1277+ }
1278+ /**
1279+ * Create a new organization. This is an internal API only available to white label admins
1280+ * @summary Create new organization within white label context
1281+ * @param organizationId Organization ID
1282+ * @param whitelabelAdminCreateOrganizationRequest
1283+ */
1284+ public async whitelabelAdminCreateOrganization ( organizationId : number , whitelabelAdminCreateOrganizationRequest : WhitelabelAdminCreateOrganizationRequest , options : { headers : { [ name : string ] : string } } = { headers : { } } ) : Promise < CreateOrganizationResponse > {
1285+ const localVarPath = this . basePath + '/api/organizations/{organizationId}/whitelabel/organizations'
1286+ . replace ( '{' + 'organizationId' + '}' , encodeURIComponent ( String ( organizationId ) ) ) ;
1287+ let localVarQueryParameters : any = { } ;
1288+ let localVarHeaderParams : any = ( < any > Object ) . assign ( { } , this . defaultHeaders ) ;
1289+ const produces = [ 'application/json' ] ;
1290+ // give precedence to 'application/json'
1291+ if ( produces . indexOf ( 'application/json' ) >= 0 ) {
1292+ localVarHeaderParams . Accept = 'application/json' ;
1293+ } else {
1294+ localVarHeaderParams . Accept = produces . join ( ',' ) ;
1295+ }
1296+ let localVarFormParams : any = { } ;
1297+
1298+ // verify required parameter 'organizationId' is not null or undefined
1299+ if ( organizationId === null || organizationId === undefined ) {
1300+ throw new Error ( 'Required parameter organizationId was null or undefined when calling whitelabelAdminCreateOrganization.' ) ;
1301+ }
1302+
1303+ // verify required parameter 'whitelabelAdminCreateOrganizationRequest' is not null or undefined
1304+ if ( whitelabelAdminCreateOrganizationRequest === null || whitelabelAdminCreateOrganizationRequest === undefined ) {
1305+ throw new Error ( 'Required parameter whitelabelAdminCreateOrganizationRequest was null or undefined when calling whitelabelAdminCreateOrganization.' ) ;
1306+ }
1307+
1308+ ( < any > Object ) . assign ( localVarHeaderParams , options . headers ) ;
1309+
1310+ let localVarUseFormData = false ;
1311+
1312+ let localVarRequestOptions : localVarRequest . Options = {
1313+ method : 'POST' ,
1314+ qs : localVarQueryParameters ,
1315+ headers : localVarHeaderParams ,
1316+ uri : localVarPath ,
1317+ useQuerystring : this . _useQuerystring ,
1318+ agentOptions : { keepAlive : false } ,
1319+ json : true ,
1320+ body : ObjectSerializer . serialize ( whitelabelAdminCreateOrganizationRequest , "WhitelabelAdminCreateOrganizationRequest" )
1321+ } ;
1322+
1323+ let authenticationPromise = Promise . resolve ( ) ;
1324+ authenticationPromise = authenticationPromise . then ( ( ) => this . authentications . ApiKeyAuthentication . applyToRequest ( localVarRequestOptions ) ) ;
1325+
1326+ authenticationPromise = authenticationPromise . then ( ( ) => this . authentications . JWTAuthentication . applyToRequest ( localVarRequestOptions ) ) ;
1327+
1328+ authenticationPromise = authenticationPromise . then ( ( ) => this . authentications . JWTHttpHeaderAuthentication . applyToRequest ( localVarRequestOptions ) ) ;
1329+
1330+ authenticationPromise = authenticationPromise . then ( ( ) => this . authentications . default . applyToRequest ( localVarRequestOptions ) ) ;
1331+ return authenticationPromise . then ( ( ) => {
1332+ if ( Object . keys ( localVarFormParams ) . length ) {
1333+ if ( localVarUseFormData ) {
1334+ ( < any > localVarRequestOptions ) . formData = localVarFormParams ;
1335+ } else {
1336+ localVarRequestOptions . form = localVarFormParams ;
1337+ }
1338+ }
1339+ return new Promise < CreateOrganizationResponse > ( ( resolve , reject ) => {
1340+ localVarRequest ( localVarRequestOptions , ( error , response , body ) => {
1341+ if ( error ) {
1342+ reject ( error ) ;
1343+ } else {
1344+ body = ObjectSerializer . deserialize ( body , "CreateOrganizationResponse" ) ;
1345+
1346+ const errString = `Failed to call "${ localVarPath } ", returned ${ response . statusCode } : ` + response . body ;
1347+
12621348 if ( typeof body . success === 'boolean' && ! body . success ) {
12631349 reject ( new Error ( body . error || errString ) ) ;
12641350 }
0 commit comments