@internxt/sdk 1.5.25 → 1.6.4
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/dist/auth/index.d.ts +127 -122
- package/dist/auth/index.js +378 -310
- package/dist/auth/types.d.ts +65 -54
- package/dist/auth/types.js +26 -26
- package/dist/drive/backups/index.d.ts +18 -18
- package/dist/drive/backups/index.js +40 -40
- package/dist/drive/backups/types.d.ts +27 -27
- package/dist/drive/backups/types.js +2 -2
- package/dist/drive/index.d.ts +7 -7
- package/dist/drive/index.js +23 -19
- package/dist/drive/payments/index.d.ts +66 -71
- package/dist/drive/payments/index.js +206 -208
- package/dist/drive/payments/types.d.ts +180 -176
- package/dist/drive/payments/types.js +37 -37
- package/dist/drive/referrals/index.d.ts +19 -19
- package/dist/drive/referrals/index.js +54 -50
- package/dist/drive/referrals/types.d.ts +21 -21
- package/dist/drive/referrals/types.js +18 -18
- package/dist/drive/share/index.d.ts +319 -319
- package/dist/drive/share/index.js +544 -540
- package/dist/drive/share/types.d.ts +360 -360
- package/dist/drive/share/types.js +2 -2
- package/dist/drive/storage/index.d.ts +315 -315
- package/dist/drive/storage/index.js +634 -630
- package/dist/drive/storage/types.d.ts +480 -473
- package/dist/drive/storage/types.js +13 -13
- package/dist/drive/trash/index.d.ts +75 -75
- package/dist/drive/trash/index.js +184 -180
- package/dist/drive/trash/types.d.ts +29 -29
- package/dist/drive/trash/types.js +2 -2
- package/dist/drive/users/index.d.ts +135 -135
- package/dist/drive/users/index.js +208 -204
- package/dist/drive/users/types.d.ts +53 -51
- package/dist/drive/users/types.js +2 -2
- package/dist/index.d.ts +6 -6
- package/dist/index.js +35 -31
- package/dist/network/download.d.ts +8 -8
- package/dist/network/download.js +123 -123
- package/dist/network/errors/codes.d.ts +24 -24
- package/dist/network/errors/codes.js +48 -48
- package/dist/network/errors/context.d.ts +35 -35
- package/dist/network/errors/context.js +39 -39
- package/dist/network/errors/download.d.ts +4 -4
- package/dist/network/errors/download.js +52 -48
- package/dist/network/errors/index.d.ts +3 -3
- package/dist/network/errors/index.js +19 -15
- package/dist/network/errors/upload.d.ts +13 -13
- package/dist/network/errors/upload.js +82 -78
- package/dist/network/index.d.ts +70 -70
- package/dist/network/index.js +315 -311
- package/dist/network/types.d.ts +102 -102
- package/dist/network/types.js +18 -18
- package/dist/network/upload.d.ts +4 -4
- package/dist/network/upload.js +158 -159
- package/dist/photos/devices/index.d.ts +10 -10
- package/dist/photos/devices/index.js +79 -79
- package/dist/photos/index.d.ts +17 -17
- package/dist/photos/index.js +56 -52
- package/dist/photos/photos/index.d.ts +60 -60
- package/dist/photos/photos/index.js +225 -225
- package/dist/photos/shares/index.d.ts +8 -8
- package/dist/photos/shares/index.js +34 -34
- package/dist/photos/types.d.ts +154 -154
- package/dist/photos/types.js +19 -19
- package/dist/photos/users/index.d.ts +7 -7
- package/dist/photos/users/index.js +46 -46
- package/dist/shared/headers/index.d.ts +21 -21
- package/dist/shared/headers/index.js +78 -79
- package/dist/shared/http/client.d.ts +85 -85
- package/dist/shared/http/client.js +172 -172
- package/dist/shared/http/types.d.ts +7 -7
- package/dist/shared/http/types.js +2 -2
- package/dist/shared/index.d.ts +1 -1
- package/dist/shared/index.js +17 -13
- package/dist/shared/types/apiConnection.d.ts +12 -12
- package/dist/shared/types/apiConnection.js +2 -2
- package/dist/shared/types/appsumo.d.ts +16 -16
- package/dist/shared/types/appsumo.js +12 -12
- package/dist/shared/types/errors.d.ts +5 -5
- package/dist/shared/types/errors.js +28 -28
- package/dist/shared/types/teams.d.ts +9 -9
- package/dist/shared/types/teams.js +2 -2
- package/dist/shared/types/userSettings.d.ts +43 -29
- package/dist/shared/types/userSettings.js +2 -2
- package/dist/utils.d.ts +3 -3
- package/dist/utils.js +24 -25
- package/dist/workspaces/index.d.ts +176 -176
- package/dist/workspaces/index.js +419 -415
- package/dist/workspaces/index.test.d.ts +1 -1
- package/dist/workspaces/index.test.js +908 -903
- package/dist/workspaces/types.d.ts +294 -291
- package/dist/workspaces/types.js +2 -2
- package/package.json +13 -13
|
@@ -1,225 +1,225 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
var axios_1 = __importDefault(require("axios"));
|
|
18
|
-
var query_string_1 = __importDefault(require("query-string"));
|
|
19
|
-
var utils_1 = require("../../utils");
|
|
20
|
-
var PhotosSubmodule = /** @class */ (function () {
|
|
21
|
-
function PhotosSubmodule(model) {
|
|
22
|
-
this.model = model;
|
|
23
|
-
}
|
|
24
|
-
PhotosSubmodule.prototype.getPhotoById = function (photoId) {
|
|
25
|
-
var _this = this;
|
|
26
|
-
return axios_1.default
|
|
27
|
-
.get(this.model.baseUrl
|
|
28
|
-
headers: {
|
|
29
|
-
Authorization: "Bearer "
|
|
30
|
-
},
|
|
31
|
-
})
|
|
32
|
-
.then(function (res) { return _this.parse(res.data); })
|
|
33
|
-
.catch(function (err) {
|
|
34
|
-
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
PhotosSubmodule.prototype.getPhotosSorted = function (filter, sort, skip, limit, includeDownloadLinks) {
|
|
38
|
-
var _this = this;
|
|
39
|
-
var query = query_string_1.default.stringify(__assign(__assign(__assign(__assign({}, filter), { skip: skip, limit: limit }), sort), { includeDownloadLinks: includeDownloadLinks === true }));
|
|
40
|
-
if (skip < 0) {
|
|
41
|
-
throw new Error('Invalid skip. Skip should be positive. Provided skip was: ' + skip);
|
|
42
|
-
}
|
|
43
|
-
return axios_1.default
|
|
44
|
-
.get(this.model.baseUrl
|
|
45
|
-
headers: {
|
|
46
|
-
Authorization: "Bearer "
|
|
47
|
-
},
|
|
48
|
-
})
|
|
49
|
-
.then(function (res) { return ({
|
|
50
|
-
results: res.data.results.map(function (photoJson) { return _this.parse(photoJson); }),
|
|
51
|
-
bucketId: res.data.bucketId,
|
|
52
|
-
}); })
|
|
53
|
-
.catch(function (err) {
|
|
54
|
-
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
PhotosSubmodule.prototype.getPhotos = function (filter, skip, limit, includeDownloadLinks) {
|
|
58
|
-
var _this = this;
|
|
59
|
-
if (skip === void 0) { skip = 0; }
|
|
60
|
-
if (limit === void 0) { limit = 1; }
|
|
61
|
-
var query = query_string_1.default.stringify(__assign(__assign({}, filter), { skip: skip, limit: limit, includeDownloadLinks: includeDownloadLinks }));
|
|
62
|
-
if (skip < 0) {
|
|
63
|
-
throw new Error('Invalid skip. Skip should be positive. Provided skip was: ' + skip);
|
|
64
|
-
}
|
|
65
|
-
return axios_1.default
|
|
66
|
-
.get(this.model.baseUrl
|
|
67
|
-
headers: {
|
|
68
|
-
Authorization: "Bearer "
|
|
69
|
-
},
|
|
70
|
-
})
|
|
71
|
-
.then(function (res) { return ({
|
|
72
|
-
results: res.data.results.map(function (photoJson) { return _this.parse(photoJson); }),
|
|
73
|
-
bucketId: res.data.bucketId,
|
|
74
|
-
}); })
|
|
75
|
-
.catch(function (err) {
|
|
76
|
-
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
PhotosSubmodule.prototype.createPhoto = function (data) {
|
|
80
|
-
var _this = this;
|
|
81
|
-
return axios_1.default
|
|
82
|
-
.post(this.model.baseUrl
|
|
83
|
-
headers: {
|
|
84
|
-
Authorization: "Bearer "
|
|
85
|
-
},
|
|
86
|
-
})
|
|
87
|
-
.then(function (res) { return _this.parse(res.data); })
|
|
88
|
-
.catch(function (err) {
|
|
89
|
-
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
PhotosSubmodule.prototype.findOrCreatePhoto = function (data) {
|
|
93
|
-
var _this = this;
|
|
94
|
-
return axios_1.default
|
|
95
|
-
.post(this.model.baseUrl
|
|
96
|
-
headers: {
|
|
97
|
-
Authorization: "Bearer "
|
|
98
|
-
},
|
|
99
|
-
})
|
|
100
|
-
.then(function (res) { return _this.parse(res.data); })
|
|
101
|
-
.catch(function (err) {
|
|
102
|
-
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
PhotosSubmodule.prototype.deletePhotosById = function (photos) {
|
|
106
|
-
return axios_1.default
|
|
107
|
-
.delete(this.model.baseUrl
|
|
108
|
-
headers: {
|
|
109
|
-
Authorization: "Bearer "
|
|
110
|
-
},
|
|
111
|
-
data: {
|
|
112
|
-
photos: photos,
|
|
113
|
-
},
|
|
114
|
-
})
|
|
115
|
-
.then(function () { return undefined; })
|
|
116
|
-
.catch(function (err) {
|
|
117
|
-
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
PhotosSubmodule.prototype.deletePhotoById = function (photoId) {
|
|
121
|
-
return axios_1.default
|
|
122
|
-
.delete(this.model.baseUrl
|
|
123
|
-
headers: {
|
|
124
|
-
Authorization: "Bearer "
|
|
125
|
-
},
|
|
126
|
-
})
|
|
127
|
-
.then(function () { return undefined; })
|
|
128
|
-
.catch(function (err) {
|
|
129
|
-
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
130
|
-
});
|
|
131
|
-
};
|
|
132
|
-
PhotosSubmodule.prototype.trashPhotosById = function (photos) {
|
|
133
|
-
return axios_1.default
|
|
134
|
-
.post(this.model.baseUrl
|
|
135
|
-
photos: photos,
|
|
136
|
-
}, {
|
|
137
|
-
headers: {
|
|
138
|
-
Authorization: "Bearer "
|
|
139
|
-
},
|
|
140
|
-
})
|
|
141
|
-
.then(function () { return undefined; })
|
|
142
|
-
.catch(function (err) {
|
|
143
|
-
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
144
|
-
});
|
|
145
|
-
};
|
|
146
|
-
PhotosSubmodule.prototype.trashPhotoById = function (photoId) {
|
|
147
|
-
return axios_1.default
|
|
148
|
-
.post(this.model.baseUrl
|
|
149
|
-
headers: {
|
|
150
|
-
Authorization: "Bearer "
|
|
151
|
-
},
|
|
152
|
-
})
|
|
153
|
-
.then(function () { return undefined; })
|
|
154
|
-
.catch(function (err) {
|
|
155
|
-
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
156
|
-
});
|
|
157
|
-
};
|
|
158
|
-
PhotosSubmodule.prototype.getUsage = function () {
|
|
159
|
-
return axios_1.default
|
|
160
|
-
.get(this.model.baseUrl
|
|
161
|
-
headers: {
|
|
162
|
-
Authorization: "Bearer "
|
|
163
|
-
},
|
|
164
|
-
})
|
|
165
|
-
.then(function (result) {
|
|
166
|
-
return result.data;
|
|
167
|
-
})
|
|
168
|
-
.catch(function (err) {
|
|
169
|
-
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
170
|
-
});
|
|
171
|
-
};
|
|
172
|
-
PhotosSubmodule.prototype.photosExists = function (photosExistPayload) {
|
|
173
|
-
var _this = this;
|
|
174
|
-
return axios_1.default
|
|
175
|
-
.post(this.model.baseUrl
|
|
176
|
-
headers: {
|
|
177
|
-
Authorization: "Bearer "
|
|
178
|
-
},
|
|
179
|
-
})
|
|
180
|
-
.then(function (res) {
|
|
181
|
-
return res.data.photos.map(function (result) {
|
|
182
|
-
if ('id' in result) {
|
|
183
|
-
return __assign(__assign({}, _this.parse(result)), { exists: true });
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
return __assign(__assign({}, result), { takenAt: new Date(result.takenAt) });
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
})
|
|
190
|
-
.catch(function (err) {
|
|
191
|
-
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
192
|
-
});
|
|
193
|
-
};
|
|
194
|
-
PhotosSubmodule.prototype.updatePhoto = function (photoId, data) {
|
|
195
|
-
return axios_1.default
|
|
196
|
-
.patch(this.model.baseUrl
|
|
197
|
-
headers: {
|
|
198
|
-
Authorization: "Bearer "
|
|
199
|
-
},
|
|
200
|
-
})
|
|
201
|
-
.then(function (result) {
|
|
202
|
-
return result.data;
|
|
203
|
-
})
|
|
204
|
-
.catch(function (err) {
|
|
205
|
-
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
206
|
-
});
|
|
207
|
-
};
|
|
208
|
-
PhotosSubmodule.prototype.getCount = function () {
|
|
209
|
-
return axios_1.default
|
|
210
|
-
.get(this.model.baseUrl
|
|
211
|
-
headers: {
|
|
212
|
-
Authorization: "Bearer "
|
|
213
|
-
},
|
|
214
|
-
})
|
|
215
|
-
.then(function (result) { return result.data; })
|
|
216
|
-
.catch(function (err) {
|
|
217
|
-
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
218
|
-
});
|
|
219
|
-
};
|
|
220
|
-
PhotosSubmodule.prototype.parse = function (json) {
|
|
221
|
-
return __assign(__assign({}, json), { takenAt: new Date(json.takenAt), statusChangedAt: new Date(json.statusChangedAt), createdAt: new Date(json.createdAt), updatedAt: new Date(json.updatedAt) });
|
|
222
|
-
};
|
|
223
|
-
return PhotosSubmodule;
|
|
224
|
-
}());
|
|
225
|
-
exports.default = PhotosSubmodule;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
var axios_1 = __importDefault(require("axios"));
|
|
18
|
+
var query_string_1 = __importDefault(require("query-string"));
|
|
19
|
+
var utils_1 = require("../../utils");
|
|
20
|
+
var PhotosSubmodule = /** @class */ (function () {
|
|
21
|
+
function PhotosSubmodule(model) {
|
|
22
|
+
this.model = model;
|
|
23
|
+
}
|
|
24
|
+
PhotosSubmodule.prototype.getPhotoById = function (photoId) {
|
|
25
|
+
var _this = this;
|
|
26
|
+
return axios_1.default
|
|
27
|
+
.get("".concat(this.model.baseUrl, "/photos/").concat(photoId), {
|
|
28
|
+
headers: {
|
|
29
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
.then(function (res) { return _this.parse(res.data); })
|
|
33
|
+
.catch(function (err) {
|
|
34
|
+
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
PhotosSubmodule.prototype.getPhotosSorted = function (filter, sort, skip, limit, includeDownloadLinks) {
|
|
38
|
+
var _this = this;
|
|
39
|
+
var query = query_string_1.default.stringify(__assign(__assign(__assign(__assign({}, filter), { skip: skip, limit: limit }), sort), { includeDownloadLinks: includeDownloadLinks === true }));
|
|
40
|
+
if (skip < 0) {
|
|
41
|
+
throw new Error('Invalid skip. Skip should be positive. Provided skip was: ' + skip);
|
|
42
|
+
}
|
|
43
|
+
return axios_1.default
|
|
44
|
+
.get("".concat(this.model.baseUrl, "/photos/sorted?").concat(query), {
|
|
45
|
+
headers: {
|
|
46
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
47
|
+
},
|
|
48
|
+
})
|
|
49
|
+
.then(function (res) { return ({
|
|
50
|
+
results: res.data.results.map(function (photoJson) { return _this.parse(photoJson); }),
|
|
51
|
+
bucketId: res.data.bucketId,
|
|
52
|
+
}); })
|
|
53
|
+
.catch(function (err) {
|
|
54
|
+
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
PhotosSubmodule.prototype.getPhotos = function (filter, skip, limit, includeDownloadLinks) {
|
|
58
|
+
var _this = this;
|
|
59
|
+
if (skip === void 0) { skip = 0; }
|
|
60
|
+
if (limit === void 0) { limit = 1; }
|
|
61
|
+
var query = query_string_1.default.stringify(__assign(__assign({}, filter), { skip: skip, limit: limit, includeDownloadLinks: includeDownloadLinks }));
|
|
62
|
+
if (skip < 0) {
|
|
63
|
+
throw new Error('Invalid skip. Skip should be positive. Provided skip was: ' + skip);
|
|
64
|
+
}
|
|
65
|
+
return axios_1.default
|
|
66
|
+
.get("".concat(this.model.baseUrl, "/photos/?").concat(query), {
|
|
67
|
+
headers: {
|
|
68
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
|
+
.then(function (res) { return ({
|
|
72
|
+
results: res.data.results.map(function (photoJson) { return _this.parse(photoJson); }),
|
|
73
|
+
bucketId: res.data.bucketId,
|
|
74
|
+
}); })
|
|
75
|
+
.catch(function (err) {
|
|
76
|
+
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
PhotosSubmodule.prototype.createPhoto = function (data) {
|
|
80
|
+
var _this = this;
|
|
81
|
+
return axios_1.default
|
|
82
|
+
.post("".concat(this.model.baseUrl, "/photos"), data, {
|
|
83
|
+
headers: {
|
|
84
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
85
|
+
},
|
|
86
|
+
})
|
|
87
|
+
.then(function (res) { return _this.parse(res.data); })
|
|
88
|
+
.catch(function (err) {
|
|
89
|
+
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
PhotosSubmodule.prototype.findOrCreatePhoto = function (data) {
|
|
93
|
+
var _this = this;
|
|
94
|
+
return axios_1.default
|
|
95
|
+
.post("".concat(this.model.baseUrl, "/photos/photo/exists"), data, {
|
|
96
|
+
headers: {
|
|
97
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
98
|
+
},
|
|
99
|
+
})
|
|
100
|
+
.then(function (res) { return _this.parse(res.data); })
|
|
101
|
+
.catch(function (err) {
|
|
102
|
+
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
PhotosSubmodule.prototype.deletePhotosById = function (photos) {
|
|
106
|
+
return axios_1.default
|
|
107
|
+
.delete("".concat(this.model.baseUrl, "/photos/photos"), {
|
|
108
|
+
headers: {
|
|
109
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
110
|
+
},
|
|
111
|
+
data: {
|
|
112
|
+
photos: photos,
|
|
113
|
+
},
|
|
114
|
+
})
|
|
115
|
+
.then(function () { return undefined; })
|
|
116
|
+
.catch(function (err) {
|
|
117
|
+
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
PhotosSubmodule.prototype.deletePhotoById = function (photoId) {
|
|
121
|
+
return axios_1.default
|
|
122
|
+
.delete("".concat(this.model.baseUrl, "/photos/").concat(photoId), {
|
|
123
|
+
headers: {
|
|
124
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
125
|
+
},
|
|
126
|
+
})
|
|
127
|
+
.then(function () { return undefined; })
|
|
128
|
+
.catch(function (err) {
|
|
129
|
+
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
PhotosSubmodule.prototype.trashPhotosById = function (photos) {
|
|
133
|
+
return axios_1.default
|
|
134
|
+
.post("".concat(this.model.baseUrl, "/photos/photos/trash"), {
|
|
135
|
+
photos: photos,
|
|
136
|
+
}, {
|
|
137
|
+
headers: {
|
|
138
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
139
|
+
},
|
|
140
|
+
})
|
|
141
|
+
.then(function () { return undefined; })
|
|
142
|
+
.catch(function (err) {
|
|
143
|
+
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
PhotosSubmodule.prototype.trashPhotoById = function (photoId) {
|
|
147
|
+
return axios_1.default
|
|
148
|
+
.post("".concat(this.model.baseUrl, "/photos/").concat(photoId, "/trash"), {}, {
|
|
149
|
+
headers: {
|
|
150
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
151
|
+
},
|
|
152
|
+
})
|
|
153
|
+
.then(function () { return undefined; })
|
|
154
|
+
.catch(function (err) {
|
|
155
|
+
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
PhotosSubmodule.prototype.getUsage = function () {
|
|
159
|
+
return axios_1.default
|
|
160
|
+
.get("".concat(this.model.baseUrl, "/photos/usage"), {
|
|
161
|
+
headers: {
|
|
162
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
163
|
+
},
|
|
164
|
+
})
|
|
165
|
+
.then(function (result) {
|
|
166
|
+
return result.data;
|
|
167
|
+
})
|
|
168
|
+
.catch(function (err) {
|
|
169
|
+
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
PhotosSubmodule.prototype.photosExists = function (photosExistPayload) {
|
|
173
|
+
var _this = this;
|
|
174
|
+
return axios_1.default
|
|
175
|
+
.post("".concat(this.model.baseUrl, "/photos/exists"), { photos: photosExistPayload }, {
|
|
176
|
+
headers: {
|
|
177
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
178
|
+
},
|
|
179
|
+
})
|
|
180
|
+
.then(function (res) {
|
|
181
|
+
return res.data.photos.map(function (result) {
|
|
182
|
+
if ('id' in result) {
|
|
183
|
+
return __assign(__assign({}, _this.parse(result)), { exists: true });
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
return __assign(__assign({}, result), { takenAt: new Date(result.takenAt) });
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
})
|
|
190
|
+
.catch(function (err) {
|
|
191
|
+
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
PhotosSubmodule.prototype.updatePhoto = function (photoId, data) {
|
|
195
|
+
return axios_1.default
|
|
196
|
+
.patch("".concat(this.model.baseUrl, "/photos/").concat(photoId), data, {
|
|
197
|
+
headers: {
|
|
198
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
199
|
+
},
|
|
200
|
+
})
|
|
201
|
+
.then(function (result) {
|
|
202
|
+
return result.data;
|
|
203
|
+
})
|
|
204
|
+
.catch(function (err) {
|
|
205
|
+
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
PhotosSubmodule.prototype.getCount = function () {
|
|
209
|
+
return axios_1.default
|
|
210
|
+
.get("".concat(this.model.baseUrl, "/photos/count"), {
|
|
211
|
+
headers: {
|
|
212
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
213
|
+
},
|
|
214
|
+
})
|
|
215
|
+
.then(function (result) { return result.data; })
|
|
216
|
+
.catch(function (err) {
|
|
217
|
+
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
218
|
+
});
|
|
219
|
+
};
|
|
220
|
+
PhotosSubmodule.prototype.parse = function (json) {
|
|
221
|
+
return __assign(__assign({}, json), { takenAt: new Date(json.takenAt), statusChangedAt: new Date(json.statusChangedAt), createdAt: new Date(json.createdAt), updatedAt: new Date(json.updatedAt) });
|
|
222
|
+
};
|
|
223
|
+
return PhotosSubmodule;
|
|
224
|
+
}());
|
|
225
|
+
exports.default = PhotosSubmodule;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CreatePhotoShareBody, PhotosSdkModel } from '..';
|
|
2
|
-
import { GetPhotoShareResponse, Share } from '../types';
|
|
3
|
-
export default class SharesSubmodule {
|
|
4
|
-
private model;
|
|
5
|
-
constructor(model: PhotosSdkModel);
|
|
6
|
-
getShare(id: string, code: string): Promise<GetPhotoShareResponse>;
|
|
7
|
-
createShare(body: CreatePhotoShareBody): Promise<Share>;
|
|
8
|
-
}
|
|
1
|
+
import { CreatePhotoShareBody, PhotosSdkModel } from '..';
|
|
2
|
+
import { GetPhotoShareResponse, Share } from '../types';
|
|
3
|
+
export default class SharesSubmodule {
|
|
4
|
+
private model;
|
|
5
|
+
constructor(model: PhotosSdkModel);
|
|
6
|
+
getShare(id: string, code: string): Promise<GetPhotoShareResponse>;
|
|
7
|
+
createShare(body: CreatePhotoShareBody): Promise<Share>;
|
|
8
|
+
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var axios_1 = __importDefault(require("axios"));
|
|
7
|
-
var utils_1 = require("../../utils");
|
|
8
|
-
var SharesSubmodule = /** @class */ (function () {
|
|
9
|
-
function SharesSubmodule(model) {
|
|
10
|
-
this.model = model;
|
|
11
|
-
}
|
|
12
|
-
SharesSubmodule.prototype.getShare = function (id, code) {
|
|
13
|
-
return axios_1.default
|
|
14
|
-
.get(this.model.baseUrl
|
|
15
|
-
.then(function (response) { return response.data; })
|
|
16
|
-
.catch(function (err) {
|
|
17
|
-
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
SharesSubmodule.prototype.createShare = function (body) {
|
|
21
|
-
return axios_1.default
|
|
22
|
-
.post(this.model.baseUrl
|
|
23
|
-
headers: {
|
|
24
|
-
Authorization: "Bearer "
|
|
25
|
-
},
|
|
26
|
-
})
|
|
27
|
-
.then(function (response) { return response.data; })
|
|
28
|
-
.catch(function (err) {
|
|
29
|
-
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
return SharesSubmodule;
|
|
33
|
-
}());
|
|
34
|
-
exports.default = SharesSubmodule;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var axios_1 = __importDefault(require("axios"));
|
|
7
|
+
var utils_1 = require("../../utils");
|
|
8
|
+
var SharesSubmodule = /** @class */ (function () {
|
|
9
|
+
function SharesSubmodule(model) {
|
|
10
|
+
this.model = model;
|
|
11
|
+
}
|
|
12
|
+
SharesSubmodule.prototype.getShare = function (id, code) {
|
|
13
|
+
return axios_1.default
|
|
14
|
+
.get("".concat(this.model.baseUrl, "/shares/").concat(id, "?code=").concat(code))
|
|
15
|
+
.then(function (response) { return response.data; })
|
|
16
|
+
.catch(function (err) {
|
|
17
|
+
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
SharesSubmodule.prototype.createShare = function (body) {
|
|
21
|
+
return axios_1.default
|
|
22
|
+
.post("".concat(this.model.baseUrl, "/shares"), body, {
|
|
23
|
+
headers: {
|
|
24
|
+
Authorization: "Bearer ".concat(this.model.accessToken),
|
|
25
|
+
},
|
|
26
|
+
})
|
|
27
|
+
.then(function (response) { return response.data; })
|
|
28
|
+
.catch(function (err) {
|
|
29
|
+
throw new Error((0, utils_1.extractAxiosErrorMessage)(err));
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
return SharesSubmodule;
|
|
33
|
+
}());
|
|
34
|
+
exports.default = SharesSubmodule;
|