From ca167b6c1eed8315045891bf5c2a6812095ac478 Mon Sep 17 00:00:00 2001 From: DaevMithran Date: Wed, 4 Sep 2024 14:58:00 +0530 Subject: [PATCH] Add cheqd resolveResource tutorial Signed-off-by: DaevMithran --- guides/tutorials/cheqd/index.md | 24 ++++++++++++++++++++++++ snippets/current/src/set-up-cheqd.ts | 12 ++++++++++++ 2 files changed, 36 insertions(+) diff --git a/guides/tutorials/cheqd/index.md b/guides/tutorials/cheqd/index.md index ebf7788..29d09c7 100644 --- a/guides/tutorials/cheqd/index.md +++ b/guides/tutorials/cheqd/index.md @@ -93,6 +93,30 @@ Using the createResource cheqd api agents are able to create custom DID-Linked R ``` +### Resolve Resource + +The resolveResource function in the cheqd API allows agents to resolve DID-Linked Resources in two ways: + +- By `resourceId` +- By `resourceName` and `resourceType` + +Additionally, two query parameters are supported for both conventions: + +- resourceUrl?version= +- resourceUrl?resourceVersionTime= + +#### Using `resourceId` + +```typescript showLineNumbers set-up-cheqd.ts section-7 + +``` + +#### Using `resourceName` and `resourceType` + +```typescript showLineNumbers set-up-cheqd.ts section-8 + +``` + ### Types --- diff --git a/snippets/current/src/set-up-cheqd.ts b/snippets/current/src/set-up-cheqd.ts index f9b00d7..425f904 100644 --- a/snippets/current/src/set-up-cheqd.ts +++ b/snippets/current/src/set-up-cheqd.ts @@ -173,3 +173,15 @@ await agent.modules.cheqd.createResource('did:cheqd:testnet:92874297-d824-40ea-8 }, }) // end-section-6 + +// start-section-7 +await agent.modules.cheqd.resolveResource( + 'did:cheqd:testnet:92874297-d824-40ea-8ae5-364a1ec9237d/resource/6de33634-6439-4e46-aa3f-bfe03606b000' +) +// end-section-7 + +// start-section-8 +await agent.modules.cheqd.resolveResource( + 'did:cheqd:testnet:92874297-d824-40ea-8ae5-364a1ec9237d/resource?resourceName=resourceName&resourceType=resourceType' +) +// end-section-8