TrashItem
The trash: what was deleted and can still be put back.
Deleting an app, database, bucket, dict, queue, repo, volume, inbox or agent
moves it here, restorable for 30 days, then purged for good. delete() on each of
them returns its TrashItem:
item = noclick.Dict.from_name("rates-cache").delete()
item.restore() # back under its name, every key with itWhile it's in the trash its name is free and its storage is billed as before;
restoring is free. purge() deletes it for good now: the one deletion that
can't be undone, so through MCP it waits for a person.
class TrashItemSomething deleted, restorable until purge_after.
- Like every live object, it also has hydrate(), refresh() and raw.
| id | str | |
| kind | str | |
| resource_id | str | Its id as it was, and will be again once restored. |
| name | str | None | |
| user_id | str | None | The user it was deleted from (None for the account's). |
| trashed_at | Any | |
| purge_after | Any | When it's purged for good unless restored first. |
| operation_id | str | None | The deletion's operation (on the item a |
from_idclassmethod
noclick.TrashItem.from_id(trash_id, *, user=..., client=None) -> TrashItemA lazy reference to an item in the trash by its id.
Who the call acts for. Defaults to the user set by noclick.as_user (none: the account itself).
The client to send with; defaults to the module client built from NOCLICK_API_KEY.
None)The item; it loads the first time it's used.
item = noclick.TrashItem.from_id("4b1e2c7d-0a9f-4e6b-8c3d-5f2a1b7e9d60")
print(item.kind, item.name, item.purge_after)listclassmethodasync
noclick.TrashItem.list(
*, kind=None, limit=None, user=..., client=None
) -> list[TrashItem]What's in the trash, newest first: every kind, or one (kind="dict").
NoneReturn at most this many.
None)Who the call acts for. Defaults to the user set by noclick.as_user (none: the account itself).
The client to send with; defaults to the module client built from NOCLICK_API_KEY.
None)Each item, with when it's purged unless restored first.
for item in noclick.TrashItem.list(kind="database"):
print(item.name, item.trashed_at, item.purge_after)list_pageclassmethodasync
noclick.TrashItem.list_page(
*, kind=None, cursor=None, limit=None, user=..., client=None
) -> PageOne page of the trash; pass next_cursor back as cursor.
NoneThe next_cursor of the page before; omit it for the first page.
None)Return at most this many.
None)Who the call acts for. Defaults to the user set by noclick.as_user (none: the account itself).
The client to send with; defaults to the module client built from NOCLICK_API_KEY.
None)A page whose data holds the items and whose next_cursor is None on the last page.
page = noclick.TrashItem.list_page(limit=20)
print([item.name for item in page.data])restoreasync
trash_item.restore() -> dict[str, Any]Put it back where it was, under its name, with everything in it. Refused with noclick.Conflict
when something new has taken its name since (rename or delete that first).
The restored resource as its own API shows it, with restored: True.
item = noclick.Database.from_name("orders").delete()
restored = item.restore()
print(restored["name"], restored["status"])purgeasync
trash_item.purge() -> NoneDelete it for good now rather than when purge_after comes: the one deletion that can't be undone.
for item in noclick.TrashItem.list(kind="bucket"):
item.purge()