Skip to content
Prev Previous commit
Next Next commit
De-emphasize 'project' and 'connection' as args to 'list_topics'.
Addresses: #742 (comment).
  • Loading branch information
tseaver committed Mar 18, 2015
commit cf8b9fa2af3ceb01f08aadbb0da18fd0594bb4fb
20 changes: 10 additions & 10 deletions gcloud/pubsub/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,18 @@
""" Define API functions (not bound to classes)."""


def list_topics(project=None, connection=None,
page_size=None, page_token=None):
def list_topics(page_size=None, page_token=None,

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

project=None, connection=None):
"""List topics for a given project.

:type page_size: int
:param page_size: maximum number of topics to return, If not passed,
defaults to a value set by the API.

:type page_token: string
:param page_token: opaque marker for the next "page" of topics. If not
passed, the API will return the first page of topics.

:type project: string
:param project: project ID to query. If not passed, defaults to the
project ID inferred from the environment.
Expand All @@ -28,14 +36,6 @@ def list_topics(project=None, connection=None,
defaults to the connection inferred from the
environment.

:type page_size: int
:param page_size: maximum number of topics to return, If not passed,
defaults to a value set by the API.

:type page_token: string
:param page_token: opaque marker for the next "page" of topics. If not
passed, the API will return the first page of topics.

:rtype: dict
:returns: keys include ``topics`` (a list of topic mappings) and
``nextPageToken`` (a string: if non-empty, indicates that
Expand Down
4 changes: 2 additions & 2 deletions gcloud/pubsub/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_w_explicit_connection_no_paging(self):
returned = {'topics': [{'name': TOPIC_NAME}],
'nextPageToken': TOKEN}
conn = _Connection(returned)
response = self._callFUT(PROJECT, conn)
response = self._callFUT(project=PROJECT, connection=conn)
topics = response['topics']
self.assertEqual(len(topics), 1)
self.assertEqual(topics[0], {'name': TOPIC_NAME})
Expand All @@ -48,7 +48,7 @@ def test_w_explicit_connection_w_paging(self):
returned = {'topics': [{'name': TOPIC_NAME}],
'nextPageToken': TOKEN2}
conn = _Connection(returned)
response = self._callFUT(PROJECT, conn, SIZE, TOKEN1)
response = self._callFUT(SIZE, TOKEN1, PROJECT, conn)
topics = response['topics']
self.assertEqual(len(topics), 1)
self.assertEqual(topics[0], {'name': TOPIC_NAME})
Expand Down