@@ -94,7 +94,57 @@ class Bookings(client: NylasClient) : Resource<Booking>(client, Booking::class.j
9494 }
9595
9696 /* *
97- * Destroy a booking
97+ * Destroy a booking with a request body.
98+ *
99+ * This is a convenience overload for callers who need to send a
100+ * [DestroyBookingRequest] but do not need query params or request overrides.
101+ * It delegates to the full request-body overload below.
102+ *
103+ * @param bookingId The ID of the booking to destroy.
104+ * @param requestBody The data to destroy the booking with.
105+ * @return The DeleteResponse object
106+ */
107+ @Throws(NylasApiError ::class , NylasSdkTimeoutError ::class )
108+ fun destroy (
109+ bookingId : String ,
110+ requestBody : DestroyBookingRequest ,
111+ ): DeleteResponse {
112+ return destroy(bookingId, requestBody, null , null )
113+ }
114+
115+ /* *
116+ * Destroy a booking with a request body.
117+ *
118+ * This is the full request-body overload used for cancellation flows that
119+ * need to send fields such as `cancellation_reason` while still supporting
120+ * optional query params and request overrides.
121+ *
122+ * @param bookingId The ID of the booking to destroy.
123+ * @param requestBody The data to destroy the booking with.
124+ * @param queryParams Optional query parameters to apply
125+ * @param overrides Optional request overrides to apply
126+ * @return The DeleteResponse object
127+ */
128+ @Throws(NylasApiError ::class , NylasSdkTimeoutError ::class )
129+ fun destroy (
130+ bookingId : String ,
131+ requestBody : DestroyBookingRequest ,
132+ queryParams : DestroyBookingQueryParams ? ,
133+ overrides : RequestOverrides ? ,
134+ ): DeleteResponse {
135+ val path = String .format(" v3/scheduling/bookings/%s" , bookingId)
136+ val adapter = JsonHelper .moshi().adapter(DestroyBookingRequest ::class .java)
137+ val serializedRequestBody = adapter.toJson(requestBody)
138+ return client.executeDelete(path, DeleteResponse ::class .java, serializedRequestBody, queryParams, overrides)
139+ }
140+
141+ /* *
142+ * Destroy a booking using the legacy no-body behavior.
143+ *
144+ * This overload is kept for backward compatibility with existing SDK users.
145+ * It preserves the previous method shape and sends the DELETE request without
146+ * a request body.
147+ *
98148 * @param bookingId The ID of the booking to destroy.
99149 * @param queryParams Optional query parameters to apply
100150 * @param overrides Optional request overrides to apply
0 commit comments