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.
| Name | Description |
| Class | Function
The parent class of the methods to extend. |
| methodNames | string | string[]
Name(s) of the methods to extend. |
| Type | Description |
|---|---|
| void |
parseArguments_(args)
parseArguments_
(
args
:
any
[])
:
ParsedArguments
;
Parse a pseudo-array arguments
for a query and callback.
| Name | Description |
| args | any[]
The original |
| Type | Description |
|---|---|
| ParsedArguments |
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.
| Name | Description |
| parsedArguments | ParsedArguments
Parsed arguments from the original method call. |
| originalMethod | Function
The cached method that accepts a callback and returns |
| Type | Description |
|---|---|
| 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.
| Name | Description |
| parsedArguments | ParsedArguments
|
| originalMethod | Function
The cached method that accepts a callback and returns |
| Type | Description |
|---|---|
| ResourceStream <T> |
| Name | Description |
|---|---|
| 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.
| Name | Description |
| methodName | string
Name of the method to streamify. {function} - Wrapped function. |
| Type | Description |
|---|---|
| (this: { [index: string]: Function ; }, ...args: any[]) => ResourceStream <T> |
| Name | Description |
|---|---|
| T |

