Collections API — list, create, get, add/remove items, delete.
Summary
Functions
Adds an item to a collection. See HuggingfaceClient.add_collection_item/4.
Creates a collection. See HuggingfaceClient.create_collection/2.
Deletes a collection. See HuggingfaceClient.delete_collection/2.
Removes an item from a collection. See HuggingfaceClient.delete_collection_item/3.
Returns full collection info. See HuggingfaceClient.collection_info/2.
Returns a lazy stream of collections. See HuggingfaceClient.list_collections/1.
Updates a collection's title, description, or theme.
Updates a specific item in a collection (change note or reorder position).
Functions
@spec add_item(String.t(), String.t(), String.t(), keyword()) :: :ok | {:error, Exception.t()}
Adds an item to a collection. See HuggingfaceClient.add_collection_item/4.
@spec create( map(), keyword() ) :: {:ok, map()} | {:error, Exception.t()}
Creates a collection. See HuggingfaceClient.create_collection/2.
@spec delete( String.t(), keyword() ) :: :ok | {:error, Exception.t()}
Deletes a collection. See HuggingfaceClient.delete_collection/2.
@spec delete_item(String.t(), String.t(), keyword()) :: :ok | {:error, Exception.t()}
Removes an item from a collection. See HuggingfaceClient.delete_collection_item/3.
@spec info( String.t(), keyword() ) :: {:ok, map()} | {:error, Exception.t()}
Returns full collection info. See HuggingfaceClient.collection_info/2.
@spec list(keyword()) :: Enumerable.t()
Returns a lazy stream of collections. See HuggingfaceClient.list_collections/1.
@spec update( String.t(), keyword() ) :: {:ok, map()} | {:error, Exception.t()}
Updates a collection's title, description, or theme.
Options
:title— new title:description— new description:private— visibility:theme— collection theme string:access_token
Example
{:ok, updated} = HuggingfaceClient.update_collection("my-user/my-collection-slug",
title: "New Title",
description: "Updated description",
access_token: "hf_..."
)
@spec update_item( String.t(), keyword() ) :: {:ok, map()} | {:error, Exception.t()}
Updates a specific item in a collection (change note or reorder position).
Options
:item_object_id— the item's object ID within the collection (required):note— updated note text for the item:position— new position index for the item:access_token