@medalsocial/sdk 1.8.0 → 1.9.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.
@@ -732,6 +732,160 @@ paths:
732
732
  $ref: "#/components/schemas/ApiResponse_BookingScheduleDayArray"
733
733
  default:
734
734
  $ref: "#/components/responses/ApiError"
735
+ /api/v1/bookings/persons:
736
+ get:
737
+ tags: [Bookings]
738
+ operationId: listContactPersons
739
+ summary: List a contact's persons
740
+ description: >-
741
+ Persons a contact books for — a child, a pet, an employee. No login of
742
+ their own. Active-only unless `include_inactive` is set.
743
+ parameters:
744
+ - name: contact_id
745
+ in: query
746
+ required: true
747
+ schema:
748
+ type: string
749
+ - name: include_inactive
750
+ in: query
751
+ schema:
752
+ type: boolean
753
+ responses:
754
+ "200":
755
+ description: Contact persons.
756
+ content:
757
+ application/json:
758
+ schema:
759
+ $ref: "#/components/schemas/ApiResponse_ContactPersonArray"
760
+ default:
761
+ $ref: "#/components/responses/ApiError"
762
+ post:
763
+ tags: [Bookings]
764
+ operationId: createContactPerson
765
+ summary: Add a person under a contact
766
+ requestBody:
767
+ required: true
768
+ content:
769
+ application/json:
770
+ schema:
771
+ $ref: "#/components/schemas/CreateContactPersonInput"
772
+ responses:
773
+ "201":
774
+ description: Created person.
775
+ content:
776
+ application/json:
777
+ schema:
778
+ $ref: "#/components/schemas/ApiResponse_ContactPerson"
779
+ default:
780
+ $ref: "#/components/responses/ApiError"
781
+ /api/v1/bookings/relations:
782
+ get:
783
+ tags: [Bookings]
784
+ operationId: listContactRelations
785
+ summary: List a contact's relations
786
+ description: Directional relations a contact holds, split into outgoing and incoming.
787
+ parameters:
788
+ - name: contact_id
789
+ in: query
790
+ required: true
791
+ schema:
792
+ type: string
793
+ responses:
794
+ "200":
795
+ description: Outgoing and incoming relations.
796
+ content:
797
+ application/json:
798
+ schema:
799
+ $ref: "#/components/schemas/ApiResponse_ContactRelations"
800
+ default:
801
+ $ref: "#/components/responses/ApiError"
802
+ post:
803
+ tags: [Bookings]
804
+ operationId: createContactRelation
805
+ summary: Create a relation from one contact to another
806
+ requestBody:
807
+ required: true
808
+ content:
809
+ application/json:
810
+ schema:
811
+ $ref: "#/components/schemas/CreateContactRelationInput"
812
+ responses:
813
+ "201":
814
+ description: Created relation id.
815
+ content:
816
+ application/json:
817
+ schema:
818
+ $ref: "#/components/schemas/ApiResponse_CreateContactRelationResult"
819
+ default:
820
+ $ref: "#/components/responses/ApiError"
821
+ /api/v1/bookings/events:
822
+ get:
823
+ tags: [Bookings]
824
+ operationId: listBookingEvents
825
+ summary: List arrangementer in a date range
826
+ parameters:
827
+ - name: from
828
+ in: query
829
+ required: true
830
+ description: Start of the window, `yyyy-mm-dd`, inclusive.
831
+ schema:
832
+ type: string
833
+ format: date
834
+ - name: to
835
+ in: query
836
+ required: true
837
+ description: End of the window, `yyyy-mm-dd`, inclusive.
838
+ schema:
839
+ type: string
840
+ format: date
841
+ - name: status
842
+ in: query
843
+ schema:
844
+ $ref: "#/components/schemas/BookingEventStatus"
845
+ responses:
846
+ "200":
847
+ description: Arrangementer in the window.
848
+ content:
849
+ application/json:
850
+ schema:
851
+ $ref: "#/components/schemas/ApiResponse_BookingEventArray"
852
+ default:
853
+ $ref: "#/components/responses/ApiError"
854
+ post:
855
+ tags: [Bookings]
856
+ operationId: createBookingEvent
857
+ summary: Create an arrangement from a template
858
+ requestBody:
859
+ required: true
860
+ content:
861
+ application/json:
862
+ schema:
863
+ $ref: "#/components/schemas/CreateBookingEventInput"
864
+ responses:
865
+ "201":
866
+ description: Created arrangement.
867
+ content:
868
+ application/json:
869
+ schema:
870
+ $ref: "#/components/schemas/ApiResponse_BookingEvent"
871
+ default:
872
+ $ref: "#/components/responses/ApiError"
873
+ /api/v1/bookings/events/{id}:
874
+ parameters:
875
+ - $ref: "#/components/parameters/Id"
876
+ get:
877
+ tags: [Bookings]
878
+ operationId: getBookingEvent
879
+ summary: Get an arrangement
880
+ responses:
881
+ "200":
882
+ description: Arrangement.
883
+ content:
884
+ application/json:
885
+ schema:
886
+ $ref: "#/components/schemas/ApiResponse_BookingEvent"
887
+ default:
888
+ $ref: "#/components/responses/ApiError"
735
889
  /api/v1/bookings/{id}:
