Skip to content

Commit

Permalink
chore: add more docs to access-client
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias committed Dec 2, 2022
1 parent 9a0c9f8 commit 8416702
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 8 deletions.
27 changes: 21 additions & 6 deletions packages/access-client/src/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,19 @@ import {
const HOST = 'https://access.web3.storage'

/**
* @template {string} T
* @param {Ucanto.Principal<T>} principal
* @param {typeof fetch} _fetch
* @param {URL} url
* @param {Ucanto.Transport.Channel<import('./types').Service>} [channel]
* Creates a Ucanto connection for the w3access API
*
* Usage:
*
* ```js
* import { connection } from '@web3-storage/access/agent'
* ```
*
* @template {string} T - DID method
* @param {Ucanto.Principal<T>} principal - w3access API Principal
* @param {typeof fetch} _fetch - fetch implementation to use
* @param {URL} url - w3access API URL
* @param {Ucanto.Transport.Channel<import('./types').Service>} [channel] - Ucanto channel to use
* @returns {Ucanto.ConnectionView<import('./types').Service>}
*/
export function connection(principal, _fetch, url, channel) {
Expand All @@ -51,8 +59,15 @@ export function connection(principal, _fetch, url, channel) {
}

/**
* @template {Ucanto.Signer} T
* Agent
*
* Usage:
*
* ```js
* import { Agent } from '@web3-storage/access/agent'
* ```
*
* @template {Ucanto.Signer} T - Ucanto Signer ie. ed25519, RSA or others
*/
export class Agent {
/** @type {Ucanto.Principal<"key">|undefined} */
Expand Down
2 changes: 1 addition & 1 deletion packages/access-client/src/encoding.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Encoding utilities
*
* These can be imported directly with:
* It is recommended that you import directly with:
* ```js
* import * as Encoding from '@web3-storage/access/encoding'
*
Expand Down
8 changes: 7 additions & 1 deletion packages/access-client/src/stores/store-conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ import * as Ucanto from '@ucanto/interface'
*/

/**
* Store implementation with "conf"
* Store implementation with "[conf](https://github.com/sindresorhus/conf)"
*
* Usage:
*
* ```js
* import { StoreConf } from '@web3-storage/access/stores/store-conf'
* ```
*
* @implements {Store}
*/
Expand Down
6 changes: 6 additions & 0 deletions packages/access-client/src/stores/store-indexeddb.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ const DATA_ID = 1
/**
* Store implementation for the browser.
*
* Usage:
*
* ```js
* import { StoreIndexedDB } from '@web3-storage/access/stores/store-indexeddb'
* ```
*
* @implements {Store}
*/
export class StoreIndexedDB {
Expand Down

0 comments on commit 8416702

Please sign in to comment.