@revolugo/booking-api-client
Version:
Javascript Revolugo Booking API Client (browser + server)
426 lines (425 loc) • 23.4 kB
TypeScript
import { BookingApi, BookingCreateApi, BookingsApiResponse, PaymentMethodUpdatePayloadApi } from '../models/index.ts';
/**
* Revolugo Booking API Reference
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.5.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import * as runtime from '../runtime.ts';
export interface BookingsDeletePayload {
token: string;
}
export interface BookingsListPayload {
endingBefore?: string | null;
filterByCheckInDate?: string | null;
filterByLastStatusUpdatedAt?: string | null;
filterByMetadata?: {
[key: string]: string;
} | null;
filterByStatus?: string | null;
limit?: number;
sortBy?: BookingsSortByEnum;
sortByOrder?: BookingsSortByOrderEnum;
startingAfter?: string | null;
}
export interface BookingsRetrievePayload {
id: string;
}
export interface BookingsRetrievePublicPayload {
token: string;
}
export interface BookingsCreatePayload {
bookingCreateApi?: BookingCreateApi;
}
export interface BookingsCouponChargePayload {
couponId: string;
id: string;
}
export interface BookingsPayLaterPayload {
id: string;
}
export interface BookingsConfirmPayLaterPayload {
id: string;
}
export interface BookingsConfirmPayload {
id: string;
}
export interface BookingsUpdatePaymentMethodsPayload {
id: string;
paymentMethodUpdatePayloadApi?: PaymentMethodUpdatePayloadApi;
}
/**
* Bookings - interface
*
* @export
* @interface BookingsInterface
*/
export interface BookingsInterface {
/**
* Cancel a confirmed Booking. A booking can only be cancelled if it\'s in one of the following status: **bkg-cf**, **bkg-pc**.
* @summary Cancel a Booking
* @param {string} token Booking token returned by **[Retrieve Booking](/v1/documentation#operation/getV1BookingsId)**. ⚠️ For security reasons, this token is unique and once generated, it is valid during a period of 10 minutes.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BookingsInterface
*/
deleteRaw(requestParameters: BookingsDeletePayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<runtime.ApiResponse<BookingApi>>;
/**
* Cancel a confirmed Booking. A booking can only be cancelled if it\'s in one of the following status: **bkg-cf**, **bkg-pc**.
* Cancel a Booking
*/
delete(requestParameters: BookingsDeletePayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<BookingApi>;
/**
* Returns a list of detailed bookings made on behalf of a specific API Key credential.
* @summary List Bookings
* @param {string} [endingBefore] A cursor to use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
* @param {string} [filterByCheckInDate] Comma separated list of two dates. Format: YYYY-MM-DD,YYYY-MM-DD
* @param {string} [filterByLastStatusUpdatedAt] Can contain the following values: either **a unique valid ISO string date** that will be considered as the \"from\" date until the current date, or **a comma separated list of two valid ISO string dates** that will be considered as the \"from\" and \"to\" dates between which the \"last_status_updated_at\" date must be included.<br/>e.g.: \"2021-01-01,2021-01-31\" or \"2023-01-03T15:03:39.910Z\" or \"2023-01-03T15:03:39.910Z,2023-01-06T15:03:39.910Z\"
* @param {{ [key: string]: string; }} [filterByMetadata] Filter bookings by metadata key-value pairs using bracket notation. All provided key-value pairs must match (AND logic).<br/>Example: `filter_by_metadata[customId]=xyz&filter_by_metadata[userId]=123`
* @param {string} [filterByStatus] Comma separated list of booking status values to filter by. Possible values are: `bkg-af` (Failure), `bkg-cx` (Canceled), `bkg-ip` (In Progress), `bkg-cf` (Confirmed). Example: `bkg-af,bkg-cx`
* @param {number} [limit] Limit the number of **Bookings** returned. Limit can range from 2 to 30
* @param {'check_in_date' | 'created_at' | 'last_status_updated_at'} [sortBy]
* @param {'asc' | 'desc'} [sortByOrder]
* @param {string} [startingAfter] A cursor to use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BookingsInterface
*/
listRaw(requestParameters: BookingsListPayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<runtime.ApiResponse<BookingsApiResponse>>;
/**
* Returns a list of detailed bookings made on behalf of a specific API Key credential.
* List Bookings
*/
list(requestParameters: BookingsListPayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<BookingsApiResponse>;
/**
* Retrieve the status and information of a booking.
* @summary Retrieve a Booking
* @param {string} id id of the booking to retrieve
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BookingsInterface
*/
retrieveRaw(requestParameters: BookingsRetrievePayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<runtime.ApiResponse<BookingApi>>;
/**
* Retrieve the status and information of a booking.
* Retrieve a Booking
*/
retrieve(requestParameters: BookingsRetrievePayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<BookingApi>;
/**
* Retrieve the status and information of a booking based on a valid token. This endpoint is public and does not require a secret API key.
* @summary Retrieve a Booking (PUBLIC)
* @param {string} token Booking token returned by **[Retrieve Booking](/v1/documentation#operation/getV1BookingsId)**. ⚠️ For security reasons, this token is unique and once generated, it is valid during a period of 10 minutes.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BookingsInterface
*/
retrievePublicRaw(requestParameters: BookingsRetrievePublicPayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<runtime.ApiResponse<BookingApi>>;
/**
* Retrieve the status and information of a booking based on a valid token. This endpoint is public and does not require a secret API key.
* Retrieve a Booking (PUBLIC)
*/
retrievePublic(requestParameters: BookingsRetrievePublicPayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<BookingApi>;
/**
* Creates an unconfirmed booking
* @summary Create an unconfirmed Booking
* @param {BookingCreateApi} [bookingCreateApi] Create an unconfirmed Booking
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BookingsInterface
*/
createRaw(requestParameters: BookingsCreatePayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<runtime.ApiResponse<BookingApi>>;
/**
* Creates an unconfirmed booking
* Create an unconfirmed Booking
*/
create(requestParameters: BookingsCreatePayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<BookingApi>;
/**
* Confirm booking from Coupon payment method
* @summary Confirm booking from Coupon payment method
* @param {string} couponId id of the coupon id to charge
* @param {string} id id of the booking to update their payment methods
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BookingsInterface
*/
couponChargeRaw(requestParameters: BookingsCouponChargePayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<runtime.ApiResponse<BookingApi>>;
/**
* Confirm booking from Coupon payment method
* Confirm booking from Coupon payment method
*/
couponCharge(requestParameters: BookingsCouponChargePayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<BookingApi>;
/**
* Pay later and retrieve the status and information of a booking.
* @summary Pay later a Booking
* @param {string} id id of the booking to pay later
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BookingsInterface
*/
paylaterRaw(requestParameters: BookingsPayLaterPayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<runtime.ApiResponse<BookingApi>>;
/**
* Pay later and retrieve the status and information of a booking.
* Pay later a Booking
*/
paylater(requestParameters: BookingsPayLaterPayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<BookingApi>;
/**
* Confirm later paid and retrieve the status and information of a booking.
* @summary Confirm a later paid Booking
* @param {string} id id of the later paid booking to confirm
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BookingsInterface
*/
confirmpaylaterRaw(requestParameters: BookingsConfirmPayLaterPayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<runtime.ApiResponse<BookingApi>>;
/**
* Confirm later paid and retrieve the status and information of a booking.
* Confirm a later paid Booking
*/
confirmpaylater(requestParameters: BookingsConfirmPayLaterPayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<BookingApi>;
/**
* Trigger the actual booking confirmation process. 💡 This endpoint is only available for Bookings in the **bkg-created** status. ⚠️ The booking confirmation is an asynchronous process. The booking won\'t transition immediatly to **bkg-cf** status. Rather, the endpoint will return a booking in **bkg-ip** and you\'ll be required to check booking status calling **[Get Booking endpoint](/v1/documentation#operation/getV1BookingsId)**, ideally with a polling mechanism, and perform further action(s), whether you need to let your customer know about their booking or you just need to update some data on your system, when booking status transitions to **bkg-cf** (confirmed) or **bkg-af** (fail). ⚠️ Once you have called this endpoint, we immediatly send your confirmation request to our supplier(s) and they may confirm it immediatly, so you\'ll be liable for up to the total booking tax included price amount if you need to cancel it at a later time (refer to the booking\'s cancellation policies to get the actual current penalty percentage applied in case of cancellation).
* @summary Confirm an ongoing Booking
* @param {string} id id of the booking to confirm
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BookingsInterface
*/
confirmRaw(requestParameters: BookingsConfirmPayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<runtime.ApiResponse<BookingApi>>;
/**
* Trigger the actual booking confirmation process. 💡 This endpoint is only available for Bookings in the **bkg-created** status. ⚠️ The booking confirmation is an asynchronous process. The booking won\'t transition immediatly to **bkg-cf** status. Rather, the endpoint will return a booking in **bkg-ip** and you\'ll be required to check booking status calling **[Get Booking endpoint](/v1/documentation#operation/getV1BookingsId)**, ideally with a polling mechanism, and perform further action(s), whether you need to let your customer know about their booking or you just need to update some data on your system, when booking status transitions to **bkg-cf** (confirmed) or **bkg-af** (fail). ⚠️ Once you have called this endpoint, we immediatly send your confirmation request to our supplier(s) and they may confirm it immediatly, so you\'ll be liable for up to the total booking tax included price amount if you need to cancel it at a later time (refer to the booking\'s cancellation policies to get the actual current penalty percentage applied in case of cancellation).
* Confirm an ongoing Booking
*/
confirm(requestParameters: BookingsConfirmPayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<BookingApi>;
/**
* Updates an ongoing Booking payment methods
* @summary Updates an ongoing Booking payment methods
* @param {string} id id of the booking to update its payment methods
* @param {PaymentMethodUpdatePayloadApi} [paymentMethodUpdatePayloadApi] Updates an ongoing Booking payment methods
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BookingsInterface
*/
updatePaymentMethodsRaw(requestParameters: BookingsUpdatePaymentMethodsPayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<runtime.ApiResponse<BookingApi>>;
/**
* Updates an ongoing Booking payment methods
* Updates an ongoing Booking payment methods
*/
updatePaymentMethods(requestParameters: BookingsUpdatePaymentMethodsPayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<BookingApi>;
}
/**
*
*/
export declare class Bookings extends runtime.BaseAPI implements BookingsInterface {
/**
* Cancel a confirmed Booking. A booking can only be cancelled if it\'s in one of the following status: **bkg-cf**, **bkg-pc**.
* Cancel a Booking
*/
deleteRaw(requestParameters: BookingsDeletePayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<runtime.ApiResponse<BookingApi>>;
/**
* Cancel a confirmed Booking. A booking can only be cancelled if it\'s in one of the following status: **bkg-cf**, **bkg-pc**.
* Cancel a Booking
*/
delete(requestParameters: BookingsDeletePayload, initOverrides?: RequestInit): Promise<BookingApi>;
/**
* Returns a list of detailed bookings made on behalf of a specific API Key credential.
* List Bookings
*/
listRaw(requestParameters: BookingsListPayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<runtime.ApiResponse<BookingsApiResponse>>;
/**
* Returns a list of detailed bookings made on behalf of a specific API Key credential.
* List Bookings
*/
list(requestParameters?: BookingsListPayload, initOverrides?: RequestInit): Promise<BookingsApiResponse>;
/**
* Retrieve the status and information of a booking.
* Retrieve a Booking
*/
retrieveRaw(requestParameters: BookingsRetrievePayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<runtime.ApiResponse<BookingApi>>;
/**
* Retrieve the status and information of a booking.
* Retrieve a Booking
*/
retrieve(requestParameters: BookingsRetrievePayload, initOverrides?: RequestInit): Promise<BookingApi>;
/**
* Retrieve the status and information of a booking based on a valid token. This endpoint is public and does not require a secret API key.
* Retrieve a Booking (PUBLIC)
*/
retrievePublicRaw(requestParameters: BookingsRetrievePublicPayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<runtime.ApiResponse<BookingApi>>;
/**
* Retrieve the status and information of a booking based on a valid token. This endpoint is public and does not require a secret API key.
* Retrieve a Booking (PUBLIC)
*/
retrievePublic(requestParameters: BookingsRetrievePublicPayload, initOverrides?: RequestInit): Promise<BookingApi>;
/**
* Creates an unconfirmed booking
* Create an unconfirmed Booking
*/
createRaw(requestParameters: BookingsCreatePayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<runtime.ApiResponse<BookingApi>>;
/**
* Creates an unconfirmed booking
* Create an unconfirmed Booking
*/
create(requestParameters?: BookingsCreatePayload, initOverrides?: RequestInit): Promise<BookingApi>;
/**
* Confirm booking from Coupon payment method
* Confirm booking from Coupon payment method
*/
couponChargeRaw(requestParameters: BookingsCouponChargePayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<runtime.ApiResponse<BookingApi>>;
/**
* Confirm booking from Coupon payment method
* Confirm booking from Coupon payment method
*/
couponCharge(requestParameters: BookingsCouponChargePayload, initOverrides?: RequestInit): Promise<BookingApi>;
/**
* Pay later and retrieve the status and information of a booking.
* Pay later a Booking
*/
paylaterRaw(requestParameters: BookingsPayLaterPayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<runtime.ApiResponse<BookingApi>>;
/**
* Pay later and retrieve the status and information of a booking.
* Pay later a Booking
*/
paylater(requestParameters: BookingsPayLaterPayload, initOverrides?: RequestInit): Promise<BookingApi>;
/**
* Confirm later paid and retrieve the status and information of a booking.
* Confirm a later paid Booking
*/
confirmpaylaterRaw(requestParameters: BookingsConfirmPayLaterPayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<runtime.ApiResponse<BookingApi>>;
/**
* Confirm later paid and retrieve the status and information of a booking.
* Confirm a later paid Booking
*/
confirmpaylater(requestParameters: BookingsConfirmPayLaterPayload, initOverrides?: RequestInit): Promise<BookingApi>;
/**
* Trigger the actual booking confirmation process. 💡 This endpoint is only available for Bookings in the **bkg-created** status. ⚠️ The booking confirmation is an asynchronous process. The booking won\'t transition immediatly to **bkg-cf** status. Rather, the endpoint will return a booking in **bkg-ip** and you\'ll be required to check booking status calling **[Get Booking endpoint](/v1/documentation#operation/getV1BookingsId)**, ideally with a polling mechanism, and perform further action(s), whether you need to let your customer know about their booking or you just need to update some data on your system, when booking status transitions to **bkg-cf** (confirmed) or **bkg-af** (fail). ⚠️ Once you have called this endpoint, we immediatly send your confirmation request to our supplier(s) and they may confirm it immediatly, so you\'ll be liable for up to the total booking tax included price amount if you need to cancel it at a later time (refer to the booking\'s cancellation policies to get the actual current penalty percentage applied in case of cancellation).
* Confirm an ongoing Booking
*/
confirmRaw(requestParameters: BookingsConfirmPayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<runtime.ApiResponse<BookingApi>>;
/**
* Trigger the actual booking confirmation process. 💡 This endpoint is only available for Bookings in the **bkg-created** status. ⚠️ The booking confirmation is an asynchronous process. The booking won\'t transition immediatly to **bkg-cf** status. Rather, the endpoint will return a booking in **bkg-ip** and you\'ll be required to check booking status calling **[Get Booking endpoint](/v1/documentation#operation/getV1BookingsId)**, ideally with a polling mechanism, and perform further action(s), whether you need to let your customer know about their booking or you just need to update some data on your system, when booking status transitions to **bkg-cf** (confirmed) or **bkg-af** (fail). ⚠️ Once you have called this endpoint, we immediatly send your confirmation request to our supplier(s) and they may confirm it immediatly, so you\'ll be liable for up to the total booking tax included price amount if you need to cancel it at a later time (refer to the booking\'s cancellation policies to get the actual current penalty percentage applied in case of cancellation).
* Confirm an ongoing Booking
*/
confirm(requestParameters: BookingsConfirmPayload, initOverrides?: RequestInit): Promise<BookingApi>;
/**
* Updates an ongoing Booking payment methods
* Updates an ongoing Booking payment methods
*/
updatePaymentMethodsRaw(requestParameters: BookingsUpdatePaymentMethodsPayload, initOverrides?: RequestInit & {
minCallCount?: number;
maxCallCount?: number;
}): Promise<runtime.ApiResponse<BookingApi>>;
/**
* Updates an ongoing Booking payment methods
* Updates an ongoing Booking payment methods
*/
updatePaymentMethods(requestParameters: BookingsUpdatePaymentMethodsPayload, initOverrides?: RequestInit): Promise<BookingApi>;
}
/**
* @export
*/
export declare const BookingsSortByEnum: {
CheckInDate: "check_in_date";
CreatedAt: "created_at";
LastStatusUpdatedAt: "last_status_updated_at";
};
export type BookingsSortByEnum = typeof BookingsSortByEnum[keyof typeof BookingsSortByEnum];
/**
* @export
*/
export declare const BookingsSortByOrderEnum: {
Asc: "asc";
Desc: "desc";
};
export type BookingsSortByOrderEnum = typeof BookingsSortByOrderEnum[keyof typeof BookingsSortByOrderEnum];