@safercity/sdk 0.2.1 → 0.3.1
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/README.md +64 -11
- package/dist/index.cjs +136 -101
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5156 -447
- package/dist/index.d.ts +5156 -447
- package/dist/index.js +136 -101
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/dist/index.cjs
CHANGED
|
@@ -49,7 +49,7 @@ function createSaferCityClient(options) {
|
|
|
49
49
|
/**
|
|
50
50
|
* Check API health status
|
|
51
51
|
*/
|
|
52
|
-
check: () => baseClient.get("/health")
|
|
52
|
+
check: () => baseClient.get("/health").then((r) => r.data)
|
|
53
53
|
},
|
|
54
54
|
// ==================
|
|
55
55
|
// Authentication
|
|
@@ -58,11 +58,11 @@ function createSaferCityClient(options) {
|
|
|
58
58
|
/**
|
|
59
59
|
* Get current authentication context
|
|
60
60
|
*/
|
|
61
|
-
whoami: () => baseClient.get("/auth/whoami"),
|
|
61
|
+
whoami: () => baseClient.get("/auth/whoami").then((r) => r.data),
|
|
62
62
|
/**
|
|
63
63
|
* Check if authenticated (optional auth)
|
|
64
64
|
*/
|
|
65
|
-
check: () => baseClient.get("/auth/optional")
|
|
65
|
+
check: () => baseClient.get("/auth/optional").then((r) => r.data)
|
|
66
66
|
},
|
|
67
67
|
// ==================
|
|
68
68
|
// Users (user-scoped)
|
|
@@ -71,15 +71,15 @@ function createSaferCityClient(options) {
|
|
|
71
71
|
/**
|
|
72
72
|
* Create user (used by tenant apps to register users)
|
|
73
73
|
*/
|
|
74
|
-
create: (body) => baseClient.post("/v1/users", body),
|
|
74
|
+
create: (body) => baseClient.post("/v1/users", body).then((r) => r.data),
|
|
75
75
|
/**
|
|
76
76
|
* Get user by ID
|
|
77
77
|
*/
|
|
78
|
-
get: (userId2) => baseClient.get(`/v1/users/${resolveUserId(userId2)}`),
|
|
78
|
+
get: (userId2) => baseClient.get(`/v1/users/${resolveUserId(userId2)}`).then((r) => r.data),
|
|
79
79
|
/**
|
|
80
80
|
* Update user (user can update self)
|
|
81
81
|
*/
|
|
82
|
-
update: (userId2, body) => baseClient.put(`/v1/users/${resolveUserId(userId2)}`, body)
|
|
82
|
+
update: (userId2, body) => baseClient.put(`/v1/users/${resolveUserId(userId2)}`, body).then((r) => r.data)
|
|
83
83
|
},
|
|
84
84
|
// ==================
|
|
85
85
|
// Panics
|
|
@@ -88,9 +88,12 @@ function createSaferCityClient(options) {
|
|
|
88
88
|
/**
|
|
89
89
|
* Create panic
|
|
90
90
|
*/
|
|
91
|
-
create: (body) => {
|
|
92
|
-
const
|
|
93
|
-
|
|
91
|
+
create: async (body) => {
|
|
92
|
+
const response = await baseClient.post("/v1/panic", {
|
|
93
|
+
...body,
|
|
94
|
+
userId: resolveUserId(body.userId)
|
|
95
|
+
}).then((r) => r.data);
|
|
96
|
+
return response;
|
|
94
97
|
},
|
|
95
98
|
/**
|
|
96
99
|
* Get panic by ID
|
|
@@ -100,25 +103,31 @@ function createSaferCityClient(options) {
|
|
|
100
103
|
...query,
|
|
101
104
|
userId: resolveUserId(query?.userId)
|
|
102
105
|
}
|
|
103
|
-
}),
|
|
106
|
+
}).then((r) => r.data),
|
|
104
107
|
/**
|
|
105
108
|
* Update panic location
|
|
106
109
|
*/
|
|
107
|
-
updateLocation: (panicId, body) => {
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
+
updateLocation: async (panicId, body) => {
|
|
111
|
+
const response = await baseClient.put(`/v1/panic/${panicId}/location`, {
|
|
112
|
+
...body,
|
|
113
|
+
userId: resolveUserId(body.userId)
|
|
114
|
+
}).then((r) => r.data);
|
|
115
|
+
return response;
|
|
110
116
|
},
|
|
111
117
|
/**
|
|
112
118
|
* Cancel panic
|
|
113
119
|
*/
|
|
114
|
-
cancel: (panicId, body) => {
|
|
115
|
-
const
|
|
116
|
-
|
|
120
|
+
cancel: async (panicId, body) => {
|
|
121
|
+
const response = await baseClient.put(`/v1/panic/${panicId}/cancel`, {
|
|
122
|
+
...body,
|
|
123
|
+
userId: resolveUserId(body.userId)
|
|
124
|
+
}).then((r) => r.data);
|
|
125
|
+
return response;
|
|
117
126
|
},
|
|
118
127
|
/**
|
|
119
128
|
* Get available panic types for a user
|
|
120
129
|
*/
|
|
121
|
-
types: (userId2) => baseClient.get(`/v1/panic/types/${resolveUserId(userId2)}`),
|
|
130
|
+
types: (userId2) => baseClient.get(`/v1/panic/types/${resolveUserId(userId2)}`).then((r) => r.data),
|
|
122
131
|
/**
|
|
123
132
|
* Stream panic updates (SSE)
|
|
124
133
|
*/
|
|
@@ -141,30 +150,35 @@ function createSaferCityClient(options) {
|
|
|
141
150
|
/**
|
|
142
151
|
* Create panic information profile
|
|
143
152
|
*/
|
|
144
|
-
create: (body) => {
|
|
145
|
-
const
|
|
146
|
-
|
|
153
|
+
create: async (body) => {
|
|
154
|
+
const response = await baseClient.post("/v1/panic-information", {
|
|
155
|
+
...body,
|
|
156
|
+
userId: resolveUserId(body.userId)
|
|
157
|
+
}).then((r) => r.data);
|
|
158
|
+
return response;
|
|
147
159
|
},
|
|
148
160
|
/**
|
|
149
161
|
* Get panic information by ID
|
|
150
162
|
*/
|
|
151
|
-
get: (id) => baseClient.get(`/v1/panic-information/${id}`),
|
|
163
|
+
get: (id) => baseClient.get(`/v1/panic-information/${id}`).then((r) => r.data),
|
|
152
164
|
/**
|
|
153
165
|
* Get panic information by user ID
|
|
154
166
|
*/
|
|
155
|
-
getByUser: (userId2) => baseClient.get(`/v1/panic-information/user/${resolveUserId(userId2)}`),
|
|
167
|
+
getByUser: (userId2) => baseClient.get(`/v1/panic-information/user/${resolveUserId(userId2)}`).then((r) => r.data),
|
|
156
168
|
/**
|
|
157
169
|
* Update panic information
|
|
158
170
|
*/
|
|
159
|
-
update: (id, body) => baseClient.put(`/v1/panic-information/${id}`, body),
|
|
171
|
+
update: (id, body) => baseClient.put(`/v1/panic-information/${id}`, body).then((r) => r.data),
|
|
160
172
|
/**
|
|
161
173
|
* Delete panic information
|
|
162
174
|
*/
|
|
163
|
-
delete: (id) => baseClient.delete(`/v1/panic-information/${id}`),
|
|
175
|
+
delete: (id) => baseClient.delete(`/v1/panic-information/${id}`).then((r) => r.data),
|
|
164
176
|
/**
|
|
165
177
|
* Validate user eligibility for panic services
|
|
166
178
|
*/
|
|
167
|
-
validateEligibility: (userId2) => baseClient.get(
|
|
179
|
+
validateEligibility: (userId2) => baseClient.get(
|
|
180
|
+
`/v1/panic-information/validation/${resolveUserId(userId2)}`
|
|
181
|
+
).then((r) => r.data)
|
|
168
182
|
},
|
|
169
183
|
// ==================
|
|
170
184
|
// Subscriptions
|
|
@@ -173,32 +187,38 @@ function createSaferCityClient(options) {
|
|
|
173
187
|
/**
|
|
174
188
|
* List subscription types
|
|
175
189
|
*/
|
|
176
|
-
listTypes: () => baseClient.get("/v1/subscriptions/types"),
|
|
190
|
+
listTypes: () => baseClient.get("/v1/subscriptions/types").then((r) => r.data),
|
|
177
191
|
/**
|
|
178
192
|
* Create subscription
|
|
179
193
|
*/
|
|
180
|
-
create: (body) => {
|
|
181
|
-
const
|
|
182
|
-
|
|
194
|
+
create: async (body) => {
|
|
195
|
+
const response = await baseClient.post("/v1/subscriptions", {
|
|
196
|
+
...body,
|
|
197
|
+
userId: resolveUserId(body.userId)
|
|
198
|
+
}).then((r) => r.data);
|
|
199
|
+
return response;
|
|
183
200
|
},
|
|
184
201
|
/**
|
|
185
202
|
* List subscriptions
|
|
186
203
|
*/
|
|
187
|
-
list: (query) => {
|
|
188
|
-
const
|
|
189
|
-
return baseClient.get("/v1/subscriptions", {
|
|
204
|
+
list: async (query) => {
|
|
205
|
+
const response = await baseClient.get("/v1/subscriptions", {
|
|
190
206
|
query: {
|
|
191
207
|
...query,
|
|
192
|
-
userId:
|
|
208
|
+
userId: resolveUserId(query?.userId)
|
|
193
209
|
}
|
|
194
|
-
});
|
|
210
|
+
}).then((r) => r.data);
|
|
211
|
+
return response;
|
|
195
212
|
},
|
|
196
213
|
/**
|
|
197
214
|
* Subscribe a user to a subscription type
|
|
198
215
|
*/
|
|
199
|
-
subscribeUser: (body) => {
|
|
200
|
-
const
|
|
201
|
-
|
|
216
|
+
subscribeUser: async (body) => {
|
|
217
|
+
const response = await baseClient.post(
|
|
218
|
+
"/v1/subscriptions/subscribe-user",
|
|
219
|
+
{ ...body, userId: resolveUserId(body.userId) }
|
|
220
|
+
).then((r) => r.data);
|
|
221
|
+
return response;
|
|
202
222
|
}
|
|
203
223
|
},
|
|
204
224
|
// ==================
|
|
@@ -208,35 +228,43 @@ function createSaferCityClient(options) {
|
|
|
208
228
|
/**
|
|
209
229
|
* Create subscriber
|
|
210
230
|
*/
|
|
211
|
-
createSubscriber: (body) => {
|
|
212
|
-
const
|
|
213
|
-
return baseClient.post("/v1/notifications/subscribers", {
|
|
231
|
+
createSubscriber: async (body) => {
|
|
232
|
+
const response = await baseClient.post("/v1/notifications/subscribers", {
|
|
214
233
|
...body,
|
|
215
|
-
userId:
|
|
216
|
-
});
|
|
234
|
+
userId: resolveUserId(body.userId)
|
|
235
|
+
}).then((r) => r.data);
|
|
236
|
+
return response;
|
|
217
237
|
},
|
|
218
238
|
/**
|
|
219
239
|
* Trigger notification
|
|
220
240
|
*/
|
|
221
|
-
trigger: (body) => {
|
|
222
|
-
const
|
|
223
|
-
|
|
241
|
+
trigger: async (body) => {
|
|
242
|
+
const response = await baseClient.post("/v1/notifications/trigger", {
|
|
243
|
+
...body,
|
|
244
|
+
userId: resolveUserId(body.userId)
|
|
245
|
+
}).then((r) => r.data);
|
|
246
|
+
return response;
|
|
224
247
|
},
|
|
225
248
|
/**
|
|
226
249
|
* Bulk trigger notifications
|
|
227
250
|
*/
|
|
228
|
-
bulkTrigger: (body) => baseClient.post(
|
|
251
|
+
bulkTrigger: (body) => baseClient.post(
|
|
252
|
+
"/v1/notifications/bulk-trigger",
|
|
253
|
+
body
|
|
254
|
+
).then((r) => r.data),
|
|
229
255
|
/**
|
|
230
256
|
* Get user preferences
|
|
231
257
|
*/
|
|
232
|
-
getPreferences: (userId2) => baseClient.get(
|
|
258
|
+
getPreferences: (userId2) => baseClient.get(
|
|
259
|
+
`/v1/notifications/preferences/${resolveUserId(userId2)}`
|
|
260
|
+
).then((r) => r.data),
|
|
233
261
|
/**
|
|
234
262
|
* Update user preferences
|
|
235
263
|
*/
|
|
236
264
|
updatePreferences: (userId2, body) => baseClient.put(
|
|
237
265
|
`/v1/notifications/preferences/${resolveUserId(userId2)}`,
|
|
238
266
|
body
|
|
239
|
-
)
|
|
267
|
+
).then((r) => r.data)
|
|
240
268
|
},
|
|
241
269
|
// ==================
|
|
242
270
|
// Location Safety
|
|
@@ -245,7 +273,7 @@ function createSaferCityClient(options) {
|
|
|
245
273
|
/**
|
|
246
274
|
* Check location safety
|
|
247
275
|
*/
|
|
248
|
-
check: (body) => baseClient.post("/v1/locations/safety-check", body)
|
|
276
|
+
check: (body) => baseClient.post("/v1/locations/safety-check", body).then((r) => r.data)
|
|
249
277
|
},
|
|
250
278
|
// ==================
|
|
251
279
|
// Banner
|
|
@@ -254,7 +282,7 @@ function createSaferCityClient(options) {
|
|
|
254
282
|
/**
|
|
255
283
|
* Get crime banner data for a location
|
|
256
284
|
*/
|
|
257
|
-
get: (body) => baseClient.post("/v1/banner", body)
|
|
285
|
+
get: (body) => baseClient.post("/v1/banner", body).then((r) => r.data)
|
|
258
286
|
},
|
|
259
287
|
// ==================
|
|
260
288
|
// Crimes
|
|
@@ -263,19 +291,19 @@ function createSaferCityClient(options) {
|
|
|
263
291
|
/**
|
|
264
292
|
* List crimes
|
|
265
293
|
*/
|
|
266
|
-
list: (query) => baseClient.get("/v1/crimes/list", { query }),
|
|
294
|
+
list: (query) => baseClient.get("/v1/crimes/list", { query }).then((r) => r.data),
|
|
267
295
|
/**
|
|
268
296
|
* Get crime categories
|
|
269
297
|
*/
|
|
270
|
-
categories: () => baseClient.get("/v1/crime-categories"),
|
|
298
|
+
categories: () => baseClient.get("/v1/crime-categories").then((r) => r.data),
|
|
271
299
|
/**
|
|
272
300
|
* Get crime types
|
|
273
301
|
*/
|
|
274
|
-
types: () => baseClient.get("/v1/crime-types"),
|
|
302
|
+
types: () => baseClient.get("/v1/crime-types").then((r) => r.data),
|
|
275
303
|
/**
|
|
276
304
|
* Get crime categories with their types
|
|
277
305
|
*/
|
|
278
|
-
categoriesWithTypes: () => baseClient.get("/v1/crime-categories/withTypes")
|
|
306
|
+
categoriesWithTypes: () => baseClient.get("/v1/crime-categories/withTypes").then((r) => r.data)
|
|
279
307
|
}
|
|
280
308
|
};
|
|
281
309
|
}
|
|
@@ -336,7 +364,7 @@ var ServerClient = class extends sdkCore.BaseClient {
|
|
|
336
364
|
*/
|
|
337
365
|
get health() {
|
|
338
366
|
return {
|
|
339
|
-
check: () => this.get("/health")
|
|
367
|
+
check: () => this.get("/health").then((r) => r.data)
|
|
340
368
|
};
|
|
341
369
|
}
|
|
342
370
|
// ==================
|
|
@@ -350,11 +378,11 @@ var ServerClient = class extends sdkCore.BaseClient {
|
|
|
350
378
|
/**
|
|
351
379
|
* Get current authentication context
|
|
352
380
|
*/
|
|
353
|
-
whoami: () => this.get("/auth/whoami"),
|
|
381
|
+
whoami: () => this.get("/auth/whoami").then((r) => r.data),
|
|
354
382
|
/**
|
|
355
383
|
* Check if authenticated (optional auth)
|
|
356
384
|
*/
|
|
357
|
-
check: () => this.get("/auth/optional")
|
|
385
|
+
check: () => this.get("/auth/optional").then((r) => r.data)
|
|
358
386
|
};
|
|
359
387
|
}
|
|
360
388
|
// ==================
|
|
@@ -368,19 +396,19 @@ var ServerClient = class extends sdkCore.BaseClient {
|
|
|
368
396
|
/**
|
|
369
397
|
* Get access token
|
|
370
398
|
*/
|
|
371
|
-
token: (body) => this.post("/v1/oauth/token", body),
|
|
399
|
+
token: (body) => this.post("/v1/oauth/token", body).then((r) => r.data),
|
|
372
400
|
/**
|
|
373
401
|
* Refresh access token
|
|
374
402
|
*/
|
|
375
|
-
refresh: (body) => this.post("/v1/oauth/refresh", body),
|
|
403
|
+
refresh: (body) => this.post("/v1/oauth/refresh", body).then((r) => r.data),
|
|
376
404
|
/**
|
|
377
405
|
* Introspect token
|
|
378
406
|
*/
|
|
379
|
-
introspect: (body) => this.post("/v1/oauth/introspect", body),
|
|
407
|
+
introspect: (body) => this.post("/v1/oauth/introspect", body).then((r) => r.data),
|
|
380
408
|
/**
|
|
381
409
|
* Revoke token
|
|
382
410
|
*/
|
|
383
|
-
revoke: (body) => this.post("/v1/oauth/revoke", body)
|
|
411
|
+
revoke: (body) => this.post("/v1/oauth/revoke", body).then((r) => r.data)
|
|
384
412
|
};
|
|
385
413
|
}
|
|
386
414
|
// ==================
|
|
@@ -394,11 +422,11 @@ var ServerClient = class extends sdkCore.BaseClient {
|
|
|
394
422
|
/**
|
|
395
423
|
* Create a new tenant
|
|
396
424
|
*/
|
|
397
|
-
create: (body) => this.post("/v1/tenants", body),
|
|
425
|
+
create: (body) => this.post("/v1/tenants", body).then((r) => r.data),
|
|
398
426
|
/**
|
|
399
427
|
* List tenants (admin)
|
|
400
428
|
*/
|
|
401
|
-
list: (query) => this.get("/v1/tenants", { query })
|
|
429
|
+
list: (query) => this.get("/v1/tenants", { query }).then((r) => r.data)
|
|
402
430
|
};
|
|
403
431
|
}
|
|
404
432
|
// ==================
|
|
@@ -412,15 +440,15 @@ var ServerClient = class extends sdkCore.BaseClient {
|
|
|
412
440
|
/**
|
|
413
441
|
* Exchange setup token for credentials
|
|
414
442
|
*/
|
|
415
|
-
setup: (body) => this.post("/v1/credentials", body),
|
|
443
|
+
setup: (body) => this.post("/v1/credentials", body).then((r) => r.data),
|
|
416
444
|
/**
|
|
417
445
|
* List credentials
|
|
418
446
|
*/
|
|
419
|
-
list: () => this.get("/v1/credentials"),
|
|
447
|
+
list: () => this.get("/v1/credentials").then((r) => r.data),
|
|
420
448
|
/**
|
|
421
449
|
* Revoke credential
|
|
422
450
|
*/
|
|
423
|
-
revoke: (credentialId) => this.delete(`/v1/credentials/${credentialId}`)
|
|
451
|
+
revoke: (credentialId) => this.delete(`/v1/credentials/${credentialId}`).then((r) => r.data)
|
|
424
452
|
};
|
|
425
453
|
}
|
|
426
454
|
// ==================
|
|
@@ -434,27 +462,27 @@ var ServerClient = class extends sdkCore.BaseClient {
|
|
|
434
462
|
/**
|
|
435
463
|
* Create user
|
|
436
464
|
*/
|
|
437
|
-
create: (body) => this.post("/v1/users", body),
|
|
465
|
+
create: (body) => this.post("/v1/users", body).then((r) => r.data),
|
|
438
466
|
/**
|
|
439
467
|
* List users
|
|
440
468
|
*/
|
|
441
|
-
list: (query) => this.get("/v1/users", { query }),
|
|
469
|
+
list: (query) => this.get("/v1/users", { query }).then((r) => r.data),
|
|
442
470
|
/**
|
|
443
471
|
* Get user by ID
|
|
444
472
|
*/
|
|
445
|
-
get: (userId) => this.get(`/v1/users/${userId}`),
|
|
473
|
+
get: (userId) => this.get(`/v1/users/${userId}`).then((r) => r.data),
|
|
446
474
|
/**
|
|
447
475
|
* Update user
|
|
448
476
|
*/
|
|
449
|
-
update: (userId, body) => this.put(`/v1/users/${userId}`, body),
|
|
477
|
+
update: (userId, body) => this.put(`/v1/users/${userId}`, body).then((r) => r.data),
|
|
450
478
|
/**
|
|
451
479
|
* Update user status
|
|
452
480
|
*/
|
|
453
|
-
updateStatus: (userId, body) => this.patch(`/v1/users/${userId}/status`, body),
|
|
481
|
+
updateStatus: (userId, body) => this.patch(`/v1/users/${userId}/status`, body).then((r) => r.data),
|
|
454
482
|
/**
|
|
455
483
|
* Delete user
|
|
456
484
|
*/
|
|
457
|
-
delete: (userId) => this.delete(`/v1/users/${userId}`)
|
|
485
|
+
delete: (userId) => this.delete(`/v1/users/${userId}`).then((r) => r.data)
|
|
458
486
|
};
|
|
459
487
|
}
|
|
460
488
|
// ==================
|
|
@@ -468,27 +496,27 @@ var ServerClient = class extends sdkCore.BaseClient {
|
|
|
468
496
|
/**
|
|
469
497
|
* Create panic
|
|
470
498
|
*/
|
|
471
|
-
create: (body) => this.post("/v1/panic", body),
|
|
499
|
+
create: (body) => this.post("/v1/panic", body).then((r) => r.data),
|
|
472
500
|
/**
|
|
473
501
|
* Get panic by ID
|
|
474
502
|
*/
|
|
475
|
-
get: (panicId, query) => this.get(`/v1/panic/${panicId}`, { query }),
|
|
503
|
+
get: (panicId, query) => this.get(`/v1/panic/${panicId}`, { query }).then((r) => r.data),
|
|
476
504
|
/**
|
|
477
505
|
* List panics
|
|
478
506
|
*/
|
|
479
|
-
list: (query) => this.get("/v1/panic", { query }),
|
|
507
|
+
list: (query) => this.get("/v1/panic", { query }).then((r) => r.data),
|
|
480
508
|
/**
|
|
481
509
|
* Update panic location
|
|
482
510
|
*/
|
|
483
|
-
updateLocation: (panicId, body) => this.put(`/v1/panic/${panicId}/location`, body),
|
|
511
|
+
updateLocation: (panicId, body) => this.put(`/v1/panic/${panicId}/location`, body).then((r) => r.data),
|
|
484
512
|
/**
|
|
485
513
|
* Cancel panic
|
|
486
514
|
*/
|
|
487
|
-
cancel: (panicId, body) => this.put(`/v1/panic/${panicId}/cancel`, body),
|
|
515
|
+
cancel: (panicId, body) => this.put(`/v1/panic/${panicId}/cancel`, body).then((r) => r.data),
|
|
488
516
|
/**
|
|
489
517
|
* Get available panic types for a user
|
|
490
518
|
*/
|
|
491
|
-
types: (userId) => this.get(`/v1/panic/types/${userId}`)
|
|
519
|
+
types: (userId) => this.get(`/v1/panic/types/${userId}`).then((r) => r.data)
|
|
492
520
|
};
|
|
493
521
|
}
|
|
494
522
|
// ==================
|
|
@@ -502,23 +530,23 @@ var ServerClient = class extends sdkCore.BaseClient {
|
|
|
502
530
|
/**
|
|
503
531
|
* List subscription types
|
|
504
532
|
*/
|
|
505
|
-
listTypes: () => this.get("/v1/subscriptions/types"),
|
|
533
|
+
listTypes: () => this.get("/v1/subscriptions/types").then((r) => r.data),
|
|
506
534
|
/**
|
|
507
535
|
* Create subscription
|
|
508
536
|
*/
|
|
509
|
-
create: (body) => this.post("/v1/subscriptions", body),
|
|
537
|
+
create: (body) => this.post("/v1/subscriptions", body).then((r) => r.data),
|
|
510
538
|
/**
|
|
511
539
|
* List subscriptions
|
|
512
540
|
*/
|
|
513
|
-
list: (query) => this.get("/v1/subscriptions", { query }),
|
|
541
|
+
list: (query) => this.get("/v1/subscriptions", { query }).then((r) => r.data),
|
|
514
542
|
/**
|
|
515
543
|
* Get subscription stats
|
|
516
544
|
*/
|
|
517
|
-
stats: () => this.get("/v1/subscriptions/stats"),
|
|
545
|
+
stats: () => this.get("/v1/subscriptions/stats").then((r) => r.data),
|
|
518
546
|
/**
|
|
519
547
|
* Subscribe a user to a subscription type
|
|
520
548
|
*/
|
|
521
|
-
subscribeUser: (body) => this.post("/v1/subscriptions/subscribe-user", body)
|
|
549
|
+
subscribeUser: (body) => this.post("/v1/subscriptions/subscribe-user", body).then((r) => r.data)
|
|
522
550
|
};
|
|
523
551
|
}
|
|
524
552
|
// ==================
|
|
@@ -532,23 +560,28 @@ var ServerClient = class extends sdkCore.BaseClient {
|
|
|
532
560
|
/**
|
|
533
561
|
* Create subscriber
|
|
534
562
|
*/
|
|
535
|
-
createSubscriber: (body) => this.post("/v1/notifications/subscribers", body),
|
|
563
|
+
createSubscriber: (body) => this.post("/v1/notifications/subscribers", body).then((r) => r.data),
|
|
536
564
|
/**
|
|
537
565
|
* Trigger notification
|
|
538
566
|
*/
|
|
539
|
-
trigger: (body) => this.post("/v1/notifications/trigger", body),
|
|
567
|
+
trigger: (body) => this.post("/v1/notifications/trigger", body).then((r) => r.data),
|
|
540
568
|
/**
|
|
541
569
|
* Bulk trigger notifications
|
|
542
570
|
*/
|
|
543
|
-
bulkTrigger: (body) => this.post("/v1/notifications/bulk-trigger", body),
|
|
571
|
+
bulkTrigger: (body) => this.post("/v1/notifications/bulk-trigger", body).then((r) => r.data),
|
|
544
572
|
/**
|
|
545
573
|
* Get user preferences
|
|
546
574
|
*/
|
|
547
|
-
getPreferences: (userId) => this.get(
|
|
575
|
+
getPreferences: (userId) => this.get(
|
|
576
|
+
`/v1/notifications/preferences/${userId}`
|
|
577
|
+
).then((r) => r.data),
|
|
548
578
|
/**
|
|
549
579
|
* Update user preferences
|
|
550
580
|
*/
|
|
551
|
-
updatePreferences: (userId, body) => this.put(
|
|
581
|
+
updatePreferences: (userId, body) => this.put(
|
|
582
|
+
`/v1/notifications/preferences/${userId}`,
|
|
583
|
+
body
|
|
584
|
+
).then((r) => r.data)
|
|
552
585
|
};
|
|
553
586
|
}
|
|
554
587
|
// ==================
|
|
@@ -562,31 +595,33 @@ var ServerClient = class extends sdkCore.BaseClient {
|
|
|
562
595
|
/**
|
|
563
596
|
* Create panic information profile
|
|
564
597
|
*/
|
|
565
|
-
create: (body) => this.post("/v1/panic-information", body),
|
|
598
|
+
create: (body) => this.post("/v1/panic-information", body).then((r) => r.data),
|
|
566
599
|
/**
|
|
567
600
|
* List panic information records
|
|
568
601
|
*/
|
|
569
|
-
list: (query) => this.get("/v1/panic-information", { query }),
|
|
602
|
+
list: (query) => this.get("/v1/panic-information", { query }).then((r) => r.data),
|
|
570
603
|
/**
|
|
571
604
|
* Get panic information by ID
|
|
572
605
|
*/
|
|
573
|
-
get: (id) => this.get(`/v1/panic-information/${id}`),
|
|
606
|
+
get: (id) => this.get(`/v1/panic-information/${id}`).then((r) => r.data),
|
|
574
607
|
/**
|
|
575
608
|
* Get panic information by user ID
|
|
576
609
|
*/
|
|
577
|
-
getByUser: (userId) => this.get(`/v1/panic-information/user/${userId}`),
|
|
610
|
+
getByUser: (userId) => this.get(`/v1/panic-information/user/${userId}`).then((r) => r.data),
|
|
578
611
|
/**
|
|
579
612
|
* Update panic information
|
|
580
613
|
*/
|
|
581
|
-
update: (id, body) => this.put(`/v1/panic-information/${id}`, body),
|
|
614
|
+
update: (id, body) => this.put(`/v1/panic-information/${id}`, body).then((r) => r.data),
|
|
582
615
|
/**
|
|
583
616
|
* Delete panic information
|
|
584
617
|
*/
|
|
585
|
-
delete: (id) => this.delete(`/v1/panic-information/${id}`),
|
|
618
|
+
delete: (id) => this.delete(`/v1/panic-information/${id}`).then((r) => r.data),
|
|
586
619
|
/**
|
|
587
620
|
* Validate user eligibility for panic services
|
|
588
621
|
*/
|
|
589
|
-
validateEligibility: (userId) => this.get(
|
|
622
|
+
validateEligibility: (userId) => this.get(
|
|
623
|
+
`/v1/panic-information/validation/${userId}`
|
|
624
|
+
).then((r) => r.data)
|
|
590
625
|
};
|
|
591
626
|
}
|
|
592
627
|
// ==================
|
|
@@ -600,7 +635,7 @@ var ServerClient = class extends sdkCore.BaseClient {
|
|
|
600
635
|
/**
|
|
601
636
|
* Check location safety
|
|
602
637
|
*/
|
|
603
|
-
check: (body) => this.post("/v1/locations/safety-check", body)
|
|
638
|
+
check: (body) => this.post("/v1/locations/safety-check", body).then((r) => r.data)
|
|
604
639
|
};
|
|
605
640
|
}
|
|
606
641
|
// ==================
|
|
@@ -614,7 +649,7 @@ var ServerClient = class extends sdkCore.BaseClient {
|
|
|
614
649
|
/**
|
|
615
650
|
* Get crime banner data for a location
|
|
616
651
|
*/
|
|
617
|
-
get: (body) => this.post("/v1/banner", body)
|
|
652
|
+
get: (body) => this.post("/v1/banner", body).then((r) => r.data)
|
|
618
653
|
};
|
|
619
654
|
}
|
|
620
655
|
// ==================
|
|
@@ -628,19 +663,19 @@ var ServerClient = class extends sdkCore.BaseClient {
|
|
|
628
663
|
/**
|
|
629
664
|
* List crimes
|
|
630
665
|
*/
|
|
631
|
-
list: (query) => this.get("/v1/crimes/list", { query }),
|
|
666
|
+
list: (query) => this.get("/v1/crimes/list", { query }).then((r) => r.data),
|
|
632
667
|
/**
|
|
633
668
|
* Get crime categories
|
|
634
669
|
*/
|
|
635
|
-
categories: () => this.get("/v1/crime-categories"),
|
|
670
|
+
categories: () => this.get("/v1/crime-categories").then((r) => r.data),
|
|
636
671
|
/**
|
|
637
672
|
* Get crime types
|
|
638
673
|
*/
|
|
639
|
-
types: () => this.get("/v1/crime-types"),
|
|
674
|
+
types: () => this.get("/v1/crime-types").then((r) => r.data),
|
|
640
675
|
/**
|
|
641
676
|
* Get crime categories with their types
|
|
642
677
|
*/
|
|
643
|
-
categoriesWithTypes: () => this.get("/v1/crime-categories/withTypes")
|
|
678
|
+
categoriesWithTypes: () => this.get("/v1/crime-categories/withTypes").then((r) => r.data)
|
|
644
679
|
};
|
|
645
680
|
}
|
|
646
681
|
};
|