diff --git a/anytype_client/client.py b/anytype_client/client.py index 13eeb6c..4df1f42 100644 --- a/anytype_client/client.py +++ b/anytype_client/client.py @@ -369,6 +369,27 @@ def delete_space(self, space_id: str) -> bool: return True # Object methods + def list_objects(self, space_id: str,) -> Object: + """Get an object by ID. + + Args: + space_id: ID of the space containing the object. + + Returns: + Object with the specified ID. + """ + response = self.request("GET", f"spaces/{space_id}/objects") + # Handle the actual API response format with 'data' key + if isinstance(response, dict) and "data" in response and isinstance(response["data"], list): + objects = [] + for objects_data in response["data"]: + try: + objects.append(Object.model_validate(objects_data)) + except Exception: + logger.error(f"Failed to parse objects data: {space_data}") + raise + return objects + def get_object(self, space_id: str, object_id: str) -> Object: """Get an object by ID.