|
18 | 18 | pagination, and long-running operations to gRPC methods. |
19 | 19 | """ |
20 | 20 |
|
21 | | -import functools |
22 | | - |
23 | | -import six |
24 | | - |
25 | 21 | from google.api_core import general_helpers |
26 | 22 | from google.api_core import grpc_helpers |
27 | | -from google.api_core import page_iterator |
28 | 23 | from google.api_core import timeout |
29 | 24 | from google.api_core.gapic_v1 import client_info |
30 | 25 |
|
@@ -232,38 +227,3 @@ def get_topic(name, timeout=None): |
232 | 227 | _GapicCallable( |
233 | 228 | func, default_retry, default_timeout, |
234 | 229 | user_agent_metadata=user_agent_metadata)) |
235 | | - |
236 | | - |
237 | | -def wrap_with_paging( |
238 | | - func, items_field, request_token_field, response_token_field): |
239 | | - """Wrap an RPC method to return a page iterator. |
240 | | -
|
241 | | - Args: |
242 | | - func (Callable): The RPC method. This should already have been |
243 | | - wrapped with common functionality using :func:`wrap_method`. |
244 | | - request (protobuf.Message): The request message. |
245 | | - items_field (str): The field in the response message that has the |
246 | | - items for the page. |
247 | | - request_token_field (str): The field in the request message used to |
248 | | - specify the page token. |
249 | | - response_token_field (str): The field in the response message that has |
250 | | - the token for the next page. |
251 | | -
|
252 | | - Returns: |
253 | | - Callable: Returns a callable that when invoked will call the RPC |
254 | | - method and return a |
255 | | - :class:`google.api_core.page_iterator.Iterator`. |
256 | | - """ |
257 | | - @six.wraps(func) |
258 | | - def paged_method(request, **kwargs): |
259 | | - """Wrapper that invokes a method and returns a page iterator.""" |
260 | | - iterator = page_iterator.GRPCIterator( |
261 | | - client=None, |
262 | | - method=functools.partial(func, **kwargs), |
263 | | - request=request, |
264 | | - items_field=items_field, |
265 | | - request_token_field=request_token_field, |
266 | | - response_token_field=response_token_field) |
267 | | - return iterator |
268 | | - |
269 | | - return paged_method |
0 commit comments