736
890
  parameters:
737
891
  - $ref: "#/components/parameters/Id"
@@ -1051,9 +1205,13 @@ paths:
1051
1205
  summary: Export everything held about the signed-in contact
1052
1206
  description: >-
1053
1207
  A synchronous GDPR Art. 15 export of the contact's profile, family,
1054
- consents and bookings, as one JSON document. Read-only, so not
1055
- idempotency-keyed. Errors: `401 PORTAL_SESSION_REQUIRED`,
1056
- `401 PORTAL_SESSION_INVALID`, `403 FORBIDDEN`, `429 RATE_LIMITED`.
1208
+ consents and bookings, as one JSON document. Unlike `GET
1209
+ /api/v1/portal/me`, `contact.persons` here includes inactive persons
1210
+ so the export is a complete dump. `relations` lists every relation
1211
+ the contact is a party to, exposing only the counterpart's display
1212
+ name. Read-only, so not idempotency-keyed. Errors: `401
1213
+ PORTAL_SESSION_REQUIRED`, `401 PORTAL_SESSION_INVALID`, `403
1214
+ FORBIDDEN`, `429 RATE_LIMITED`.
1057
1215
  responses:
1058
1216
  "200":
1059
1217
  description: The export.
@@ -2644,6 +2802,9 @@ components:
2644
2802
  - end_ts
2645
2803
  - booked_for_name
2646
2804
  - booked_for_birth_year
2805
+ - booked_for_person_id
2806
+ - event_id
2807
+ - event_order
2647
2808
  - party_sequence_id
2648
2809
  - status
2649
2810
  - cancelled_by
@@ -2676,6 +2837,15 @@ components:
2676
2837
  booked_for_birth_year:
2677
2838
  description: A birth year, not a birthdate — the age bracket is all that is stored.
2678
2839
  type: [integer, "null"]
2840
+ booked_for_person_id:
2841
+ description: The ContactPerson this booking was made for, if any.
2842
+ type: [string, "null"]
2843
+ event_id:
2844
+ description: The BookingEvent this booking is a registration for, if any.
2845
+ type: [string, "null"]
2846
+ event_order:
2847
+ description: Position of this booking within its event's registrations, if any.
2848
+ type: [integer, "null"]
2679
2849
  party_sequence_id:
2680
2850
  description: Shared by every booking created in the same party request.
2681
2851
  type: [string, "null"]
@@ -2880,6 +3050,9 @@ components:
2880
3050
  type: integer
2881
3051
  minimum: 1900
2882
3052
  maximum: 2200
3053
+ booked_for_person_id:
3054
+ description: Book this line on behalf of a ContactPerson rather than the contact.
3055
+ type: string
2883
3056
  CreateBookingInput:
