Skip to content

Commit

Permalink
Add cheqd resolveResource tutorial
Browse files Browse the repository at this point in the history
Signed-off-by: DaevMithran <[email protected]>
  • Loading branch information
DaevMithran committed Sep 4, 2024
1 parent d5701fe commit ca167b6
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
24 changes: 24 additions & 0 deletions guides/tutorials/cheqd/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=<versionId>
- resourceUrl?resourceVersionTime=<epoch time>

#### Using `resourceId`

```typescript showLineNumbers set-up-cheqd.ts section-7

```

#### Using `resourceName` and `resourceType`

```typescript showLineNumbers set-up-cheqd.ts section-8

```

### Types

---
Expand Down
12 changes: 12 additions & 0 deletions snippets/current/src/set-up-cheqd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(

Check failure on line 178 in snippets/current/src/set-up-cheqd.ts

View workflow job for this annotation

GitHub Actions / Check format, types and build

Property 'cheqd' does not exist on type 'AgentApi<WithoutDefaultModules<{ dids: DidsModule; anoncreds: AnonCredsModule; cheqd: CheqdModule; askar: AskarModule; }>>'.
'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(

Check failure on line 184 in snippets/current/src/set-up-cheqd.ts

View workflow job for this annotation

GitHub Actions / Check format, types and build

Property 'cheqd' does not exist on type 'AgentApi<WithoutDefaultModules<{ dids: DidsModule; anoncreds: AnonCredsModule; cheqd: CheqdModule; askar: AskarModule; }>>'.
'did:cheqd:testnet:92874297-d824-40ea-8ae5-364a1ec9237d/resource?resourceName=resourceName&resourceType=resourceType'
)
// end-section-8

0 comments on commit ca167b6

Please sign in to comment.