UNPKG

@useapi/midjourney-api

Version:

TypeScript client library for Midjourney API by useapi.net

708 lines 62.5 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator = (this && this.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (g && (g = 0, op[0] && (_ = 0)), _) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; Object.defineProperty(exports, "__esModule", { value: true }); exports.DefaultApiResponseProcessor = exports.DefaultApiRequestFactory = void 0; var baseapi_1 = require("./baseapi"); var http_1 = require("../http/http"); var ObjectSerializer_1 = require("../models/ObjectSerializer"); var exception_1 = require("./exception"); var util_1 = require("../util"); var DefaultApiRequestFactory = (function (_super) { __extends(DefaultApiRequestFactory, _super); function DefaultApiRequestFactory() { return _super !== null && _super.apply(this, arguments) || this; } DefaultApiRequestFactory.prototype.accountGet = function (_options) { var _a, _b, _c; return __awaiter(this, void 0, void 0, function () { var _config, localVarPath, requestContext, authMethod, defaultAuth; return __generator(this, function (_d) { switch (_d.label) { case 0: _config = _options || this.configuration; localVarPath = '/account'; requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8"); authMethod = _config.authMethods["apiToken"]; if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2]; return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))]; case 1: _d.sent(); _d.label = 2; case 2: defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default); if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4]; return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))]; case 3: _d.sent(); _d.label = 4; case 4: return [2, requestContext]; } }); }); }; DefaultApiRequestFactory.prototype.jobsBlendPost = function (jobsBlendPostRequest, _options) { var _a, _b, _c; return __awaiter(this, void 0, void 0, function () { var _config, localVarPath, requestContext, contentType, serializedBody, authMethod, defaultAuth; return __generator(this, function (_d) { switch (_d.label) { case 0: _config = _options || this.configuration; if (jobsBlendPostRequest === null || jobsBlendPostRequest === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "jobsBlendPost", "jobsBlendPostRequest"); } localVarPath = '/jobs/blend'; requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8"); contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(jobsBlendPostRequest, "JobsBlendPostRequest", ""), contentType); requestContext.setBody(serializedBody); authMethod = _config.authMethods["apiToken"]; if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2]; return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))]; case 1: _d.sent(); _d.label = 2; case 2: defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default); if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4]; return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))]; case 3: _d.sent(); _d.label = 4; case 4: return [2, requestContext]; } }); }); }; DefaultApiRequestFactory.prototype.jobsButtonPost = function (jobsButtonPostRequest, _options) { var _a, _b, _c; return __awaiter(this, void 0, void 0, function () { var _config, localVarPath, requestContext, contentType, serializedBody, authMethod, defaultAuth; return __generator(this, function (_d) { switch (_d.label) { case 0: _config = _options || this.configuration; if (jobsButtonPostRequest === null || jobsButtonPostRequest === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "jobsButtonPost", "jobsButtonPostRequest"); } localVarPath = '/jobs/button'; requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8"); contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(jobsButtonPostRequest, "JobsButtonPostRequest", ""), contentType); requestContext.setBody(serializedBody); authMethod = _config.authMethods["apiToken"]; if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2]; return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))]; case 1: _d.sent(); _d.label = 2; case 2: defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default); if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4]; return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))]; case 3: _d.sent(); _d.label = 4; case 4: return [2, requestContext]; } }); }); }; DefaultApiRequestFactory.prototype.jobsCancelGet = function (jobid, _options) { var _a, _b, _c; return __awaiter(this, void 0, void 0, function () { var _config, localVarPath, requestContext, authMethod, defaultAuth; return __generator(this, function (_d) { switch (_d.label) { case 0: _config = _options || this.configuration; if (jobid === null || jobid === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "jobsCancelGet", "jobid"); } localVarPath = '/jobs/cancel/'; requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8"); if (jobid !== undefined) { requestContext.setQueryParam("jobid", ObjectSerializer_1.ObjectSerializer.serialize(jobid, "string", "")); } authMethod = _config.authMethods["apiToken"]; if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2]; return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))]; case 1: _d.sent(); _d.label = 2; case 2: defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default); if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4]; return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))]; case 3: _d.sent(); _d.label = 4; case 4: return [2, requestContext]; } }); }); }; DefaultApiRequestFactory.prototype.jobsDescribePost = function (jobsDescribePostRequest, _options) { var _a, _b, _c; return __awaiter(this, void 0, void 0, function () { var _config, localVarPath, requestContext, contentType, serializedBody, authMethod, defaultAuth; return __generator(this, function (_d) { switch (_d.label) { case 0: _config = _options || this.configuration; if (jobsDescribePostRequest === null || jobsDescribePostRequest === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "jobsDescribePost", "jobsDescribePostRequest"); } localVarPath = '/jobs/describe'; requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8"); contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(jobsDescribePostRequest, "JobsDescribePostRequest", ""), contentType); requestContext.setBody(serializedBody); authMethod = _config.authMethods["apiToken"]; if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2]; return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))]; case 1: _d.sent(); _d.label = 2; case 2: defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default); if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4]; return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))]; case 3: _d.sent(); _d.label = 4; case 4: return [2, requestContext]; } }); }); }; DefaultApiRequestFactory.prototype.jobsGet = function (jobid, _options) { var _a, _b, _c; return __awaiter(this, void 0, void 0, function () { var _config, localVarPath, requestContext, authMethod, defaultAuth; return __generator(this, function (_d) { switch (_d.label) { case 0: _config = _options || this.configuration; if (jobid === null || jobid === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "jobsGet", "jobid"); } localVarPath = '/jobs/'; requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8"); if (jobid !== undefined) { requestContext.setQueryParam("jobid", ObjectSerializer_1.ObjectSerializer.serialize(jobid, "string", "")); } authMethod = _config.authMethods["apiToken"]; if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2]; return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))]; case 1: _d.sent(); _d.label = 2; case 2: defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default); if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4]; return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))]; case 3: _d.sent(); _d.label = 4; case 4: return [2, requestContext]; } }); }); }; DefaultApiRequestFactory.prototype.jobsListGet = function (_options) { var _a, _b, _c; return __awaiter(this, void 0, void 0, function () { var _config, localVarPath, requestContext, authMethod, defaultAuth; return __generator(this, function (_d) { switch (_d.label) { case 0: _config = _options || this.configuration; localVarPath = '/jobs'; requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8"); authMethod = _config.authMethods["apiToken"]; if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2]; return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))]; case 1: _d.sent(); _d.label = 2; case 2: defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default); if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4]; return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))]; case 3: _d.sent(); _d.label = 4; case 4: return [2, requestContext]; } }); }); }; DefaultApiRequestFactory.prototype.jobsImaginePost = function (jobsImaginePostRequest, _options) { var _a, _b, _c; return __awaiter(this, void 0, void 0, function () { var _config, localVarPath, requestContext, contentType, serializedBody, authMethod, defaultAuth; return __generator(this, function (_d) { switch (_d.label) { case 0: _config = _options || this.configuration; if (jobsImaginePostRequest === null || jobsImaginePostRequest === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "jobsImaginePost", "jobsImaginePostRequest"); } localVarPath = '/jobs/imagine'; requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8"); contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(jobsImaginePostRequest, "JobsImaginePostRequest", ""), contentType); requestContext.setBody(serializedBody); authMethod = _config.authMethods["apiToken"]; if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2]; return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))]; case 1: _d.sent(); _d.label = 2; case 2: defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default); if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4]; return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))]; case 3: _d.sent(); _d.label = 4; case 4: return [2, requestContext]; } }); }); }; return DefaultApiRequestFactory; }(baseapi_1.BaseAPIRequestFactory)); exports.DefaultApiRequestFactory = DefaultApiRequestFactory; var DefaultApiResponseProcessor = (function () { function DefaultApiResponseProcessor() { } DefaultApiResponseProcessor.prototype.accountGetWithHttpInfo = function (response) { return __awaiter(this, void 0, void 0, function () { var contentType, body, _a, _b, _c, _d, body, _e, _f, _g, _h, body, _j, _k, _l, _m, _o, _p; return __generator(this, function (_q) { switch (_q.label) { case 0: contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (!(0, util_1.isCodeInRange)("200", response.httpStatusCode)) return [3, 2]; _b = (_a = ObjectSerializer_1.ObjectSerializer).deserialize; _d = (_c = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 1: body = _b.apply(_a, [_d.apply(_c, [_q.sent(), contentType]), "AccountResponse", ""]); return [2, new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body)]; case 2: if (!(0, util_1.isCodeInRange)("401", response.httpStatusCode)) return [3, 4]; _f = (_e = ObjectSerializer_1.ObjectSerializer).deserialize; _h = (_g = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 3: body = _f.apply(_e, [_h.apply(_g, [_q.sent(), contentType]), "ResponseError", ""]); throw new exception_1.ApiException(response.httpStatusCode, "Unauthorized", body, response.headers); case 4: if (!(response.httpStatusCode >= 200 && response.httpStatusCode <= 299)) return [3, 6]; _k = (_j = ObjectSerializer_1.ObjectSerializer).deserialize; _m = (_l = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 5: body = _k.apply(_j, [_m.apply(_l, [_q.sent(), contentType]), "AccountResponse", ""]); return [2, new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body)]; case 6: _o = exception_1.ApiException.bind; _p = [void 0, response.httpStatusCode, "Unknown API Status Code!"]; return [4, response.getBodyAsAny()]; case 7: throw new (_o.apply(exception_1.ApiException, _p.concat([_q.sent(), response.headers])))(); } }); }); }; DefaultApiResponseProcessor.prototype.jobsBlendPostWithHttpInfo = function (response) { return __awaiter(this, void 0, void 0, function () { var contentType, body, _a, _b, _c, _d, body, _e, _f, _g, _h, body, _j, _k, _l, _m, body, _o, _p, _q, _r, body, _s, _t, _u, _v, body, _w, _x, _y, _z, body, _0, _1, _2, _3, _4, _5; return __generator(this, function (_6) { switch (_6.label) { case 0: contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (!(0, util_1.isCodeInRange)("200", response.httpStatusCode)) return [3, 2]; _b = (_a = ObjectSerializer_1.ObjectSerializer).deserialize; _d = (_c = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 1: body = _b.apply(_a, [_d.apply(_c, [_6.sent(), contentType]), "BlendResponse", ""]); return [2, new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body)]; case 2: if (!(0, util_1.isCodeInRange)("401", response.httpStatusCode)) return [3, 4]; _f = (_e = ObjectSerializer_1.ObjectSerializer).deserialize; _h = (_g = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 3: body = _f.apply(_e, [_h.apply(_g, [_6.sent(), contentType]), "ResponseError", ""]); throw new exception_1.ApiException(response.httpStatusCode, "Unauthorized", body, response.headers); case 4: if (!(0, util_1.isCodeInRange)("412", response.httpStatusCode)) return [3, 6]; _k = (_j = ObjectSerializer_1.ObjectSerializer).deserialize; _m = (_l = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 5: body = _k.apply(_j, [_m.apply(_l, [_6.sent(), contentType]), "ResponseError", ""]); throw new exception_1.ApiException(response.httpStatusCode, "blendUrls, discord, server or channel value is missing, one of blendUrls values not a valid URL or URL which can not be retrieved", body, response.headers); case 6: if (!(0, util_1.isCodeInRange)("413", response.httpStatusCode)) return [3, 8]; _p = (_o = ObjectSerializer_1.ObjectSerializer).deserialize; _r = (_q = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 7: body = _p.apply(_o, [_r.apply(_q, [_6.sent(), contentType]), "ResponseError", ""]); throw new exception_1.ApiException(response.httpStatusCode, "replyRef or replyUrl is too long", body, response.headers); case 8: if (!(0, util_1.isCodeInRange)("422", response.httpStatusCode)) return [3, 10]; _t = (_s = ObjectSerializer_1.ObjectSerializer).deserialize; _v = (_u = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 9: body = _t.apply(_s, [_v.apply(_u, [_6.sent(), contentType]), "ImagineResponseModerated", ""]); throw new exception_1.ApiException(response.httpStatusCode, "Unable to find posted message, likely moderated or invalid url", body, response.headers); case 10: if (!(0, util_1.isCodeInRange)("429", response.httpStatusCode)) return [3, 12]; _x = (_w = ObjectSerializer_1.ObjectSerializer).deserialize; _z = (_y = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 11: body = _x.apply(_w, [_z.apply(_y, [_6.sent(), contentType]), "ResponseMaxJobs", ""]); throw new exception_1.ApiException(response.httpStatusCode, "API query is full and can not accept new jobs/blend requests", body, response.headers); case 12: if (!(response.httpStatusCode >= 200 && response.httpStatusCode <= 299)) return [3, 14]; _1 = (_0 = ObjectSerializer_1.ObjectSerializer).deserialize; _3 = (_2 = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 13: body = _1.apply(_0, [_3.apply(_2, [_6.sent(), contentType]), "BlendResponse", ""]); return [2, new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body)]; case 14: _4 = exception_1.ApiException.bind; _5 = [void 0, response.httpStatusCode, "Unknown API Status Code!"]; return [4, response.getBodyAsAny()]; case 15: throw new (_4.apply(exception_1.ApiException, _5.concat([_6.sent(), response.headers])))(); } }); }); }; DefaultApiResponseProcessor.prototype.jobsButtonPostWithHttpInfo = function (response) { return __awaiter(this, void 0, void 0, function () { var contentType, body, _a, _b, _c, _d, body, _e, _f, _g, _h, body, _j, _k, _l, _m, body, _o, _p, _q, _r, body, _s, _t, _u, _v, body, _w, _x, _y, _z, body, _0, _1, _2, _3, body, _4, _5, _6, _7, body, _8, _9, _10, _11, _12, _13; return __generator(this, function (_14) { switch (_14.label) { case 0: contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (!(0, util_1.isCodeInRange)("200", response.httpStatusCode)) return [3, 2]; _b = (_a = ObjectSerializer_1.ObjectSerializer).deserialize; _d = (_c = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 1: body = _b.apply(_a, [_d.apply(_c, [_14.sent(), contentType]), "ButtonResponse", ""]); return [2, new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body)]; case 2: if (!(0, util_1.isCodeInRange)("400", response.httpStatusCode)) return [3, 4]; _f = (_e = ObjectSerializer_1.ObjectSerializer).deserialize; _h = (_g = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 3: body = _f.apply(_e, [_h.apply(_g, [_14.sent(), contentType]), "ResponseError", ""]); throw new exception_1.ApiException(response.httpStatusCode, "Button not supported or not found in jobid buttons array", body, response.headers); case 4: if (!(0, util_1.isCodeInRange)("401", response.httpStatusCode)) return [3, 6]; _k = (_j = ObjectSerializer_1.ObjectSerializer).deserialize; _m = (_l = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 5: body = _k.apply(_j, [_m.apply(_l, [_14.sent(), contentType]), "ResponseError", ""]); throw new exception_1.ApiException(response.httpStatusCode, "Unauthorized", body, response.headers); case 6: if (!(0, util_1.isCodeInRange)("404", response.httpStatusCode)) return [3, 8]; _p = (_o = ObjectSerializer_1.ObjectSerializer).deserialize; _r = (_q = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 7: body = _p.apply(_o, [_r.apply(_q, [_14.sent(), contentType]), "ResponseError", ""]); throw new exception_1.ApiException(response.httpStatusCode, "Unable to locate jobid", body, response.headers); case 8: if (!(0, util_1.isCodeInRange)("409", response.httpStatusCode)) return [3, 10]; _t = (_s = ObjectSerializer_1.ObjectSerializer).deserialize; _v = (_u = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 9: body = _t.apply(_s, [_v.apply(_u, [_14.sent(), contentType]), "ButtonResponseErrorUpscaled", ""]); throw new exception_1.ApiException(response.httpStatusCode, "Upscale button already executed by jobid", body, response.headers); case 10: if (!(0, util_1.isCodeInRange)("412", response.httpStatusCode)) return [3, 12]; _x = (_w = ObjectSerializer_1.ObjectSerializer).deserialize; _z = (_y = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 11: body = _x.apply(_w, [_z.apply(_y, [_14.sent(), contentType]), "ResponseError", ""]); throw new exception_1.ApiException(response.httpStatusCode, "jobid or button value is missing", body, response.headers); case 12: if (!(0, util_1.isCodeInRange)("413", response.httpStatusCode)) return [3, 14]; _1 = (_0 = ObjectSerializer_1.ObjectSerializer).deserialize; _3 = (_2 = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 13: body = _1.apply(_0, [_3.apply(_2, [_14.sent(), contentType]), "ResponseError", ""]); throw new exception_1.ApiException(response.httpStatusCode, "replyRef or replyUrl is too long", body, response.headers); case 14: if (!(0, util_1.isCodeInRange)("429", response.httpStatusCode)) return [3, 16]; _5 = (_4 = ObjectSerializer_1.ObjectSerializer).deserialize; _7 = (_6 = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 15: body = _5.apply(_4, [_7.apply(_6, [_14.sent(), contentType]), "ResponseMaxJobs", ""]); throw new exception_1.ApiException(response.httpStatusCode, "API query is full and can not accept new jobs/button requests", body, response.headers); case 16: if (!(response.httpStatusCode >= 200 && response.httpStatusCode <= 299)) return [3, 18]; _9 = (_8 = ObjectSerializer_1.ObjectSerializer).deserialize; _11 = (_10 = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 17: body = _9.apply(_8, [_11.apply(_10, [_14.sent(), contentType]), "ButtonResponse", ""]); return [2, new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body)]; case 18: _12 = exception_1.ApiException.bind; _13 = [void 0, response.httpStatusCode, "Unknown API Status Code!"]; return [4, response.getBodyAsAny()]; case 19: throw new (_12.apply(exception_1.ApiException, _13.concat([_14.sent(), response.headers])))(); } }); }); }; DefaultApiResponseProcessor.prototype.jobsCancelGetWithHttpInfo = function (response) { return __awaiter(this, void 0, void 0, function () { var contentType, body, _a, _b, _c, _d, body, _e, _f, _g, _h, body, _j, _k, _l, _m, body, _o, _p, _q, _r, body, _s, _t, _u, _v, _w, _x; return __generator(this, function (_y) { switch (_y.label) { case 0: contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (!(0, util_1.isCodeInRange)("200", response.httpStatusCode)) return [3, 2]; _b = (_a = ObjectSerializer_1.ObjectSerializer).deserialize; _d = (_c = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 1: body = _b.apply(_a, [_d.apply(_c, [_y.sent(), contentType]), "JobCancelResponse", ""]); return [2, new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body)]; case 2: if (!(0, util_1.isCodeInRange)("400", response.httpStatusCode)) return [3, 4]; _f = (_e = ObjectSerializer_1.ObjectSerializer).deserialize; _h = (_g = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 3: body = _f.apply(_e, [_h.apply(_g, [_y.sent(), contentType]), "ResponseError", ""]); throw new exception_1.ApiException(response.httpStatusCode, "Query param jobid not provided", body, response.headers); case 4: if (!(0, util_1.isCodeInRange)("401", response.httpStatusCode)) return [3, 6]; _k = (_j = ObjectSerializer_1.ObjectSerializer).deserialize; _m = (_l = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 5: body = _k.apply(_j, [_m.apply(_l, [_y.sent(), contentType]), "ResponseError", ""]); throw new exception_1.ApiException(response.httpStatusCode, "Unauthorized", body, response.headers); case 6: if (!(0, util_1.isCodeInRange)("404", response.httpStatusCode)) return [3, 8]; _p = (_o = ObjectSerializer_1.ObjectSerializer).deserialize; _r = (_q = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 7: body = _p.apply(_o, [_r.apply(_q, [_y.sent(), contentType]), "ResponseError", ""]); throw new exception_1.ApiException(response.httpStatusCode, "Unable to locate jobid", body, response.headers); case 8: if (!(response.httpStatusCode >= 200 && response.httpStatusCode <= 299)) return [3, 10]; _t = (_s = ObjectSerializer_1.ObjectSerializer).deserialize; _v = (_u = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 9: body = _t.apply(_s, [_v.apply(_u, [_y.sent(), contentType]), "JobCancelResponse", ""]); return [2, new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body)]; case 10: _w = exception_1.ApiException.bind; _x = [void 0, response.httpStatusCode, "Unknown API Status Code!"]; return [4, response.getBodyAsAny()]; case 11: throw new (_w.apply(exception_1.ApiException, _x.concat([_y.sent(), response.headers])))(); } }); }); }; DefaultApiResponseProcessor.prototype.jobsDescribePostWithHttpInfo = function (response) { return __awaiter(this, void 0, void 0, function () { var contentType, body, _a, _b, _c, _d, body, _e, _f, _g, _h, body, _j, _k, _l, _m, body, _o, _p, _q, _r, body, _s, _t, _u, _v, body, _w, _x, _y, _z, body, _0, _1, _2, _3, _4, _5; return __generator(this, function (_6) { switch (_6.label) { case 0: contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (!(0, util_1.isCodeInRange)("200", response.httpStatusCode)) return [3, 2]; _b = (_a = ObjectSerializer_1.ObjectSerializer).deserialize; _d = (_c = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 1: body = _b.apply(_a, [_d.apply(_c, [_6.sent(), contentType]), "DescribeResponse", ""]); return [2, new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body)]; case 2: if (!(0, util_1.isCodeInRange)("401", response.httpStatusCode)) return [3, 4]; _f = (_e = ObjectSerializer_1.ObjectSerializer).deserialize; _h = (_g = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 3: body = _f.apply(_e, [_h.apply(_g, [_6.sent(), contentType]), "ResponseError", ""]); throw new exception_1.ApiException(response.httpStatusCode, "Unauthorized", body, response.headers); case 4: if (!(0, util_1.isCodeInRange)("412", response.httpStatusCode)) return [3, 6]; _k = (_j = ObjectSerializer_1.ObjectSerializer).deserialize; _m = (_l = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 5: body = _k.apply(_j, [_m.apply(_l, [_6.sent(), contentType]), "ResponseError", ""]); throw new exception_1.ApiException(response.httpStatusCode, "describeUrl, discord, server or channel value is missing, describeUrl value not a valid URL or URL which can not be retrieved", body, response.headers); case 6: if (!(0, util_1.isCodeInRange)("413", response.httpStatusCode)) return [3, 8]; _p = (_o = ObjectSerializer_1.ObjectSerializer).deserialize; _r = (_q = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 7: body = _p.apply(_o, [_r.apply(_q, [_6.sent(), contentType]), "ResponseError", ""]); throw new exception_1.ApiException(response.httpStatusCode, "replyRef or replyUrl is too long", body, response.headers); case 8: if (!(0, util_1.isCodeInRange)("422", response.httpStatusCode)) return [3, 10]; _t = (_s = ObjectSerializer_1.ObjectSerializer).deserialize; _v = (_u = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 9: body = _t.apply(_s, [_v.apply(_u, [_6.sent(), contentType]), "ImagineResponseModerated", ""]); throw new exception_1.ApiException(response.httpStatusCode, "Unable to find posted message, likely moderated or invalid url", body, response.headers); case 10: if (!(0, util_1.isCodeInRange)("429", response.httpStatusCode)) return [3, 12]; _x = (_w = ObjectSerializer_1.ObjectSerializer).deserialize; _z = (_y = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 11: body = _x.apply(_w, [_z.apply(_y, [_6.sent(), contentType]), "ResponseMaxJobs", ""]); throw new exception_1.ApiException(response.httpStatusCode, "API query is full and can not accept new jobs/blend requests", body, response.headers); case 12: if (!(response.httpStatusCode >= 200 && response.httpStatusCode <= 299)) return [3, 14]; _1 = (_0 = ObjectSerializer_1.ObjectSerializer).deserialize; _3 = (_2 = ObjectSerializer_1.ObjectSerializer).parse; return [4, response.body.text()]; case 13: body = _1.apply(_0, [_3.apply(_2, [_6.sent(), contentType]), "DescribeResponse", ""]); return [2, new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body)]; case 14: _4 = exception_1.ApiException.bind; _5 = [void 0, response.httpStatusCode, "Unknown API Status Code!"]; return [4, response.getBodyAsAny()]; case 15: throw new (_4.apply(exception_1.ApiException, _5.concat([_6.sent(), response.headers])))(); } }); }); }; DefaultApiResponseProcessor.prototype.jobsGetWithHttpInfo = function (response) { return __awaiter(this, void 0, void 0, function () { var contentType, body, _a, _b, _c, _d, body, _e, _f, _g, _h, body, _j, _k, _l, _m, body, _o, _p, _q, _r, body, _s, _t, _u, _v, _w, _x; return __generat