@oxyhq/core 1.5.0 → 1.6.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/dist/cjs/AuthManager.js +1 -1
- package/dist/cjs/HttpService.js +87 -69
- package/dist/cjs/OxyServices.base.js +5 -4
- package/dist/cjs/crypto/keyManager.js +1 -13
- package/dist/cjs/crypto/signatureService.js +7 -20
- package/dist/cjs/mixins/OxyServices.analytics.js +2 -2
- package/dist/cjs/mixins/OxyServices.assets.js +14 -14
- package/dist/cjs/mixins/OxyServices.auth.js +19 -19
- package/dist/cjs/mixins/OxyServices.developer.js +6 -6
- package/dist/cjs/mixins/OxyServices.devices.js +7 -7
- package/dist/cjs/mixins/OxyServices.features.js +23 -23
- package/dist/cjs/mixins/OxyServices.fedcm.js +1 -1
- package/dist/cjs/mixins/OxyServices.karma.js +6 -6
- package/dist/cjs/mixins/OxyServices.location.js +2 -2
- package/dist/cjs/mixins/OxyServices.payment.js +6 -6
- package/dist/cjs/mixins/OxyServices.popup.js +1 -1
- package/dist/cjs/mixins/OxyServices.privacy.js +6 -6
- package/dist/cjs/mixins/OxyServices.security.js +3 -3
- package/dist/cjs/mixins/OxyServices.user.js +22 -22
- package/dist/cjs/mixins/OxyServices.utility.js +16 -7
- package/dist/cjs/utils/platform.js +14 -0
- package/dist/esm/AuthManager.js +1 -1
- package/dist/esm/HttpService.js +87 -69
- package/dist/esm/OxyServices.base.js +5 -4
- package/dist/esm/crypto/keyManager.js +1 -13
- package/dist/esm/crypto/signatureService.js +2 -15
- package/dist/esm/mixins/OxyServices.analytics.js +2 -2
- package/dist/esm/mixins/OxyServices.assets.js +14 -14
- package/dist/esm/mixins/OxyServices.auth.js +19 -19
- package/dist/esm/mixins/OxyServices.developer.js +6 -6
- package/dist/esm/mixins/OxyServices.devices.js +7 -7
- package/dist/esm/mixins/OxyServices.features.js +23 -23
- package/dist/esm/mixins/OxyServices.fedcm.js +1 -1
- package/dist/esm/mixins/OxyServices.karma.js +6 -6
- package/dist/esm/mixins/OxyServices.location.js +2 -2
- package/dist/esm/mixins/OxyServices.payment.js +6 -6
- package/dist/esm/mixins/OxyServices.popup.js +1 -1
- package/dist/esm/mixins/OxyServices.privacy.js +6 -6
- package/dist/esm/mixins/OxyServices.security.js +3 -3
- package/dist/esm/mixins/OxyServices.user.js +22 -22
- package/dist/esm/mixins/OxyServices.utility.js +16 -7
- package/dist/esm/utils/platform.js +12 -0
- package/dist/types/HttpService.d.ts +4 -1
- package/dist/types/OxyServices.base.d.ts +1 -1
- package/dist/types/mixins/OxyServices.analytics.d.ts +1 -1
- package/dist/types/mixins/OxyServices.assets.d.ts +1 -1
- package/dist/types/mixins/OxyServices.auth.d.ts +1 -1
- package/dist/types/mixins/OxyServices.developer.d.ts +1 -1
- package/dist/types/mixins/OxyServices.devices.d.ts +1 -1
- package/dist/types/mixins/OxyServices.features.d.ts +1 -1
- package/dist/types/mixins/OxyServices.fedcm.d.ts +1 -1
- package/dist/types/mixins/OxyServices.karma.d.ts +1 -1
- package/dist/types/mixins/OxyServices.language.d.ts +1 -1
- package/dist/types/mixins/OxyServices.location.d.ts +1 -1
- package/dist/types/mixins/OxyServices.payment.d.ts +1 -1
- package/dist/types/mixins/OxyServices.popup.d.ts +1 -1
- package/dist/types/mixins/OxyServices.privacy.d.ts +1 -1
- package/dist/types/mixins/OxyServices.redirect.d.ts +1 -1
- package/dist/types/mixins/OxyServices.security.d.ts +1 -1
- package/dist/types/mixins/OxyServices.user.d.ts +1 -1
- package/dist/types/mixins/OxyServices.utility.d.ts +7 -6
- package/dist/types/utils/platform.d.ts +8 -0
- package/package.json +1 -1
- package/src/AuthManager.ts +1 -1
- package/src/HttpService.ts +85 -67
- package/src/OxyServices.base.ts +5 -4
- package/src/crypto/keyManager.ts +1 -15
- package/src/crypto/signatureService.ts +2 -17
- package/src/mixins/OxyServices.analytics.ts +2 -2
- package/src/mixins/OxyServices.assets.ts +14 -14
- package/src/mixins/OxyServices.auth.ts +19 -19
- package/src/mixins/OxyServices.developer.ts +6 -6
- package/src/mixins/OxyServices.devices.ts +7 -7
- package/src/mixins/OxyServices.features.ts +23 -23
- package/src/mixins/OxyServices.fedcm.ts +1 -1
- package/src/mixins/OxyServices.karma.ts +6 -6
- package/src/mixins/OxyServices.location.ts +2 -2
- package/src/mixins/OxyServices.payment.ts +6 -6
- package/src/mixins/OxyServices.popup.ts +1 -1
- package/src/mixins/OxyServices.privacy.ts +6 -6
- package/src/mixins/OxyServices.security.ts +3 -3
- package/src/mixins/OxyServices.user.ts +22 -22
- package/src/mixins/OxyServices.utility.ts +18 -8
- package/src/utils/platform.ts +14 -0
|
@@ -8,7 +8,7 @@ export function OxyServicesAssetsMixin(Base) {
|
|
|
8
8
|
*/
|
|
9
9
|
async deleteFile(fileId) {
|
|
10
10
|
try {
|
|
11
|
-
return await this.makeRequest('DELETE', `/
|
|
11
|
+
return await this.makeRequest('DELETE', `/assets/${encodeURIComponent(fileId)}`, undefined, { cache: false });
|
|
12
12
|
}
|
|
13
13
|
catch (error) {
|
|
14
14
|
throw this.handleError(error);
|
|
@@ -29,7 +29,7 @@ export function OxyServicesAssetsMixin(Base) {
|
|
|
29
29
|
if (token)
|
|
30
30
|
params.set('token', token);
|
|
31
31
|
const qs = params.toString();
|
|
32
|
-
return `${base}/
|
|
32
|
+
return `${base}/assets/${encodeURIComponent(fileId)}/stream${qs ? `?${qs}` : ''}`;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Get file download URL asynchronously (returns signed URL directly from CDN)
|
|
@@ -53,7 +53,7 @@ export function OxyServicesAssetsMixin(Base) {
|
|
|
53
53
|
paramsObj.limit = limit;
|
|
54
54
|
if (offset)
|
|
55
55
|
paramsObj.offset = offset;
|
|
56
|
-
return await this.makeRequest('GET', '/
|
|
56
|
+
return await this.makeRequest('GET', '/assets', paramsObj, {
|
|
57
57
|
cache: false,
|
|
58
58
|
});
|
|
59
59
|
}
|
|
@@ -66,7 +66,7 @@ export function OxyServicesAssetsMixin(Base) {
|
|
|
66
66
|
*/
|
|
67
67
|
async getAccountStorageUsage() {
|
|
68
68
|
try {
|
|
69
|
-
return await this.makeRequest('GET', '/
|
|
69
|
+
return await this.makeRequest('GET', '/storage/usage', undefined, {
|
|
70
70
|
cache: false,
|
|
71
71
|
});
|
|
72
72
|
}
|
|
@@ -109,7 +109,7 @@ export function OxyServicesAssetsMixin(Base) {
|
|
|
109
109
|
*/
|
|
110
110
|
async getBatchFileAccess(fileIds, context) {
|
|
111
111
|
try {
|
|
112
|
-
return await this.makeRequest('POST', '/
|
|
112
|
+
return await this.makeRequest('POST', '/assets/batch-access', {
|
|
113
113
|
fileIds,
|
|
114
114
|
context
|
|
115
115
|
});
|
|
@@ -170,7 +170,7 @@ export function OxyServicesAssetsMixin(Base) {
|
|
|
170
170
|
}
|
|
171
171
|
const response = await this.getClient().request({
|
|
172
172
|
method: 'POST',
|
|
173
|
-
url: '/
|
|
173
|
+
url: '/assets/upload',
|
|
174
174
|
data: formData,
|
|
175
175
|
cache: false,
|
|
176
176
|
});
|
|
@@ -228,7 +228,7 @@ export function OxyServicesAssetsMixin(Base) {
|
|
|
228
228
|
body.visibility = visibility;
|
|
229
229
|
if (webhookUrl)
|
|
230
230
|
body.webhookUrl = webhookUrl;
|
|
231
|
-
return await this.makeRequest('POST', `/
|
|
231
|
+
return await this.makeRequest('POST', `/assets/${fileId}/links`, body, { cache: false });
|
|
232
232
|
}
|
|
233
233
|
catch (error) {
|
|
234
234
|
throw this.handleError(error);
|
|
@@ -239,7 +239,7 @@ export function OxyServicesAssetsMixin(Base) {
|
|
|
239
239
|
*/
|
|
240
240
|
async assetUnlink(fileId, app, entityType, entityId) {
|
|
241
241
|
try {
|
|
242
|
-
return await this.makeRequest('DELETE', `/
|
|
242
|
+
return await this.makeRequest('DELETE', `/assets/${fileId}/links`, {
|
|
243
243
|
app,
|
|
244
244
|
entityType,
|
|
245
245
|
entityId
|
|
@@ -254,7 +254,7 @@ export function OxyServicesAssetsMixin(Base) {
|
|
|
254
254
|
*/
|
|
255
255
|
async assetGet(fileId) {
|
|
256
256
|
try {
|
|
257
|
-
return await this.makeRequest('GET', `/
|
|
257
|
+
return await this.makeRequest('GET', `/assets/${fileId}`, undefined, {
|
|
258
258
|
cache: true,
|
|
259
259
|
cacheTTL: 5 * 60 * 1000,
|
|
260
260
|
});
|
|
@@ -273,7 +273,7 @@ export function OxyServicesAssetsMixin(Base) {
|
|
|
273
273
|
params.variant = variant;
|
|
274
274
|
if (expiresIn)
|
|
275
275
|
params.expiresIn = expiresIn;
|
|
276
|
-
return await this.makeRequest('GET', `/
|
|
276
|
+
return await this.makeRequest('GET', `/assets/${fileId}/url`, params, {
|
|
277
277
|
cache: true,
|
|
278
278
|
cacheTTL: 10 * 60 * 1000,
|
|
279
279
|
});
|
|
@@ -287,7 +287,7 @@ export function OxyServicesAssetsMixin(Base) {
|
|
|
287
287
|
*/
|
|
288
288
|
async assetRestore(fileId) {
|
|
289
289
|
try {
|
|
290
|
-
return await this.makeRequest('POST', `/
|
|
290
|
+
return await this.makeRequest('POST', `/assets/${fileId}/restore`, undefined, { cache: false });
|
|
291
291
|
}
|
|
292
292
|
catch (error) {
|
|
293
293
|
throw this.handleError(error);
|
|
@@ -299,7 +299,7 @@ export function OxyServicesAssetsMixin(Base) {
|
|
|
299
299
|
async assetDelete(fileId, force = false) {
|
|
300
300
|
try {
|
|
301
301
|
const params = force ? { force: 'true' } : undefined;
|
|
302
|
-
return await this.makeRequest('DELETE', `/
|
|
302
|
+
return await this.makeRequest('DELETE', `/assets/${fileId}`, params, { cache: false });
|
|
303
303
|
}
|
|
304
304
|
catch (error) {
|
|
305
305
|
throw this.handleError(error);
|
|
@@ -322,7 +322,7 @@ export function OxyServicesAssetsMixin(Base) {
|
|
|
322
322
|
*/
|
|
323
323
|
async assetUpdateVisibility(fileId, visibility) {
|
|
324
324
|
try {
|
|
325
|
-
return await this.makeRequest('PATCH', `/
|
|
325
|
+
return await this.makeRequest('PATCH', `/assets/${fileId}/visibility`, {
|
|
326
326
|
visibility
|
|
327
327
|
}, { cache: false });
|
|
328
328
|
}
|
|
@@ -360,7 +360,7 @@ export function OxyServicesAssetsMixin(Base) {
|
|
|
360
360
|
params.variant = variant;
|
|
361
361
|
if (expiresIn)
|
|
362
362
|
params.expiresIn = expiresIn;
|
|
363
|
-
const urlRes = await this.makeRequest('GET', `/
|
|
363
|
+
const urlRes = await this.makeRequest('GET', `/assets/${encodeURIComponent(fileId)}/url`, Object.keys(params).length ? params : undefined, {
|
|
364
364
|
cache: true,
|
|
365
365
|
cacheTTL: cacheTTL ?? 10 * 60 * 1000,
|
|
366
366
|
});
|
|
@@ -40,7 +40,7 @@ export function OxyServicesAuthMixin(Base) {
|
|
|
40
40
|
if (this._serviceToken && this._serviceTokenExp > Date.now() + 60000) {
|
|
41
41
|
return this._serviceToken;
|
|
42
42
|
}
|
|
43
|
-
const response = await this.makeRequest('POST', '/
|
|
43
|
+
const response = await this.makeRequest('POST', '/auth/service-token', { apiKey: key, apiSecret: secret }, { cache: false, retry: false });
|
|
44
44
|
this._serviceToken = response.token;
|
|
45
45
|
this._serviceTokenExp = Date.now() + response.expiresIn * 1000;
|
|
46
46
|
return this._serviceToken;
|
|
@@ -74,7 +74,7 @@ export function OxyServicesAuthMixin(Base) {
|
|
|
74
74
|
*/
|
|
75
75
|
async register(publicKey, signature, timestamp) {
|
|
76
76
|
try {
|
|
77
|
-
const res = await this.makeRequest('POST', '/
|
|
77
|
+
const res = await this.makeRequest('POST', '/auth/register', {
|
|
78
78
|
publicKey,
|
|
79
79
|
signature,
|
|
80
80
|
timestamp,
|
|
@@ -96,7 +96,7 @@ export function OxyServicesAuthMixin(Base) {
|
|
|
96
96
|
*/
|
|
97
97
|
async requestChallenge(publicKey) {
|
|
98
98
|
try {
|
|
99
|
-
return await this.makeRequest('POST', '/
|
|
99
|
+
return await this.makeRequest('POST', '/auth/challenge', {
|
|
100
100
|
publicKey,
|
|
101
101
|
}, { cache: false });
|
|
102
102
|
}
|
|
@@ -116,7 +116,7 @@ export function OxyServicesAuthMixin(Base) {
|
|
|
116
116
|
*/
|
|
117
117
|
async verifyChallenge(publicKey, challenge, signature, timestamp, deviceName, deviceFingerprint) {
|
|
118
118
|
try {
|
|
119
|
-
return await this.makeRequest('POST', '/
|
|
119
|
+
return await this.makeRequest('POST', '/auth/verify', {
|
|
120
120
|
publicKey,
|
|
121
121
|
challenge,
|
|
122
122
|
signature,
|
|
@@ -134,7 +134,7 @@ export function OxyServicesAuthMixin(Base) {
|
|
|
134
134
|
*/
|
|
135
135
|
async checkPublicKeyRegistered(publicKey) {
|
|
136
136
|
try {
|
|
137
|
-
return await this.makeRequest('GET', `/
|
|
137
|
+
return await this.makeRequest('GET', `/auth/check-publickey/${encodeURIComponent(publicKey)}`, undefined, { cache: false });
|
|
138
138
|
}
|
|
139
139
|
catch (error) {
|
|
140
140
|
throw this.handleError(error);
|
|
@@ -145,7 +145,7 @@ export function OxyServicesAuthMixin(Base) {
|
|
|
145
145
|
*/
|
|
146
146
|
async getUserByPublicKey(publicKey) {
|
|
147
147
|
try {
|
|
148
|
-
return await this.makeRequest('GET', `/
|
|
148
|
+
return await this.makeRequest('GET', `/auth/user/${encodeURIComponent(publicKey)}`, undefined, { cache: true, cacheTTL: 2 * 60 * 1000 });
|
|
149
149
|
}
|
|
150
150
|
catch (error) {
|
|
151
151
|
throw this.handleError(error);
|
|
@@ -156,7 +156,7 @@ export function OxyServicesAuthMixin(Base) {
|
|
|
156
156
|
*/
|
|
157
157
|
async getUserBySession(sessionId) {
|
|
158
158
|
try {
|
|
159
|
-
return await this.makeRequest('GET', `/
|
|
159
|
+
return await this.makeRequest('GET', `/session/user/${sessionId}`, undefined, {
|
|
160
160
|
cache: true,
|
|
161
161
|
cacheTTL: 2 * 60 * 1000,
|
|
162
162
|
});
|
|
@@ -174,7 +174,7 @@ export function OxyServicesAuthMixin(Base) {
|
|
|
174
174
|
return [];
|
|
175
175
|
}
|
|
176
176
|
const uniqueSessionIds = Array.from(new Set(sessionIds)).sort();
|
|
177
|
-
return await this.makeRequest('POST', '/
|
|
177
|
+
return await this.makeRequest('POST', '/session/users/batch', { sessionIds: uniqueSessionIds }, {
|
|
178
178
|
cache: true,
|
|
179
179
|
cacheTTL: 2 * 60 * 1000,
|
|
180
180
|
deduplicate: true,
|
|
@@ -189,7 +189,7 @@ export function OxyServicesAuthMixin(Base) {
|
|
|
189
189
|
*/
|
|
190
190
|
async getTokenBySession(sessionId) {
|
|
191
191
|
try {
|
|
192
|
-
const res = await this.makeRequest('GET', `/
|
|
192
|
+
const res = await this.makeRequest('GET', `/session/token/${sessionId}`, undefined, { cache: false, retry: false });
|
|
193
193
|
this.setTokens(res.accessToken);
|
|
194
194
|
return res;
|
|
195
195
|
}
|
|
@@ -202,7 +202,7 @@ export function OxyServicesAuthMixin(Base) {
|
|
|
202
202
|
*/
|
|
203
203
|
async getSessionsBySessionId(sessionId) {
|
|
204
204
|
try {
|
|
205
|
-
return await this.makeRequest('GET', `/
|
|
205
|
+
return await this.makeRequest('GET', `/session/sessions/${sessionId}`, undefined, {
|
|
206
206
|
cache: false,
|
|
207
207
|
});
|
|
208
208
|
}
|
|
@@ -216,8 +216,8 @@ export function OxyServicesAuthMixin(Base) {
|
|
|
216
216
|
async logoutSession(sessionId, targetSessionId) {
|
|
217
217
|
try {
|
|
218
218
|
const url = targetSessionId
|
|
219
|
-
? `/
|
|
220
|
-
: `/
|
|
219
|
+
? `/session/logout/${sessionId}/${targetSessionId}`
|
|
220
|
+
: `/session/logout/${sessionId}`;
|
|
221
221
|
await this.makeRequest('POST', url, undefined, { cache: false });
|
|
222
222
|
}
|
|
223
223
|
catch (error) {
|
|
@@ -229,7 +229,7 @@ export function OxyServicesAuthMixin(Base) {
|
|
|
229
229
|
*/
|
|
230
230
|
async logoutAllSessions(sessionId) {
|
|
231
231
|
try {
|
|
232
|
-
await this.makeRequest('POST', `/
|
|
232
|
+
await this.makeRequest('POST', `/session/logout-all/${sessionId}`, undefined, { cache: false });
|
|
233
233
|
}
|
|
234
234
|
catch (error) {
|
|
235
235
|
throw this.handleError(error);
|
|
@@ -245,11 +245,11 @@ export function OxyServicesAuthMixin(Base) {
|
|
|
245
245
|
urlParams.deviceFingerprint = options.deviceFingerprint;
|
|
246
246
|
if (options.useHeaderValidation)
|
|
247
247
|
urlParams.useHeaderValidation = 'true';
|
|
248
|
-
return await this.makeRequest('GET', `/
|
|
248
|
+
return await this.makeRequest('GET', `/session/validate/${sessionId}`, urlParams, { cache: false });
|
|
249
249
|
}
|
|
250
250
|
catch (error) {
|
|
251
251
|
// Session is invalid — clear any cached user data for this session (#196)
|
|
252
|
-
this.clearCacheEntry(`GET:/
|
|
252
|
+
this.clearCacheEntry(`GET:/session/user/${sessionId}`);
|
|
253
253
|
throw this.handleError(error);
|
|
254
254
|
}
|
|
255
255
|
}
|
|
@@ -258,7 +258,7 @@ export function OxyServicesAuthMixin(Base) {
|
|
|
258
258
|
*/
|
|
259
259
|
async checkUsernameAvailability(username) {
|
|
260
260
|
try {
|
|
261
|
-
return await this.makeRequest('GET', `/
|
|
261
|
+
return await this.makeRequest('GET', `/auth/check-username/${username}`, undefined, { cache: false });
|
|
262
262
|
}
|
|
263
263
|
catch (error) {
|
|
264
264
|
throw this.handleError(error);
|
|
@@ -269,7 +269,7 @@ export function OxyServicesAuthMixin(Base) {
|
|
|
269
269
|
*/
|
|
270
270
|
async checkEmailAvailability(email) {
|
|
271
271
|
try {
|
|
272
|
-
return await this.makeRequest('GET', `/
|
|
272
|
+
return await this.makeRequest('GET', `/auth/check-email/${email}`, undefined, { cache: false });
|
|
273
273
|
}
|
|
274
274
|
catch (error) {
|
|
275
275
|
throw this.handleError(error);
|
|
@@ -280,7 +280,7 @@ export function OxyServicesAuthMixin(Base) {
|
|
|
280
280
|
*/
|
|
281
281
|
async signUp(username, email, password, deviceName, deviceFingerprint) {
|
|
282
282
|
try {
|
|
283
|
-
return await this.makeRequest('POST', '/
|
|
283
|
+
return await this.makeRequest('POST', '/auth/signup', {
|
|
284
284
|
username,
|
|
285
285
|
email,
|
|
286
286
|
password,
|
|
@@ -297,7 +297,7 @@ export function OxyServicesAuthMixin(Base) {
|
|
|
297
297
|
*/
|
|
298
298
|
async signIn(identifier, password, deviceName, deviceFingerprint) {
|
|
299
299
|
try {
|
|
300
|
-
return await this.makeRequest('POST', '/
|
|
300
|
+
return await this.makeRequest('POST', '/auth/login', {
|
|
301
301
|
identifier,
|
|
302
302
|
password,
|
|
303
303
|
deviceName,
|
|
@@ -10,7 +10,7 @@ export function OxyServicesDeveloperMixin(Base) {
|
|
|
10
10
|
*/
|
|
11
11
|
async getDeveloperApps() {
|
|
12
12
|
try {
|
|
13
|
-
const res = await this.makeRequest('GET', '/
|
|
13
|
+
const res = await this.makeRequest('GET', '/developer/apps', undefined, {
|
|
14
14
|
cache: true,
|
|
15
15
|
cacheTTL: CACHE_TIMES.MEDIUM,
|
|
16
16
|
});
|
|
@@ -27,7 +27,7 @@ export function OxyServicesDeveloperMixin(Base) {
|
|
|
27
27
|
*/
|
|
28
28
|
async createDeveloperApp(data) {
|
|
29
29
|
try {
|
|
30
|
-
const res = await this.makeRequest('POST', '/
|
|
30
|
+
const res = await this.makeRequest('POST', '/developer/apps', data, { cache: false });
|
|
31
31
|
return res.app;
|
|
32
32
|
}
|
|
33
33
|
catch (error) {
|
|
@@ -39,7 +39,7 @@ export function OxyServicesDeveloperMixin(Base) {
|
|
|
39
39
|
*/
|
|
40
40
|
async getDeveloperApp(appId) {
|
|
41
41
|
try {
|
|
42
|
-
const res = await this.makeRequest('GET', `/
|
|
42
|
+
const res = await this.makeRequest('GET', `/developer/apps/${appId}`, undefined, {
|
|
43
43
|
cache: true,
|
|
44
44
|
cacheTTL: CACHE_TIMES.LONG,
|
|
45
45
|
});
|
|
@@ -57,7 +57,7 @@ export function OxyServicesDeveloperMixin(Base) {
|
|
|
57
57
|
*/
|
|
58
58
|
async updateDeveloperApp(appId, data) {
|
|
59
59
|
try {
|
|
60
|
-
const res = await this.makeRequest('PATCH', `/
|
|
60
|
+
const res = await this.makeRequest('PATCH', `/developer/apps/${appId}`, data, { cache: false });
|
|
61
61
|
return res.app;
|
|
62
62
|
}
|
|
63
63
|
catch (error) {
|
|
@@ -71,7 +71,7 @@ export function OxyServicesDeveloperMixin(Base) {
|
|
|
71
71
|
*/
|
|
72
72
|
async regenerateDeveloperAppSecret(appId) {
|
|
73
73
|
try {
|
|
74
|
-
return await this.makeRequest('POST', `/
|
|
74
|
+
return await this.makeRequest('POST', `/developer/apps/${appId}/regenerate-secret`, undefined, { cache: false });
|
|
75
75
|
}
|
|
76
76
|
catch (error) {
|
|
77
77
|
throw this.handleError(error);
|
|
@@ -84,7 +84,7 @@ export function OxyServicesDeveloperMixin(Base) {
|
|
|
84
84
|
*/
|
|
85
85
|
async deleteDeveloperApp(appId) {
|
|
86
86
|
try {
|
|
87
|
-
return await this.makeRequest('DELETE', `/
|
|
87
|
+
return await this.makeRequest('DELETE', `/developer/apps/${appId}`, undefined, { cache: false });
|
|
88
88
|
}
|
|
89
89
|
catch (error) {
|
|
90
90
|
throw this.handleError(error);
|
|
@@ -10,7 +10,7 @@ export function OxyServicesDevicesMixin(Base) {
|
|
|
10
10
|
*/
|
|
11
11
|
async registerDevice(deviceData) {
|
|
12
12
|
try {
|
|
13
|
-
return await this.makeRequest('POST', '/
|
|
13
|
+
return await this.makeRequest('POST', '/devices', deviceData, { cache: false });
|
|
14
14
|
}
|
|
15
15
|
catch (error) {
|
|
16
16
|
throw this.handleError(error);
|
|
@@ -22,7 +22,7 @@ export function OxyServicesDevicesMixin(Base) {
|
|
|
22
22
|
*/
|
|
23
23
|
async getUserDevices() {
|
|
24
24
|
try {
|
|
25
|
-
return await this.makeRequest('GET', '/
|
|
25
|
+
return await this.makeRequest('GET', '/devices', undefined, {
|
|
26
26
|
cache: false, // Don't cache device list - always get fresh data
|
|
27
27
|
});
|
|
28
28
|
}
|
|
@@ -36,7 +36,7 @@ export function OxyServicesDevicesMixin(Base) {
|
|
|
36
36
|
*/
|
|
37
37
|
async removeDevice(deviceId) {
|
|
38
38
|
try {
|
|
39
|
-
await this.makeRequest('DELETE', `/
|
|
39
|
+
await this.makeRequest('DELETE', `/devices/${deviceId}`, undefined, { cache: false });
|
|
40
40
|
}
|
|
41
41
|
catch (error) {
|
|
42
42
|
throw this.handleError(error);
|
|
@@ -52,7 +52,7 @@ export function OxyServicesDevicesMixin(Base) {
|
|
|
52
52
|
try {
|
|
53
53
|
// Use makeRequest for consistent error handling and optional caching
|
|
54
54
|
// Cache disabled by default to ensure fresh session data
|
|
55
|
-
return await this.makeRequest('GET', `/
|
|
55
|
+
return await this.makeRequest('GET', `/session/device/sessions/${sessionId}`, undefined, {
|
|
56
56
|
cache: false, // Don't cache sessions - always get fresh data
|
|
57
57
|
deduplicate: true, // Deduplicate concurrent requests for same sessionId
|
|
58
58
|
});
|
|
@@ -75,7 +75,7 @@ export function OxyServicesDevicesMixin(Base) {
|
|
|
75
75
|
urlParams.deviceId = deviceId;
|
|
76
76
|
if (excludeCurrent)
|
|
77
77
|
urlParams.excludeCurrent = 'true';
|
|
78
|
-
return await this.makeRequest('POST', `/
|
|
78
|
+
return await this.makeRequest('POST', `/session/device/logout-all/${sessionId}`, urlParams, { cache: false });
|
|
79
79
|
}
|
|
80
80
|
catch (error) {
|
|
81
81
|
throw this.handleError(error);
|
|
@@ -89,7 +89,7 @@ export function OxyServicesDevicesMixin(Base) {
|
|
|
89
89
|
*/
|
|
90
90
|
async updateDeviceName(sessionId, deviceName) {
|
|
91
91
|
try {
|
|
92
|
-
return await this.makeRequest('PUT', `/
|
|
92
|
+
return await this.makeRequest('PUT', `/session/device/name/${sessionId}`, { deviceName }, { cache: false });
|
|
93
93
|
}
|
|
94
94
|
catch (error) {
|
|
95
95
|
throw this.handleError(error);
|
|
@@ -101,7 +101,7 @@ export function OxyServicesDevicesMixin(Base) {
|
|
|
101
101
|
*/
|
|
102
102
|
async getSecurityInfo() {
|
|
103
103
|
try {
|
|
104
|
-
return await this.makeRequest('GET', '/
|
|
104
|
+
return await this.makeRequest('GET', '/devices/security', undefined, {
|
|
105
105
|
cache: false,
|
|
106
106
|
});
|
|
107
107
|
}
|
|
@@ -12,7 +12,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
12
12
|
*/
|
|
13
13
|
async submitFeedback(payload) {
|
|
14
14
|
try {
|
|
15
|
-
return await this.makeRequest('POST', '/
|
|
15
|
+
return await this.makeRequest('POST', '/feedback', payload, {
|
|
16
16
|
cache: false,
|
|
17
17
|
});
|
|
18
18
|
}
|
|
@@ -28,7 +28,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
28
28
|
*/
|
|
29
29
|
async getSubscriptionPlans() {
|
|
30
30
|
try {
|
|
31
|
-
return await this.makeRequest('GET', '/
|
|
31
|
+
return await this.makeRequest('GET', '/subscriptions/plans', undefined, {
|
|
32
32
|
cache: true,
|
|
33
33
|
cacheTTL: CACHE_TIMES.LONG,
|
|
34
34
|
});
|
|
@@ -42,7 +42,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
42
42
|
*/
|
|
43
43
|
async getIndividualFeatures() {
|
|
44
44
|
try {
|
|
45
|
-
return await this.makeRequest('GET', '/
|
|
45
|
+
return await this.makeRequest('GET', '/subscriptions/features', undefined, {
|
|
46
46
|
cache: true,
|
|
47
47
|
cacheTTL: CACHE_TIMES.LONG,
|
|
48
48
|
});
|
|
@@ -56,7 +56,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
56
56
|
*/
|
|
57
57
|
async subscribe(planId, paymentMethodId) {
|
|
58
58
|
return this.withAuthRetry(async () => {
|
|
59
|
-
return await this.makeRequest('POST', '/
|
|
59
|
+
return await this.makeRequest('POST', '/subscriptions/subscribe', {
|
|
60
60
|
planId,
|
|
61
61
|
paymentMethodId,
|
|
62
62
|
}, { cache: false });
|
|
@@ -67,7 +67,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
67
67
|
*/
|
|
68
68
|
async subscribeToFeature(featureId, paymentMethodId) {
|
|
69
69
|
return this.withAuthRetry(async () => {
|
|
70
|
-
return await this.makeRequest('POST', '/
|
|
70
|
+
return await this.makeRequest('POST', '/subscriptions/features/subscribe', {
|
|
71
71
|
featureId,
|
|
72
72
|
paymentMethodId,
|
|
73
73
|
}, { cache: false });
|
|
@@ -78,7 +78,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
78
78
|
*/
|
|
79
79
|
async cancelSubscription(subscriptionId) {
|
|
80
80
|
return this.withAuthRetry(async () => {
|
|
81
|
-
await this.makeRequest('POST', `/
|
|
81
|
+
await this.makeRequest('POST', `/subscriptions/${subscriptionId}/cancel`, undefined, {
|
|
82
82
|
cache: false,
|
|
83
83
|
});
|
|
84
84
|
}, 'cancelSubscription');
|
|
@@ -88,7 +88,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
88
88
|
*/
|
|
89
89
|
async reactivateSubscription(subscriptionId) {
|
|
90
90
|
return this.withAuthRetry(async () => {
|
|
91
|
-
await this.makeRequest('POST', `/
|
|
91
|
+
await this.makeRequest('POST', `/subscriptions/${subscriptionId}/reactivate`, undefined, {
|
|
92
92
|
cache: false,
|
|
93
93
|
});
|
|
94
94
|
}, 'reactivateSubscription');
|
|
@@ -99,7 +99,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
99
99
|
async getCurrentSubscription() {
|
|
100
100
|
return this.withAuthRetry(async () => {
|
|
101
101
|
try {
|
|
102
|
-
return await this.makeRequest('GET', '/
|
|
102
|
+
return await this.makeRequest('GET', '/subscriptions/current', undefined, {
|
|
103
103
|
cache: true,
|
|
104
104
|
cacheTTL: CACHE_TIMES.SHORT,
|
|
105
105
|
});
|
|
@@ -119,7 +119,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
119
119
|
*/
|
|
120
120
|
async getSavedItems(userId) {
|
|
121
121
|
return this.withAuthRetry(async () => {
|
|
122
|
-
const endpoint = userId ? `/
|
|
122
|
+
const endpoint = userId ? `/users/${userId}/saves` : '/saves';
|
|
123
123
|
return await this.makeRequest('GET', endpoint, undefined, {
|
|
124
124
|
cache: true,
|
|
125
125
|
cacheTTL: CACHE_TIMES.SHORT,
|
|
@@ -131,7 +131,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
131
131
|
*/
|
|
132
132
|
async getCollections(userId) {
|
|
133
133
|
return this.withAuthRetry(async () => {
|
|
134
|
-
const endpoint = userId ? `/
|
|
134
|
+
const endpoint = userId ? `/users/${userId}/collections` : '/collections';
|
|
135
135
|
return await this.makeRequest('GET', endpoint, undefined, {
|
|
136
136
|
cache: true,
|
|
137
137
|
cacheTTL: CACHE_TIMES.SHORT,
|
|
@@ -143,7 +143,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
143
143
|
*/
|
|
144
144
|
async saveItem(itemId, itemType, collectionId) {
|
|
145
145
|
return this.withAuthRetry(async () => {
|
|
146
|
-
return await this.makeRequest('POST', '/
|
|
146
|
+
return await this.makeRequest('POST', '/saves', {
|
|
147
147
|
itemId,
|
|
148
148
|
itemType,
|
|
149
149
|
collectionId,
|
|
@@ -155,7 +155,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
155
155
|
*/
|
|
156
156
|
async removeSavedItem(saveId) {
|
|
157
157
|
return this.withAuthRetry(async () => {
|
|
158
|
-
await this.makeRequest('DELETE', `/
|
|
158
|
+
await this.makeRequest('DELETE', `/saves/${saveId}`, undefined, { cache: false });
|
|
159
159
|
}, 'removeSavedItem');
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
@@ -163,7 +163,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
163
163
|
*/
|
|
164
164
|
async createCollection(name, description) {
|
|
165
165
|
return this.withAuthRetry(async () => {
|
|
166
|
-
return await this.makeRequest('POST', '/
|
|
166
|
+
return await this.makeRequest('POST', '/collections', {
|
|
167
167
|
name,
|
|
168
168
|
description,
|
|
169
169
|
}, { cache: false });
|
|
@@ -174,7 +174,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
174
174
|
*/
|
|
175
175
|
async deleteCollection(collectionId) {
|
|
176
176
|
return this.withAuthRetry(async () => {
|
|
177
|
-
await this.makeRequest('DELETE', `/
|
|
177
|
+
await this.makeRequest('DELETE', `/collections/${collectionId}`, undefined, { cache: false });
|
|
178
178
|
}, 'deleteCollection');
|
|
179
179
|
}
|
|
180
180
|
// ==================
|
|
@@ -185,7 +185,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
185
185
|
*/
|
|
186
186
|
async getUserStats(userId) {
|
|
187
187
|
try {
|
|
188
|
-
return await this.makeRequest('GET', `/
|
|
188
|
+
return await this.makeRequest('GET', `/users/${userId}/stats`, undefined, {
|
|
189
189
|
cache: true,
|
|
190
190
|
cacheTTL: CACHE_TIMES.MEDIUM,
|
|
191
191
|
});
|
|
@@ -207,7 +207,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
207
207
|
params.limit = limit;
|
|
208
208
|
if (offset)
|
|
209
209
|
params.offset = offset;
|
|
210
|
-
const endpoint = userId ? `/
|
|
210
|
+
const endpoint = userId ? `/users/${userId}/history` : '/history';
|
|
211
211
|
return await this.makeRequest('GET', endpoint, params, {
|
|
212
212
|
cache: true,
|
|
213
213
|
cacheTTL: CACHE_TIMES.SHORT,
|
|
@@ -219,7 +219,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
219
219
|
*/
|
|
220
220
|
async clearUserHistory() {
|
|
221
221
|
return this.withAuthRetry(async () => {
|
|
222
|
-
await this.makeRequest('DELETE', '/
|
|
222
|
+
await this.makeRequest('DELETE', '/history', undefined, { cache: false });
|
|
223
223
|
}, 'clearUserHistory');
|
|
224
224
|
}
|
|
225
225
|
/**
|
|
@@ -227,7 +227,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
227
227
|
*/
|
|
228
228
|
async deleteHistoryItem(itemId) {
|
|
229
229
|
return this.withAuthRetry(async () => {
|
|
230
|
-
await this.makeRequest('DELETE', `/
|
|
230
|
+
await this.makeRequest('DELETE', `/history/${itemId}`, undefined, { cache: false });
|
|
231
231
|
}, 'deleteHistoryItem');
|
|
232
232
|
}
|
|
233
233
|
// ==================
|
|
@@ -239,7 +239,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
239
239
|
async getFAQs(category) {
|
|
240
240
|
try {
|
|
241
241
|
const params = category ? { category } : undefined;
|
|
242
|
-
return await this.makeRequest('GET', '/
|
|
242
|
+
return await this.makeRequest('GET', '/faqs', params, {
|
|
243
243
|
cache: true,
|
|
244
244
|
cacheTTL: CACHE_TIMES.LONG,
|
|
245
245
|
});
|
|
@@ -253,7 +253,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
253
253
|
*/
|
|
254
254
|
async searchFAQs(query) {
|
|
255
255
|
try {
|
|
256
|
-
return await this.makeRequest('GET', '/
|
|
256
|
+
return await this.makeRequest('GET', '/faqs/search', { query }, {
|
|
257
257
|
cache: true,
|
|
258
258
|
cacheTTL: CACHE_TIMES.MEDIUM,
|
|
259
259
|
});
|
|
@@ -270,7 +270,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
270
270
|
*/
|
|
271
271
|
async getUserAchievements(userId) {
|
|
272
272
|
return this.withAuthRetry(async () => {
|
|
273
|
-
const endpoint = userId ? `/
|
|
273
|
+
const endpoint = userId ? `/users/${userId}/achievements` : '/achievements';
|
|
274
274
|
return await this.makeRequest('GET', endpoint, undefined, {
|
|
275
275
|
cache: true,
|
|
276
276
|
cacheTTL: CACHE_TIMES.MEDIUM,
|
|
@@ -282,7 +282,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
282
282
|
*/
|
|
283
283
|
async getAllAchievements() {
|
|
284
284
|
try {
|
|
285
|
-
return await this.makeRequest('GET', '/
|
|
285
|
+
return await this.makeRequest('GET', '/achievements/all', undefined, {
|
|
286
286
|
cache: true,
|
|
287
287
|
cacheTTL: CACHE_TIMES.LONG,
|
|
288
288
|
});
|
|
@@ -299,7 +299,7 @@ export function OxyServicesFeaturesMixin(Base) {
|
|
|
299
299
|
*/
|
|
300
300
|
async deleteAccount(password) {
|
|
301
301
|
return this.withAuthRetry(async () => {
|
|
302
|
-
await this.makeRequest('DELETE', '/
|
|
302
|
+
await this.makeRequest('DELETE', '/account', { password }, { cache: false });
|
|
303
303
|
}, 'deleteAccount');
|
|
304
304
|
}
|
|
305
305
|
};
|
|
@@ -340,7 +340,7 @@ export function OxyServicesFedCMMixin(Base) {
|
|
|
340
340
|
async exchangeIdTokenForSession(idToken) {
|
|
341
341
|
debug.log('Exchanging ID token for session...');
|
|
342
342
|
try {
|
|
343
|
-
const response = await this.makeRequest('POST', '/
|
|
343
|
+
const response = await this.makeRequest('POST', '/fedcm/exchange', { id_token: idToken }, { cache: false });
|
|
344
344
|
debug.log('Token exchange complete:', {
|
|
345
345
|
hasSession: !!response?.sessionId,
|
|
346
346
|
hasUser: !!response?.user,
|
|
@@ -9,7 +9,7 @@ export function OxyServicesKarmaMixin(Base) {
|
|
|
9
9
|
*/
|
|
10
10
|
async getUserKarma(userId) {
|
|
11
11
|
try {
|
|
12
|
-
return await this.makeRequest('GET', `/
|
|
12
|
+
return await this.makeRequest('GET', `/karma/${userId}`, undefined, {
|
|
13
13
|
cache: true,
|
|
14
14
|
cacheTTL: 2 * 60 * 1000, // 2 minutes cache
|
|
15
15
|
});
|
|
@@ -23,7 +23,7 @@ export function OxyServicesKarmaMixin(Base) {
|
|
|
23
23
|
*/
|
|
24
24
|
async giveKarma(userId, amount, reason) {
|
|
25
25
|
try {
|
|
26
|
-
return await this.makeRequest('POST', `/
|
|
26
|
+
return await this.makeRequest('POST', `/karma/${userId}/give`, {
|
|
27
27
|
amount,
|
|
28
28
|
reason
|
|
29
29
|
}, { cache: false });
|
|
@@ -39,7 +39,7 @@ export function OxyServicesKarmaMixin(Base) {
|
|
|
39
39
|
*/
|
|
40
40
|
async getUserKarmaTotal(userId) {
|
|
41
41
|
try {
|
|
42
|
-
return await this.makeRequest('GET', `/
|
|
42
|
+
return await this.makeRequest('GET', `/karma/${userId}/total`, undefined, {
|
|
43
43
|
cache: true,
|
|
44
44
|
cacheTTL: CACHE_TIMES.MEDIUM,
|
|
45
45
|
});
|
|
@@ -62,7 +62,7 @@ export function OxyServicesKarmaMixin(Base) {
|
|
|
62
62
|
params.limit = limit;
|
|
63
63
|
if (offset)
|
|
64
64
|
params.offset = offset;
|
|
65
|
-
return await this.makeRequest('GET', `/
|
|
65
|
+
return await this.makeRequest('GET', `/karma/${userId}/history`, params, {
|
|
66
66
|
cache: true,
|
|
67
67
|
cacheTTL: CACHE_TIMES.MEDIUM,
|
|
68
68
|
});
|
|
@@ -77,7 +77,7 @@ export function OxyServicesKarmaMixin(Base) {
|
|
|
77
77
|
*/
|
|
78
78
|
async getKarmaLeaderboard() {
|
|
79
79
|
try {
|
|
80
|
-
return await this.makeRequest('GET', '/
|
|
80
|
+
return await this.makeRequest('GET', '/karma/leaderboard', undefined, {
|
|
81
81
|
cache: true,
|
|
82
82
|
cacheTTL: CACHE_TIMES.LONG,
|
|
83
83
|
});
|
|
@@ -92,7 +92,7 @@ export function OxyServicesKarmaMixin(Base) {
|
|
|
92
92
|
*/
|
|
93
93
|
async getKarmaRules() {
|
|
94
94
|
try {
|
|
95
|
-
return await this.makeRequest('GET', '/
|
|
95
|
+
return await this.makeRequest('GET', '/karma/rules', undefined, {
|
|
96
96
|
cache: true,
|
|
97
97
|
cacheTTL: CACHE_TIMES.EXTRA_LONG, // Rules don't change often
|
|
98
98
|
});
|