-
Notifications
You must be signed in to change notification settings - Fork 130
docs: Example for customizing fetch requests to trustless gateways #768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move the example to index.ts
of the package, because the README file is generated automatically from it, and will be overwritten in the build.
For example, for the dag-json package, this is the source:
helia/packages/dag-json/src/index.ts
Lines 1 to 26 in 7e32123
/** | |
* @packageDocumentation | |
* | |
* `@helia/dag-json` makes working with DAG-JSON {@link https://github.com/ipfs/helia Helia} simple & straightforward. | |
* | |
* See the {@link DAGJSON} interface for all available operations. | |
* | |
* @example | |
* | |
* ```typescript | |
* import { createHelia } from 'helia' | |
* import { dagJson } from '@helia/dag-json' | |
* import { CID } from 'multiformats/cid' | |
* | |
* const helia = await createHelia() | |
* const j = dagJson(helia) | |
* | |
* const cid = await j.add({ | |
* hello: 'world' | |
* }) | |
* const obj = await j.get(cid) | |
* | |
* console.info(obj) | |
* // { hello: 'world' } | |
* ``` | |
*/ |
- Make sure the style is consistent by using
npx aegir lint
andnpx aegir lint -- --fix
- To generate the readme run
npx aegir docs
Also left some comments in line.
Hi @2color, I’ve also added the example for |
Hi @2color , |
Hi @2color, |
Co-authored-by: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com>
Co-authored-by: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com>
Hi @2color @SgtPooki ,
You can verify the working example at: https://github.com/Dhruv-Varshney-developer/test-example-helia I've also updated the CID in the example to use The PR is now ready for review. |
Title
docs: Example for customizing fetch requests to trustless gateways
Description
Add example code to the
packages/block-brokers/README.md
demonstrating how to customize the fetch requests sent to trustless gateways using thetransformRequestInit
option.This shows how to add authentication headers (such as JWT tokens) when using theTrustlessGatewayBlockBroker
.Completes #757 .
Notes & open questions
Change checklist