airsoft-defense-connector 0.1.0 → 0.2.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/README.md +14 -0
- package/package.json +1 -1
- package/src/client.js +6 -4
package/README.md
CHANGED
|
@@ -209,6 +209,20 @@ const players = await api.listPlayers({ page: 1, size: 20 });
|
|
|
209
209
|
|
|
210
210
|
Pass API-relative paths beginning with / and omit the /api prefix. Use query for URL parameters and json for a documented JSON write body. The generic request method supports JSON endpoints.
|
|
211
211
|
|
|
212
|
+
### Game check-ins
|
|
213
|
+
|
|
214
|
+
Both methods accept an optional API-shaped body:
|
|
215
|
+
|
|
216
|
+
```js
|
|
217
|
+
await api.checkInPlayer(siteId, userId, { play_date: '2025-11-08' });
|
|
218
|
+
await api.selfCheckIn(siteId, {
|
|
219
|
+
play_date: '2025-11-08',
|
|
220
|
+
location: { latitude: 51.5, longitude: -0.12, accuracy: 18 },
|
|
221
|
+
});
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Omit `play_date` to use the server receipt date in Europe/London. Invalid or future London dates return 422. Self check-ins may also include `location` with latitude and longitude in decimal degrees and accuracy in metres, or `{ status: 'permission_denied' }` / `{ status: 'unavailable' }` when appropriate. Omit `location` entirely if GPS is unsupported; `null` or an empty object is assessed differently. For self check-ins, location and historical dates are advisory and can add risk points. A 201 acknowledges processing, not a saved record; duplicates may return 409.
|
|
225
|
+
|
|
212
226
|
## Handle errors and test locally
|
|
213
227
|
|
|
214
228
|
| Error | Meaning |
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -409,19 +409,21 @@ export class Client {
|
|
|
409
409
|
* Record an attendee's check-in. The API can return 409 if one already exists.
|
|
410
410
|
* @param {ResourceId} siteId site record ID.
|
|
411
411
|
* @param {ResourceId} userId Attendee's user record ID.
|
|
412
|
+
* @param {object} [data] Optional request body, including play_date (YYYY-MM-DD).
|
|
412
413
|
* @returns {Promise<JsonResponse|null>}
|
|
413
414
|
*/
|
|
414
|
-
checkInPlayer(siteId, userId) {
|
|
415
|
-
return this.request('POST', '/games/checkin/' + recordId(siteId) + '/' + recordId(userId));
|
|
415
|
+
checkInPlayer(siteId, userId, data) {
|
|
416
|
+
return this.request('POST', '/games/checkin/' + recordId(siteId) + '/' + recordId(userId), { json: data });
|
|
416
417
|
}
|
|
417
418
|
|
|
418
419
|
/**
|
|
419
420
|
* Record the signed-in user's check-in at a site.
|
|
420
421
|
* @param {ResourceId} siteId site record ID.
|
|
422
|
+
* @param {object} [data] Optional request body, including play_date and location.
|
|
421
423
|
* @returns {Promise<JsonResponse|null>}
|
|
422
424
|
*/
|
|
423
|
-
selfCheckIn(siteId) {
|
|
424
|
-
return this.request('POST', '/games/self-checkin/' + recordId(siteId));
|
|
425
|
+
selfCheckIn(siteId, data) {
|
|
426
|
+
return this.request('POST', '/games/self-checkin/' + recordId(siteId), { json: data });
|
|
425
427
|
}
|
|
426
428
|
|
|
427
429
|
/**
|