UNPKG

gunbot-sdk-js

Version:

Open-source JavaScript & TypeScript **SDK** for controlling the Gunbot trading bot REST API (crypto, ETF, stock)

1,301 lines (1,273 loc) 207 kB
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) { if (typeof require !== "undefined") return require.apply(this, arguments); throw Error('Dynamic require of "' + x + '" is not supported'); }); // src/ApiClient.js import superagent from "superagent"; var ApiClient = class _ApiClient { constructor() { this.basePath = "http://your-gunbot-instance.com:3000/api/v1".replace(/\/+$/, ""); this.authentications = {}; this.defaultHeaders = {}; this.timeout = 6e4; this.cache = true; this.enableCookies = false; if (typeof window === "undefined") { this.agent = new superagent.agent(); } this.requestAgent = null; } /** * Returns a string representation for an actual parameter. * @param param The actual parameter. * @returns {String} The string representation of <code>param</code>. */ paramToString(param) { if (param == void 0 || param == null) { return ""; } if (param instanceof Date) { return param.toJSON(); } return param.toString(); } /** * Builds full URL by appending the given path to the base URL and replacing path parameter place-holders with parameter values. * NOTE: query parameters are not handled here. * @param {String} path The path to append to the base URL. * @param {Object} pathParams The parameter values to append. * @returns {String} The encoded path with parameter values substituted. */ buildUrl(path, pathParams) { if (!path.match(/^\//)) { path = "/" + path; } var url = this.basePath + path; url = url.replace(/\{([\w-]+)\}/g, (fullMatch, key) => { var value; if (pathParams.hasOwnProperty(key)) { value = this.paramToString(pathParams[key]); } else { value = fullMatch; } return encodeURIComponent(value); }); return url; } /** * Checks whether the given content type represents JSON.<br> * JSON content type examples:<br> * <ul> * <li>application/json</li> * <li>application/json; charset=UTF8</li> * <li>APPLICATION/JSON</li> * </ul> * @param {String} contentType The MIME content type to check. * @returns {Boolean} <code>true</code> if <code>contentType</code> represents JSON, otherwise <code>false</code>. */ isJsonMime(contentType) { return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i)); } /** * Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first. * @param {Array.<String>} contentTypes * @returns {String} The chosen content type, preferring JSON. */ jsonPreferredMime(contentTypes) { for (var i = 0; i < contentTypes.length; i++) { if (this.isJsonMime(contentTypes[i])) { return contentTypes[i]; } } return contentTypes[0]; } /** * Checks whether the given parameter value represents file-like content. * @param param The parameter to check. * @returns {Boolean} <code>true</code> if <code>param</code> represents a file. */ isFileParam(param) { if (typeof __require === "function") { let fs; try { fs = __require("fs"); } catch (err) { } if (fs && fs.ReadStream && param instanceof fs.ReadStream) { return true; } } if (typeof Buffer === "function" && param instanceof Buffer) { return true; } if (typeof Blob === "function" && param instanceof Blob) { return true; } if (typeof File === "function" && param instanceof File) { return true; } return false; } /** * Normalizes parameter values: * <ul> * <li>remove nils</li> * <li>keep files and arrays</li> * <li>format to string with `paramToString` for other cases</li> * </ul> * @param {Object.<String, Object>} params The parameters as object properties. * @returns {Object.<String, Object>} normalized parameters. */ normalizeParams(params) { var newParams = {}; for (var key in params) { if (params.hasOwnProperty(key) && params[key] != void 0 && params[key] != null) { var value = params[key]; if (this.isFileParam(value) || Array.isArray(value)) { newParams[key] = value; } else { newParams[key] = this.paramToString(value); } } } return newParams; } /** * Enumeration of collection format separator strategies. * @enum {String} * @readonly */ static CollectionFormatEnum = { /** * Comma-separated values. Value: <code>csv</code> * @const */ CSV: ",", /** * Space-separated values. Value: <code>ssv</code> * @const */ SSV: " ", /** * Tab-separated values. Value: <code>tsv</code> * @const */ TSV: " ", /** * Pipe(|)-separated values. Value: <code>pipes</code> * @const */ PIPES: "|", /** * Native array. Value: <code>multi</code> * @const */ MULTI: "multi" }; /** * Builds a string representation of an array-type actual parameter, according to the given collection format. * @param {Array} param An array parameter. * @param {module:ApiClient.CollectionFormatEnum} collectionFormat The array element separator strategy. * @returns {String|Array} A string representation of the supplied collection, using the specified delimiter. Returns * <code>param</code> as is if <code>collectionFormat</code> is <code>multi</code>. */ buildCollectionParam(param, collectionFormat) { if (param == null) { return null; } switch (collectionFormat) { case "csv": return param.map(this.paramToString).join(","); case "ssv": return param.map(this.paramToString).join(" "); case "tsv": return param.map(this.paramToString).join(" "); case "pipes": return param.map(this.paramToString).join("|"); case "multi": return param.map(this.paramToString); default: throw new Error("Unknown collection format: " + collectionFormat); } } /** * Applies authentication headers to the request. * @param {Object} request The request object created by a <code>superagent()</code> call. * @param {Array.<String>} authNames An array of authentication method names. */ applyAuthToRequest(request, authNames) { authNames.forEach((authName) => { var auth = this.authentications[authName]; switch (auth.type) { case "basic": if (auth.username || auth.password) { request.auth(auth.username || "", auth.password || ""); } break; case "apiKey": if (auth.apiKey) { var data = {}; if (auth.apiKeyPrefix) { data[auth.name] = auth.apiKeyPrefix + " " + auth.apiKey; } else { data[auth.name] = auth.apiKey; } if (auth["in"] === "header") { request.set(data); } else { request.query(data); } } break; case "oauth2": if (auth.accessToken) { request.set({ "Authorization": "Bearer " + auth.accessToken }); } break; default: throw new Error("Unknown authentication type: " + auth.type); } }); } /** * Deserializes an HTTP response body into a value of the specified type. * @param {Object} response A SuperAgent response object. * @param {(String|Array.<String>|Object.<String, Object>|Function)} returnType The type to return. Pass a string for simple types * or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To * return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type: * all properties on <code>data<code> will be converted to this type. * @returns A value of the specified type. */ deserialize(response, returnType) { if (response == null || returnType == null || response.status == 204) { return null; } var data = response.body; if (data == null || typeof data === "object" && typeof data.length === "undefined" && !Object.keys(data).length) { data = response.text; } return _ApiClient.convertToType(data, returnType); } /** * Callback function to receive the result of the operation. * @callback module:ApiClient~callApiCallback * @param {String} error Error message, if any. * @param data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Invokes the REST service using the supplied settings and parameters. * @param {String} path The base URL to invoke. * @param {String} httpMethod The HTTP method to use. * @param {Object.<String, String>} pathParams A map of path parameters and their values. * @param {Object.<String, Object>} queryParams A map of query parameters and their values. * @param {Object.<String, Object>} headerParams A map of header parameters and their values. * @param {Object.<String, Object>} formParams A map of form parameters and their values. * @param {Object} bodyParam The value to pass as the request body. * @param {Array.<String>} authNames An array of authentication type names. * @param {Array.<String>} contentTypes An array of request MIME types. * @param {Array.<String>} accepts An array of acceptable response MIME types. * @param {(String|Array|ObjectFunction)} returnType The required type to return; can be a string for simple types or the * constructor for a complex type. * @param {module:ApiClient~callApiCallback} callback The callback function. * @returns {Object} The SuperAgent request object. */ callApi(path, httpMethod, pathParams, queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts, returnType, callback) { var url = this.buildUrl(path, pathParams); var request = superagent(httpMethod, url); this.applyAuthToRequest(request, authNames); if (httpMethod.toUpperCase() === "GET" && this.cache === false) { queryParams["_"] = (/* @__PURE__ */ new Date()).getTime(); } request.query(this.normalizeParams(queryParams)); request.set(this.defaultHeaders).set(this.normalizeParams(headerParams)); if (this.requestAgent) { request.agent(this.requestAgent); } request.timeout(this.timeout); var contentType = this.jsonPreferredMime(contentTypes); if (contentType) { if (contentType != "multipart/form-data") { request.type(contentType); } } else if (!request.header["Content-Type"]) { request.type("application/json"); } if (contentType === "application/x-www-form-urlencoded") { request.send(new URLSearchParams(this.normalizeParams(formParams))); } else if (contentType == "multipart/form-data") { var _formParams = this.normalizeParams(formParams); for (var key in _formParams) { if (_formParams.hasOwnProperty(key)) { if (this.isFileParam(_formParams[key])) { request.attach(key, _formParams[key]); } else { request.field(key, _formParams[key]); } } } } else if (bodyParam) { request.send(bodyParam); } var accept = this.jsonPreferredMime(accepts); if (accept) { request.accept(accept); } if (returnType === "Blob") { request.responseType("blob"); } else if (returnType === "String") { request.responseType("string"); } if (this.enableCookies) { if (typeof window === "undefined") { this.agent.attachCookies(request); } else { request.withCredentials(); } } if (typeof callback === "function") { request.end((error, response) => { let data = null; if (!error) { try { data = this.deserialize(response, returnType); if (this.enableCookies && typeof window === "undefined") { this.agent.saveCookies(response); } } catch (err) { error = err; } } callback(error, data, response); }); return request; } return new Promise((resolve, reject) => { request.end((error, response) => { if (error) { reject(error); return; } try { const data = this.deserialize(response, returnType); if (this.enableCookies && typeof window === "undefined") { this.agent.saveCookies(response); } resolve(data); } catch (err) { reject(err); } }); }); } /** * Parses an ISO-8601 string representation of a date value. * @param {String} str The date value as a string. * @returns {Date} The parsed date object. */ static parseDate(str) { return new Date(str); } /** * Converts a value to the specified type. * @param {(String|Object)} data The data to convert, as a string or object. * @param {(String|Array.<String>|Object.<String, Object>|Function)} type The type to return. Pass a string for simple types * or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To * return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type: * all properties on <code>data<code> will be converted to this type. * @returns An instance of the specified type or null or undefined if data is null or undefined. */ static convertToType(data, type) { if (data === null || data === void 0) return data; switch (type) { case "Boolean": return Boolean(data); case "Integer": return parseInt(data, 10); case "Number": return parseFloat(data); case "String": return String(data); case "Date": return _ApiClient.parseDate(String(data)); case "Blob": return data; default: if (type === Object) { return data; } else if (typeof type === "function") { return type.constructFromObject(data); } else if (Array.isArray(type)) { var itemType = type[0]; return data.map((item) => { return _ApiClient.convertToType(item, itemType); }); } else if (typeof type === "object") { var keyType, valueType; for (var k in type) { if (type.hasOwnProperty(k)) { keyType = k; valueType = type[k]; break; } } var result = {}; for (var k in data) { if (data.hasOwnProperty(k)) { var key = _ApiClient.convertToType(k, keyType); var value = _ApiClient.convertToType(data[k], valueType); result[key] = value; } } return result; } else { return data; } } } /** * Constructs a new map or array model from REST data. * @param data {Object|Array} The REST data. * @param obj {Object|Array} The target object or array. */ static constructFromObject(data, obj, itemType) { if (Array.isArray(data)) { for (var i = 0; i < data.length; i++) { if (data.hasOwnProperty(i)) obj[i] = _ApiClient.convertToType(data[i], itemType); } } else { for (var k in data) { if (data.hasOwnProperty(k)) obj[k] = _ApiClient.convertToType(data[k], itemType); } } } }; ApiClient.instance = new ApiClient(); // src/model/AssetTotalItem.js var AssetTotalItem = class _AssetTotalItem { /** * Constructs a new <code>AssetTotalItem</code>. * @alias module:model/AssetTotalItem * @class */ constructor() { } /** * Constructs a <code>AssetTotalItem</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/AssetTotalItem} obj Optional instance to populate. * @return {module:model/AssetTotalItem} The populated <code>AssetTotalItem</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _AssetTotalItem(); if (data.hasOwnProperty("id")) obj.id = ApiClient.convertToType(data["id"], "Number"); if (data.hasOwnProperty("base_key")) obj.baseKey = ApiClient.convertToType(data["base_key"], "String"); if (data.hasOwnProperty("amount")) obj.amount = ApiClient.convertToType(data["amount"], "Number"); if (data.hasOwnProperty("timestamp")) obj.timestamp = ApiClient.convertToType(data["timestamp"], "Number"); } return obj; } }; AssetTotalItem.prototype.id = void 0; AssetTotalItem.prototype.baseKey = void 0; AssetTotalItem.prototype.amount = void 0; AssetTotalItem.prototype.timestamp = void 0; // src/model/AssetsTotalRequest.js var AssetsTotalRequest = class _AssetsTotalRequest { /** * Constructs a new <code>AssetsTotalRequest</code>. * @alias module:model/AssetsTotalRequest * @class * @param exchange {String} Exchange name (e.g., `binance`). * @param base {String} Base currency to value the assets in (e.g., `USDT`). * @param start {Number} Start timestamp in milliseconds since Unix epoch. * @param end {Number} End timestamp in milliseconds since Unix epoch. */ constructor(exchange, base, start, end) { this.exchange = exchange; this.base = base; this.start = start; this.end = end; } /** * Constructs a <code>AssetsTotalRequest</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/AssetsTotalRequest} obj Optional instance to populate. * @return {module:model/AssetsTotalRequest} The populated <code>AssetsTotalRequest</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _AssetsTotalRequest(); if (data.hasOwnProperty("exchange")) obj.exchange = ApiClient.convertToType(data["exchange"], "String"); if (data.hasOwnProperty("base")) obj.base = ApiClient.convertToType(data["base"], "String"); if (data.hasOwnProperty("start")) obj.start = ApiClient.convertToType(data["start"], "Number"); if (data.hasOwnProperty("end")) obj.end = ApiClient.convertToType(data["end"], "Number"); } return obj; } }; AssetsTotalRequest.prototype.exchange = void 0; AssetsTotalRequest.prototype.base = void 0; AssetsTotalRequest.prototype.start = void 0; AssetsTotalRequest.prototype.end = void 0; // src/model/AssetsTotalResponse.js var AssetsTotalResponse = class _AssetsTotalResponse extends Array { /** * Constructs a new <code>AssetsTotalResponse</code>. * @alias module:model/AssetsTotalResponse * @class * @extends Array */ constructor() { super(); } /** * Constructs a <code>AssetsTotalResponse</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/AssetsTotalResponse} obj Optional instance to populate. * @return {module:model/AssetsTotalResponse} The populated <code>AssetsTotalResponse</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _AssetsTotalResponse(); ApiClient.constructFromObject(data, obj, "AssetTotalItem"); } return obj; } }; // src/model/AuthStatusResponse.js var AuthStatusResponse = class _AuthStatusResponse { /** * Constructs a new <code>AuthStatusResponse</code>. * @alias module:model/AuthStatusResponse * @class */ constructor() { } /** * Constructs a <code>AuthStatusResponse</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/AuthStatusResponse} obj Optional instance to populate. * @return {module:model/AuthStatusResponse} The populated <code>AuthStatusResponse</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _AuthStatusResponse(); if (data.hasOwnProperty("code")) obj.code = ApiClient.convertToType(data["code"], "Number"); if (data.hasOwnProperty("isDemo")) obj.isDemo = ApiClient.convertToType(data["isDemo"], "Boolean"); if (data.hasOwnProperty("isRegistered")) obj.isRegistered = ApiClient.convertToType(data["isRegistered"], "Boolean"); if (data.hasOwnProperty("isTwoFA")) obj.isTwoFA = ApiClient.convertToType(data["isTwoFA"], "Boolean"); if (data.hasOwnProperty("metamask")) obj.metamask = ApiClient.convertToType(data["metamask"], "Boolean"); if (data.hasOwnProperty("status")) obj.status = ApiClient.convertToType(data["status"], "String"); if (data.hasOwnProperty("message")) obj.message = ApiClient.convertToType(data["message"], "String"); } return obj; } }; AuthStatusResponse.prototype.code = void 0; AuthStatusResponse.prototype.isDemo = void 0; AuthStatusResponse.prototype.isRegistered = void 0; AuthStatusResponse.prototype.isTwoFA = void 0; AuthStatusResponse.prototype.metamask = void 0; AuthStatusResponse.prototype.status = void 0; AuthStatusResponse.prototype.message = void 0; // src/model/BalanceItem.js var BalanceItem = class _BalanceItem { /** * Constructs a new <code>BalanceItem</code>. * @alias module:model/BalanceItem * @class */ constructor() { } /** * Constructs a <code>BalanceItem</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/BalanceItem} obj Optional instance to populate. * @return {module:model/BalanceItem} The populated <code>BalanceItem</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _BalanceItem(); if (data.hasOwnProperty("Asset")) obj.asset = ApiClient.convertToType(data["Asset"], "String"); if (data.hasOwnProperty("Exchange")) obj.exchange = ApiClient.convertToType(data["Exchange"], "String"); if (data.hasOwnProperty("Available Qty")) obj.availableQty = ApiClient.convertToType(data["Available Qty"], "String"); if (data.hasOwnProperty("On Order")) obj.onOrder = ApiClient.convertToType(data["On Order"], "String"); } return obj; } }; BalanceItem.prototype.asset = void 0; BalanceItem.prototype.exchange = void 0; BalanceItem.prototype.availableQty = void 0; BalanceItem.prototype.onOrder = void 0; // src/model/BalancesResponse.js var BalancesResponse = class _BalancesResponse extends Array { /** * Constructs a new <code>BalancesResponse</code>. * @alias module:model/BalancesResponse * @class * @extends Array */ constructor() { super(); } /** * Constructs a <code>BalancesResponse</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/BalancesResponse} obj Optional instance to populate. * @return {module:model/BalancesResponse} The populated <code>BalancesResponse</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _BalancesResponse(); ApiClient.constructFromObject(data, obj, "BalanceItem"); } return obj; } }; // src/model/ChartDataRequest.js var ChartDataRequest = class _ChartDataRequest { /** * Constructs a new <code>ChartDataRequest</code>. * @alias module:model/ChartDataRequest * @class * @param exchange {String} * @param pair {String} */ constructor(exchange, pair) { this.exchange = exchange; this.pair = pair; } /** * Constructs a <code>ChartDataRequest</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/ChartDataRequest} obj Optional instance to populate. * @return {module:model/ChartDataRequest} The populated <code>ChartDataRequest</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _ChartDataRequest(); if (data.hasOwnProperty("exchange")) obj.exchange = ApiClient.convertToType(data["exchange"], "String"); if (data.hasOwnProperty("pair")) obj.pair = ApiClient.convertToType(data["pair"], "String"); } return obj; } }; ChartDataRequest.prototype.exchange = void 0; ChartDataRequest.prototype.pair = void 0; // src/model/ChartDataResponse.js var ChartDataResponse = class _ChartDataResponse { /** * Constructs a new <code>ChartDataResponse</code>. * Chart data with candle and indicator arrays. * @alias module:model/ChartDataResponse * @class * @extends */ constructor() { } /** * Constructs a <code>ChartDataResponse</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/ChartDataResponse} obj Optional instance to populate. * @return {module:model/ChartDataResponse} The populated <code>ChartDataResponse</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _ChartDataResponse(); ApiClient.constructFromObject(data, obj, ""); } return obj; } }; // src/model/ChartMarkItem.js var ChartMarkItem = class _ChartMarkItem { /** * Constructs a new <code>ChartMarkItem</code>. * @alias module:model/ChartMarkItem * @class */ constructor() { } /** * Constructs a <code>ChartMarkItem</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/ChartMarkItem} obj Optional instance to populate. * @return {module:model/ChartMarkItem} The populated <code>ChartMarkItem</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _ChartMarkItem(); if (data.hasOwnProperty("exchange")) obj.exchange = ApiClient.convertToType(data["exchange"], "String"); if (data.hasOwnProperty("pair")) obj.pair = ApiClient.convertToType(data["pair"], "String"); if (data.hasOwnProperty("id")) obj.id = ApiClient.convertToType(data["id"], "String"); if (data.hasOwnProperty("time")) obj.time = ApiClient.convertToType(data["time"], "Number"); if (data.hasOwnProperty("color")) obj.color = ApiClient.convertToType(data["color"], "String"); if (data.hasOwnProperty("label")) obj.label = ApiClient.convertToType(data["label"], "String"); if (data.hasOwnProperty("tooltip")) obj.tooltip = ApiClient.convertToType(data["tooltip"], ["String"]); } return obj; } }; ChartMarkItem.prototype.exchange = void 0; ChartMarkItem.prototype.pair = void 0; ChartMarkItem.prototype.id = void 0; ChartMarkItem.prototype.time = void 0; ChartMarkItem.prototype.color = void 0; ChartMarkItem.prototype.label = void 0; ChartMarkItem.prototype.tooltip = void 0; // src/model/ChartMarksResponse.js var ChartMarksResponse = class _ChartMarksResponse extends Array { /** * Constructs a new <code>ChartMarksResponse</code>. * @alias module:model/ChartMarksResponse * @class * @extends Array */ constructor() { super(); } /** * Constructs a <code>ChartMarksResponse</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/ChartMarksResponse} obj Optional instance to populate. * @return {module:model/ChartMarksResponse} The populated <code>ChartMarksResponse</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _ChartMarksResponse(); ApiClient.constructFromObject(data, obj, "ChartMarkItem"); } return obj; } }; // src/model/GunbotConfig.js var GunbotConfig = class _GunbotConfig { /** * Constructs a new <code>GunbotConfig</code>. * @alias module:model/GunbotConfig * @class * @extends Object */ constructor() { } /** * Constructs a <code>GunbotConfig</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/GunbotConfig} obj Optional instance to populate. * @return {module:model/GunbotConfig} The populated <code>GunbotConfig</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _GunbotConfig(); ApiClient.constructFromObject(data, obj, "Object"); } return obj; } }; // src/model/ConfigFullResponse.js var ConfigFullResponse = class _ConfigFullResponse { /** * Constructs a new <code>ConfigFullResponse</code>. * @alias module:model/ConfigFullResponse * @class */ constructor() { } /** * Constructs a <code>ConfigFullResponse</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/ConfigFullResponse} obj Optional instance to populate. * @return {module:model/ConfigFullResponse} The populated <code>ConfigFullResponse</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _ConfigFullResponse(); if (data.hasOwnProperty("status")) obj.status = ApiClient.convertToType(data["status"], "String"); if (data.hasOwnProperty("config")) obj.config = GunbotConfig.constructFromObject(data["config"]); } return obj; } }; ConfigFullResponse.prototype.status = void 0; ConfigFullResponse.prototype.config = void 0; // src/model/ConfigPairAddRequest.js var ConfigPairAddRequest = class _ConfigPairAddRequest { /** * Constructs a new <code>ConfigPairAddRequest</code>. * @alias module:model/ConfigPairAddRequest * @class * @param pair {String} The trading pair to add (e.g., `USDT-PEPE`). * @param exchange {String} The exchange name (e.g., `binance`). */ constructor(pair, exchange) { this.pair = pair; this.exchange = exchange; } /** * Constructs a <code>ConfigPairAddRequest</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/ConfigPairAddRequest} obj Optional instance to populate. * @return {module:model/ConfigPairAddRequest} The populated <code>ConfigPairAddRequest</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _ConfigPairAddRequest(); if (data.hasOwnProperty("pair")) obj.pair = ApiClient.convertToType(data["pair"], "String"); if (data.hasOwnProperty("exchange")) obj.exchange = ApiClient.convertToType(data["exchange"], "String"); if (data.hasOwnProperty("settings")) obj.settings = ApiClient.convertToType(data["settings"], { "String": Object }); } return obj; } }; ConfigPairAddRequest.prototype.pair = void 0; ConfigPairAddRequest.prototype.exchange = void 0; ConfigPairAddRequest.prototype.settings = void 0; // src/model/ConfigPairRemoveRequest.js var ConfigPairRemoveRequest = class _ConfigPairRemoveRequest { /** * Constructs a new <code>ConfigPairRemoveRequest</code>. * @alias module:model/ConfigPairRemoveRequest * @class * @param pair {String} The trading pair to remove (e.g., `USDT-PEPE`). * @param exchange {String} The exchange name (e.g., `binance`). */ constructor(pair, exchange) { this.pair = pair; this.exchange = exchange; } /** * Constructs a <code>ConfigPairRemoveRequest</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/ConfigPairRemoveRequest} obj Optional instance to populate. * @return {module:model/ConfigPairRemoveRequest} The populated <code>ConfigPairRemoveRequest</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _ConfigPairRemoveRequest(); if (data.hasOwnProperty("pair")) obj.pair = ApiClient.convertToType(data["pair"], "String"); if (data.hasOwnProperty("exchange")) obj.exchange = ApiClient.convertToType(data["exchange"], "String"); } return obj; } }; ConfigPairRemoveRequest.prototype.pair = void 0; ConfigPairRemoveRequest.prototype.exchange = void 0; // src/model/ConfigStrategyAddRequest.js var ConfigStrategyAddRequest = class _ConfigStrategyAddRequest { /** * Constructs a new <code>ConfigStrategyAddRequest</code>. * @alias module:model/ConfigStrategyAddRequest * @class * @param name {String} The name of the strategy to add (e.g., `myStrategy`). * @param settings {Object.<String, Object>} (Optional) Specific settings for the strategy. */ constructor(name, settings) { this.name = name; this.settings = settings; } /** * Constructs a <code>ConfigStrategyAddRequest</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/ConfigStrategyAddRequest} obj Optional instance to populate. * @return {module:model/ConfigStrategyAddRequest} The populated <code>ConfigStrategyAddRequest</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _ConfigStrategyAddRequest(); if (data.hasOwnProperty("name")) obj.name = ApiClient.convertToType(data["name"], "String"); if (data.hasOwnProperty("settings")) obj.settings = ApiClient.convertToType(data["settings"], { "String": Object }); } return obj; } }; ConfigStrategyAddRequest.prototype.name = void 0; ConfigStrategyAddRequest.prototype.settings = void 0; // src/model/ConfigStrategyRemoveRequest.js var ConfigStrategyRemoveRequest = class _ConfigStrategyRemoveRequest { /** * Constructs a new <code>ConfigStrategyRemoveRequest</code>. * @alias module:model/ConfigStrategyRemoveRequest * @class * @param name {String} The name of the strategy to remove. */ constructor(name) { this.name = name; } /** * Constructs a <code>ConfigStrategyRemoveRequest</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/ConfigStrategyRemoveRequest} obj Optional instance to populate. * @return {module:model/ConfigStrategyRemoveRequest} The populated <code>ConfigStrategyRemoveRequest</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _ConfigStrategyRemoveRequest(); if (data.hasOwnProperty("name")) obj.name = ApiClient.convertToType(data["name"], "String"); } return obj; } }; ConfigStrategyRemoveRequest.prototype.name = void 0; // src/model/ConfigUpdateRequest.js var ConfigUpdateRequest = class _ConfigUpdateRequest { /** * Constructs a new <code>ConfigUpdateRequest</code>. * @alias module:model/ConfigUpdateRequest * @class */ constructor() { } /** * Constructs a <code>ConfigUpdateRequest</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/ConfigUpdateRequest} obj Optional instance to populate. * @return {module:model/ConfigUpdateRequest} The populated <code>ConfigUpdateRequest</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _ConfigUpdateRequest(); if (data.hasOwnProperty("config")) obj.config = GunbotConfig.constructFromObject(data["config"]); } return obj; } }; ConfigUpdateRequest.prototype.config = void 0; // src/model/ConfigUpdateResponse.js var ConfigUpdateResponse = class _ConfigUpdateResponse { /** * Constructs a new <code>ConfigUpdateResponse</code>. * @alias module:model/ConfigUpdateResponse * @class */ constructor() { } /** * Constructs a <code>ConfigUpdateResponse</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/ConfigUpdateResponse} obj Optional instance to populate. * @return {module:model/ConfigUpdateResponse} The populated <code>ConfigUpdateResponse</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _ConfigUpdateResponse(); if (data.hasOwnProperty("status")) obj.status = ApiClient.convertToType(data["status"], "String"); if (data.hasOwnProperty("config")) obj.config = GunbotConfig.constructFromObject(data["config"]); } return obj; } }; ConfigUpdateResponse.prototype.status = void 0; ConfigUpdateResponse.prototype.config = void 0; // src/model/CoreMemRawRequest.js var CoreMemRawRequest = class _CoreMemRawRequest { /** * Constructs a new <code>CoreMemRawRequest</code>. * @alias module:model/CoreMemRawRequest * @class * @param exchange {String} * @param pair {String} */ constructor(exchange, pair) { this.exchange = exchange; this.pair = pair; } /** * Constructs a <code>CoreMemRawRequest</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/CoreMemRawRequest} obj Optional instance to populate. * @return {module:model/CoreMemRawRequest} The populated <code>CoreMemRawRequest</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _CoreMemRawRequest(); if (data.hasOwnProperty("exchange")) obj.exchange = ApiClient.convertToType(data["exchange"], "String"); if (data.hasOwnProperty("pair")) obj.pair = ApiClient.convertToType(data["pair"], "String"); if (data.hasOwnProperty("elements")) obj.elements = ApiClient.convertToType(data["elements"], ["String"]); } return obj; } }; CoreMemRawRequest.prototype.exchange = void 0; CoreMemRawRequest.prototype.pair = void 0; CoreMemRawRequest.prototype.elements = void 0; // src/model/CoreMemRawResponse.js var CoreMemRawResponse = class _CoreMemRawResponse { /** * Constructs a new <code>CoreMemRawResponse</code>. * @alias module:model/CoreMemRawResponse * @class * @extends */ constructor() { } /** * Constructs a <code>CoreMemRawResponse</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/CoreMemRawResponse} obj Optional instance to populate. * @return {module:model/CoreMemRawResponse} The populated <code>CoreMemRawResponse</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _CoreMemRawResponse(); ApiClient.constructFromObject(data, obj, ""); } return obj; } }; // src/model/CoreMemSingleRequest.js var CoreMemSingleRequest = class _CoreMemSingleRequest { /** * Constructs a new <code>CoreMemSingleRequest</code>. * @alias module:model/CoreMemSingleRequest * @class * @param exchange {String} * @param pair {String} */ constructor(exchange, pair) { this.exchange = exchange; this.pair = pair; } /** * Constructs a <code>CoreMemSingleRequest</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/CoreMemSingleRequest} obj Optional instance to populate. * @return {module:model/CoreMemSingleRequest} The populated <code>CoreMemSingleRequest</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _CoreMemSingleRequest(); if (data.hasOwnProperty("exchange")) obj.exchange = ApiClient.convertToType(data["exchange"], "String"); if (data.hasOwnProperty("pair")) obj.pair = ApiClient.convertToType(data["pair"], "String"); } return obj; } }; CoreMemSingleRequest.prototype.exchange = void 0; CoreMemSingleRequest.prototype.pair = void 0; // src/model/CoreMemSnapshotResponse.js var CoreMemSnapshotResponse = class _CoreMemSnapshotResponse { /** * Constructs a new <code>CoreMemSnapshotResponse</code>. * Snapshot of core memory data. * @alias module:model/CoreMemSnapshotResponse * @class * @extends */ constructor() { } /** * Constructs a <code>CoreMemSnapshotResponse</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/CoreMemSnapshotResponse} obj Optional instance to populate. * @return {module:model/CoreMemSnapshotResponse} The populated <code>CoreMemSnapshotResponse</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _CoreMemSnapshotResponse(); ApiClient.constructFromObject(data, obj, ""); } return obj; } }; // src/model/ErrorResponse.js var ErrorResponse = class _ErrorResponse { /** * Constructs a new <code>ErrorResponse</code>. * @alias module:model/ErrorResponse * @class */ constructor() { } /** * Constructs a <code>ErrorResponse</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/ErrorResponse} obj Optional instance to populate. * @return {module:model/ErrorResponse} The populated <code>ErrorResponse</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _ErrorResponse(); if (data.hasOwnProperty("status")) obj.status = ApiClient.convertToType(data["status"], "String"); if (data.hasOwnProperty("message")) obj.message = ApiClient.convertToType(data["message"], "String"); if (data.hasOwnProperty("code")) obj.code = ApiClient.convertToType(data["code"], "Number"); } return obj; } }; ErrorResponse.prototype.status = void 0; ErrorResponse.prototype.message = void 0; ErrorResponse.prototype.code = void 0; // src/model/FileAclarContentResponse.js var FileAclarContentResponse = class _FileAclarContentResponse { /** * Constructs a new <code>FileAclarContentResponse</code>. * @alias module:model/FileAclarContentResponse * @class */ constructor() { } /** * Constructs a <code>FileAclarContentResponse</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/FileAclarContentResponse} obj Optional instance to populate. * @return {module:model/FileAclarContentResponse} The populated <code>FileAclarContentResponse</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _FileAclarContentResponse(); if (data.hasOwnProperty("this")) obj._this = ApiClient.convertToType(data["this"], "Number"); if (data.hasOwnProperty("pnd")) obj.pnd = ApiClient.convertToType(data["pnd"], "Boolean"); } return obj; } }; FileAclarContentResponse.prototype._this = void 0; FileAclarContentResponse.prototype.pnd = void 0; // src/model/FileContentResponse.js var FileContentResponse = class _FileContentResponse { /** * Constructs a new <code>FileContentResponse</code>. * @alias module:model/FileContentResponse * @class * @extends */ constructor() { } /** * Constructs a <code>FileContentResponse</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/FileContentResponse} obj Optional instance to populate. * @return {module:model/FileContentResponse} The populated <code>FileContentResponse</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _FileContentResponse(); ApiClient.constructFromObject(data, obj, ""); } return obj; } }; // src/model/FileGetRequest.js var FileGetRequest = class _FileGetRequest { /** * Constructs a new <code>FileGetRequest</code>. * @alias module:model/FileGetRequest * @class * @param filename {String} The name of the file to retrieve. */ constructor(filename) { this.filename = filename; } /** * Constructs a <code>FileGetRequest</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not. * @param {Object} data The plain JavaScript object bearing properties of interest. * @param {module:model/FileGetRequest} obj Optional instance to populate. * @return {module:model/FileGetRequest} The populated <code>FileGetRequest</code> instance. */ static constructFromObject(data, obj) { if (data) { obj = obj || new _FileGetRequest(); if (data.hasOwnProperty("filename")) obj.filename = ApiClient.convertToType(data["filename"], "String"); } return obj; } }; FileGetRequest.prototype.filename = void 0; // src/model/FileListResponse.js var FileListResponse = class _FileListResponse { /** * Constructs a new <code>FileListResponse</code>. * @alias module:model/FileListResponse * @class */ constructor() { } /** * Constructs a <code>FileListResponse</code> from a plain JavaScript object, optionally creating a new instance. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.