@@ -65,20 +65,12 @@ def list_topics(self, page_size=None, page_token=None):
6565 more topics can be retrieved with another call (pass that
6666 value as ``page_token``).
6767 """
68- params = {}
69-
70- if page_size is not None :
71- params ['pageSize' ] = page_size
72-
73- if page_token is not None :
74- params ['pageToken' ] = page_token
75-
76- path = '/projects/%s/topics' % (self .project ,)
77- resp = self .connection .api_request (method = 'GET' , path = path ,
78- query_params = params )
68+ conn = self .connection
69+ resources , next_token = conn .list_topics (
70+ self .project , page_size , page_token )
7971 topics = [Topic .from_api_repr (resource , self )
80- for resource in resp . get ( 'topics' , ()) ]
81- return topics , resp . get ( 'nextPageToken' )
72+ for resource in resources ]
73+ return topics , next_token
8274
8375 def list_subscriptions (self , page_size = None , page_token = None ):
8476 """List subscriptions for the project associated with this client.
@@ -104,23 +96,14 @@ def list_subscriptions(self, page_size=None, page_token=None):
10496 more topics can be retrieved with another call (pass that
10597 value as ``page_token``).
10698 """
107- params = {}
108-
109- if page_size is not None :
110- params ['pageSize' ] = page_size
111-
112- if page_token is not None :
113- params ['pageToken' ] = page_token
114-
115- path = '/projects/%s/subscriptions' % (self .project ,)
116-
117- resp = self .connection .api_request (method = 'GET' , path = path ,
118- query_params = params )
99+ conn = self .connection
100+ resources , next_token = conn .list_subscriptions (
101+ self .project , page_size , page_token )
119102 topics = {}
120103 subscriptions = [Subscription .from_api_repr (resource , self ,
121104 topics = topics )
122- for resource in resp . get ( 'subscriptions' , ()) ]
123- return subscriptions , resp . get ( 'nextPageToken' )
105+ for resource in resources ]
106+ return subscriptions , next_token
124107
125108 def topic (self , name , timestamp_messages = False ):
126109 """Creates a topic bound to the current client.
0 commit comments