Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/Stays/Bookings/Bookings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Client } from '../../Client'
import { StaysBooking } from '../StaysTypes'
import { ListParamsBookings, StaysBooking } from '../StaysTypes'
import { Resource } from '../../Resource'
import { DuffelResponse, PaginationMeta } from '../../types'

Expand Down Expand Up @@ -70,19 +70,18 @@ export class Bookings extends Resource {
* @link https://duffel.com/docs/api/bookings/list-bookings
*/
public list = async (
options?: PaginationMeta,
options?: PaginationMeta & ListParamsBookings,
): Promise<DuffelResponse<StaysBooking[]>> =>
this.request({ method: 'GET', path: this.path, params: options })

/**
* Retrieves a generator of all bookings. The results may be returned in any order.
* @link https://duffel.com/docs/api/bookings/list-bookings
*/
public listWithGenerator = (): AsyncGenerator<
DuffelResponse<StaysBooking>,
void,
unknown
> => this.paginatedRequest({ path: this.path })
public listWithGenerator = (
options?: ListParamsBookings,
): AsyncGenerator<DuffelResponse<StaysBooking>, void, unknown> =>
this.paginatedRequest({ path: this.path, params: options })

/**
* Cancel a booking
Expand Down
7 changes: 7 additions & 0 deletions src/Stays/StaysTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -734,3 +734,10 @@ export interface StaysAccommodationReview {
export interface StaysAccommodationReviewResponse {
reviews: Array<StaysAccommodationReview>
}

export type ListParamsBookings = {
/**
* Whether to filter bookings matching a given customer user id.
*/
user_id?: string
}
5 changes: 5 additions & 0 deletions src/booking/Orders/OrdersTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,11 @@ export interface ListParamsOrders {
* Whether to filter orders matching a given passenger name record (PNR)
*/
booking_reference?: string

/**
* Whether to filter orders matching a given customer user id.
*/
user_id?: string
}

export interface UpdateSingleOrder {
Expand Down