cal.pub0.org/lib/types.ts

167 lines
4.0 KiB
TypeScript
Raw Normal View History

import {
User,
ApiKey,
Team,
Credential,
SelectedCalendar,
EventType,
2022-04-01 23:55:41 +00:00
EventTypeCustomInput,
Attendee,
Availability,
BookingReference,
Booking,
DailyEventReference,
Webhook,
DestinationCalendar,
Membership,
Payment,
Schedule,
2022-04-02 00:45:28 +00:00
ReminderMail,
} 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-30 12:17:55 +00:00
// User
export type UserResponse = BaseResponse & {
user?: Partial<User>;
2022-03-30 12:17:55 +00:00
};
2022-03-30 12:17:55 +00:00
export type UsersResponse = BaseResponse & {
users?: Partial<User>[];
2022-03-30 12:17:55 +00:00
};
// Team
export type TeamResponse = BaseResponse & {
team?: Partial<Team>;
owner?: Partial<Membership>;
};
export type TeamsResponse = BaseResponse & {
teams?: Partial<Team>[];
};
// SelectedCalendar
export type SelectedCalendarResponse = BaseResponse & {
selected_calendar?: Partial<SelectedCalendar>;
};
export type SelectedCalendarsResponse = BaseResponse & {
selected_calendars?: Partial<SelectedCalendar>[];
};
// Attendee
export type AttendeeResponse = BaseResponse & {
attendee?: Partial<Attendee>;
};
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.
export type AttendeesResponse = BaseResponse & {
attendees?: Partial<Attendee>[];
};
// Availability
export type AvailabilityResponse = BaseResponse & {
availability?: Partial<Availability>;
};
2022-04-04 19:53:03 +00:00
export type AvailabilitiesResponse = BaseResponse & {
availabilities?: Partial<Availability>[];
};
// BookingReference
export type BookingReferenceResponse = BaseResponse & {
booking_reference?: Partial<BookingReference>;
};
export type BookingReferencesResponse = BaseResponse & {
booking_references?: Partial<BookingReference>[];
};
// Booking
export type BookingResponse = BaseResponse & {
booking?: Partial<Booking>;
};
export type BookingsResponse = BaseResponse & {
bookings?: Partial<Booking>[];
};
// Credential
export type CredentialResponse = BaseResponse & {
credential?: Partial<Credential>;
};
export type CredentialsResponse = BaseResponse & {
credentials?: Partial<Credential>[];
};
// DailyEventReference
export type DailyEventReferenceResponse = BaseResponse & {
daily_event_reference?: Partial<DailyEventReference>;
};
export type DailyEventReferencesResponse = BaseResponse & {
daily_event_references?: Partial<DailyEventReference>[];
};
// DestinationCalendar
export type DestinationCalendarResponse = BaseResponse & {
destination_calendar?: Partial<DestinationCalendar>;
};
export type DestinationCalendarsResponse = BaseResponse & {
destination_calendars?: Partial<DestinationCalendar>[];
};
// Membership
export type MembershipResponse = BaseResponse & {
membership?: Partial<Membership>;
};
export type MembershipsResponse = BaseResponse & {
memberships?: Partial<Membership>[];
};
2022-04-01 23:55:41 +00:00
// EventTypeCustomInput
export type EventTypeCustomInputResponse = BaseResponse & {
event_type_custom_input?: Partial<EventTypeCustomInput>;
2022-04-01 23:55:41 +00:00
};
export type EventTypeCustomInputsResponse = BaseResponse & {
event_type_custom_inputs?: Partial<EventTypeCustomInput>[];
2022-04-01 23:55:41 +00:00
};
// EventType
export type EventTypeResponse = BaseResponse & {
event_type?: Partial<EventType>;
};
export type EventTypesResponse = BaseResponse & {
event_types?: Partial<EventType>[];
};
// Payment
export type PaymentResponse = BaseResponse & {
payment?: Partial<Payment>;
};
export type PaymentsResponse = BaseResponse & {
payments?: Partial<Payment>[];
};
// Schedule
export type ScheduleResponse = BaseResponse & {
schedule?: Partial<Schedule>;
};
export type SchedulesResponse = BaseResponse & {
schedules?: Partial<Schedule>[];
};
// Webhook
export type WebhookResponse = BaseResponse & {
webhook?: Partial<Webhook>;
};
export type WebhooksResponse = BaseResponse & {
webhooks?: Partial<Webhook>[];
};
2022-04-02 00:45:28 +00:00
// ReminderMail
export type ReminderMailResponse = BaseResponse & {
reminder_mail?: Partial<ReminderMail>;
2022-04-02 00:45:28 +00:00
};
export type ReminderMailsResponse = BaseResponse & {
reminder_mails?: Partial<ReminderMail>[];
2022-04-02 00:45:28 +00:00
};