Package
@google-cloud/paginatorMethods
extend(Class, methodNames)
extend
(
Class
:
Function
,
methodNames
:
string
|
string
[])
:
void
;
Cache the original method, then overwrite it on the Class's prototype.
Class
Function
The parent class of the methods to extend.
methodNames
string | string[]
Name(s) of the methods to extend.
void
parseArguments_(args)
parseArguments_
(
args
:
any
[])
:
ParsedArguments
;
Parse a pseudo-array arguments
for a query and callback.
args
any[]
The original arguments
pseduo-array that the original method received.
run_(parsedArguments, originalMethod)
run_
(
parsedArguments
:
ParsedArguments
,
originalMethod
:
Function
)
:
any
;
This simply checks to see if autoPaginate
is set or not, if it's true then we buffer all results, otherwise simply call the original method.
parsedArguments
originalMethod
Function
The cached method that accepts a callback and returns nextQuery
to receive more results.
any
runAsStream_(parsedArguments, originalMethod)
runAsStream_<T
=
any
> (
parsedArguments
:
ParsedArguments
,
originalMethod
:
Function
)
:
ResourceStream<T>
;
This method simply calls the nextQuery recursively, emitting results to a stream. The stream ends when nextQuery
is null.
maxResults
will act as a cap for how many results are fetched and emitted to the stream.
parsedArguments
originalMethod
Function
The cached method that accepts a callback and returns nextQuery
to receive more results. {stream} - Readable object stream.
T
streamify(methodName)
streamify<T
=
any
> (
methodName
:
string
)
:
(
this
:
{
[
index
:
string
]
:
Function
;
},
...
args
:
any
[])
=
>
ResourceStream<T>
;
Wraps paginated API calls in a readable object stream.
This method simply calls the nextQuery recursively, emitting results to a stream. The stream ends when nextQuery
is null.
maxResults
will act as a cap for how many results are fetched and emitted to the stream.
methodName
string
Name of the method to streamify. {function} - Wrapped function.
(this: {
[index: string]: Function
;
}, ...args: any[]) => ResourceStream
<T>
T