Interface CollectionsAPI

interface CollectionsAPI {
    addCollectionItem: (
        collectionId: string,
        body: CollectionsAddCollectionItemRequestBody,
        options?: ApiCallOptions,
    ) => Promise<AddCollectionItemHttpResponse>;
    clearCache: () => void;
    createCollection: (
        body: CollectionsCreateCollectionRequestBody,
        options?: ApiCallOptions,
    ) => Promise<CreateCollectionHttpResponse>;
    deleteCollection: (
        collectionId: string,
        options?: ApiCallOptions,
    ) => Promise<DeleteCollectionHttpResponse>;
    deleteCollectionItem: (
        collectionId: string,
        itemId: string,
        options?: ApiCallOptions,
    ) => Promise<DeleteCollectionItemHttpResponse>;
    getCollection: (
        collectionId: string,
        options?: ApiCallOptions,
    ) => Promise<GetCollectionHttpResponse>;
    getCollectionItem: (
        collectionId: string,
        itemId: string,
        options?: ApiCallOptions,
    ) => Promise<GetCollectionItemHttpResponse>;
    getCollectionItems: (
        collectionId: string,
        query: {
            limit?: number;
            name?: string;
            next?: string;
            noActions?: boolean;
            prev?: string;
            query?: string;
            resourceId?: string;
            resourceLink?: string;
            resourceType?: ItemResourceTypeEnum;
            shared?: boolean;
            sort?:
                | "-name"
                | "+name"
                | "+createdAt"
                | "-createdAt"
                | "+updatedAt"
                | "-updatedAt";
            spaceId?: string;
        },
        options?: ApiCallOptions,
    ) => Promise<GetCollectionItemsHttpResponse>;
    getCollections: (
        query: {
            creatorId?: string;
            id?: string;
            includeItems?: string;
            limit?: number;
            name?: string;
            next?: string;
            prev?: string;
            query?: string;
            sort?:
                | "-name"
                | "+name"
                | "+createdAt"
                | "-createdAt"
                | "+updatedAt"
                | "-updatedAt";
            type?: CollectionTypes;
            types?: CollectionTypes[];
        },
        options?: ApiCallOptions,
    ) => Promise<GetCollectionsHttpResponse>;
    getFavoritesCollection: (
        options?: ApiCallOptions,
    ) => Promise<GetFavoritesCollectionHttpResponse>;
    patchCollection: (
        collectionId: string,
        body: CollectionByIdPatch,
        options?: ApiCallOptions,
    ) => Promise<PatchCollectionHttpResponse>;
    updateCollection: (
        collectionId: string,
        body: CollectionsUpdateCollectionRequestBody,
        options?: ApiCallOptions,
    ) => Promise<UpdateCollectionHttpResponse>;
}
Index

Properties

addCollectionItem: (
    collectionId: string,
    body: CollectionsAddCollectionItemRequestBody,
    options?: ApiCallOptions,
) => Promise<AddCollectionItemHttpResponse>

Adds an item to a collection and returns the item.

Type declaration

The collection's unique identifier.

an object with the body content

AddCollectionItemHttpError

clearCache: () => void

Clears the cache for collections api requests.

Type declaration

    • (): void
    • Clears the cache for collections api requests.

      Returns void

createCollection: (
    body: CollectionsCreateCollectionRequestBody,
    options?: ApiCallOptions,
) => Promise<CreateCollectionHttpResponse>

Creates and returns a new collection. Collections of type public (shown as tags in the user interface) must have unique names. Other collection types can reuse names.

Type declaration

an object with the body content

CreateCollectionHttpError

deleteCollection: (
    collectionId: string,
    options?: ApiCallOptions,
) => Promise<DeleteCollectionHttpResponse>

Deletes a collection and removes all items from the collection.

Type declaration

The collection's unique identifier.

DeleteCollectionHttpError

deleteCollectionItem: (
    collectionId: string,
    itemId: string,
    options?: ApiCallOptions,
) => Promise<DeleteCollectionItemHttpResponse>

Removes an item from a collection.

Type declaration

The collection's unique identifier.

The item's unique identifier.

DeleteCollectionItemHttpError

getCollection: (
    collectionId: string,
    options?: ApiCallOptions,
) => Promise<GetCollectionHttpResponse>

Finds and returns a collection.

Type declaration

The collection's unique identifier.

GetCollectionHttpError

getCollectionItem: (
    collectionId: string,
    itemId: string,
    options?: ApiCallOptions,
) => Promise<GetCollectionItemHttpResponse>

Finds and returns an item in a specific collection. See GET /items/{id}.

