Adds swagger definition to Event Types (#242)

This PR adds swagger definition to Event Types endpoint with request
body examples for POST and PATCH requests
This commit is contained in:
Syed Ali Shahbaz
2023-02-23 13:54:10 +01:00
committed by GitHub
parent 42eb7041d4
commit a4f82fa6fa
6 changed files with 284 additions and 24 deletions
+6
View File
@@ -50,6 +50,12 @@ import { defaultResponder } from "@calcom/lib/server";
* location:
* type: string
* description: 'Meeting location'
* seatsPerTimeSlot:
* type: integer
* description: 'The number of seats for each time slot'
* seatsShowAttendees:
* type: boolean
* description: 'Share Attendee information in seats'
* smsReminderNumber:
* type: number
* description: 'SMS reminder number'
+7 -3
View File
@@ -12,18 +12,22 @@ import { schemaQueryIdParseInt } from "~/lib/validations/shared/queryIdTransform
* operationId: removeEventTypeById
* summary: Remove an existing eventType
* parameters:
* - in: query
* name: apiKey
* schema:
* type: string
* required: true
* description: Your API Key
* - in: path
* name: id
* schema:
* type: integer
* required: true
* description: ID of the eventType to delete
* security:
* - ApiKeyAuth: []
* tags:
* - event-types
* externalDocs:
* url: https://docs.cal.com/event-types
* url: https://docs.cal.com/core-features/event-types
* responses:
* 201:
* description: OK, eventType removed successfully
+14 -10
View File
@@ -12,19 +12,23 @@ import { schemaQueryIdParseInt } from "~/lib/validations/shared/queryIdTransform
* operationId: getEventTypeById
* summary: Find a eventType
* parameters:
* - in: path
* name: id
* example: 4
* schema:
* type: integer
* required: true
* description: ID of the eventType to get
* security:
* - ApiKeyAuth: []
* - in: query
* name: apiKey
* schema:
* type: string
* required: true
* description: Your API Key
* - in: path
* name: id
* example: 4
* schema:
* type: integer
* required: true
* description: ID of the eventType to get
* tags:
* - event-types
* externalDocs:
* url: https://docs.cal.com/event-types
* url: https://docs.cal.com/core-features/event-types
* responses:
* 200:
* description: OK
+119 -3
View File
@@ -17,18 +17,134 @@ import checkTeamEventEditPermission from "../_utils/checkTeamEventEditPermission
* operationId: editEventTypeById
* summary: Edit an existing eventType
* parameters:
* - in: query
* name: apiKey
* schema:
* type: string
* required: true
* description: Your API Key
* - in: path
* name: id
* schema:
* type: integer
* required: true
* description: ID of the eventType to edit
* security:
* - ApiKeyAuth: []
* requestBody:
* description: Create a new event-type related to your user or team
* required: true
* content:
* application/json:
* schema:
* type: object
* properties:
* length:
* type: integer
* description: Duration of the event type in minutes
* metadata:
* type: object
* description: Metadata relating to event type. Pass {} if empty
* title:
* type: string
* description: Title of the event type
* slug:
* type: string
* description: Unique slug for the event type
* hidden:
* type: boolean
* description: If the event type should be hidden from your public booking page
* position:
* type: integer
* description: The position of the event type on the public booking page
* teamId:
* type: integer
* description: Team ID if the event type should belong to a team
* periodType:
* type: string
* enum: [UNLIMITED, ROLLING, RANGE]
* description: To decide how far into the future an invitee can book an event with you
* periodStartDate:
* type: string
* format: date-time
* description: Start date of bookable period (Required if periodType is 'range')
* periodEndDate:
* type: string
* format: date-time
* description: End date of bookable period (Required if periodType is 'range')
* periodDays:
* type: integer
* description: Number of bookable days (Required if periodType is rolling)
* periodCountCalendarDays:
* type: boolean
* description: If calendar days should be counted for period days
* requiresConfirmation:
* type: boolean
* description: If the event type should require your confirmation before completing the booking
* recurringEvent:
* type: object
* description: If the event should recur every week/month/year with the selected frequency
* properties:
* interval:
* type: integer
* count:
* type: integer
* freq:
* type: integer
* disableGuests:
* type: boolean
* description: If the event type should disable adding guests to the booking
* hideCalendarNotes:
* type: boolean
* description: If the calendar notes should be hidden from the booking
* minimumBookingNotice:
* type: integer
* description: Minimum time in minutes before the event is bookable
* beforeEventBuffer:
* type: integer
* description: Number of minutes of buffer time before a Cal Event
* afterEventBuffer:
* type: integer
* description: Number of minutes of buffer time after a Cal Event
* schedulingType:
* type: string
* description: The type of scheduling if a Team event. Required for team events only
* enum: [ROUND_ROBIN, COLLECTIVE]
* price:
* type: integer
* description: Price of the event type booking
* currency:
* type: string
* description: Currency acronym. Eg- usd, eur, gbp, etc.
* slotInterval:
* type: integer
* description: The intervals of available bookable slots in minutes
* successRedirectUrl:
* type: string
* format: url
* description: A valid URL where the booker will redirect to, once the booking is completed successfully
* description:
* type: string
* description: Description of the event type
* seatsPerTimeSlot:
* type: integer
* description: 'The number of seats for each time slot'
* seatsShowAttendees:
* type: boolean
* description: 'Share Attendee information in seats'
* locations:
* type: array
* description: A list of all available locations for the event type
* items:
* type: object
* example:
* event-type:
* summary: An example of event type PATCH request
* value:
* length: 60
* requiresConfirmation: true
* tags:
* - event-types
* externalDocs:
* url: https://docs.cal.com/event-types
* url: https://docs.cal.com/core-features/event-types
* responses:
* 201:
* description: OK, eventType edited successfully
+8 -1
View File
@@ -13,10 +13,17 @@ import { schemaQuerySingleOrMultipleUserIds } from "~/lib/validations/shared/que
* get:
* summary: Find all event types
* operationId: listEventTypes
* parameters:
* - in: query
* name: apiKey
* schema:
* type: string
* required: true
* description: Your API Key
* tags:
* - event-types
* externalDocs:
* url: https://docs.cal.com/event-types
* url: https://docs.cal.com/core-features/event-types
* responses:
* 200:
* description: OK
+130 -7
View File
@@ -14,6 +14,13 @@ import checkTeamEventEditPermission from "./_utils/checkTeamEventEditPermission"
* post:
* summary: Creates a new event type
* operationId: addEventType
* parameters:
* - in: query
* name: apiKey
* schema:
* type: string
* required: true
* description: Your API Key
* requestBody:
* description: Create a new event-type related to your user or team
* required: true
@@ -28,22 +35,138 @@ import checkTeamEventEditPermission from "./_utils/checkTeamEventEditPermission"
* - metadata
* properties:
* length:
* type: number
* example: 30
* type: integer
* description: Duration of the event type in minutes
* metadata:
* type: object
* example: {"smartContractAddress": "0x1234567890123456789012345678901234567890"}
* description: Metadata relating to event type. Pass {} if empty
* title:
* type: string
* example: My Event
* description: Title of the event type
* slug:
* type: string
* example: my-event
*
* description: Unique slug for the event type
* hidden:
* type: boolean
* description: If the event type should be hidden from your public booking page
* position:
* type: integer
* description: The position of the event type on the public booking page
* teamId:
* type: integer
* description: Team ID if the event type should belong to a team
* periodType:
* type: string
* enum: [UNLIMITED, ROLLING, RANGE]
* description: To decide how far into the future an invitee can book an event with you
* periodStartDate:
* type: string
* format: date-time
* description: Start date of bookable period (Required if periodType is 'range')
* periodEndDate:
* type: string
* format: date-time
* description: End date of bookable period (Required if periodType is 'range')
* periodDays:
* type: integer
* description: Number of bookable days (Required if periodType is rolling)
* periodCountCalendarDays:
* type: boolean
* description: If calendar days should be counted for period days
* requiresConfirmation:
* type: boolean
* description: If the event type should require your confirmation before completing the booking
* recurringEvent:
* type: object
* description: If the event should recur every week/month/year with the selected frequency
* properties:
* interval:
* type: integer
* count:
* type: integer
* freq:
* type: integer
* disableGuests:
* type: boolean
* description: If the event type should disable adding guests to the booking
* hideCalendarNotes:
* type: boolean
* description: If the calendar notes should be hidden from the booking
* minimumBookingNotice:
* type: integer
* description: Minimum time in minutes before the event is bookable
* beforeEventBuffer:
* type: integer
* description: Number of minutes of buffer time before a Cal Event
* afterEventBuffer:
* type: integer
* description: Number of minutes of buffer time after a Cal Event
* schedulingType:
* type: string
* description: The type of scheduling if a Team event. Required for team events only
* enum: [ROUND_ROBIN, COLLECTIVE]
* price:
* type: integer
* description: Price of the event type booking
* currency:
* type: string
* description: Currency acronym. Eg- usd, eur, gbp, etc.
* slotInterval:
* type: integer
* description: The intervals of available bookable slots in minutes
* successRedirectUrl:
* type: string
* format: url
* description: A valid URL where the booker will redirect to, once the booking is completed successfully
* description:
* type: string
* description: Description of the event type
* locations:
* type: array
* description: A list of all available locations for the event type
* items:
* type: object
* example:
* event-type:
* summary: An example of event type POST request
* value:
* title: Hello World
* slug: hello-world
* length: 30
* hidden: false
* position: 0
* eventName: null
* timeZone: null
* periodType: UNLIMITED
* periodStartDate: 2023-02-15T08:46:16.000Z
* periodEndDate: 2023-0-15T08:46:16.000Z
* periodDays: null
* periodCountCalendarDays: false
* requiresConfirmation: false
* recurringEvent: null
* disableGuests: false
* hideCalendarNotes: false
* minimumBookingNotice: 120
* beforeEventBuffer: 0
* afterEventBuffer: 0
* price: 0
* currency: usd
* slotInterval: null
* successRedirectUrl: null
* description: A test event type
* metadata: {
* apps: {
* stripe: {
* price: 0,
* enabled: false,
* currency: usd
* }
* }
* }
* tags:
* - event-types
* externalDocs:
* url: https://docs.cal.com/event-types
* url: https://docs.cal.com/core-features/event-types
* responses:
* 201:
* description: OK, event type created