From 3f9ae48b4480737ad00d247eaf9ee0500e6f9e6d Mon Sep 17 00:00:00 2001 From: Paul Cothenet Date: Wed, 2 Feb 2022 16:14:41 -0800 Subject: [PATCH] Remove unused preferences files + README (#58) * Clean-up preferences * Update PR template --- .github/PULL_REQUEST_TEMPLATE.md | 1 + README.md | 26 -------------------- package-lock.json | 4 ++-- package.json | 2 +- src/ApiClient.js | 2 +- src/model/CreatePreferenceRequest.js | 36 ---------------------------- 6 files changed, 5 insertions(+), 66 deletions(-) delete mode 100644 src/model/CreatePreferenceRequest.js diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 7535225..535d538 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -12,4 +12,5 @@ - [ ] Have you built the package locally and made queries against it successfully? - [ ] Did you update the changelog? - [ ] Did you bump the package version? +- [ ] If endpoints were removed, did you manually remove the corresponding files? (this should be rare) - [ ] For breaking changes, did you plan for the release of the new SDK versions and deploy the API to production? diff --git a/README.md b/README.md index ef9be79..1c52072 100644 --- a/README.md +++ b/README.md @@ -179,32 +179,6 @@ const minimumAvailableMass = 100; // Pass in the minimum available inventory the patch.projects.retrieveProjects({ minimumAvailableMass }); ``` -### 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.patch.io/projects). - -[API Reference](https://docs.patch.io/#/?id=preferences) - -#### Examples - -```javascript -// Create a preference -const projectId = 'pro_test_1234'; // Pass in the project_id for your preference -patch.preferences.createPreference({ project_id: projectId }); - -// Retrieve a preference -const preferenceId = 'pre_test_1234'; // Pass in the preferences's id -patch.preferences.retrievePreference(preferenceId); - -// Delete a preference -const preferenceId = 'pre_test_1234'; // Pass in the preferences's id -patch.preferences.deletePreference(preferenceId); - -// Retrieve a list of preferences -const page = 1; // Pass in which page of preferences you'd like -patch.preferences.retrievePreferences({ page }); -``` - ## Contributing While we value open-source contributions to this SDK, the core of this library is generated programmatically. Complex additions made directly to the library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us! diff --git a/package-lock.json b/package-lock.json index b6af6fc..a344097 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@patch-technology/patch", - "version": "1.17.0", + "version": "1.17.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@patch-technology/patch", - "version": "1.17.0", + "version": "1.17.1", "license": "MIT", "dependencies": { "query-string": "^7.0.1", diff --git a/package.json b/package.json index e2e74a1..6a01430 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@patch-technology/patch", - "version": "1.17.0", + "version": "1.17.1", "description": "Node.js wrapper for the Patch API", "license": "MIT", "repository": { diff --git a/src/ApiClient.js b/src/ApiClient.js index e6f9d1e..7bd496a 100644 --- a/src/ApiClient.js +++ b/src/ApiClient.js @@ -16,7 +16,7 @@ class ApiClient { }; this.defaultHeaders = { - 'User-Agent': 'patch-node/1.17.0' + 'User-Agent': 'patch-node/1.17.1' }; /** diff --git a/src/model/CreatePreferenceRequest.js b/src/model/CreatePreferenceRequest.js deleted file mode 100644 index 5c0f2fc..0000000 --- a/src/model/CreatePreferenceRequest.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Patch API V1 - * The core API used to integrate with Patch's service - * - * Contact: developers@usepatch.com - */ - -import ApiClient from '../ApiClient'; - -class CreatePreferenceRequest { - 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' - ); - } - } - return obj; - } -} - -CreatePreferenceRequest.prototype['project_id'] = undefined; - -export default CreatePreferenceRequest;