[−][src]Function hdk::get_links
pub fn get_links<S: Into<String>>(
base: &HashString,
tag: S
) -> ZomeApiResult<GetLinksResult>
Consumes two values, the first of which is the address of an entry, base
, and the second of which is a string, tag
,
used to describe the relationship between the base
and other entries you wish to lookup. Returns a list of addresses of other
entries which matched as being linked by the given tag
. Links are created in the first place using the Zome API function link_entries.
Once you have the addresses, there is a good likelihood that you will wish to call get_entry for each of them.
Examples
pub fn handle_posts_by_agent(agent: HashString) -> serde_json::Value { match hdk::get_links(&agent, "authored_posts") { Ok(result) => json!({"post_addresses": result.links}), Err(hdk_error) => hdk_error.to_json(), } }