async def get_feature(self, featureId): """ Args: feature_id {str} Returns: Feature """ http_method = "get".upper() api_url = format_url(f""" {self._base_url} /api/v1/features/{featureId} """) body = {} headers = {} request, error = await self._request_executor.create_request( http_method, api_url, body, headers) if error: return (None, None, error) response, error = await self._request_executor\ .execute(request, Feature) if error: return (None, response, error) try: result = Feature(self.form_response_body(response.get_body())) except Exception as error: return (None, response, error) return (result, response, None)
async def list_features(self): """ Args: Returns: list: Collection of Feature instances. """ http_method = "get".upper() api_url = format_url(f""" {self._base_url} /api/v1/features """) body = {} headers = {} request, error = await self._request_executor.create_request( http_method, api_url, body, headers) if error: return (None, None, error) response, error = await self._request_executor\ .execute(request, Feature) if error: return (None, response, error) try: result = [] for item in response.get_body(): result.append(Feature(self.form_response_body(item))) except Exception as error: return (None, response, error) return (result, response, None)
async def update_feature_lifecycle(self, featureId, lifecycle, query_params={}, keep_empty_params=False): """ Args: feature_id {str} lifecycle {str} query_params {dict}: Map of query parameters for request [query_params.mode] {str} Returns: Feature """ http_method = "post".upper() api_url = format_url(f""" {self._base_url} /api/v1/features/{featureId}/{lifecycle} """) if query_params: encoded_query_params = urlencode(query_params) api_url += f"/?{encoded_query_params}" body = {} headers = {} form = {} request, error = await self._request_executor.create_request( http_method, api_url, body, headers, form, keep_empty_params=keep_empty_params) if error: return (None, None, error) response, error = await self._request_executor\ .execute(request, Feature) if error: return (None, response, error) try: result = Feature(self.form_response_body(response.get_body())) except Exception as error: return (None, response, error) return (result, response, None)
async def list_feature_dependents(self, featureId, keep_empty_params=False): """ Args: feature_id {str} Returns: list: Collection of Feature instances. """ http_method = "get".upper() api_url = format_url(f""" {self._base_url} /api/v1/features/{featureId}/dependents """) body = {} headers = {} form = {} request, error = await self._request_executor.create_request( http_method, api_url, body, headers, form, keep_empty_params=keep_empty_params) if error: return (None, None, error) response, error = await self._request_executor\ .execute(request, Feature) if error: return (None, response, error) try: result = [] for item in response.get_body(): result.append(Feature(self.form_response_body(item))) except Exception as error: return (None, response, error) return (result, response, None)