2884
3057
  type: object
2885
3058
  required: [items, contact]
@@ -4213,6 +4386,41 @@ components:
4213
4386
  type: string
4214
4387
  birth_year:
4215
4388
  type: integer
4389
+ PortalPerson:
4390
+ description: >-
4391
+ A person the contact books for — a child, a pet — with no login of
4392
+ its own.
4393
+ type: object
4394
+ required:
4395
+ [person_id, name, birth_year, relation_type, relation_label, notes, active]
4396
+ properties:
4397
+ person_id:
4398
+ type: string
4399
+ name:
4400
+ type: string
4401
+ birth_year:
4402
+ type: [integer, "null"]
4403
+ relation_type:
4404
+ $ref: "#/components/schemas/RelationType"
4405
+ relation_label:
4406
+ type: [string, "null"]
4407
+ notes:
4408
+ type: [string, "null"]
4409
+ active:
4410
+ type: boolean
4411
+ description: >-
4412
+ False for a person the customer removed or that was promoted to
4413
+ its own contact; `me` returns active persons only, the export
4414
+ returns all.
4415
+ PortalLabels:
4416
+ description: The workspace's own words for the person concept, e.g. `"Barn"`.
4417
+ type: object
4418
+ required: [person, persons]
4419
+ properties:
4420
+ person:
4421
+ type: string
4422
+ persons:
4423
+ type: string
4216
4424
  PortalProfile:
4217
4425
  type: object
4218
4426
  required:
@@ -4222,6 +4430,8 @@ components:
4222
4430
  - last_name
4223
4431
  - phone
4224
4432
  - family
4433
+ - persons
4434
+ - labels
4225
4435
  - marketing_consent
4226
4436
  - created_at
4227
4437
  properties:
@@ -4239,6 +4449,12 @@ components:
4239
4449
  type: array
4240
4450
  items:
4241
4451
  $ref: "#/components/schemas/PortalFamilyMember"
4452
+ persons:
4453
+ type: array
4454
+ items:
4455
+ $ref: "#/components/schemas/PortalPerson"
4456
+ labels:
4457
+ $ref: "#/components/schemas/PortalLabels"
4242
4458
  marketing_consent:
4243
4459
  type: boolean
4244
4460
  created_at:
@@ -4340,10 +4556,35 @@ components:
4340
4556
  description: Unix timestamp in milliseconds, or `null`.
4341
4557
  source:
4342
4558
  type: string
4559
+ PortalExportRelation:
4560
+ description: A relation the exporting contact is a party to; only the counterpart's display name is exposed.
4561
+ type: object
4562
+ required:
4563
+ - direction
4564
+ - type
4565
+ - custom_label
4566
+ - since
4567
+ - note
4568
+ - counterpart_name
4569
+ properties:
4570
+ direction:
4571
+ type: string
4572
+ enum: [outgoing, incoming]
4573
+ type:
4574
+ $ref: "#/components/schemas/RelationType"
4575
+ custom_label:
4576
+ type: [string, "null"]
4577
+ since:
4578
+ type: [integer, "null"]
4579
+ description: Unix timestamp in milliseconds.
4580
+ note:
4581
+ type: [string, "null"]
4582
+ counterpart_name:
4583
+ type: string
4343
4584
  PortalExport:
4344
4585
  description: Everything the workspace holds about the signed-in contact (GDPR Art. 15).
4345
4586
  type: object
4346
- required: [exported_at, contact, family, consents, bookings]
4587
+ required: [exported_at, contact, family, consents, bookings, relations]
4347
4588
  properties:
4348
4589
  exported_at:
4349
4590
  type: integer
@@ -4362,6 +4603,10 @@ components:
4362
4603
  type: array
4363
4604
  items:
4364
4605
  $ref: "#/components/schemas/PortalBooking"
4606
+ relations:
4607
+ type: array
4608
+ items:
4609
+ $ref: "#/components/schemas/PortalExportRelation"
4365
4610
  Envelope_PortalLoginStartResult:
