Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions alephclient/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ def flush_collection(self, collection_id: str, sync: bool = False):
url = self._make_url(f"collections/{collection_id}", params=params)
return self._request("DELETE", url)

def touch_collection(self, collection_id: str):
"""Update the content update date of a collection by ID"""
url = self._make_url(f"collections/{collection_id}/touch")
return self._request("POST", url)

def get_entity(self, entity_id: str, publisher: bool = False) -> Dict:
"""Get a single entity by ID."""
url = self._make_url(f"entities/{entity_id}")
Expand Down
13 changes: 13 additions & 0 deletions alephclient/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,19 @@ def flush_collection(ctx, foreign_id, sync=False):
raise click.ClickException(exc.message)


@cli.command("touch")
@click.option("-f", "--foreign-id", required=True, help="foreign_id of the collection")
@click.pass_context
def touch_collection(ctx, foreign_id):
"""Update a collection's content update date."""
api = ctx.obj["api"]
try:
collection_id = _get_id_from_foreign_key(api, foreign_id)
api.touch_collection(collection_id)
except AlephException as exc:
raise click.ClickException(exc.message)


@cli.command("write-entity")
@click.option("-i", "--infile", type=click.File("r"), default="-")
@click.option("-f", "--foreign-id", required=True, help="foreign_id of the collection")
Expand Down
3 changes: 3 additions & 0 deletions alephclient/tests/test_api_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ def test_delete_collection(self, mocker):
def test_flush_collection(self, mocker):
pass

def test_touch_collection(self, mocker):
pass

def test_get_collection_by_foreign_id(self, mocker):
pass

Expand Down