@veritree/services 1.1.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2 -0
- package/package.json +1 -1
- package/src/endpoints/bulk-uploads.js +5 -0
- package/src/endpoints/images.js +11 -2
- package/src/helpers/api.js +6 -6
package/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BulkUploads } from './src/endpoints/bulk-uploads';
|
|
1
2
|
import { Countries } from './src/endpoints/countries';
|
|
2
3
|
import { FieldUpdates } from './src/endpoints/field-updates';
|
|
3
4
|
import { FieldUpdateVerifications } from './src/endpoints/field-udpate-verifications';
|
|
@@ -20,6 +21,7 @@ import { TreeOrders } from './src/endpoints/trees-orders';
|
|
|
20
21
|
import { User } from './src/endpoints/user';
|
|
21
22
|
|
|
22
23
|
export {
|
|
24
|
+
BulkUploads,
|
|
23
25
|
Countries,
|
|
24
26
|
FieldUpdates,
|
|
25
27
|
FieldUpdateVerifications,
|
package/package.json
CHANGED
package/src/endpoints/images.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import Api from "../helpers/api";
|
|
2
|
+
import Relations from "../helpers/relations";
|
|
3
|
+
class ImagesApi extends Api {
|
|
4
|
+
constructor(resource) {
|
|
5
|
+
super(resource);
|
|
6
|
+
this.resource = "images";
|
|
7
|
+
}
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
relation(prefix, id) {
|
|
10
|
+
return Relations(this, prefix, id);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
4
13
|
|
|
5
|
-
export const Images = new
|
|
14
|
+
export const Images = new ImagesApi();
|
package/src/helpers/api.js
CHANGED
|
@@ -90,8 +90,8 @@ export default class Api {
|
|
|
90
90
|
* @param {object} data
|
|
91
91
|
* @returns {promise}
|
|
92
92
|
*/
|
|
93
|
-
async create(data) {
|
|
94
|
-
return await this.post(null, data);
|
|
93
|
+
async create(data, args) {
|
|
94
|
+
return await this.post(null, data, args);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
/**
|
|
@@ -101,8 +101,8 @@ export default class Api {
|
|
|
101
101
|
* @param {string} as - 'put' // necessary for updates because of how Laravel handles PUT requests
|
|
102
102
|
* @returns {promise}
|
|
103
103
|
*/
|
|
104
|
-
async update(id, data, as = "put") {
|
|
105
|
-
const url = `${this.getUrl(id)}${this.getUrlParams()}`;
|
|
104
|
+
async update(id, data, as = "put", args) {
|
|
105
|
+
const url = `${this.getUrl(id)}${this.getUrlParams(args)}`;
|
|
106
106
|
return await this.post(url, data, as);
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -113,8 +113,8 @@ export default class Api {
|
|
|
113
113
|
* @param {string} as - 'put' // necessary for updates because of how Laravel handles PUT requests
|
|
114
114
|
* @returns {promise}
|
|
115
115
|
*/
|
|
116
|
-
async delete(id) {
|
|
117
|
-
const url = `${this.getUrl(id)}${this.getUrlParams()}`;
|
|
116
|
+
async delete(id, args) {
|
|
117
|
+
const url = `${this.getUrl(id)}${this.getUrlParams(args)}`;
|
|
118
118
|
return await this.post(url, null, "delete");
|
|
119
119
|
}
|
|
120
120
|
|