4366
4611
  type: object
4367
4612
  required: [data]
@@ -4743,3 +4988,293 @@ components:
4743
4988
  properties:
4744
4989
  data:
4745
4990
  $ref: "#/components/schemas/ChannelConnectionDisconnectResult"
4991
+ RelationType:
4992
+ description: How a person or a relation relates to a contact.
4993
+ type: string
4994
+ enum: [guardian, owner, employer, caregiver, partner, custom]
4995
+ ContactPerson:
4996
+ description: >-
4997
+ A person a contact books for — a child, a pet, an employee. No login
4998
+ of their own.
4999
+ type: object
5000
+ required:
5001
+ - person_id
5002
+ - contact_id
5003
+ - name
5004
+ - birth_year
5005
+ - relation_type
5006
+ - relation_label
5007
+ - notes
5008
+ - active
5009
+ - promoted_to_contact_id
5010
+ - created_at
5011
+ - updated_at
5012
+ properties:
5013
+ person_id:
5014
+ type: string
5015
+ contact_id:
5016
+ type: string
5017
+ name:
5018
+ type: string
5019
+ birth_year:
5020
+ type: [integer, "null"]
5021
+ relation_type:
5022
+ $ref: "#/components/schemas/RelationType"
5023
+ relation_label:
5024
+ type: [string, "null"]
5025
+ notes:
5026
+ type: [string, "null"]
5027
+ active:
5028
+ type: boolean
5029
+ promoted_to_contact_id:
5030
+ type: [string, "null"]
5031
+ created_at:
5032
+ type: string
5033
+ format: date-time
5034
+ updated_at:
5035
+ type: string
5036
+ format: date-time
5037
+ CreateContactPersonInput:
5038
+ type: object
5039
+ required: [contact_id, name, relation_type]
5040
+ properties:
5041
+ contact_id:
5042
+ type: string
5043
+ name:
5044
+ type: string
5045
+ birth_year:
5046
+ type: integer
5047
+ relation_type:
5048
+ $ref: "#/components/schemas/RelationType"
5049
+ relation_label:
5050
+ type: string
5051
+ notes:
5052
+ type: string
5053
+ ContactRelation:
5054
+ description: One directional relation between two contacts.
5055
+ type: object
5056
+ required:
5057
+ - relation_id
5058
+ - from_contact_id
5059
+ - to_contact_id
5060
+ - type
5061
+ - custom_label
5062
+ - since
5063
+ - note
5064
+ - counterpart_name
5065
+ - created_at
5066
+ properties:
5067
+ relation_id:
5068
+ type: string
5069
+ from_contact_id:
5070
+ type: string
5071
+ to_contact_id:
5072
+ type: string
5073
+ type:
5074
+ $ref: "#/components/schemas/RelationType"
5075
+ custom_label:
5076
+ type: [string, "null"]
5077
+ since:
5078
+ type: [integer, "null"]
5079
+ description: Unix timestamp in milliseconds.
5080
+ note:
5081
+ type: [string, "null"]
5082
+ counterpart_name:
5083
+ type: string
5084
+ description: Empty string when the counterpart contact no longer exists.
5085
+ created_at:
5086
+ type: string
5087
+ format: date-time
5088
+ ContactRelations:
5089
+ description: Relations a contact holds, split by direction.
5090
+ type: object
5091
+ required: [outgoing, incoming]
5092
+ properties:
5093
+ outgoing:
5094
+ type: array
5095
+ items:
5096
+ $ref: "#/components/schemas/ContactRelation"
5097
+ incoming:
5098
+ type: array
5099
+ items:
5100
+ $ref: "#/components/schemas/ContactRelation"
5101
+ CreateContactRelationInput:
5102
+ type: object
5103
+ required: [from_contact_id, to_contact_id, type]
5104
+ properties:
5105
+ from_contact_id:
5106
+ type: string
5107
+ to_contact_id:
5108
+ type: string
5109
+ type:
5110
+ $ref: "#/components/schemas/RelationType"
5111
+ custom_label:
5112
+ type: string
5113
+ since:
5114
+ type: integer
5115
+ description: Unix timestamp in milliseconds.
5116
+ note:
5117
+ type: string
5118
+ CreateContactRelationResult:
5119
+ type: object
5120
+ required: [relation_id]
5121
+ properties:
5122
+ relation_id:
5123
+ type: string
5124
+ BookingEventStatus:
5125
+ type: string
5126
+ enum: [draft, open, closed, completed, cancelled]
5127
+ BookingEventTemplateKey:
5128
+ type: string
5129
+ enum: [kindergarten_visit, company_day, class, open_day, custom]
5130
+ BookingEvent:
5131
+ description: An arrangement — a scheduled group session bookings register against.
5132
+ type: object
5133
+ required:
5134
+ - event_id
5135
+ - template_id
5136
+ - host_id
5137
+ - date
5138
+ - window_start_minute
5139
+ - window_end_minute
5140
+ - place
5141
+ - capacity
5142
+ - minimum
5143
+ - registered_count
5144
+ - service_ids
5145
+ - resource_ids
5146
+ - price_override_ore
5147
+ - status
5148
+ - registration_closes_at
5149
+ - slug
5150
+ - created_at
5151
+ - updated_at
5152
+ properties:
5153
+ event_id:
5154
+ type: string
5155
+ template_id:
5156
+ type: string
5157
+ host_id:
5158
+ type: [string, "null"]
5159
+ date:
5160
+ description: yyyy-mm-dd in the workspace time zone.
5161
+ type: string
5162
+ format: date
5163
+ window_start_minute:
5164
+ type: integer
5165
+ window_end_minute:
5166
+ type: integer
5167
+ place:
5168
+ type: string
5169
+ enum: [at_host, in_house]
5170
+ capacity:
5171
+ type: integer
5172
+ minimum:
5173
+ type: integer
5174
+ registered_count:
5175
+ type: integer
5176
+ service_ids:
5177
+ type: array
5178
+ items:
5179
+ type: string
5180
+ resource_ids:
5181
+ type: array
5182
+ items:
5183
+ type: string
5184
+ price_override_ore:
5185
+ type: [integer, "null"]
5186
+ status:
5187
+ $ref: "#/components/schemas/BookingEventStatus"
5188
+ registration_closes_at:
5189
+ type: string
5190
+ format: date-time
5191
+ slug:
5192
+ type: string
5193
+ created_at:
5194
+ type: string
5195
+ format: date-time
5196
+ updated_at:
5197
+ type: string
5198
+ format: date-time
5199
+ CreateBookingEventInput:
5200
+ type: object
5201
+ required: [template_key, date, window_start_minute, place, service_ids, resource_ids]
5202
+ properties:
5203
+ template_key:
5204
+ $ref: "#/components/schemas/BookingEventTemplateKey"
5205
+ host_id:
5206
+ type: string
5207
+ date:
5208
+ type: string
5209
+ format: date
5210
+ window_start_minute:
5211
+ type: integer
5212
+ window_end_minute:
5213
+ type: integer
5214
+ place:
5215
+ type: string
5216
+ enum: [at_host, in_house]
5217
+ capacity:
5218
+ type: integer
5219
+ minimum:
5220
+ type: integer
5221
+ service_ids:
5222
+ type: array
5223
+ items:
5224
+ type: string
5225
+ resource_ids:
5226
+ type: array
5227
+ items:
5228
+ type: string
5229
+ ApiResponse_ContactPersonArray:
5230
+ $ref: "#/components/schemas/Envelope_ContactPersonArray"
5231
+ ApiResponse_ContactPerson:
5232
+ $ref: "#/components/schemas/Envelope_ContactPerson"
5233
+ ApiResponse_ContactRelations:
5234
+ $ref: "#/components/schemas/Envelope_ContactRelations"
5235
+ ApiResponse_CreateContactRelationResult:
5236
+ $ref: "#/components/schemas/Envelope_CreateContactRelationResult"
5237
+ ApiResponse_BookingEventArray:
5238
+ $ref: "#/components/schemas/Envelope_BookingEventArray"
5239
+ ApiResponse_BookingEvent:
5240
+ $ref: "#/components/schemas/Envelope_BookingEvent"
5241
+ Envelope_ContactPersonArray:
5242
+ type: object
5243
+ required: [data]
5244
+ properties:
5245
+ data:
5246
+ type: array
5247
+ items:
5248
+ $ref: "#/components/schemas/ContactPerson"
5249
+ Envelope_ContactPerson:
5250
+ type: object
5251
+ required: [data]
5252
+ properties:
5253
+ data:
5254
+ $ref: "#/components/schemas/ContactPerson"
5255
+ Envelope_ContactRelations:
5256
+ type: object
5257
+ required: [data]
5258
+ properties:
5259
+ data:
5260
+ $ref: "#/components/schemas/ContactRelations"
5261
+ Envelope_CreateContactRelationResult:
5262
+ type: object
5263
+ required: [data]
5264
+ properties:
5265
+ data:
5266
+ $ref: "#/components/schemas/CreateContactRelationResult"
5267
+ Envelope_BookingEventArray:
5268
+ type: object
5269
+ required: [data]
5270
+ properties:
5271
+ data:
5272
+ type: array
5273
+ items:
5274
+ $ref: "#/components/schemas/BookingEvent"
5275
+ Envelope_BookingEvent:
5276
+ type: object
5277
+ required: [data]
5278
+ properties:
5279
+ data:
5280
+ $ref: "#/components/schemas/BookingEvent"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medalsocial/sdk",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "TypeScript SDK for Medal Social API — posts, emails, contacts, deals, helpdesk, webhooks, and GDPR compliance",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Medal Social / Ali Aljumaili",
@@ -38,6 +38,9 @@ Errors throw `MedalApiError` (see the `client` skill for details).
38
38
  |---|---|---|
