Scheduling infrastructure for absolutely everyone.
Improves Booking docs in swagger (#219)
Syed Ali Shahbaz279c3da21f32
diff --git a/pages/api/bookings/[id]/_delete.ts b/pages/api/bookings/[id]/_delete.tsindex a48e53b9aea..c2bc3cf5d97 100644--- a/pages/api/bookings/[id]/_delete.ts+++ b/pages/api/bookings/[id]/_delete.ts@@ -29,6 +29,19 @@ import { schemaQueryIdParseInt } from "~/lib/validations/shared/queryIdTransform* type: integer* required: true* description: ID of the booking to cancel+ * parameters:+ * - in: path+ * name: id+ * schema:+ * type: integer+ * required: true+ * description: ID of the booking to get+ * - in: query+ * name: apiKey+ * required: true+ * schema:+ * type: string+ * description: Your API key* tags:* - bookings* responses:@@ -36,11 +49,25 @@ import { schemaQueryIdParseInt } from "~/lib/validations/shared/queryIdTransform* description: OK, booking cancelled successfuly* 400:* description: |- * Message | Cause- * :--|:--- * Booking not found| The provided id didn't correspond to any existing booking.- * Cannot cancel past events| The provided id matched an existing booking with a past startDate.- * User not found| The userId did not matched an existing user.+ * Bad request+ * <table>+ * <tr>+ * <td>Message</td>+ * <td>Cause</td>+ * </tr>+ * <tr>+ * <td>Booking not found</td>+ * <td>The provided id didn't correspond to any existing booking.</td>+ * </tr>+ * <tr>+ * <td>Cannot cancel past events</td>+ * <td>The provided id matched an existing booking with a past startDate.</td>+ * </tr>+ * <tr>+ * <td>User not found</td>+ * <td>The userId did not matched an existing user.</td>+ * </tr>+ * </table>* 404:* description: User not found*/diff --git a/pages/api/bookings/[id]/_get.ts b/pages/api/bookings/[id]/_get.tsindex a15f993077e..2d6ae07a647 100644--- a/pages/api/bookings/[id]/_get.ts+++ b/pages/api/bookings/[id]/_get.ts@@ -18,6 +18,12 @@ import { schemaQueryIdParseInt } from "~/lib/validations/shared/queryIdTransform* type: integer* required: true* description: ID of the booking to get+ * - in: query+ * name: apiKey+ * required: true+ * schema:+ * type: string+ * description: Your API key* tags:* - bookings* responses:diff --git a/pages/api/bookings/[id]/_patch.ts b/pages/api/bookings/[id]/_patch.tsindex fc20c147098..55b20bc9c11 100644--- a/pages/api/bookings/[id]/_patch.ts+++ b/pages/api/bookings/[id]/_patch.ts@@ -23,14 +23,53 @@ import { schemaQueryIdParseInt } from "~/lib/validations/shared/queryIdTransform* properties:* title:* type: string- * example: 15min+ * description: 'Booking event title'* startTime:* type: string- * example: 1970-01-01T17:00:00.000Z+ * format: date-time+ * description: 'Start time of the Event'* endTime:* type: string- * example: 1970-01-01T17:00:00.000Z+ * format: date-time+ * description: 'End time of the Event'+ * recurringEventId:+ * type: integer+ * description: 'Recurring event ID if the event is recurring'+ * description:+ * type: string+ * description: 'Event description'+ * status:+ * type: string+ * description: 'Acceptable values one of ["ACCEPTED", "PENDING", "CANCELLED", "REJECTED"]'+ * location:+ * type: string+ * description: 'Meeting location'+ * smsReminderNumber:+ * type: number+ * description: 'SMS reminder number'+ * attendees:+ * type: array+ * description: 'List of attendees of the booking'+ * items:+ * type: object+ * properties:+ * name:+ * type: string+ * email:+ * type: string+ * format: email+ * timeZone:+ * type: string+ * locale:+ * type: string+ ** parameters:+ * - in: query+ * name: apiKey+ * required: true+ * schema:+ * type: string+ * description: Your API key* - in: path* name: id* schema:diff --git a/pages/api/bookings/_get.ts b/pages/api/bookings/_get.tsindex cdb9f1627f6..9476d07e09f 100644--- a/pages/api/bookings/_get.ts+++ b/pages/api/bookings/_get.ts@@ -12,7 +12,28 @@ import { schemaQuerySingleOrMultipleUserIds } from "~/lib/validations/shared/que* /bookings:* get:* summary: Find all bookings+ * parameters:+ * - in: query+ * name: apiKey+ * required: true+ * schema:+ * type: string+ * description: Your API key* operationId: listBookings+ * requestBody:+ * description: Find all bookings+ * content:+ * application/json:+ * schema:+ * type: object+ * properties:+ * userId:+ * description: 'The user(s) to get the booking for, if the request is by an Admin'+ * oneOf:+ * - type: integer+ * - type: array+ * items:+ * type: integer* tags:* - bookings* responses:diff --git a/pages/api/bookings/_post.ts b/pages/api/bookings/_post.tsindex af3099dd856..ff3ac36e024 100644--- a/pages/api/bookings/_post.ts+++ b/pages/api/bookings/_post.ts@@ -8,42 +8,99 @@ import { defaultResponder } from "@calcom/lib/server";* /bookings:* post:* summary: Creates a new booking+ * parameters:+ * - in: query+ * name: apiKey+ * required: true+ * schema:+ * type: string+ * description: Your API key* operationId: addBooking* requestBody:- * description: Edit an existing booking related to one of your event-types+ * description: Create a new booking related to one of your event-types* required: true* content:* application/json:* schema:* type: object+ * required:+ * - startTime+ * - endTime* properties:* title:* type: string- * example: 15min+ * description: 'Booking event title'* startTime:* type: string- * example: 1970-01-01T17:00:00.000Z+ * format: date-time+ * description: 'Start time of the Event'* endTime:* type: string- * example: 1970-01-01T17:00:00.000Z- * recurringCount:+ * format: date-time+ * description: 'End time of the Event'+ * recurringEventId:+ * type: integer+ * description: 'Recurring event ID if the event is recurring'+ * description:+ * type: string+ * description: 'Event description'+ * status:+ * type: string+ * description: 'Acceptable values one of ["ACCEPTED", "PENDING", "CANCELLED", "REJECTED"]'+ * location:+ * type: string+ * description: 'Meeting location'+ * smsReminderNumber:* type: number- * example: 8+ * description: 'SMS reminder number'+ * attendees:+ * type: array+ * description: 'List of attendees of the booking'+ * items:+ * type: object+ * properties:+ * name:+ * type: string+ * email:+ * type: string+ * format: email+ * timeZone:+ * type: string+ * locale:+ * type: string+ ** tags:- * - bookings+ * - bookings* responses:* 201:* description: Booking(s) created successfully.* 400:- * description: |- * Message | Cause- * :--|:--- * Booking body is invalid| Missing property on booking entity.- * Invalid eventTypeId| The provided eventTypeId does not exist.- * Missing recurringCount| The eventType is recurring, and no recurringCount was passed.- * Invalid recurringCount| The provided recurringCount is greater than the eventType recurring config+ * description: |+ * Bad request+ * <table>+ * <tr>+ * <td>Message</td>+ * <td>Cause</td>+ * </tr>+ * <tr>+ * <td>Booking body is invalid</td>+ * <td>Missing property on booking entity.</td>+ * </tr>+ * <tr>+ * <td>Invalid eventTypeId</td>+ * <td>The provided eventTypeId does not exist.</td>+ * </tr>+ * <tr>+ * <td>Missing recurringCount</td>+ * <td>The eventType is recurring, and no recurringCount was passed.</td>+ * </tr>+ * <tr>+ * <td>Invalid recurringCount</td>+ * <td>The provided recurringCount is greater than the eventType recurring config</td>+ * </tr>+ * </table>* 401:- * description: Authorization information is missing or invalid.+ * description: Authorization information is missing or invalid.*/async function handler(req: NextApiRequest) {const { userId, isAdmin } = req;diff --git a/pages/api/users/_post.ts b/pages/api/users/_post.tsindex 2346e358760..3ee8c222d5f 100644--- a/pages/api/users/_post.ts+++ b/pages/api/users/_post.ts@@ -46,7 +46,7 @@ import { schemaUserCreateBodyParams } from "~/lib/validations/user";* description: Start of the week. Acceptable values are one of [SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY]* type: string* timeZone:- * description: The new user's time zone+ * description: The new user's time zone. Eg: 'EUROPE/PARIS'* type: string* theme:* description: Default theme for the new user. Acceptable values are one of [DARK, LIGHT]@@ -61,15 +61,15 @@ import { schemaUserCreateBodyParams } from "~/lib/validations/user";* user:* summary: An example of USER* value:- * email: [email protected]- * username: johndoe- * weekStart: MONDAY- * brandColor: #555555- * darkBrandColor: #111111- * timeZone: EUROPE/PARIS- * theme: LIGHT- * timeFormat: TWELVE- * locale: FR+ * email: '[email protected]'+ * username: 'johndoe'+ * weekStart: 'MONDAY'+ * brandColor: '#555555'+ * darkBrandColor: '#111111'+ * timeZone: 'EUROPE/PARIS'+ * theme: 'LIGHT'+ * timeFormat: 'TWELVE'+ * locale: 'FR'* tags:* - users* responses: