Skip to content

Commit 19f3823

Browse files
authored
Merge pull request #1085 from duffelhq/igorp1/tsp-721-public-endpoint-to-retrieve-orders-for-a-customer-user
feat: updates client to surface user_id query param
2 parents 272edc6 + 36881d9 commit 19f3823

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

src/Stays/Bookings/Bookings.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Client } from '../../Client'
2-
import { StaysBooking } from '../StaysTypes'
2+
import { ListParamsBookings, StaysBooking } from '../StaysTypes'
33
import { Resource } from '../../Resource'
44
import { DuffelResponse, PaginationMeta } from '../../types'
55

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

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

8786
/**
8887
* Cancel a booking

src/Stays/StaysTypes.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,3 +734,10 @@ export interface StaysAccommodationReview {
734734
export interface StaysAccommodationReviewResponse {
735735
reviews: Array<StaysAccommodationReview>
736736
}
737+
738+
export type ListParamsBookings = {
739+
/**
740+
* Whether to filter bookings matching a given customer user id.
741+
*/
742+
user_id?: string
743+
}

src/booking/Orders/OrdersTypes.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,11 @@ export interface ListParamsOrders {
670670
* Whether to filter orders matching a given passenger name record (PNR)
671671
*/
672672
booking_reference?: string
673+
674+
/**
675+
* Whether to filter orders matching a given customer user id.
676+
*/
677+
user_id?: string
673678
}
674679

675680
export interface UpdateSingleOrder {

0 commit comments

Comments
 (0)