Item class

Used to perform operations on a specific item.

See Items for operations on all items; see container.items.

Properties

container
id
url

Returns a reference URL to the resource. Used for linking in Permissions.

Methods

delete<T>(RequestOptions)

Delete the item.

Any provided type, T, is not necessarily enforced by the SDK. You may get more or less properties and it's up to your logic to enforce it.

patch<T>(PatchRequestBody, RequestOptions)

Perform a JSONPatch on the item.

Any provided type, T, is not necessarily enforced by the SDK. You may get more or less properties and it's up to your logic to enforce it.

read<T>(RequestOptions)

Read the item's definition.

Any provided type, T, is not necessarily enforced by the SDK. You may get more or less properties and it's up to your logic to enforce it. If the type, T, is a class, it won't pass typeof comparisons, because it won't have a match prototype. It's recommended to only use interfaces.

There is no set schema for JSON items. They may contain any number of custom properties.

Example

Using custom type for response

interface TodoItem {
  title: string;
  done: bool;
  id: string;
}

let item: TodoItem;
({body: item} = await item.read<TodoItem>());
replace(ItemDefinition, RequestOptions)

Replace the item's definition.

There is no set schema for JSON items. They may contain any number of custom properties.

replace<T>(T, RequestOptions)

Replace the item's definition.

Any provided type, T, is not necessarily enforced by the SDK. You may get more or less properties and it's up to your logic to enforce it.

There is no set schema for JSON items. They may contain any number of custom properties.

Property Details

container

container: Container

Property Value

id

id: string

Property Value

string

url

Returns a reference URL to the resource. Used for linking in Permissions.

string url

Property Value

string

Method Details

delete<T>(RequestOptions)

Delete the item.

Any provided type, T, is not necessarily enforced by the SDK. You may get more or less properties and it's up to your logic to enforce it.

function delete<T>(options?: RequestOptions): Promise<ItemResponse<T>>

Parameters

options
RequestOptions

Additional options for the request

Returns

Promise<ItemResponse<T>>

patch<T>(PatchRequestBody, RequestOptions)

Perform a JSONPatch on the item.

Any provided type, T, is not necessarily enforced by the SDK. You may get more or less properties and it's up to your logic to enforce it.

function patch<T>(body: PatchRequestBody, options?: RequestOptions): Promise<ItemResponse<T>>

Parameters

options
RequestOptions

Additional options for the request

Returns

Promise<ItemResponse<T>>

read<T>(RequestOptions)

Read the item's definition.

Any provided type, T, is not necessarily enforced by the SDK. You may get more or less properties and it's up to your logic to enforce it. If the type, T, is a class, it won't pass typeof comparisons, because it won't have a match prototype. It's recommended to only use interfaces.

There is no set schema for JSON items. They may contain any number of custom properties.

Example

Using custom type for response

interface TodoItem {
  title: string;
  done: bool;
  id: string;
}

let item: TodoItem;
({body: item} = await item.read<TodoItem>());
function read<T>(options?: RequestOptions): Promise<ItemResponse<T>>

Parameters

options
RequestOptions

Additional options for the request

Returns

Promise<ItemResponse<T>>

replace(ItemDefinition, RequestOptions)

Replace the item's definition.

There is no set schema for JSON items. They may contain any number of custom properties.

function replace(body: ItemDefinition, options?: RequestOptions): Promise<ItemResponse<ItemDefinition>>

Parameters

body
ItemDefinition

The definition to replace the existing Item's definition with.

options
RequestOptions

Additional options for the request

Returns

replace<T>(T, RequestOptions)

Replace the item's definition.

Any provided type, T, is not necessarily enforced by the SDK. You may get more or less properties and it's up to your logic to enforce it.

There is no set schema for JSON items. They may contain any number of custom properties.

function replace<T>(body: T, options?: RequestOptions): Promise<ItemResponse<T>>

Parameters

body

T

The definition to replace the existing Item's definition with.

options
RequestOptions

Additional options for the request

Returns

Promise<ItemResponse<T>>