39
39
  | `medal.bookings` | `src/resources/bookings.ts` | `listServices(opts?)`, `listResources()`, `availability(opts)`, `schedule(opts)`, `list(opts?)`, `create(input, opts?)`, `get(id)`, `update(id, input, opts?)`, `cancel(id, input?, opts?)`, `reschedule(id, input, opts?)`, `markNoShow(id, opts?)` — all **staff** semantics (policy windows bypassed) |
40
40
  | `medal.bookings.manage` | `src/resources/bookings.ts` (`BookingsManage`) | `get(token)`, `cancel(token, input?, opts?)`, `reschedule(token, input, opts?)` — **customer** semantics (policy windows enforced) |
41
+ | `medal.bookings.persons` | `src/resources/bookings.ts` (`BookingsPersons`) | `list(contactId, { include_inactive? })`, `create(input)` — persons a contact books for (children, pets, employees) |
42
+ | `medal.bookings.relations` | `src/resources/bookings.ts` (`BookingsRelations`) | `list(contactId)` → `{ outgoing, incoming }`, `create(input)` — directional relations between contacts |
43
+ | `medal.bookings.events` | `src/resources/bookings.ts` (`BookingsEvents`) | `list({ from, to, status? })`, `get(id)`, `create(input)` — arrangementer (scheduled group sessions); registering a booking to an event ships in a later release |
41
44
  | `medal.contacts` | `src/resources/contacts.ts` | `list(opts?)`, `create(input)`, `get(id)`, `update(id, input)`, `remove(id)`, `activities(id, opts?)`, `addNote(id, { content })`, `import(contacts[])` |
42
45
  | `medal.deals` | `src/resources/deals.ts` | `list(opts?)`, `create(input)`, `get(id)`, `update(id, input)`, `remove(id)` |
43
46
  | `medal.emails.templates` | `src/resources/emails.ts` (`EmailTemplates`) | `list()`, `get(slug, opts?)` |