Type declaration

The collection's unique identifier.

The item's unique identifier.

GetCollectionItemHttpError

getCollectionItems: (
    collectionId: string,
    query: {
        limit?: number;
        name?: string;
        next?: string;
        noActions?: boolean;
        prev?: string;
        query?: string;
        resourceId?: string;
        resourceLink?: string;
        resourceType?: ItemResourceTypeEnum;
        shared?: boolean;
        sort?:
            | "-name"
            | "+name"
            | "+createdAt"
            | "-createdAt"
            | "+updatedAt"
            | "-updatedAt";
        spaceId?: string;
    },
    options?: ApiCallOptions,
) => Promise<GetCollectionItemsHttpResponse>

Retrieves items from a collection that the user has access to.

Type declaration

    • (
          collectionId: string,
          query: {
              limit?: number;
              name?: string;
              next?: string;
              noActions?: boolean;
              prev?: string;
              query?: string;
              resourceId?: string;
              resourceLink?: string;
              resourceType?: ItemResourceTypeEnum;
              shared?: boolean;
              sort?:
                  | "-name"
                  | "+name"
                  | "+createdAt"
                  | "-createdAt"
                  | "+updatedAt"
                  | "-updatedAt";
              spaceId?: string;
          },
          options?: ApiCallOptions,
      ): Promise<GetCollectionItemsHttpResponse>
    • Retrieves items from a collection that the user has access to.

      Parameters

      • collectionId: string

        The collection's unique identifier. (This query also supports 'favorites' as the collectionID).

      • query: {
            limit?: number;
            name?: string;
            next?: string;
            noActions?: boolean;
            prev?: string;
            query?: string;
            resourceId?: string;
            resourceLink?: string;
            resourceType?: ItemResourceTypeEnum;
            shared?: boolean;
            sort?:
                | "-name"
                | "+name"
                | "+createdAt"
                | "-createdAt"
                | "+updatedAt"
                | "-updatedAt";
            spaceId?: string;
        }

        an object with query parameters

        • Optionallimit?: number

          The maximum number of resources to return for a request. The limit must be an integer between 1 and 100 (inclusive).

        • Optionalname?: string

          The case-insensitive string used to search for a resource by name.

        • Optionalnext?: string

          The cursor to the next page of resources. Provide either the next or prev cursor, but not both.

        • OptionalnoActions?: boolean

          If set to true, the user's available actions for each item will not be evaluated meaning the actions-array will be omitted from the response (reduces response time).

        • Optionalprev?: string

          The cursor to the previous page of resources. Provide either the next or prev cursor, but not both.

        • Optionalquery?: string

          The case-insensitive string used to search for a resource by name or description.

        • OptionalresourceId?: string

          The case-sensitive string used to search for an item by resourceId. If resourceId is provided, then resourceType must be provided. Provide either the resourceId or resourceLink, but not both.

        • OptionalresourceLink?: string

          The case-sensitive string used to search for an item by resourceLink. If resourceLink is provided, then resourceType must be provided. Provide either the resourceId or resourceLink, but not both.

        • OptionalresourceType?: ItemResourceTypeEnum

          The case-sensitive string used to search for an item by resourceType.

        • Optionalshared?: boolean

          Whether or not to return items in a shared space.

        • Optionalsort?: "-name" | "+name" | "+createdAt" | "-createdAt" | "+updatedAt" | "-updatedAt"

          The property of a resource to sort on (default sort is +createdAt). The supported properties are createdAt, updatedAt, and name. A property must be prefixed by + or - to indicate ascending or descending sort order respectively.

        • OptionalspaceId?: string

          The space's unique identifier (supports 'personal' as spaceId).

      • Optionaloptions: ApiCallOptions

      Returns Promise<GetCollectionItemsHttpResponse>

      GetCollectionItemsHttpError

The collection's unique identifier. (This query also supports 'favorites' as the collectionID). *

an object with query parameters

GetCollectionItemsHttpError

getCollections: (
    query: {
        creatorId?: string;
        id?: string;
        includeItems?: string;
        limit?: number;
        name?: string;
        next?: string;
        prev?: string;
        query?: string;
        sort?:
            | "-name"
            | "+name"
            | "+createdAt"
            | "-createdAt"
            | "+updatedAt"
            | "-updatedAt";
        type?: CollectionTypes;
        types?: CollectionTypes[];
    },
    options?: ApiCallOptions,
) => Promise<GetCollectionsHttpResponse>

Retrieves the collections that the user has access to. This endpoint does not return the user's favorites collection, which can be retrieved with /v1/collections/favorites.

