Skip to content

Commit 5c52149

Browse files
chore(internal): fix pagination internals not accepting option promises
1 parent 4e4c9df commit 5c52149

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/client.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -616,17 +616,22 @@ export class Kernel {
616616
getAPIList<Item, PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>>(
617617
path: string,
618618
Page: new (...args: any[]) => PageClass,
619-
opts?: RequestOptions,
619+
opts?: PromiseOrValue<RequestOptions>,
620620
): Pagination.PagePromise<PageClass, Item> {
621-
return this.requestAPIList(Page, { method: 'get', path, ...opts });
621+
return this.requestAPIList(
622+
Page,
623+
opts && 'then' in opts ?
624+
opts.then((opts) => ({ method: 'get', path, ...opts }))
625+
: { method: 'get', path, ...opts },
626+
);
622627
}
623628

624629
requestAPIList<
625630
Item = unknown,
626631
PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>,
627632
>(
628633
Page: new (...args: ConstructorParameters<typeof Pagination.AbstractPage>) => PageClass,
629-
options: FinalRequestOptions,
634+
options: PromiseOrValue<FinalRequestOptions>,
630635
): Pagination.PagePromise<PageClass, Item> {
631636
const request = this.makeRequest(options, null, undefined);
632637
return new Pagination.PagePromise<PageClass, Item>(this as any as Kernel, request, Page);

0 commit comments

Comments
 (0)