diff --git a/src/gax.ts b/src/gax.ts index b46a30184..2f7763123 100644 --- a/src/gax.ts +++ b/src/gax.ts @@ -125,8 +125,6 @@ export interface CallOptions { timeout?: number; retry?: Partial | null; autoPaginate?: boolean; - pageToken?: string; - pageSize?: number; maxResults?: number; maxRetries?: number; // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -177,7 +175,6 @@ export class CallSettings { this.retry = settings.retry as RetryOptions; this.autoPaginate = 'autoPaginate' in settings ? settings.autoPaginate : true; - this.pageToken = settings.pageToken; this.maxResults = settings.maxResults; this.otherArgs = settings.otherArgs || {}; this.bundleOptions = settings.bundleOptions; @@ -203,8 +200,6 @@ export class CallSettings { let timeout = this.timeout; let retry = this.retry; let autoPaginate = this.autoPaginate; - let pageToken = this.pageToken; - let pageSize = this.pageSize; let maxResults = this.maxResults; let otherArgs = this.otherArgs; let isBundling = this.isBundling; @@ -246,15 +241,6 @@ export class CallSettings { autoPaginate = false; } - if ('pageToken' in options) { - autoPaginate = false; - pageToken = options.pageToken; - } - - if ('pageSize' in options) { - pageSize = options.pageSize; - } - if ('maxResults' in options) { maxResults = options.maxResults; } @@ -294,8 +280,6 @@ export class CallSettings { bundleOptions: this.bundleOptions, longrunning, autoPaginate, - pageToken, - pageSize, maxResults, otherArgs, isBundling, diff --git a/src/paginationCalls/pagedApiCaller.ts b/src/paginationCalls/pagedApiCaller.ts index 6ab9f4471..9c25cd0e7 100644 --- a/src/paginationCalls/pagedApiCaller.ts +++ b/src/paginationCalls/pagedApiCaller.ts @@ -135,8 +135,7 @@ export class PagedApiCaller implements APICaller { * It's supposed to be a gRPC service stub function wrapped into several layers of wrappers that make it * accept just two parameters: (request, callback). * @param request A request object that came from the user. - * @param settings Call settings. We are interested in `maxResults`, autoPaginate`, `pageToken`, and `pageSize` - * (they are all optional). + * @param settings Call settings. We are interested in `maxResults` and `autoPaginate` (they are optional). * @param ongoingCall An instance of OngoingCall or OngoingCallPromise that can be used for call cancellation, * and is used to return results to the user. */ @@ -148,14 +147,6 @@ export class PagedApiCaller implements APICaller { ) { request = Object.assign({}, request); - // If settings object contain pageToken or pageSize, override the corresponding fields in the request object. - if (settings.pageToken) { - request[this.pageDescriptor.requestPageTokenField] = settings.pageToken; - } - if (settings.pageSize) { - request[this.pageDescriptor.requestPageSizeField!] = settings.pageSize; - } - if (!settings.autoPaginate) { // they don't want auto-pagination this time - okay, just call once ongoingCall.call(apiCall, request); diff --git a/test/unit/pagedIteration.ts b/test/unit/pagedIteration.ts index 73d34db1a..8bbabf40f 100644 --- a/test/unit/pagedIteration.ts +++ b/test/unit/pagedIteration.ts @@ -339,18 +339,17 @@ describe('paged iteration', () => { }); it('ignores autoPaginate options, but respects others', done => { - // Specifies autoPaginate: false, which will be ignored, and pageToken: - // pageSize which will be used so that the stream will start from the - // specified token. - const options = {pageToken: pageSize, autoPaginate: false}; + // Specifies autoPaginate: false, which will be ignored, and maxResults: + // pageSize which will be used. + const options = {maxResults: pageSize, autoPaginate: false}; streamChecker( // @ts-ignore incomplete options descriptor.createStream(apiCall, {}, options), () => { - assert.strictEqual(spy.callCount, pagesToStream); + assert.strictEqual(spy.callCount, 1); }, done, - pageSize + 0 ); });