Skip to content

Commit eecad0a

Browse files
chore(internal): fix pagination internals not accepting option promises
1 parent 2e1b9c5 commit eecad0a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/client.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,17 +482,22 @@ export class Conductor {
482482
getAPIList<Item, PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>>(
483483
path: string,
484484
Page: new (...args: any[]) => PageClass,
485-
opts?: RequestOptions,
485+
opts?: PromiseOrValue<RequestOptions>,
486486
): Pagination.PagePromise<PageClass, Item> {
487-
return this.requestAPIList(Page, { method: 'get', path, ...opts });
487+
return this.requestAPIList(
488+
Page,
489+
opts && 'then' in opts ?
490+
opts.then((opts) => ({ method: 'get', path, ...opts }))
491+
: { method: 'get', path, ...opts },
492+
);
488493
}
489494

490495
requestAPIList<
491496
Item = unknown,
492497
PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>,
493498
>(
494499
Page: new (...args: ConstructorParameters<typeof Pagination.AbstractPage>) => PageClass,
495-
options: FinalRequestOptions,
500+
options: PromiseOrValue<FinalRequestOptions>,
496501
): Pagination.PagePromise<PageClass, Item> {
497502
const request = this.makeRequest(options, null, undefined);
498503
return new Pagination.PagePromise<PageClass, Item>(this as any as Conductor, request, Page);

0 commit comments

Comments
 (0)