diff --git a/index.html b/index.html
index 0029b46..a11dd4a 100644
--- a/index.html
+++ b/index.html
@@ -8,122 +8,13 @@
/>
use hdk::prelude::*;
+ >
+use hdk::prelude::*;
#[hdk_extern]
fn query_my_full_chain(_: ()) -> ExternResult<Vec<Record>> {
let filter = ChainQueryFilter::new(); // We'll see more options
- let my_full_chain: Vec<Record> = query(filter)?;Does not do any network call Records are returned in ascendent order (from oldest to newest) // No network calls
+ let my_full_chain: Vec<Record> = query(filter)?; // - Does not do any network call
+ // - Records are returned in ascendent
+ // order (from oldest to newest)
Ok(my_full_chain)
}
@@ -166,17 +62,19 @@ HDK: retrieving source chains
query() (II)
-
+
use hdk::prelude::*;
+ >
+use hdk::prelude::*;
#[hdk_entry_helper]
struct Comment {
comment: String
}
-
#[hdk_entry_defs]
#[unit_enum(UnitEntryTypes)]
enum EntryTypes {
@@ -185,21 +83,20 @@ query() (II)
#[hdk_extern]
fn query_my_comments(_: ()) -> ExternResult<Vec<Record>> {
- let comment_entry_type: EntryType = UnitEntryTypes::Comment.try_into()?;Generated with "#[unit_enum(UnitEntryTypes)]"
-
- let filter = ChainQueryFilter::new().entry_type(comment_entry_type); // Filter by the given entry type
-
+ let comment_entry_type: EntryType = UnitEntryTypes::Comment.try_into()?; // Generated with
+ // "#[unit_enum()]"
+ let filter = ChainQueryFilter::new().entry_type(comment_entry_type); // Filter by the
+ // given entrytype
let all_my_comments = query(filter)?; // Only the records which create or update comments
-
Ok(all_my_comments)
}
#[hdk_extern]
fn query_all_links_i_created(_: ()) -> ExternResult<Vec<Record>> {
- let filter = ChainQueryFilter::new().action_type(ActionType::CreateLinkMay be any kind of action);
-
- let all_links_i_created = query(filter)?; // Only the records whose action is of type "CreateLink"
-
+ let filter = ChainQueryFilter::new().action_type(ActionType::CreateLink); // May be any kind
+ // of action
+ let all_links_i_created = query(filter)?; // Only the records whose action
+ // is of the "CreateLink" variant
Ok(all_links_i_created)
}
@@ -217,19 +114,24 @@ query() (II)
-
+
use hdk::prelude::*;
+ >
+use hdk::prelude::*;
#[hdk_extern]
fn get_comments_created_by(author: AgentPubKey) -> ExternResult<Vec<ActionHash>> {
let filter = ChainQueryFilter::new(); // Same options as "query"
let agent_activity = get_agent_activity(
- author,
+ author,
filter,
- ActivityRequest::Full
+ ActivityRequest::Full // - "ActivityRequest" can be:
+ // - "Full": request the list of action hashes for the full chain
+ // - "Status": request only the status of the chain
)?;
}
@@ -244,23 +146,10 @@ That's it!