@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.
- package/README.md +25 -0
- package/dist/openapi/medal-social.openapi.json +923 -25
- package/dist/src/index.d.mts +189 -1
- package/dist/src/index.d.ts +189 -1
- package/dist/src/index.js +61 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +61 -0
- package/dist/src/index.mjs.map +1 -1
- package/dist/src/openapi.generated.d.mts +422 -1
- package/dist/src/openapi.generated.d.ts +422 -1
- package/dist/src/openapi.generated.js.map +1 -1
- package/openapi/medal-social.openapi.yaml +539 -4
- package/package.json +1 -1
- package/skills/resources/SKILL.md +3 -0
package/dist/src/index.d.mts
CHANGED
|
@@ -655,6 +655,12 @@ interface Booking {
|
|
|
655
655
|
booked_for_name: string | null;
|
|
656
656
|
/** Birth year (not a birthdate) of whoever the appointment is for. */
|
|
657
657
|
booked_for_birth_year: number | null;
|
|
658
|
+
/** The {@link ContactPerson} this booking was made for, if any. */
|
|
659
|
+
booked_for_person_id: string | null;
|
|
660
|
+
/** The {@link BookingEvent} this booking is a registration for, if any. */
|
|
661
|
+
event_id: string | null;
|
|
662
|
+
/** Position of this booking within its event's registrations, if any. */
|
|
663
|
+
event_order: number | null;
|
|
658
664
|
/** Shared by every booking created in the same party request. */
|
|
659
665
|
party_sequence_id: string | null;
|
|
660
666
|
status: BookingStatus;
|
|
@@ -740,6 +746,8 @@ interface CreateBookingItemInput {
|
|
|
740
746
|
booked_for_name?: string;
|
|
741
747
|
/** Birth year (not a birthdate) of whoever the appointment is for. */
|
|
742
748
|
booked_for_birth_year?: number;
|
|
749
|
+
/** Book this line on behalf of a {@link ContactPerson} rather than the contact. */
|
|
750
|
+
booked_for_person_id?: string;
|
|
743
751
|
}
|
|
744
752
|
/** The person the booking is made under. Phone is the CRM dedupe key. */
|
|
745
753
|
interface BookingContactInput {
|
|
@@ -918,6 +926,113 @@ interface BookingAvailabilityOptions {
|
|
|
918
926
|
/** Restrict slots to one resource. Defaults to every capable resource. */
|
|
919
927
|
resource_id?: string;
|
|
920
928
|
}
|
|
929
|
+
/** How a {@link ContactPerson} or {@link ContactRelation} relates to a contact. */
|
|
930
|
+
type RelationType = "guardian" | "owner" | "employer" | "caregiver" | "partner" | "custom";
|
|
931
|
+
/** A person a contact books for — a child, a pet, an employee. No login of its own. */
|
|
932
|
+
interface ContactPerson {
|
|
933
|
+
person_id: string;
|
|
934
|
+
contact_id: string;
|
|
935
|
+
name: string;
|
|
936
|
+
birth_year: number | null;
|
|
937
|
+
relation_type: RelationType;
|
|
938
|
+
relation_label: string | null;
|
|
939
|
+
notes: string | null;
|
|
940
|
+
active: boolean;
|
|
941
|
+
promoted_to_contact_id: string | null;
|
|
942
|
+
/** ISO 8601. */
|
|
943
|
+
created_at: string;
|
|
944
|
+
/** ISO 8601. */
|
|
945
|
+
updated_at: string;
|
|
946
|
+
}
|
|
947
|
+
/** Input for `bookings.persons.create(...)`. */
|
|
948
|
+
interface CreateContactPersonInput {
|
|
949
|
+
contact_id: string;
|
|
950
|
+
name: string;
|
|
951
|
+
birth_year?: number;
|
|
952
|
+
relation_type: RelationType;
|
|
953
|
+
relation_label?: string;
|
|
954
|
+
notes?: string;
|
|
955
|
+
}
|
|
956
|
+
/** One directional relation between two contacts. */
|
|
957
|
+
interface ContactRelation {
|
|
958
|
+
relation_id: string;
|
|
959
|
+
from_contact_id: string;
|
|
960
|
+
to_contact_id: string;
|
|
961
|
+
type: RelationType;
|
|
962
|
+
custom_label: string | null;
|
|
963
|
+
since: number | null;
|
|
964
|
+
note: string | null;
|
|
965
|
+
/** Empty string when the counterpart contact no longer exists. */
|
|
966
|
+
counterpart_name: string;
|
|
967
|
+
/** ISO 8601. */
|
|
968
|
+
created_at: string;
|
|
969
|
+
}
|
|
970
|
+
/** Relations a contact holds, split by direction. */
|
|
971
|
+
interface ContactRelations {
|
|
972
|
+
outgoing: ContactRelation[];
|
|
973
|
+
incoming: ContactRelation[];
|
|
974
|
+
}
|
|
975
|
+
/** Input for `bookings.relations.create(...)`. */
|
|
976
|
+
interface CreateContactRelationInput {
|
|
977
|
+
from_contact_id: string;
|
|
978
|
+
to_contact_id: string;
|
|
979
|
+
type: RelationType;
|
|
980
|
+
custom_label?: string;
|
|
981
|
+
since?: number;
|
|
982
|
+
note?: string;
|
|
983
|
+
}
|
|
984
|
+
/** Result of `bookings.relations.create(...)`. */
|
|
985
|
+
interface CreateContactRelationResult {
|
|
986
|
+
relation_id: string;
|
|
987
|
+
}
|
|
988
|
+
/** Lifecycle state of an arrangement. */
|
|
989
|
+
type BookingEventStatus = "draft" | "open" | "closed" | "completed" | "cancelled";
|
|
990
|
+
/** Which prebuilt template an arrangement was created from. */
|
|
991
|
+
type BookingEventTemplateKey = "kindergarten_visit" | "company_day" | "class" | "open_day" | "custom";
|
|
992
|
+
/** An arrangement — a scheduled group session bookings register against. */
|
|
993
|
+
interface BookingEvent {
|
|
994
|
+
event_id: string;
|
|
995
|
+
template_id: string;
|
|
996
|
+
host_id: string | null;
|
|
997
|
+
/** yyyy-mm-dd in the workspace time zone. */
|
|
998
|
+
date: string;
|
|
999
|
+
window_start_minute: number;
|
|
1000
|
+
window_end_minute: number;
|
|
1001
|
+
place: "at_host" | "in_house";
|
|
1002
|
+
capacity: number;
|
|
1003
|
+
minimum: number;
|
|
1004
|
+
registered_count: number;
|
|
1005
|
+
service_ids: string[];
|
|
1006
|
+
resource_ids: string[];
|
|
1007
|
+
price_override_ore: number | null;
|
|
1008
|
+
status: BookingEventStatus;
|
|
1009
|
+
/** ISO 8601. */
|
|
1010
|
+
registration_closes_at: string;
|
|
1011
|
+
slug: string;
|
|
1012
|
+
/** ISO 8601. */
|
|
1013
|
+
created_at: string;
|
|
1014
|
+
/** ISO 8601. */
|
|
1015
|
+
updated_at: string;
|
|
1016
|
+
}
|
|
1017
|
+
/** Options for `bookings.events.list(...)`. The window is `yyyy-mm-dd`, inclusive. */
|
|
1018
|
+
interface ListBookingEventsOptions {
|
|
1019
|
+
from: string;
|
|
1020
|
+
to: string;
|
|
1021
|
+
status?: BookingEventStatus;
|
|
1022
|
+
}
|
|
1023
|
+
/** Input for `bookings.events.create(...)`. */
|
|
1024
|
+
interface CreateBookingEventInput {
|
|
1025
|
+
template_key: BookingEventTemplateKey;
|
|
1026
|
+
host_id?: string;
|
|
1027
|
+
date: string;
|
|
1028
|
+
window_start_minute: number;
|
|
1029
|
+
window_end_minute?: number;
|
|
1030
|
+
place: "at_host" | "in_house";
|
|
1031
|
+
capacity?: number;
|
|
1032
|
+
minimum?: number;
|
|
1033
|
+
service_ids: string[];
|
|
1034
|
+
resource_ids: string[];
|
|
1035
|
+
}
|
|
921
1036
|
|
|
922
1037
|
/**
|
|
923
1038
|
* Customer-side booking management, addressed by the show-once manage token
|
|
@@ -948,6 +1063,45 @@ declare class BookingsManage {
|
|
|
948
1063
|
*/
|
|
949
1064
|
reschedule(token: string, input: RescheduleBookingInput, options?: RequestOptions): Promise<ApiResponse<BookingRescheduleResult>>;
|
|
950
1065
|
}
|
|
1066
|
+
/**
|
|
1067
|
+
* Persons a contact books for — children, pets, employees. Each has no login
|
|
1068
|
+
* of its own; bookings made on their behalf still hang off the contact via
|
|
1069
|
+
* `booked_for_person_id`.
|
|
1070
|
+
*/
|
|
1071
|
+
declare class BookingsPersons {
|
|
1072
|
+
private client;
|
|
1073
|
+
constructor(client: BaseClient);
|
|
1074
|
+
/** Persons a contact books for. Active-only unless `include_inactive`. */
|
|
1075
|
+
list(contactId: string, options?: {
|
|
1076
|
+
include_inactive?: boolean;
|
|
1077
|
+
}): Promise<ApiResponse<ContactPerson[]>>;
|
|
1078
|
+
/** Add a person under a contact. */
|
|
1079
|
+
create(input: CreateContactPersonInput, options?: RequestOptions): Promise<ApiResponse<ContactPerson>>;
|
|
1080
|
+
}
|
|
1081
|
+
/** Directional relations between contacts — guardian, partner, employer, and so on. */
|
|
1082
|
+
declare class BookingsRelations {
|
|
1083
|
+
private client;
|
|
1084
|
+
constructor(client: BaseClient);
|
|
1085
|
+
/** Relations a contact holds, split into outgoing and incoming. */
|
|
1086
|
+
list(contactId: string): Promise<ApiResponse<ContactRelations>>;
|
|
1087
|
+
/** Create a relation from one contact to another. */
|
|
1088
|
+
create(input: CreateContactRelationInput, options?: RequestOptions): Promise<ApiResponse<CreateContactRelationResult>>;
|
|
1089
|
+
}
|
|
1090
|
+
/**
|
|
1091
|
+
* Arrangementer — scheduled group sessions bookings register against.
|
|
1092
|
+
* Registration itself lands in a later release; this is the read/create
|
|
1093
|
+
* surface for the events.
|
|
1094
|
+
*/
|
|
1095
|
+
declare class BookingsEvents {
|
|
1096
|
+
private client;
|
|
1097
|
+
constructor(client: BaseClient);
|
|
1098
|
+
/** Arrangementer in a date range (`yyyy-mm-dd`, inclusive). */
|
|
1099
|
+
list(options: ListBookingEventsOptions): Promise<ApiResponse<BookingEvent[]>>;
|
|
1100
|
+
/** Get an arrangement by ID. */
|
|
1101
|
+
get(id: string): Promise<ApiResponse<BookingEvent>>;
|
|
1102
|
+
/** Create an arrangement from a template. */
|
|
1103
|
+
create(input: CreateBookingEventInput, options?: RequestOptions): Promise<ApiResponse<BookingEvent>>;
|
|
1104
|
+
}
|
|
951
1105
|
/**
|
|
952
1106
|
* Appointment bookings: the service catalogue, free slots, and the bookings
|
|
953
1107
|
* themselves.
|
|
@@ -977,6 +1131,12 @@ declare class Bookings {
|
|
|
977
1131
|
private client;
|
|
978
1132
|
/** Customer-side actions addressed by manage token. */
|
|
979
1133
|
readonly manage: BookingsManage;
|
|
1134
|
+
/** Persons a contact books for — children, pets, employees. */
|
|
1135
|
+
readonly persons: BookingsPersons;
|
|
1136
|
+
/** Directional relations between contacts. */
|
|
1137
|
+
readonly relations: BookingsRelations;
|
|
1138
|
+
/** Arrangementer — scheduled group sessions bookings register against. */
|
|
1139
|
+
readonly events: BookingsEvents;
|
|
980
1140
|
constructor(client: BaseClient);
|
|
981
1141
|
/** List the bookable service catalogue. Active-only unless asked otherwise. */
|
|
982
1142
|
listServices(options?: ListBookingServicesOptions): Promise<ApiResponse<BookingService[]>>;
|
|
@@ -1790,6 +1950,22 @@ interface PortalFamilyMember {
|
|
|
1790
1950
|
name: string;
|
|
1791
1951
|
birth_year: number;
|
|
1792
1952
|
}
|
|
1953
|
+
/** A person the contact books for — a child, a pet — with no login of its own. */
|
|
1954
|
+
interface PortalPerson {
|
|
1955
|
+
person_id: string;
|
|
1956
|
+
name: string;
|
|
1957
|
+
birth_year: number | null;
|
|
1958
|
+
relation_type: RelationType;
|
|
1959
|
+
relation_label: string | null;
|
|
1960
|
+
notes: string | null;
|
|
1961
|
+
/** `false` for a person the customer removed or that was promoted to its own contact; `me` returns active persons only, the export returns all. */
|
|
1962
|
+
active: boolean;
|
|
1963
|
+
}
|
|
1964
|
+
/** The workspace's own words for the person concept, e.g. `"Barn"`. */
|
|
1965
|
+
interface PortalLabels {
|
|
1966
|
+
person: string;
|
|
1967
|
+
persons: string;
|
|
1968
|
+
}
|
|
1793
1969
|
/** The signed-in contact's own profile. */
|
|
1794
1970
|
interface PortalProfile {
|
|
1795
1971
|
contact_id: string;
|
|
@@ -1798,6 +1974,8 @@ interface PortalProfile {
|
|
|
1798
1974
|
last_name: string | null;
|
|
1799
1975
|
phone: string | null;
|
|
1800
1976
|
family: PortalFamilyMember[];
|
|
1977
|
+
persons: PortalPerson[];
|
|
1978
|
+
labels: PortalLabels;
|
|
1801
1979
|
marketing_consent: boolean;
|
|
1802
1980
|
/** Unix timestamp in milliseconds. */
|
|
1803
1981
|
created_at: number;
|
|
@@ -1850,6 +2028,15 @@ interface PortalConsentRecord {
|
|
|
1850
2028
|
revoked_at: number | null;
|
|
1851
2029
|
source: string;
|
|
1852
2030
|
}
|
|
2031
|
+
/** A relation the exporting contact is a party to; only the counterpart's display name is exposed. */
|
|
2032
|
+
interface PortalExportRelation {
|
|
2033
|
+
direction: "outgoing" | "incoming";
|
|
2034
|
+
type: RelationType;
|
|
2035
|
+
custom_label: string | null;
|
|
2036
|
+
since: number | null;
|
|
2037
|
+
note: string | null;
|
|
2038
|
+
counterpart_name: string;
|
|
2039
|
+
}
|
|
1853
2040
|
/** Everything the workspace holds about the signed-in contact (GDPR Art. 15). */
|
|
1854
2041
|
interface PortalExport {
|
|
1855
2042
|
/** Unix timestamp in milliseconds. */
|
|
@@ -1858,6 +2045,7 @@ interface PortalExport {
|
|
|
1858
2045
|
family: PortalFamilyMember[];
|
|
1859
2046
|
consents: PortalConsentRecord[];
|
|
1860
2047
|
bookings: PortalBooking[];
|
|
2048
|
+
relations: PortalExportRelation[];
|
|
1861
2049
|
}
|
|
1862
2050
|
|
|
1863
2051
|
/**
|
|
@@ -2635,4 +2823,4 @@ declare class Medal {
|
|
|
2635
2823
|
/** Convenience factory — equivalent to `new Medal(apiKey, options)`. */
|
|
2636
2824
|
declare function createMedalClient(apiKey: string, options?: MedalOptions): Medal;
|
|
2637
2825
|
|
|
2638
|
-
export { type Activity, type AddNoteInput, type ApiResponse, type AutoConfirmContext, type AutoConfirmOptions, BaseClient, type BatchSendInput, type BatchSendResult, type BatchSendSummary, type Booking, type BookingActionResult, type BookingAvailabilityOptions, type BookingCancelledBy, type BookingClaimableCreatedVia, type BookingContactInput, type BookingCreateResult, type BookingCreatedVia, type BookingPaymentStatus, type BookingRescheduleResult, type BookingResource, type BookingResourceType, type BookingScheduleDay, type BookingScheduleOptions, type BookingService, type BookingSlot, type BookingStatus, type BookingTimestampInput, Bookings, type BookingsPage, type BookingsPagination, CAPABILITY_IDS, CAPABILITY_ROUTES, type CancelBookingInput, type CapabilityConfirmation, CapabilityConfirmations, CapabilityConfirmer, type CapabilityId, type CapabilityPathParamValue, type CapabilityRoute, type CapabilityWriteBodies, type CapabilityWriteRequest, type Channel, type ChannelConnectedEvent, type ChannelConnection, type ChannelConnectionDisconnectResult, type ChannelConnectionState, type ChannelDisconnectReason, type ChannelDisconnectedEvent, Channels, type ConnectLink, type ConnectLinkCreateResult, type ConnectLinkRevokeResult, type ConnectLinkStatus, type ConsentRecord, type ConsentResult, type ConsentType, type Contact, type ContactConsents, type ContactCreateResult, type ContactNoteResult, type ContactRemoveResult, type ContactStatus, type ContactUpdateResult, Contacts, type Conversation, type ConversationAssignedEvent, type ConversationCreatedEvent, type ConversationMessage, type ConversationStatus, type ConversationStatusChangedEvent, type ConversationUpdateResult, type CookieCategoryConsent, type CookieConsentInput, type CreateBookingInput, type CreateBookingItemInput, type CreateConnectLinkInput, type CreateContactInput, type CreateDealInput, type CreatePostInput, type CreateReplyInput, type CreateWebhookInput, type CreatedBooking, DEFAULT_WEBHOOK_TOLERANCE_MS, type Deal, type DealCreateResult, type DealRemoveResult, type DealStatus, type DealUpdateResult, Deals, type EmailSend, type EmailSendResult, type EmailStatus, type EmailTemplate, type EmailTemplateDetail, Emails, Gdpr, type GdprExport, type GetTemplateOptions, Helpdesk, type HelpdeskMessageType, type ImportContactInput, type ImportContactsResult, type IssueCapabilityConfirmationInput, type ListBookingServicesOptions, type ListBookingsOptions, type ListConnectLinksOptions, type ListContactsOptions, type ListConversationsOptions, type ListDealsOptions, type ListDeliveriesOptions, type ListPostsOptions, type ManageSummary, Medal, MedalApiError, type MedalOptions, type MessageAuthorType, type MessageDeliveryStatus, type MessageDeliveryUpdatedEvent, type MessageReceivedEvent, type MessageSentEvent, type PaginatedResponse, type PaginationOptions, Portal, type PortalBooking, type PortalBookingStatus, type PortalBookings, type PortalConsentRecord, type PortalContactSummary, type PortalExport, type PortalFamilyMember, type PortalLoginStartInput, type PortalLoginStartResult, type PortalProfile, type PortalProfilePatch, type PortalSession, type PortalVerifyInput, type Post, type PostDetail, type PostType, type PostVariant, Posts, type PublishResult, type RecordConsentInput, type ReplyCreateResult, type RequestOptions, type RescheduleBookingInput, Scan, type ScanCompany, type ScanCreateInput, type ScanCreateResult, type ScanJob, type ScanResultPayload, type ScanStatus, type ScanSubScores, type SchedulePostInput, type ScheduleResult, type SendEmailInput, type TestPingEvent, type UpdateBookingInput, type UpdateContactInput, type UpdateConversationInput, type UpdateDealInput, type UpdatePostInput, type UpdateWebhookInput, type VerifyWebhookSignatureInput, type WaitForScanOptions, type WebhookChannelLifecycleData, type WebhookConversationSnapshot, type WebhookDeleteResult, type WebhookDelivery, type WebhookEndpoint, type WebhookEvent, type WebhookMessageSnapshot, type WebhookTestResult, WebhookVerificationError, type WebhookVerificationErrorCode, Webhooks, type Workspace, Workspaces, createMedalClient, Medal as default, verifyWebhookSignature };
|
|
2826
|
+
export { type Activity, type AddNoteInput, type ApiResponse, type AutoConfirmContext, type AutoConfirmOptions, BaseClient, type BatchSendInput, type BatchSendResult, type BatchSendSummary, type Booking, type BookingActionResult, type BookingAvailabilityOptions, type BookingCancelledBy, type BookingClaimableCreatedVia, type BookingContactInput, type BookingCreateResult, type BookingCreatedVia, type BookingEvent, type BookingEventStatus, type BookingEventTemplateKey, type BookingPaymentStatus, type BookingRescheduleResult, type BookingResource, type BookingResourceType, type BookingScheduleDay, type BookingScheduleOptions, type BookingService, type BookingSlot, type BookingStatus, type BookingTimestampInput, Bookings, type BookingsPage, type BookingsPagination, CAPABILITY_IDS, CAPABILITY_ROUTES, type CancelBookingInput, type CapabilityConfirmation, CapabilityConfirmations, CapabilityConfirmer, type CapabilityId, type CapabilityPathParamValue, type CapabilityRoute, type CapabilityWriteBodies, type CapabilityWriteRequest, type Channel, type ChannelConnectedEvent, type ChannelConnection, type ChannelConnectionDisconnectResult, type ChannelConnectionState, type ChannelDisconnectReason, type ChannelDisconnectedEvent, Channels, type ConnectLink, type ConnectLinkCreateResult, type ConnectLinkRevokeResult, type ConnectLinkStatus, type ConsentRecord, type ConsentResult, type ConsentType, type Contact, type ContactConsents, type ContactCreateResult, type ContactNoteResult, type ContactPerson, type ContactRelation, type ContactRelations, type ContactRemoveResult, type ContactStatus, type ContactUpdateResult, Contacts, type Conversation, type ConversationAssignedEvent, type ConversationCreatedEvent, type ConversationMessage, type ConversationStatus, type ConversationStatusChangedEvent, type ConversationUpdateResult, type CookieCategoryConsent, type CookieConsentInput, type CreateBookingEventInput, type CreateBookingInput, type CreateBookingItemInput, type CreateConnectLinkInput, type CreateContactInput, type CreateContactPersonInput, type CreateContactRelationInput, type CreateContactRelationResult, type CreateDealInput, type CreatePostInput, type CreateReplyInput, type CreateWebhookInput, type CreatedBooking, DEFAULT_WEBHOOK_TOLERANCE_MS, type Deal, type DealCreateResult, type DealRemoveResult, type DealStatus, type DealUpdateResult, Deals, type EmailSend, type EmailSendResult, type EmailStatus, type EmailTemplate, type EmailTemplateDetail, Emails, Gdpr, type GdprExport, type GetTemplateOptions, Helpdesk, type HelpdeskMessageType, type ImportContactInput, type ImportContactsResult, type IssueCapabilityConfirmationInput, type ListBookingEventsOptions, type ListBookingServicesOptions, type ListBookingsOptions, type ListConnectLinksOptions, type ListContactsOptions, type ListConversationsOptions, type ListDealsOptions, type ListDeliveriesOptions, type ListPostsOptions, type ManageSummary, Medal, MedalApiError, type MedalOptions, type MessageAuthorType, type MessageDeliveryStatus, type MessageDeliveryUpdatedEvent, type MessageReceivedEvent, type MessageSentEvent, type PaginatedResponse, type PaginationOptions, Portal, type PortalBooking, type PortalBookingStatus, type PortalBookings, type PortalConsentRecord, type PortalContactSummary, type PortalExport, type PortalExportRelation, type PortalFamilyMember, type PortalLabels, type PortalLoginStartInput, type PortalLoginStartResult, type PortalPerson, type PortalProfile, type PortalProfilePatch, type PortalSession, type PortalVerifyInput, type Post, type PostDetail, type PostType, type PostVariant, Posts, type PublishResult, type RecordConsentInput, type RelationType, type ReplyCreateResult, type RequestOptions, type RescheduleBookingInput, Scan, type ScanCompany, type ScanCreateInput, type ScanCreateResult, type ScanJob, type ScanResultPayload, type ScanStatus, type ScanSubScores, type SchedulePostInput, type ScheduleResult, type SendEmailInput, type TestPingEvent, type UpdateBookingInput, type UpdateContactInput, type UpdateConversationInput, type UpdateDealInput, type UpdatePostInput, type UpdateWebhookInput, type VerifyWebhookSignatureInput, type WaitForScanOptions, type WebhookChannelLifecycleData, type WebhookConversationSnapshot, type WebhookDeleteResult, type WebhookDelivery, type WebhookEndpoint, type WebhookEvent, type WebhookMessageSnapshot, type WebhookTestResult, WebhookVerificationError, type WebhookVerificationErrorCode, Webhooks, type Workspace, Workspaces, createMedalClient, Medal as default, verifyWebhookSignature };
|
package/dist/src/index.d.ts
CHANGED
|
@@ -655,6 +655,12 @@ interface Booking {
|
|
|
655
655
|
booked_for_name: string | null;
|
|
656
656
|
/** Birth year (not a birthdate) of whoever the appointment is for. */
|
|
657
657
|
booked_for_birth_year: number | null;
|
|
658
|
+
/** The {@link ContactPerson} this booking was made for, if any. */
|
|
659
|
+
booked_for_person_id: string | null;
|
|
660
|
+
/** The {@link BookingEvent} this booking is a registration for, if any. */
|
|
661
|
+
event_id: string | null;
|
|
662
|
+
/** Position of this booking within its event's registrations, if any. */
|
|
663
|
+
event_order: number | null;
|
|
658
664
|
/** Shared by every booking created in the same party request. */
|
|
659
665
|
party_sequence_id: string | null;
|
|
660
666
|
status: BookingStatus;
|
|
@@ -740,6 +746,8 @@ interface CreateBookingItemInput {
|
|
|
740
746
|
booked_for_name?: string;
|
|
741
747
|
/** Birth year (not a birthdate) of whoever the appointment is for. */
|
|
742
748
|
booked_for_birth_year?: number;
|
|
749
|
+
/** Book this line on behalf of a {@link ContactPerson} rather than the contact. */
|
|
750
|
+
booked_for_person_id?: string;
|
|
743
751
|
}
|
|
744
752
|
/** The person the booking is made under. Phone is the CRM dedupe key. */
|
|
745
753
|
interface BookingContactInput {
|
|
@@ -918,6 +926,113 @@ interface BookingAvailabilityOptions {
|
|
|
918
926
|
/** Restrict slots to one resource. Defaults to every capable resource. */
|
|
919
927
|
resource_id?: string;
|
|
920
928
|
}
|
|
929
|
+
/** How a {@link ContactPerson} or {@link ContactRelation} relates to a contact. */
|
|
930
|
+
type RelationType = "guardian" | "owner" | "employer" | "caregiver" | "partner" | "custom";
|
|
931
|
+
/** A person a contact books for — a child, a pet, an employee. No login of its own. */
|
|
932
|
+
interface ContactPerson {
|
|
933
|
+
person_id: string;
|
|
934
|
+
contact_id: string;
|
|
935
|
+
name: string;
|
|
936
|
+
birth_year: number | null;
|
|
937
|
+
relation_type: RelationType;
|
|
938
|
+
relation_label: string | null;
|
|
939
|
+
notes: string | null;
|
|
940
|
+
active: boolean;
|
|
941
|
+
promoted_to_contact_id: string | null;
|
|
942
|
+
/** ISO 8601. */
|
|
943
|
+
created_at: string;
|
|
944
|
+
/** ISO 8601. */
|
|
945
|
+
updated_at: string;
|
|
946
|
+
}
|
|
947
|
+
/** Input for `bookings.persons.create(...)`. */
|
|
948
|
+
interface CreateContactPersonInput {
|
|
949
|
+
contact_id: string;
|
|
950
|
+
name: string;
|
|
951
|
+
birth_year?: number;
|
|
952
|
+
relation_type: RelationType;
|
|
953
|
+
relation_label?: string;
|
|
954
|
+
notes?: string;
|
|
955
|
+
}
|
|
956
|
+
/** One directional relation between two contacts. */
|
|
957
|
+
interface ContactRelation {
|
|
958
|
+
relation_id: string;
|
|
959
|
+
from_contact_id: string;
|
|
960
|
+
to_contact_id: string;
|
|
961
|
+
type: RelationType;
|
|
962
|
+
custom_label: string | null;
|
|
963
|
+
since: number | null;
|
|
964
|
+
note: string | null;
|
|
965
|
+
/** Empty string when the counterpart contact no longer exists. */
|
|
966
|
+
counterpart_name: string;
|
|
967
|
+
/** ISO 8601. */
|
|
968
|
+
created_at: string;
|
|
969
|
+
}
|
|
970
|
+
/** Relations a contact holds, split by direction. */
|
|
971
|
+
interface ContactRelations {
|
|
972
|
+
outgoing: ContactRelation[];
|
|
973
|
+
incoming: ContactRelation[];
|
|
974
|
+
}
|
|
975
|
+
/** Input for `bookings.relations.create(...)`. */
|
|
976
|
+
interface CreateContactRelationInput {
|
|
977
|
+
from_contact_id: string;
|
|
978
|
+
to_contact_id: string;
|
|
979
|
+
type: RelationType;
|
|
980
|
+
custom_label?: string;
|
|
981
|
+
since?: number;
|
|
982
|
+
note?: string;
|
|
983
|
+
}
|
|
984
|
+
/** Result of `bookings.relations.create(...)`. */
|
|
985
|
+
interface CreateContactRelationResult {
|
|
986
|
+
relation_id: string;
|
|
987
|
+
}
|
|
988
|
+
/** Lifecycle state of an arrangement. */
|
|
989
|
+
type BookingEventStatus = "draft" | "open" | "closed" | "completed" | "cancelled";
|
|
990
|
+
/** Which prebuilt template an arrangement was created from. */
|
|
991
|
+
type BookingEventTemplateKey = "kindergarten_visit" | "company_day" | "class" | "open_day" | "custom";
|
|
992
|
+
/** An arrangement — a scheduled group session bookings register against. */
|
|
993
|
+
interface BookingEvent {
|
|
994
|
+
event_id: string;
|
|
995
|
+
template_id: string;
|
|
996
|
+
host_id: string | null;
|
|
997
|
+
/** yyyy-mm-dd in the workspace time zone. */
|
|
998
|
+
date: string;
|
|
999
|
+
window_start_minute: number;
|
|
1000
|
+
window_end_minute: number;
|
|
1001
|
+
place: "at_host" | "in_house";
|
|
1002
|
+
capacity: number;
|
|
1003
|
+
minimum: number;
|
|
1004
|
+
registered_count: number;
|
|
1005
|
+
service_ids: string[];
|
|
1006
|
+
resource_ids: string[];
|
|
1007
|
+
price_override_ore: number | null;
|
|
1008
|
+
status: BookingEventStatus;
|
|
1009
|
+
/** ISO 8601. */
|
|
1010
|
+
registration_closes_at: string;
|
|
1011
|
+
slug: string;
|
|
1012
|
+
/** ISO 8601. */
|
|
1013
|
+
created_at: string;
|
|
1014
|
+
/** ISO 8601. */
|
|
1015
|
+
updated_at: string;
|
|
1016
|
+
}
|
|
1017
|
+
/** Options for `bookings.events.list(...)`. The window is `yyyy-mm-dd`, inclusive. */
|
|
1018
|
+
interface ListBookingEventsOptions {
|
|
1019
|
+
from: string;
|
|
1020
|
+
to: string;
|
|
1021
|
+
status?: BookingEventStatus;
|
|
1022
|
+
}
|
|
1023
|
+
/** Input for `bookings.events.create(...)`. */
|
|
1024
|
+
interface CreateBookingEventInput {
|
|
1025
|
+
template_key: BookingEventTemplateKey;
|
|
1026
|
+
host_id?: string;
|
|
1027
|
+
date: string;
|
|
1028
|
+
window_start_minute: number;
|
|
1029
|
+
window_end_minute?: number;
|
|
1030
|
+
place: "at_host" | "in_house";
|
|
1031
|
+
capacity?: number;
|
|
1032
|
+
minimum?: number;
|
|
1033
|
+
service_ids: string[];
|
|
1034
|
+
resource_ids: string[];
|
|
1035
|
+
}
|
|
921
1036
|
|
|
922
1037
|
/**
|
|
923
1038
|
* Customer-side booking management, addressed by the show-once manage token
|
|
@@ -948,6 +1063,45 @@ declare class BookingsManage {
|
|
|
948
1063
|
*/
|
|
949
1064
|
reschedule(token: string, input: RescheduleBookingInput, options?: RequestOptions): Promise<ApiResponse<BookingRescheduleResult>>;
|
|
950
1065
|
}
|
|
1066
|
+
/**
|
|
1067
|
+
* Persons a contact books for — children, pets, employees. Each has no login
|
|
1068
|
+
* of its own; bookings made on their behalf still hang off the contact via
|
|
1069
|
+
* `booked_for_person_id`.
|
|
1070
|
+
*/
|
|
1071
|
+
declare class BookingsPersons {
|
|
1072
|
+
private client;
|
|
1073
|
+
constructor(client: BaseClient);
|
|
1074
|
+
/** Persons a contact books for. Active-only unless `include_inactive`. */
|
|
1075
|
+
list(contactId: string, options?: {
|
|
1076
|
+
include_inactive?: boolean;
|
|
1077
|
+
}): Promise<ApiResponse<ContactPerson[]>>;
|
|
1078
|
+
/** Add a person under a contact. */
|
|
1079
|
+
create(input: CreateContactPersonInput, options?: RequestOptions): Promise<ApiResponse<ContactPerson>>;
|
|
1080
|
+
}
|
|
1081
|
+
/** Directional relations between contacts — guardian, partner, employer, and so on. */
|
|
1082
|
+
declare class BookingsRelations {
|
|
1083
|
+
private client;
|
|
1084
|
+
constructor(client: BaseClient);
|
|
1085
|
+
/** Relations a contact holds, split into outgoing and incoming. */
|
|
1086
|
+
list(contactId: string): Promise<ApiResponse<ContactRelations>>;
|
|
1087
|
+
/** Create a relation from one contact to another. */
|
|
1088
|
+
create(input: CreateContactRelationInput, options?: RequestOptions): Promise<ApiResponse<CreateContactRelationResult>>;
|
|
1089
|
+
}
|
|
1090
|
+
/**
|
|
1091
|
+
* Arrangementer — scheduled group sessions bookings register against.
|
|
1092
|
+
* Registration itself lands in a later release; this is the read/create
|
|
1093
|
+
* surface for the events.
|
|
1094
|
+
*/
|
|
1095
|
+
declare class BookingsEvents {
|
|
1096
|
+
private client;
|
|
1097
|
+
constructor(client: BaseClient);
|
|
1098
|
+
/** Arrangementer in a date range (`yyyy-mm-dd`, inclusive). */
|
|
1099
|
+
list(options: ListBookingEventsOptions): Promise<ApiResponse<BookingEvent[]>>;
|
|
1100
|
+
/** Get an arrangement by ID. */
|
|
1101
|
+
get(id: string): Promise<ApiResponse<BookingEvent>>;
|
|
1102
|
+
/** Create an arrangement from a template. */
|
|
1103
|
+
create(input: CreateBookingEventInput, options?: RequestOptions): Promise<ApiResponse<BookingEvent>>;
|
|
1104
|
+
}
|
|
951
1105
|
/**
|
|
952
1106
|
* Appointment bookings: the service catalogue, free slots, and the bookings
|
|
953
1107
|
* themselves.
|
|
@@ -977,6 +1131,12 @@ declare class Bookings {
|
|
|
977
1131
|
private client;
|
|
978
1132
|
/** Customer-side actions addressed by manage token. */
|
|
979
1133
|
readonly manage: BookingsManage;
|
|
1134
|
+
/** Persons a contact books for — children, pets, employees. */
|
|
1135
|
+
readonly persons: BookingsPersons;
|
|
1136
|
+
/** Directional relations between contacts. */
|
|
1137
|
+
readonly relations: BookingsRelations;
|
|
1138
|
+
/** Arrangementer — scheduled group sessions bookings register against. */
|
|
1139
|
+
readonly events: BookingsEvents;
|
|
980
1140
|
constructor(client: BaseClient);
|
|
981
1141
|
/** List the bookable service catalogue. Active-only unless asked otherwise. */
|
|
982
1142
|
listServices(options?: ListBookingServicesOptions): Promise<ApiResponse<BookingService[]>>;
|
|
@@ -1790,6 +1950,22 @@ interface PortalFamilyMember {
|
|
|
1790
1950
|
name: string;
|
|
1791
1951
|
birth_year: number;
|
|
1792
1952
|
}
|
|
1953
|
+
/** A person the contact books for — a child, a pet — with no login of its own. */
|
|
1954
|
+
interface PortalPerson {
|
|
1955
|
+
person_id: string;
|
|
1956
|
+
name: string;
|
|
1957
|
+
birth_year: number | null;
|
|
1958
|
+
relation_type: RelationType;
|
|
1959
|
+
relation_label: string | null;
|
|
1960
|
+
notes: string | null;
|
|
1961
|
+
/** `false` for a person the customer removed or that was promoted to its own contact; `me` returns active persons only, the export returns all. */
|
|
1962
|
+
active: boolean;
|
|
1963
|
+
}
|
|
1964
|
+
/** The workspace's own words for the person concept, e.g. `"Barn"`. */
|
|
1965
|
+
interface PortalLabels {
|
|
1966
|
+
person: string;
|
|
1967
|
+
persons: string;
|
|
1968
|
+
}
|
|
1793
1969
|
/** The signed-in contact's own profile. */
|
|
1794
1970
|
interface PortalProfile {
|
|
1795
1971
|
contact_id: string;
|
|
@@ -1798,6 +1974,8 @@ interface PortalProfile {
|
|
|
1798
1974
|
last_name: string | null;
|
|
1799
1975
|
phone: string | null;
|
|
1800
1976
|
family: PortalFamilyMember[];
|
|
1977
|
+
persons: PortalPerson[];
|
|
1978
|
+
labels: PortalLabels;
|
|
1801
1979
|
marketing_consent: boolean;
|
|
1802
1980
|
/** Unix timestamp in milliseconds. */
|
|
1803
1981
|
created_at: number;
|
|
@@ -1850,6 +2028,15 @@ interface PortalConsentRecord {
|
|
|
1850
2028
|
revoked_at: number | null;
|
|
1851
2029
|
source: string;
|
|
1852
2030
|
}
|
|
2031
|
+
/** A relation the exporting contact is a party to; only the counterpart's display name is exposed. */
|
|
2032
|
+
interface PortalExportRelation {
|
|
2033
|
+
direction: "outgoing" | "incoming";
|
|
2034
|
+
type: RelationType;
|
|
2035
|
+
custom_label: string | null;
|
|
2036
|
+
since: number | null;
|
|
2037
|
+
note: string | null;
|
|
2038
|
+
counterpart_name: string;
|
|
2039
|
+
}
|
|
1853
2040
|
/** Everything the workspace holds about the signed-in contact (GDPR Art. 15). */
|
|
1854
2041
|
interface PortalExport {
|
|
1855
2042
|
/** Unix timestamp in milliseconds. */
|
|
@@ -1858,6 +2045,7 @@ interface PortalExport {
|
|
|
1858
2045
|
family: PortalFamilyMember[];
|
|
1859
2046
|
consents: PortalConsentRecord[];
|
|
1860
2047
|
bookings: PortalBooking[];
|
|
2048
|
+
relations: PortalExportRelation[];
|
|
1861
2049
|
}
|
|
1862
2050
|
|
|
1863
2051
|
/**
|
|
@@ -2635,4 +2823,4 @@ declare class Medal {
|
|
|
2635
2823
|
/** Convenience factory — equivalent to `new Medal(apiKey, options)`. */
|
|
2636
2824
|
declare function createMedalClient(apiKey: string, options?: MedalOptions): Medal;
|
|
2637
2825
|
|
|
2638
|
-
export { type Activity, type AddNoteInput, type ApiResponse, type AutoConfirmContext, type AutoConfirmOptions, BaseClient, type BatchSendInput, type BatchSendResult, type BatchSendSummary, type Booking, type BookingActionResult, type BookingAvailabilityOptions, type BookingCancelledBy, type BookingClaimableCreatedVia, type BookingContactInput, type BookingCreateResult, type BookingCreatedVia, type BookingPaymentStatus, type BookingRescheduleResult, type BookingResource, type BookingResourceType, type BookingScheduleDay, type BookingScheduleOptions, type BookingService, type BookingSlot, type BookingStatus, type BookingTimestampInput, Bookings, type BookingsPage, type BookingsPagination, CAPABILITY_IDS, CAPABILITY_ROUTES, type CancelBookingInput, type CapabilityConfirmation, CapabilityConfirmations, CapabilityConfirmer, type CapabilityId, type CapabilityPathParamValue, type CapabilityRoute, type CapabilityWriteBodies, type CapabilityWriteRequest, type Channel, type ChannelConnectedEvent, type ChannelConnection, type ChannelConnectionDisconnectResult, type ChannelConnectionState, type ChannelDisconnectReason, type ChannelDisconnectedEvent, Channels, type ConnectLink, type ConnectLinkCreateResult, type ConnectLinkRevokeResult, type ConnectLinkStatus, type ConsentRecord, type ConsentResult, type ConsentType, type Contact, type ContactConsents, type ContactCreateResult, type ContactNoteResult, type ContactRemoveResult, type ContactStatus, type ContactUpdateResult, Contacts, type Conversation, type ConversationAssignedEvent, type ConversationCreatedEvent, type ConversationMessage, type ConversationStatus, type ConversationStatusChangedEvent, type ConversationUpdateResult, type CookieCategoryConsent, type CookieConsentInput, type CreateBookingInput, type CreateBookingItemInput, type CreateConnectLinkInput, type CreateContactInput, type CreateDealInput, type CreatePostInput, type CreateReplyInput, type CreateWebhookInput, type CreatedBooking, DEFAULT_WEBHOOK_TOLERANCE_MS, type Deal, type DealCreateResult, type DealRemoveResult, type DealStatus, type DealUpdateResult, Deals, type EmailSend, type EmailSendResult, type EmailStatus, type EmailTemplate, type EmailTemplateDetail, Emails, Gdpr, type GdprExport, type GetTemplateOptions, Helpdesk, type HelpdeskMessageType, type ImportContactInput, type ImportContactsResult, type IssueCapabilityConfirmationInput, type ListBookingServicesOptions, type ListBookingsOptions, type ListConnectLinksOptions, type ListContactsOptions, type ListConversationsOptions, type ListDealsOptions, type ListDeliveriesOptions, type ListPostsOptions, type ManageSummary, Medal, MedalApiError, type MedalOptions, type MessageAuthorType, type MessageDeliveryStatus, type MessageDeliveryUpdatedEvent, type MessageReceivedEvent, type MessageSentEvent, type PaginatedResponse, type PaginationOptions, Portal, type PortalBooking, type PortalBookingStatus, type PortalBookings, type PortalConsentRecord, type PortalContactSummary, type PortalExport, type PortalFamilyMember, type PortalLoginStartInput, type PortalLoginStartResult, type PortalProfile, type PortalProfilePatch, type PortalSession, type PortalVerifyInput, type Post, type PostDetail, type PostType, type PostVariant, Posts, type PublishResult, type RecordConsentInput, type ReplyCreateResult, type RequestOptions, type RescheduleBookingInput, Scan, type ScanCompany, type ScanCreateInput, type ScanCreateResult, type ScanJob, type ScanResultPayload, type ScanStatus, type ScanSubScores, type SchedulePostInput, type ScheduleResult, type SendEmailInput, type TestPingEvent, type UpdateBookingInput, type UpdateContactInput, type UpdateConversationInput, type UpdateDealInput, type UpdatePostInput, type UpdateWebhookInput, type VerifyWebhookSignatureInput, type WaitForScanOptions, type WebhookChannelLifecycleData, type WebhookConversationSnapshot, type WebhookDeleteResult, type WebhookDelivery, type WebhookEndpoint, type WebhookEvent, type WebhookMessageSnapshot, type WebhookTestResult, WebhookVerificationError, type WebhookVerificationErrorCode, Webhooks, type Workspace, Workspaces, createMedalClient, Medal as default, verifyWebhookSignature };
|
|
2826
|
+
export { type Activity, type AddNoteInput, type ApiResponse, type AutoConfirmContext, type AutoConfirmOptions, BaseClient, type BatchSendInput, type BatchSendResult, type BatchSendSummary, type Booking, type BookingActionResult, type BookingAvailabilityOptions, type BookingCancelledBy, type BookingClaimableCreatedVia, type BookingContactInput, type BookingCreateResult, type BookingCreatedVia, type BookingEvent, type BookingEventStatus, type BookingEventTemplateKey, type BookingPaymentStatus, type BookingRescheduleResult, type BookingResource, type BookingResourceType, type BookingScheduleDay, type BookingScheduleOptions, type BookingService, type BookingSlot, type BookingStatus, type BookingTimestampInput, Bookings, type BookingsPage, type BookingsPagination, CAPABILITY_IDS, CAPABILITY_ROUTES, type CancelBookingInput, type CapabilityConfirmation, CapabilityConfirmations, CapabilityConfirmer, type CapabilityId, type CapabilityPathParamValue, type CapabilityRoute, type CapabilityWriteBodies, type CapabilityWriteRequest, type Channel, type ChannelConnectedEvent, type ChannelConnection, type ChannelConnectionDisconnectResult, type ChannelConnectionState, type ChannelDisconnectReason, type ChannelDisconnectedEvent, Channels, type ConnectLink, type ConnectLinkCreateResult, type ConnectLinkRevokeResult, type ConnectLinkStatus, type ConsentRecord, type ConsentResult, type ConsentType, type Contact, type ContactConsents, type ContactCreateResult, type ContactNoteResult, type ContactPerson, type ContactRelation, type ContactRelations, type ContactRemoveResult, type ContactStatus, type ContactUpdateResult, Contacts, type Conversation, type ConversationAssignedEvent, type ConversationCreatedEvent, type ConversationMessage, type ConversationStatus, type ConversationStatusChangedEvent, type ConversationUpdateResult, type CookieCategoryConsent, type CookieConsentInput, type CreateBookingEventInput, type CreateBookingInput, type CreateBookingItemInput, type CreateConnectLinkInput, type CreateContactInput, type CreateContactPersonInput, type CreateContactRelationInput, type CreateContactRelationResult, type CreateDealInput, type CreatePostInput, type CreateReplyInput, type CreateWebhookInput, type CreatedBooking, DEFAULT_WEBHOOK_TOLERANCE_MS, type Deal, type DealCreateResult, type DealRemoveResult, type DealStatus, type DealUpdateResult, Deals, type EmailSend, type EmailSendResult, type EmailStatus, type EmailTemplate, type EmailTemplateDetail, Emails, Gdpr, type GdprExport, type GetTemplateOptions, Helpdesk, type HelpdeskMessageType, type ImportContactInput, type ImportContactsResult, type IssueCapabilityConfirmationInput, type ListBookingEventsOptions, type ListBookingServicesOptions, type ListBookingsOptions, type ListConnectLinksOptions, type ListContactsOptions, type ListConversationsOptions, type ListDealsOptions, type ListDeliveriesOptions, type ListPostsOptions, type ManageSummary, Medal, MedalApiError, type MedalOptions, type MessageAuthorType, type MessageDeliveryStatus, type MessageDeliveryUpdatedEvent, type MessageReceivedEvent, type MessageSentEvent, type PaginatedResponse, type PaginationOptions, Portal, type PortalBooking, type PortalBookingStatus, type PortalBookings, type PortalConsentRecord, type PortalContactSummary, type PortalExport, type PortalExportRelation, type PortalFamilyMember, type PortalLabels, type PortalLoginStartInput, type PortalLoginStartResult, type PortalPerson, type PortalProfile, type PortalProfilePatch, type PortalSession, type PortalVerifyInput, type Post, type PostDetail, type PostType, type PostVariant, Posts, type PublishResult, type RecordConsentInput, type RelationType, type ReplyCreateResult, type RequestOptions, type RescheduleBookingInput, Scan, type ScanCompany, type ScanCreateInput, type ScanCreateResult, type ScanJob, type ScanResultPayload, type ScanStatus, type ScanSubScores, type SchedulePostInput, type ScheduleResult, type SendEmailInput, type TestPingEvent, type UpdateBookingInput, type UpdateContactInput, type UpdateConversationInput, type UpdateDealInput, type UpdatePostInput, type UpdateWebhookInput, type VerifyWebhookSignatureInput, type WaitForScanOptions, type WebhookChannelLifecycleData, type WebhookConversationSnapshot, type WebhookDeleteResult, type WebhookDelivery, type WebhookEndpoint, type WebhookEvent, type WebhookMessageSnapshot, type WebhookTestResult, WebhookVerificationError, type WebhookVerificationErrorCode, Webhooks, type Workspace, Workspaces, createMedalClient, Medal as default, verifyWebhookSignature };
|
package/dist/src/index.js
CHANGED
|
@@ -373,14 +373,75 @@ var BookingsManage = class {
|
|
|
373
373
|
);
|
|
374
374
|
}
|
|
375
375
|
};
|
|
376
|
+
var BookingsPersons = class {
|
|
377
|
+
constructor(client) {
|
|
378
|
+
this.client = client;
|
|
379
|
+
}
|
|
380
|
+
client;
|
|
381
|
+
/** Persons a contact books for. Active-only unless `include_inactive`. */
|
|
382
|
+
async list(contactId, options) {
|
|
383
|
+
const params = { contact_id: contactId };
|
|
384
|
+
if (options?.include_inactive !== void 0) {
|
|
385
|
+
params.include_inactive = String(options.include_inactive);
|
|
386
|
+
}
|
|
387
|
+
return this.client.get("/api/v1/bookings/persons", params);
|
|
388
|
+
}
|
|
389
|
+
/** Add a person under a contact. */
|
|
390
|
+
async create(input, options) {
|
|
391
|
+
return this.client.postOnce("/api/v1/bookings/persons", input, options);
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
var BookingsRelations = class {
|
|
395
|
+
constructor(client) {
|
|
396
|
+
this.client = client;
|
|
397
|
+
}
|
|
398
|
+
client;
|
|
399
|
+
/** Relations a contact holds, split into outgoing and incoming. */
|
|
400
|
+
async list(contactId) {
|
|
401
|
+
return this.client.get("/api/v1/bookings/relations", { contact_id: contactId });
|
|
402
|
+
}
|
|
403
|
+
/** Create a relation from one contact to another. */
|
|
404
|
+
async create(input, options) {
|
|
405
|
+
return this.client.postOnce("/api/v1/bookings/relations", input, options);
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
var BookingsEvents = class {
|
|
409
|
+
constructor(client) {
|
|
410
|
+
this.client = client;
|
|
411
|
+
}
|
|
412
|
+
client;
|
|
413
|
+
/** Arrangementer in a date range (`yyyy-mm-dd`, inclusive). */
|
|
414
|
+
async list(options) {
|
|
415
|
+
const params = { from: options.from, to: options.to };
|
|
416
|
+
if (options.status) params.status = options.status;
|
|
417
|
+
return this.client.get("/api/v1/bookings/events", params);
|
|
418
|
+
}
|
|
419
|
+
/** Get an arrangement by ID. */
|
|
420
|
+
async get(id) {
|
|
421
|
+
return this.client.get(`/api/v1/bookings/events/${encodeURIComponent(id)}`);
|
|
422
|
+
}
|
|
423
|
+
/** Create an arrangement from a template. */
|
|
424
|
+
async create(input, options) {
|
|
425
|
+
return this.client.postOnce("/api/v1/bookings/events", input, options);
|
|
426
|
+
}
|
|
427
|
+
};
|
|
376
428
|
var Bookings = class {
|
|
377
429
|
constructor(client) {
|
|
378
430
|
this.client = client;
|
|
379
431
|
this.manage = new BookingsManage(client);
|
|
432
|
+
this.persons = new BookingsPersons(client);
|
|
433
|
+
this.relations = new BookingsRelations(client);
|
|
434
|
+
this.events = new BookingsEvents(client);
|
|
380
435
|
}
|
|
381
436
|
client;
|
|
382
437
|
/** Customer-side actions addressed by manage token. */
|
|
383
438
|
manage;
|
|
439
|
+
/** Persons a contact books for — children, pets, employees. */
|
|
440
|
+
persons;
|
|
441
|
+
/** Directional relations between contacts. */
|
|
442
|
+
relations;
|
|
443
|
+
/** Arrangementer — scheduled group sessions bookings register against. */
|
|
444
|
+
events;
|
|
384
445
|
/** List the bookable service catalogue. Active-only unless asked otherwise. */
|
|
385
446
|
async listServices(options) {
|
|
386
447
|
const params = {};
|