Skip to content

Commit aca5a22

Browse files
bulk mapping sort code refactor
1 parent 014a37f commit aca5a22

File tree

1 file changed

+7
-87
lines changed

1 file changed

+7
-87
lines changed

api/defaultApi.ts

Lines changed: 7 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -408,96 +408,16 @@ export class DefaultApi {
408408
requestBody: Array<number>,
409409
options: { headers: { [name: string]: string } } = { headers: {} }
410410
): Promise<{ response: http.IncomingMessage; body: Array<number> }> {
411-
const localVarPath = this.basePath + "/api/2/mappings/sort";
412-
let localVarQueryParameters: any = {};
413-
let localVarHeaderParams: any = (<any>Object).assign(
414-
{},
415-
this._defaultHeaders
416-
);
417-
const produces = ["application/json"];
418-
// give precedence to 'application/json'
419-
if (produces.indexOf("application/json") >= 0) {
420-
localVarHeaderParams.Accept = "application/json";
421-
} else {
422-
localVarHeaderParams.Accept = produces.join(",");
423-
}
424-
let localVarFormParams: any = {};
425-
426-
// verify required parameter 'authorization' is not null or undefined
427-
if (authorization === null || authorization === undefined) {
428-
throw new Error(
429-
"Required parameter authorization was null or undefined when calling bulkMappingSort."
430-
);
431-
}
432-
433-
// verify required parameter 'requestBody' is not null or undefined
434-
if (requestBody === null || requestBody === undefined) {
435-
throw new Error(
436-
"Required parameter requestBody was null or undefined when calling bulkMappingSort."
437-
);
438-
}
439-
440-
localVarHeaderParams["Authorization"] = ObjectSerializer.serialize(
411+
return this.request<Array<number>>(
412+
"PUT",
413+
"/api/2/mappings/sort",
441414
authorization,
442-
"string"
443-
);
444-
(<any>Object).assign(localVarHeaderParams, options.headers);
445-
446-
let localVarUseFormData = false;
447-
448-
let localVarRequestOptions: localVarRequest.Options = {
449-
method: "PUT",
450-
qs: localVarQueryParameters,
451-
headers: localVarHeaderParams,
452-
uri: localVarPath,
453-
useQuerystring: this._useQuerystring,
454-
json: true,
455-
body: ObjectSerializer.serialize(requestBody, "Array<number>"),
456-
};
457-
458-
let authenticationPromise = Promise.resolve();
459-
authenticationPromise = authenticationPromise.then(() =>
460-
this.authentications.default.applyToRequest(localVarRequestOptions)
415+
requestBody, // Sending requestBody
416+
{}, // No query parameters
417+
options
461418
);
462-
463-
let interceptorPromise = authenticationPromise;
464-
for (const interceptor of this.interceptors) {
465-
interceptorPromise = interceptorPromise.then(() =>
466-
interceptor(localVarRequestOptions)
467-
);
468-
}
469-
470-
return interceptorPromise.then(() => {
471-
if (Object.keys(localVarFormParams).length) {
472-
if (localVarUseFormData) {
473-
(<any>localVarRequestOptions).formData = localVarFormParams;
474-
} else {
475-
localVarRequestOptions.form = localVarFormParams;
476-
}
477-
}
478-
return new Promise<{
479-
response: http.IncomingMessage;
480-
body: Array<number>;
481-
}>((resolve, reject) => {
482-
localVarRequest(localVarRequestOptions, (error, response, body) => {
483-
if (error) {
484-
reject(error);
485-
} else {
486-
if (
487-
response.statusCode &&
488-
response.statusCode >= 200 &&
489-
response.statusCode <= 299
490-
) {
491-
body = ObjectSerializer.deserialize(body, "Array<number>");
492-
resolve({ response: response, body: body });
493-
} else {
494-
reject(new HttpError(response, body, response.statusCode));
495-
}
496-
}
497-
});
498-
});
499-
});
500419
}
420+
501421
/**
502422
*
503423
* @param authorization

0 commit comments

Comments
 (0)