From 4ae32981ff4be56d5ba3103876cc44e5f247424b Mon Sep 17 00:00:00 2001 From: Brennan Spellacy Date: Wed, 29 Jul 2020 17:00:06 -0700 Subject: [PATCH 01/10] update readme and upgrade dependencies --- README.md | 8 +- package-lock.json | 1027 ++++++++++++++++++++++++++++++++++++++++----- package.json | 8 +- 3 files changed, 931 insertions(+), 112 deletions(-) diff --git a/README.md b/README.md index 7ca9b87..e9a4aa0 100644 --- a/README.md +++ b/README.md @@ -11,12 +11,12 @@ For a complete API reference, check out [Patch's API Reference.](https://docs.us ### NPM ```shell -npm install patch-node --save +npm install @patch-technology/patch --save ``` ### Yarn ```shell -yarn add patch-node +yarn add @patch-technology/patch ``` ### Requirements @@ -29,11 +29,11 @@ yarn add patch-node After installing the package, you'll have to configure it with your API key which is available from the API key page in the Patch dashboard: ```javascript // ES6+ -import Patch from 'patch-node' +import Patch from '@patch-technology/patch' const patch = Patch('key_test_1234') // ES5 -var patch = require('patch-node')('key_test_1234') +var patch = require('@patch-technology/patch')('key_test_1234') ``` ### Orders diff --git a/package-lock.json b/package-lock.json index 81fc61a..dfce5f9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@patch-technology/patch", - "version": "1.0.0", + "version": "1.0.0-rc.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -8,6 +8,7 @@ "version": "7.10.5", "resolved": "https://registry.npmjs.org/@babel/cli/-/cli-7.10.5.tgz", "integrity": "sha512-j9H9qSf3kLdM0Ao3aGPbGZ73mEA9XazuupcS6cDGWuiyAcANoguhP0r2Lx32H5JGw4sSSoHG3x/mxVnHgvOoyA==", + "dev": true, "requires": { "chokidar": "^2.1.8", "commander": "^4.0.1", @@ -1207,6 +1208,18 @@ "to-fast-properties": "^2.0.0" } }, + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, "ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -1220,6 +1233,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "dev": true, "optional": true, "requires": { "micromatch": "^3.1.4", @@ -1230,6 +1244,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, "optional": true, "requires": { "remove-trailing-separator": "^1.0.1" @@ -1237,30 +1252,55 @@ } } }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, "arr-diff": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true, "optional": true }, "arr-flatten": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true, "optional": true }, "arr-union": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true, "optional": true }, "array-unique": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true, "optional": true }, + "array.prototype.map": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array.prototype.map/-/array.prototype.map-1.0.2.tgz", + "integrity": "sha512-Az3OYxgsa1g7xDYp86l0nnN4bcmuEITGe1rbdEBVkrqkzMgDcbdQ2R7r41pNzti+4NMces3H8gMmuioZUilLgw==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1", + "es-array-method-boxes-properly": "^1.0.0", + "is-string": "^1.0.4" + } + }, "assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", @@ -1271,12 +1311,14 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true, "optional": true }, "async-each": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz", "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==", + "dev": true, "optional": true }, "asynckit": { @@ -1288,6 +1330,7 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "dev": true, "optional": true }, "babel-plugin-dynamic-import-node": { @@ -1302,12 +1345,14 @@ "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true }, "base": { "version": "0.11.2", "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true, "optional": true, "requires": { "cache-base": "^1.0.1", @@ -1323,6 +1368,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, "optional": true, "requires": { "is-descriptor": "^1.0.0" @@ -1332,6 +1378,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, "optional": true, "requires": { "kind-of": "^6.0.0" @@ -1341,6 +1388,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, "optional": true, "requires": { "kind-of": "^6.0.0" @@ -1350,6 +1398,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, "optional": true, "requires": { "is-accessor-descriptor": "^1.0.0", @@ -1363,12 +1412,14 @@ "version": "1.13.1", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", + "dev": true, "optional": true }, "bindings": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dev": true, "optional": true, "requires": { "file-uri-to-path": "1.0.0" @@ -1378,6 +1429,7 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1387,6 +1439,7 @@ "version": "2.3.2", "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, "optional": true, "requires": { "arr-flatten": "^1.1.0", @@ -1405,6 +1458,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, "optional": true, "requires": { "is-extendable": "^0.1.0" @@ -1440,6 +1494,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "dev": true, "optional": true, "requires": { "collection-visit": "^1.0.0", @@ -1453,6 +1508,12 @@ "unset-value": "^1.0.0" } }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, "caniuse-lite": { "version": "1.0.30001102", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001102.tgz", @@ -1494,6 +1555,7 @@ "version": "2.1.8", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", + "dev": true, "optional": true, "requires": { "anymatch": "^2.0.0", @@ -1514,6 +1576,7 @@ "version": "0.3.6", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dev": true, "optional": true, "requires": { "arr-union": "^3.1.0", @@ -1526,6 +1589,7 @@ "version": "0.2.5", "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, "optional": true, "requires": { "is-descriptor": "^0.1.0" @@ -1533,10 +1597,50 @@ } } }, + "cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "dev": true, + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, "collection-visit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, "optional": true, "requires": { "map-visit": "^1.0.0", @@ -1569,7 +1673,8 @@ "commander": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", - "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==" + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true }, "commondir": { "version": "1.0.1", @@ -1585,12 +1690,14 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true }, "convert-source-map": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz", "integrity": "sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA==", + "dev": true, "requires": { "safe-buffer": "~5.1.1" } @@ -1604,6 +1711,7 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true, "optional": true }, "core-js-compat": { @@ -1627,21 +1735,31 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true, + "optional": true }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, "optional": true, "requires": { "ms": "2.0.0" } }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, "decode-uri-component": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true, "optional": true }, "deep-eql": { @@ -1666,6 +1784,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, "optional": true, "requires": { "is-descriptor": "^1.0.2", @@ -1676,6 +1795,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, "optional": true, "requires": { "kind-of": "^6.0.0" @@ -1685,6 +1805,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, "optional": true, "requires": { "kind-of": "^6.0.0" @@ -1694,6 +1815,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, "optional": true, "requires": { "is-accessor-descriptor": "^1.0.0", @@ -1709,9 +1831,9 @@ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "dev": true }, "electron-to-chromium": { @@ -1720,6 +1842,71 @@ "integrity": "sha512-y7FwtQm/8xuLMnYQfBQDYzCpNn+VkSnf4c3Km5TWMNXg7JA5RQBuxmcLaKdDVcIK0K5xGIa7TlxpRt4BdNxNoA==", "dev": true }, + "emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "es-abstract": { + "version": "1.17.6", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz", + "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==", + "dev": true, + "requires": { + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1", + "is-callable": "^1.2.0", + "is-regex": "^1.1.0", + "object-inspect": "^1.7.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.0", + "string.prototype.trimend": "^1.0.1", + "string.prototype.trimstart": "^1.0.1" + } + }, + "es-array-method-boxes-properly": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz", + "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==", + "dev": true + }, + "es-get-iterator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.0.tgz", + "integrity": "sha512-UfrmHuWQlNMTs35e1ypnvikg6jCz3SK8v8ImvmDsh36fCVUR1MqoFDiyn0/k52C8NqO3YsO8Oe0azeesNuqSsQ==", + "dev": true, + "requires": { + "es-abstract": "^1.17.4", + "has-symbols": "^1.0.1", + "is-arguments": "^1.0.4", + "is-map": "^2.0.1", + "is-set": "^2.0.1", + "is-string": "^1.0.5", + "isarray": "^2.0.5" + }, + "dependencies": { + "isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + } + } + }, + "es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, "escalade": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.0.2.tgz", @@ -1732,6 +1919,12 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, "esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", @@ -1742,6 +1935,7 @@ "version": "2.1.4", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, "optional": true, "requires": { "debug": "^2.3.3", @@ -1757,6 +1951,7 @@ "version": "0.2.5", "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, "optional": true, "requires": { "is-descriptor": "^0.1.0" @@ -1766,6 +1961,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, "optional": true, "requires": { "is-extendable": "^0.1.0" @@ -1773,15 +1969,11 @@ } } }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, "extend-shallow": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, "optional": true, "requires": { "assign-symbols": "^1.0.0", @@ -1792,6 +1984,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, "optional": true, "requires": { "is-plain-object": "^2.0.4" @@ -1803,6 +1996,7 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, "optional": true, "requires": { "array-unique": "^0.3.2", @@ -1819,6 +2013,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, "optional": true, "requires": { "is-descriptor": "^1.0.0" @@ -1828,6 +2023,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, "optional": true, "requires": { "is-extendable": "^0.1.0" @@ -1837,6 +2033,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, "optional": true, "requires": { "kind-of": "^6.0.0" @@ -1846,6 +2043,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, "optional": true, "requires": { "kind-of": "^6.0.0" @@ -1855,6 +2053,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, "optional": true, "requires": { "is-accessor-descriptor": "^1.0.0", @@ -1864,16 +2063,23 @@ } } }, + "fast-safe-stringify": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz", + "integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==" + }, "file-uri-to-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "dev": true, "optional": true }, "fill-range": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, "optional": true, "requires": { "extend-shallow": "^2.0.1", @@ -1886,6 +2092,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, "optional": true, "requires": { "is-extendable": "^0.1.0" @@ -1913,19 +2120,37 @@ "locate-path": "^3.0.0" } }, + "flat": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz", + "integrity": "sha512-Px/TiLIznH7gEDlPXcUD4KnBusa6kR6ayRUVcnEAbreRIuhkqow/mun59BuRXwoYk7ZQOLW1ZM05ilIvK38hFw==", + "dev": true, + "requires": { + "is-buffer": "~2.0.3" + }, + "dependencies": { + "is-buffer": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", + "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==", + "dev": true + } + } + }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true, "optional": true }, "form-data": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", - "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz", + "integrity": "sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==", "requires": { "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", + "combined-stream": "^1.0.8", "mime-types": "^2.1.12" } }, @@ -1938,6 +2163,7 @@ "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, "optional": true, "requires": { "map-cache": "^0.2.2" @@ -1946,17 +2172,20 @@ "fs-readdir-recursive": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz", - "integrity": "sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA==" + "integrity": "sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA==", + "dev": true }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true }, "fsevents": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", + "dev": true, "optional": true, "requires": { "bindings": "^1.5.0", @@ -1975,6 +2204,12 @@ "integrity": "sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg==", "dev": true }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, "get-func-name": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", @@ -1985,12 +2220,14 @@ "version": "2.0.6", "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true, "optional": true }, "glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -2004,6 +2241,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "dev": true, "optional": true, "requires": { "is-glob": "^3.1.0", @@ -2014,6 +2252,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "dev": true, "optional": true, "requires": { "is-extglob": "^2.1.0" @@ -2031,6 +2270,7 @@ "version": "4.2.4", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", + "dev": true, "optional": true }, "growl": { @@ -2039,6 +2279,15 @@ "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", "dev": true }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -2055,6 +2304,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, "optional": true, "requires": { "get-value": "^2.0.6", @@ -2066,6 +2316,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, "optional": true, "requires": { "is-number": "^3.0.0", @@ -2076,6 +2327,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, "optional": true, "requires": { "is-buffer": "^1.1.5" @@ -2084,15 +2336,16 @@ } }, "he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -2116,6 +2369,7 @@ "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, "optional": true, "requires": { "kind-of": "^3.0.2" @@ -2125,6 +2379,7 @@ "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, "optional": true, "requires": { "is-buffer": "^1.1.5" @@ -2132,10 +2387,17 @@ } } }, + "is-arguments": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.0.4.tgz", + "integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA==", + "dev": true + }, "is-binary-path": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "dev": true, "optional": true, "requires": { "binary-extensions": "^1.0.0" @@ -2145,12 +2407,20 @@ "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true, "optional": true }, + "is-callable": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.0.tgz", + "integrity": "sha512-pyVD9AaGLxtg6srb2Ng6ynWJqkHU9bEM087AKck0w8QwDarTfNcpIYoU8x8Hv2Icm8u6kFJM18Dag8lyqGkviw==", + "dev": true + }, "is-data-descriptor": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, "optional": true, "requires": { "kind-of": "^3.0.2" @@ -2160,6 +2430,7 @@ "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, "optional": true, "requires": { "is-buffer": "^1.1.5" @@ -2167,10 +2438,17 @@ } } }, + "is-date-object": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", + "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", + "dev": true + }, "is-descriptor": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, "optional": true, "requires": { "is-accessor-descriptor": "^0.1.6", @@ -2182,6 +2460,7 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true, "optional": true } } @@ -2190,27 +2469,41 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true, "optional": true }, "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "optional": true + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true }, "is-glob": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", - "optional": true, + "dev": true, "requires": { "is-extglob": "^2.1.1" } }, + "is-map": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.1.tgz", + "integrity": "sha512-T/S49scO8plUiAOA2DBTBG3JHpn1yiw0kRp6dgiZ0v2/6twi5eiB0rHtHFH9ZIrvlWc6+4O+m4zg5+Z833aXgw==", + "dev": true + }, "is-number": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, "optional": true, "requires": { "kind-of": "^3.0.2" @@ -2220,6 +2513,7 @@ "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, "optional": true, "requires": { "is-buffer": "^1.1.5" @@ -2231,34 +2525,101 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, "optional": true, "requires": { "isobject": "^3.0.1" } }, + "is-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.0.tgz", + "integrity": "sha512-iI97M8KTWID2la5uYXlkbSDQIg4F6o1sYboZKKTDpnDQMLtUL86zxhgDet3Q2SriaYsyGqZ6Mn2SjbRKeLHdqw==", + "dev": true, + "requires": { + "has-symbols": "^1.0.1" + } + }, + "is-set": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.1.tgz", + "integrity": "sha512-eJEzOtVyenDs1TMzSQ3kU3K+E0GUS9sno+F0OBT97xsgcJsF9nXMBtkT9/kut5JEpM7oL7X/0qxR17K3mcwIAA==", + "dev": true + }, + "is-string": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", + "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==", + "dev": true + }, + "is-symbol": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", + "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", + "dev": true, + "requires": { + "has-symbols": "^1.0.1" + } + }, "is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true, "optional": true }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true, + "optional": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true }, "isobject": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true, "optional": true }, + "iterate-iterator": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/iterate-iterator/-/iterate-iterator-1.0.1.tgz", + "integrity": "sha512-3Q6tudGN05kbkDQDI4CqjaBf4qf85w6W6GnuZDtUVYwKgtC1q8yxYX7CZed7N+tLzQqS6roujWvszf13T+n9aw==", + "dev": true + }, + "iterate-value": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/iterate-value/-/iterate-value-1.0.2.tgz", + "integrity": "sha512-A6fMAio4D2ot2r/TYzr4yUWrmwNdsN5xL7+HUiyACE4DXm+q8HtPcnFTp+NnW3k4N05tZ7FVYFFb2CR13NxyHQ==", + "dev": true, + "requires": { + "es-get-iterator": "^1.0.2", + "iterate-iterator": "^1.0.1" + } + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", "dev": true }, + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, "jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -2278,6 +2639,7 @@ "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, "optional": true }, "leven": { @@ -2308,7 +2670,17 @@ "lodash": { "version": "4.17.19", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", - "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==" + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", + "dev": true + }, + "log-symbols": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", + "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", + "dev": true, + "requires": { + "chalk": "^2.4.2" + } }, "loose-envify": { "version": "1.4.0", @@ -2323,6 +2695,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "dev": true, "requires": { "pify": "^4.0.1", "semver": "^5.6.0" @@ -2332,12 +2705,14 @@ "version": "0.2.2", "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true, "optional": true }, "map-visit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true, "optional": true, "requires": { "object-visit": "^1.0.0" @@ -2352,6 +2727,7 @@ "version": "3.1.10", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, "optional": true, "requires": { "arr-diff": "^4.0.0", @@ -2370,9 +2746,9 @@ } }, "mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" + "version": "2.4.6", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.6.tgz", + "integrity": "sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA==" }, "mime-db": { "version": "1.44.0", @@ -2391,6 +2767,7 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, "requires": { "brace-expansion": "^1.1.7" } @@ -2405,6 +2782,7 @@ "version": "1.3.2", "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", + "dev": true, "optional": true, "requires": { "for-in": "^1.0.2", @@ -2415,6 +2793,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, "optional": true, "requires": { "is-plain-object": "^2.0.4" @@ -2422,78 +2801,200 @@ } } }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - }, - "dependencies": { - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - } - } - }, "mocha": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", - "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.0.1.tgz", + "integrity": "sha512-vefaXfdYI8+Yo8nPZQQi0QO2o+5q9UIMX1jZ1XMmK3+4+CQjc7+B0hPdUeglXiTlr8IHMVRo63IhO9Mzt6fxOg==", "dev": true, "requires": { + "ansi-colors": "4.1.1", "browser-stdout": "1.3.1", - "commander": "2.15.1", - "debug": "3.1.0", - "diff": "3.5.0", + "chokidar": "3.3.1", + "debug": "3.2.6", + "diff": "4.0.2", "escape-string-regexp": "1.0.5", - "glob": "7.1.2", + "find-up": "4.1.0", + "glob": "7.1.6", "growl": "1.10.5", - "he": "1.1.1", + "he": "1.2.0", + "js-yaml": "3.13.1", + "log-symbols": "3.0.0", "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "supports-color": "5.4.0" + "ms": "2.1.2", + "object.assign": "4.1.0", + "promise.allsettled": "1.0.2", + "serialize-javascript": "3.0.0", + "strip-json-comments": "3.0.1", + "supports-color": "7.1.0", + "which": "2.0.2", + "wide-align": "1.1.3", + "workerpool": "6.0.0", + "yargs": "13.3.2", + "yargs-parser": "13.1.2", + "yargs-unparser": "1.6.0" }, "dependencies": { - "commander": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "anymatch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", + "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "binary-extensions": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz", + "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==", "dev": true }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "chokidar": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.1.tgz", + "integrity": "sha512-4QYCEWOcK3OJrxwvyyAOxFuhpvOVCYkr33LPfFNBjAD/w3sEzWsp2BUOkI4l9bHvWioAd0rc6NlHUOEaWkTeqg==", + "dev": true, + "requires": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "fsevents": "~2.1.2", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.3.0" + } + }, "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "fsevents": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", + "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "dev": true, + "optional": true + }, + "glob-parent": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", + "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", "dev": true, "requires": { - "ms": "2.0.0" + "is-glob": "^4.0.1" } }, - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", "dev": true, "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "p-limit": "^2.2.0" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "readdirp": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.3.0.tgz", + "integrity": "sha512-zz0pAkSPOXXm1viEwygWIPSPkcBYjW1xU5j/JBh5t9bGCJwa6f9+BJa6VaB2g+b55yVrmXzqkyLf4xaWYM0IkQ==", + "dev": true, + "requires": { + "picomatch": "^2.0.7" } }, "supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, "requires": { - "has-flag": "^3.0.0" + "is-number": "^7.0.0" } } } @@ -2501,18 +3002,22 @@ "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true, + "optional": true }, "nan": { "version": "2.14.1", "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz", "integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==", + "dev": true, "optional": true }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "dev": true, "optional": true, "requires": { "arr-diff": "^4.0.0", @@ -2544,12 +3049,13 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "optional": true + "dev": true }, "object-copy": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, "optional": true, "requires": { "copy-descriptor": "^0.1.0", @@ -2561,6 +3067,7 @@ "version": "0.2.5", "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, "optional": true, "requires": { "is-descriptor": "^0.1.0" @@ -2570,6 +3077,7 @@ "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, "optional": true, "requires": { "is-buffer": "^1.1.5" @@ -2577,6 +3085,12 @@ } } }, + "object-inspect": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", + "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==", + "dev": true + }, "object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", @@ -2587,6 +3101,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, "optional": true, "requires": { "isobject": "^3.0.0" @@ -2608,6 +3123,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, "optional": true, "requires": { "isobject": "^3.0.1" @@ -2617,6 +3133,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, "requires": { "wrappy": "1" } @@ -2649,12 +3166,14 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true, "optional": true }, "path-dirname": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", + "dev": true, "optional": true }, "path-exists": { @@ -2666,7 +3185,8 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true }, "path-parse": { "version": "1.0.6", @@ -2680,10 +3200,17 @@ "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", "dev": true }, + "picomatch": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", + "dev": true + }, "pify": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true }, "pirates": { "version": "4.0.1", @@ -2707,12 +3234,28 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true, "optional": true }, "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true, + "optional": true + }, + "promise.allsettled": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/promise.allsettled/-/promise.allsettled-1.0.2.tgz", + "integrity": "sha512-UpcYW5S1RaNKT6pd+s9jp9K9rlQge1UXKskec0j6Mmuq7UJCvlS2J2/s/yuPN8ehftf9HXMxWlKiPbGGUzpoRg==", + "dev": true, + "requires": { + "array.prototype.map": "^1.0.1", + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1", + "function-bind": "^1.1.1", + "iterate-value": "^1.0.0" + } }, "qs": { "version": "6.9.4", @@ -2723,6 +3266,8 @@ "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "dev": true, + "optional": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -2737,6 +3282,7 @@ "version": "2.2.1", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", + "dev": true, "optional": true, "requires": { "graceful-fs": "^4.1.11", @@ -2778,6 +3324,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, "optional": true, "requires": { "extend-shallow": "^3.0.2", @@ -2825,20 +3372,35 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true, "optional": true }, "repeat-element": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", + "dev": true, "optional": true }, "repeat-string": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true, "optional": true }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, "resolve": { "version": "1.17.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", @@ -2852,12 +3414,14 @@ "version": "0.2.1", "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true, "optional": true }, "ret": { "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true, "optional": true }, "safe-buffer": { @@ -2869,6 +3433,7 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, "optional": true, "requires": { "ret": "~0.1.10" @@ -2877,12 +3442,26 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "serialize-javascript": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-3.0.0.tgz", + "integrity": "sha512-skZcHYw2vEX4bw90nAr2iTTsz6x2SrHEnfxgKYmZlvJYBEZrvbKtobJWlQ20zczKb3bsHHXXTYt48zBA7ni9cw==", + "dev": true + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true }, "set-value": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", + "dev": true, "optional": true, "requires": { "extend-shallow": "^2.0.1", @@ -2895,6 +3474,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, "optional": true, "requires": { "is-extendable": "^0.1.0" @@ -2905,12 +3485,14 @@ "slash": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz", - "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==" + "integrity": "sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A==", + "dev": true }, "snapdragon": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "dev": true, "optional": true, "requires": { "base": "^0.11.1", @@ -2927,6 +3509,7 @@ "version": "0.2.5", "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, "optional": true, "requires": { "is-descriptor": "^0.1.0" @@ -2936,6 +3519,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, "optional": true, "requires": { "is-extendable": "^0.1.0" @@ -2947,6 +3531,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dev": true, "optional": true, "requires": { "define-property": "^1.0.0", @@ -2958,6 +3543,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, "optional": true, "requires": { "is-descriptor": "^1.0.0" @@ -2967,6 +3553,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, "optional": true, "requires": { "kind-of": "^6.0.0" @@ -2976,6 +3563,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, "optional": true, "requires": { "kind-of": "^6.0.0" @@ -2985,6 +3573,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, "optional": true, "requires": { "is-accessor-descriptor": "^1.0.0", @@ -2998,6 +3587,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true, "optional": true, "requires": { "kind-of": "^3.2.0" @@ -3007,6 +3597,7 @@ "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, "optional": true, "requires": { "is-buffer": "^1.1.5" @@ -3017,12 +3608,14 @@ "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true }, "source-map-resolve": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz", "integrity": "sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==", + "dev": true, "optional": true, "requires": { "atob": "^2.1.2", @@ -3054,21 +3647,30 @@ "version": "0.4.0", "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "dev": true, "optional": true }, "split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "dev": true, "optional": true, "requires": { "extend-shallow": "^3.0.0" } }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, "static-extend": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, "optional": true, "requires": { "define-property": "^0.2.5", @@ -3079,6 +3681,7 @@ "version": "0.2.5", "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, "optional": true, "requires": { "is-descriptor": "^0.1.0" @@ -3086,6 +3689,36 @@ } } }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + } + }, + "string.prototype.trimend": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz", + "integrity": "sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + } + }, + "string.prototype.trimstart": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz", + "integrity": "sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + } + }, "string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -3094,27 +3727,43 @@ "safe-buffer": "~5.1.0" } }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "strip-json-comments": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", + "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", + "dev": true + }, "superagent": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/superagent/-/superagent-3.7.0.tgz", - "integrity": "sha512-/8trxO6NbLx4YXb7IeeFTSmsQ35pQBiTBsLNvobZx7qBzBeHYvKCyIIhW2gNcWbLzYxPAjdgFbiepd8ypwC0Gw==", - "requires": { - "component-emitter": "^1.2.0", - "cookiejar": "^2.1.0", - "debug": "^3.1.0", - "extend": "^3.0.0", - "form-data": "^2.3.1", - "formidable": "^1.1.1", - "methods": "^1.1.1", - "mime": "^1.4.1", - "qs": "^6.5.1", - "readable-stream": "^2.0.5" + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/superagent/-/superagent-5.3.1.tgz", + "integrity": "sha512-wjJ/MoTid2/RuGCOFtlacyGNxN9QLMgcpYLDQlWFIhhdJ93kNscFonGvrpAHSCVjRVj++DGCglocF7Aej1KHvQ==", + "requires": { + "component-emitter": "^1.3.0", + "cookiejar": "^2.1.2", + "debug": "^4.1.1", + "fast-safe-stringify": "^2.0.7", + "form-data": "^3.0.0", + "formidable": "^1.2.2", + "methods": "^1.1.2", + "mime": "^2.4.6", + "qs": "^6.9.4", + "readable-stream": "^3.6.0", + "semver": "^7.3.2" }, "dependencies": { "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "requires": { "ms": "^2.1.1" } @@ -3123,6 +3772,21 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "semver": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==" } } }, @@ -3145,6 +3809,7 @@ "version": "0.3.0", "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, "optional": true, "requires": { "kind-of": "^3.0.2" @@ -3154,6 +3819,7 @@ "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, "optional": true, "requires": { "is-buffer": "^1.1.5" @@ -3165,6 +3831,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, "optional": true, "requires": { "define-property": "^2.0.2", @@ -3177,6 +3844,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, "optional": true, "requires": { "is-number": "^3.0.0", @@ -3221,6 +3889,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", + "dev": true, "optional": true, "requires": { "arr-union": "^3.1.0", @@ -3233,6 +3902,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, "optional": true, "requires": { "has-value": "^0.3.1", @@ -3243,6 +3913,7 @@ "version": "0.3.1", "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, "optional": true, "requires": { "get-value": "^2.0.3", @@ -3254,6 +3925,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, "optional": true, "requires": { "isarray": "1.0.0" @@ -3265,6 +3937,7 @@ "version": "0.1.4", "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true, "optional": true } } @@ -3273,18 +3946,21 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", "integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==", + "dev": true, "optional": true }, "urix": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true, "optional": true }, "use": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", + "dev": true, "optional": true }, "util-deprecate": { @@ -3292,10 +3968,153 @@ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dev": true, + "requires": { + "string-width": "^1.0.2 || 2" + } + }, + "workerpool": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.0.0.tgz", + "integrity": "sha512-fU2OcNA/GVAJLLyKUoHkAgIhKb0JoCpSjLC/G2vYKxUjVmQwGbRVeoPJ1a8U4pnVofz4AQV5Y/NEw8oKqxEBtA==", + "dev": true + }, + "wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true + }, + "yargs": { + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", + "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "dev": true, + "requires": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, + "yargs-parser": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", + "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, + "yargs-unparser": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz", + "integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==", + "dev": true, + "requires": { + "flat": "^4.1.0", + "lodash": "^4.17.15", + "yargs": "^13.3.0" + } } } } diff --git a/package.json b/package.json index 68c5de2..3bd9dca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@patch-technology/patch", - "version": "1.0.0-rc.1", + "version": "1.0.0-rc.2", "description": "Javascript wrapper for the Patch API", "license": "MIT", "main": "dist/index.js", @@ -13,10 +13,10 @@ "fs": false }, "dependencies": { - "@babel/cli": "^7.0.0", - "superagent": "3.7.0" + "superagent": "^5.3.1" }, "devDependencies": { + "@babel/cli": "^7.0.0", "@babel/core": "^7.0.0", "@babel/plugin-proposal-class-properties": "^7.0.0", "@babel/plugin-proposal-decorators": "^7.0.0", @@ -37,7 +37,7 @@ "@babel/preset-env": "^7.0.0", "@babel/register": "^7.0.0", "chai": "^4.2.0", - "mocha": "^5.2.0" + "mocha": "^8.0.1" }, "files": [ "dist" From 8705a7db82b3cbce2b4653c8146276f7f999d456 Mon Sep 17 00:00:00 2001 From: Brennan Spellacy Date: Wed, 29 Jul 2020 20:25:27 -0700 Subject: [PATCH 02/10] Add prettier --- .github/workflows/test.yml | 2 +- .prettierignore | 1 + .prettierrc.json | 1 + README.md | 58 +- package-lock.json | 286 ++++++++ package.json | 15 +- src/ApiClient.js | 864 +++++++++++++------------ src/api/EstimatesApi.js | 255 ++++---- src/api/OrdersApi.js | 388 +++++------ src/api/PreferencesApi.js | 334 +++++----- src/api/ProjectsApi.js | 172 ++--- src/index.js | 33 +- src/model/Allocation.js | 70 +- src/model/CreateMassEstimateRequest.js | 44 +- src/model/CreateOrderRequest.js | 44 +- src/model/CreatePreferenceRequest.js | 53 +- src/model/ErrorResponse.js | 74 +-- src/model/Estimate.js | 81 ++- src/model/EstimateListResponse.js | 88 ++- src/model/EstimateResponse.js | 75 +-- src/model/MetaIndexObject.js | 51 +- src/model/Order.js | 119 ++-- src/model/OrderListResponse.js | 88 ++- src/model/OrderResponse.js | 75 +-- src/model/Preference.js | 71 +- src/model/PreferenceListResponse.js | 88 ++- src/model/PreferenceResponse.js | 75 +-- src/model/Project.js | 133 ++-- src/model/ProjectListResponse.js | 88 ++- src/model/ProjectResponse.js | 75 +-- test/integration/estimates.spec.js | 32 +- test/integration/orders.test.js | 60 +- test/integration/preferences.test.js | 44 +- test/integration/projects.test.js | 30 +- 34 files changed, 2083 insertions(+), 1884 deletions(-) create mode 100644 .prettierignore create mode 100644 .prettierrc.json diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4a3d982..ab08845 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: ['10', '12', '14'] + node: ["10", "12", "14"] name: Node ${{ matrix.node }} Test steps: - name: Check out code diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..1521c8b --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +dist diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1 @@ +{} diff --git a/README.md b/README.md index e9a4aa0..49309ca 100644 --- a/README.md +++ b/README.md @@ -1,47 +1,55 @@ # Patch Javascript SDK + ![Test](https://github.com/patch-technology/patch-node/workflows/Test/badge.svg) [![Discord](https://img.shields.io/discord/733029448558837792)](https://discord.gg/M23NnGR) The official Javascript package for the [Patch API](https://www.usepatch.com) ## Documentation + For a complete API reference, check out [Patch's API Reference.](https://docs.usepatch.com/docs/patch/openapi/v1/swagger.yaml) ## Installation ### NPM + ```shell npm install @patch-technology/patch --save ``` ### Yarn + ```shell yarn add @patch-technology/patch ``` ### Requirements -* Node 10 + + +- Node 10 + ## Usage ### Configuration After installing the package, you'll have to configure it with your API key which is available from the API key page in the Patch dashboard: + ```javascript // ES6+ -import Patch from '@patch-technology/patch' -const patch = Patch('key_test_1234') +import Patch from "@patch-technology/patch"; +const patch = Patch("key_test_1234"); // ES5 -var patch = require('@patch-technology/patch')('key_test_1234') +var patch = require("@patch-technology/patch")("key_test_1234"); ``` ### Orders + In Patch, orders represent a purchase of carbon offsets or negative emissions by mass. Place orders directly if you know the amount of carbon dioxide you would like to sequester. If you do not know how much to purchase, use an estimate. [API Reference](https://docs.usepatch.com/docs/patch/openapi/v1/swagger.yaml/paths/~1v1~1orders/get) #### Examples + ```javascript // Create an order const mass = 1000000 // Pass in the mass in grams (i.e. 1 metric tonne) @@ -65,61 +73,67 @@ patch.orders.retrieveOrders({ page }) ``` ### Estimates + Estimates allow API users to get a quote for the cost of compensating a certain amount of CO2. When creating an estimate, an order in the `draft` state will also be created, reserving the allocation of a project for 5 minutes. If you don't place your draft order within those 5 minutes, the order will automatically be cancelled. [API Reference](https://docs.usepatch.com/docs/patch/openapi/v1/swagger.yaml/paths/~1v1~1estimates/get) #### Examples + ```javascript // Create an estimate -const mass = 1000000 // Pass in the mass in grams (i.e. 1 metric tonne) -patch.estimates.createMassEstimate({ mass_g: mass }) +const mass = 1000000; // Pass in the mass in grams (i.e. 1 metric tonne) +patch.estimates.createMassEstimate({ mass_g: mass }); // Retrieve an estimate -const estimateId = 'est_test_1234' -patch.estimates.retrieveEstimate(estimate_id) +const estimateId = "est_test_1234"; +patch.estimates.retrieveEstimate(estimate_id); // Retrieve a list of estimates -const page = 1 // Pass in which page of estimates you'd like -patch.estimates.retrieveEstimates({ page }) +const page = 1; // Pass in which page of estimates you'd like +patch.estimates.retrieveEstimates({ page }); ``` ### Projects + Projects are the ways Patch takes CO2 out of the air. They can represent reforestation, enhanced weathering, direct air carbon capture, etc. When you place an order via Patch, it is allocated to a project. [API Reference](https://docs.usepatch.com/docs/patch/openapi/v1/swagger.yaml/paths/~1v1~1projects/get) #### Examples + ```javascript // Retrieve a project -const project_id = 'pro_test_1234' // Pass in the project's ID -patch.projects.retrieveProject(project_id) +const project_id = "pro_test_1234"; // Pass in the project's ID +patch.projects.retrieveProject(project_id); // Retrieve a list of projects -const page = 1 // Pass in which page of projects you'd like -patch.projects.retrieve_projects({ page }) +const page = 1; // Pass in which page of projects you'd like +patch.projects.retrieve_projects({ page }); ``` ### Preferences + Preferences are how you route your orders in Patch. If you don't have a preference, Patch will allocate your order to the least expensive option. If you do have a preference, all of your orders will be sent to that project. You can set your preferences via API, or through the [Patch Dashboard](https://dashboard.usepatch.com/projects). [API Reference](https://docs.usepatch.com/docs/patch/openapi/v1/swagger.yaml/paths/~1v1~1preferences/post) #### Examples + ```javascript // Create a preference -const projectId = 'pro_test_1234' // Pass in the project_id for your preference -patch.preferences.create_preference(project_id: projectId) +const projectId = "pro_test_1234"; // Pass in the project_id for your preference +patch.preferences.create_preference((project_id: projectId)); // Retrieve a preference -const preferenceId = 'pre_test_1234' // Pass in the preferences's id -patch.preferences.retrieve_preference(preferenceId) +const preferenceId = "pre_test_1234"; // Pass in the preferences's id +patch.preferences.retrieve_preference(preferenceId); // Delete a preference -const preferenceId = 'pre_test_1234' // Pass in the preferences's id -patch.preferences.delete_preference(preferenceId) +const preferenceId = "pre_test_1234"; // Pass in the preferences's id +patch.preferences.delete_preference(preferenceId); // Retrieve a list of preferences -const page = 1 // Pass in which page of preferences you'd like -patch.preferences.retrieve_preferences({ page }) +const page = 1; // Pass in which page of preferences you'd like +patch.preferences.retrieve_preferences({ page }); ``` diff --git a/package-lock.json b/package-lock.json index dfce5f9..3dee2e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1208,6 +1208,18 @@ "to-fast-properties": "^2.0.0" } }, + "@types/color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", + "dev": true + }, + "@types/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", + "dev": true + }, "ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", @@ -1508,6 +1520,12 @@ "unset-value": "^1.0.0" } }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, "camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", @@ -1572,6 +1590,12 @@ "upath": "^1.1.1" } }, + "ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true + }, "class-utils": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", @@ -1682,6 +1706,12 @@ "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", "dev": true }, + "compare-versions": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.6.0.tgz", + "integrity": "sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA==", + "dev": true + }, "component-emitter": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", @@ -1739,6 +1769,19 @@ "dev": true, "optional": true }, + "cosmiconfig": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz", + "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==", + "dev": true, + "requires": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.1.0", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.7.2" + } + }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -1848,6 +1891,15 @@ "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", "dev": true }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, "es-abstract": { "version": "1.17.6", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz", @@ -2120,6 +2172,15 @@ "locate-path": "^3.0.0" } }, + "find-versions": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-3.2.0.tgz", + "integrity": "sha512-P8WRou2S+oe222TOCHitLy8zj+SIsVJh52VP4lvXkaFVnOFFdoWv1H1Jjvel1aI6NCFOAaeAVm8qrI0odiLcww==", + "dev": true, + "requires": { + "semver-regex": "^2.0.0" + } + }, "flat": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/flat/-/flat-4.1.0.tgz", @@ -2341,6 +2402,135 @@ "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true }, + "husky": { + "version": "4.2.5", + "resolved": "https://registry.npmjs.org/husky/-/husky-4.2.5.tgz", + "integrity": "sha512-SYZ95AjKcX7goYVZtVZF2i6XiZcHknw50iXvY7b0MiGoj5RwdgRQNEHdb+gPDPCXKlzwrybjFjkL6FOj8uRhZQ==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "ci-info": "^2.0.0", + "compare-versions": "^3.6.0", + "cosmiconfig": "^6.0.0", + "find-versions": "^3.2.0", + "opencollective-postinstall": "^2.0.2", + "pkg-dir": "^4.2.0", + "please-upgrade-node": "^3.2.0", + "slash": "^3.0.0", + "which-pm-runs": "^1.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + } + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "import-fresh": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", + "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -2393,6 +2583,12 @@ "integrity": "sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA==", "dev": true }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, "is-binary-path": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", @@ -2626,6 +2822,12 @@ "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", "dev": true }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, "json5": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz", @@ -2657,6 +2859,12 @@ "leven": "^3.1.0" } }, + "lines-and-columns": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", + "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", + "dev": true + }, "locate-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", @@ -3138,6 +3346,12 @@ "wrappy": "1" } }, + "opencollective-postinstall": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz", + "integrity": "sha512-8AV/sCtuzUeTo8gQK5qDZzARrulB3egtLzFgteqB2tcT4Mw7B8Kt7JcDHmltjz6FOAHsvTevk70gZEbhM4ZS9Q==", + "dev": true + }, "p-limit": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", @@ -3162,6 +3376,27 @@ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, + "parse-json": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.1.tgz", + "integrity": "sha512-ztoZ4/DYeXQq4E21v169sC8qWINGpcosGv9XhTDvg9/hWvx/zrFkc9BiWxR58OJLHGk28j5BL0SDLeV2WmFZlQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1", + "lines-and-columns": "^1.1.6" + } + }, "pascalcase": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", @@ -3194,6 +3429,12 @@ "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "dev": true }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, "pathval": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", @@ -3230,6 +3471,15 @@ "find-up": "^3.0.0" } }, + "please-upgrade-node": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz", + "integrity": "sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg==", + "dev": true, + "requires": { + "semver-compare": "^1.0.0" + } + }, "posix-character-classes": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", @@ -3237,6 +3487,12 @@ "dev": true, "optional": true }, + "prettier": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", + "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==", + "dev": true + }, "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -3410,6 +3666,12 @@ "path-parse": "^1.0.6" } }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, "resolve-url": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", @@ -3445,6 +3707,18 @@ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true }, + "semver-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", + "integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w=", + "dev": true + }, + "semver-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-2.0.0.tgz", + "integrity": "sha512-mUdIBBvdn0PLOeP3TEkMH7HHeUP3GjsXCwKarjv/kGmUFOYg1VqEemKhoQpWMu6X2I8kHeuVdGibLGkVK+/5Qw==", + "dev": true + }, "serialize-javascript": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-3.0.0.tgz", @@ -3983,6 +4257,12 @@ "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, + "which-pm-runs": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.0.0.tgz", + "integrity": "sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs=", + "dev": true + }, "wide-align": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", @@ -4049,6 +4329,12 @@ "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", "dev": true }, + "yaml": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.0.tgz", + "integrity": "sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg==", + "dev": true + }, "yargs": { "version": "13.3.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", diff --git a/package.json b/package.json index 3bd9dca..9348b45 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,10 @@ "version": "1.0.0-rc.2", "description": "Javascript wrapper for the Patch API", "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/patch-technology/patch-node.git" + }, "main": "dist/index.js", "scripts": { "build": "babel src -d dist", @@ -37,9 +41,16 @@ "@babel/preset-env": "^7.0.0", "@babel/register": "^7.0.0", "chai": "^4.2.0", - "mocha": "^8.0.1" + "husky": "^4.2.5", + "mocha": "^8.0.1", + "prettier": "2.0.5" }, "files": [ "dist" - ] + ], + "husky": { + "hooks": { + "pre-commit": "npx prettier --write ." + } + } } diff --git a/src/ApiClient.js b/src/ApiClient.js index 789f42a..e68c45a 100644 --- a/src/ApiClient.js +++ b/src/ApiClient.js @@ -5,493 +5,509 @@ * Contact: developers@usepatch.com */ - import superagent from "superagent"; import querystring from "querystring"; class ApiClient { - constructor() { - this.basePath = 'https://api.usepatch.com'.replace(/\/+$/, ''); - this.authentications = { - - - - - 'bearer_auth': {type: 'bearer'} + constructor() { + this.basePath = "https://api.usepatch.com".replace(/\/+$/, ""); + this.authentications = { + bearer_auth: { type: "bearer" }, + }; + this.defaultHeaders = {}; + + /** + * The default HTTP timeout for all API calls. + * @type {Number} + * @default 60000 + */ + this.timeout = 60000; + + /** + * If set to false an additional timestamp parameter is added to all API GET calls to + * prevent browser caching + * @type {Boolean} + * @default true + */ + this.cache = true; + + this.enableCookies = false; + + /* + * Used to save and return cookies in a node.js (non-browser) setting, + * if this.enableCookies is set to true. + */ + if (typeof window === "undefined") { + this.agent = new superagent.agent(); + } + /* + * Allow user to override superagent agent + */ + this.requestAgent = null; + /* + * Allow user to add superagent plugins + */ + this.plugins = null; + } + paramToString(param) { + if (param == undefined || param == null) { + return ""; + } + if (param instanceof Date) { + return param.toJSON(); + } - } + return param.toString(); + } - this.defaultHeaders = {}; - - /** - * The default HTTP timeout for all API calls. - * @type {Number} - * @default 60000 - */ - this.timeout = 60000; - - /** - * If set to false an additional timestamp parameter is added to all API GET calls to - * prevent browser caching - * @type {Boolean} - * @default true - */ - this.cache = true; - - this.enableCookies = false; - - /* - * Used to save and return cookies in a node.js (non-browser) setting, - * if this.enableCookies is set to true. - */ - if (typeof window === 'undefined') { - this.agent = new superagent.agent(); - } + buildUrl(path, pathParams) { + if (!path.match(/^\//)) { + path = "/" + path; + } - /* - * Allow user to override superagent agent - */ - this.requestAgent = null; + 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; + } + + isJsonMime(contentType) { + return Boolean( + contentType != null && contentType.match(/^application\/json(;.*)?$/i) + ); + } + + jsonPreferredMime(contentTypes) { + for (var i = 0; i < contentTypes.length; i++) { + if (this.isJsonMime(contentTypes[i])) { + return contentTypes[i]; + } + } - /* - * Allow user to add superagent plugins - */ - this.plugins = null; + return contentTypes[0]; + } + + isFileParam(param) { + // fs.ReadStream in Node.js and Electron (but not in runtime like browserify) + if (typeof require === "function") { + let fs; + try { + fs = require("fs"); + } catch (err) {} + if (fs && fs.ReadStream && param instanceof fs.ReadStream) { + return true; + } + } + // Buffer in Node.js + if (typeof Buffer === "function" && param instanceof Buffer) { + return true; } - paramToString(param) { - if (param == undefined || param == null) { - return ''; - } - if (param instanceof Date) { - return param.toJSON(); - } + // Blob in browser + if (typeof Blob === "function" && param instanceof Blob) { + return true; + } - return param.toString(); + // File in browser (it seems File object is also instance of Blob, but keep this for safe) + if (typeof File === "function" && param instanceof File) { + return true; } - buildUrl(path, pathParams) { - if (!path.match(/^\//)) { - path = '/' + path; + return false; + } + + normalizeParams(params) { + var newParams = {}; + for (var key in params) { + if ( + params.hasOwnProperty(key) && + params[key] != undefined && + params[key] != null + ) { + var value = params[key]; + if (this.isFileParam(value) || Array.isArray(value)) { + newParams[key] = value; + } else { + newParams[key] = this.paramToString(value); } + } + } - var url = this.basePath + path; + return newParams; + } - url = url.replace(/\{([\w-]+)\}/g, (fullMatch, key) => { - var value; - if (pathParams.hasOwnProperty(key)) { - value = this.paramToString(pathParams[key]); + 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("\t"); + case "pipes": + return param.map(this.paramToString).join("|"); + case "multi": + //return the array directly as SuperAgent will handle it as expected + return param.map(this.paramToString); + default: + throw new Error("Unknown collection format: " + collectionFormat); + } + } + + 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 "bearer": + if (auth.accessToken) { + request.set({ Authorization: "Bearer " + auth.accessToken }); + } + + break; + case "apiKey": + if (auth.apiKey) { + var data = {}; + if (auth.apiKeyPrefix) { + data[auth.name] = auth.apiKeyPrefix + " " + auth.apiKey; } else { - value = fullMatch; + data[auth.name] = auth.apiKey; } - return encodeURIComponent(value); - }); - - return url; + 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); + } + }); + } + + deserialize(response, returnType) { + if (response == null || returnType == null || response.status == 204) { + return null; } - isJsonMime(contentType) { - return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i)); + // Rely on SuperAgent for parsing response body. + // See http://visionmedia.github.io/superagent/#parsing-response-bodies + var data = response.body; + if ( + data == null || + (typeof data === "object" && + typeof data.length === "undefined" && + !Object.keys(data).length) + ) { + // SuperAgent does not always produce a body; use the unparsed response as a fallback + data = response.text; } - jsonPreferredMime(contentTypes) { - for (var i = 0; i < contentTypes.length; i++) { - if (this.isJsonMime(contentTypes[i])) { - return contentTypes[i]; - } + return ApiClient.convertToType(data, returnType); + } + + callApi( + path, + httpMethod, + pathParams, + queryParams, + headerParams, + formParams, + bodyParam, + authNames, + contentTypes, + accepts, + returnType + ) { + var url = this.buildUrl(path, pathParams); + var request = superagent(httpMethod, url); + + if (this.plugins !== null) { + for (var index in this.plugins) { + if (this.plugins.hasOwnProperty(index)) { + request.use(this.plugins[index]); } - - return contentTypes[0]; + } } - isFileParam(param) { - // fs.ReadStream in Node.js and Electron (but not in runtime like browserify) - if (typeof require === 'function') { - let fs; - try { - fs = require('fs'); - } catch (err) {} - if (fs && fs.ReadStream && param instanceof fs.ReadStream) { - return true; - } - } + // apply authentications + this.applyAuthToRequest(request, authNames); - // Buffer in Node.js - if (typeof Buffer === 'function' && param instanceof Buffer) { - return true; - } + // set query parameters + if (httpMethod.toUpperCase() === "GET" && this.cache === false) { + queryParams["_"] = new Date().getTime(); + } - // Blob in browser - if (typeof Blob === 'function' && param instanceof Blob) { - return true; - } + request.query(this.normalizeParams(queryParams)); - // File in browser (it seems File object is also instance of Blob, but keep this for safe) - if (typeof File === 'function' && param instanceof File) { - return true; - } + // set header parameters + request.set(this.defaultHeaders).set(this.normalizeParams(headerParams)); - return false; + // set requestAgent if it is set by user + if (this.requestAgent) { + request.agent(this.requestAgent); } - normalizeParams(params) { - var newParams = {}; - for (var key in params) { - if (params.hasOwnProperty(key) && params[key] != undefined && 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; + // set request timeout + request.timeout(this.timeout); + + var contentType = this.jsonPreferredMime(contentTypes); + if (contentType) { + // Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746) + if (contentType != "multipart/form-data") { + request.type(contentType); + } + } else if (!request.header["Content-Type"]) { + request.type("application/json"); } - 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('\t'); - case 'pipes': - return param.map(this.paramToString).join('|'); - case 'multi': - //return the array directly as SuperAgent will handle it as expected - return param.map(this.paramToString); - default: - throw new Error('Unknown collection format: ' + collectionFormat); + if (contentType === "application/x-www-form-urlencoded") { + request.send(querystring.stringify(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])) { + // file field + request.attach(key, _formParams[key]); + } else { + request.field(key, _formParams[key]); + } } + } + } else if (bodyParam !== null && bodyParam !== undefined) { + request.send(bodyParam); } - 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 'bearer': - if (auth.accessToken) { - request.set({'Authorization': 'Bearer ' + auth.accessToken}); - } - - 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); - } - }); + var accept = this.jsonPreferredMime(accepts); + if (accept) { + request.accept(accept); } - deserialize(response, returnType) { - if (response == null || returnType == null || response.status == 204) { - return null; - } - - // Rely on SuperAgent for parsing response body. - // See http://visionmedia.github.io/superagent/#parsing-response-bodies - var data = response.body; - if (data == null || (typeof data === 'object' && typeof data.length === 'undefined' && !Object.keys(data).length)) { - // SuperAgent does not always produce a body; use the unparsed response as a fallback - data = response.text; - } - - return ApiClient.convertToType(data, returnType); + if (returnType === "Blob") { + request.responseType("blob"); + } else if (returnType === "String") { + request.responseType("string"); } - callApi(path, httpMethod, pathParams, - queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts, - returnType) { - - var url = this.buildUrl(path, pathParams); - var request = superagent(httpMethod, url); + // Attach previously saved cookies, if enabled + if (this.enableCookies) { + if (typeof window === "undefined") { + this.agent._attachCookies(request); + } else { + request.withCredentials(); + } + } - if (this.plugins !== null) { - for (var index in this.plugins) { - if (this.plugins.hasOwnProperty(index)) { - request.use(this.plugins[index]) - } + return new Promise((resolve, reject) => { + request.end((error, response) => { + if (error) { + var err = {}; + err.status = response.status; + err.statusText = response.statusText; + err.body = response.body; + err.response = response; + err.error = error; + + reject(err); + } else { + try { + var data = this.deserialize(response, returnType); + if (this.enableCookies && typeof window === "undefined") { + this.agent._saveCookies(response); } - } - - // apply authentications - this.applyAuthToRequest(request, authNames); - // set query parameters - if (httpMethod.toUpperCase() === 'GET' && this.cache === false) { - queryParams['_'] = new Date().getTime(); + resolve({ data, response }); + } catch (err) { + reject(err); + } } - - request.query(this.normalizeParams(queryParams)); - - // set header parameters - request.set(this.defaultHeaders).set(this.normalizeParams(headerParams)); - - // set requestAgent if it is set by user - if (this.requestAgent) { - request.agent(this.requestAgent); - } - - // set request timeout - request.timeout(this.timeout); - - var contentType = this.jsonPreferredMime(contentTypes); - if (contentType) { - // Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746) - if(contentType != 'multipart/form-data') { - request.type(contentType); + }); + }); + } + + static parseDate(str) { + return new Date(str); + } + + static convertToType(data, type) { + if (data === null || data === undefined) 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) { + // generic object, return directly + return data; + } else if (typeof type.constructFromObject === "function") { + // for model type like User and enum class + return type.constructFromObject(data); + } else if (Array.isArray(type)) { + // for array type like: ['String'] + var itemType = type[0]; + + return data.map((item) => { + return ApiClient.convertToType(item, itemType); + }); + } else if (typeof type === "object") { + // for plain object type like: {'String': 'Integer'} + var keyType, valueType; + for (var k in type) { + if (type.hasOwnProperty(k)) { + keyType = k; + valueType = type[k]; + break; } - } else if (!request.header['Content-Type']) { - request.type('application/json'); - } - - if (contentType === 'application/x-www-form-urlencoded') { - request.send(querystring.stringify(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])) { - // file field - request.attach(key, _formParams[key]); - } else { - request.field(key, _formParams[key]); - } - } + } + + 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; } - } else if (bodyParam !== null && bodyParam !== undefined) { - 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'); - } + } - // Attach previously saved cookies, if enabled - if (this.enableCookies){ - if (typeof window === 'undefined') { - this.agent._attachCookies(request); - } - else { - request.withCredentials(); - } + return result; + } else { + // for unknown type, return the data directly + return data; } - - - return new Promise((resolve, reject) => { - request.end((error, response) => { - if (error) { - var err = {}; - err.status = response.status; - err.statusText = response.statusText; - err.body = response.body; - err.response = response; - err.error = error; - - reject(err); - } else { - try { - var data = this.deserialize(response, returnType); - if (this.enableCookies && typeof window === 'undefined'){ - this.agent._saveCookies(response); - } - - resolve({data, response}); - } catch (err) { - reject(err); - } - } - }); - }); - - - } - - static parseDate(str) { - return new Date(str); + } + + hostSettings() { + return [ + { + url: "https://api.usepatch.com", + description: "No description provided", + + variables: { + defaultHost: { + description: "No description provided", + default_value: "api.usepatch.com", + enum_values: [], + }, + }, + }, + ]; + } + + getBasePathFromSettings(index, variables = {}) { + var servers = this.hostSettings(); + + // check array index out of bound + if (index < 0 || index >= servers.length) { + throw new Error( + "Invalid index " + + index + + " when selecting the host settings. Must be less than " + + servers.length + ); } - static convertToType(data, type) { - if (data === null || data === undefined) - 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) { - // generic object, return directly - return data; - } else if (typeof type.constructFromObject === 'function') { - // for model type like User and enum class - return type.constructFromObject(data); - } else if (Array.isArray(type)) { - // for array type like: ['String'] - var itemType = type[0]; - - return data.map((item) => { - return ApiClient.convertToType(item, itemType); - }); - } else if (typeof type === 'object') { - // for plain object type like: {'String': 'Integer'} - 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 { - // for unknown type, return the data directly - return data; - } + var server = servers[index]; + var url = server["url"]; + + // go through variable and assign a value + for (var variable_name in server["variables"]) { + if (variable_name in variables) { + let variable = server["variables"][variable_name]; + if ( + !("enum_values" in variable) || + variable["enum_values"].includes(variables[variable_name]) + ) { + url = url.replace( + "{" + variable_name + "}", + variables[variable_name] + ); + } else { + throw new Error( + "The variable `" + + variable_name + + "` in the host URL has invalid value " + + variables[variable_name] + + ". Must be " + + server["variables"][variable_name]["enum_values"] + + "." + ); } + } else { + // use default value + url = url.replace( + "{" + variable_name + "}", + server["variables"][variable_name]["default_value"] + ); + } } - - hostSettings() { - return [ - - { - 'url': "https://api.usepatch.com", - 'description': "No description provided", - - - 'variables': { - - defaultHost: { - 'description': "No description provided", - 'default_value': "api.usepatch.com", - 'enum_values': [ - - ] - } - - } - - - } - - ]; - } - - getBasePathFromSettings(index, variables={}) { - var servers = this.hostSettings(); - - // check array index out of bound - if (index < 0 || index >= servers.length) { - throw new Error("Invalid index " + index + " when selecting the host settings. Must be less than " + servers.length); - } - - var server = servers[index]; - var url = server['url']; - - // go through variable and assign a value - for (var variable_name in server['variables']) { - if (variable_name in variables) { - let variable = server['variables'][variable_name]; - if ( !('enum_values' in variable) || variable['enum_values'].includes(variables[variable_name]) ) { - url = url.replace("{" + variable_name + "}", variables[variable_name]); - } else { - throw new Error("The variable `" + variable_name + "` in the host URL has invalid value " + variables[variable_name] + ". Must be " + server['variables'][variable_name]['enum_values'] + "."); - } - } else { - // use default value - url = url.replace("{" + variable_name + "}", server['variables'][variable_name]['default_value']) - } - } - return url; + return url; + } + + 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); + } } - - 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.CollectionFormatEnum = { - CSV: ',', - SSV: ' ', - TSV: '\t', - PIPES: '|', - MULTI: 'multi' + CSV: ",", + SSV: " ", + TSV: "\t", + PIPES: "|", + MULTI: "multi", }; ApiClient.instance = new ApiClient(); diff --git a/src/api/EstimatesApi.js b/src/api/EstimatesApi.js index 0976f5b..2afbbe6 100644 --- a/src/api/EstimatesApi.js +++ b/src/api/EstimatesApi.js @@ -5,148 +5,157 @@ * Contact: developers@usepatch.com */ - import ApiClient from "../ApiClient"; -import CreateMassEstimateRequest from '../model/CreateMassEstimateRequest'; -import ErrorResponse from '../model/ErrorResponse'; -import EstimateListResponse from '../model/EstimateListResponse'; -import EstimateResponse from '../model/EstimateResponse'; - +import CreateMassEstimateRequest from "../model/CreateMassEstimateRequest"; +import ErrorResponse from "../model/ErrorResponse"; +import EstimateListResponse from "../model/EstimateListResponse"; +import EstimateResponse from "../model/EstimateResponse"; export default class EstimatesApi { constructor(apiClient) { this.apiClient = apiClient || ApiClient.instance; this.createMassEstimate = this.createMassEstimate.bind(this); - this.createMassEstimateWithHttpInfo = this.createMassEstimateWithHttpInfo.bind(this); + this.createMassEstimateWithHttpInfo = this.createMassEstimateWithHttpInfo.bind( + this + ); this.retrieveEstimate = this.retrieveEstimate.bind(this); - this.retrieveEstimateWithHttpInfo = this.retrieveEstimateWithHttpInfo.bind(this); + this.retrieveEstimateWithHttpInfo = this.retrieveEstimateWithHttpInfo.bind( + this + ); this.retrieveEstimates = this.retrieveEstimates.bind(this); - this.retrieveEstimatesWithHttpInfo = this.retrieveEstimatesWithHttpInfo.bind(this); - } - + this.retrieveEstimatesWithHttpInfo = this.retrieveEstimatesWithHttpInfo.bind( + this + ); + } createMassEstimateWithHttpInfo(createMassEstimateRequest) { - - let postBody = createMassEstimateRequest; - - - // verify the required parameter 'createMassEstimateRequest' is set - if (createMassEstimateRequest === undefined || createMassEstimateRequest === null) { - throw new Error("Missing the required parameter 'createMassEstimateRequest' when calling createMassEstimate"); - } - - - - let pathParams = { - }; - let queryParams = { - }; - let headerParams = { - }; - let formParams = { - }; - - let authNames = ['bearer_auth']; - let contentTypes = ['application/json', ]; - let accepts = ['application/json', ]; - let returnType = EstimateResponse; - - return this.apiClient.callApi( - '/v1/estimates/mass', 'POST', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType + let postBody = createMassEstimateRequest; + + // verify the required parameter 'createMassEstimateRequest' is set + if ( + createMassEstimateRequest === undefined || + createMassEstimateRequest === null + ) { + throw new Error( + "Missing the required parameter 'createMassEstimateRequest' when calling createMassEstimate" ); } - createMassEstimate(createMassEstimateRequest) { - return this.createMassEstimateWithHttpInfo(createMassEstimateRequest) - .then(function(response_and_data) { - return response_and_data.data; - }); - } - - - retrieveEstimateWithHttpInfo(id) { - - let postBody = null; - - - // verify the required parameter 'id' is set - if (id === undefined || id === null) { - throw new Error("Missing the required parameter 'id' when calling retrieveEstimate"); + let pathParams = {}; + let queryParams = {}; + let headerParams = {}; + let formParams = {}; + + let authNames = ["bearer_auth"]; + let contentTypes = ["application/json"]; + let accepts = ["application/json"]; + let returnType = EstimateResponse; + + return this.apiClient.callApi( + "/v1/estimates/mass", + "POST", + pathParams, + queryParams, + headerParams, + formParams, + postBody, + authNames, + contentTypes, + accepts, + returnType + ); + } + + createMassEstimate(createMassEstimateRequest) { + return this.createMassEstimateWithHttpInfo(createMassEstimateRequest).then( + function (response_and_data) { + return response_and_data.data; } + ); + } + retrieveEstimateWithHttpInfo(id) { + let postBody = null; - - let pathParams = { - 'id': id - }; - let queryParams = { - }; - let headerParams = { - }; - let formParams = { - }; - - let authNames = ['bearer_auth']; - let contentTypes = []; - let accepts = ['application/json', ]; - let returnType = EstimateResponse; - - return this.apiClient.callApi( - '/v1/estimates/{id}', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType + // verify the required parameter 'id' is set + if (id === undefined || id === null) { + throw new Error( + "Missing the required parameter 'id' when calling retrieveEstimate" ); } - retrieveEstimate(id) { - return this.retrieveEstimateWithHttpInfo(id) - .then(function(response_and_data) { - return response_and_data.data; - }); - } - + let pathParams = { + id: id, + }; + let queryParams = {}; + let headerParams = {}; + let formParams = {}; + + let authNames = ["bearer_auth"]; + let contentTypes = []; + let accepts = ["application/json"]; + let returnType = EstimateResponse; + + return this.apiClient.callApi( + "/v1/estimates/{id}", + "GET", + pathParams, + queryParams, + headerParams, + formParams, + postBody, + authNames, + contentTypes, + accepts, + returnType + ); + } + + retrieveEstimate(id) { + return this.retrieveEstimateWithHttpInfo(id).then(function ( + response_and_data + ) { + return response_and_data.data; + }); + } retrieveEstimatesWithHttpInfo(opts) { - - opts = opts || {}; - - let postBody = null; - - - - - let pathParams = { - }; - let queryParams = { - 'page': opts['page'] - - - }; - let headerParams = { - }; - let formParams = { - }; - - let authNames = ['bearer_auth']; - let contentTypes = []; - let accepts = ['application/json']; - let returnType = EstimateListResponse; - - return this.apiClient.callApi( - '/v1/estimates', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - } - - retrieveEstimates(opts) { - return this.retrieveEstimatesWithHttpInfo(opts) - .then(function(response_and_data) { - return response_and_data.data; - }); - } - - + opts = opts || {}; + + let postBody = null; + + let pathParams = {}; + let queryParams = { + page: opts["page"], + }; + let headerParams = {}; + let formParams = {}; + + let authNames = ["bearer_auth"]; + let contentTypes = []; + let accepts = ["application/json"]; + let returnType = EstimateListResponse; + + return this.apiClient.callApi( + "/v1/estimates", + "GET", + pathParams, + queryParams, + headerParams, + formParams, + postBody, + authNames, + contentTypes, + accepts, + returnType + ); + } + + retrieveEstimates(opts) { + return this.retrieveEstimatesWithHttpInfo(opts).then(function ( + response_and_data + ) { + return response_and_data.data; + }); + } } diff --git a/src/api/OrdersApi.js b/src/api/OrdersApi.js index 08a327c..dc953d3 100644 --- a/src/api/OrdersApi.js +++ b/src/api/OrdersApi.js @@ -5,13 +5,11 @@ * Contact: developers@usepatch.com */ - import ApiClient from "../ApiClient"; -import CreateOrderRequest from '../model/CreateOrderRequest'; -import ErrorResponse from '../model/ErrorResponse'; -import OrderListResponse from '../model/OrderListResponse'; -import OrderResponse from '../model/OrderResponse'; - +import CreateOrderRequest from "../model/CreateOrderRequest"; +import ErrorResponse from "../model/ErrorResponse"; +import OrderListResponse from "../model/OrderListResponse"; +import OrderResponse from "../model/OrderResponse"; export default class OrdersApi { constructor(apiClient) { @@ -25,216 +23,222 @@ export default class OrdersApi { this.retrieveOrder = this.retrieveOrder.bind(this); this.retrieveOrderWithHttpInfo = this.retrieveOrderWithHttpInfo.bind(this); this.retrieveOrders = this.retrieveOrders.bind(this); - this.retrieveOrdersWithHttpInfo = this.retrieveOrdersWithHttpInfo.bind(this); - } - + this.retrieveOrdersWithHttpInfo = this.retrieveOrdersWithHttpInfo.bind( + this + ); + } cancelOrderWithHttpInfo(id) { - - let postBody = null; - - - // verify the required parameter 'id' is set - if (id === undefined || id === null) { - throw new Error("Missing the required parameter 'id' when calling cancelOrder"); - } + let postBody = null; - - - let pathParams = { - 'id': id - }; - let queryParams = { - }; - let headerParams = { - }; - let formParams = { - }; - - let authNames = ['bearer_auth']; - let contentTypes = []; - let accepts = ['application/json', ]; - let returnType = OrderResponse; - - return this.apiClient.callApi( - '/v1/orders/{id}/cancel', 'PATCH', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType + // verify the required parameter 'id' is set + if (id === undefined || id === null) { + throw new Error( + "Missing the required parameter 'id' when calling cancelOrder" ); } - cancelOrder(id) { - return this.cancelOrderWithHttpInfo(id) - .then(function(response_and_data) { - return response_and_data.data; - }); - } - + let pathParams = { + id: id, + }; + let queryParams = {}; + let headerParams = {}; + let formParams = {}; + + let authNames = ["bearer_auth"]; + let contentTypes = []; + let accepts = ["application/json"]; + let returnType = OrderResponse; + + return this.apiClient.callApi( + "/v1/orders/{id}/cancel", + "PATCH", + pathParams, + queryParams, + headerParams, + formParams, + postBody, + authNames, + contentTypes, + accepts, + returnType + ); + } + + cancelOrder(id) { + return this.cancelOrderWithHttpInfo(id).then(function (response_and_data) { + return response_and_data.data; + }); + } createOrderWithHttpInfo(createOrderRequest) { - - let postBody = createOrderRequest; - - - // verify the required parameter 'createOrderRequest' is set - if (createOrderRequest === undefined || createOrderRequest === null) { - throw new Error("Missing the required parameter 'createOrderRequest' when calling createOrder"); - } - - + let postBody = createOrderRequest; - let pathParams = { - }; - let queryParams = { - }; - let headerParams = { - }; - let formParams = { - }; - - let authNames = ['bearer_auth']; - let contentTypes = ['application/json', ]; - let accepts = ['application/json', ]; - let returnType = OrderResponse; - - return this.apiClient.callApi( - '/v1/orders', 'POST', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType + // verify the required parameter 'createOrderRequest' is set + if (createOrderRequest === undefined || createOrderRequest === null) { + throw new Error( + "Missing the required parameter 'createOrderRequest' when calling createOrder" ); } - createOrder(createOrderRequest) { - return this.createOrderWithHttpInfo(createOrderRequest) - .then(function(response_and_data) { - return response_and_data.data; - }); - } - + let pathParams = {}; + let queryParams = {}; + let headerParams = {}; + let formParams = {}; + + let authNames = ["bearer_auth"]; + let contentTypes = ["application/json"]; + let accepts = ["application/json"]; + let returnType = OrderResponse; + + return this.apiClient.callApi( + "/v1/orders", + "POST", + pathParams, + queryParams, + headerParams, + formParams, + postBody, + authNames, + contentTypes, + accepts, + returnType + ); + } + + createOrder(createOrderRequest) { + return this.createOrderWithHttpInfo(createOrderRequest).then(function ( + response_and_data + ) { + return response_and_data.data; + }); + } placeOrderWithHttpInfo(id) { - - let postBody = null; - + let postBody = null; - // verify the required parameter 'id' is set - if (id === undefined || id === null) { - throw new Error("Missing the required parameter 'id' when calling placeOrder"); - } - - - - let pathParams = { - 'id': id - }; - let queryParams = { - }; - let headerParams = { - }; - let formParams = { - }; - - let authNames = ['bearer_auth']; - let contentTypes = []; - let accepts = ['application/json', ]; - let returnType = OrderResponse; - - return this.apiClient.callApi( - '/v1/orders/{id}/place', 'PATCH', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType + // verify the required parameter 'id' is set + if (id === undefined || id === null) { + throw new Error( + "Missing the required parameter 'id' when calling placeOrder" ); } - placeOrder(id) { - return this.placeOrderWithHttpInfo(id) - .then(function(response_and_data) { - return response_and_data.data; - }); - } - + let pathParams = { + id: id, + }; + let queryParams = {}; + let headerParams = {}; + let formParams = {}; + + let authNames = ["bearer_auth"]; + let contentTypes = []; + let accepts = ["application/json"]; + let returnType = OrderResponse; + + return this.apiClient.callApi( + "/v1/orders/{id}/place", + "PATCH", + pathParams, + queryParams, + headerParams, + formParams, + postBody, + authNames, + contentTypes, + accepts, + returnType + ); + } + + placeOrder(id) { + return this.placeOrderWithHttpInfo(id).then(function (response_and_data) { + return response_and_data.data; + }); + } retrieveOrderWithHttpInfo(id) { - - let postBody = null; - - - // verify the required parameter 'id' is set - if (id === undefined || id === null) { - throw new Error("Missing the required parameter 'id' when calling retrieveOrder"); - } - - + let postBody = null; - let pathParams = { - 'id': id - }; - let queryParams = { - }; - let headerParams = { - }; - let formParams = { - }; - - let authNames = ['bearer_auth']; - let contentTypes = []; - let accepts = ['application/json', ]; - let returnType = OrderResponse; - - return this.apiClient.callApi( - '/v1/orders/{id}', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType + // verify the required parameter 'id' is set + if (id === undefined || id === null) { + throw new Error( + "Missing the required parameter 'id' when calling retrieveOrder" ); } - retrieveOrder(id) { - return this.retrieveOrderWithHttpInfo(id) - .then(function(response_and_data) { - return response_and_data.data; - }); - } - + let pathParams = { + id: id, + }; + let queryParams = {}; + let headerParams = {}; + let formParams = {}; + + let authNames = ["bearer_auth"]; + let contentTypes = []; + let accepts = ["application/json"]; + let returnType = OrderResponse; + + return this.apiClient.callApi( + "/v1/orders/{id}", + "GET", + pathParams, + queryParams, + headerParams, + formParams, + postBody, + authNames, + contentTypes, + accepts, + returnType + ); + } + + retrieveOrder(id) { + return this.retrieveOrderWithHttpInfo(id).then(function ( + response_and_data + ) { + return response_and_data.data; + }); + } retrieveOrdersWithHttpInfo(opts) { - - opts = opts || {}; - - let postBody = null; - - - - - let pathParams = { - }; - let queryParams = { - 'page': opts['page'] - - - }; - let headerParams = { - }; - let formParams = { - }; - - let authNames = ['bearer_auth']; - let contentTypes = []; - let accepts = ['application/json']; - let returnType = OrderListResponse; - - return this.apiClient.callApi( - '/v1/orders', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - } - - retrieveOrders(opts) { - return this.retrieveOrdersWithHttpInfo(opts) - .then(function(response_and_data) { - return response_and_data.data; - }); - } - - + opts = opts || {}; + + let postBody = null; + + let pathParams = {}; + let queryParams = { + page: opts["page"], + }; + let headerParams = {}; + let formParams = {}; + + let authNames = ["bearer_auth"]; + let contentTypes = []; + let accepts = ["application/json"]; + let returnType = OrderListResponse; + + return this.apiClient.callApi( + "/v1/orders", + "GET", + pathParams, + queryParams, + headerParams, + formParams, + postBody, + authNames, + contentTypes, + accepts, + returnType + ); + } + + retrieveOrders(opts) { + return this.retrieveOrdersWithHttpInfo(opts).then(function ( + response_and_data + ) { + return response_and_data.data; + }); + } } diff --git a/src/api/PreferencesApi.js b/src/api/PreferencesApi.js index 4d3a8f0..9e8e905 100644 --- a/src/api/PreferencesApi.js +++ b/src/api/PreferencesApi.js @@ -5,192 +5,206 @@ * Contact: developers@usepatch.com */ - import ApiClient from "../ApiClient"; -import CreatePreferenceRequest from '../model/CreatePreferenceRequest'; -import ErrorResponse from '../model/ErrorResponse'; -import PreferenceListResponse from '../model/PreferenceListResponse'; -import PreferenceResponse from '../model/PreferenceResponse'; - +import CreatePreferenceRequest from "../model/CreatePreferenceRequest"; +import ErrorResponse from "../model/ErrorResponse"; +import PreferenceListResponse from "../model/PreferenceListResponse"; +import PreferenceResponse from "../model/PreferenceResponse"; export default class PreferencesApi { constructor(apiClient) { this.apiClient = apiClient || ApiClient.instance; this.createPreference = this.createPreference.bind(this); - this.createPreferenceWithHttpInfo = this.createPreferenceWithHttpInfo.bind(this); + this.createPreferenceWithHttpInfo = this.createPreferenceWithHttpInfo.bind( + this + ); this.deletePreference = this.deletePreference.bind(this); - this.deletePreferenceWithHttpInfo = this.deletePreferenceWithHttpInfo.bind(this); + this.deletePreferenceWithHttpInfo = this.deletePreferenceWithHttpInfo.bind( + this + ); this.retrievePreference = this.retrievePreference.bind(this); - this.retrievePreferenceWithHttpInfo = this.retrievePreferenceWithHttpInfo.bind(this); + this.retrievePreferenceWithHttpInfo = this.retrievePreferenceWithHttpInfo.bind( + this + ); this.retrievePreferences = this.retrievePreferences.bind(this); - this.retrievePreferencesWithHttpInfo = this.retrievePreferencesWithHttpInfo.bind(this); - } - + this.retrievePreferencesWithHttpInfo = this.retrievePreferencesWithHttpInfo.bind( + this + ); + } createPreferenceWithHttpInfo(createPreferenceRequest) { - - let postBody = createPreferenceRequest; - - - // verify the required parameter 'createPreferenceRequest' is set - if (createPreferenceRequest === undefined || createPreferenceRequest === null) { - throw new Error("Missing the required parameter 'createPreferenceRequest' when calling createPreference"); - } - - - - let pathParams = { - }; - let queryParams = { - }; - let headerParams = { - }; - let formParams = { - }; - - let authNames = ['bearer_auth']; - let contentTypes = ['application/json', ]; - let accepts = ['application/json', ]; - let returnType = PreferenceResponse; - - return this.apiClient.callApi( - '/v1/preferences', 'POST', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType + let postBody = createPreferenceRequest; + + // verify the required parameter 'createPreferenceRequest' is set + if ( + createPreferenceRequest === undefined || + createPreferenceRequest === null + ) { + throw new Error( + "Missing the required parameter 'createPreferenceRequest' when calling createPreference" ); } - createPreference(createPreferenceRequest) { - return this.createPreferenceWithHttpInfo(createPreferenceRequest) - .then(function(response_and_data) { - return response_and_data.data; - }); - } - - - deletePreferenceWithHttpInfo(id) { - - let postBody = null; - - - // verify the required parameter 'id' is set - if (id === undefined || id === null) { - throw new Error("Missing the required parameter 'id' when calling deletePreference"); + let pathParams = {}; + let queryParams = {}; + let headerParams = {}; + let formParams = {}; + + let authNames = ["bearer_auth"]; + let contentTypes = ["application/json"]; + let accepts = ["application/json"]; + let returnType = PreferenceResponse; + + return this.apiClient.callApi( + "/v1/preferences", + "POST", + pathParams, + queryParams, + headerParams, + formParams, + postBody, + authNames, + contentTypes, + accepts, + returnType + ); + } + + createPreference(createPreferenceRequest) { + return this.createPreferenceWithHttpInfo(createPreferenceRequest).then( + function (response_and_data) { + return response_and_data.data; } + ); + } + deletePreferenceWithHttpInfo(id) { + let postBody = null; - - let pathParams = { - 'id': id - }; - let queryParams = { - }; - let headerParams = { - }; - let formParams = { - }; - - let authNames = ['bearer_auth']; - let contentTypes = []; - let accepts = ['application/json', ]; - let returnType = PreferenceResponse; - - return this.apiClient.callApi( - '/v1/preferences/{id}', 'DELETE', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType + // verify the required parameter 'id' is set + if (id === undefined || id === null) { + throw new Error( + "Missing the required parameter 'id' when calling deletePreference" ); } - deletePreference(id) { - return this.deletePreferenceWithHttpInfo(id) - .then(function(response_and_data) { - return response_and_data.data; - }); - } - + let pathParams = { + id: id, + }; + let queryParams = {}; + let headerParams = {}; + let formParams = {}; + + let authNames = ["bearer_auth"]; + let contentTypes = []; + let accepts = ["application/json"]; + let returnType = PreferenceResponse; + + return this.apiClient.callApi( + "/v1/preferences/{id}", + "DELETE", + pathParams, + queryParams, + headerParams, + formParams, + postBody, + authNames, + contentTypes, + accepts, + returnType + ); + } + + deletePreference(id) { + return this.deletePreferenceWithHttpInfo(id).then(function ( + response_and_data + ) { + return response_and_data.data; + }); + } retrievePreferenceWithHttpInfo(id) { - - let postBody = null; - - - // verify the required parameter 'id' is set - if (id === undefined || id === null) { - throw new Error("Missing the required parameter 'id' when calling retrievePreference"); - } - - - - let pathParams = { - 'id': id - }; - let queryParams = { - }; - let headerParams = { - }; - let formParams = { - }; + let postBody = null; - let authNames = ['bearer_auth']; - let contentTypes = []; - let accepts = ['application/json', ]; - let returnType = PreferenceResponse; - - return this.apiClient.callApi( - '/v1/preferences/{id}', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType + // verify the required parameter 'id' is set + if (id === undefined || id === null) { + throw new Error( + "Missing the required parameter 'id' when calling retrievePreference" ); } - retrievePreference(id) { - return this.retrievePreferenceWithHttpInfo(id) - .then(function(response_and_data) { - return response_and_data.data; - }); - } - + let pathParams = { + id: id, + }; + let queryParams = {}; + let headerParams = {}; + let formParams = {}; + + let authNames = ["bearer_auth"]; + let contentTypes = []; + let accepts = ["application/json"]; + let returnType = PreferenceResponse; + + return this.apiClient.callApi( + "/v1/preferences/{id}", + "GET", + pathParams, + queryParams, + headerParams, + formParams, + postBody, + authNames, + contentTypes, + accepts, + returnType + ); + } + + retrievePreference(id) { + return this.retrievePreferenceWithHttpInfo(id).then(function ( + response_and_data + ) { + return response_and_data.data; + }); + } retrievePreferencesWithHttpInfo(opts) { - - opts = opts || {}; - - let postBody = null; - - - - - let pathParams = { - }; - let queryParams = { - 'page': opts['page'] - - - }; - let headerParams = { - }; - let formParams = { - }; - - let authNames = ['bearer_auth']; - let contentTypes = []; - let accepts = ['application/json']; - let returnType = PreferenceListResponse; - - return this.apiClient.callApi( - '/v1/preferences', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - } - - retrievePreferences(opts) { - return this.retrievePreferencesWithHttpInfo(opts) - .then(function(response_and_data) { - return response_and_data.data; - }); - } - - + opts = opts || {}; + + let postBody = null; + + let pathParams = {}; + let queryParams = { + page: opts["page"], + }; + let headerParams = {}; + let formParams = {}; + + let authNames = ["bearer_auth"]; + let contentTypes = []; + let accepts = ["application/json"]; + let returnType = PreferenceListResponse; + + return this.apiClient.callApi( + "/v1/preferences", + "GET", + pathParams, + queryParams, + headerParams, + formParams, + postBody, + authNames, + contentTypes, + accepts, + returnType + ); + } + + retrievePreferences(opts) { + return this.retrievePreferencesWithHttpInfo(opts).then(function ( + response_and_data + ) { + return response_and_data.data; + }); + } } diff --git a/src/api/ProjectsApi.js b/src/api/ProjectsApi.js index 9456307..9856da4 100644 --- a/src/api/ProjectsApi.js +++ b/src/api/ProjectsApi.js @@ -5,104 +5,106 @@ * Contact: developers@usepatch.com */ - import ApiClient from "../ApiClient"; -import ErrorResponse from '../model/ErrorResponse'; -import ProjectListResponse from '../model/ProjectListResponse'; -import ProjectResponse from '../model/ProjectResponse'; - +import ErrorResponse from "../model/ErrorResponse"; +import ProjectListResponse from "../model/ProjectListResponse"; +import ProjectResponse from "../model/ProjectResponse"; export default class ProjectsApi { constructor(apiClient) { this.apiClient = apiClient || ApiClient.instance; this.retrieveProject = this.retrieveProject.bind(this); - this.retrieveProjectWithHttpInfo = this.retrieveProjectWithHttpInfo.bind(this); + this.retrieveProjectWithHttpInfo = this.retrieveProjectWithHttpInfo.bind( + this + ); this.retrieveProjects = this.retrieveProjects.bind(this); - this.retrieveProjectsWithHttpInfo = this.retrieveProjectsWithHttpInfo.bind(this); - } - + this.retrieveProjectsWithHttpInfo = this.retrieveProjectsWithHttpInfo.bind( + this + ); + } retrieveProjectWithHttpInfo(id) { - - let postBody = null; - - - // verify the required parameter 'id' is set - if (id === undefined || id === null) { - throw new Error("Missing the required parameter 'id' when calling retrieveProject"); - } + let postBody = null; - - - let pathParams = { - 'id': id - }; - let queryParams = { - }; - let headerParams = { - }; - let formParams = { - }; - - let authNames = ['bearer_auth']; - let contentTypes = []; - let accepts = ['application/json', ]; - let returnType = ProjectResponse; - - return this.apiClient.callApi( - '/v1/projects/{id}', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType + // verify the required parameter 'id' is set + if (id === undefined || id === null) { + throw new Error( + "Missing the required parameter 'id' when calling retrieveProject" ); } - retrieveProject(id) { - return this.retrieveProjectWithHttpInfo(id) - .then(function(response_and_data) { - return response_and_data.data; - }); - } - + let pathParams = { + id: id, + }; + let queryParams = {}; + let headerParams = {}; + let formParams = {}; + + let authNames = ["bearer_auth"]; + let contentTypes = []; + let accepts = ["application/json"]; + let returnType = ProjectResponse; + + return this.apiClient.callApi( + "/v1/projects/{id}", + "GET", + pathParams, + queryParams, + headerParams, + formParams, + postBody, + authNames, + contentTypes, + accepts, + returnType + ); + } + + retrieveProject(id) { + return this.retrieveProjectWithHttpInfo(id).then(function ( + response_and_data + ) { + return response_and_data.data; + }); + } retrieveProjectsWithHttpInfo(opts) { - - opts = opts || {}; - - let postBody = null; - - - - - let pathParams = { - }; - let queryParams = { - 'page': opts['page'] - - - }; - let headerParams = { - }; - let formParams = { - }; - - let authNames = ['bearer_auth']; - let contentTypes = []; - let accepts = ['application/json']; - let returnType = ProjectListResponse; - - return this.apiClient.callApi( - '/v1/projects', 'GET', - pathParams, queryParams, headerParams, formParams, postBody, - authNames, contentTypes, accepts, returnType - ); - } - - retrieveProjects(opts) { - return this.retrieveProjectsWithHttpInfo(opts) - .then(function(response_and_data) { - return response_and_data.data; - }); - } - - + opts = opts || {}; + + let postBody = null; + + let pathParams = {}; + let queryParams = { + page: opts["page"], + }; + let headerParams = {}; + let formParams = {}; + + let authNames = ["bearer_auth"]; + let contentTypes = []; + let accepts = ["application/json"]; + let returnType = ProjectListResponse; + + return this.apiClient.callApi( + "/v1/projects", + "GET", + pathParams, + queryParams, + headerParams, + formParams, + postBody, + authNames, + contentTypes, + accepts, + returnType + ); + } + + retrieveProjects(opts) { + return this.retrieveProjectsWithHttpInfo(opts).then(function ( + response_and_data + ) { + return response_and_data.data; + }); + } } diff --git a/src/index.js b/src/index.js index eb40f28..08fbc73 100644 --- a/src/index.js +++ b/src/index.js @@ -5,24 +5,23 @@ * Contact: developers@usepatch.com */ -import ApiClient from './ApiClient'; -import EstimatesApi from './api/EstimatesApi'; -import OrdersApi from './api/OrdersApi'; -import PreferencesApi from './api/PreferencesApi'; -import ProjectsApi from './api/ProjectsApi'; +import ApiClient from "./ApiClient"; +import EstimatesApi from "./api/EstimatesApi"; +import OrdersApi from "./api/OrdersApi"; +import PreferencesApi from "./api/PreferencesApi"; +import ProjectsApi from "./api/ProjectsApi"; export default function Patch(accessToken) { - if (! (this instanceof Patch)) return new Patch(accessToken) + if (!(this instanceof Patch)) return new Patch(accessToken); - this.client = ApiClient.instance - this.client.authentications['bearer_auth'].accessToken = accessToken - - this.estimates = new EstimatesApi(this.client) - - this.orders = new OrdersApi(this.client) - - this.preferences = new PreferencesApi(this.client) - - this.projects = new ProjectsApi(this.client) - + this.client = ApiClient.instance; + this.client.authentications["bearer_auth"].accessToken = accessToken; + + this.estimates = new EstimatesApi(this.client); + + this.orders = new OrdersApi(this.client); + + this.preferences = new PreferencesApi(this.client); + + this.projects = new ProjectsApi(this.client); } diff --git a/src/model/Allocation.js b/src/model/Allocation.js index 1c70b22..d88a445 100644 --- a/src/model/Allocation.js +++ b/src/model/Allocation.js @@ -5,52 +5,42 @@ * Contact: developers@usepatch.com */ -import ApiClient from '../ApiClient'; - +import ApiClient from "../ApiClient"; class Allocation { - constructor() { - - Allocation.initialize(this); - } - - static initialize(obj) { + constructor() { + Allocation.initialize(this); + } + + static initialize(obj) {} + + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Allocation(); + + if (data.hasOwnProperty("id")) { + obj["id"] = ApiClient.convertToType(data["id"], "String"); + } + + if (data.hasOwnProperty("production")) { + obj["production"] = ApiClient.convertToType( + data["production"], + "Boolean" + ); + } + + if (data.hasOwnProperty("mass_g")) { + obj["mass_g"] = ApiClient.convertToType(data["mass_g"], "Number"); + } } - - static constructFromObject(data, obj) { - if (data) { - obj = obj || new Allocation(); - - - if (data.hasOwnProperty('id')) { - obj['id'] = ApiClient.convertToType(data['id'], 'String'); - } - - if (data.hasOwnProperty('production')) { - obj['production'] = ApiClient.convertToType(data['production'], 'Boolean'); - } - - if (data.hasOwnProperty('mass_g')) { - obj['mass_g'] = ApiClient.convertToType(data['mass_g'], 'Number'); - } - - } - return obj; - } - - + return obj; + } } +Allocation.prototype["id"] = undefined; -Allocation.prototype['id'] = undefined; - -Allocation.prototype['production'] = undefined; - -Allocation.prototype['mass_g'] = undefined; - - +Allocation.prototype["production"] = undefined; +Allocation.prototype["mass_g"] = undefined; export default Allocation; - - diff --git a/src/model/CreateMassEstimateRequest.js b/src/model/CreateMassEstimateRequest.js index 6541afd..181a8ec 100644 --- a/src/model/CreateMassEstimateRequest.js +++ b/src/model/CreateMassEstimateRequest.js @@ -5,41 +5,29 @@ * Contact: developers@usepatch.com */ -import ApiClient from '../ApiClient'; - +import ApiClient from "../ApiClient"; class CreateMassEstimateRequest { - constructor(massG) { - - CreateMassEstimateRequest.initialize(this, massG); - } + constructor(massG) { + CreateMassEstimateRequest.initialize(this, massG); + } - static initialize(obj, massG) { - obj['mass_g'] = massG; - } + static initialize(obj, massG) { + obj["mass_g"] = massG; + } - static constructFromObject(data, obj) { - if (data) { - obj = obj || new CreateMassEstimateRequest(); + static constructFromObject(data, obj) { + if (data) { + obj = obj || new CreateMassEstimateRequest(); - - if (data.hasOwnProperty('mass_g')) { - obj['mass_g'] = ApiClient.convertToType(data['mass_g'], 'Number'); - } - - } - return obj; + if (data.hasOwnProperty("mass_g")) { + obj["mass_g"] = ApiClient.convertToType(data["mass_g"], "Number"); + } } - - + return obj; + } } - -CreateMassEstimateRequest.prototype['mass_g'] = undefined; - - - +CreateMassEstimateRequest.prototype["mass_g"] = undefined; export default CreateMassEstimateRequest; - - diff --git a/src/model/CreateOrderRequest.js b/src/model/CreateOrderRequest.js index a6c00da..841a372 100644 --- a/src/model/CreateOrderRequest.js +++ b/src/model/CreateOrderRequest.js @@ -5,41 +5,29 @@ * Contact: developers@usepatch.com */ -import ApiClient from '../ApiClient'; - +import ApiClient from "../ApiClient"; class CreateOrderRequest { - constructor(massG) { - - CreateOrderRequest.initialize(this, massG); - } + constructor(massG) { + CreateOrderRequest.initialize(this, massG); + } - static initialize(obj, massG) { - obj['mass_g'] = massG; - } + static initialize(obj, massG) { + obj["mass_g"] = massG; + } - static constructFromObject(data, obj) { - if (data) { - obj = obj || new CreateOrderRequest(); + static constructFromObject(data, obj) { + if (data) { + obj = obj || new CreateOrderRequest(); - - if (data.hasOwnProperty('mass_g')) { - obj['mass_g'] = ApiClient.convertToType(data['mass_g'], 'Number'); - } - - } - return obj; + if (data.hasOwnProperty("mass_g")) { + obj["mass_g"] = ApiClient.convertToType(data["mass_g"], "Number"); + } } - - + return obj; + } } - -CreateOrderRequest.prototype['mass_g'] = undefined; - - - +CreateOrderRequest.prototype["mass_g"] = undefined; export default CreateOrderRequest; - - diff --git a/src/model/CreatePreferenceRequest.js b/src/model/CreatePreferenceRequest.js index b82075b..e3bf53a 100644 --- a/src/model/CreatePreferenceRequest.js +++ b/src/model/CreatePreferenceRequest.js @@ -5,41 +5,32 @@ * Contact: developers@usepatch.com */ -import ApiClient from '../ApiClient'; - +import ApiClient from "../ApiClient"; class CreatePreferenceRequest { - constructor(projectId) { - - CreatePreferenceRequest.initialize(this, projectId); - } - - static initialize(obj, projectId) { - obj['project_id'] = projectId; + constructor(projectId) { + CreatePreferenceRequest.initialize(this, projectId); + } + + static initialize(obj, projectId) { + obj["project_id"] = projectId; + } + + static constructFromObject(data, obj) { + if (data) { + obj = obj || new CreatePreferenceRequest(); + + if (data.hasOwnProperty("project_id")) { + obj["project_id"] = ApiClient.convertToType( + data["project_id"], + "String" + ); + } } - - static constructFromObject(data, obj) { - if (data) { - obj = obj || new CreatePreferenceRequest(); - - - if (data.hasOwnProperty('project_id')) { - obj['project_id'] = ApiClient.convertToType(data['project_id'], 'String'); - } - - } - return obj; - } - - + return obj; + } } - -CreatePreferenceRequest.prototype['project_id'] = undefined; - - - +CreatePreferenceRequest.prototype["project_id"] = undefined; export default CreatePreferenceRequest; - - diff --git a/src/model/ErrorResponse.js b/src/model/ErrorResponse.js index f552818..5637020 100644 --- a/src/model/ErrorResponse.js +++ b/src/model/ErrorResponse.js @@ -5,55 +5,43 @@ * Contact: developers@usepatch.com */ -import ApiClient from '../ApiClient'; - +import ApiClient from "../ApiClient"; class ErrorResponse { - constructor(success, error, data) { - - ErrorResponse.initialize(this, success, error, data); - } - - static initialize(obj, success, error, data) { - obj['success'] = success; - obj['error'] = error; - obj['data'] = data; + constructor(success, error, data) { + ErrorResponse.initialize(this, success, error, data); + } + + static initialize(obj, success, error, data) { + obj["success"] = success; + obj["error"] = error; + obj["data"] = data; + } + + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ErrorResponse(); + + if (data.hasOwnProperty("success")) { + obj["success"] = ApiClient.convertToType(data["success"], "Boolean"); + } + + if (data.hasOwnProperty("error")) { + obj["error"] = ApiClient.convertToType(data["error"], Object); + } + + if (data.hasOwnProperty("data")) { + obj["data"] = ApiClient.convertToType(data["data"], Object); + } } - - static constructFromObject(data, obj) { - if (data) { - obj = obj || new ErrorResponse(); - - - if (data.hasOwnProperty('success')) { - obj['success'] = ApiClient.convertToType(data['success'], 'Boolean'); - } - - if (data.hasOwnProperty('error')) { - obj['error'] = ApiClient.convertToType(data['error'], Object); - } - - if (data.hasOwnProperty('data')) { - obj['data'] = ApiClient.convertToType(data['data'], Object); - } - - } - return obj; - } - - + return obj; + } } +ErrorResponse.prototype["success"] = undefined; -ErrorResponse.prototype['success'] = undefined; - -ErrorResponse.prototype['error'] = undefined; - -ErrorResponse.prototype['data'] = undefined; - - +ErrorResponse.prototype["error"] = undefined; +ErrorResponse.prototype["data"] = undefined; export default ErrorResponse; - - diff --git a/src/model/Estimate.js b/src/model/Estimate.js index 748a43a..7fa705d 100644 --- a/src/model/Estimate.js +++ b/src/model/Estimate.js @@ -5,58 +5,49 @@ * Contact: developers@usepatch.com */ -import ApiClient from '../ApiClient'; -import Order from './Order'; +import ApiClient from "../ApiClient"; +import Order from "./Order"; class Estimate { - constructor() { - - Estimate.initialize(this); + constructor() { + Estimate.initialize(this); + } + + static initialize(obj) {} + + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Estimate(); + + if (data.hasOwnProperty("id")) { + obj["id"] = ApiClient.convertToType(data["id"], "String"); + } + + if (data.hasOwnProperty("production")) { + obj["production"] = ApiClient.convertToType( + data["production"], + "Boolean" + ); + } + + if (data.hasOwnProperty("type")) { + obj["type"] = ApiClient.convertToType(data["type"], "String"); + } + + if (data.hasOwnProperty("order")) { + obj["order"] = Order.constructFromObject(data["order"]); + } } - - static initialize(obj) { - } - - static constructFromObject(data, obj) { - if (data) { - obj = obj || new Estimate(); - - - if (data.hasOwnProperty('id')) { - obj['id'] = ApiClient.convertToType(data['id'], 'String'); - } - - if (data.hasOwnProperty('production')) { - obj['production'] = ApiClient.convertToType(data['production'], 'Boolean'); - } - - if (data.hasOwnProperty('type')) { - obj['type'] = ApiClient.convertToType(data['type'], 'String'); - } - - if (data.hasOwnProperty('order')) { - obj['order'] = Order.constructFromObject(data['order']); - } - - } - return obj; - } - - + return obj; + } } +Estimate.prototype["id"] = undefined; -Estimate.prototype['id'] = undefined; - -Estimate.prototype['production'] = undefined; - -Estimate.prototype['type'] = undefined; - -Estimate.prototype['order'] = undefined; - +Estimate.prototype["production"] = undefined; +Estimate.prototype["type"] = undefined; +Estimate.prototype["order"] = undefined; export default Estimate; - - diff --git a/src/model/EstimateListResponse.js b/src/model/EstimateListResponse.js index dd7ba6a..158ec1a 100644 --- a/src/model/EstimateListResponse.js +++ b/src/model/EstimateListResponse.js @@ -5,62 +5,52 @@ * Contact: developers@usepatch.com */ -import ApiClient from '../ApiClient'; -import Estimate from './Estimate';import MetaIndexObject from './MetaIndexObject'; +import ApiClient from "../ApiClient"; +import Estimate from "./Estimate"; +import MetaIndexObject from "./MetaIndexObject"; class EstimateListResponse { - constructor(success, error, data, meta) { - - EstimateListResponse.initialize(this, success, error, data, meta); + constructor(success, error, data, meta) { + EstimateListResponse.initialize(this, success, error, data, meta); + } + + static initialize(obj, success, error, data, meta) { + obj["success"] = success; + obj["error"] = error; + obj["data"] = data; + obj["meta"] = meta; + } + + static constructFromObject(data, obj) { + if (data) { + obj = obj || new EstimateListResponse(); + + if (data.hasOwnProperty("success")) { + obj["success"] = ApiClient.convertToType(data["success"], "Boolean"); + } + + if (data.hasOwnProperty("error")) { + obj["error"] = ApiClient.convertToType(data["error"], Object); + } + + if (data.hasOwnProperty("data")) { + obj["data"] = ApiClient.convertToType(data["data"], [Estimate]); + } + + if (data.hasOwnProperty("meta")) { + obj["meta"] = MetaIndexObject.constructFromObject(data["meta"]); + } } - - static initialize(obj, success, error, data, meta) { - obj['success'] = success; - obj['error'] = error; - obj['data'] = data; - obj['meta'] = meta; - } - - static constructFromObject(data, obj) { - if (data) { - obj = obj || new EstimateListResponse(); - - - if (data.hasOwnProperty('success')) { - obj['success'] = ApiClient.convertToType(data['success'], 'Boolean'); - } - - if (data.hasOwnProperty('error')) { - obj['error'] = ApiClient.convertToType(data['error'], Object); - } - - if (data.hasOwnProperty('data')) { - obj['data'] = ApiClient.convertToType(data['data'], [Estimate]); - } - - if (data.hasOwnProperty('meta')) { - obj['meta'] = MetaIndexObject.constructFromObject(data['meta']); - } - - } - return obj; - } - - + return obj; + } } +EstimateListResponse.prototype["success"] = undefined; -EstimateListResponse.prototype['success'] = undefined; - -EstimateListResponse.prototype['error'] = undefined; - -EstimateListResponse.prototype['data'] = undefined; - -EstimateListResponse.prototype['meta'] = undefined; - +EstimateListResponse.prototype["error"] = undefined; +EstimateListResponse.prototype["data"] = undefined; +EstimateListResponse.prototype["meta"] = undefined; export default EstimateListResponse; - - diff --git a/src/model/EstimateResponse.js b/src/model/EstimateResponse.js index 0c16fe2..ddfc401 100644 --- a/src/model/EstimateResponse.js +++ b/src/model/EstimateResponse.js @@ -5,55 +5,44 @@ * Contact: developers@usepatch.com */ -import ApiClient from '../ApiClient'; -import Estimate from './Estimate'; +import ApiClient from "../ApiClient"; +import Estimate from "./Estimate"; class EstimateResponse { - constructor(success, error, data) { - - EstimateResponse.initialize(this, success, error, data); + constructor(success, error, data) { + EstimateResponse.initialize(this, success, error, data); + } + + static initialize(obj, success, error, data) { + obj["success"] = success; + obj["error"] = error; + obj["data"] = data; + } + + static constructFromObject(data, obj) { + if (data) { + obj = obj || new EstimateResponse(); + + if (data.hasOwnProperty("success")) { + obj["success"] = ApiClient.convertToType(data["success"], "Boolean"); + } + + if (data.hasOwnProperty("error")) { + obj["error"] = ApiClient.convertToType(data["error"], Object); + } + + if (data.hasOwnProperty("data")) { + obj["data"] = Estimate.constructFromObject(data["data"]); + } } - - static initialize(obj, success, error, data) { - obj['success'] = success; - obj['error'] = error; - obj['data'] = data; - } - - static constructFromObject(data, obj) { - if (data) { - obj = obj || new EstimateResponse(); - - - if (data.hasOwnProperty('success')) { - obj['success'] = ApiClient.convertToType(data['success'], 'Boolean'); - } - - if (data.hasOwnProperty('error')) { - obj['error'] = ApiClient.convertToType(data['error'], Object); - } - - if (data.hasOwnProperty('data')) { - obj['data'] = Estimate.constructFromObject(data['data']); - } - - } - return obj; - } - - + return obj; + } } +EstimateResponse.prototype["success"] = undefined; -EstimateResponse.prototype['success'] = undefined; - -EstimateResponse.prototype['error'] = undefined; - -EstimateResponse.prototype['data'] = undefined; - - +EstimateResponse.prototype["error"] = undefined; +EstimateResponse.prototype["data"] = undefined; export default EstimateResponse; - - diff --git a/src/model/MetaIndexObject.js b/src/model/MetaIndexObject.js index bffc4f8..77c2a17 100644 --- a/src/model/MetaIndexObject.js +++ b/src/model/MetaIndexObject.js @@ -5,46 +5,33 @@ * Contact: developers@usepatch.com */ -import ApiClient from '../ApiClient'; - +import ApiClient from "../ApiClient"; class MetaIndexObject { - constructor() { - - MetaIndexObject.initialize(this); - } + constructor() { + MetaIndexObject.initialize(this); + } - static initialize(obj) { - } + static initialize(obj) {} - static constructFromObject(data, obj) { - if (data) { - obj = obj || new MetaIndexObject(); - - - if (data.hasOwnProperty('prev_page')) { - obj['prev_page'] = ApiClient.convertToType(data['prev_page'], 'Number'); - } - - if (data.hasOwnProperty('next_page')) { - obj['next_page'] = ApiClient.convertToType(data['next_page'], 'Number'); - } - - } - return obj; - } + static constructFromObject(data, obj) { + if (data) { + obj = obj || new MetaIndexObject(); + if (data.hasOwnProperty("prev_page")) { + obj["prev_page"] = ApiClient.convertToType(data["prev_page"], "Number"); + } + if (data.hasOwnProperty("next_page")) { + obj["next_page"] = ApiClient.convertToType(data["next_page"], "Number"); + } + } + return obj; + } } +MetaIndexObject.prototype["prev_page"] = undefined; -MetaIndexObject.prototype['prev_page'] = undefined; - -MetaIndexObject.prototype['next_page'] = undefined; - - - +MetaIndexObject.prototype["next_page"] = undefined; export default MetaIndexObject; - - diff --git a/src/model/Order.js b/src/model/Order.js index cd0f24a..69b400e 100644 --- a/src/model/Order.js +++ b/src/model/Order.js @@ -5,76 +5,75 @@ * Contact: developers@usepatch.com */ -import ApiClient from '../ApiClient'; -import Allocation from './Allocation'; +import ApiClient from "../ApiClient"; +import Allocation from "./Allocation"; class Order { - constructor() { - - Order.initialize(this); + constructor() { + Order.initialize(this); + } + + static initialize(obj) {} + + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Order(); + + if (data.hasOwnProperty("id")) { + obj["id"] = ApiClient.convertToType(data["id"], "String"); + } + + if (data.hasOwnProperty("mass_g")) { + obj["mass_g"] = ApiClient.convertToType(data["mass_g"], "Number"); + } + + if (data.hasOwnProperty("production")) { + obj["production"] = ApiClient.convertToType( + data["production"], + "Boolean" + ); + } + + if (data.hasOwnProperty("state")) { + obj["state"] = ApiClient.convertToType(data["state"], "String"); + } + + if (data.hasOwnProperty("allocation_state")) { + obj["allocation_state"] = ApiClient.convertToType( + data["allocation_state"], + "String" + ); + } + + if (data.hasOwnProperty("price_cents_usd")) { + obj["price_cents_usd"] = ApiClient.convertToType( + data["price_cents_usd"], + "String" + ); + } + + if (data.hasOwnProperty("allocations")) { + obj["allocations"] = ApiClient.convertToType(data["allocations"], [ + Allocation, + ]); + } } - - static initialize(obj) { - } - - static constructFromObject(data, obj) { - if (data) { - obj = obj || new Order(); - - - if (data.hasOwnProperty('id')) { - obj['id'] = ApiClient.convertToType(data['id'], 'String'); - } - - if (data.hasOwnProperty('mass_g')) { - obj['mass_g'] = ApiClient.convertToType(data['mass_g'], 'Number'); - } - - if (data.hasOwnProperty('production')) { - obj['production'] = ApiClient.convertToType(data['production'], 'Boolean'); - } - - if (data.hasOwnProperty('state')) { - obj['state'] = ApiClient.convertToType(data['state'], 'String'); - } - - if (data.hasOwnProperty('allocation_state')) { - obj['allocation_state'] = ApiClient.convertToType(data['allocation_state'], 'String'); - } - - if (data.hasOwnProperty('price_cents_usd')) { - obj['price_cents_usd'] = ApiClient.convertToType(data['price_cents_usd'], 'String'); - } - - if (data.hasOwnProperty('allocations')) { - obj['allocations'] = ApiClient.convertToType(data['allocations'], [Allocation]); - } - - } - return obj; - } - - + return obj; + } } +Order.prototype["id"] = undefined; -Order.prototype['id'] = undefined; +Order.prototype["mass_g"] = undefined; -Order.prototype['mass_g'] = undefined; +Order.prototype["production"] = undefined; -Order.prototype['production'] = undefined; - -Order.prototype['state'] = undefined; - -Order.prototype['allocation_state'] = undefined; - -Order.prototype['price_cents_usd'] = undefined; - -Order.prototype['allocations'] = undefined; +Order.prototype["state"] = undefined; +Order.prototype["allocation_state"] = undefined; +Order.prototype["price_cents_usd"] = undefined; +Order.prototype["allocations"] = undefined; export default Order; - - diff --git a/src/model/OrderListResponse.js b/src/model/OrderListResponse.js index b55a98c..108dc0c 100644 --- a/src/model/OrderListResponse.js +++ b/src/model/OrderListResponse.js @@ -5,62 +5,52 @@ * Contact: developers@usepatch.com */ -import ApiClient from '../ApiClient'; -import MetaIndexObject from './MetaIndexObject';import Order from './Order'; +import ApiClient from "../ApiClient"; +import MetaIndexObject from "./MetaIndexObject"; +import Order from "./Order"; class OrderListResponse { - constructor(success, error, data, meta) { - - OrderListResponse.initialize(this, success, error, data, meta); + constructor(success, error, data, meta) { + OrderListResponse.initialize(this, success, error, data, meta); + } + + static initialize(obj, success, error, data, meta) { + obj["success"] = success; + obj["error"] = error; + obj["data"] = data; + obj["meta"] = meta; + } + + static constructFromObject(data, obj) { + if (data) { + obj = obj || new OrderListResponse(); + + if (data.hasOwnProperty("success")) { + obj["success"] = ApiClient.convertToType(data["success"], "Boolean"); + } + + if (data.hasOwnProperty("error")) { + obj["error"] = ApiClient.convertToType(data["error"], Object); + } + + if (data.hasOwnProperty("data")) { + obj["data"] = ApiClient.convertToType(data["data"], [Order]); + } + + if (data.hasOwnProperty("meta")) { + obj["meta"] = MetaIndexObject.constructFromObject(data["meta"]); + } } - - static initialize(obj, success, error, data, meta) { - obj['success'] = success; - obj['error'] = error; - obj['data'] = data; - obj['meta'] = meta; - } - - static constructFromObject(data, obj) { - if (data) { - obj = obj || new OrderListResponse(); - - - if (data.hasOwnProperty('success')) { - obj['success'] = ApiClient.convertToType(data['success'], 'Boolean'); - } - - if (data.hasOwnProperty('error')) { - obj['error'] = ApiClient.convertToType(data['error'], Object); - } - - if (data.hasOwnProperty('data')) { - obj['data'] = ApiClient.convertToType(data['data'], [Order]); - } - - if (data.hasOwnProperty('meta')) { - obj['meta'] = MetaIndexObject.constructFromObject(data['meta']); - } - - } - return obj; - } - - + return obj; + } } +OrderListResponse.prototype["success"] = undefined; -OrderListResponse.prototype['success'] = undefined; - -OrderListResponse.prototype['error'] = undefined; - -OrderListResponse.prototype['data'] = undefined; - -OrderListResponse.prototype['meta'] = undefined; - +OrderListResponse.prototype["error"] = undefined; +OrderListResponse.prototype["data"] = undefined; +OrderListResponse.prototype["meta"] = undefined; export default OrderListResponse; - - diff --git a/src/model/OrderResponse.js b/src/model/OrderResponse.js index 2e33bea..ca17242 100644 --- a/src/model/OrderResponse.js +++ b/src/model/OrderResponse.js @@ -5,55 +5,44 @@ * Contact: developers@usepatch.com */ -import ApiClient from '../ApiClient'; -import Order from './Order'; +import ApiClient from "../ApiClient"; +import Order from "./Order"; class OrderResponse { - constructor(success, error, data) { - - OrderResponse.initialize(this, success, error, data); + constructor(success, error, data) { + OrderResponse.initialize(this, success, error, data); + } + + static initialize(obj, success, error, data) { + obj["success"] = success; + obj["error"] = error; + obj["data"] = data; + } + + static constructFromObject(data, obj) { + if (data) { + obj = obj || new OrderResponse(); + + if (data.hasOwnProperty("success")) { + obj["success"] = ApiClient.convertToType(data["success"], "Boolean"); + } + + if (data.hasOwnProperty("error")) { + obj["error"] = ApiClient.convertToType(data["error"], Object); + } + + if (data.hasOwnProperty("data")) { + obj["data"] = Order.constructFromObject(data["data"]); + } } - - static initialize(obj, success, error, data) { - obj['success'] = success; - obj['error'] = error; - obj['data'] = data; - } - - static constructFromObject(data, obj) { - if (data) { - obj = obj || new OrderResponse(); - - - if (data.hasOwnProperty('success')) { - obj['success'] = ApiClient.convertToType(data['success'], 'Boolean'); - } - - if (data.hasOwnProperty('error')) { - obj['error'] = ApiClient.convertToType(data['error'], Object); - } - - if (data.hasOwnProperty('data')) { - obj['data'] = Order.constructFromObject(data['data']); - } - - } - return obj; - } - - + return obj; + } } +OrderResponse.prototype["success"] = undefined; -OrderResponse.prototype['success'] = undefined; - -OrderResponse.prototype['error'] = undefined; - -OrderResponse.prototype['data'] = undefined; - - +OrderResponse.prototype["error"] = undefined; +OrderResponse.prototype["data"] = undefined; export default OrderResponse; - - diff --git a/src/model/Preference.js b/src/model/Preference.js index 3ad6103..bb5c2d5 100644 --- a/src/model/Preference.js +++ b/src/model/Preference.js @@ -5,52 +5,43 @@ * Contact: developers@usepatch.com */ -import ApiClient from '../ApiClient'; -import Project from './Project'; +import ApiClient from "../ApiClient"; +import Project from "./Project"; class Preference { - constructor() { - - Preference.initialize(this); + constructor() { + Preference.initialize(this); + } + + static initialize(obj) {} + + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Preference(); + + if (data.hasOwnProperty("id")) { + obj["id"] = ApiClient.convertToType(data["id"], "String"); + } + + if (data.hasOwnProperty("allocation_percentage")) { + obj["allocation_percentage"] = ApiClient.convertToType( + data["allocation_percentage"], + "Number" + ); + } + + if (data.hasOwnProperty("project")) { + obj["project"] = Project.constructFromObject(data["project"]); + } } - - static initialize(obj) { - } - - static constructFromObject(data, obj) { - if (data) { - obj = obj || new Preference(); - - - if (data.hasOwnProperty('id')) { - obj['id'] = ApiClient.convertToType(data['id'], 'String'); - } - - if (data.hasOwnProperty('allocation_percentage')) { - obj['allocation_percentage'] = ApiClient.convertToType(data['allocation_percentage'], 'Number'); - } - - if (data.hasOwnProperty('project')) { - obj['project'] = Project.constructFromObject(data['project']); - } - - } - return obj; - } - - + return obj; + } } +Preference.prototype["id"] = undefined; -Preference.prototype['id'] = undefined; - -Preference.prototype['allocation_percentage'] = undefined; - -Preference.prototype['project'] = undefined; - - +Preference.prototype["allocation_percentage"] = undefined; +Preference.prototype["project"] = undefined; export default Preference; - - diff --git a/src/model/PreferenceListResponse.js b/src/model/PreferenceListResponse.js index 3adb70e..e00a5d8 100644 --- a/src/model/PreferenceListResponse.js +++ b/src/model/PreferenceListResponse.js @@ -5,62 +5,52 @@ * Contact: developers@usepatch.com */ -import ApiClient from '../ApiClient'; -import MetaIndexObject from './MetaIndexObject';import Preference from './Preference'; +import ApiClient from "../ApiClient"; +import MetaIndexObject from "./MetaIndexObject"; +import Preference from "./Preference"; class PreferenceListResponse { - constructor(success, error, data, meta) { - - PreferenceListResponse.initialize(this, success, error, data, meta); + constructor(success, error, data, meta) { + PreferenceListResponse.initialize(this, success, error, data, meta); + } + + static initialize(obj, success, error, data, meta) { + obj["success"] = success; + obj["error"] = error; + obj["data"] = data; + obj["meta"] = meta; + } + + static constructFromObject(data, obj) { + if (data) { + obj = obj || new PreferenceListResponse(); + + if (data.hasOwnProperty("success")) { + obj["success"] = ApiClient.convertToType(data["success"], "Boolean"); + } + + if (data.hasOwnProperty("error")) { + obj["error"] = ApiClient.convertToType(data["error"], Object); + } + + if (data.hasOwnProperty("data")) { + obj["data"] = ApiClient.convertToType(data["data"], [Preference]); + } + + if (data.hasOwnProperty("meta")) { + obj["meta"] = MetaIndexObject.constructFromObject(data["meta"]); + } } - - static initialize(obj, success, error, data, meta) { - obj['success'] = success; - obj['error'] = error; - obj['data'] = data; - obj['meta'] = meta; - } - - static constructFromObject(data, obj) { - if (data) { - obj = obj || new PreferenceListResponse(); - - - if (data.hasOwnProperty('success')) { - obj['success'] = ApiClient.convertToType(data['success'], 'Boolean'); - } - - if (data.hasOwnProperty('error')) { - obj['error'] = ApiClient.convertToType(data['error'], Object); - } - - if (data.hasOwnProperty('data')) { - obj['data'] = ApiClient.convertToType(data['data'], [Preference]); - } - - if (data.hasOwnProperty('meta')) { - obj['meta'] = MetaIndexObject.constructFromObject(data['meta']); - } - - } - return obj; - } - - + return obj; + } } +PreferenceListResponse.prototype["success"] = undefined; -PreferenceListResponse.prototype['success'] = undefined; - -PreferenceListResponse.prototype['error'] = undefined; - -PreferenceListResponse.prototype['data'] = undefined; - -PreferenceListResponse.prototype['meta'] = undefined; - +PreferenceListResponse.prototype["error"] = undefined; +PreferenceListResponse.prototype["data"] = undefined; +PreferenceListResponse.prototype["meta"] = undefined; export default PreferenceListResponse; - - diff --git a/src/model/PreferenceResponse.js b/src/model/PreferenceResponse.js index 621d2db..87549ba 100644 --- a/src/model/PreferenceResponse.js +++ b/src/model/PreferenceResponse.js @@ -5,55 +5,44 @@ * Contact: developers@usepatch.com */ -import ApiClient from '../ApiClient'; -import Preference from './Preference'; +import ApiClient from "../ApiClient"; +import Preference from "./Preference"; class PreferenceResponse { - constructor(success, error, data) { - - PreferenceResponse.initialize(this, success, error, data); + constructor(success, error, data) { + PreferenceResponse.initialize(this, success, error, data); + } + + static initialize(obj, success, error, data) { + obj["success"] = success; + obj["error"] = error; + obj["data"] = data; + } + + static constructFromObject(data, obj) { + if (data) { + obj = obj || new PreferenceResponse(); + + if (data.hasOwnProperty("success")) { + obj["success"] = ApiClient.convertToType(data["success"], "Boolean"); + } + + if (data.hasOwnProperty("error")) { + obj["error"] = ApiClient.convertToType(data["error"], Object); + } + + if (data.hasOwnProperty("data")) { + obj["data"] = Preference.constructFromObject(data["data"]); + } } - - static initialize(obj, success, error, data) { - obj['success'] = success; - obj['error'] = error; - obj['data'] = data; - } - - static constructFromObject(data, obj) { - if (data) { - obj = obj || new PreferenceResponse(); - - - if (data.hasOwnProperty('success')) { - obj['success'] = ApiClient.convertToType(data['success'], 'Boolean'); - } - - if (data.hasOwnProperty('error')) { - obj['error'] = ApiClient.convertToType(data['error'], Object); - } - - if (data.hasOwnProperty('data')) { - obj['data'] = Preference.constructFromObject(data['data']); - } - - } - return obj; - } - - + return obj; + } } +PreferenceResponse.prototype["success"] = undefined; -PreferenceResponse.prototype['success'] = undefined; - -PreferenceResponse.prototype['error'] = undefined; - -PreferenceResponse.prototype['data'] = undefined; - - +PreferenceResponse.prototype["error"] = undefined; +PreferenceResponse.prototype["data"] = undefined; export default PreferenceResponse; - - diff --git a/src/model/Project.js b/src/model/Project.js index e4a5e7b..c3eebbd 100644 --- a/src/model/Project.js +++ b/src/model/Project.js @@ -5,88 +5,81 @@ * Contact: developers@usepatch.com */ -import ApiClient from '../ApiClient'; - +import ApiClient from "../ApiClient"; class Project { - constructor() { - - Project.initialize(this); - } - - static initialize(obj) { + constructor() { + Project.initialize(this); + } + + static initialize(obj) {} + + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Project(); + + if (data.hasOwnProperty("id")) { + obj["id"] = ApiClient.convertToType(data["id"], "String"); + } + + if (data.hasOwnProperty("production")) { + obj["production"] = ApiClient.convertToType( + data["production"], + "Boolean" + ); + } + + if (data.hasOwnProperty("name")) { + obj["name"] = ApiClient.convertToType(data["name"], "String"); + } + + if (data.hasOwnProperty("description")) { + obj["description"] = ApiClient.convertToType( + data["description"], + "String" + ); + } + + if (data.hasOwnProperty("country")) { + obj["country"] = ApiClient.convertToType(data["country"], "String"); + } + + if (data.hasOwnProperty("longitude")) { + obj["longitude"] = ApiClient.convertToType(data["longitude"], "Number"); + } + + if (data.hasOwnProperty("latitude")) { + obj["latitude"] = ApiClient.convertToType(data["latitude"], "Number"); + } + + if (data.hasOwnProperty("verifier")) { + obj["verifier"] = ApiClient.convertToType(data["verifier"], "String"); + } + + if (data.hasOwnProperty("developer")) { + obj["developer"] = ApiClient.convertToType(data["developer"], "String"); + } } - - static constructFromObject(data, obj) { - if (data) { - obj = obj || new Project(); - - - if (data.hasOwnProperty('id')) { - obj['id'] = ApiClient.convertToType(data['id'], 'String'); - } - - if (data.hasOwnProperty('production')) { - obj['production'] = ApiClient.convertToType(data['production'], 'Boolean'); - } - - if (data.hasOwnProperty('name')) { - obj['name'] = ApiClient.convertToType(data['name'], 'String'); - } - - if (data.hasOwnProperty('description')) { - obj['description'] = ApiClient.convertToType(data['description'], 'String'); - } - - if (data.hasOwnProperty('country')) { - obj['country'] = ApiClient.convertToType(data['country'], 'String'); - } - - if (data.hasOwnProperty('longitude')) { - obj['longitude'] = ApiClient.convertToType(data['longitude'], 'Number'); - } - - if (data.hasOwnProperty('latitude')) { - obj['latitude'] = ApiClient.convertToType(data['latitude'], 'Number'); - } - - if (data.hasOwnProperty('verifier')) { - obj['verifier'] = ApiClient.convertToType(data['verifier'], 'String'); - } - - if (data.hasOwnProperty('developer')) { - obj['developer'] = ApiClient.convertToType(data['developer'], 'String'); - } - - } - return obj; - } - - + return obj; + } } +Project.prototype["id"] = undefined; -Project.prototype['id'] = undefined; +Project.prototype["production"] = undefined; -Project.prototype['production'] = undefined; +Project.prototype["name"] = undefined; -Project.prototype['name'] = undefined; +Project.prototype["description"] = undefined; -Project.prototype['description'] = undefined; +Project.prototype["country"] = undefined; -Project.prototype['country'] = undefined; - -Project.prototype['longitude'] = undefined; - -Project.prototype['latitude'] = undefined; - -Project.prototype['verifier'] = undefined; - -Project.prototype['developer'] = undefined; +Project.prototype["longitude"] = undefined; +Project.prototype["latitude"] = undefined; +Project.prototype["verifier"] = undefined; +Project.prototype["developer"] = undefined; export default Project; - - diff --git a/src/model/ProjectListResponse.js b/src/model/ProjectListResponse.js index b31ec8f..93d6607 100644 --- a/src/model/ProjectListResponse.js +++ b/src/model/ProjectListResponse.js @@ -5,62 +5,52 @@ * Contact: developers@usepatch.com */ -import ApiClient from '../ApiClient'; -import MetaIndexObject from './MetaIndexObject';import Project from './Project'; +import ApiClient from "../ApiClient"; +import MetaIndexObject from "./MetaIndexObject"; +import Project from "./Project"; class ProjectListResponse { - constructor(success, error, data, meta) { - - ProjectListResponse.initialize(this, success, error, data, meta); + constructor(success, error, data, meta) { + ProjectListResponse.initialize(this, success, error, data, meta); + } + + static initialize(obj, success, error, data, meta) { + obj["success"] = success; + obj["error"] = error; + obj["data"] = data; + obj["meta"] = meta; + } + + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ProjectListResponse(); + + if (data.hasOwnProperty("success")) { + obj["success"] = ApiClient.convertToType(data["success"], "Boolean"); + } + + if (data.hasOwnProperty("error")) { + obj["error"] = ApiClient.convertToType(data["error"], Object); + } + + if (data.hasOwnProperty("data")) { + obj["data"] = ApiClient.convertToType(data["data"], [Project]); + } + + if (data.hasOwnProperty("meta")) { + obj["meta"] = MetaIndexObject.constructFromObject(data["meta"]); + } } - - static initialize(obj, success, error, data, meta) { - obj['success'] = success; - obj['error'] = error; - obj['data'] = data; - obj['meta'] = meta; - } - - static constructFromObject(data, obj) { - if (data) { - obj = obj || new ProjectListResponse(); - - - if (data.hasOwnProperty('success')) { - obj['success'] = ApiClient.convertToType(data['success'], 'Boolean'); - } - - if (data.hasOwnProperty('error')) { - obj['error'] = ApiClient.convertToType(data['error'], Object); - } - - if (data.hasOwnProperty('data')) { - obj['data'] = ApiClient.convertToType(data['data'], [Project]); - } - - if (data.hasOwnProperty('meta')) { - obj['meta'] = MetaIndexObject.constructFromObject(data['meta']); - } - - } - return obj; - } - - + return obj; + } } +ProjectListResponse.prototype["success"] = undefined; -ProjectListResponse.prototype['success'] = undefined; - -ProjectListResponse.prototype['error'] = undefined; - -ProjectListResponse.prototype['data'] = undefined; - -ProjectListResponse.prototype['meta'] = undefined; - +ProjectListResponse.prototype["error"] = undefined; +ProjectListResponse.prototype["data"] = undefined; +ProjectListResponse.prototype["meta"] = undefined; export default ProjectListResponse; - - diff --git a/src/model/ProjectResponse.js b/src/model/ProjectResponse.js index af3beef..7be07aa 100644 --- a/src/model/ProjectResponse.js +++ b/src/model/ProjectResponse.js @@ -5,55 +5,44 @@ * Contact: developers@usepatch.com */ -import ApiClient from '../ApiClient'; -import Project from './Project'; +import ApiClient from "../ApiClient"; +import Project from "./Project"; class ProjectResponse { - constructor(success, error, data) { - - ProjectResponse.initialize(this, success, error, data); + constructor(success, error, data) { + ProjectResponse.initialize(this, success, error, data); + } + + static initialize(obj, success, error, data) { + obj["success"] = success; + obj["error"] = error; + obj["data"] = data; + } + + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ProjectResponse(); + + if (data.hasOwnProperty("success")) { + obj["success"] = ApiClient.convertToType(data["success"], "Boolean"); + } + + if (data.hasOwnProperty("error")) { + obj["error"] = ApiClient.convertToType(data["error"], Object); + } + + if (data.hasOwnProperty("data")) { + obj["data"] = Project.constructFromObject(data["data"]); + } } - - static initialize(obj, success, error, data) { - obj['success'] = success; - obj['error'] = error; - obj['data'] = data; - } - - static constructFromObject(data, obj) { - if (data) { - obj = obj || new ProjectResponse(); - - - if (data.hasOwnProperty('success')) { - obj['success'] = ApiClient.convertToType(data['success'], 'Boolean'); - } - - if (data.hasOwnProperty('error')) { - obj['error'] = ApiClient.convertToType(data['error'], Object); - } - - if (data.hasOwnProperty('data')) { - obj['data'] = Project.constructFromObject(data['data']); - } - - } - return obj; - } - - + return obj; + } } +ProjectResponse.prototype["success"] = undefined; -ProjectResponse.prototype['success'] = undefined; - -ProjectResponse.prototype['error'] = undefined; - -ProjectResponse.prototype['data'] = undefined; - - +ProjectResponse.prototype["error"] = undefined; +ProjectResponse.prototype["data"] = undefined; export default ProjectResponse; - - diff --git a/test/integration/estimates.spec.js b/test/integration/estimates.spec.js index fbf0e2a..fe3cee1 100644 --- a/test/integration/estimates.spec.js +++ b/test/integration/estimates.spec.js @@ -1,16 +1,22 @@ -import { expect } from 'chai' -import Patch from '../../dist/index' -const patch = Patch(process.env.SANDBOX_API_KEY) +import { expect } from "chai"; +import Patch from "../../dist/index"; +const patch = Patch(process.env.SANDBOX_API_KEY); -describe('Estimates Integration', function() { - it('supports create, retrieve and list', async function() { - const createEstimateResponse = await patch.estimates.createMassEstimate({ mass_g: 100 }) - const estimateId = createEstimateResponse.data.id +describe("Estimates Integration", function () { + it("supports create, retrieve and list", async function () { + const createEstimateResponse = await patch.estimates.createMassEstimate({ + mass_g: 100, + }); + const estimateId = createEstimateResponse.data.id; - const retrieveEstimateResponse = await patch.estimates.retrieveEstimate(estimateId) - expect(retrieveEstimateResponse.data.id).to.equal(estimateId) + const retrieveEstimateResponse = await patch.estimates.retrieveEstimate( + estimateId + ); + expect(retrieveEstimateResponse.data.id).to.equal(estimateId); - const retrieveEstimatesResponse = await patch.estimates.retrieveEstimates({ page: 1 }) - expect(retrieveEstimatesResponse.data.length).to.be.above(0) - }) -}) + const retrieveEstimatesResponse = await patch.estimates.retrieveEstimates({ + page: 1, + }); + expect(retrieveEstimatesResponse.data.length).to.be.above(0); + }); +}); diff --git a/test/integration/orders.test.js b/test/integration/orders.test.js index 88576ab..4f21d26 100644 --- a/test/integration/orders.test.js +++ b/test/integration/orders.test.js @@ -1,34 +1,40 @@ -import { expect } from 'chai' -import Patch from '../../dist/index' -const patch = Patch(process.env.SANDBOX_API_KEY) +import { expect } from "chai"; +import Patch from "../../dist/index"; +const patch = Patch(process.env.SANDBOX_API_KEY); -describe('Orders Integration', function() { - it('supports create, place, cancel, retrieve and list', async function() { - const createOrderResponse = await patch.orders.createOrder({ mass_g: 100 }) - const orderId = createOrderResponse.data.id +describe("Orders Integration", function () { + it("supports create, place, cancel, retrieve and list", async function () { + const createOrderResponse = await patch.orders.createOrder({ mass_g: 100 }); + const orderId = createOrderResponse.data.id; - const retreiveOrderResponse = await patch.orders.retrieveOrder(orderId) - expect(retreiveOrderResponse.data.id).to.equal(orderId) + const retreiveOrderResponse = await patch.orders.retrieveOrder(orderId); + expect(retreiveOrderResponse.data.id).to.equal(orderId); - const retrieveOrdersResponse = await patch.orders.retrieveOrders({ page: 1 }) - expect(retrieveOrdersResponse.data.length).to.be.above(0) - }) + const retrieveOrdersResponse = await patch.orders.retrieveOrders({ + page: 1, + }); + expect(retrieveOrdersResponse.data.length).to.be.above(0); + }); - it('supports placing orders in a `draft` state', async function() { - const estimateResponse = await patch.estimates.createMassEstimate({ mass_g: 100 }) - const orderId = estimateResponse.data.order.id - expect(estimateResponse.data.order.state).to.equal('draft') + it("supports placing orders in a `draft` state", async function () { + const estimateResponse = await patch.estimates.createMassEstimate({ + mass_g: 100, + }); + const orderId = estimateResponse.data.order.id; + expect(estimateResponse.data.order.state).to.equal("draft"); - const placeOrderResponse = await patch.orders.placeOrder(orderId) - expect(placeOrderResponse.data.state).to.equal('placed') - }) + const placeOrderResponse = await patch.orders.placeOrder(orderId); + expect(placeOrderResponse.data.state).to.equal("placed"); + }); - it('supports cancelling orders in a `draft` state', async function() { - const estimateResponse = await patch.estimates.createMassEstimate({ mass_g: 100 }) - const orderId = estimateResponse.data.order.id - expect(estimateResponse.data.order.state).to.equal('draft') + it("supports cancelling orders in a `draft` state", async function () { + const estimateResponse = await patch.estimates.createMassEstimate({ + mass_g: 100, + }); + const orderId = estimateResponse.data.order.id; + expect(estimateResponse.data.order.state).to.equal("draft"); - const placeOrderResponse = await patch.orders.cancelOrder(orderId) - expect(placeOrderResponse.data.state).to.equal('cancelled') - }) -}) + const placeOrderResponse = await patch.orders.cancelOrder(orderId); + expect(placeOrderResponse.data.state).to.equal("cancelled"); + }); +}); diff --git a/test/integration/preferences.test.js b/test/integration/preferences.test.js index 651b517..9b4f961 100644 --- a/test/integration/preferences.test.js +++ b/test/integration/preferences.test.js @@ -1,22 +1,30 @@ -import { expect } from 'chai' -import Patch from '../../dist/index' -const patch = Patch(process.env.SANDBOX_API_KEY) +import { expect } from "chai"; +import Patch from "../../dist/index"; +const patch = Patch(process.env.SANDBOX_API_KEY); -describe('Preferences Integration', function() { - it('supports create, delete, retrieve and list', async function() { - const projectResponse = await patch.projects.retrieveProjects() - expect(projectResponse.data.length).to.be.above(0) +describe("Preferences Integration", function () { + it("supports create, delete, retrieve and list", async function () { + const projectResponse = await patch.projects.retrieveProjects(); + expect(projectResponse.data.length).to.be.above(0); - const projectId = projectResponse.data[0].id - const createPreferenceResponse = await patch.preferences.createPreference({ project_id: projectId }) - const preferenceId = createPreferenceResponse.data.id - const retrievePreferenceResponse = await patch.preferences.retrievePreference(preferenceId) - expect(retrievePreferenceResponse.data.id).to.equal(preferenceId) + const projectId = projectResponse.data[0].id; + const createPreferenceResponse = await patch.preferences.createPreference({ + project_id: projectId, + }); + const preferenceId = createPreferenceResponse.data.id; + const retrievePreferenceResponse = await patch.preferences.retrievePreference( + preferenceId + ); + expect(retrievePreferenceResponse.data.id).to.equal(preferenceId); - const retrievePreferencesResponse = await patch.preferences.retrievePreferences({ page: 1 }) - expect(retrievePreferencesResponse.data[0].id).to.equal(preferenceId) + const retrievePreferencesResponse = await patch.preferences.retrievePreferences( + { page: 1 } + ); + expect(retrievePreferencesResponse.data[0].id).to.equal(preferenceId); - const deletePreferenceResponse = await patch.preferences.deletePreference(preferenceId) - expect(deletePreferenceResponse.data.id).to.equal(preferenceId) - }) -}) + const deletePreferenceResponse = await patch.preferences.deletePreference( + preferenceId + ); + expect(deletePreferenceResponse.data.id).to.equal(preferenceId); + }); +}); diff --git a/test/integration/projects.test.js b/test/integration/projects.test.js index b5130e5..60c210e 100644 --- a/test/integration/projects.test.js +++ b/test/integration/projects.test.js @@ -1,17 +1,17 @@ -import { expect } from 'chai' -import Patch from '../../dist/index' -const patch = Patch(process.env.SANDBOX_API_KEY) +import { expect } from "chai"; +import Patch from "../../dist/index"; +const patch = Patch(process.env.SANDBOX_API_KEY); -describe('Project Integration', function() { - it('supports fetching the available projects', async function() { - const { data } = await patch.projects.retrieveProjects() - expect(data.length).to.be.above(0) - }) +describe("Project Integration", function () { + it("supports fetching the available projects", async function () { + const { data } = await patch.projects.retrieveProjects(); + expect(data.length).to.be.above(0); + }); - it('supports fetching a single project', async function() { - const { data } = await patch.projects.retrieveProjects() - const projectId = data[0].id - const projectResponse = await patch.projects.retrieveProject(projectId) - expect(projectResponse.data.id).to.equal(projectId) - }) -}) + it("supports fetching a single project", async function () { + const { data } = await patch.projects.retrieveProjects(); + const projectId = data[0].id; + const projectResponse = await patch.projects.retrieveProject(projectId); + expect(projectResponse.data.id).to.equal(projectId); + }); +}); From eb0d9ed185148364d57ceeb9f89b977cbf440e83 Mon Sep 17 00:00:00 2001 From: Brennan Spellacy Date: Thu, 30 Jul 2020 15:55:00 -0700 Subject: [PATCH 03/10] Fix flakey spec --- .github/workflows/test.yml | 2 +- .prettierrc.json | 5 +- README.md | 16 +- dist/ApiClient.js | 710 +++++++++++------------- dist/api/EstimatesApi.js | 171 +++--- dist/api/OrdersApi.js | 271 ++++----- dist/api/PreferencesApi.js | 221 ++++---- dist/api/ProjectsApi.js | 123 ++-- dist/index.js | 14 +- dist/model/Allocation.js | 65 +-- dist/model/CreateMassEstimateRequest.js | 57 +- dist/model/CreateOrderRequest.js | 57 +- dist/model/CreatePreferenceRequest.js | 57 +- dist/model/ErrorResponse.js | 73 ++- dist/model/Estimate.js | 67 +-- dist/model/EstimateListResponse.js | 77 ++- dist/model/EstimateResponse.js | 69 ++- dist/model/MetaIndexObject.js | 59 +- dist/model/Order.js | 95 ++-- dist/model/OrderListResponse.js | 77 ++- dist/model/OrderResponse.js | 69 ++- dist/model/Preference.js | 65 +-- dist/model/PreferenceListResponse.js | 77 ++- dist/model/PreferenceResponse.js | 69 ++- dist/model/Project.js | 111 ++-- dist/model/ProjectListResponse.js | 77 ++- dist/model/ProjectResponse.js | 69 ++- src/ApiClient.js | 186 +++---- src/api/EstimatesApi.js | 58 +- src/api/OrdersApi.js | 86 ++- src/api/PreferencesApi.js | 74 +-- src/api/ProjectsApi.js | 40 +- src/index.js | 12 +- src/model/Allocation.js | 24 +- src/model/CreateMassEstimateRequest.js | 10 +- src/model/CreateOrderRequest.js | 10 +- src/model/CreatePreferenceRequest.js | 14 +- src/model/ErrorResponse.js | 26 +- src/model/Estimate.js | 32 +- src/model/EstimateListResponse.js | 38 +- src/model/EstimateResponse.js | 28 +- src/model/MetaIndexObject.js | 14 +- src/model/Order.js | 60 +- src/model/OrderListResponse.js | 38 +- src/model/OrderResponse.js | 28 +- src/model/Preference.js | 26 +- src/model/PreferenceListResponse.js | 38 +- src/model/PreferenceResponse.js | 28 +- src/model/Project.js | 64 +-- src/model/ProjectListResponse.js | 38 +- src/model/ProjectResponse.js | 28 +- test/integration/estimates.spec.js | 12 +- test/integration/orders.test.js | 26 +- test/integration/preferences.test.js | 31 +- test/integration/projects.test.js | 10 +- 55 files changed, 1807 insertions(+), 2095 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ab08845..4a3d982 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: ["10", "12", "14"] + node: ['10', '12', '14'] name: Node ${{ matrix.node }} Test steps: - name: Check out code diff --git a/.prettierrc.json b/.prettierrc.json index 0967ef4..32ebab4 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1 +1,4 @@ -{} +{ + "singleQuote": true, + "trailingComma": "none" +} diff --git a/README.md b/README.md index 49309ca..b265d15 100644 --- a/README.md +++ b/README.md @@ -35,11 +35,11 @@ After installing the package, you'll have to configure it with your API key whic ```javascript // ES6+ -import Patch from "@patch-technology/patch"; -const patch = Patch("key_test_1234"); +import Patch from '@patch-technology/patch'; +const patch = Patch('key_test_1234'); // ES5 -var patch = require("@patch-technology/patch")("key_test_1234"); +var patch = require('@patch-technology/patch')('key_test_1234'); ``` ### Orders @@ -86,7 +86,7 @@ const mass = 1000000; // Pass in the mass in grams (i.e. 1 metric tonne) patch.estimates.createMassEstimate({ mass_g: mass }); // Retrieve an estimate -const estimateId = "est_test_1234"; +const estimateId = 'est_test_1234'; patch.estimates.retrieveEstimate(estimate_id); // Retrieve a list of estimates @@ -104,7 +104,7 @@ Projects are the ways Patch takes CO2 out of the air. They can represent refores ```javascript // Retrieve a project -const project_id = "pro_test_1234"; // Pass in the project's ID +const project_id = 'pro_test_1234'; // Pass in the project's ID patch.projects.retrieveProject(project_id); // Retrieve a list of projects @@ -122,15 +122,15 @@ Preferences are how you route your orders in Patch. If you don't have a preferen ```javascript // Create a preference -const projectId = "pro_test_1234"; // Pass in the project_id for your preference +const projectId = 'pro_test_1234'; // Pass in the project_id for your preference patch.preferences.create_preference((project_id: projectId)); // Retrieve a preference -const preferenceId = "pre_test_1234"; // Pass in the preferences's id +const preferenceId = 'pre_test_1234'; // Pass in the preferences's id patch.preferences.retrieve_preference(preferenceId); // Delete a preference -const preferenceId = "pre_test_1234"; // Pass in the preferences's id +const preferenceId = 'pre_test_1234'; // Pass in the preferences's id patch.preferences.delete_preference(preferenceId); // Retrieve a list of preferences diff --git a/dist/ApiClient.js b/dist/ApiClient.js index d95a1ad..ef559bf 100644 --- a/dist/ApiClient.js +++ b/dist/ApiClient.js @@ -3,29 +3,25 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; +exports.default = void 0; var _superagent = _interopRequireDefault(require("superagent")); var _querystring = _interopRequireDefault(require("querystring")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var ApiClient = /*#__PURE__*/function () { - function ApiClient() { - _classCallCheck(this, ApiClient); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/** + * Patch API V1 + * The core API used to integrate with Patch's service + * + * Contact: developers@usepatch.com + */ +class ApiClient { + constructor() { this.basePath = 'https://api.usepatch.com'.replace(/\/+$/, ''); this.authentications = { - 'bearer_auth': { + bearer_auth: { type: 'bearer' } }; @@ -52,7 +48,7 @@ var ApiClient = /*#__PURE__*/function () { */ if (typeof window === 'undefined') { - this.agent = new _superagent["default"].agent(); + this.agent = new _superagent.default.agent(); } /* * Allow user to override superagent agent @@ -67,461 +63,423 @@ var ApiClient = /*#__PURE__*/function () { this.plugins = null; } - _createClass(ApiClient, [{ - key: "paramToString", - value: function paramToString(param) { - if (param == undefined || param == null) { - return ''; - } + paramToString(param) { + if (param == undefined || param == null) { + return ''; + } - if (param instanceof Date) { - return param.toJSON(); - } + if (param instanceof Date) { + return param.toJSON(); + } - return param.toString(); + return param.toString(); + } + + buildUrl(path, pathParams) { + if (!path.match(/^\//)) { + path = '/' + path; } - }, { - key: "buildUrl", - value: function buildUrl(path, pathParams) { - var _this = this; - 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; } - var url = this.basePath + path; - url = url.replace(/\{([\w-]+)\}/g, function (fullMatch, key) { - var value; + return encodeURIComponent(value); + }); + return url; + } - if (pathParams.hasOwnProperty(key)) { - value = _this.paramToString(pathParams[key]); - } else { - value = fullMatch; - } + isJsonMime(contentType) { + return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i)); + } - return encodeURIComponent(value); - }); - return url; - } - }, { - key: "isJsonMime", - value: function isJsonMime(contentType) { - return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i)); - } - }, { - key: "jsonPreferredMime", - value: function jsonPreferredMime(contentTypes) { - for (var i = 0; i < contentTypes.length; i++) { - if (this.isJsonMime(contentTypes[i])) { - return contentTypes[i]; - } + jsonPreferredMime(contentTypes) { + for (var i = 0; i < contentTypes.length; i++) { + if (this.isJsonMime(contentTypes[i])) { + return contentTypes[i]; } - - return contentTypes[0]; } - }, { - key: "isFileParam", - value: function isFileParam(param) { - // fs.ReadStream in Node.js and Electron (but not in runtime like browserify) - if (typeof require === 'function') { - var fs; - - try { - fs = require('fs'); - } catch (err) {} - - if (fs && fs.ReadStream && param instanceof fs.ReadStream) { - return true; - } - } // Buffer in Node.js + return contentTypes[0]; + } - if (typeof Buffer === 'function' && param instanceof Buffer) { - return true; - } // Blob in browser + isFileParam(param) { + // fs.ReadStream in Node.js and Electron (but not in runtime like browserify) + if (typeof require === 'function') { + let fs; + try { + fs = require('fs'); + } catch (err) {} - if (typeof Blob === 'function' && param instanceof Blob) { + if (fs && fs.ReadStream && param instanceof fs.ReadStream) { return true; - } // File in browser (it seems File object is also instance of Blob, but keep this for safe) + } + } // Buffer in Node.js - if (typeof File === 'function' && param instanceof File) { - return true; - } + if (typeof Buffer === 'function' && param instanceof Buffer) { + return true; + } // Blob in browser + + + if (typeof Blob === 'function' && param instanceof Blob) { + return true; + } // File in browser (it seems File object is also instance of Blob, but keep this for safe) - return false; + + if (typeof File === 'function' && param instanceof File) { + return true; } - }, { - key: "normalizeParams", - value: function normalizeParams(params) { - var newParams = {}; - for (var key in params) { - if (params.hasOwnProperty(key) && params[key] != undefined && params[key] != null) { - var value = params[key]; + return false; + } - if (this.isFileParam(value) || Array.isArray(value)) { - newParams[key] = value; - } else { - newParams[key] = this.paramToString(value); - } + normalizeParams(params) { + var newParams = {}; + + for (var key in params) { + if (params.hasOwnProperty(key) && params[key] != undefined && 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; + return newParams; + } + + buildCollectionParam(param, collectionFormat) { + if (param == null) { + return null; } - }, { - key: "buildCollectionParam", - value: function buildCollectionParam(param, collectionFormat) { - if (param == null) { - return null; - } - switch (collectionFormat) { - case 'csv': - return param.map(this.paramToString).join(','); + switch (collectionFormat) { + case 'csv': + return param.map(this.paramToString).join(','); - case 'ssv': - return param.map(this.paramToString).join(' '); + case 'ssv': + return param.map(this.paramToString).join(' '); - case 'tsv': - return param.map(this.paramToString).join('\t'); + case 'tsv': + return param.map(this.paramToString).join('\t'); - case 'pipes': - return param.map(this.paramToString).join('|'); + case 'pipes': + return param.map(this.paramToString).join('|'); - case 'multi': - //return the array directly as SuperAgent will handle it as expected - return param.map(this.paramToString); + case 'multi': + //return the array directly as SuperAgent will handle it as expected + return param.map(this.paramToString); - default: - throw new Error('Unknown collection format: ' + collectionFormat); - } + default: + throw new Error('Unknown collection format: ' + collectionFormat); } - }, { - key: "applyAuthToRequest", - value: function applyAuthToRequest(request, authNames) { - var _this2 = this; - - authNames.forEach(function (authName) { - var auth = _this2.authentications[authName]; - - switch (auth.type) { - case 'basic': - if (auth.username || auth.password) { - request.auth(auth.username || '', auth.password || ''); - } - - break; + } - case 'bearer': - if (auth.accessToken) { - request.set({ - 'Authorization': 'Bearer ' + auth.accessToken - }); - } + applyAuthToRequest(request, authNames) { + authNames.forEach(authName => { + var auth = this.authentications[authName]; - break; + switch (auth.type) { + case 'basic': + if (auth.username || auth.password) { + request.auth(auth.username || '', auth.password || ''); + } - case 'apiKey': - if (auth.apiKey) { - var data = {}; + break; - if (auth.apiKeyPrefix) { - data[auth.name] = auth.apiKeyPrefix + ' ' + auth.apiKey; - } else { - data[auth.name] = auth.apiKey; - } + case 'bearer': + if (auth.accessToken) { + request.set({ + Authorization: 'Bearer ' + auth.accessToken + }); + } - if (auth['in'] === 'header') { - request.set(data); - } else { - request.query(data); - } - } + break; - break; + case 'apiKey': + if (auth.apiKey) { + var data = {}; - case 'oauth2': - if (auth.accessToken) { - request.set({ - 'Authorization': 'Bearer ' + auth.accessToken - }); + if (auth.apiKeyPrefix) { + data[auth.name] = auth.apiKeyPrefix + ' ' + auth.apiKey; + } else { + data[auth.name] = auth.apiKey; } - break; + if (auth['in'] === 'header') { + request.set(data); + } else { + request.query(data); + } + } - default: - throw new Error('Unknown authentication type: ' + auth.type); - } - }); - } - }, { - key: "deserialize", - value: function deserialize(response, returnType) { - if (response == null || returnType == null || response.status == 204) { - return null; - } // Rely on SuperAgent for parsing response body. - // See http://visionmedia.github.io/superagent/#parsing-response-bodies + break; + case 'oauth2': + if (auth.accessToken) { + request.set({ + Authorization: 'Bearer ' + auth.accessToken + }); + } - var data = response.body; + break; - if (data == null || _typeof(data) === 'object' && typeof data.length === 'undefined' && !Object.keys(data).length) { - // SuperAgent does not always produce a body; use the unparsed response as a fallback - data = response.text; + default: + throw new Error('Unknown authentication type: ' + auth.type); } + }); + } + + deserialize(response, returnType) { + if (response == null || returnType == null || response.status == 204) { + return null; + } // Rely on SuperAgent for parsing response body. + // See http://visionmedia.github.io/superagent/#parsing-response-bodies + - return ApiClient.convertToType(data, returnType); + var data = response.body; + + if (data == null || typeof data === 'object' && typeof data.length === 'undefined' && !Object.keys(data).length) { + // SuperAgent does not always produce a body; use the unparsed response as a fallback + data = response.text; } - }, { - key: "callApi", - value: function callApi(path, httpMethod, pathParams, queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts, returnType) { - var _this3 = this; - - var url = this.buildUrl(path, pathParams); - var request = (0, _superagent["default"])(httpMethod, url); - - if (this.plugins !== null) { - for (var index in this.plugins) { - if (this.plugins.hasOwnProperty(index)) { - request.use(this.plugins[index]); - } - } - } // apply authentications + return ApiClient.convertToType(data, returnType); + } - this.applyAuthToRequest(request, authNames); // set query parameters + callApi(path, httpMethod, pathParams, queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts, returnType) { + var url = this.buildUrl(path, pathParams); + var request = (0, _superagent.default)(httpMethod, url); - if (httpMethod.toUpperCase() === 'GET' && this.cache === false) { - queryParams['_'] = new Date().getTime(); + if (this.plugins !== null) { + for (var index in this.plugins) { + if (this.plugins.hasOwnProperty(index)) { + request.use(this.plugins[index]); + } } + } // apply authentications - request.query(this.normalizeParams(queryParams)); // set header parameters - request.set(this.defaultHeaders).set(this.normalizeParams(headerParams)); // set requestAgent if it is set by user + this.applyAuthToRequest(request, authNames); // set query parameters - if (this.requestAgent) { - request.agent(this.requestAgent); - } // set request timeout + if (httpMethod.toUpperCase() === 'GET' && this.cache === false) { + queryParams['_'] = new Date().getTime(); + } + request.query(this.normalizeParams(queryParams)); // set header parameters - request.timeout(this.timeout); - var contentType = this.jsonPreferredMime(contentTypes); + request.set(this.defaultHeaders).set(this.normalizeParams(headerParams)); // set requestAgent if it is set by user - if (contentType) { - // Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746) - if (contentType != 'multipart/form-data') { - request.type(contentType); - } - } else if (!request.header['Content-Type']) { - request.type('application/json'); + if (this.requestAgent) { + request.agent(this.requestAgent); + } // set request timeout + + + request.timeout(this.timeout); + var contentType = this.jsonPreferredMime(contentTypes); + + if (contentType) { + // Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746) + 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(_querystring["default"].stringify(this.normalizeParams(formParams))); - } else if (contentType == 'multipart/form-data') { - var _formParams = this.normalizeParams(formParams); + if (contentType === 'application/x-www-form-urlencoded') { + request.send(_querystring.default.stringify(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])) { - // file field - request.attach(key, _formParams[key]); - } else { - request.field(key, _formParams[key]); - } + for (var key in _formParams) { + if (_formParams.hasOwnProperty(key)) { + if (this.isFileParam(_formParams[key])) { + // file field + request.attach(key, _formParams[key]); + } else { + request.field(key, _formParams[key]); } } - } else if (bodyParam !== null && bodyParam !== undefined) { - request.send(bodyParam); } + } else if (bodyParam !== null && bodyParam !== undefined) { + request.send(bodyParam); + } - var accept = this.jsonPreferredMime(accepts); + var accept = this.jsonPreferredMime(accepts); - if (accept) { - request.accept(accept); - } + if (accept) { + request.accept(accept); + } - if (returnType === 'Blob') { - request.responseType('blob'); - } else if (returnType === 'String') { - request.responseType('string'); - } // Attach previously saved cookies, if enabled + if (returnType === 'Blob') { + request.responseType('blob'); + } else if (returnType === 'String') { + request.responseType('string'); + } // Attach previously saved cookies, if enabled - if (this.enableCookies) { - if (typeof window === 'undefined') { - this.agent._attachCookies(request); - } else { - request.withCredentials(); - } + if (this.enableCookies) { + if (typeof window === 'undefined') { + this.agent._attachCookies(request); + } else { + request.withCredentials(); } - - return new Promise(function (resolve, reject) { - request.end(function (error, response) { - if (error) { - var err = {}; - err.status = response.status; - err.statusText = response.statusText; - err.body = response.body; - err.response = response; - err.error = error; - reject(err); - } else { - try { - var data = _this3.deserialize(response, returnType); - - if (_this3.enableCookies && typeof window === 'undefined') { - _this3.agent._saveCookies(response); - } - - resolve({ - data: data, - response: response - }); - } catch (err) { - reject(err); - } - } - }); - }); } - }, { - key: "hostSettings", - value: function hostSettings() { - return [{ - 'url': "https://api.usepatch.com", - 'description': "No description provided", - 'variables': { - defaultHost: { - 'description': "No description provided", - 'default_value': "api.usepatch.com", - 'enum_values': [] - } - } - }]; - } - }, { - key: "getBasePathFromSettings", - value: function getBasePathFromSettings(index) { - var variables = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var servers = this.hostSettings(); // check array index out of bound - - if (index < 0 || index >= servers.length) { - throw new Error("Invalid index " + index + " when selecting the host settings. Must be less than " + servers.length); - } - - var server = servers[index]; - var url = server['url']; // go through variable and assign a value - for (var variable_name in server['variables']) { - if (variable_name in variables) { - var variable = server['variables'][variable_name]; + return new Promise((resolve, reject) => { + request.end((error, response) => { + var data = this.deserialize(response, returnType); - if (!('enum_values' in variable) || variable['enum_values'].includes(variables[variable_name])) { - url = url.replace("{" + variable_name + "}", variables[variable_name]); - } else { - throw new Error("The variable `" + variable_name + "` in the host URL has invalid value " + variables[variable_name] + ". Must be " + server['variables'][variable_name]['enum_values'] + "."); - } + if (error) { + reject(data); } else { - // use default value - url = url.replace("{" + variable_name + "}", server['variables'][variable_name]['default_value']); + if (this.enableCookies && typeof window === 'undefined') { + this.agent._saveCookies(response); + } + + resolve(data); } - } + }); + }); + } - return url; - } - }], [{ - key: "parseDate", - value: function parseDate(str) { - return new Date(str); - } - }, { - key: "convertToType", - value: function convertToType(data, type) { - if (data === null || data === undefined) return data; + static parseDate(str) { + return new Date(str); + } - switch (type) { - case 'Boolean': - return Boolean(data); + static convertToType(data, type) { + if (data === null || data === undefined) return data; - case 'Integer': - return parseInt(data, 10); + switch (type) { + case 'Boolean': + return Boolean(data); - case 'Number': - return parseFloat(data); + case 'Integer': + return parseInt(data, 10); - case 'String': - return String(data); + case 'Number': + return parseFloat(data); - case 'Date': - return ApiClient.parseDate(String(data)); + case 'String': + return String(data); - case 'Blob': - return data; + case 'Date': + return ApiClient.parseDate(String(data)); - default: - if (type === Object) { - // generic object, return directly - return data; - } else if (typeof type.constructFromObject === 'function') { - // for model type like User and enum class - return type.constructFromObject(data); - } else if (Array.isArray(type)) { - // for array type like: ['String'] - var itemType = type[0]; - return data.map(function (item) { - return ApiClient.convertToType(item, itemType); - }); - } else if (_typeof(type) === 'object') { - // for plain object type like: {'String': 'Integer'} - var keyType, valueType; - - for (var k in type) { - if (type.hasOwnProperty(k)) { - keyType = k; - valueType = type[k]; - break; - } + case 'Blob': + return data; + + default: + if (type === Object) { + // generic object, return directly + return data; + } else if (typeof type.constructFromObject === 'function') { + // for model type like User and enum class + return type.constructFromObject(data); + } else if (Array.isArray(type)) { + // for array type like: ['String'] + var itemType = type[0]; + return data.map(item => { + return ApiClient.convertToType(item, itemType); + }); + } else if (typeof type === 'object') { + // for plain object type like: {'String': 'Integer'} + var keyType, valueType; + + for (var k in type) { + if (type.hasOwnProperty(k)) { + keyType = k; + valueType = type[k]; + break; } + } - var result = {}; + 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; - } + 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 { - // for unknown type, return the data directly - return data; } + return result; + } else { + // for unknown type, return the data directly + return data; + } + + } + } + + hostSettings() { + return [{ + url: 'https://api.usepatch.com', + description: 'No description provided', + variables: { + defaultHost: { + description: 'No description provided', + default_value: 'api.usepatch.com', + enum_values: [] + } } + }]; + } + + getBasePathFromSettings(index, variables = {}) { + var servers = this.hostSettings(); // check array index out of bound + + if (index < 0 || index >= servers.length) { + throw new Error('Invalid index ' + index + ' when selecting the host settings. Must be less than ' + servers.length); } - }, { - key: "constructFromObject", - value: function 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); + + var server = servers[index]; + var url = server['url']; // go through variable and assign a value + + for (var variable_name in server['variables']) { + if (variable_name in variables) { + let variable = server['variables'][variable_name]; + + if (!('enum_values' in variable) || variable['enum_values'].includes(variables[variable_name])) { + url = url.replace('{' + variable_name + '}', variables[variable_name]); + } else { + throw new Error('The variable `' + variable_name + '` in the host URL has invalid value ' + variables[variable_name] + '. Must be ' + server['variables'][variable_name]['enum_values'] + '.'); } } else { - for (var k in data) { - if (data.hasOwnProperty(k)) obj[k] = ApiClient.convertToType(data[k], itemType); - } + // use default value + url = url.replace('{' + variable_name + '}', server['variables'][variable_name]['default_value']); + } + } + + return url; + } + + 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); } } - }]); + } - return ApiClient; -}(); +} ApiClient.CollectionFormatEnum = { CSV: ',', @@ -532,4 +490,4 @@ ApiClient.CollectionFormatEnum = { }; ApiClient.instance = new ApiClient(); var _default = ApiClient; -exports["default"] = _default; \ No newline at end of file +exports.default = _default; \ No newline at end of file diff --git a/dist/api/EstimatesApi.js b/dist/api/EstimatesApi.js index 634af55..21b37a5 100644 --- a/dist/api/EstimatesApi.js +++ b/dist/api/EstimatesApi.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; +exports.default = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); @@ -15,19 +15,17 @@ var _EstimateListResponse = _interopRequireDefault(require("../model/EstimateLis var _EstimateResponse = _interopRequireDefault(require("../model/EstimateResponse")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var EstimatesApi = /*#__PURE__*/function () { - function EstimatesApi(apiClient) { - _classCallCheck(this, EstimatesApi); - - this.apiClient = apiClient || _ApiClient["default"].instance; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Patch API V1 + * The core API used to integrate with Patch's service + * + * Contact: developers@usepatch.com + */ +class EstimatesApi { + constructor(apiClient) { + this.apiClient = apiClient || _ApiClient.default.instance; this.createMassEstimate = this.createMassEstimate.bind(this); this.createMassEstimateWithHttpInfo = this.createMassEstimateWithHttpInfo.bind(this); this.retrieveEstimate = this.retrieveEstimate.bind(this); @@ -36,87 +34,72 @@ var EstimatesApi = /*#__PURE__*/function () { this.retrieveEstimatesWithHttpInfo = this.retrieveEstimatesWithHttpInfo.bind(this); } - _createClass(EstimatesApi, [{ - key: "createMassEstimateWithHttpInfo", - value: function createMassEstimateWithHttpInfo(createMassEstimateRequest) { - var postBody = createMassEstimateRequest; // verify the required parameter 'createMassEstimateRequest' is set - - if (createMassEstimateRequest === undefined || createMassEstimateRequest === null) { - throw new Error("Missing the required parameter 'createMassEstimateRequest' when calling createMassEstimate"); - } - - var pathParams = {}; - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - var authNames = ['bearer_auth']; - var contentTypes = ['application/json']; - var accepts = ['application/json']; - var returnType = _EstimateResponse["default"]; - return this.apiClient.callApi('/v1/estimates/mass', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); - } - }, { - key: "createMassEstimate", - value: function createMassEstimate(createMassEstimateRequest) { - return this.createMassEstimateWithHttpInfo(createMassEstimateRequest).then(function (response_and_data) { - return response_and_data.data; - }); - } - }, { - key: "retrieveEstimateWithHttpInfo", - value: function retrieveEstimateWithHttpInfo(id) { - var postBody = null; // verify the required parameter 'id' is set - - if (id === undefined || id === null) { - throw new Error("Missing the required parameter 'id' when calling retrieveEstimate"); - } - - var pathParams = { - 'id': id - }; - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - var authNames = ['bearer_auth']; - var contentTypes = []; - var accepts = ['application/json']; - var returnType = _EstimateResponse["default"]; - return this.apiClient.callApi('/v1/estimates/{id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); - } - }, { - key: "retrieveEstimate", - value: function retrieveEstimate(id) { - return this.retrieveEstimateWithHttpInfo(id).then(function (response_and_data) { - return response_and_data.data; - }); - } - }, { - key: "retrieveEstimatesWithHttpInfo", - value: function retrieveEstimatesWithHttpInfo(opts) { - opts = opts || {}; - var postBody = null; - var pathParams = {}; - var queryParams = { - 'page': opts['page'] - }; - var headerParams = {}; - var formParams = {}; - var authNames = ['bearer_auth']; - var contentTypes = []; - var accepts = ['application/json']; - var returnType = _EstimateListResponse["default"]; - return this.apiClient.callApi('/v1/estimates', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); + createMassEstimateWithHttpInfo(createMassEstimateRequest) { + let postBody = createMassEstimateRequest; // verify the required parameter 'createMassEstimateRequest' is set + + if (createMassEstimateRequest === undefined || createMassEstimateRequest === null) { + throw new Error("Missing the required parameter 'createMassEstimateRequest' when calling createMassEstimate"); } - }, { - key: "retrieveEstimates", - value: function retrieveEstimates(opts) { - return this.retrieveEstimatesWithHttpInfo(opts).then(function (response_and_data) { - return response_and_data.data; - }); + + let pathParams = {}; + let queryParams = {}; + let headerParams = {}; + let formParams = {}; + let authNames = ['bearer_auth']; + let contentTypes = ['application/json']; + let accepts = ['application/json']; + let returnType = _EstimateResponse.default; + return this.apiClient.callApi('/v1/estimates/mass', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); + } + + createMassEstimate(createMassEstimateRequest) { + return this.createMassEstimateWithHttpInfo(createMassEstimateRequest); + } + + retrieveEstimateWithHttpInfo(id) { + let postBody = null; // verify the required parameter 'id' is set + + if (id === undefined || id === null) { + throw new Error("Missing the required parameter 'id' when calling retrieveEstimate"); } - }]); - return EstimatesApi; -}(); + let pathParams = { + id: id + }; + let queryParams = {}; + let headerParams = {}; + let formParams = {}; + let authNames = ['bearer_auth']; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = _EstimateResponse.default; + return this.apiClient.callApi('/v1/estimates/{id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); + } + + retrieveEstimate(id) { + return this.retrieveEstimateWithHttpInfo(id); + } + + retrieveEstimatesWithHttpInfo(opts) { + opts = opts || {}; + let postBody = null; + let pathParams = {}; + let queryParams = { + page: opts['page'] + }; + let headerParams = {}; + let formParams = {}; + let authNames = ['bearer_auth']; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = _EstimateListResponse.default; + return this.apiClient.callApi('/v1/estimates', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); + } + + retrieveEstimates(opts) { + return this.retrieveEstimatesWithHttpInfo(opts); + } + +} -exports["default"] = EstimatesApi; \ No newline at end of file +exports.default = EstimatesApi; \ No newline at end of file diff --git a/dist/api/OrdersApi.js b/dist/api/OrdersApi.js index 596d13e..aeb1a21 100644 --- a/dist/api/OrdersApi.js +++ b/dist/api/OrdersApi.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; +exports.default = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); @@ -15,19 +15,17 @@ var _OrderListResponse = _interopRequireDefault(require("../model/OrderListRespo var _OrderResponse = _interopRequireDefault(require("../model/OrderResponse")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var OrdersApi = /*#__PURE__*/function () { - function OrdersApi(apiClient) { - _classCallCheck(this, OrdersApi); - - this.apiClient = apiClient || _ApiClient["default"].instance; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Patch API V1 + * The core API used to integrate with Patch's service + * + * Contact: developers@usepatch.com + */ +class OrdersApi { + constructor(apiClient) { + this.apiClient = apiClient || _ApiClient.default.instance; this.cancelOrder = this.cancelOrder.bind(this); this.cancelOrderWithHttpInfo = this.cancelOrderWithHttpInfo.bind(this); this.createOrder = this.createOrder.bind(this); @@ -40,143 +38,120 @@ var OrdersApi = /*#__PURE__*/function () { this.retrieveOrdersWithHttpInfo = this.retrieveOrdersWithHttpInfo.bind(this); } - _createClass(OrdersApi, [{ - key: "cancelOrderWithHttpInfo", - value: function cancelOrderWithHttpInfo(id) { - var postBody = null; // verify the required parameter 'id' is set - - if (id === undefined || id === null) { - throw new Error("Missing the required parameter 'id' when calling cancelOrder"); - } - - var pathParams = { - 'id': id - }; - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - var authNames = ['bearer_auth']; - var contentTypes = []; - var accepts = ['application/json']; - var returnType = _OrderResponse["default"]; - return this.apiClient.callApi('/v1/orders/{id}/cancel', 'PATCH', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); - } - }, { - key: "cancelOrder", - value: function cancelOrder(id) { - return this.cancelOrderWithHttpInfo(id).then(function (response_and_data) { - return response_and_data.data; - }); - } - }, { - key: "createOrderWithHttpInfo", - value: function createOrderWithHttpInfo(createOrderRequest) { - var postBody = createOrderRequest; // verify the required parameter 'createOrderRequest' is set - - if (createOrderRequest === undefined || createOrderRequest === null) { - throw new Error("Missing the required parameter 'createOrderRequest' when calling createOrder"); - } - - var pathParams = {}; - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - var authNames = ['bearer_auth']; - var contentTypes = ['application/json']; - var accepts = ['application/json']; - var returnType = _OrderResponse["default"]; - return this.apiClient.callApi('/v1/orders', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); - } - }, { - key: "createOrder", - value: function createOrder(createOrderRequest) { - return this.createOrderWithHttpInfo(createOrderRequest).then(function (response_and_data) { - return response_and_data.data; - }); - } - }, { - key: "placeOrderWithHttpInfo", - value: function placeOrderWithHttpInfo(id) { - var postBody = null; // verify the required parameter 'id' is set - - if (id === undefined || id === null) { - throw new Error("Missing the required parameter 'id' when calling placeOrder"); - } - - var pathParams = { - 'id': id - }; - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - var authNames = ['bearer_auth']; - var contentTypes = []; - var accepts = ['application/json']; - var returnType = _OrderResponse["default"]; - return this.apiClient.callApi('/v1/orders/{id}/place', 'PATCH', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); - } - }, { - key: "placeOrder", - value: function placeOrder(id) { - return this.placeOrderWithHttpInfo(id).then(function (response_and_data) { - return response_and_data.data; - }); - } - }, { - key: "retrieveOrderWithHttpInfo", - value: function retrieveOrderWithHttpInfo(id) { - var postBody = null; // verify the required parameter 'id' is set - - if (id === undefined || id === null) { - throw new Error("Missing the required parameter 'id' when calling retrieveOrder"); - } - - var pathParams = { - 'id': id - }; - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - var authNames = ['bearer_auth']; - var contentTypes = []; - var accepts = ['application/json']; - var returnType = _OrderResponse["default"]; - return this.apiClient.callApi('/v1/orders/{id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); + cancelOrderWithHttpInfo(id) { + let postBody = null; // verify the required parameter 'id' is set + + if (id === undefined || id === null) { + throw new Error("Missing the required parameter 'id' when calling cancelOrder"); } - }, { - key: "retrieveOrder", - value: function retrieveOrder(id) { - return this.retrieveOrderWithHttpInfo(id).then(function (response_and_data) { - return response_and_data.data; - }); + + let pathParams = { + id: id + }; + let queryParams = {}; + let headerParams = {}; + let formParams = {}; + let authNames = ['bearer_auth']; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = _OrderResponse.default; + return this.apiClient.callApi('/v1/orders/{id}/cancel', 'PATCH', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); + } + + cancelOrder(id) { + return this.cancelOrderWithHttpInfo(id); + } + + createOrderWithHttpInfo(createOrderRequest) { + let postBody = createOrderRequest; // verify the required parameter 'createOrderRequest' is set + + if (createOrderRequest === undefined || createOrderRequest === null) { + throw new Error("Missing the required parameter 'createOrderRequest' when calling createOrder"); } - }, { - key: "retrieveOrdersWithHttpInfo", - value: function retrieveOrdersWithHttpInfo(opts) { - opts = opts || {}; - var postBody = null; - var pathParams = {}; - var queryParams = { - 'page': opts['page'] - }; - var headerParams = {}; - var formParams = {}; - var authNames = ['bearer_auth']; - var contentTypes = []; - var accepts = ['application/json']; - var returnType = _OrderListResponse["default"]; - return this.apiClient.callApi('/v1/orders', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); + + let pathParams = {}; + let queryParams = {}; + let headerParams = {}; + let formParams = {}; + let authNames = ['bearer_auth']; + let contentTypes = ['application/json']; + let accepts = ['application/json']; + let returnType = _OrderResponse.default; + return this.apiClient.callApi('/v1/orders', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); + } + + createOrder(createOrderRequest) { + return this.createOrderWithHttpInfo(createOrderRequest); + } + + placeOrderWithHttpInfo(id) { + let postBody = null; // verify the required parameter 'id' is set + + if (id === undefined || id === null) { + throw new Error("Missing the required parameter 'id' when calling placeOrder"); } - }, { - key: "retrieveOrders", - value: function retrieveOrders(opts) { - return this.retrieveOrdersWithHttpInfo(opts).then(function (response_and_data) { - return response_and_data.data; - }); + + let pathParams = { + id: id + }; + let queryParams = {}; + let headerParams = {}; + let formParams = {}; + let authNames = ['bearer_auth']; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = _OrderResponse.default; + return this.apiClient.callApi('/v1/orders/{id}/place', 'PATCH', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); + } + + placeOrder(id) { + return this.placeOrderWithHttpInfo(id); + } + + retrieveOrderWithHttpInfo(id) { + let postBody = null; // verify the required parameter 'id' is set + + if (id === undefined || id === null) { + throw new Error("Missing the required parameter 'id' when calling retrieveOrder"); } - }]); - return OrdersApi; -}(); + let pathParams = { + id: id + }; + let queryParams = {}; + let headerParams = {}; + let formParams = {}; + let authNames = ['bearer_auth']; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = _OrderResponse.default; + return this.apiClient.callApi('/v1/orders/{id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); + } + + retrieveOrder(id) { + return this.retrieveOrderWithHttpInfo(id); + } + + retrieveOrdersWithHttpInfo(opts) { + opts = opts || {}; + let postBody = null; + let pathParams = {}; + let queryParams = { + page: opts['page'] + }; + let headerParams = {}; + let formParams = {}; + let authNames = ['bearer_auth']; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = _OrderListResponse.default; + return this.apiClient.callApi('/v1/orders', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); + } + + retrieveOrders(opts) { + return this.retrieveOrdersWithHttpInfo(opts); + } + +} -exports["default"] = OrdersApi; \ No newline at end of file +exports.default = OrdersApi; \ No newline at end of file diff --git a/dist/api/PreferencesApi.js b/dist/api/PreferencesApi.js index d582ea2..58365b9 100644 --- a/dist/api/PreferencesApi.js +++ b/dist/api/PreferencesApi.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; +exports.default = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); @@ -15,19 +15,17 @@ var _PreferenceListResponse = _interopRequireDefault(require("../model/Preferenc var _PreferenceResponse = _interopRequireDefault(require("../model/PreferenceResponse")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var PreferencesApi = /*#__PURE__*/function () { - function PreferencesApi(apiClient) { - _classCallCheck(this, PreferencesApi); - - this.apiClient = apiClient || _ApiClient["default"].instance; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Patch API V1 + * The core API used to integrate with Patch's service + * + * Contact: developers@usepatch.com + */ +class PreferencesApi { + constructor(apiClient) { + this.apiClient = apiClient || _ApiClient.default.instance; this.createPreference = this.createPreference.bind(this); this.createPreferenceWithHttpInfo = this.createPreferenceWithHttpInfo.bind(this); this.deletePreference = this.deletePreference.bind(this); @@ -38,115 +36,96 @@ var PreferencesApi = /*#__PURE__*/function () { this.retrievePreferencesWithHttpInfo = this.retrievePreferencesWithHttpInfo.bind(this); } - _createClass(PreferencesApi, [{ - key: "createPreferenceWithHttpInfo", - value: function createPreferenceWithHttpInfo(createPreferenceRequest) { - var postBody = createPreferenceRequest; // verify the required parameter 'createPreferenceRequest' is set - - if (createPreferenceRequest === undefined || createPreferenceRequest === null) { - throw new Error("Missing the required parameter 'createPreferenceRequest' when calling createPreference"); - } - - var pathParams = {}; - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - var authNames = ['bearer_auth']; - var contentTypes = ['application/json']; - var accepts = ['application/json']; - var returnType = _PreferenceResponse["default"]; - return this.apiClient.callApi('/v1/preferences', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); - } - }, { - key: "createPreference", - value: function createPreference(createPreferenceRequest) { - return this.createPreferenceWithHttpInfo(createPreferenceRequest).then(function (response_and_data) { - return response_and_data.data; - }); - } - }, { - key: "deletePreferenceWithHttpInfo", - value: function deletePreferenceWithHttpInfo(id) { - var postBody = null; // verify the required parameter 'id' is set - - if (id === undefined || id === null) { - throw new Error("Missing the required parameter 'id' when calling deletePreference"); - } - - var pathParams = { - 'id': id - }; - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - var authNames = ['bearer_auth']; - var contentTypes = []; - var accepts = ['application/json']; - var returnType = _PreferenceResponse["default"]; - return this.apiClient.callApi('/v1/preferences/{id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); - } - }, { - key: "deletePreference", - value: function deletePreference(id) { - return this.deletePreferenceWithHttpInfo(id).then(function (response_and_data) { - return response_and_data.data; - }); - } - }, { - key: "retrievePreferenceWithHttpInfo", - value: function retrievePreferenceWithHttpInfo(id) { - var postBody = null; // verify the required parameter 'id' is set - - if (id === undefined || id === null) { - throw new Error("Missing the required parameter 'id' when calling retrievePreference"); - } - - var pathParams = { - 'id': id - }; - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - var authNames = ['bearer_auth']; - var contentTypes = []; - var accepts = ['application/json']; - var returnType = _PreferenceResponse["default"]; - return this.apiClient.callApi('/v1/preferences/{id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); - } - }, { - key: "retrievePreference", - value: function retrievePreference(id) { - return this.retrievePreferenceWithHttpInfo(id).then(function (response_and_data) { - return response_and_data.data; - }); + createPreferenceWithHttpInfo(createPreferenceRequest) { + let postBody = createPreferenceRequest; // verify the required parameter 'createPreferenceRequest' is set + + if (createPreferenceRequest === undefined || createPreferenceRequest === null) { + throw new Error("Missing the required parameter 'createPreferenceRequest' when calling createPreference"); } - }, { - key: "retrievePreferencesWithHttpInfo", - value: function retrievePreferencesWithHttpInfo(opts) { - opts = opts || {}; - var postBody = null; - var pathParams = {}; - var queryParams = { - 'page': opts['page'] - }; - var headerParams = {}; - var formParams = {}; - var authNames = ['bearer_auth']; - var contentTypes = []; - var accepts = ['application/json']; - var returnType = _PreferenceListResponse["default"]; - return this.apiClient.callApi('/v1/preferences', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); + + let pathParams = {}; + let queryParams = {}; + let headerParams = {}; + let formParams = {}; + let authNames = ['bearer_auth']; + let contentTypes = ['application/json']; + let accepts = ['application/json']; + let returnType = _PreferenceResponse.default; + return this.apiClient.callApi('/v1/preferences', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); + } + + createPreference(createPreferenceRequest) { + return this.createPreferenceWithHttpInfo(createPreferenceRequest); + } + + deletePreferenceWithHttpInfo(id) { + let postBody = null; // verify the required parameter 'id' is set + + if (id === undefined || id === null) { + throw new Error("Missing the required parameter 'id' when calling deletePreference"); } - }, { - key: "retrievePreferences", - value: function retrievePreferences(opts) { - return this.retrievePreferencesWithHttpInfo(opts).then(function (response_and_data) { - return response_and_data.data; - }); + + let pathParams = { + id: id + }; + let queryParams = {}; + let headerParams = {}; + let formParams = {}; + let authNames = ['bearer_auth']; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = _PreferenceResponse.default; + return this.apiClient.callApi('/v1/preferences/{id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); + } + + deletePreference(id) { + return this.deletePreferenceWithHttpInfo(id); + } + + retrievePreferenceWithHttpInfo(id) { + let postBody = null; // verify the required parameter 'id' is set + + if (id === undefined || id === null) { + throw new Error("Missing the required parameter 'id' when calling retrievePreference"); } - }]); - return PreferencesApi; -}(); + let pathParams = { + id: id + }; + let queryParams = {}; + let headerParams = {}; + let formParams = {}; + let authNames = ['bearer_auth']; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = _PreferenceResponse.default; + return this.apiClient.callApi('/v1/preferences/{id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); + } + + retrievePreference(id) { + return this.retrievePreferenceWithHttpInfo(id); + } + + retrievePreferencesWithHttpInfo(opts) { + opts = opts || {}; + let postBody = null; + let pathParams = {}; + let queryParams = { + page: opts['page'] + }; + let headerParams = {}; + let formParams = {}; + let authNames = ['bearer_auth']; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = _PreferenceListResponse.default; + return this.apiClient.callApi('/v1/preferences', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); + } + + retrievePreferences(opts) { + return this.retrievePreferencesWithHttpInfo(opts); + } + +} -exports["default"] = PreferencesApi; \ No newline at end of file +exports.default = PreferencesApi; \ No newline at end of file diff --git a/dist/api/ProjectsApi.js b/dist/api/ProjectsApi.js index fdafaec..bd96e27 100644 --- a/dist/api/ProjectsApi.js +++ b/dist/api/ProjectsApi.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; +exports.default = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); @@ -13,80 +13,67 @@ var _ProjectListResponse = _interopRequireDefault(require("../model/ProjectListR var _ProjectResponse = _interopRequireDefault(require("../model/ProjectResponse")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var ProjectsApi = /*#__PURE__*/function () { - function ProjectsApi(apiClient) { - _classCallCheck(this, ProjectsApi); - - this.apiClient = apiClient || _ApiClient["default"].instance; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Patch API V1 + * The core API used to integrate with Patch's service + * + * Contact: developers@usepatch.com + */ +class ProjectsApi { + constructor(apiClient) { + this.apiClient = apiClient || _ApiClient.default.instance; this.retrieveProject = this.retrieveProject.bind(this); this.retrieveProjectWithHttpInfo = this.retrieveProjectWithHttpInfo.bind(this); this.retrieveProjects = this.retrieveProjects.bind(this); this.retrieveProjectsWithHttpInfo = this.retrieveProjectsWithHttpInfo.bind(this); } - _createClass(ProjectsApi, [{ - key: "retrieveProjectWithHttpInfo", - value: function retrieveProjectWithHttpInfo(id) { - var postBody = null; // verify the required parameter 'id' is set + retrieveProjectWithHttpInfo(id) { + let postBody = null; // verify the required parameter 'id' is set - if (id === undefined || id === null) { - throw new Error("Missing the required parameter 'id' when calling retrieveProject"); - } - - var pathParams = { - 'id': id - }; - var queryParams = {}; - var headerParams = {}; - var formParams = {}; - var authNames = ['bearer_auth']; - var contentTypes = []; - var accepts = ['application/json']; - var returnType = _ProjectResponse["default"]; - return this.apiClient.callApi('/v1/projects/{id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); - } - }, { - key: "retrieveProject", - value: function retrieveProject(id) { - return this.retrieveProjectWithHttpInfo(id).then(function (response_and_data) { - return response_and_data.data; - }); - } - }, { - key: "retrieveProjectsWithHttpInfo", - value: function retrieveProjectsWithHttpInfo(opts) { - opts = opts || {}; - var postBody = null; - var pathParams = {}; - var queryParams = { - 'page': opts['page'] - }; - var headerParams = {}; - var formParams = {}; - var authNames = ['bearer_auth']; - var contentTypes = []; - var accepts = ['application/json']; - var returnType = _ProjectListResponse["default"]; - return this.apiClient.callApi('/v1/projects', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); - } - }, { - key: "retrieveProjects", - value: function retrieveProjects(opts) { - return this.retrieveProjectsWithHttpInfo(opts).then(function (response_and_data) { - return response_and_data.data; - }); + if (id === undefined || id === null) { + throw new Error("Missing the required parameter 'id' when calling retrieveProject"); } - }]); - return ProjectsApi; -}(); + let pathParams = { + id: id + }; + let queryParams = {}; + let headerParams = {}; + let formParams = {}; + let authNames = ['bearer_auth']; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = _ProjectResponse.default; + return this.apiClient.callApi('/v1/projects/{id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); + } + + retrieveProject(id) { + return this.retrieveProjectWithHttpInfo(id); + } + + retrieveProjectsWithHttpInfo(opts) { + opts = opts || {}; + let postBody = null; + let pathParams = {}; + let queryParams = { + page: opts['page'] + }; + let headerParams = {}; + let formParams = {}; + let authNames = ['bearer_auth']; + let contentTypes = []; + let accepts = ['application/json']; + let returnType = _ProjectListResponse.default; + return this.apiClient.callApi('/v1/projects', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType); + } + + retrieveProjects(opts) { + return this.retrieveProjectsWithHttpInfo(opts); + } + +} -exports["default"] = ProjectsApi; \ No newline at end of file +exports.default = ProjectsApi; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index 3c072d1..ff86ce1 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = Patch; +exports.default = Patch; var _ApiClient = _interopRequireDefault(require("./ApiClient")); @@ -15,7 +15,7 @@ var _PreferencesApi = _interopRequireDefault(require("./api/PreferencesApi")); var _ProjectsApi = _interopRequireDefault(require("./api/ProjectsApi")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Patch API V1 @@ -25,10 +25,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d */ function Patch(accessToken) { if (!(this instanceof Patch)) return new Patch(accessToken); - this.client = _ApiClient["default"].instance; + this.client = _ApiClient.default.instance; this.client.authentications['bearer_auth'].accessToken = accessToken; - this.estimates = new _EstimatesApi["default"](this.client); - this.orders = new _OrdersApi["default"](this.client); - this.preferences = new _PreferencesApi["default"](this.client); - this.projects = new _ProjectsApi["default"](this.client); + this.estimates = new _EstimatesApi.default(this.client); + this.orders = new _OrdersApi.default(this.client); + this.preferences = new _PreferencesApi.default(this.client); + this.projects = new _ProjectsApi.default(this.client); } \ No newline at end of file diff --git a/dist/model/Allocation.js b/dist/model/Allocation.js index 35ef28e..fea4642 100644 --- a/dist/model/Allocation.js +++ b/dist/model/Allocation.js @@ -3,56 +3,49 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; +exports.default = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } +/** + * Patch API V1 + * The core API used to integrate with Patch's service + * + * Contact: developers@usepatch.com + */ +class Allocation { + constructor() { + Allocation.initialize(this); + } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + static initialize(obj) {} -var Allocation = /*#__PURE__*/function () { - function Allocation() { - _classCallCheck(this, Allocation); + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Allocation(); - Allocation.initialize(this); - } + if (data.hasOwnProperty('id')) { + obj['id'] = _ApiClient.default.convertToType(data['id'], 'String'); + } - _createClass(Allocation, null, [{ - key: "initialize", - value: function initialize(obj) {} - }, { - key: "constructFromObject", - value: function constructFromObject(data, obj) { - if (data) { - obj = obj || new Allocation(); - - if (data.hasOwnProperty('id')) { - obj['id'] = _ApiClient["default"].convertToType(data['id'], 'String'); - } - - if (data.hasOwnProperty('production')) { - obj['production'] = _ApiClient["default"].convertToType(data['production'], 'Boolean'); - } - - if (data.hasOwnProperty('mass_g')) { - obj['mass_g'] = _ApiClient["default"].convertToType(data['mass_g'], 'Number'); - } + if (data.hasOwnProperty('production')) { + obj['production'] = _ApiClient.default.convertToType(data['production'], 'Boolean'); } - return obj; + if (data.hasOwnProperty('mass_g')) { + obj['mass_g'] = _ApiClient.default.convertToType(data['mass_g'], 'Number'); + } } - }]); - return Allocation; -}(); + return obj; + } + +} Allocation.prototype['id'] = undefined; Allocation.prototype['production'] = undefined; Allocation.prototype['mass_g'] = undefined; var _default = Allocation; -exports["default"] = _default; \ No newline at end of file +exports.default = _default; \ No newline at end of file diff --git a/dist/model/CreateMassEstimateRequest.js b/dist/model/CreateMassEstimateRequest.js index f5f18be..39acbb9 100644 --- a/dist/model/CreateMassEstimateRequest.js +++ b/dist/model/CreateMassEstimateRequest.js @@ -3,48 +3,41 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; +exports.default = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var CreateMassEstimateRequest = /*#__PURE__*/function () { - function CreateMassEstimateRequest(massG) { - _classCallCheck(this, CreateMassEstimateRequest); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/** + * Patch API V1 + * The core API used to integrate with Patch's service + * + * Contact: developers@usepatch.com + */ +class CreateMassEstimateRequest { + constructor(massG) { CreateMassEstimateRequest.initialize(this, massG); } - _createClass(CreateMassEstimateRequest, null, [{ - key: "initialize", - value: function initialize(obj, massG) { - obj['mass_g'] = massG; - } - }, { - key: "constructFromObject", - value: function constructFromObject(data, obj) { - if (data) { - obj = obj || new CreateMassEstimateRequest(); - - if (data.hasOwnProperty('mass_g')) { - obj['mass_g'] = _ApiClient["default"].convertToType(data['mass_g'], 'Number'); - } - } + static initialize(obj, massG) { + obj['mass_g'] = massG; + } + + static constructFromObject(data, obj) { + if (data) { + obj = obj || new CreateMassEstimateRequest(); - return obj; + if (data.hasOwnProperty('mass_g')) { + obj['mass_g'] = _ApiClient.default.convertToType(data['mass_g'], 'Number'); + } } - }]); - return CreateMassEstimateRequest; -}(); + return obj; + } + +} CreateMassEstimateRequest.prototype['mass_g'] = undefined; var _default = CreateMassEstimateRequest; -exports["default"] = _default; \ No newline at end of file +exports.default = _default; \ No newline at end of file diff --git a/dist/model/CreateOrderRequest.js b/dist/model/CreateOrderRequest.js index 363b2e8..af45f22 100644 --- a/dist/model/CreateOrderRequest.js +++ b/dist/model/CreateOrderRequest.js @@ -3,48 +3,41 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; +exports.default = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var CreateOrderRequest = /*#__PURE__*/function () { - function CreateOrderRequest(massG) { - _classCallCheck(this, CreateOrderRequest); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/** + * Patch API V1 + * The core API used to integrate with Patch's service + * + * Contact: developers@usepatch.com + */ +class CreateOrderRequest { + constructor(massG) { CreateOrderRequest.initialize(this, massG); } - _createClass(CreateOrderRequest, null, [{ - key: "initialize", - value: function initialize(obj, massG) { - obj['mass_g'] = massG; - } - }, { - key: "constructFromObject", - value: function constructFromObject(data, obj) { - if (data) { - obj = obj || new CreateOrderRequest(); - - if (data.hasOwnProperty('mass_g')) { - obj['mass_g'] = _ApiClient["default"].convertToType(data['mass_g'], 'Number'); - } - } + static initialize(obj, massG) { + obj['mass_g'] = massG; + } + + static constructFromObject(data, obj) { + if (data) { + obj = obj || new CreateOrderRequest(); - return obj; + if (data.hasOwnProperty('mass_g')) { + obj['mass_g'] = _ApiClient.default.convertToType(data['mass_g'], 'Number'); + } } - }]); - return CreateOrderRequest; -}(); + return obj; + } + +} CreateOrderRequest.prototype['mass_g'] = undefined; var _default = CreateOrderRequest; -exports["default"] = _default; \ No newline at end of file +exports.default = _default; \ No newline at end of file diff --git a/dist/model/CreatePreferenceRequest.js b/dist/model/CreatePreferenceRequest.js index 33d5447..5bfa0a6 100644 --- a/dist/model/CreatePreferenceRequest.js +++ b/dist/model/CreatePreferenceRequest.js @@ -3,48 +3,41 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; +exports.default = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var CreatePreferenceRequest = /*#__PURE__*/function () { - function CreatePreferenceRequest(projectId) { - _classCallCheck(this, CreatePreferenceRequest); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/** + * Patch API V1 + * The core API used to integrate with Patch's service + * + * Contact: developers@usepatch.com + */ +class CreatePreferenceRequest { + constructor(projectId) { CreatePreferenceRequest.initialize(this, projectId); } - _createClass(CreatePreferenceRequest, null, [{ - key: "initialize", - value: function initialize(obj, projectId) { - obj['project_id'] = projectId; - } - }, { - key: "constructFromObject", - value: function constructFromObject(data, obj) { - if (data) { - obj = obj || new CreatePreferenceRequest(); - - if (data.hasOwnProperty('project_id')) { - obj['project_id'] = _ApiClient["default"].convertToType(data['project_id'], 'String'); - } - } + static initialize(obj, projectId) { + obj['project_id'] = projectId; + } + + static constructFromObject(data, obj) { + if (data) { + obj = obj || new CreatePreferenceRequest(); - return obj; + if (data.hasOwnProperty('project_id')) { + obj['project_id'] = _ApiClient.default.convertToType(data['project_id'], 'String'); + } } - }]); - return CreatePreferenceRequest; -}(); + return obj; + } + +} CreatePreferenceRequest.prototype['project_id'] = undefined; var _default = CreatePreferenceRequest; -exports["default"] = _default; \ No newline at end of file +exports.default = _default; \ No newline at end of file diff --git a/dist/model/ErrorResponse.js b/dist/model/ErrorResponse.js index bd46090..844471b 100644 --- a/dist/model/ErrorResponse.js +++ b/dist/model/ErrorResponse.js @@ -3,60 +3,53 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; +exports.default = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } +/** + * Patch API V1 + * The core API used to integrate with Patch's service + * + * Contact: developers@usepatch.com + */ +class ErrorResponse { + constructor(success, error, data) { + ErrorResponse.initialize(this, success, error, data); + } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + static initialize(obj, success, error, data) { + obj['success'] = success; + obj['error'] = error; + obj['data'] = data; + } -var ErrorResponse = /*#__PURE__*/function () { - function ErrorResponse(success, error, data) { - _classCallCheck(this, ErrorResponse); + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ErrorResponse(); - ErrorResponse.initialize(this, success, error, data); - } + if (data.hasOwnProperty('success')) { + obj['success'] = _ApiClient.default.convertToType(data['success'], 'Boolean'); + } - _createClass(ErrorResponse, null, [{ - key: "initialize", - value: function initialize(obj, success, error, data) { - obj['success'] = success; - obj['error'] = error; - obj['data'] = data; - } - }, { - key: "constructFromObject", - value: function constructFromObject(data, obj) { - if (data) { - obj = obj || new ErrorResponse(); - - if (data.hasOwnProperty('success')) { - obj['success'] = _ApiClient["default"].convertToType(data['success'], 'Boolean'); - } - - if (data.hasOwnProperty('error')) { - obj['error'] = _ApiClient["default"].convertToType(data['error'], Object); - } - - if (data.hasOwnProperty('data')) { - obj['data'] = _ApiClient["default"].convertToType(data['data'], Object); - } + if (data.hasOwnProperty('error')) { + obj['error'] = _ApiClient.default.convertToType(data['error'], Object); } - return obj; + if (data.hasOwnProperty('data')) { + obj['data'] = _ApiClient.default.convertToType(data['data'], Object); + } } - }]); - return ErrorResponse; -}(); + return obj; + } + +} ErrorResponse.prototype['success'] = undefined; ErrorResponse.prototype['error'] = undefined; ErrorResponse.prototype['data'] = undefined; var _default = ErrorResponse; -exports["default"] = _default; \ No newline at end of file +exports.default = _default; \ No newline at end of file diff --git a/dist/model/Estimate.js b/dist/model/Estimate.js index 0964539..765b918 100644 --- a/dist/model/Estimate.js +++ b/dist/model/Estimate.js @@ -3,63 +3,56 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; +exports.default = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); var _Order = _interopRequireDefault(require("./Order")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var Estimate = /*#__PURE__*/function () { - function Estimate() { - _classCallCheck(this, Estimate); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/** + * Patch API V1 + * The core API used to integrate with Patch's service + * + * Contact: developers@usepatch.com + */ +class Estimate { + constructor() { Estimate.initialize(this); } - _createClass(Estimate, null, [{ - key: "initialize", - value: function initialize(obj) {} - }, { - key: "constructFromObject", - value: function constructFromObject(data, obj) { - if (data) { - obj = obj || new Estimate(); + static initialize(obj) {} - if (data.hasOwnProperty('id')) { - obj['id'] = _ApiClient["default"].convertToType(data['id'], 'String'); - } + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Estimate(); - if (data.hasOwnProperty('production')) { - obj['production'] = _ApiClient["default"].convertToType(data['production'], 'Boolean'); - } + if (data.hasOwnProperty('id')) { + obj['id'] = _ApiClient.default.convertToType(data['id'], 'String'); + } - if (data.hasOwnProperty('type')) { - obj['type'] = _ApiClient["default"].convertToType(data['type'], 'String'); - } + if (data.hasOwnProperty('production')) { + obj['production'] = _ApiClient.default.convertToType(data['production'], 'Boolean'); + } - if (data.hasOwnProperty('order')) { - obj['order'] = _Order["default"].constructFromObject(data['order']); - } + if (data.hasOwnProperty('type')) { + obj['type'] = _ApiClient.default.convertToType(data['type'], 'String'); } - return obj; + if (data.hasOwnProperty('order')) { + obj['order'] = _Order.default.constructFromObject(data['order']); + } } - }]); - return Estimate; -}(); + return obj; + } + +} Estimate.prototype['id'] = undefined; Estimate.prototype['production'] = undefined; Estimate.prototype['type'] = undefined; Estimate.prototype['order'] = undefined; var _default = Estimate; -exports["default"] = _default; \ No newline at end of file +exports.default = _default; \ No newline at end of file diff --git a/dist/model/EstimateListResponse.js b/dist/model/EstimateListResponse.js index 2f50990..3974018 100644 --- a/dist/model/EstimateListResponse.js +++ b/dist/model/EstimateListResponse.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; +exports.default = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); @@ -11,62 +11,55 @@ var _Estimate = _interopRequireDefault(require("./Estimate")); var _MetaIndexObject = _interopRequireDefault(require("./MetaIndexObject")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var EstimateListResponse = /*#__PURE__*/function () { - function EstimateListResponse(success, error, data, meta) { - _classCallCheck(this, EstimateListResponse); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/** + * Patch API V1 + * The core API used to integrate with Patch's service + * + * Contact: developers@usepatch.com + */ +class EstimateListResponse { + constructor(success, error, data, meta) { EstimateListResponse.initialize(this, success, error, data, meta); } - _createClass(EstimateListResponse, null, [{ - key: "initialize", - value: function initialize(obj, success, error, data, meta) { - obj['success'] = success; - obj['error'] = error; - obj['data'] = data; - obj['meta'] = meta; - } - }, { - key: "constructFromObject", - value: function constructFromObject(data, obj) { - if (data) { - obj = obj || new EstimateListResponse(); + static initialize(obj, success, error, data, meta) { + obj['success'] = success; + obj['error'] = error; + obj['data'] = data; + obj['meta'] = meta; + } - if (data.hasOwnProperty('success')) { - obj['success'] = _ApiClient["default"].convertToType(data['success'], 'Boolean'); - } + static constructFromObject(data, obj) { + if (data) { + obj = obj || new EstimateListResponse(); - if (data.hasOwnProperty('error')) { - obj['error'] = _ApiClient["default"].convertToType(data['error'], Object); - } + if (data.hasOwnProperty('success')) { + obj['success'] = _ApiClient.default.convertToType(data['success'], 'Boolean'); + } - if (data.hasOwnProperty('data')) { - obj['data'] = _ApiClient["default"].convertToType(data['data'], [_Estimate["default"]]); - } + if (data.hasOwnProperty('error')) { + obj['error'] = _ApiClient.default.convertToType(data['error'], Object); + } - if (data.hasOwnProperty('meta')) { - obj['meta'] = _MetaIndexObject["default"].constructFromObject(data['meta']); - } + if (data.hasOwnProperty('data')) { + obj['data'] = _ApiClient.default.convertToType(data['data'], [_Estimate.default]); } - return obj; + if (data.hasOwnProperty('meta')) { + obj['meta'] = _MetaIndexObject.default.constructFromObject(data['meta']); + } } - }]); - return EstimateListResponse; -}(); + return obj; + } + +} EstimateListResponse.prototype['success'] = undefined; EstimateListResponse.prototype['error'] = undefined; EstimateListResponse.prototype['data'] = undefined; EstimateListResponse.prototype['meta'] = undefined; var _default = EstimateListResponse; -exports["default"] = _default; \ No newline at end of file +exports.default = _default; \ No newline at end of file diff --git a/dist/model/EstimateResponse.js b/dist/model/EstimateResponse.js index 6983631..f04d209 100644 --- a/dist/model/EstimateResponse.js +++ b/dist/model/EstimateResponse.js @@ -3,62 +3,55 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; +exports.default = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); var _Estimate = _interopRequireDefault(require("./Estimate")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var EstimateResponse = /*#__PURE__*/function () { - function EstimateResponse(success, error, data) { - _classCallCheck(this, EstimateResponse); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/** + * Patch API V1 + * The core API used to integrate with Patch's service + * + * Contact: developers@usepatch.com + */ +class EstimateResponse { + constructor(success, error, data) { EstimateResponse.initialize(this, success, error, data); } - _createClass(EstimateResponse, null, [{ - key: "initialize", - value: function initialize(obj, success, error, data) { - obj['success'] = success; - obj['error'] = error; - obj['data'] = data; - } - }, { - key: "constructFromObject", - value: function constructFromObject(data, obj) { - if (data) { - obj = obj || new EstimateResponse(); + static initialize(obj, success, error, data) { + obj['success'] = success; + obj['error'] = error; + obj['data'] = data; + } - if (data.hasOwnProperty('success')) { - obj['success'] = _ApiClient["default"].convertToType(data['success'], 'Boolean'); - } + static constructFromObject(data, obj) { + if (data) { + obj = obj || new EstimateResponse(); - if (data.hasOwnProperty('error')) { - obj['error'] = _ApiClient["default"].convertToType(data['error'], Object); - } + if (data.hasOwnProperty('success')) { + obj['success'] = _ApiClient.default.convertToType(data['success'], 'Boolean'); + } - if (data.hasOwnProperty('data')) { - obj['data'] = _Estimate["default"].constructFromObject(data['data']); - } + if (data.hasOwnProperty('error')) { + obj['error'] = _ApiClient.default.convertToType(data['error'], Object); } - return obj; + if (data.hasOwnProperty('data')) { + obj['data'] = _Estimate.default.constructFromObject(data['data']); + } } - }]); - return EstimateResponse; -}(); + return obj; + } + +} EstimateResponse.prototype['success'] = undefined; EstimateResponse.prototype['error'] = undefined; EstimateResponse.prototype['data'] = undefined; var _default = EstimateResponse; -exports["default"] = _default; \ No newline at end of file +exports.default = _default; \ No newline at end of file diff --git a/dist/model/MetaIndexObject.js b/dist/model/MetaIndexObject.js index 71f5fc6..0fdeee0 100644 --- a/dist/model/MetaIndexObject.js +++ b/dist/model/MetaIndexObject.js @@ -3,51 +3,44 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; +exports.default = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var MetaIndexObject = /*#__PURE__*/function () { - function MetaIndexObject() { - _classCallCheck(this, MetaIndexObject); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/** + * Patch API V1 + * The core API used to integrate with Patch's service + * + * Contact: developers@usepatch.com + */ +class MetaIndexObject { + constructor() { MetaIndexObject.initialize(this); } - _createClass(MetaIndexObject, null, [{ - key: "initialize", - value: function initialize(obj) {} - }, { - key: "constructFromObject", - value: function constructFromObject(data, obj) { - if (data) { - obj = obj || new MetaIndexObject(); - - if (data.hasOwnProperty('prev_page')) { - obj['prev_page'] = _ApiClient["default"].convertToType(data['prev_page'], 'Number'); - } - - if (data.hasOwnProperty('next_page')) { - obj['next_page'] = _ApiClient["default"].convertToType(data['next_page'], 'Number'); - } + static initialize(obj) {} + + static constructFromObject(data, obj) { + if (data) { + obj = obj || new MetaIndexObject(); + + if (data.hasOwnProperty('prev_page')) { + obj['prev_page'] = _ApiClient.default.convertToType(data['prev_page'], 'Number'); } - return obj; + if (data.hasOwnProperty('next_page')) { + obj['next_page'] = _ApiClient.default.convertToType(data['next_page'], 'Number'); + } } - }]); - return MetaIndexObject; -}(); + return obj; + } + +} MetaIndexObject.prototype['prev_page'] = undefined; MetaIndexObject.prototype['next_page'] = undefined; var _default = MetaIndexObject; -exports["default"] = _default; \ No newline at end of file +exports.default = _default; \ No newline at end of file diff --git a/dist/model/Order.js b/dist/model/Order.js index 4826bc8..9b8495f 100644 --- a/dist/model/Order.js +++ b/dist/model/Order.js @@ -3,71 +3,64 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; +exports.default = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); var _Allocation = _interopRequireDefault(require("./Allocation")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +/** + * Patch API V1 + * The core API used to integrate with Patch's service + * + * Contact: developers@usepatch.com + */ +class Order { + constructor() { + Order.initialize(this); + } -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + static initialize(obj) {} -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Order(); -var Order = /*#__PURE__*/function () { - function Order() { - _classCallCheck(this, Order); + if (data.hasOwnProperty('id')) { + obj['id'] = _ApiClient.default.convertToType(data['id'], 'String'); + } - Order.initialize(this); - } + if (data.hasOwnProperty('mass_g')) { + obj['mass_g'] = _ApiClient.default.convertToType(data['mass_g'], 'Number'); + } + + if (data.hasOwnProperty('production')) { + obj['production'] = _ApiClient.default.convertToType(data['production'], 'Boolean'); + } - _createClass(Order, null, [{ - key: "initialize", - value: function initialize(obj) {} - }, { - key: "constructFromObject", - value: function constructFromObject(data, obj) { - if (data) { - obj = obj || new Order(); - - if (data.hasOwnProperty('id')) { - obj['id'] = _ApiClient["default"].convertToType(data['id'], 'String'); - } - - if (data.hasOwnProperty('mass_g')) { - obj['mass_g'] = _ApiClient["default"].convertToType(data['mass_g'], 'Number'); - } - - if (data.hasOwnProperty('production')) { - obj['production'] = _ApiClient["default"].convertToType(data['production'], 'Boolean'); - } - - if (data.hasOwnProperty('state')) { - obj['state'] = _ApiClient["default"].convertToType(data['state'], 'String'); - } - - if (data.hasOwnProperty('allocation_state')) { - obj['allocation_state'] = _ApiClient["default"].convertToType(data['allocation_state'], 'String'); - } - - if (data.hasOwnProperty('price_cents_usd')) { - obj['price_cents_usd'] = _ApiClient["default"].convertToType(data['price_cents_usd'], 'String'); - } - - if (data.hasOwnProperty('allocations')) { - obj['allocations'] = _ApiClient["default"].convertToType(data['allocations'], [_Allocation["default"]]); - } + if (data.hasOwnProperty('state')) { + obj['state'] = _ApiClient.default.convertToType(data['state'], 'String'); } - return obj; + if (data.hasOwnProperty('allocation_state')) { + obj['allocation_state'] = _ApiClient.default.convertToType(data['allocation_state'], 'String'); + } + + if (data.hasOwnProperty('price_cents_usd')) { + obj['price_cents_usd'] = _ApiClient.default.convertToType(data['price_cents_usd'], 'String'); + } + + if (data.hasOwnProperty('allocations')) { + obj['allocations'] = _ApiClient.default.convertToType(data['allocations'], [_Allocation.default]); + } } - }]); - return Order; -}(); + return obj; + } + +} Order.prototype['id'] = undefined; Order.prototype['mass_g'] = undefined; @@ -77,4 +70,4 @@ Order.prototype['allocation_state'] = undefined; Order.prototype['price_cents_usd'] = undefined; Order.prototype['allocations'] = undefined; var _default = Order; -exports["default"] = _default; \ No newline at end of file +exports.default = _default; \ No newline at end of file diff --git a/dist/model/OrderListResponse.js b/dist/model/OrderListResponse.js index edebb63..08ca13a 100644 --- a/dist/model/OrderListResponse.js +++ b/dist/model/OrderListResponse.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; +exports.default = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); @@ -11,62 +11,55 @@ var _MetaIndexObject = _interopRequireDefault(require("./MetaIndexObject")); var _Order = _interopRequireDefault(require("./Order")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var OrderListResponse = /*#__PURE__*/function () { - function OrderListResponse(success, error, data, meta) { - _classCallCheck(this, OrderListResponse); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/** + * Patch API V1 + * The core API used to integrate with Patch's service + * + * Contact: developers@usepatch.com + */ +class OrderListResponse { + constructor(success, error, data, meta) { OrderListResponse.initialize(this, success, error, data, meta); } - _createClass(OrderListResponse, null, [{ - key: "initialize", - value: function initialize(obj, success, error, data, meta) { - obj['success'] = success; - obj['error'] = error; - obj['data'] = data; - obj['meta'] = meta; - } - }, { - key: "constructFromObject", - value: function constructFromObject(data, obj) { - if (data) { - obj = obj || new OrderListResponse(); + static initialize(obj, success, error, data, meta) { + obj['success'] = success; + obj['error'] = error; + obj['data'] = data; + obj['meta'] = meta; + } - if (data.hasOwnProperty('success')) { - obj['success'] = _ApiClient["default"].convertToType(data['success'], 'Boolean'); - } + static constructFromObject(data, obj) { + if (data) { + obj = obj || new OrderListResponse(); - if (data.hasOwnProperty('error')) { - obj['error'] = _ApiClient["default"].convertToType(data['error'], Object); - } + if (data.hasOwnProperty('success')) { + obj['success'] = _ApiClient.default.convertToType(data['success'], 'Boolean'); + } - if (data.hasOwnProperty('data')) { - obj['data'] = _ApiClient["default"].convertToType(data['data'], [_Order["default"]]); - } + if (data.hasOwnProperty('error')) { + obj['error'] = _ApiClient.default.convertToType(data['error'], Object); + } - if (data.hasOwnProperty('meta')) { - obj['meta'] = _MetaIndexObject["default"].constructFromObject(data['meta']); - } + if (data.hasOwnProperty('data')) { + obj['data'] = _ApiClient.default.convertToType(data['data'], [_Order.default]); } - return obj; + if (data.hasOwnProperty('meta')) { + obj['meta'] = _MetaIndexObject.default.constructFromObject(data['meta']); + } } - }]); - return OrderListResponse; -}(); + return obj; + } + +} OrderListResponse.prototype['success'] = undefined; OrderListResponse.prototype['error'] = undefined; OrderListResponse.prototype['data'] = undefined; OrderListResponse.prototype['meta'] = undefined; var _default = OrderListResponse; -exports["default"] = _default; \ No newline at end of file +exports.default = _default; \ No newline at end of file diff --git a/dist/model/OrderResponse.js b/dist/model/OrderResponse.js index 41601b9..776fa14 100644 --- a/dist/model/OrderResponse.js +++ b/dist/model/OrderResponse.js @@ -3,62 +3,55 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; +exports.default = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); var _Order = _interopRequireDefault(require("./Order")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var OrderResponse = /*#__PURE__*/function () { - function OrderResponse(success, error, data) { - _classCallCheck(this, OrderResponse); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/** + * Patch API V1 + * The core API used to integrate with Patch's service + * + * Contact: developers@usepatch.com + */ +class OrderResponse { + constructor(success, error, data) { OrderResponse.initialize(this, success, error, data); } - _createClass(OrderResponse, null, [{ - key: "initialize", - value: function initialize(obj, success, error, data) { - obj['success'] = success; - obj['error'] = error; - obj['data'] = data; - } - }, { - key: "constructFromObject", - value: function constructFromObject(data, obj) { - if (data) { - obj = obj || new OrderResponse(); + static initialize(obj, success, error, data) { + obj['success'] = success; + obj['error'] = error; + obj['data'] = data; + } - if (data.hasOwnProperty('success')) { - obj['success'] = _ApiClient["default"].convertToType(data['success'], 'Boolean'); - } + static constructFromObject(data, obj) { + if (data) { + obj = obj || new OrderResponse(); - if (data.hasOwnProperty('error')) { - obj['error'] = _ApiClient["default"].convertToType(data['error'], Object); - } + if (data.hasOwnProperty('success')) { + obj['success'] = _ApiClient.default.convertToType(data['success'], 'Boolean'); + } - if (data.hasOwnProperty('data')) { - obj['data'] = _Order["default"].constructFromObject(data['data']); - } + if (data.hasOwnProperty('error')) { + obj['error'] = _ApiClient.default.convertToType(data['error'], Object); } - return obj; + if (data.hasOwnProperty('data')) { + obj['data'] = _Order.default.constructFromObject(data['data']); + } } - }]); - return OrderResponse; -}(); + return obj; + } + +} OrderResponse.prototype['success'] = undefined; OrderResponse.prototype['error'] = undefined; OrderResponse.prototype['data'] = undefined; var _default = OrderResponse; -exports["default"] = _default; \ No newline at end of file +exports.default = _default; \ No newline at end of file diff --git a/dist/model/Preference.js b/dist/model/Preference.js index fd4738b..0ea5883 100644 --- a/dist/model/Preference.js +++ b/dist/model/Preference.js @@ -3,58 +3,51 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; +exports.default = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); var _Project = _interopRequireDefault(require("./Project")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } +/** + * Patch API V1 + * The core API used to integrate with Patch's service + * + * Contact: developers@usepatch.com + */ +class Preference { + constructor() { + Preference.initialize(this); + } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + static initialize(obj) {} -var Preference = /*#__PURE__*/function () { - function Preference() { - _classCallCheck(this, Preference); + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Preference(); - Preference.initialize(this); - } + if (data.hasOwnProperty('id')) { + obj['id'] = _ApiClient.default.convertToType(data['id'], 'String'); + } - _createClass(Preference, null, [{ - key: "initialize", - value: function initialize(obj) {} - }, { - key: "constructFromObject", - value: function constructFromObject(data, obj) { - if (data) { - obj = obj || new Preference(); - - if (data.hasOwnProperty('id')) { - obj['id'] = _ApiClient["default"].convertToType(data['id'], 'String'); - } - - if (data.hasOwnProperty('allocation_percentage')) { - obj['allocation_percentage'] = _ApiClient["default"].convertToType(data['allocation_percentage'], 'Number'); - } - - if (data.hasOwnProperty('project')) { - obj['project'] = _Project["default"].constructFromObject(data['project']); - } + if (data.hasOwnProperty('allocation_percentage')) { + obj['allocation_percentage'] = _ApiClient.default.convertToType(data['allocation_percentage'], 'Number'); } - return obj; + if (data.hasOwnProperty('project')) { + obj['project'] = _Project.default.constructFromObject(data['project']); + } } - }]); - return Preference; -}(); + return obj; + } + +} Preference.prototype['id'] = undefined; Preference.prototype['allocation_percentage'] = undefined; Preference.prototype['project'] = undefined; var _default = Preference; -exports["default"] = _default; \ No newline at end of file +exports.default = _default; \ No newline at end of file diff --git a/dist/model/PreferenceListResponse.js b/dist/model/PreferenceListResponse.js index 64f21e2..e064c55 100644 --- a/dist/model/PreferenceListResponse.js +++ b/dist/model/PreferenceListResponse.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; +exports.default = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); @@ -11,62 +11,55 @@ var _MetaIndexObject = _interopRequireDefault(require("./MetaIndexObject")); var _Preference = _interopRequireDefault(require("./Preference")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var PreferenceListResponse = /*#__PURE__*/function () { - function PreferenceListResponse(success, error, data, meta) { - _classCallCheck(this, PreferenceListResponse); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/** + * Patch API V1 + * The core API used to integrate with Patch's service + * + * Contact: developers@usepatch.com + */ +class PreferenceListResponse { + constructor(success, error, data, meta) { PreferenceListResponse.initialize(this, success, error, data, meta); } - _createClass(PreferenceListResponse, null, [{ - key: "initialize", - value: function initialize(obj, success, error, data, meta) { - obj['success'] = success; - obj['error'] = error; - obj['data'] = data; - obj['meta'] = meta; - } - }, { - key: "constructFromObject", - value: function constructFromObject(data, obj) { - if (data) { - obj = obj || new PreferenceListResponse(); + static initialize(obj, success, error, data, meta) { + obj['success'] = success; + obj['error'] = error; + obj['data'] = data; + obj['meta'] = meta; + } - if (data.hasOwnProperty('success')) { - obj['success'] = _ApiClient["default"].convertToType(data['success'], 'Boolean'); - } + static constructFromObject(data, obj) { + if (data) { + obj = obj || new PreferenceListResponse(); - if (data.hasOwnProperty('error')) { - obj['error'] = _ApiClient["default"].convertToType(data['error'], Object); - } + if (data.hasOwnProperty('success')) { + obj['success'] = _ApiClient.default.convertToType(data['success'], 'Boolean'); + } - if (data.hasOwnProperty('data')) { - obj['data'] = _ApiClient["default"].convertToType(data['data'], [_Preference["default"]]); - } + if (data.hasOwnProperty('error')) { + obj['error'] = _ApiClient.default.convertToType(data['error'], Object); + } - if (data.hasOwnProperty('meta')) { - obj['meta'] = _MetaIndexObject["default"].constructFromObject(data['meta']); - } + if (data.hasOwnProperty('data')) { + obj['data'] = _ApiClient.default.convertToType(data['data'], [_Preference.default]); } - return obj; + if (data.hasOwnProperty('meta')) { + obj['meta'] = _MetaIndexObject.default.constructFromObject(data['meta']); + } } - }]); - return PreferenceListResponse; -}(); + return obj; + } + +} PreferenceListResponse.prototype['success'] = undefined; PreferenceListResponse.prototype['error'] = undefined; PreferenceListResponse.prototype['data'] = undefined; PreferenceListResponse.prototype['meta'] = undefined; var _default = PreferenceListResponse; -exports["default"] = _default; \ No newline at end of file +exports.default = _default; \ No newline at end of file diff --git a/dist/model/PreferenceResponse.js b/dist/model/PreferenceResponse.js index 0034876..73cb45e 100644 --- a/dist/model/PreferenceResponse.js +++ b/dist/model/PreferenceResponse.js @@ -3,62 +3,55 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; +exports.default = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); var _Preference = _interopRequireDefault(require("./Preference")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var PreferenceResponse = /*#__PURE__*/function () { - function PreferenceResponse(success, error, data) { - _classCallCheck(this, PreferenceResponse); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/** + * Patch API V1 + * The core API used to integrate with Patch's service + * + * Contact: developers@usepatch.com + */ +class PreferenceResponse { + constructor(success, error, data) { PreferenceResponse.initialize(this, success, error, data); } - _createClass(PreferenceResponse, null, [{ - key: "initialize", - value: function initialize(obj, success, error, data) { - obj['success'] = success; - obj['error'] = error; - obj['data'] = data; - } - }, { - key: "constructFromObject", - value: function constructFromObject(data, obj) { - if (data) { - obj = obj || new PreferenceResponse(); + static initialize(obj, success, error, data) { + obj['success'] = success; + obj['error'] = error; + obj['data'] = data; + } - if (data.hasOwnProperty('success')) { - obj['success'] = _ApiClient["default"].convertToType(data['success'], 'Boolean'); - } + static constructFromObject(data, obj) { + if (data) { + obj = obj || new PreferenceResponse(); - if (data.hasOwnProperty('error')) { - obj['error'] = _ApiClient["default"].convertToType(data['error'], Object); - } + if (data.hasOwnProperty('success')) { + obj['success'] = _ApiClient.default.convertToType(data['success'], 'Boolean'); + } - if (data.hasOwnProperty('data')) { - obj['data'] = _Preference["default"].constructFromObject(data['data']); - } + if (data.hasOwnProperty('error')) { + obj['error'] = _ApiClient.default.convertToType(data['error'], Object); } - return obj; + if (data.hasOwnProperty('data')) { + obj['data'] = _Preference.default.constructFromObject(data['data']); + } } - }]); - return PreferenceResponse; -}(); + return obj; + } + +} PreferenceResponse.prototype['success'] = undefined; PreferenceResponse.prototype['error'] = undefined; PreferenceResponse.prototype['data'] = undefined; var _default = PreferenceResponse; -exports["default"] = _default; \ No newline at end of file +exports.default = _default; \ No newline at end of file diff --git a/dist/model/Project.js b/dist/model/Project.js index 3a6e954..490edae 100644 --- a/dist/model/Project.js +++ b/dist/model/Project.js @@ -3,77 +3,70 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; +exports.default = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +/** + * Patch API V1 + * The core API used to integrate with Patch's service + * + * Contact: developers@usepatch.com + */ +class Project { + constructor() { + Project.initialize(this); + } -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + static initialize(obj) {} -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + static constructFromObject(data, obj) { + if (data) { + obj = obj || new Project(); -var Project = /*#__PURE__*/function () { - function Project() { - _classCallCheck(this, Project); + if (data.hasOwnProperty('id')) { + obj['id'] = _ApiClient.default.convertToType(data['id'], 'String'); + } - Project.initialize(this); - } + if (data.hasOwnProperty('production')) { + obj['production'] = _ApiClient.default.convertToType(data['production'], 'Boolean'); + } + + if (data.hasOwnProperty('name')) { + obj['name'] = _ApiClient.default.convertToType(data['name'], 'String'); + } + + if (data.hasOwnProperty('description')) { + obj['description'] = _ApiClient.default.convertToType(data['description'], 'String'); + } - _createClass(Project, null, [{ - key: "initialize", - value: function initialize(obj) {} - }, { - key: "constructFromObject", - value: function constructFromObject(data, obj) { - if (data) { - obj = obj || new Project(); - - if (data.hasOwnProperty('id')) { - obj['id'] = _ApiClient["default"].convertToType(data['id'], 'String'); - } - - if (data.hasOwnProperty('production')) { - obj['production'] = _ApiClient["default"].convertToType(data['production'], 'Boolean'); - } - - if (data.hasOwnProperty('name')) { - obj['name'] = _ApiClient["default"].convertToType(data['name'], 'String'); - } - - if (data.hasOwnProperty('description')) { - obj['description'] = _ApiClient["default"].convertToType(data['description'], 'String'); - } - - if (data.hasOwnProperty('country')) { - obj['country'] = _ApiClient["default"].convertToType(data['country'], 'String'); - } - - if (data.hasOwnProperty('longitude')) { - obj['longitude'] = _ApiClient["default"].convertToType(data['longitude'], 'Number'); - } - - if (data.hasOwnProperty('latitude')) { - obj['latitude'] = _ApiClient["default"].convertToType(data['latitude'], 'Number'); - } - - if (data.hasOwnProperty('verifier')) { - obj['verifier'] = _ApiClient["default"].convertToType(data['verifier'], 'String'); - } - - if (data.hasOwnProperty('developer')) { - obj['developer'] = _ApiClient["default"].convertToType(data['developer'], 'String'); - } + if (data.hasOwnProperty('country')) { + obj['country'] = _ApiClient.default.convertToType(data['country'], 'String'); } - return obj; + if (data.hasOwnProperty('longitude')) { + obj['longitude'] = _ApiClient.default.convertToType(data['longitude'], 'Number'); + } + + if (data.hasOwnProperty('latitude')) { + obj['latitude'] = _ApiClient.default.convertToType(data['latitude'], 'Number'); + } + + if (data.hasOwnProperty('verifier')) { + obj['verifier'] = _ApiClient.default.convertToType(data['verifier'], 'String'); + } + + if (data.hasOwnProperty('developer')) { + obj['developer'] = _ApiClient.default.convertToType(data['developer'], 'String'); + } } - }]); - return Project; -}(); + return obj; + } + +} Project.prototype['id'] = undefined; Project.prototype['production'] = undefined; @@ -85,4 +78,4 @@ Project.prototype['latitude'] = undefined; Project.prototype['verifier'] = undefined; Project.prototype['developer'] = undefined; var _default = Project; -exports["default"] = _default; \ No newline at end of file +exports.default = _default; \ No newline at end of file diff --git a/dist/model/ProjectListResponse.js b/dist/model/ProjectListResponse.js index 5dc1e91..8ef5c18 100644 --- a/dist/model/ProjectListResponse.js +++ b/dist/model/ProjectListResponse.js @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; +exports.default = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); @@ -11,62 +11,55 @@ var _MetaIndexObject = _interopRequireDefault(require("./MetaIndexObject")); var _Project = _interopRequireDefault(require("./Project")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var ProjectListResponse = /*#__PURE__*/function () { - function ProjectListResponse(success, error, data, meta) { - _classCallCheck(this, ProjectListResponse); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/** + * Patch API V1 + * The core API used to integrate with Patch's service + * + * Contact: developers@usepatch.com + */ +class ProjectListResponse { + constructor(success, error, data, meta) { ProjectListResponse.initialize(this, success, error, data, meta); } - _createClass(ProjectListResponse, null, [{ - key: "initialize", - value: function initialize(obj, success, error, data, meta) { - obj['success'] = success; - obj['error'] = error; - obj['data'] = data; - obj['meta'] = meta; - } - }, { - key: "constructFromObject", - value: function constructFromObject(data, obj) { - if (data) { - obj = obj || new ProjectListResponse(); + static initialize(obj, success, error, data, meta) { + obj['success'] = success; + obj['error'] = error; + obj['data'] = data; + obj['meta'] = meta; + } - if (data.hasOwnProperty('success')) { - obj['success'] = _ApiClient["default"].convertToType(data['success'], 'Boolean'); - } + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ProjectListResponse(); - if (data.hasOwnProperty('error')) { - obj['error'] = _ApiClient["default"].convertToType(data['error'], Object); - } + if (data.hasOwnProperty('success')) { + obj['success'] = _ApiClient.default.convertToType(data['success'], 'Boolean'); + } - if (data.hasOwnProperty('data')) { - obj['data'] = _ApiClient["default"].convertToType(data['data'], [_Project["default"]]); - } + if (data.hasOwnProperty('error')) { + obj['error'] = _ApiClient.default.convertToType(data['error'], Object); + } - if (data.hasOwnProperty('meta')) { - obj['meta'] = _MetaIndexObject["default"].constructFromObject(data['meta']); - } + if (data.hasOwnProperty('data')) { + obj['data'] = _ApiClient.default.convertToType(data['data'], [_Project.default]); } - return obj; + if (data.hasOwnProperty('meta')) { + obj['meta'] = _MetaIndexObject.default.constructFromObject(data['meta']); + } } - }]); - return ProjectListResponse; -}(); + return obj; + } + +} ProjectListResponse.prototype['success'] = undefined; ProjectListResponse.prototype['error'] = undefined; ProjectListResponse.prototype['data'] = undefined; ProjectListResponse.prototype['meta'] = undefined; var _default = ProjectListResponse; -exports["default"] = _default; \ No newline at end of file +exports.default = _default; \ No newline at end of file diff --git a/dist/model/ProjectResponse.js b/dist/model/ProjectResponse.js index c212969..3880a62 100644 --- a/dist/model/ProjectResponse.js +++ b/dist/model/ProjectResponse.js @@ -3,62 +3,55 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; +exports.default = void 0; var _ApiClient = _interopRequireDefault(require("../ApiClient")); var _Project = _interopRequireDefault(require("./Project")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var ProjectResponse = /*#__PURE__*/function () { - function ProjectResponse(success, error, data) { - _classCallCheck(this, ProjectResponse); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/** + * Patch API V1 + * The core API used to integrate with Patch's service + * + * Contact: developers@usepatch.com + */ +class ProjectResponse { + constructor(success, error, data) { ProjectResponse.initialize(this, success, error, data); } - _createClass(ProjectResponse, null, [{ - key: "initialize", - value: function initialize(obj, success, error, data) { - obj['success'] = success; - obj['error'] = error; - obj['data'] = data; - } - }, { - key: "constructFromObject", - value: function constructFromObject(data, obj) { - if (data) { - obj = obj || new ProjectResponse(); + static initialize(obj, success, error, data) { + obj['success'] = success; + obj['error'] = error; + obj['data'] = data; + } - if (data.hasOwnProperty('success')) { - obj['success'] = _ApiClient["default"].convertToType(data['success'], 'Boolean'); - } + static constructFromObject(data, obj) { + if (data) { + obj = obj || new ProjectResponse(); - if (data.hasOwnProperty('error')) { - obj['error'] = _ApiClient["default"].convertToType(data['error'], Object); - } + if (data.hasOwnProperty('success')) { + obj['success'] = _ApiClient.default.convertToType(data['success'], 'Boolean'); + } - if (data.hasOwnProperty('data')) { - obj['data'] = _Project["default"].constructFromObject(data['data']); - } + if (data.hasOwnProperty('error')) { + obj['error'] = _ApiClient.default.convertToType(data['error'], Object); } - return obj; + if (data.hasOwnProperty('data')) { + obj['data'] = _Project.default.constructFromObject(data['data']); + } } - }]); - return ProjectResponse; -}(); + return obj; + } + +} ProjectResponse.prototype['success'] = undefined; ProjectResponse.prototype['error'] = undefined; ProjectResponse.prototype['data'] = undefined; var _default = ProjectResponse; -exports["default"] = _default; \ No newline at end of file +exports.default = _default; \ No newline at end of file diff --git a/src/ApiClient.js b/src/ApiClient.js index e68c45a..3e3fd9d 100644 --- a/src/ApiClient.js +++ b/src/ApiClient.js @@ -5,14 +5,14 @@ * Contact: developers@usepatch.com */ -import superagent from "superagent"; -import querystring from "querystring"; +import superagent from 'superagent'; +import querystring from 'querystring'; class ApiClient { constructor() { - this.basePath = "https://api.usepatch.com".replace(/\/+$/, ""); + this.basePath = 'https://api.usepatch.com'.replace(/\/+$/, ''); this.authentications = { - bearer_auth: { type: "bearer" }, + bearer_auth: { type: 'bearer' } }; this.defaultHeaders = {}; @@ -38,7 +38,7 @@ class ApiClient { * Used to save and return cookies in a node.js (non-browser) setting, * if this.enableCookies is set to true. */ - if (typeof window === "undefined") { + if (typeof window === 'undefined') { this.agent = new superagent.agent(); } @@ -55,7 +55,7 @@ class ApiClient { paramToString(param) { if (param == undefined || param == null) { - return ""; + return ''; } if (param instanceof Date) { return param.toJSON(); @@ -66,7 +66,7 @@ class ApiClient { buildUrl(path, pathParams) { if (!path.match(/^\//)) { - path = "/" + path; + path = '/' + path; } var url = this.basePath + path; @@ -103,10 +103,10 @@ class ApiClient { isFileParam(param) { // fs.ReadStream in Node.js and Electron (but not in runtime like browserify) - if (typeof require === "function") { + if (typeof require === 'function') { let fs; try { - fs = require("fs"); + fs = require('fs'); } catch (err) {} if (fs && fs.ReadStream && param instanceof fs.ReadStream) { return true; @@ -114,17 +114,17 @@ class ApiClient { } // Buffer in Node.js - if (typeof Buffer === "function" && param instanceof Buffer) { + if (typeof Buffer === 'function' && param instanceof Buffer) { return true; } // Blob in browser - if (typeof Blob === "function" && param instanceof Blob) { + if (typeof Blob === 'function' && param instanceof Blob) { return true; } // File in browser (it seems File object is also instance of Blob, but keep this for safe) - if (typeof File === "function" && param instanceof File) { + if (typeof File === 'function' && param instanceof File) { return true; } @@ -156,19 +156,19 @@ class ApiClient { 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("\t"); - case "pipes": - return param.map(this.paramToString).join("|"); - case "multi": + case 'csv': + return param.map(this.paramToString).join(','); + case 'ssv': + return param.map(this.paramToString).join(' '); + case 'tsv': + return param.map(this.paramToString).join('\t'); + case 'pipes': + return param.map(this.paramToString).join('|'); + case 'multi': //return the array directly as SuperAgent will handle it as expected return param.map(this.paramToString); default: - throw new Error("Unknown collection format: " + collectionFormat); + throw new Error('Unknown collection format: ' + collectionFormat); } } @@ -176,28 +176,28 @@ class ApiClient { authNames.forEach((authName) => { var auth = this.authentications[authName]; switch (auth.type) { - case "basic": + case 'basic': if (auth.username || auth.password) { - request.auth(auth.username || "", auth.password || ""); + request.auth(auth.username || '', auth.password || ''); } break; - case "bearer": + case 'bearer': if (auth.accessToken) { - request.set({ Authorization: "Bearer " + auth.accessToken }); + request.set({ Authorization: 'Bearer ' + auth.accessToken }); } break; - case "apiKey": + case 'apiKey': if (auth.apiKey) { var data = {}; if (auth.apiKeyPrefix) { - data[auth.name] = auth.apiKeyPrefix + " " + auth.apiKey; + data[auth.name] = auth.apiKeyPrefix + ' ' + auth.apiKey; } else { data[auth.name] = auth.apiKey; } - if (auth["in"] === "header") { + if (auth['in'] === 'header') { request.set(data); } else { request.query(data); @@ -205,14 +205,14 @@ class ApiClient { } break; - case "oauth2": + case 'oauth2': if (auth.accessToken) { - request.set({ Authorization: "Bearer " + auth.accessToken }); + request.set({ Authorization: 'Bearer ' + auth.accessToken }); } break; default: - throw new Error("Unknown authentication type: " + auth.type); + throw new Error('Unknown authentication type: ' + auth.type); } }); } @@ -227,8 +227,8 @@ class ApiClient { var data = response.body; if ( data == null || - (typeof data === "object" && - typeof data.length === "undefined" && + (typeof data === 'object' && + typeof data.length === 'undefined' && !Object.keys(data).length) ) { // SuperAgent does not always produce a body; use the unparsed response as a fallback @@ -266,8 +266,8 @@ class ApiClient { this.applyAuthToRequest(request, authNames); // set query parameters - if (httpMethod.toUpperCase() === "GET" && this.cache === false) { - queryParams["_"] = new Date().getTime(); + if (httpMethod.toUpperCase() === 'GET' && this.cache === false) { + queryParams['_'] = new Date().getTime(); } request.query(this.normalizeParams(queryParams)); @@ -286,16 +286,16 @@ class ApiClient { var contentType = this.jsonPreferredMime(contentTypes); if (contentType) { // Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746) - if (contentType != "multipart/form-data") { + if (contentType != 'multipart/form-data') { request.type(contentType); } - } else if (!request.header["Content-Type"]) { - request.type("application/json"); + } else if (!request.header['Content-Type']) { + request.type('application/json'); } - if (contentType === "application/x-www-form-urlencoded") { + if (contentType === 'application/x-www-form-urlencoded') { request.send(querystring.stringify(this.normalizeParams(formParams))); - } else if (contentType == "multipart/form-data") { + } else if (contentType == 'multipart/form-data') { var _formParams = this.normalizeParams(formParams); for (var key in _formParams) { if (_formParams.hasOwnProperty(key)) { @@ -316,15 +316,15 @@ class ApiClient { request.accept(accept); } - if (returnType === "Blob") { - request.responseType("blob"); - } else if (returnType === "String") { - request.responseType("string"); + if (returnType === 'Blob') { + request.responseType('blob'); + } else if (returnType === 'String') { + request.responseType('string'); } // Attach previously saved cookies, if enabled if (this.enableCookies) { - if (typeof window === "undefined") { + if (typeof window === 'undefined') { this.agent._attachCookies(request); } else { request.withCredentials(); @@ -333,26 +333,14 @@ class ApiClient { return new Promise((resolve, reject) => { request.end((error, response) => { + var data = this.deserialize(response, returnType); if (error) { - var err = {}; - err.status = response.status; - err.statusText = response.statusText; - err.body = response.body; - err.response = response; - err.error = error; - - reject(err); + reject(data); } else { - try { - var data = this.deserialize(response, returnType); - if (this.enableCookies && typeof window === "undefined") { - this.agent._saveCookies(response); - } - - resolve({ data, response }); - } catch (err) { - reject(err); + if (this.enableCookies && typeof window === 'undefined') { + this.agent._saveCookies(response); } + resolve(data); } }); }); @@ -366,23 +354,23 @@ class ApiClient { if (data === null || data === undefined) return data; switch (type) { - case "Boolean": + case 'Boolean': return Boolean(data); - case "Integer": + case 'Integer': return parseInt(data, 10); - case "Number": + case 'Number': return parseFloat(data); - case "String": + case 'String': return String(data); - case "Date": + case 'Date': return ApiClient.parseDate(String(data)); - case "Blob": + case 'Blob': return data; default: if (type === Object) { // generic object, return directly return data; - } else if (typeof type.constructFromObject === "function") { + } else if (typeof type.constructFromObject === 'function') { // for model type like User and enum class return type.constructFromObject(data); } else if (Array.isArray(type)) { @@ -392,7 +380,7 @@ class ApiClient { return data.map((item) => { return ApiClient.convertToType(item, itemType); }); - } else if (typeof type === "object") { + } else if (typeof type === 'object') { // for plain object type like: {'String': 'Integer'} var keyType, valueType; for (var k in type) { @@ -423,17 +411,17 @@ class ApiClient { hostSettings() { return [ { - url: "https://api.usepatch.com", - description: "No description provided", + url: 'https://api.usepatch.com', + description: 'No description provided', variables: { defaultHost: { - description: "No description provided", - default_value: "api.usepatch.com", - enum_values: [], - }, - }, - }, + description: 'No description provided', + default_value: 'api.usepatch.com', + enum_values: [] + } + } + } ]; } @@ -443,44 +431,44 @@ class ApiClient { // check array index out of bound if (index < 0 || index >= servers.length) { throw new Error( - "Invalid index " + + 'Invalid index ' + index + - " when selecting the host settings. Must be less than " + + ' when selecting the host settings. Must be less than ' + servers.length ); } var server = servers[index]; - var url = server["url"]; + var url = server['url']; // go through variable and assign a value - for (var variable_name in server["variables"]) { + for (var variable_name in server['variables']) { if (variable_name in variables) { - let variable = server["variables"][variable_name]; + let variable = server['variables'][variable_name]; if ( - !("enum_values" in variable) || - variable["enum_values"].includes(variables[variable_name]) + !('enum_values' in variable) || + variable['enum_values'].includes(variables[variable_name]) ) { url = url.replace( - "{" + variable_name + "}", + '{' + variable_name + '}', variables[variable_name] ); } else { throw new Error( - "The variable `" + + 'The variable `' + variable_name + - "` in the host URL has invalid value " + + '` in the host URL has invalid value ' + variables[variable_name] + - ". Must be " + - server["variables"][variable_name]["enum_values"] + - "." + '. Must be ' + + server['variables'][variable_name]['enum_values'] + + '.' ); } } else { // use default value url = url.replace( - "{" + variable_name + "}", - server["variables"][variable_name]["default_value"] + '{' + variable_name + '}', + server['variables'][variable_name]['default_value'] ); } } @@ -503,11 +491,11 @@ class ApiClient { } ApiClient.CollectionFormatEnum = { - CSV: ",", - SSV: " ", - TSV: "\t", - PIPES: "|", - MULTI: "multi", + CSV: ',', + SSV: ' ', + TSV: '\t', + PIPES: '|', + MULTI: 'multi' }; ApiClient.instance = new ApiClient(); diff --git a/src/api/EstimatesApi.js b/src/api/EstimatesApi.js index 2afbbe6..e7f9254 100644 --- a/src/api/EstimatesApi.js +++ b/src/api/EstimatesApi.js @@ -5,11 +5,11 @@ * Contact: developers@usepatch.com */ -import ApiClient from "../ApiClient"; -import CreateMassEstimateRequest from "../model/CreateMassEstimateRequest"; -import ErrorResponse from "../model/ErrorResponse"; -import EstimateListResponse from "../model/EstimateListResponse"; -import EstimateResponse from "../model/EstimateResponse"; +import ApiClient from '../ApiClient'; +import CreateMassEstimateRequest from '../model/CreateMassEstimateRequest'; +import ErrorResponse from '../model/ErrorResponse'; +import EstimateListResponse from '../model/EstimateListResponse'; +import EstimateResponse from '../model/EstimateResponse'; export default class EstimatesApi { constructor(apiClient) { @@ -46,14 +46,14 @@ export default class EstimatesApi { let headerParams = {}; let formParams = {}; - let authNames = ["bearer_auth"]; - let contentTypes = ["application/json"]; - let accepts = ["application/json"]; + let authNames = ['bearer_auth']; + let contentTypes = ['application/json']; + let accepts = ['application/json']; let returnType = EstimateResponse; return this.apiClient.callApi( - "/v1/estimates/mass", - "POST", + '/v1/estimates/mass', + 'POST', pathParams, queryParams, headerParams, @@ -67,11 +67,7 @@ export default class EstimatesApi { } createMassEstimate(createMassEstimateRequest) { - return this.createMassEstimateWithHttpInfo(createMassEstimateRequest).then( - function (response_and_data) { - return response_and_data.data; - } - ); + return this.createMassEstimateWithHttpInfo(createMassEstimateRequest); } retrieveEstimateWithHttpInfo(id) { @@ -85,20 +81,20 @@ export default class EstimatesApi { } let pathParams = { - id: id, + id: id }; let queryParams = {}; let headerParams = {}; let formParams = {}; - let authNames = ["bearer_auth"]; + let authNames = ['bearer_auth']; let contentTypes = []; - let accepts = ["application/json"]; + let accepts = ['application/json']; let returnType = EstimateResponse; return this.apiClient.callApi( - "/v1/estimates/{id}", - "GET", + '/v1/estimates/{id}', + 'GET', pathParams, queryParams, headerParams, @@ -112,11 +108,7 @@ export default class EstimatesApi { } retrieveEstimate(id) { - return this.retrieveEstimateWithHttpInfo(id).then(function ( - response_and_data - ) { - return response_and_data.data; - }); + return this.retrieveEstimateWithHttpInfo(id); } retrieveEstimatesWithHttpInfo(opts) { @@ -126,19 +118,19 @@ export default class EstimatesApi { let pathParams = {}; let queryParams = { - page: opts["page"], + page: opts['page'] }; let headerParams = {}; let formParams = {}; - let authNames = ["bearer_auth"]; + let authNames = ['bearer_auth']; let contentTypes = []; - let accepts = ["application/json"]; + let accepts = ['application/json']; let returnType = EstimateListResponse; return this.apiClient.callApi( - "/v1/estimates", - "GET", + '/v1/estimates', + 'GET', pathParams, queryParams, headerParams, @@ -152,10 +144,6 @@ export default class EstimatesApi { } retrieveEstimates(opts) { - return this.retrieveEstimatesWithHttpInfo(opts).then(function ( - response_and_data - ) { - return response_and_data.data; - }); + return this.retrieveEstimatesWithHttpInfo(opts); } } diff --git a/src/api/OrdersApi.js b/src/api/OrdersApi.js index dc953d3..7b0fc6f 100644 --- a/src/api/OrdersApi.js +++ b/src/api/OrdersApi.js @@ -5,11 +5,11 @@ * Contact: developers@usepatch.com */ -import ApiClient from "../ApiClient"; -import CreateOrderRequest from "../model/CreateOrderRequest"; -import ErrorResponse from "../model/ErrorResponse"; -import OrderListResponse from "../model/OrderListResponse"; -import OrderResponse from "../model/OrderResponse"; +import ApiClient from '../ApiClient'; +import CreateOrderRequest from '../model/CreateOrderRequest'; +import ErrorResponse from '../model/ErrorResponse'; +import OrderListResponse from '../model/OrderListResponse'; +import OrderResponse from '../model/OrderResponse'; export default class OrdersApi { constructor(apiClient) { @@ -39,20 +39,20 @@ export default class OrdersApi { } let pathParams = { - id: id, + id: id }; let queryParams = {}; let headerParams = {}; let formParams = {}; - let authNames = ["bearer_auth"]; + let authNames = ['bearer_auth']; let contentTypes = []; - let accepts = ["application/json"]; + let accepts = ['application/json']; let returnType = OrderResponse; return this.apiClient.callApi( - "/v1/orders/{id}/cancel", - "PATCH", + '/v1/orders/{id}/cancel', + 'PATCH', pathParams, queryParams, headerParams, @@ -66,9 +66,7 @@ export default class OrdersApi { } cancelOrder(id) { - return this.cancelOrderWithHttpInfo(id).then(function (response_and_data) { - return response_and_data.data; - }); + return this.cancelOrderWithHttpInfo(id); } createOrderWithHttpInfo(createOrderRequest) { @@ -86,14 +84,14 @@ export default class OrdersApi { let headerParams = {}; let formParams = {}; - let authNames = ["bearer_auth"]; - let contentTypes = ["application/json"]; - let accepts = ["application/json"]; + let authNames = ['bearer_auth']; + let contentTypes = ['application/json']; + let accepts = ['application/json']; let returnType = OrderResponse; return this.apiClient.callApi( - "/v1/orders", - "POST", + '/v1/orders', + 'POST', pathParams, queryParams, headerParams, @@ -107,11 +105,7 @@ export default class OrdersApi { } createOrder(createOrderRequest) { - return this.createOrderWithHttpInfo(createOrderRequest).then(function ( - response_and_data - ) { - return response_and_data.data; - }); + return this.createOrderWithHttpInfo(createOrderRequest); } placeOrderWithHttpInfo(id) { @@ -125,20 +119,20 @@ export default class OrdersApi { } let pathParams = { - id: id, + id: id }; let queryParams = {}; let headerParams = {}; let formParams = {}; - let authNames = ["bearer_auth"]; + let authNames = ['bearer_auth']; let contentTypes = []; - let accepts = ["application/json"]; + let accepts = ['application/json']; let returnType = OrderResponse; return this.apiClient.callApi( - "/v1/orders/{id}/place", - "PATCH", + '/v1/orders/{id}/place', + 'PATCH', pathParams, queryParams, headerParams, @@ -152,9 +146,7 @@ export default class OrdersApi { } placeOrder(id) { - return this.placeOrderWithHttpInfo(id).then(function (response_and_data) { - return response_and_data.data; - }); + return this.placeOrderWithHttpInfo(id); } retrieveOrderWithHttpInfo(id) { @@ -168,20 +160,20 @@ export default class OrdersApi { } let pathParams = { - id: id, + id: id }; let queryParams = {}; let headerParams = {}; let formParams = {}; - let authNames = ["bearer_auth"]; + let authNames = ['bearer_auth']; let contentTypes = []; - let accepts = ["application/json"]; + let accepts = ['application/json']; let returnType = OrderResponse; return this.apiClient.callApi( - "/v1/orders/{id}", - "GET", + '/v1/orders/{id}', + 'GET', pathParams, queryParams, headerParams, @@ -195,11 +187,7 @@ export default class OrdersApi { } retrieveOrder(id) { - return this.retrieveOrderWithHttpInfo(id).then(function ( - response_and_data - ) { - return response_and_data.data; - }); + return this.retrieveOrderWithHttpInfo(id); } retrieveOrdersWithHttpInfo(opts) { @@ -209,19 +197,19 @@ export default class OrdersApi { let pathParams = {}; let queryParams = { - page: opts["page"], + page: opts['page'] }; let headerParams = {}; let formParams = {}; - let authNames = ["bearer_auth"]; + let authNames = ['bearer_auth']; let contentTypes = []; - let accepts = ["application/json"]; + let accepts = ['application/json']; let returnType = OrderListResponse; return this.apiClient.callApi( - "/v1/orders", - "GET", + '/v1/orders', + 'GET', pathParams, queryParams, headerParams, @@ -235,10 +223,6 @@ export default class OrdersApi { } retrieveOrders(opts) { - return this.retrieveOrdersWithHttpInfo(opts).then(function ( - response_and_data - ) { - return response_and_data.data; - }); + return this.retrieveOrdersWithHttpInfo(opts); } } diff --git a/src/api/PreferencesApi.js b/src/api/PreferencesApi.js index 9e8e905..5d2bc82 100644 --- a/src/api/PreferencesApi.js +++ b/src/api/PreferencesApi.js @@ -5,11 +5,11 @@ * Contact: developers@usepatch.com */ -import ApiClient from "../ApiClient"; -import CreatePreferenceRequest from "../model/CreatePreferenceRequest"; -import ErrorResponse from "../model/ErrorResponse"; -import PreferenceListResponse from "../model/PreferenceListResponse"; -import PreferenceResponse from "../model/PreferenceResponse"; +import ApiClient from '../ApiClient'; +import CreatePreferenceRequest from '../model/CreatePreferenceRequest'; +import ErrorResponse from '../model/ErrorResponse'; +import PreferenceListResponse from '../model/PreferenceListResponse'; +import PreferenceResponse from '../model/PreferenceResponse'; export default class PreferencesApi { constructor(apiClient) { @@ -50,14 +50,14 @@ export default class PreferencesApi { let headerParams = {}; let formParams = {}; - let authNames = ["bearer_auth"]; - let contentTypes = ["application/json"]; - let accepts = ["application/json"]; + let authNames = ['bearer_auth']; + let contentTypes = ['application/json']; + let accepts = ['application/json']; let returnType = PreferenceResponse; return this.apiClient.callApi( - "/v1/preferences", - "POST", + '/v1/preferences', + 'POST', pathParams, queryParams, headerParams, @@ -71,11 +71,7 @@ export default class PreferencesApi { } createPreference(createPreferenceRequest) { - return this.createPreferenceWithHttpInfo(createPreferenceRequest).then( - function (response_and_data) { - return response_and_data.data; - } - ); + return this.createPreferenceWithHttpInfo(createPreferenceRequest); } deletePreferenceWithHttpInfo(id) { @@ -89,20 +85,20 @@ export default class PreferencesApi { } let pathParams = { - id: id, + id: id }; let queryParams = {}; let headerParams = {}; let formParams = {}; - let authNames = ["bearer_auth"]; + let authNames = ['bearer_auth']; let contentTypes = []; - let accepts = ["application/json"]; + let accepts = ['application/json']; let returnType = PreferenceResponse; return this.apiClient.callApi( - "/v1/preferences/{id}", - "DELETE", + '/v1/preferences/{id}', + 'DELETE', pathParams, queryParams, headerParams, @@ -116,11 +112,7 @@ export default class PreferencesApi { } deletePreference(id) { - return this.deletePreferenceWithHttpInfo(id).then(function ( - response_and_data - ) { - return response_and_data.data; - }); + return this.deletePreferenceWithHttpInfo(id); } retrievePreferenceWithHttpInfo(id) { @@ -134,20 +126,20 @@ export default class PreferencesApi { } let pathParams = { - id: id, + id: id }; let queryParams = {}; let headerParams = {}; let formParams = {}; - let authNames = ["bearer_auth"]; + let authNames = ['bearer_auth']; let contentTypes = []; - let accepts = ["application/json"]; + let accepts = ['application/json']; let returnType = PreferenceResponse; return this.apiClient.callApi( - "/v1/preferences/{id}", - "GET", + '/v1/preferences/{id}', + 'GET', pathParams, queryParams, headerParams, @@ -161,11 +153,7 @@ export default class PreferencesApi { } retrievePreference(id) { - return this.retrievePreferenceWithHttpInfo(id).then(function ( - response_and_data - ) { - return response_and_data.data; - }); + return this.retrievePreferenceWithHttpInfo(id); } retrievePreferencesWithHttpInfo(opts) { @@ -175,19 +163,19 @@ export default class PreferencesApi { let pathParams = {}; let queryParams = { - page: opts["page"], + page: opts['page'] }; let headerParams = {}; let formParams = {}; - let authNames = ["bearer_auth"]; + let authNames = ['bearer_auth']; let contentTypes = []; - let accepts = ["application/json"]; + let accepts = ['application/json']; let returnType = PreferenceListResponse; return this.apiClient.callApi( - "/v1/preferences", - "GET", + '/v1/preferences', + 'GET', pathParams, queryParams, headerParams, @@ -201,10 +189,6 @@ export default class PreferencesApi { } retrievePreferences(opts) { - return this.retrievePreferencesWithHttpInfo(opts).then(function ( - response_and_data - ) { - return response_and_data.data; - }); + return this.retrievePreferencesWithHttpInfo(opts); } } diff --git a/src/api/ProjectsApi.js b/src/api/ProjectsApi.js index 9856da4..9752160 100644 --- a/src/api/ProjectsApi.js +++ b/src/api/ProjectsApi.js @@ -5,10 +5,10 @@ * Contact: developers@usepatch.com */ -import ApiClient from "../ApiClient"; -import ErrorResponse from "../model/ErrorResponse"; -import ProjectListResponse from "../model/ProjectListResponse"; -import ProjectResponse from "../model/ProjectResponse"; +import ApiClient from '../ApiClient'; +import ErrorResponse from '../model/ErrorResponse'; +import ProjectListResponse from '../model/ProjectListResponse'; +import ProjectResponse from '../model/ProjectResponse'; export default class ProjectsApi { constructor(apiClient) { @@ -34,20 +34,20 @@ export default class ProjectsApi { } let pathParams = { - id: id, + id: id }; let queryParams = {}; let headerParams = {}; let formParams = {}; - let authNames = ["bearer_auth"]; + let authNames = ['bearer_auth']; let contentTypes = []; - let accepts = ["application/json"]; + let accepts = ['application/json']; let returnType = ProjectResponse; return this.apiClient.callApi( - "/v1/projects/{id}", - "GET", + '/v1/projects/{id}', + 'GET', pathParams, queryParams, headerParams, @@ -61,11 +61,7 @@ export default class ProjectsApi { } retrieveProject(id) { - return this.retrieveProjectWithHttpInfo(id).then(function ( - response_and_data - ) { - return response_and_data.data; - }); + return this.retrieveProjectWithHttpInfo(id); } retrieveProjectsWithHttpInfo(opts) { @@ -75,19 +71,19 @@ export default class ProjectsApi { let pathParams = {}; let queryParams = { - page: opts["page"], + page: opts['page'] }; let headerParams = {}; let formParams = {}; - let authNames = ["bearer_auth"]; + let authNames = ['bearer_auth']; let contentTypes = []; - let accepts = ["application/json"]; + let accepts = ['application/json']; let returnType = ProjectListResponse; return this.apiClient.callApi( - "/v1/projects", - "GET", + '/v1/projects', + 'GET', pathParams, queryParams, headerParams, @@ -101,10 +97,6 @@ export default class ProjectsApi { } retrieveProjects(opts) { - return this.retrieveProjectsWithHttpInfo(opts).then(function ( - response_and_data - ) { - return response_and_data.data; - }); + return this.retrieveProjectsWithHttpInfo(opts); } } diff --git a/src/index.js b/src/index.js index 08fbc73..b910f9a 100644 --- a/src/index.js +++ b/src/index.js @@ -5,17 +5,17 @@ * Contact: developers@usepatch.com */ -import ApiClient from "./ApiClient"; -import EstimatesApi from "./api/EstimatesApi"; -import OrdersApi from "./api/OrdersApi"; -import PreferencesApi from "./api/PreferencesApi"; -import ProjectsApi from "./api/ProjectsApi"; +import ApiClient from './ApiClient'; +import EstimatesApi from './api/EstimatesApi'; +import OrdersApi from './api/OrdersApi'; +import PreferencesApi from './api/PreferencesApi'; +import ProjectsApi from './api/ProjectsApi'; export default function Patch(accessToken) { if (!(this instanceof Patch)) return new Patch(accessToken); this.client = ApiClient.instance; - this.client.authentications["bearer_auth"].accessToken = accessToken; + this.client.authentications['bearer_auth'].accessToken = accessToken; this.estimates = new EstimatesApi(this.client); diff --git a/src/model/Allocation.js b/src/model/Allocation.js index d88a445..98476c9 100644 --- a/src/model/Allocation.js +++ b/src/model/Allocation.js @@ -5,7 +5,7 @@ * Contact: developers@usepatch.com */ -import ApiClient from "../ApiClient"; +import ApiClient from '../ApiClient'; class Allocation { constructor() { @@ -18,29 +18,29 @@ class Allocation { if (data) { obj = obj || new Allocation(); - if (data.hasOwnProperty("id")) { - obj["id"] = ApiClient.convertToType(data["id"], "String"); + if (data.hasOwnProperty('id')) { + obj['id'] = ApiClient.convertToType(data['id'], 'String'); } - if (data.hasOwnProperty("production")) { - obj["production"] = ApiClient.convertToType( - data["production"], - "Boolean" + if (data.hasOwnProperty('production')) { + obj['production'] = ApiClient.convertToType( + data['production'], + 'Boolean' ); } - if (data.hasOwnProperty("mass_g")) { - obj["mass_g"] = ApiClient.convertToType(data["mass_g"], "Number"); + if (data.hasOwnProperty('mass_g')) { + obj['mass_g'] = ApiClient.convertToType(data['mass_g'], 'Number'); } } return obj; } } -Allocation.prototype["id"] = undefined; +Allocation.prototype['id'] = undefined; -Allocation.prototype["production"] = undefined; +Allocation.prototype['production'] = undefined; -Allocation.prototype["mass_g"] = undefined; +Allocation.prototype['mass_g'] = undefined; export default Allocation; diff --git a/src/model/CreateMassEstimateRequest.js b/src/model/CreateMassEstimateRequest.js index 181a8ec..1382eca 100644 --- a/src/model/CreateMassEstimateRequest.js +++ b/src/model/CreateMassEstimateRequest.js @@ -5,7 +5,7 @@ * Contact: developers@usepatch.com */ -import ApiClient from "../ApiClient"; +import ApiClient from '../ApiClient'; class CreateMassEstimateRequest { constructor(massG) { @@ -13,21 +13,21 @@ class CreateMassEstimateRequest { } static initialize(obj, massG) { - obj["mass_g"] = massG; + obj['mass_g'] = massG; } static constructFromObject(data, obj) { if (data) { obj = obj || new CreateMassEstimateRequest(); - if (data.hasOwnProperty("mass_g")) { - obj["mass_g"] = ApiClient.convertToType(data["mass_g"], "Number"); + if (data.hasOwnProperty('mass_g')) { + obj['mass_g'] = ApiClient.convertToType(data['mass_g'], 'Number'); } } return obj; } } -CreateMassEstimateRequest.prototype["mass_g"] = undefined; +CreateMassEstimateRequest.prototype['mass_g'] = undefined; export default CreateMassEstimateRequest; diff --git a/src/model/CreateOrderRequest.js b/src/model/CreateOrderRequest.js index 841a372..49277f5 100644 --- a/src/model/CreateOrderRequest.js +++ b/src/model/CreateOrderRequest.js @@ -5,7 +5,7 @@ * Contact: developers@usepatch.com */ -import ApiClient from "../ApiClient"; +import ApiClient from '../ApiClient'; class CreateOrderRequest { constructor(massG) { @@ -13,21 +13,21 @@ class CreateOrderRequest { } static initialize(obj, massG) { - obj["mass_g"] = massG; + obj['mass_g'] = massG; } static constructFromObject(data, obj) { if (data) { obj = obj || new CreateOrderRequest(); - if (data.hasOwnProperty("mass_g")) { - obj["mass_g"] = ApiClient.convertToType(data["mass_g"], "Number"); + if (data.hasOwnProperty('mass_g')) { + obj['mass_g'] = ApiClient.convertToType(data['mass_g'], 'Number'); } } return obj; } } -CreateOrderRequest.prototype["mass_g"] = undefined; +CreateOrderRequest.prototype['mass_g'] = undefined; export default CreateOrderRequest; diff --git a/src/model/CreatePreferenceRequest.js b/src/model/CreatePreferenceRequest.js index e3bf53a..5c0f2fc 100644 --- a/src/model/CreatePreferenceRequest.js +++ b/src/model/CreatePreferenceRequest.js @@ -5,7 +5,7 @@ * Contact: developers@usepatch.com */ -import ApiClient from "../ApiClient"; +import ApiClient from '../ApiClient'; class CreatePreferenceRequest { constructor(projectId) { @@ -13,17 +13,17 @@ class CreatePreferenceRequest { } static initialize(obj, projectId) { - obj["project_id"] = projectId; + obj['project_id'] = projectId; } static constructFromObject(data, obj) { if (data) { obj = obj || new CreatePreferenceRequest(); - if (data.hasOwnProperty("project_id")) { - obj["project_id"] = ApiClient.convertToType( - data["project_id"], - "String" + if (data.hasOwnProperty('project_id')) { + obj['project_id'] = ApiClient.convertToType( + data['project_id'], + 'String' ); } } @@ -31,6 +31,6 @@ class CreatePreferenceRequest { } } -CreatePreferenceRequest.prototype["project_id"] = undefined; +CreatePreferenceRequest.prototype['project_id'] = undefined; export default CreatePreferenceRequest; diff --git a/src/model/ErrorResponse.js b/src/model/ErrorResponse.js index 5637020..57fa749 100644 --- a/src/model/ErrorResponse.js +++ b/src/model/ErrorResponse.js @@ -5,7 +5,7 @@ * Contact: developers@usepatch.com */ -import ApiClient from "../ApiClient"; +import ApiClient from '../ApiClient'; class ErrorResponse { constructor(success, error, data) { @@ -13,35 +13,35 @@ class ErrorResponse { } static initialize(obj, success, error, data) { - obj["success"] = success; - obj["error"] = error; - obj["data"] = data; + obj['success'] = success; + obj['error'] = error; + obj['data'] = data; } static constructFromObject(data, obj) { if (data) { obj = obj || new ErrorResponse(); - if (data.hasOwnProperty("success")) { - obj["success"] = ApiClient.convertToType(data["success"], "Boolean"); + if (data.hasOwnProperty('success')) { + obj['success'] = ApiClient.convertToType(data['success'], 'Boolean'); } - if (data.hasOwnProperty("error")) { - obj["error"] = ApiClient.convertToType(data["error"], Object); + if (data.hasOwnProperty('error')) { + obj['error'] = ApiClient.convertToType(data['error'], Object); } - if (data.hasOwnProperty("data")) { - obj["data"] = ApiClient.convertToType(data["data"], Object); + if (data.hasOwnProperty('data')) { + obj['data'] = ApiClient.convertToType(data['data'], Object); } } return obj; } } -ErrorResponse.prototype["success"] = undefined; +ErrorResponse.prototype['success'] = undefined; -ErrorResponse.prototype["error"] = undefined; +ErrorResponse.prototype['error'] = undefined; -ErrorResponse.prototype["data"] = undefined; +ErrorResponse.prototype['data'] = undefined; export default ErrorResponse; diff --git a/src/model/Estimate.js b/src/model/Estimate.js index 7fa705d..9de3be0 100644 --- a/src/model/Estimate.js +++ b/src/model/Estimate.js @@ -5,8 +5,8 @@ * Contact: developers@usepatch.com */ -import ApiClient from "../ApiClient"; -import Order from "./Order"; +import ApiClient from '../ApiClient'; +import Order from './Order'; class Estimate { constructor() { @@ -19,35 +19,35 @@ class Estimate { if (data) { obj = obj || new Estimate(); - if (data.hasOwnProperty("id")) { - obj["id"] = ApiClient.convertToType(data["id"], "String"); + if (data.hasOwnProperty('id')) { + obj['id'] = ApiClient.convertToType(data['id'], 'String'); } - if (data.hasOwnProperty("production")) { - obj["production"] = ApiClient.convertToType( - data["production"], - "Boolean" + if (data.hasOwnProperty('production')) { + obj['production'] = ApiClient.convertToType( + data['production'], + 'Boolean' ); } - if (data.hasOwnProperty("type")) { - obj["type"] = ApiClient.convertToType(data["type"], "String"); + if (data.hasOwnProperty('type')) { + obj['type'] = ApiClient.convertToType(data['type'], 'String'); } - if (data.hasOwnProperty("order")) { - obj["order"] = Order.constructFromObject(data["order"]); + if (data.hasOwnProperty('order')) { + obj['order'] = Order.constructFromObject(data['order']); } } return obj; } } -Estimate.prototype["id"] = undefined; +Estimate.prototype['id'] = undefined; -Estimate.prototype["production"] = undefined; +Estimate.prototype['production'] = undefined; -Estimate.prototype["type"] = undefined; +Estimate.prototype['type'] = undefined; -Estimate.prototype["order"] = undefined; +Estimate.prototype['order'] = undefined; export default Estimate; diff --git a/src/model/EstimateListResponse.js b/src/model/EstimateListResponse.js index 158ec1a..3e4e400 100644 --- a/src/model/EstimateListResponse.js +++ b/src/model/EstimateListResponse.js @@ -5,9 +5,9 @@ * Contact: developers@usepatch.com */ -import ApiClient from "../ApiClient"; -import Estimate from "./Estimate"; -import MetaIndexObject from "./MetaIndexObject"; +import ApiClient from '../ApiClient'; +import Estimate from './Estimate'; +import MetaIndexObject from './MetaIndexObject'; class EstimateListResponse { constructor(success, error, data, meta) { @@ -15,42 +15,42 @@ class EstimateListResponse { } static initialize(obj, success, error, data, meta) { - obj["success"] = success; - obj["error"] = error; - obj["data"] = data; - obj["meta"] = meta; + obj['success'] = success; + obj['error'] = error; + obj['data'] = data; + obj['meta'] = meta; } static constructFromObject(data, obj) { if (data) { obj = obj || new EstimateListResponse(); - if (data.hasOwnProperty("success")) { - obj["success"] = ApiClient.convertToType(data["success"], "Boolean"); + if (data.hasOwnProperty('success')) { + obj['success'] = ApiClient.convertToType(data['success'], 'Boolean'); } - if (data.hasOwnProperty("error")) { - obj["error"] = ApiClient.convertToType(data["error"], Object); + if (data.hasOwnProperty('error')) { + obj['error'] = ApiClient.convertToType(data['error'], Object); } - if (data.hasOwnProperty("data")) { - obj["data"] = ApiClient.convertToType(data["data"], [Estimate]); + if (data.hasOwnProperty('data')) { + obj['data'] = ApiClient.convertToType(data['data'], [Estimate]); } - if (data.hasOwnProperty("meta")) { - obj["meta"] = MetaIndexObject.constructFromObject(data["meta"]); + if (data.hasOwnProperty('meta')) { + obj['meta'] = MetaIndexObject.constructFromObject(data['meta']); } } return obj; } } -EstimateListResponse.prototype["success"] = undefined; +EstimateListResponse.prototype['success'] = undefined; -EstimateListResponse.prototype["error"] = undefined; +EstimateListResponse.prototype['error'] = undefined; -EstimateListResponse.prototype["data"] = undefined; +EstimateListResponse.prototype['data'] = undefined; -EstimateListResponse.prototype["meta"] = undefined; +EstimateListResponse.prototype['meta'] = undefined; export default EstimateListResponse; diff --git a/src/model/EstimateResponse.js b/src/model/EstimateResponse.js index ddfc401..e77ba7b 100644 --- a/src/model/EstimateResponse.js +++ b/src/model/EstimateResponse.js @@ -5,8 +5,8 @@ * Contact: developers@usepatch.com */ -import ApiClient from "../ApiClient"; -import Estimate from "./Estimate"; +import ApiClient from '../ApiClient'; +import Estimate from './Estimate'; class EstimateResponse { constructor(success, error, data) { @@ -14,35 +14,35 @@ class EstimateResponse { } static initialize(obj, success, error, data) { - obj["success"] = success; - obj["error"] = error; - obj["data"] = data; + obj['success'] = success; + obj['error'] = error; + obj['data'] = data; } static constructFromObject(data, obj) { if (data) { obj = obj || new EstimateResponse(); - if (data.hasOwnProperty("success")) { - obj["success"] = ApiClient.convertToType(data["success"], "Boolean"); + if (data.hasOwnProperty('success')) { + obj['success'] = ApiClient.convertToType(data['success'], 'Boolean'); } - if (data.hasOwnProperty("error")) { - obj["error"] = ApiClient.convertToType(data["error"], Object); + if (data.hasOwnProperty('error')) { + obj['error'] = ApiClient.convertToType(data['error'], Object); } - if (data.hasOwnProperty("data")) { - obj["data"] = Estimate.constructFromObject(data["data"]); + if (data.hasOwnProperty('data')) { + obj['data'] = Estimate.constructFromObject(data['data']); } } return obj; } } -EstimateResponse.prototype["success"] = undefined; +EstimateResponse.prototype['success'] = undefined; -EstimateResponse.prototype["error"] = undefined; +EstimateResponse.prototype['error'] = undefined; -EstimateResponse.prototype["data"] = undefined; +EstimateResponse.prototype['data'] = undefined; export default EstimateResponse; diff --git a/src/model/MetaIndexObject.js b/src/model/MetaIndexObject.js index 77c2a17..ac3aff9 100644 --- a/src/model/MetaIndexObject.js +++ b/src/model/MetaIndexObject.js @@ -5,7 +5,7 @@ * Contact: developers@usepatch.com */ -import ApiClient from "../ApiClient"; +import ApiClient from '../ApiClient'; class MetaIndexObject { constructor() { @@ -18,20 +18,20 @@ class MetaIndexObject { if (data) { obj = obj || new MetaIndexObject(); - if (data.hasOwnProperty("prev_page")) { - obj["prev_page"] = ApiClient.convertToType(data["prev_page"], "Number"); + if (data.hasOwnProperty('prev_page')) { + obj['prev_page'] = ApiClient.convertToType(data['prev_page'], 'Number'); } - if (data.hasOwnProperty("next_page")) { - obj["next_page"] = ApiClient.convertToType(data["next_page"], "Number"); + if (data.hasOwnProperty('next_page')) { + obj['next_page'] = ApiClient.convertToType(data['next_page'], 'Number'); } } return obj; } } -MetaIndexObject.prototype["prev_page"] = undefined; +MetaIndexObject.prototype['prev_page'] = undefined; -MetaIndexObject.prototype["next_page"] = undefined; +MetaIndexObject.prototype['next_page'] = undefined; export default MetaIndexObject; diff --git a/src/model/Order.js b/src/model/Order.js index 69b400e..a06bbb1 100644 --- a/src/model/Order.js +++ b/src/model/Order.js @@ -5,8 +5,8 @@ * Contact: developers@usepatch.com */ -import ApiClient from "../ApiClient"; -import Allocation from "./Allocation"; +import ApiClient from '../ApiClient'; +import Allocation from './Allocation'; class Order { constructor() { @@ -19,42 +19,42 @@ class Order { if (data) { obj = obj || new Order(); - if (data.hasOwnProperty("id")) { - obj["id"] = ApiClient.convertToType(data["id"], "String"); + if (data.hasOwnProperty('id')) { + obj['id'] = ApiClient.convertToType(data['id'], 'String'); } - if (data.hasOwnProperty("mass_g")) { - obj["mass_g"] = ApiClient.convertToType(data["mass_g"], "Number"); + if (data.hasOwnProperty('mass_g')) { + obj['mass_g'] = ApiClient.convertToType(data['mass_g'], 'Number'); } - if (data.hasOwnProperty("production")) { - obj["production"] = ApiClient.convertToType( - data["production"], - "Boolean" + if (data.hasOwnProperty('production')) { + obj['production'] = ApiClient.convertToType( + data['production'], + 'Boolean' ); } - if (data.hasOwnProperty("state")) { - obj["state"] = ApiClient.convertToType(data["state"], "String"); + if (data.hasOwnProperty('state')) { + obj['state'] = ApiClient.convertToType(data['state'], 'String'); } - if (data.hasOwnProperty("allocation_state")) { - obj["allocation_state"] = ApiClient.convertToType( - data["allocation_state"], - "String" + if (data.hasOwnProperty('allocation_state')) { + obj['allocation_state'] = ApiClient.convertToType( + data['allocation_state'], + 'String' ); } - if (data.hasOwnProperty("price_cents_usd")) { - obj["price_cents_usd"] = ApiClient.convertToType( - data["price_cents_usd"], - "String" + if (data.hasOwnProperty('price_cents_usd')) { + obj['price_cents_usd'] = ApiClient.convertToType( + data['price_cents_usd'], + 'String' ); } - if (data.hasOwnProperty("allocations")) { - obj["allocations"] = ApiClient.convertToType(data["allocations"], [ - Allocation, + if (data.hasOwnProperty('allocations')) { + obj['allocations'] = ApiClient.convertToType(data['allocations'], [ + Allocation ]); } } @@ -62,18 +62,18 @@ class Order { } } -Order.prototype["id"] = undefined; +Order.prototype['id'] = undefined; -Order.prototype["mass_g"] = undefined; +Order.prototype['mass_g'] = undefined; -Order.prototype["production"] = undefined; +Order.prototype['production'] = undefined; -Order.prototype["state"] = undefined; +Order.prototype['state'] = undefined; -Order.prototype["allocation_state"] = undefined; +Order.prototype['allocation_state'] = undefined; -Order.prototype["price_cents_usd"] = undefined; +Order.prototype['price_cents_usd'] = undefined; -Order.prototype["allocations"] = undefined; +Order.prototype['allocations'] = undefined; export default Order; diff --git a/src/model/OrderListResponse.js b/src/model/OrderListResponse.js index 108dc0c..05bd5aa 100644 --- a/src/model/OrderListResponse.js +++ b/src/model/OrderListResponse.js @@ -5,9 +5,9 @@ * Contact: developers@usepatch.com */ -import ApiClient from "../ApiClient"; -import MetaIndexObject from "./MetaIndexObject"; -import Order from "./Order"; +import ApiClient from '../ApiClient'; +import MetaIndexObject from './MetaIndexObject'; +import Order from './Order'; class OrderListResponse { constructor(success, error, data, meta) { @@ -15,42 +15,42 @@ class OrderListResponse { } static initialize(obj, success, error, data, meta) { - obj["success"] = success; - obj["error"] = error; - obj["data"] = data; - obj["meta"] = meta; + obj['success'] = success; + obj['error'] = error; + obj['data'] = data; + obj['meta'] = meta; } static constructFromObject(data, obj) { if (data) { obj = obj || new OrderListResponse(); - if (data.hasOwnProperty("success")) { - obj["success"] = ApiClient.convertToType(data["success"], "Boolean"); + if (data.hasOwnProperty('success')) { + obj['success'] = ApiClient.convertToType(data['success'], 'Boolean'); } - if (data.hasOwnProperty("error")) { - obj["error"] = ApiClient.convertToType(data["error"], Object); + if (data.hasOwnProperty('error')) { + obj['error'] = ApiClient.convertToType(data['error'], Object); } - if (data.hasOwnProperty("data")) { - obj["data"] = ApiClient.convertToType(data["data"], [Order]); + if (data.hasOwnProperty('data')) { + obj['data'] = ApiClient.convertToType(data['data'], [Order]); } - if (data.hasOwnProperty("meta")) { - obj["meta"] = MetaIndexObject.constructFromObject(data["meta"]); + if (data.hasOwnProperty('meta')) { + obj['meta'] = MetaIndexObject.constructFromObject(data['meta']); } } return obj; } } -OrderListResponse.prototype["success"] = undefined; +OrderListResponse.prototype['success'] = undefined; -OrderListResponse.prototype["error"] = undefined; +OrderListResponse.prototype['error'] = undefined; -OrderListResponse.prototype["data"] = undefined; +OrderListResponse.prototype['data'] = undefined; -OrderListResponse.prototype["meta"] = undefined; +OrderListResponse.prototype['meta'] = undefined; export default OrderListResponse; diff --git a/src/model/OrderResponse.js b/src/model/OrderResponse.js index ca17242..fee9623 100644 --- a/src/model/OrderResponse.js +++ b/src/model/OrderResponse.js @@ -5,8 +5,8 @@ * Contact: developers@usepatch.com */ -import ApiClient from "../ApiClient"; -import Order from "./Order"; +import ApiClient from '../ApiClient'; +import Order from './Order'; class OrderResponse { constructor(success, error, data) { @@ -14,35 +14,35 @@ class OrderResponse { } static initialize(obj, success, error, data) { - obj["success"] = success; - obj["error"] = error; - obj["data"] = data; + obj['success'] = success; + obj['error'] = error; + obj['data'] = data; } static constructFromObject(data, obj) { if (data) { obj = obj || new OrderResponse(); - if (data.hasOwnProperty("success")) { - obj["success"] = ApiClient.convertToType(data["success"], "Boolean"); + if (data.hasOwnProperty('success')) { + obj['success'] = ApiClient.convertToType(data['success'], 'Boolean'); } - if (data.hasOwnProperty("error")) { - obj["error"] = ApiClient.convertToType(data["error"], Object); + if (data.hasOwnProperty('error')) { + obj['error'] = ApiClient.convertToType(data['error'], Object); } - if (data.hasOwnProperty("data")) { - obj["data"] = Order.constructFromObject(data["data"]); + if (data.hasOwnProperty('data')) { + obj['data'] = Order.constructFromObject(data['data']); } } return obj; } } -OrderResponse.prototype["success"] = undefined; +OrderResponse.prototype['success'] = undefined; -OrderResponse.prototype["error"] = undefined; +OrderResponse.prototype['error'] = undefined; -OrderResponse.prototype["data"] = undefined; +OrderResponse.prototype['data'] = undefined; export default OrderResponse; diff --git a/src/model/Preference.js b/src/model/Preference.js index bb5c2d5..0a770ad 100644 --- a/src/model/Preference.js +++ b/src/model/Preference.js @@ -5,8 +5,8 @@ * Contact: developers@usepatch.com */ -import ApiClient from "../ApiClient"; -import Project from "./Project"; +import ApiClient from '../ApiClient'; +import Project from './Project'; class Preference { constructor() { @@ -19,29 +19,29 @@ class Preference { if (data) { obj = obj || new Preference(); - if (data.hasOwnProperty("id")) { - obj["id"] = ApiClient.convertToType(data["id"], "String"); + if (data.hasOwnProperty('id')) { + obj['id'] = ApiClient.convertToType(data['id'], 'String'); } - if (data.hasOwnProperty("allocation_percentage")) { - obj["allocation_percentage"] = ApiClient.convertToType( - data["allocation_percentage"], - "Number" + if (data.hasOwnProperty('allocation_percentage')) { + obj['allocation_percentage'] = ApiClient.convertToType( + data['allocation_percentage'], + 'Number' ); } - if (data.hasOwnProperty("project")) { - obj["project"] = Project.constructFromObject(data["project"]); + if (data.hasOwnProperty('project')) { + obj['project'] = Project.constructFromObject(data['project']); } } return obj; } } -Preference.prototype["id"] = undefined; +Preference.prototype['id'] = undefined; -Preference.prototype["allocation_percentage"] = undefined; +Preference.prototype['allocation_percentage'] = undefined; -Preference.prototype["project"] = undefined; +Preference.prototype['project'] = undefined; export default Preference; diff --git a/src/model/PreferenceListResponse.js b/src/model/PreferenceListResponse.js index e00a5d8..48fc6d8 100644 --- a/src/model/PreferenceListResponse.js +++ b/src/model/PreferenceListResponse.js @@ -5,9 +5,9 @@ * Contact: developers@usepatch.com */ -import ApiClient from "../ApiClient"; -import MetaIndexObject from "./MetaIndexObject"; -import Preference from "./Preference"; +import ApiClient from '../ApiClient'; +import MetaIndexObject from './MetaIndexObject'; +import Preference from './Preference'; class PreferenceListResponse { constructor(success, error, data, meta) { @@ -15,42 +15,42 @@ class PreferenceListResponse { } static initialize(obj, success, error, data, meta) { - obj["success"] = success; - obj["error"] = error; - obj["data"] = data; - obj["meta"] = meta; + obj['success'] = success; + obj['error'] = error; + obj['data'] = data; + obj['meta'] = meta; } static constructFromObject(data, obj) { if (data) { obj = obj || new PreferenceListResponse(); - if (data.hasOwnProperty("success")) { - obj["success"] = ApiClient.convertToType(data["success"], "Boolean"); + if (data.hasOwnProperty('success')) { + obj['success'] = ApiClient.convertToType(data['success'], 'Boolean'); } - if (data.hasOwnProperty("error")) { - obj["error"] = ApiClient.convertToType(data["error"], Object); + if (data.hasOwnProperty('error')) { + obj['error'] = ApiClient.convertToType(data['error'], Object); } - if (data.hasOwnProperty("data")) { - obj["data"] = ApiClient.convertToType(data["data"], [Preference]); + if (data.hasOwnProperty('data')) { + obj['data'] = ApiClient.convertToType(data['data'], [Preference]); } - if (data.hasOwnProperty("meta")) { - obj["meta"] = MetaIndexObject.constructFromObject(data["meta"]); + if (data.hasOwnProperty('meta')) { + obj['meta'] = MetaIndexObject.constructFromObject(data['meta']); } } return obj; } } -PreferenceListResponse.prototype["success"] = undefined; +PreferenceListResponse.prototype['success'] = undefined; -PreferenceListResponse.prototype["error"] = undefined; +PreferenceListResponse.prototype['error'] = undefined; -PreferenceListResponse.prototype["data"] = undefined; +PreferenceListResponse.prototype['data'] = undefined; -PreferenceListResponse.prototype["meta"] = undefined; +PreferenceListResponse.prototype['meta'] = undefined; export default PreferenceListResponse; diff --git a/src/model/PreferenceResponse.js b/src/model/PreferenceResponse.js index 87549ba..1797e30 100644 --- a/src/model/PreferenceResponse.js +++ b/src/model/PreferenceResponse.js @@ -5,8 +5,8 @@ * Contact: developers@usepatch.com */ -import ApiClient from "../ApiClient"; -import Preference from "./Preference"; +import ApiClient from '../ApiClient'; +import Preference from './Preference'; class PreferenceResponse { constructor(success, error, data) { @@ -14,35 +14,35 @@ class PreferenceResponse { } static initialize(obj, success, error, data) { - obj["success"] = success; - obj["error"] = error; - obj["data"] = data; + obj['success'] = success; + obj['error'] = error; + obj['data'] = data; } static constructFromObject(data, obj) { if (data) { obj = obj || new PreferenceResponse(); - if (data.hasOwnProperty("success")) { - obj["success"] = ApiClient.convertToType(data["success"], "Boolean"); + if (data.hasOwnProperty('success')) { + obj['success'] = ApiClient.convertToType(data['success'], 'Boolean'); } - if (data.hasOwnProperty("error")) { - obj["error"] = ApiClient.convertToType(data["error"], Object); + if (data.hasOwnProperty('error')) { + obj['error'] = ApiClient.convertToType(data['error'], Object); } - if (data.hasOwnProperty("data")) { - obj["data"] = Preference.constructFromObject(data["data"]); + if (data.hasOwnProperty('data')) { + obj['data'] = Preference.constructFromObject(data['data']); } } return obj; } } -PreferenceResponse.prototype["success"] = undefined; +PreferenceResponse.prototype['success'] = undefined; -PreferenceResponse.prototype["error"] = undefined; +PreferenceResponse.prototype['error'] = undefined; -PreferenceResponse.prototype["data"] = undefined; +PreferenceResponse.prototype['data'] = undefined; export default PreferenceResponse; diff --git a/src/model/Project.js b/src/model/Project.js index c3eebbd..fabd7e5 100644 --- a/src/model/Project.js +++ b/src/model/Project.js @@ -5,7 +5,7 @@ * Contact: developers@usepatch.com */ -import ApiClient from "../ApiClient"; +import ApiClient from '../ApiClient'; class Project { constructor() { @@ -18,68 +18,68 @@ class Project { if (data) { obj = obj || new Project(); - if (data.hasOwnProperty("id")) { - obj["id"] = ApiClient.convertToType(data["id"], "String"); + if (data.hasOwnProperty('id')) { + obj['id'] = ApiClient.convertToType(data['id'], 'String'); } - if (data.hasOwnProperty("production")) { - obj["production"] = ApiClient.convertToType( - data["production"], - "Boolean" + if (data.hasOwnProperty('production')) { + obj['production'] = ApiClient.convertToType( + data['production'], + 'Boolean' ); } - if (data.hasOwnProperty("name")) { - obj["name"] = ApiClient.convertToType(data["name"], "String"); + if (data.hasOwnProperty('name')) { + obj['name'] = ApiClient.convertToType(data['name'], 'String'); } - if (data.hasOwnProperty("description")) { - obj["description"] = ApiClient.convertToType( - data["description"], - "String" + if (data.hasOwnProperty('description')) { + obj['description'] = ApiClient.convertToType( + data['description'], + 'String' ); } - if (data.hasOwnProperty("country")) { - obj["country"] = ApiClient.convertToType(data["country"], "String"); + if (data.hasOwnProperty('country')) { + obj['country'] = ApiClient.convertToType(data['country'], 'String'); } - if (data.hasOwnProperty("longitude")) { - obj["longitude"] = ApiClient.convertToType(data["longitude"], "Number"); + if (data.hasOwnProperty('longitude')) { + obj['longitude'] = ApiClient.convertToType(data['longitude'], 'Number'); } - if (data.hasOwnProperty("latitude")) { - obj["latitude"] = ApiClient.convertToType(data["latitude"], "Number"); + if (data.hasOwnProperty('latitude')) { + obj['latitude'] = ApiClient.convertToType(data['latitude'], 'Number'); } - if (data.hasOwnProperty("verifier")) { - obj["verifier"] = ApiClient.convertToType(data["verifier"], "String"); + if (data.hasOwnProperty('verifier')) { + obj['verifier'] = ApiClient.convertToType(data['verifier'], 'String'); } - if (data.hasOwnProperty("developer")) { - obj["developer"] = ApiClient.convertToType(data["developer"], "String"); + if (data.hasOwnProperty('developer')) { + obj['developer'] = ApiClient.convertToType(data['developer'], 'String'); } } return obj; } } -Project.prototype["id"] = undefined; +Project.prototype['id'] = undefined; -Project.prototype["production"] = undefined; +Project.prototype['production'] = undefined; -Project.prototype["name"] = undefined; +Project.prototype['name'] = undefined; -Project.prototype["description"] = undefined; +Project.prototype['description'] = undefined; -Project.prototype["country"] = undefined; +Project.prototype['country'] = undefined; -Project.prototype["longitude"] = undefined; +Project.prototype['longitude'] = undefined; -Project.prototype["latitude"] = undefined; +Project.prototype['latitude'] = undefined; -Project.prototype["verifier"] = undefined; +Project.prototype['verifier'] = undefined; -Project.prototype["developer"] = undefined; +Project.prototype['developer'] = undefined; export default Project; diff --git a/src/model/ProjectListResponse.js b/src/model/ProjectListResponse.js index 93d6607..a33dde2 100644 --- a/src/model/ProjectListResponse.js +++ b/src/model/ProjectListResponse.js @@ -5,9 +5,9 @@ * Contact: developers@usepatch.com */ -import ApiClient from "../ApiClient"; -import MetaIndexObject from "./MetaIndexObject"; -import Project from "./Project"; +import ApiClient from '../ApiClient'; +import MetaIndexObject from './MetaIndexObject'; +import Project from './Project'; class ProjectListResponse { constructor(success, error, data, meta) { @@ -15,42 +15,42 @@ class ProjectListResponse { } static initialize(obj, success, error, data, meta) { - obj["success"] = success; - obj["error"] = error; - obj["data"] = data; - obj["meta"] = meta; + obj['success'] = success; + obj['error'] = error; + obj['data'] = data; + obj['meta'] = meta; } static constructFromObject(data, obj) { if (data) { obj = obj || new ProjectListResponse(); - if (data.hasOwnProperty("success")) { - obj["success"] = ApiClient.convertToType(data["success"], "Boolean"); + if (data.hasOwnProperty('success')) { + obj['success'] = ApiClient.convertToType(data['success'], 'Boolean'); } - if (data.hasOwnProperty("error")) { - obj["error"] = ApiClient.convertToType(data["error"], Object); + if (data.hasOwnProperty('error')) { + obj['error'] = ApiClient.convertToType(data['error'], Object); } - if (data.hasOwnProperty("data")) { - obj["data"] = ApiClient.convertToType(data["data"], [Project]); + if (data.hasOwnProperty('data')) { + obj['data'] = ApiClient.convertToType(data['data'], [Project]); } - if (data.hasOwnProperty("meta")) { - obj["meta"] = MetaIndexObject.constructFromObject(data["meta"]); + if (data.hasOwnProperty('meta')) { + obj['meta'] = MetaIndexObject.constructFromObject(data['meta']); } } return obj; } } -ProjectListResponse.prototype["success"] = undefined; +ProjectListResponse.prototype['success'] = undefined; -ProjectListResponse.prototype["error"] = undefined; +ProjectListResponse.prototype['error'] = undefined; -ProjectListResponse.prototype["data"] = undefined; +ProjectListResponse.prototype['data'] = undefined; -ProjectListResponse.prototype["meta"] = undefined; +ProjectListResponse.prototype['meta'] = undefined; export default ProjectListResponse; diff --git a/src/model/ProjectResponse.js b/src/model/ProjectResponse.js index 7be07aa..8b6e12e 100644 --- a/src/model/ProjectResponse.js +++ b/src/model/ProjectResponse.js @@ -5,8 +5,8 @@ * Contact: developers@usepatch.com */ -import ApiClient from "../ApiClient"; -import Project from "./Project"; +import ApiClient from '../ApiClient'; +import Project from './Project'; class ProjectResponse { constructor(success, error, data) { @@ -14,35 +14,35 @@ class ProjectResponse { } static initialize(obj, success, error, data) { - obj["success"] = success; - obj["error"] = error; - obj["data"] = data; + obj['success'] = success; + obj['error'] = error; + obj['data'] = data; } static constructFromObject(data, obj) { if (data) { obj = obj || new ProjectResponse(); - if (data.hasOwnProperty("success")) { - obj["success"] = ApiClient.convertToType(data["success"], "Boolean"); + if (data.hasOwnProperty('success')) { + obj['success'] = ApiClient.convertToType(data['success'], 'Boolean'); } - if (data.hasOwnProperty("error")) { - obj["error"] = ApiClient.convertToType(data["error"], Object); + if (data.hasOwnProperty('error')) { + obj['error'] = ApiClient.convertToType(data['error'], Object); } - if (data.hasOwnProperty("data")) { - obj["data"] = Project.constructFromObject(data["data"]); + if (data.hasOwnProperty('data')) { + obj['data'] = Project.constructFromObject(data['data']); } } return obj; } } -ProjectResponse.prototype["success"] = undefined; +ProjectResponse.prototype['success'] = undefined; -ProjectResponse.prototype["error"] = undefined; +ProjectResponse.prototype['error'] = undefined; -ProjectResponse.prototype["data"] = undefined; +ProjectResponse.prototype['data'] = undefined; export default ProjectResponse; diff --git a/test/integration/estimates.spec.js b/test/integration/estimates.spec.js index fe3cee1..bcb379a 100644 --- a/test/integration/estimates.spec.js +++ b/test/integration/estimates.spec.js @@ -1,11 +1,11 @@ -import { expect } from "chai"; -import Patch from "../../dist/index"; +import { expect } from 'chai'; +import Patch from '../../dist/index'; const patch = Patch(process.env.SANDBOX_API_KEY); -describe("Estimates Integration", function () { - it("supports create, retrieve and list", async function () { +describe('Estimates Integration', function () { + it('supports create, retrieve and list', async function () { const createEstimateResponse = await patch.estimates.createMassEstimate({ - mass_g: 100, + mass_g: 100 }); const estimateId = createEstimateResponse.data.id; @@ -15,7 +15,7 @@ describe("Estimates Integration", function () { expect(retrieveEstimateResponse.data.id).to.equal(estimateId); const retrieveEstimatesResponse = await patch.estimates.retrieveEstimates({ - page: 1, + page: 1 }); expect(retrieveEstimatesResponse.data.length).to.be.above(0); }); diff --git a/test/integration/orders.test.js b/test/integration/orders.test.js index 4f21d26..d2c7c30 100644 --- a/test/integration/orders.test.js +++ b/test/integration/orders.test.js @@ -1,9 +1,9 @@ -import { expect } from "chai"; -import Patch from "../../dist/index"; +import { expect } from 'chai'; +import Patch from '../../dist/index'; const patch = Patch(process.env.SANDBOX_API_KEY); -describe("Orders Integration", function () { - it("supports create, place, cancel, retrieve and list", async function () { +describe('Orders Integration', function () { + it('supports create, place, cancel, retrieve and list', async function () { const createOrderResponse = await patch.orders.createOrder({ mass_g: 100 }); const orderId = createOrderResponse.data.id; @@ -11,30 +11,30 @@ describe("Orders Integration", function () { expect(retreiveOrderResponse.data.id).to.equal(orderId); const retrieveOrdersResponse = await patch.orders.retrieveOrders({ - page: 1, + page: 1 }); expect(retrieveOrdersResponse.data.length).to.be.above(0); }); - it("supports placing orders in a `draft` state", async function () { + it('supports placing orders in a `draft` state', async function () { const estimateResponse = await patch.estimates.createMassEstimate({ - mass_g: 100, + mass_g: 100 }); const orderId = estimateResponse.data.order.id; - expect(estimateResponse.data.order.state).to.equal("draft"); + expect(estimateResponse.data.order.state).to.equal('draft'); const placeOrderResponse = await patch.orders.placeOrder(orderId); - expect(placeOrderResponse.data.state).to.equal("placed"); + expect(placeOrderResponse.data.state).to.equal('placed'); }); - it("supports cancelling orders in a `draft` state", async function () { + it('supports cancelling orders in a `draft` state', async function () { const estimateResponse = await patch.estimates.createMassEstimate({ - mass_g: 100, + mass_g: 100 }); const orderId = estimateResponse.data.order.id; - expect(estimateResponse.data.order.state).to.equal("draft"); + expect(estimateResponse.data.order.state).to.equal('draft'); const placeOrderResponse = await patch.orders.cancelOrder(orderId); - expect(placeOrderResponse.data.state).to.equal("cancelled"); + expect(placeOrderResponse.data.state).to.equal('cancelled'); }); }); diff --git a/test/integration/preferences.test.js b/test/integration/preferences.test.js index 9b4f961..c0e5f38 100644 --- a/test/integration/preferences.test.js +++ b/test/integration/preferences.test.js @@ -1,16 +1,33 @@ -import { expect } from "chai"; -import Patch from "../../dist/index"; +import { expect } from 'chai'; +import Patch from '../../dist/index'; const patch = Patch(process.env.SANDBOX_API_KEY); -describe("Preferences Integration", function () { - it("supports create, delete, retrieve and list", async function () { +describe('Preferences Integration', function () { + it('supports create, delete, retrieve and list', async function () { const projectResponse = await patch.projects.retrieveProjects(); expect(projectResponse.data.length).to.be.above(0); const projectId = projectResponse.data[0].id; - const createPreferenceResponse = await patch.preferences.createPreference({ - project_id: projectId, - }); + let createPreferenceResponse; + + try { + createPreferenceResponse = await patch.preferences.createPreference({ + project_id: projectId + }); + } catch ({ error }) { + // If there's a preference that exists already + if (error.code === 422) { + // Delete the preference + await patch.preferences.deletePreference( + (await patch.preferences.retrievePreferences()).data[0].id + ); + + createPreferenceResponse = await patch.preferences.createPreference({ + project_id: projectId + }); + } + } + const preferenceId = createPreferenceResponse.data.id; const retrievePreferenceResponse = await patch.preferences.retrievePreference( preferenceId diff --git a/test/integration/projects.test.js b/test/integration/projects.test.js index 60c210e..f905a79 100644 --- a/test/integration/projects.test.js +++ b/test/integration/projects.test.js @@ -1,14 +1,14 @@ -import { expect } from "chai"; -import Patch from "../../dist/index"; +import { expect } from 'chai'; +import Patch from '../../dist/index'; const patch = Patch(process.env.SANDBOX_API_KEY); -describe("Project Integration", function () { - it("supports fetching the available projects", async function () { +describe('Project Integration', function () { + it('supports fetching the available projects', async function () { const { data } = await patch.projects.retrieveProjects(); expect(data.length).to.be.above(0); }); - it("supports fetching a single project", async function () { + it('supports fetching a single project', async function () { const { data } = await patch.projects.retrieveProjects(); const projectId = data[0].id; const projectResponse = await patch.projects.retrieveProject(projectId); From 2fc81c3dcd687e6e8b35516a1665b24781475493 Mon Sep 17 00:00:00 2001 From: Brennan Spellacy Date: Thu, 30 Jul 2020 16:22:03 -0700 Subject: [PATCH 04/10] Update README.md Co-authored-by: Thiago Araujo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b265d15..86f131a 100644 --- a/README.md +++ b/README.md @@ -135,5 +135,5 @@ patch.preferences.delete_preference(preferenceId); // Retrieve a list of preferences const page = 1; // Pass in which page of preferences you'd like -patch.preferences.retrieve_preferences({ page }); +patch.preferences.retrievePreferences({ page }); ``` From 3942f54dbd955bb0e1efe98fa89b124d2cf88196 Mon Sep 17 00:00:00 2001 From: Brennan Spellacy Date: Thu, 30 Jul 2020 16:22:11 -0700 Subject: [PATCH 05/10] Update README.md Co-authored-by: Thiago Araujo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 86f131a..3e90932 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,7 @@ patch.preferences.retrieve_preference(preferenceId); // Delete a preference const preferenceId = 'pre_test_1234'; // Pass in the preferences's id -patch.preferences.delete_preference(preferenceId); +patch.preferences.deletePreference(preferenceId); // Retrieve a list of preferences const page = 1; // Pass in which page of preferences you'd like From 245950809591a0ea1a7159d174bbde2dfbfe1446 Mon Sep 17 00:00:00 2001 From: Brennan Spellacy Date: Thu, 30 Jul 2020 16:22:18 -0700 Subject: [PATCH 06/10] Update README.md Co-authored-by: Thiago Araujo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3e90932..7678c39 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,7 @@ patch.preferences.create_preference((project_id: projectId)); // Retrieve a preference const preferenceId = 'pre_test_1234'; // Pass in the preferences's id -patch.preferences.retrieve_preference(preferenceId); +patch.preferences.retrievePreference(preferenceId); // Delete a preference const preferenceId = 'pre_test_1234'; // Pass in the preferences's id From 8d4d3b1a32f1b28c274491bd3ae4282a454ee3c1 Mon Sep 17 00:00:00 2001 From: Brennan Spellacy Date: Thu, 30 Jul 2020 16:22:25 -0700 Subject: [PATCH 07/10] Update README.md Co-authored-by: Thiago Araujo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7678c39..2266739 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,7 @@ Preferences are how you route your orders in Patch. If you don't have a preferen ```javascript // Create a preference const projectId = 'pro_test_1234'; // Pass in the project_id for your preference -patch.preferences.create_preference((project_id: projectId)); +patch.preferences.createPreference((project_id: projectId)); // Retrieve a preference const preferenceId = 'pre_test_1234'; // Pass in the preferences's id From 750a95cdf32f45d47b80c34cc23337fd4151a41f Mon Sep 17 00:00:00 2001 From: Brennan Spellacy Date: Thu, 30 Jul 2020 16:22:30 -0700 Subject: [PATCH 08/10] Update README.md Co-authored-by: Thiago Araujo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2266739..b45820d 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ Projects are the ways Patch takes CO2 out of the air. They can represent refores ```javascript // Retrieve a project const project_id = 'pro_test_1234'; // Pass in the project's ID -patch.projects.retrieveProject(project_id); +patch.projects.retrieveProject(projectId); // Retrieve a list of projects const page = 1; // Pass in which page of projects you'd like From 9008708a0ba9f894c4da27596b138743511a8f36 Mon Sep 17 00:00:00 2001 From: Brennan Spellacy Date: Thu, 30 Jul 2020 16:22:37 -0700 Subject: [PATCH 09/10] Update README.md Co-authored-by: Thiago Araujo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b45820d..9ad34bf 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ Projects are the ways Patch takes CO2 out of the air. They can represent refores ```javascript // Retrieve a project -const project_id = 'pro_test_1234'; // Pass in the project's ID +const projectId = 'pro_test_1234'; // Pass in the project's ID patch.projects.retrieveProject(projectId); // Retrieve a list of projects From 88aa7169a1f9e0bdfb0a1bc569058bb4199c87b1 Mon Sep 17 00:00:00 2001 From: Brennan Spellacy Date: Thu, 30 Jul 2020 16:22:53 -0700 Subject: [PATCH 10/10] Update README.md Co-authored-by: Thiago Araujo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9ad34bf..d6938f2 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,7 @@ patch.projects.retrieveProject(projectId); // Retrieve a list of projects const page = 1; // Pass in which page of projects you'd like -patch.projects.retrieve_projects({ page }); +patch.projects.retrieveProjects({ page }); ``` ### Preferences