junobuild_satellite

Function get_asset_store

Source
pub fn get_asset_store(
    caller: Principal,
    collection: &CollectionKey,
    full_path: FullPath,
) -> Result<Option<Asset>, String>
Expand description

Get an asset from a collection’s store.

This function retrieves an asset from a collection’s store based on the specified parameters. It returns a Result<Option<Asset>, String> where Ok(Some(Asset)) indicates a successfully retrieved asset, Ok(None) represents no asset found for the specified path, or an error message as Err(String) if retrieval encounters issues.

§Parameters

  • caller: The Principal representing the caller requesting the asset.
  • collection: A reference to the CollectionKey representing the collection from which to retrieve the asset.
  • full_path: A FullPath identifying the asset to be retrieved.

§Returns

  • Ok(Some(Asset)): Indicates successful retrieval of the asset.
  • Ok(None): Indicates no asset found for the specified path.
  • Err(String): An error message if the retrieval operation fails.

This function allows you to securely retrieve an asset from a Juno collection’s store.