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 it

While 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 TrashItem

Something deleted, restorable until purge_after.

Attributes
idstr
kindstr
resource_idstr

Its id as it was, and will be again once restored.

namestr | None
user_idstr | None

The user it was deleted from (None for the account's).

trashed_atAny
purge_afterAny

When it's purged for good unless restored first.

operation_idstr | None

The deletion's operation (on the item a delete() returned): Operation.undo() on it restores it too.

from_idclassmethod

noclick.TrashItem.from_id(trash_id, *, user=..., client=None) -> TrashItem

A lazy reference to an item in the trash by its id.

Parameters
trash_idstrrequired
userAny

Who the call acts for. Defaults to the user set by noclick.as_user (none: the account itself).

(defaults to the current user)
clientClient | None

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

(default None)
Returns
TrashItem

The item; it loads the first time it's used.

Usage
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").

Parameters
kindstr | Nonedefault None
limitint | None

Return at most this many.

(default None)
userAny

Who the call acts for. Defaults to the user set by noclick.as_user (none: the account itself).

(defaults to the current user)
clientClient | None

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

(default None)
Returns
list[TrashItem]

Each item, with when it's purged unless restored first.

Usage
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
) -> Page

One page of the trash; pass next_cursor back as cursor.

Parameters
kindstr | Nonedefault None
cursorstr | None

The next_cursor of the page before; omit it for the first page.

(default None)
limitint | None

Return at most this many.

(default None)
userAny

Who the call acts for. Defaults to the user set by noclick.as_user (none: the account itself).

(defaults to the current user)
clientClient | None

The client to send with; defaults to the module client built from NOCLICK_API_KEY.

(default None)
Returns
Page

A page whose data holds the items and whose next_cursor is None on the last page.

Usage
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).

Returns
dict[str, Any]

The restored resource as its own API shows it, with restored: True.

Usage
item = noclick.Database.from_name("orders").delete()
restored = item.restore()
print(restored["name"], restored["status"])

purgeasync

trash_item.purge() -> None

Delete it for good now rather than when purge_after comes: the one deletion that can't be undone.

Usage
for item in noclick.TrashItem.list(kind="bucket"):
    item.purge()