-
Notifications
You must be signed in to change notification settings - Fork 21
fix(UXP-858): add offer_request_id inside Offers list operations #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,5 +1,5 @@ | ||||||
import { Resource } from '../../Resource' | ||||||
import { DuffelResponse, Offer, PaginationMeta } from '../../types' | ||||||
import { DuffelResponse, ListOffersParams, Offer } from '../../types' | ||||||
|
||||||
/** | ||||||
* Each offer represents flights you can buy from an airline at a particular price that meet your search criteria. | ||||||
|
@@ -28,16 +28,35 @@ export class Offers extends Resource { | |||||
|
||||||
/** | ||||||
* Retrieves a page of offers. The results may be returned in any order. | ||||||
* @param {Object} [options] - Pagination options (optional: limit, after, before) | ||||||
* @param {Object.<ListOffersParams>} params - Endpoint options (optional: limit, after, before, max_connections, sort) | ||||||
* @param {string} params.offer_request_id - Duffel's unique identifier for the offer request, returned when it was created | ||||||
* @link https://duffel.com/docs/api/offers/get-offers | ||||||
*/ | ||||||
public list = (options?: PaginationMeta): Promise<DuffelResponse<Offer[]>> => | ||||||
this.request({ method: 'GET', path: this.path, params: options }) | ||||||
public list = ({ offer_request_id, ...params }: ListOffersParams): Promise<DuffelResponse<Offer[]>> => | ||||||
this.request({ | ||||||
method: 'GET', | ||||||
path: this.path, | ||||||
params: { | ||||||
...params, | ||||||
offer_request_id | ||||||
} | ||||||
}) | ||||||
|
||||||
/** | ||||||
* Retrieves a generator of all offers. The results may be returned in any order. | ||||||
* @param {Object.<ListOffersParams>} params - Endpoint options (optional: limit, after, before, max_connections, sort) | ||||||
* @param {string} params.offer_request_id - Duffel's unique identifier for the offer request, returned when it was created | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Since it shouldn't actually be nested inside "params"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was reading about it and because it's nested inside There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aah ok, I read that as you need to have it as |
||||||
* @link https://duffel.com/docs/api/offers/get-offers | ||||||
*/ | ||||||
public listWithGenerator = (): AsyncGenerator<DuffelResponse<Offer>, void, unknown> => | ||||||
this.paginatedRequest({ path: this.path }) | ||||||
public listWithGenerator = ({ | ||||||
offer_request_id, | ||||||
...params | ||||||
}: ListOffersParams): AsyncGenerator<DuffelResponse<Offer>, void, unknown> => | ||||||
this.paginatedRequest({ | ||||||
path: this.path, | ||||||
params: { | ||||||
...params, | ||||||
offer_request_id | ||||||
} | ||||||
}) | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.