Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Item

Used to perform operations on a specific item.

see

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

Hierarchy

  • Item

Index

Properties

Accessors

Methods

Properties

container

container: Container

The parent Container.

id

id: string

The id of the given Item.

Accessors

url

  • get url(): string
  • Returns a reference URL to the resource. Used for linking in Permissions.

    Returns string

Methods

delete

  • 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.

    Type parameters

    Parameters

    • Default value options: RequestOptions = {}

      Additional options for the request, such as the partition key.

    Returns Promise<ItemResponse<T>>

read

  • 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>());

    Type parameters

    Parameters

    • Default value options: RequestOptions = {}

      Additional options for the request, such as the partition key. Note, if you provide a partition key on the options object, it will override the primary key on this.partitionKey.

    Returns Promise<ItemResponse<T>>

replace

  • Replace the item's definition.

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

    Parameters

    • body: ItemDefinition

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

    • Optional options: RequestOptions

      Additional options for the request, such as the partition key.

    Returns Promise<ItemResponse<ItemDefinition>>

  • 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.

    Type parameters

    Parameters

    • body: T

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

    • Optional options: RequestOptions

      Additional options for the request, such as the partition key.

    Returns Promise<ItemResponse<T>>

Generated using TypeDoc