Skip to content

Commit f87294e

Browse files
updated apis of roles
1 parent 7ef66b6 commit f87294e

File tree

1 file changed

+20
-52
lines changed

1 file changed

+20
-52
lines changed

api/defaultApi.ts

Lines changed: 20 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -9160,7 +9160,7 @@ export class DefaultApi {
91609160
public async removeRoleAdmins(
91619161
authorization: string,
91629162
roleId: number,
9163-
removeRoleUsersRequest: RemoveRoleUsersRequest,
9163+
userIds: number[], // Directly expect an array of user IDs
91649164
options: { headers: { [name: string]: string } } = { headers: {} }
91659165
): Promise<{ response: http.IncomingMessage; body?: any }> {
91669166
const localVarPath =
@@ -9169,41 +9169,38 @@ export class DefaultApi {
91699169
"{" + "role_id" + "}",
91709170
encodeURIComponent(String(roleId))
91719171
);
9172+
91729173
let localVarQueryParameters: any = {};
91739174
let localVarHeaderParams: any = (<any>Object).assign(
91749175
{},
91759176
this._defaultHeaders
91769177
);
91779178
const produces = ["application/json"];
9178-
// give precedence to 'application/json'
9179+
// Give precedence to 'application/json'
91799180
if (produces.indexOf("application/json") >= 0) {
91809181
localVarHeaderParams.Accept = "application/json";
91819182
} else {
91829183
localVarHeaderParams.Accept = produces.join(",");
91839184
}
9184-
let localVarFormParams: any = {};
91859185

9186-
// verify required parameter 'authorization' is not null or undefined
9186+
// Verify required parameter 'authorization' is not null or undefined
91879187
if (authorization === null || authorization === undefined) {
91889188
throw new Error(
91899189
"Required parameter authorization was null or undefined when calling removeRoleAdmins."
91909190
);
91919191
}
91929192

9193-
// verify required parameter 'roleId' is not null or undefined
9193+
// Verify required parameter 'roleId' is not null or undefined
91949194
if (roleId === null || roleId === undefined) {
91959195
throw new Error(
91969196
"Required parameter roleId was null or undefined when calling removeRoleAdmins."
91979197
);
91989198
}
91999199

9200-
// verify required parameter 'removeRoleUsersRequest' is not null or undefined
9201-
if (
9202-
removeRoleUsersRequest === null ||
9203-
removeRoleUsersRequest === undefined
9204-
) {
9200+
// Verify required parameter 'userIds' is not null or undefined
9201+
if (userIds === null || userIds === undefined) {
92059202
throw new Error(
9206-
"Required parameter removeRoleUsersRequest was null or undefined when calling removeRoleAdmins."
9203+
"Required parameter userIds was null or undefined when calling removeRoleAdmins."
92079204
);
92089205
}
92099206

@@ -9213,19 +9210,14 @@ export class DefaultApi {
92139210
);
92149211
(<any>Object).assign(localVarHeaderParams, options.headers);
92159212

9216-
let localVarUseFormData = false;
9217-
92189213
let localVarRequestOptions: localVarRequest.Options = {
92199214
method: "DELETE",
92209215
qs: localVarQueryParameters,
92219216
headers: localVarHeaderParams,
92229217
uri: localVarPath,
92239218
useQuerystring: this._useQuerystring,
92249219
json: true,
9225-
body: ObjectSerializer.serialize(
9226-
removeRoleUsersRequest,
9227-
"RemoveRoleUsersRequest"
9228-
),
9220+
body: userIds, // Pass the array directly as the request body
92299221
};
92309222

92319223
let authenticationPromise = Promise.resolve();
@@ -9241,13 +9233,6 @@ export class DefaultApi {
92419233
}
92429234

92439235
return interceptorPromise.then(() => {
9244-
if (Object.keys(localVarFormParams).length) {
9245-
if (localVarUseFormData) {
9246-
(<any>localVarRequestOptions).formData = localVarFormParams;
9247-
} else {
9248-
localVarRequestOptions.form = localVarFormParams;
9249-
}
9250-
}
92519236
return new Promise<{ response: http.IncomingMessage; body?: any }>(
92529237
(resolve, reject) => {
92539238
localVarRequest(localVarRequestOptions, (error, response, body) => {
@@ -9269,6 +9254,7 @@ export class DefaultApi {
92699254
);
92709255
});
92719256
}
9257+
92729258
/**
92739259
*
92749260
* @param authorization
@@ -9278,7 +9264,7 @@ export class DefaultApi {
92789264
public async removeRoleUsers(
92799265
authorization: string,
92809266
roleId: number,
9281-
removeRoleUsersRequest: RemoveRoleUsersRequest,
9267+
userIds: Array<number>, // Updated to directly accept an array of user IDs
92829268
options: { headers: { [name: string]: string } } = { headers: {} }
92839269
): Promise<{ response: http.IncomingMessage; body?: any }> {
92849270
const localVarPath =
@@ -9287,42 +9273,36 @@ export class DefaultApi {
92879273
"{" + "role_id" + "}",
92889274
encodeURIComponent(String(roleId))
92899275
);
9276+
92909277
let localVarQueryParameters: any = {};
92919278
let localVarHeaderParams: any = (<any>Object).assign(
92929279
{},
92939280
this._defaultHeaders
92949281
);
9282+
92959283
const produces = ["application/json"];
92969284
// give precedence to 'application/json'
92979285
if (produces.indexOf("application/json") >= 0) {
92989286
localVarHeaderParams.Accept = "application/json";
92999287
} else {
93009288
localVarHeaderParams.Accept = produces.join(",");
93019289
}
9302-
let localVarFormParams: any = {};
93039290

9304-
// verify required parameter 'authorization' is not null or undefined
9291+
// Verify required parameter 'authorization' is not null or undefined
93059292
if (authorization === null || authorization === undefined) {
93069293
throw new Error(
93079294
"Required parameter authorization was null or undefined when calling removeRoleUsers."
93089295
);
93099296
}
93109297

9311-
// verify required parameter 'roleId' is not null or undefined
9298+
// Verify required parameter 'roleId' is not null or undefined
93129299
if (roleId === null || roleId === undefined) {
93139300
throw new Error(
93149301
"Required parameter roleId was null or undefined when calling removeRoleUsers."
93159302
);
93169303
}
9317-
9318-
// verify required parameter 'removeRoleUsersRequest' is not null or undefined
9319-
if (
9320-
removeRoleUsersRequest === null ||
9321-
removeRoleUsersRequest === undefined
9322-
) {
9323-
throw new Error(
9324-
"Required parameter removeRoleUsersRequest was null or undefined when calling removeRoleUsers."
9325-
);
9304+
if (!userIds || !Array.isArray(userIds)) {
9305+
throw new Error("User IDs must be a valid array.");
93269306
}
93279307

93289308
localVarHeaderParams["Authorization"] = ObjectSerializer.serialize(
@@ -9331,19 +9311,13 @@ export class DefaultApi {
93319311
);
93329312
(<any>Object).assign(localVarHeaderParams, options.headers);
93339313

9334-
let localVarUseFormData = false;
9335-
9336-
let localVarRequestOptions: localVarRequest.Options = {
9314+
const localVarRequestOptions: localVarRequest.Options = {
93379315
method: "DELETE",
93389316
qs: localVarQueryParameters,
93399317
headers: localVarHeaderParams,
93409318
uri: localVarPath,
9341-
useQuerystring: this._useQuerystring,
93429319
json: true,
9343-
body: ObjectSerializer.serialize(
9344-
removeRoleUsersRequest,
9345-
"RemoveRoleUsersRequest"
9346-
),
9320+
body: userIds, // Pass the array of user IDs directly as the request body
93479321
};
93489322

93499323
let authenticationPromise = Promise.resolve();
@@ -9359,13 +9333,6 @@ export class DefaultApi {
93599333
}
93609334

93619335
return interceptorPromise.then(() => {
9362-
if (Object.keys(localVarFormParams).length) {
9363-
if (localVarUseFormData) {
9364-
(<any>localVarRequestOptions).formData = localVarFormParams;
9365-
} else {
9366-
localVarRequestOptions.form = localVarFormParams;
9367-
}
9368-
}
93699336
return new Promise<{ response: http.IncomingMessage; body?: any }>(
93709337
(resolve, reject) => {
93719338
localVarRequest(localVarRequestOptions, (error, response, body) => {
@@ -9387,6 +9354,7 @@ export class DefaultApi {
93879354
);
93889355
});
93899356
}
9357+
93909358
/**
93919359
*
93929360
* @param authorization

0 commit comments

Comments
 (0)