| 219 | |
| 220 | @add_auth_token_to_kwargs_from_env |
| 221 | def get_all(self, **kwargs): |
| 222 | # TODO: This is ugly, stop abusing kwargs |
| 223 | url = "/%s" % self.resource.get_url_path_name() |
| 224 | limit = kwargs.pop("limit", None) |
| 225 | pack = kwargs.pop("pack", None) |
| 226 | prefix = kwargs.pop("prefix", None) |
| 227 | user = kwargs.pop("user", None) |
| 228 | offset = kwargs.pop("offset", 0) |
| 229 | |
| 230 | params = kwargs.pop("params", {}) |
| 231 | |
| 232 | if limit: |
| 233 | params["limit"] = limit |
| 234 | |
| 235 | if pack: |
| 236 | params["pack"] = pack |
| 237 | |
| 238 | if prefix: |
| 239 | params["prefix"] = prefix |
| 240 | |
| 241 | if user: |
| 242 | params["user"] = user |
| 243 | |
| 244 | if offset: |
| 245 | params["offset"] = offset |
| 246 | |
| 247 | response = self.client.get(url=url, params=params, **kwargs) |
| 248 | if response.status_code != http_client.OK: |
| 249 | self.handle_error(response) |
| 250 | return [ |
| 251 | self.resource.deserialize(item) for item in parse_api_response(response) |
| 252 | ] |
| 253 | |
| 254 | @add_auth_token_to_kwargs_from_env |
| 255 | def get_by_id(self, id, **kwargs): |