From e5483dd7c20db37c0d15064bdc816a23fe58c525 Mon Sep 17 00:00:00 2001 From: Ben Swennen Date: Thu, 29 Jul 2021 11:56:27 +0200 Subject: [PATCH] feat(types): add appointment & customer types --- types/appointment.d.ts | 76 +++++++++++++++++++++++++++++++++++++++ types/contactOffices.d.ts | 4 --- types/customer.d.ts | 24 +++++++++++++ types/index.d.ts | 7 +++- 4 files changed, 106 insertions(+), 5 deletions(-) create mode 100644 types/appointment.d.ts create mode 100644 types/customer.d.ts diff --git a/types/appointment.d.ts b/types/appointment.d.ts new file mode 100644 index 0000000..4c98d08 --- /dev/null +++ b/types/appointment.d.ts @@ -0,0 +1,76 @@ +declare module 'skedify-sdk' { + export type AppointmentState = + | 'incoming' + | 'outgoing' + | 'completed' + | 'cancelled' + | 'accepted' + | 'occurred' + + export interface Appointment extends Omit { + uuid: string; + listing_uuid: string; + contact_id: string; + customer_id: string; + subject_id: string; + office_id: string; + state: AppointmentState; + meeting_type: string; + first_possibility_id: string; + notes?: string; + outcome_remark?: string; + trailing_buffer_time: number; + metadata: any[]; + customer_showed: boolean; + is_success: boolean; + video_url_for_contact: string; + video_url_for_customer: string; + video_test_url_for_contact: string; + video_test_url_for_customer: string; + cancellation_reason_id?: string; + cancelled_by_id?: string; + cancelled_by_type?: string; + initiated_from: string; + initiated_by_id: string; + initiated_by_type: string; + updated_at: string; + updated_by_id: string; + updated_by_type: string; + } + + export interface Possibility + extends Omit { + appointment_id: number; + start: string; + end: string; + timezone: string; + duration: number; + is_accepted: boolean; + next_possibility_id: string | null; + created_by_id: number; + created_by_type: string; + updated_by_id: number; + updated_by_type: string; + updated_at: string; + } + + export interface WithSubject { + subject: Subject; + } + + export interface WithCustomer { + customer: Customer; + } + + export interface WithContact { + contact: Employee & WithEmployeeUser; + } + + export interface WithAcceptedPossibility { + accepted_possibility: Possibility; + } + + export interface WithPossibilities { + possibilities: Possibility[]; + } +} diff --git a/types/contactOffices.d.ts b/types/contactOffices.d.ts index 3e825be..fb95134 100644 --- a/types/contactOffices.d.ts +++ b/types/contactOffices.d.ts @@ -7,10 +7,6 @@ declare module "skedify-sdk" { updated_at: string | null; } - export interface WithContact { - contact: Contact & T; - } - export interface WithOffice { office: Office; } diff --git a/types/customer.d.ts b/types/customer.d.ts new file mode 100644 index 0000000..baa5ec0 --- /dev/null +++ b/types/customer.d.ts @@ -0,0 +1,24 @@ +declare module 'skedify-sdk' { + export interface Customer extends BaseFields { + uuid: string; + user_id?: string; + preferred_office_id?: string; + preferred_contact_id?: string; + external_id?: string; + email: string; + first_name: string; + last_name: string; + gender?: string; + date_of_birth?: string; + language: string; + phone_number?: string; + profile_picture?: string; + timezone: string; + customer_number?: string; + company?: string; + notes?: string; + is_existing: boolean; + updated_at: string; + location?: string; + } +} diff --git a/types/index.d.ts b/types/index.d.ts index 5f7a9c1..d663277 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,3 +1,5 @@ +/// +/// /// /// /// @@ -144,7 +146,7 @@ declare module "skedify-sdk" { outcome_lists: Include; outcome_outcome_lists: Include; outcomes: Include; - possibilities: Include; + possibilities: Include & { created_by: Include }; postal_code: Include; question: Include; questions: Include; @@ -167,6 +169,9 @@ declare module "skedify-sdk" { admins(): GenericAPI; admins(id: string): GenericAPI; + appointments(): GenericAPI; + appointments(id: string): GenericAPI; + calendarEventTemplates(): GenericAPI; calendarEventTemplates(id: string): GenericAPI;