MCPcopy Create free account
hub / github.com/dfinity/orbit / list_assets

Method list_assets

core/station/impl/src/controllers/asset.rs:57–77  ·  view source on GitHub ↗
(&self, input: ListAssetsInput)

Source from the content-addressed store, hash-verified

55
56 #[with_middleware(guard = authorize(&call_context(), &[Resource::Asset(ResourceAction::List)]))]
57 async fn list_assets(&self, input: ListAssetsInput) -> ApiResult<ListAssetsResponse> {
58 let ctx = call_context();
59 let result = self.asset_service.list(input, Some(&ctx))?;
60 let mut privileges = Vec::new();
61
62 for asset in &result.items {
63 let asset_privileges = self
64 .asset_service
65 .get_caller_privileges_for_asset(&asset.id, &ctx)
66 .await?;
67
68 privileges.push(AssetCallerPrivilegesDTO::from(asset_privileges));
69 }
70
71 Ok(ListAssetsResponse {
72 assets: result.items.into_iter().map(Into::into).collect(),
73 next_offset: result.next_offset,
74 total: result.total,
75 privileges,
76 })
77 }
78}

Callers 3

list_assetsFunction · 0.80
listAssetsMethod · 0.80
listAssetsFunction · 0.80

Calls 4

mapMethod · 0.80
call_contextFunction · 0.50
listMethod · 0.45

Tested by

no test coverage detected