2022-05-19 20:00:22 +00:00
|
|
|
import { AppStoreLocationType, DefaultLocationType } from "@calcom/app-store/locations";
|
2022-03-30 15:37:51 +00:00
|
|
|
import {
|
|
|
|
User,
|
|
|
|
Team,
|
2022-04-01 21:03:03 +00:00
|
|
|
Credential,
|
2022-03-30 15:37:51 +00:00
|
|
|
SelectedCalendar,
|
2022-04-01 23:55:41 +00:00
|
|
|
EventTypeCustomInput,
|
2022-03-30 15:37:51 +00:00
|
|
|
Attendee,
|
|
|
|
Availability,
|
|
|
|
BookingReference,
|
|
|
|
Booking,
|
|
|
|
DailyEventReference,
|
|
|
|
Webhook,
|
|
|
|
DestinationCalendar,
|
|
|
|
Membership,
|
|
|
|
Payment,
|
|
|
|
Schedule,
|
2022-04-02 00:45:28 +00:00
|
|
|
ReminderMail,
|
2022-05-19 20:00:22 +00:00
|
|
|
EventType,
|
2022-03-30 15:37:51 +00:00
|
|
|
} from "@calcom/prisma/client";
|
2022-03-30 12:17:55 +00:00
|
|
|
|
|
|
|
// Base response, used for all responses
|
|
|
|
export type BaseResponse = {
|
|
|
|
message?: string;
|
|
|
|
error?: Error;
|
|
|
|
};
|
2022-03-31 20:14:37 +00:00
|
|
|
|
2022-03-30 12:17:55 +00:00
|
|
|
// User
|
|
|
|
export type UserResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
user?: Partial<User>;
|
2022-03-30 12:17:55 +00:00
|
|
|
};
|
2022-03-31 20:14:37 +00:00
|
|
|
|
2022-03-30 12:17:55 +00:00
|
|
|
export type UsersResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
users?: Partial<User>[];
|
2022-03-30 12:17:55 +00:00
|
|
|
};
|
2022-03-30 14:56:24 +00:00
|
|
|
|
2022-03-30 15:37:51 +00:00
|
|
|
// Team
|
2022-03-30 14:56:24 +00:00
|
|
|
export type TeamResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
team?: Partial<Team>;
|
2022-04-20 21:42:49 +00:00
|
|
|
owner?: Partial<Membership>;
|
2022-03-30 14:56:24 +00:00
|
|
|
};
|
|
|
|
export type TeamsResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
teams?: Partial<Team>[];
|
2022-03-30 14:56:24 +00:00
|
|
|
};
|
|
|
|
|
2022-03-30 15:37:51 +00:00
|
|
|
// SelectedCalendar
|
2022-03-30 14:56:24 +00:00
|
|
|
export type SelectedCalendarResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
selected_calendar?: Partial<SelectedCalendar>;
|
2022-03-30 14:56:24 +00:00
|
|
|
};
|
|
|
|
export type SelectedCalendarsResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
selected_calendars?: Partial<SelectedCalendar>[];
|
2022-03-30 14:56:24 +00:00
|
|
|
};
|
2022-03-30 15:37:51 +00:00
|
|
|
|
|
|
|
// Attendee
|
|
|
|
export type AttendeeResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
attendee?: Partial<Attendee>;
|
2022-03-30 15:37:51 +00:00
|
|
|
};
|
2022-04-08 01:16:53 +00:00
|
|
|
// Grouping attendees in booking arrays for now,
|
|
|
|
// later might remove endpoint and move to booking endpoint altogether.
|
2022-03-30 15:37:51 +00:00
|
|
|
export type AttendeesResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
attendees?: Partial<Attendee>[];
|
2022-03-30 15:37:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Availability
|
|
|
|
export type AvailabilityResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
availability?: Partial<Availability>;
|
2022-03-30 15:37:51 +00:00
|
|
|
};
|
2022-04-04 19:53:03 +00:00
|
|
|
export type AvailabilitiesResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
availabilities?: Partial<Availability>[];
|
2022-03-30 15:37:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// BookingReference
|
|
|
|
export type BookingReferenceResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
booking_reference?: Partial<BookingReference>;
|
2022-03-30 15:37:51 +00:00
|
|
|
};
|
|
|
|
export type BookingReferencesResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
booking_references?: Partial<BookingReference>[];
|
2022-03-30 15:37:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Booking
|
|
|
|
export type BookingResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
booking?: Partial<Booking>;
|
2022-03-30 15:37:51 +00:00
|
|
|
};
|
|
|
|
export type BookingsResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
bookings?: Partial<Booking>[];
|
2022-03-30 15:37:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Credential
|
|
|
|
export type CredentialResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
credential?: Partial<Credential>;
|
2022-03-30 15:37:51 +00:00
|
|
|
};
|
|
|
|
export type CredentialsResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
credentials?: Partial<Credential>[];
|
2022-03-30 15:37:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// DailyEventReference
|
|
|
|
export type DailyEventReferenceResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
daily_event_reference?: Partial<DailyEventReference>;
|
2022-03-30 15:37:51 +00:00
|
|
|
};
|
|
|
|
export type DailyEventReferencesResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
daily_event_references?: Partial<DailyEventReference>[];
|
2022-03-30 15:37:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// DestinationCalendar
|
|
|
|
export type DestinationCalendarResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
destination_calendar?: Partial<DestinationCalendar>;
|
2022-03-30 15:37:51 +00:00
|
|
|
};
|
|
|
|
export type DestinationCalendarsResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
destination_calendars?: Partial<DestinationCalendar>[];
|
2022-03-30 15:37:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Membership
|
|
|
|
export type MembershipResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
membership?: Partial<Membership>;
|
2022-03-30 15:37:51 +00:00
|
|
|
};
|
|
|
|
export type MembershipsResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
memberships?: Partial<Membership>[];
|
2022-03-30 15:37:51 +00:00
|
|
|
};
|
|
|
|
|
2022-04-01 23:55:41 +00:00
|
|
|
// EventTypeCustomInput
|
|
|
|
export type EventTypeCustomInputResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
event_type_custom_input?: Partial<EventTypeCustomInput>;
|
2022-04-01 23:55:41 +00:00
|
|
|
};
|
|
|
|
export type EventTypeCustomInputsResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
event_type_custom_inputs?: Partial<EventTypeCustomInput>[];
|
2022-04-01 23:55:41 +00:00
|
|
|
};
|
2022-05-19 20:00:22 +00:00
|
|
|
// From rrule https://jakubroztocil.github.io/rrule freq
|
2022-05-20 00:47:20 +00:00
|
|
|
export enum Frequency {
|
2022-05-19 20:00:22 +00:00
|
|
|
"YEARLY",
|
|
|
|
"MONTHLY",
|
|
|
|
"WEEKLY",
|
|
|
|
"DAILY",
|
|
|
|
"HOURLY",
|
|
|
|
"MINUTELY",
|
|
|
|
"SECONDLY",
|
|
|
|
}
|
|
|
|
interface EventTypeExtended extends Omit<EventType, "recurringEvent" | "locations"> {
|
|
|
|
recurringEvent: {
|
|
|
|
dtstart?: Date | undefined;
|
|
|
|
interval?: number | undefined;
|
|
|
|
count?: number | undefined;
|
|
|
|
freq?: Frequency | undefined;
|
|
|
|
until?: Date | undefined;
|
|
|
|
tzid?: string | undefined;
|
2022-05-27 23:50:28 +00:00
|
|
|
} | null;
|
|
|
|
locations:
|
|
|
|
| {
|
|
|
|
link?: string | undefined;
|
|
|
|
address?: string | undefined;
|
|
|
|
hostPhoneNumber?: string | undefined;
|
|
|
|
type: DefaultLocationType | AppStoreLocationType;
|
|
|
|
}[]
|
|
|
|
| null;
|
2022-05-19 20:00:22 +00:00
|
|
|
}
|
2022-05-19 22:58:42 +00:00
|
|
|
|
2022-03-30 15:37:51 +00:00
|
|
|
// EventType
|
|
|
|
export type EventTypeResponse = BaseResponse & {
|
2022-05-20 01:40:14 +00:00
|
|
|
event_type?: Partial<EventType | EventTypeExtended>;
|
2022-03-30 15:37:51 +00:00
|
|
|
};
|
|
|
|
export type EventTypesResponse = BaseResponse & {
|
2022-05-20 01:40:14 +00:00
|
|
|
event_types?: Partial<EventType | EventTypeExtended>[];
|
2022-03-30 15:37:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Payment
|
|
|
|
export type PaymentResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
payment?: Partial<Payment>;
|
2022-03-30 15:37:51 +00:00
|
|
|
};
|
|
|
|
export type PaymentsResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
payments?: Partial<Payment>[];
|
2022-03-30 15:37:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Schedule
|
|
|
|
export type ScheduleResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
schedule?: Partial<Schedule>;
|
2022-03-30 15:37:51 +00:00
|
|
|
};
|
|
|
|
export type SchedulesResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
schedules?: Partial<Schedule>[];
|
2022-03-30 15:37:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Webhook
|
|
|
|
export type WebhookResponse = BaseResponse & {
|
2022-05-20 19:52:41 +00:00
|
|
|
webhook?: Partial<Webhook> | null;
|
2022-03-30 15:37:51 +00:00
|
|
|
};
|
|
|
|
export type WebhooksResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
webhooks?: Partial<Webhook>[];
|
2022-03-30 15:37:51 +00:00
|
|
|
};
|
2022-04-02 00:45:28 +00:00
|
|
|
|
|
|
|
// ReminderMail
|
|
|
|
export type ReminderMailResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
reminder_mail?: Partial<ReminderMail>;
|
2022-04-02 00:45:28 +00:00
|
|
|
};
|
|
|
|
export type ReminderMailsResponse = BaseResponse & {
|
2022-04-11 10:03:15 +00:00
|
|
|
reminder_mails?: Partial<ReminderMail>[];
|
2022-04-02 00:45:28 +00:00
|
|
|
};
|