[docs]@set_service_action_metadata(endpoint=FolderRetrieveEndpoint)deflist(self,*,limit:Optional[int]=None,offset:Optional[int]=None)->FolderRetrieveResponse:""" List existing folders. Raises: ApiResponseException: In case of an API error. ApiNetworkException: In case of unhandled network error. """request_params=_FolderRetrieveParametersQuery(limit=limit,offset=offset).model_dump()self._log_method_execution("Folder List",**request_params)withself._get_http_client()asclient:metadata=get_service_action_metadata(self.list)http_response=client.get(url=self._get_endpoint(metadata.endpoint),params=request_params)returnFolderRetrieveResponse(**http_response.json())
[docs]@set_service_action_metadata(endpoint=FolderCreateEndpoint)defcreate(self,name:str)->FolderCreateResponse:""" Args: name: The name of the folder to be created. Raises: ApiResponseException: In case of a known API error. ApiNetworkException: In case of unhandled network error. """request_body=_FolderCreateRequest(name=name).model_dump()self._log_method_execution("Folder Create",**request_body)withself._get_http_client()asclient:metadata=get_service_action_metadata(self.create)response=client.post(url=self._get_endpoint(metadata.endpoint),params=_FolderCreateParametersQuery().model_dump(),json=request_body,)returnFolderCreateResponse(**response.json())
[docs]@set_service_action_metadata(endpoint=FolderIdRetrieveEndpoint)defretrieve(self,id:str,)->FolderIdRetrieveResponse:""" Args: id: The ID of the folder to retrieve. Raises: ValueError: If the provided ID is an empty string. ApiResponseException: In case of a known API error. ApiNetworkException: In case of unhandled network error. """assert_is_not_empty_string(id)self._log_method_execution("Folder Retrieve",id=id)withself._get_http_client()asclient:metadata=get_service_action_metadata(self.retrieve)response=client.get(url=self._get_endpoint(metadata.endpoint,id=id),params=_FolderIdRetrieveParametersQuery().model_dump(),)returnFolderIdRetrieveResponse(**response.json())
[docs]@set_service_action_metadata(endpoint=FolderIdDeleteEndpoint)defdelete(self,id:str)->None:""" Deletes a folder with the given ID. Args: id: The ID of the folder to be deleted. Raises: ValueError: If the ID is an empty string. ApiResponseException: In case of a known API error (ex: file does not exist). ApiNetworkException: In case of unhandled network error. """assert_is_not_empty_string(id)self._log_method_execution("Folder Delete",id=id)withself._get_http_client()asclient:metadata=get_service_action_metadata(self.delete)client.delete(url=self._get_endpoint(metadata.endpoint,id=id),params=_FolderIdDeleteParametersQuery().model_dump(),)