@@ -73,7 +73,10 @@ def __init__(self, session, object_factory):
73
73
self ._object_factory = object_factory
74
74
{% if "list" in methods % }
75
75
@generator_container
76
- def list (self , {% for qp in query_parameters - % }
76
+ def list (self , {% for up in url_parameters - % }
77
+ {{ up ['name' ] }},
78
+ {% endfor - % }
79
+ {% for qp in query_parameters - % }
77
80
{{ qp ['name' ] }}{% if qp ['optional' ] % }= None {% endif % },
78
81
{% endfor - % }
79
82
headers = {},
@@ -94,6 +97,9 @@ def list(self, {% for qp in query_parameters -%}
94
97
container.
95
98
96
99
Args:
100
+ {% for up in url_parameters -%}
101
+ {{ up['name'] }} ({{ up['type']}}): {{ up['description']}}
102
+ {% endfor -%}
97
103
{% for qp in query_parameters -%}
98
104
{{ qp['name'] }} ({{ qp['type']}}): {{ qp['description']}}
99
105
{% endfor -%}
@@ -110,6 +116,9 @@ def list(self, {% for qp in query_parameters -%}
110
116
ApiError: If the Webex Teams cloud returns an error.
111
117
112
118
"""
119
+ {% for up in url_parameters - % }
120
+ check_type ({{ up ['name' ] }}, {{ up ['type' ] }})
121
+ {% endfor - % }
113
122
{% for qp in query_parameters - % }
114
123
check_type ({{ qp ['name' ] }}, {{ qp ['type' ] }}{% if qp ['optional' ] % }, optional = True {% endif % })
115
124
{% endfor % }
@@ -126,12 +135,22 @@ def list(self, {% for qp in query_parameters -%}
126
135
params ['{{qp[' requestName ']}}' ] = params .pop ("{{ qp['name'] }}" )
127
136
{% endif % }
128
137
{% - endfor % }
138
+ {% - if url_parameters % }
139
+ {% - set ups = [] - % }
140
+ {% for up in url_parameters | map (attribute = 'name' ) - % }
141
+ {% set ups = ups .append ( up + "=" + up ) % }
142
+ {% - endfor % }
143
+ # Add URL parameters to the API endpoint
144
+ request_url = API_ENDPOINT .format ({{ ups | join (", " ) }})
145
+ {% else % }
146
+ request_url = API_ENDPOINT
147
+ {% endif % }
129
148
# API request - get items
130
149
131
150
# Update headers
132
151
for k , v in headers .items ():
133
152
self ._session .headers [k ] = v
134
- items = self ._session .get_items (API_ENDPOINT , params = params )
153
+ items = self ._session .get_items (request_url , params = params )
135
154
136
155
# Remove headers
137
156
for k , v in headers .items ():
@@ -142,14 +161,20 @@ def list(self, {% for qp in query_parameters -%}
142
161
yield self ._object_factory (OBJECT_TYPE , item )
143
162
{% endif % }
144
163
{% if "create" in methods % }
145
- def create (self , {% for cp in create_parameters - % }
146
- {{ cp ['name' ] }}{% if cp ['optional' ] % }= None {% endif % },
164
+ def create (self , {% for up in url_parameters - % }
165
+ {{ up ['name' ] }},
166
+ {% endfor - % }
167
+ {% for cp in create_parameters - % }
168
+ {{ cp ['name' ] }}{% if cp ['optional' ] % }= None {% endif % },
147
169
{% endfor - % }
148
170
149
171
** request_parameters ):
150
172
"""Create a {{ object_type }}.
151
173
152
174
Args:
175
+ {% for up in url_parameters -%}
176
+ {{ up['name'] }} ({{ up['type']}}): {{ up['description']}}
177
+ {% endfor -%}
153
178
{% for cp in create_parameters -%}
154
179
{{ cp['name'] }} ({{ cp['type']}}): {{ cp['description']}}
155
180
{% endfor -%}
@@ -165,6 +190,9 @@ def create(self, {% for cp in create_parameters -%}
165
190
ApiError: If the Webex Teams cloud returns an error.
166
191
167
192
"""
193
+ {% for up in url_parameters - % }
194
+ check_type ({{ up ['name' ] }}, {{ up ['type' ] }})
195
+ {% endfor - % }
168
196
{% for cp in create_parameters - % }
169
197
check_type ({{ cp ['name' ] }}, {{ cp ['type' ] }}{% if cp ['optional' ] % }, optional = True {% endif % })
170
198
{% endfor % }
@@ -181,18 +209,31 @@ def create(self, {% for cp in create_parameters -%}
181
209
post_data ['{{cp[' requestName ']}}' ] = post_data .pop ("{{ cp['name'] }}" )
182
210
{% endif % }
183
211
{% - endfor % }
212
+ {% - if url_parameters % }
213
+ {% - set ups = [] - % }
214
+ {% for up in url_parameters | map (attribute = 'name' ) - % }
215
+ {% set ups = ups .append ( up + "=" + up ) % }
216
+ {% - endfor % }
217
+ # Add URL parameters to the API endpoint
218
+ request_url = API_ENDPOINT .format ({{ ups | join (", " ) }})
219
+ {% else % }
220
+ request_url = API_ENDPOINT
221
+ {% endif % }
184
222
# API request
185
- json_data = self ._session .post (API_ENDPOINT , json = post_data )
223
+ json_data = self ._session .post (request_url , json = post_data )
186
224
187
225
# Return a membership object created from the response JSON data
188
226
return self ._object_factory (OBJECT_TYPE , json_data )
189
227
{% endif % }
190
228
191
229
{% if "get" in methods % }
192
- def get (self , {{ object_type }}Id ):
230
+ def get (self , {% for up in url_parameters % }{{ up [ 'name' ]}}, { % endfor % }{ { object_type }}Id ):
193
231
"""Get details for a {{ object_type }}, by ID.
194
232
195
233
Args:
234
+ {% for up in url_parameters -%}
235
+ {{up['name']}} ({{ up['type']}}): {{ up['description']}}
236
+ {% endfor -%}
196
237
{{ object_type }}Id(basestring): The {{ object_type }} ID.
197
238
198
239
Returns:
@@ -204,35 +245,64 @@ def get(self, {{ object_type }}Id):
204
245
ApiError: If the Webex Teams cloud returns an error.
205
246
206
247
"""
248
+ {% for up in url_parameters - % }
249
+ check_type ({{ up ['name' ] }}, {{ up ['type' ] }})
250
+ {% endfor - % }
207
251
check_type ({{ object_type }}Id , basestring )
208
-
252
+ {% - if url_parameters % }
253
+ {% - set ups = [] - % }
254
+ {% for up in url_parameters | map (attribute = 'name' ) - % }
255
+ {% set ups = ups .append ( up + "=" + up ) % }
256
+ {% - endfor % }
257
+
258
+ # Add URL parameters to the API endpoint
259
+ request_url = API_ENDPOINT .format ({{ ups | join (", " ) }})
260
+ {% else % }
261
+ request_url = API_ENDPOINT
262
+ {% endif % }
209
263
# API request
210
- json_data = self ._session .get (API_ENDPOINT + '/' + {{ object_type }}Id )
264
+ json_data = self ._session .get (request_url + '/' + {{ object_type }}Id )
211
265
212
266
# Return a membership object created from the response JSON data
213
267
return self ._object_factory (OBJECT_TYPE , json_data )
214
268
{% endif % }
215
269
216
270
{% if "delete" in methods % }
217
- def delete (self , {{ object_type }}Id ):
271
+ def delete (self , {% for up in url_parameters % }{{ up [ 'name' ]}}, { % endfor % }{ { object_type }}Id ):
218
272
"""Delete a {{ object_type }}, by ID.
219
273
220
274
Args:
275
+ {% for up in url_parameters -%}
276
+ {{up['name']}} ({{ up['type']}}): {{ up['description']}}
277
+ {% endfor -%}
221
278
{{ object_type }}Id(basestring): The {{ object_type }} ID.
222
279
223
280
Raises:
224
281
TypeError: If the parameter types are incorrect.
225
282
ApiError: If the Webex Teams cloud returns an error.
226
283
227
284
"""
285
+ {% for up in url_parameters - % }
286
+ check_type ({{ up ['name' ] }}, {{ up ['type' ] }})
287
+ {% endfor - % }
228
288
check_type ({{ object_type }}Id , basestring )
229
-
289
+ {% - if url_parameters % }
290
+ {% - set ups = [] - % }
291
+ {% for up in url_parameters | map (attribute = 'name' ) - % }
292
+ {% set ups = ups .append ( up + "=" + up ) % }
293
+ {% - endfor % }
294
+
295
+ # Add URL parameters to the API endpoint
296
+ request_url = API_ENDPOINT .format ({{ ups | join (", " ) }})
297
+ {% else % }
298
+ request_url = API_ENDPOINT
299
+ {% endif % }
230
300
# API request
231
- self ._session .delete (API_ENDPOINT + '/' + {{ object_type }}Id )
301
+ self ._session .delete (request_url + '/' + {{ object_type }}Id )
232
302
{% endif % }
233
303
234
304
{% if "update" in methods % }
235
- def update (self , {{ object_type }}Id ,
305
+ def update (self , {% for up in url_parameters % }{{ up [ 'name' ]}}, { % endfor % }{ { object_type }}Id ,
236
306
{% for up in update_parameters - % }
237
307
{{ up ['name' ] }}{% if up ['optional' ] % }= None {% endif % },
238
308
{% endfor - % }
@@ -241,6 +311,9 @@ def update(self, {{ object_type }}Id,
241
311
"""Update properties for a {{ object_type }}, by ID.
242
312
243
313
Args:
314
+ {% for up in url_parameters -%}
315
+ {{up['name']}} ({{ up['type']}}): {{ up['description']}}
316
+ {% endfor -%}
244
317
{{ object_type }}Id(basestring): The {{ object_type }} ID.
245
318
{% for up in update_parameters -%}
246
319
{{ up['name'] }} ({{ up['type']}}): {{ up['description']}}
@@ -258,6 +331,9 @@ def update(self, {{ object_type }}Id,
258
331
259
332
"""
260
333
check_type ({{ object_type }}Id , basestring )
334
+ {% for up in url_parameters - % }
335
+ check_type ({{ up ['name' ] }}, {{ up ['type' ] }})
336
+ {% endfor - % }
261
337
{% for up in update_parameters - % }
262
338
check_type ({{ up ['name' ] }}, {{ up ['type' ] }}{% if up ['optional' ] % }, optional = True {% endif % })
263
339
{% endfor % }
@@ -267,16 +343,24 @@ def update(self, {{ object_type }}Id,
267
343
{{ up ['name' ] }}= {{ up ['name' ] }},
268
344
{% endfor % }
269
345
)
270
-
271
346
{% for up in update_parameters - % }
272
347
{% if up ['requestName' ] % }
273
348
if {{ up ['name' ] }}:
274
349
put_data ['{{up[' requestName ']}}' ] = put_data .pop ("{{ up['name'] }}" )
275
350
{% endif % }
276
351
{% - endfor % }
277
-
352
+ {% - if url_parameters % }
353
+ {% - set ups = [] - % }
354
+ {% for up in url_parameters | map (attribute = 'name' ) - % }
355
+ {% set ups = ups .append ( up + "=" + up ) % }
356
+ {% - endfor % }
357
+ # Add URL parameters to the API endpoint
358
+ request_url = API_ENDPOINT .format ({{ ups | join (", " ) }})
359
+ {% else % }
360
+ request_url = API_ENDPOINT
361
+ {% endif % }
278
362
# API request
279
- json_data = self ._session .put (API_ENDPOINT + '/' + {{ object_type }}Id ,
363
+ json_data = self ._session .put (request_url + '/' + {{ object_type }}Id ,
280
364
json = put_data )
281
365
282
366
# Return a membership object created from the response JSON data
0 commit comments