@medalsocial/sdk 1.8.0 → 1.10.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 +49 -1
- package/dist/openapi/medal-social.openapi.json +1742 -483
- package/dist/src/index.d.mts +353 -1
- package/dist/src/index.d.ts +353 -1
- package/dist/src/index.js +120 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +120 -0
- package/dist/src/index.mjs.map +1 -1
- package/dist/src/openapi.generated.d.mts +659 -1
- package/dist/src/openapi.generated.d.ts +659 -1
- package/dist/src/openapi.generated.js.map +1 -1
- package/openapi/medal-social.openapi.yaml +806 -4
- package/package.json +1 -1
- package/skills/resources/SKILL.md +7 -0
package/dist/src/index.mjs
CHANGED
|
@@ -291,11 +291,67 @@ var CapabilityConfirmer = class {
|
|
|
291
291
|
};
|
|
292
292
|
|
|
293
293
|
// src/resources/bookings.ts
|
|
294
|
+
var BookingsPayment = class {
|
|
295
|
+
constructor(client) {
|
|
296
|
+
this.client = client;
|
|
297
|
+
}
|
|
298
|
+
client;
|
|
299
|
+
/**
|
|
300
|
+
* Reserve (or charge) the booking's amount and get the wallet redirect.
|
|
301
|
+
*
|
|
302
|
+
* Automatically idempotent: the SDK mints an `Idempotency-Key` so its own
|
|
303
|
+
* 5xx retries replay instead of reserving twice. One live payment per
|
|
304
|
+
* booking — starting a second while one is outstanding answers 409; wait for
|
|
305
|
+
* the first to be approved, aborted, or to expire (ten minutes).
|
|
306
|
+
*
|
|
307
|
+
* A `return_url` the workspace's own sites do not vouch for is refused with
|
|
308
|
+
* 422, not 400: the URL parses, it is just not yours.
|
|
309
|
+
*/
|
|
310
|
+
async start(id, input, options) {
|
|
311
|
+
return this.client.postOnce(
|
|
312
|
+
`/api/v1/bookings/${encodeURIComponent(id)}/payment`,
|
|
313
|
+
input,
|
|
314
|
+
options
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* The newest payment attempt on the booking.
|
|
319
|
+
*
|
|
320
|
+
* Throws `MedalApiError` with status 404 when the booking has no payment at
|
|
321
|
+
* all — "not started" and "unknown booking" answer alike, so this is not an
|
|
322
|
+
* existence oracle. Earlier attempts are not returned; attempt N+1 is what
|
|
323
|
+
* "the payment" means to a caller polling a retry.
|
|
324
|
+
*/
|
|
325
|
+
async get(id) {
|
|
326
|
+
return this.client.get(`/api/v1/bookings/${encodeURIComponent(id)}/payment`);
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
var BookingsManagePayment = class {
|
|
330
|
+
constructor(client) {
|
|
331
|
+
this.client = client;
|
|
332
|
+
}
|
|
333
|
+
client;
|
|
334
|
+
/** Start a payment on the customer's behalf. See {@link BookingsPayment.start}. */
|
|
335
|
+
async start(token, input, options) {
|
|
336
|
+
return this.client.postOnce(
|
|
337
|
+
`/api/v1/bookings/manage/${encodeURIComponent(token)}/payment`,
|
|
338
|
+
input,
|
|
339
|
+
options
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
/** Read the payment on the customer's own booking. 404 when there is none. */
|
|
343
|
+
async get(token) {
|
|
344
|
+
return this.client.get(`/api/v1/bookings/manage/${encodeURIComponent(token)}/payment`);
|
|
345
|
+
}
|
|
346
|
+
};
|
|
294
347
|
var BookingsManage = class {
|
|
295
348
|
constructor(client) {
|
|
296
349
|
this.client = client;
|
|
350
|
+
this.payment = new BookingsManagePayment(client);
|
|
297
351
|
}
|
|
298
352
|
client;
|
|
353
|
+
/** Payments authorized by the manage token rather than by booking id. */
|
|
354
|
+
payment;
|
|
299
355
|
/**
|
|
300
356
|
* Read what the holder of a manage token may see and do. Honour
|
|
301
357
|
* `can_cancel` / `can_reschedule` — they already apply the policy windows.
|
|
@@ -324,14 +380,78 @@ var BookingsManage = class {
|
|
|
324
380
|
);
|
|
325
381
|
}
|
|
326
382
|
};
|
|
383
|
+
var BookingsPersons = class {
|
|
384
|
+
constructor(client) {
|
|
385
|
+
this.client = client;
|
|
386
|
+
}
|
|
387
|
+
client;
|
|
388
|
+
/** Persons a contact books for. Active-only unless `include_inactive`. */
|
|
389
|
+
async list(contactId, options) {
|
|
390
|
+
const params = { contact_id: contactId };
|
|
391
|
+
if (options?.include_inactive !== void 0) {
|
|
392
|
+
params.include_inactive = String(options.include_inactive);
|
|
393
|
+
}
|
|
394
|
+
return this.client.get("/api/v1/bookings/persons", params);
|
|
395
|
+
}
|
|
396
|
+
/** Add a person under a contact. */
|
|
397
|
+
async create(input, options) {
|
|
398
|
+
return this.client.postOnce("/api/v1/bookings/persons", input, options);
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
var BookingsRelations = class {
|
|
402
|
+
constructor(client) {
|
|
403
|
+
this.client = client;
|
|
404
|
+
}
|
|
405
|
+
client;
|
|
406
|
+
/** Relations a contact holds, split into outgoing and incoming. */
|
|
407
|
+
async list(contactId) {
|
|
408
|
+
return this.client.get("/api/v1/bookings/relations", { contact_id: contactId });
|
|
409
|
+
}
|
|
410
|
+
/** Create a relation from one contact to another. */
|
|
411
|
+
async create(input, options) {
|
|
412
|
+
return this.client.postOnce("/api/v1/bookings/relations", input, options);
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
var BookingsEvents = class {
|
|
416
|
+
constructor(client) {
|
|
417
|
+
this.client = client;
|
|
418
|
+
}
|
|
419
|
+
client;
|
|
420
|
+
/** Arrangementer in a date range (`yyyy-mm-dd`, inclusive). */
|
|
421
|
+
async list(options) {
|
|
422
|
+
const params = { from: options.from, to: options.to };
|
|
423
|
+
if (options.status) params.status = options.status;
|
|
424
|
+
return this.client.get("/api/v1/bookings/events", params);
|
|
425
|
+
}
|
|
426
|
+
/** Get an arrangement by ID. */
|
|
427
|
+
async get(id) {
|
|
428
|
+
return this.client.get(`/api/v1/bookings/events/${encodeURIComponent(id)}`);
|
|
429
|
+
}
|
|
430
|
+
/** Create an arrangement from a template. */
|
|
431
|
+
async create(input, options) {
|
|
432
|
+
return this.client.postOnce("/api/v1/bookings/events", input, options);
|
|
433
|
+
}
|
|
434
|
+
};
|
|
327
435
|
var Bookings = class {
|
|
328
436
|
constructor(client) {
|
|
329
437
|
this.client = client;
|
|
330
438
|
this.manage = new BookingsManage(client);
|
|
439
|
+
this.persons = new BookingsPersons(client);
|
|
440
|
+
this.relations = new BookingsRelations(client);
|
|
441
|
+
this.events = new BookingsEvents(client);
|
|
442
|
+
this.payment = new BookingsPayment(client);
|
|
331
443
|
}
|
|
332
444
|
client;
|
|
333
445
|
/** Customer-side actions addressed by manage token. */
|
|
334
446
|
manage;
|
|
447
|
+
/** Persons a contact books for — children, pets, employees. */
|
|
448
|
+
persons;
|
|
449
|
+
/** Directional relations between contacts. */
|
|
450
|
+
relations;
|
|
451
|
+
/** Arrangementer — scheduled group sessions bookings register against. */
|
|
452
|
+
events;
|
|
453
|
+
/** Vipps payments on a booking, as the business. */
|
|
454
|
+
payment;
|
|
335
455
|
/** List the bookable service catalogue. Active-only unless asked otherwise. */
|
|
336
456
|
async listServices(options) {
|
|
337
457
|
const params = {};
|