Type declaration

    • (
          query: {
              creatorId?: string;
              id?: string;
              includeItems?: string;
              limit?: number;
              name?: string;
              next?: string;
              prev?: string;
              query?: string;
              sort?:
                  | "-name"
                  | "+name"
                  | "+createdAt"
                  | "-createdAt"
                  | "+updatedAt"
                  | "-updatedAt";
              type?: CollectionTypes;
              types?: CollectionTypes[];
          },
          options?: ApiCallOptions,
      ): Promise<GetCollectionsHttpResponse>
    • Retrieves the collections that the user has access to. This endpoint does not return the user's favorites collection, which can be retrieved with /v1/collections/favorites.

      Parameters

      • query: {
            creatorId?: string;
            id?: string;
            includeItems?: string;
            limit?: number;
            name?: string;
            next?: string;
            prev?: string;
            query?: string;
            sort?:
                | "-name"
                | "+name"
                | "+createdAt"
                | "-createdAt"
                | "+updatedAt"
                | "-updatedAt";
            type?: CollectionTypes;
            types?: CollectionTypes[];
        }

        an object with query parameters

        • OptionalcreatorId?: string

          The case-sensitive string used to search for a resource by creatorId.

        • Optionalid?: string

          The collection's unique identifier.

        • OptionalincludeItems?: string

          Includes the list of items belonging to the collections. Supported parameters are 'limit', 'sort' and 'resourceType'. Supported formats are json formatted string or deep object style using square brackets.

        • Optionallimit?: number

          The maximum number of resources to return for a request. The limit must be an integer between 1 and 100 (inclusive).

        • Optionalname?: string

          The case-sensitive string used to search for a collection by name.

        • Optionalnext?: string

          The cursor to the next page of resources. Provide either the next or prev cursor, but not both.

        • Optionalprev?: string

          The cursor to the previous page of resources. Provide either the next or prev cursor, but not both.

        • Optionalquery?: string

          The case-insensitive string used to search for a resource by name or description.

        • Optionalsort?: "-name" | "+name" | "+createdAt" | "-createdAt" | "+updatedAt" | "-updatedAt"

          The property of a resource to sort on (default sort is +createdAt). The supported properties are createdAt, updatedAt, and name. A property must be prefixed by + or - to indicate ascending or descending sort order respectively.

        • Optionaltype?: CollectionTypes

          The case-sensitive string used to filter for a collection by type. Retrieve private collections with private, public collections with publicgoverned, and tags with public.

        • Optionaltypes?: CollectionTypes[]

          A comma-separated case-sensitive string used to filter by multiple types.

      • Optionaloptions: ApiCallOptions

      Returns Promise<GetCollectionsHttpResponse>

      GetCollectionsHttpError

an object with query parameters

GetCollectionsHttpError

getFavoritesCollection: (
    options?: ApiCallOptions,
) => Promise<GetFavoritesCollectionHttpResponse>

Lists the user's favorites collection.

Type declaration

GetFavoritesCollectionHttpError

patchCollection: (
    collectionId: string,
    body: CollectionByIdPatch,
    options?: ApiCallOptions,
) => Promise<PatchCollectionHttpResponse>

Updates the name, description, or type fields provided in the patch body. Can be used to publish a private collection as a publicgoverned collection by patching /type with publicgoverned once the collection contains at least 1 item. Can also be used to return a publicgoverned collection to private. Cannot be used to change between public (tag) and private / publicgoverned (collection).

Type declaration

    • (
          collectionId: string,
          body: CollectionByIdPatch,
          options?: ApiCallOptions,
      ): Promise<PatchCollectionHttpResponse>
    • Updates the name, description, or type fields provided in the patch body. Can be used to publish a private collection as a publicgoverned collection by patching /type with publicgoverned once the collection contains at least 1 item. Can also be used to return a publicgoverned collection to private. Cannot be used to change between public (tag) and private / publicgoverned (collection).

      Parameters

      Returns Promise<PatchCollectionHttpResponse>

      PatchCollectionHttpError

The collection's unique identifier.

an object with the body content

PatchCollectionHttpError

updateCollection: (
    collectionId: string,
    body: CollectionsUpdateCollectionRequestBody,
    options?: ApiCallOptions,
) => Promise<UpdateCollectionHttpResponse>

Updates a collection's name and description and returns the updated collection. Omitted and unsupported fields are ignored. To unset a field, provide the field's zero value.

Type declaration

The collection's unique identifier.

an object with the body content

UpdateCollectionHttpError