Skip to content
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

docs: ipfs-http-client -> kubo-rpc-client #9331

Merged
merged 14 commits into from
Nov 22, 2022
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,10 @@ Basic proof of 'ipfs working' locally:
# QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o
ipfs cat <that hash>

### HTTP clients

For programmatic interaction with Kubo, see our [list of HTTP/RPC clients](docs/http-clients.md).

### Troubleshooting

If you have previously installed IPFS before and you are running into problems getting a newer version to work, try deleting (or backing up somewhere else) your IPFS config directory (~/.ipfs by default) and rerunning `ipfs init`. This will reinitialize the config file to its defaults and clear out the local datastore of any bad entries.
Expand Down
17 changes: 17 additions & 0 deletions docs/http-clients.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# HTTP Clients
SgtPooki marked this conversation as resolved.
Show resolved Hide resolved

To date, we have four different HTTP API clients:
SgtPooki marked this conversation as resolved.
Show resolved Hide resolved

- [kubo-rpc-client](https://github.com/ipfs/js-kubo-rpc-client) - Official JS client for talking to Kubo over HTTP
SgtPooki marked this conversation as resolved.
Show resolved Hide resolved
- [ipfs-http-client](https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-http-client) - http client for js-ipfs -- Use when talking to [`js-ipfs`](https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs)
SgtPooki marked this conversation as resolved.
Show resolved Hide resolved
- [go-ipfs-api](https://github.com/ipfs/go-ipfs-api) - The go interface to ipfs's HTTP API
- [go-ipfs-http-client](https://github.com/ipfs/go-ipfs-http-client) - IPFS CoreAPI implementation using HTTP API
SgtPooki marked this conversation as resolved.
Show resolved Hide resolved
- [kubo/commands/http](https://github.com/ipfs/kubo/tree/916f987de2c35db71815b54bbb9a0a71df829838/commands/http) -
generalized transport based on the [command definitions](https://github.com/ipfs/kubo/tree/916f987de2c35db71815b54bbb9a0a71df829838/core/commands)

## Recommended clients

| Language | Package Name | Github Repository |
|:--------:|:-------------------:|---------------------------------------------|
| JS | kubo-rpc-client | https://github.com/ipfs/js-kubo-rpc-client |
| Go | go-ipfs-http-client | https://github.com/ipfs/go-ipfs-http-client |
21 changes: 6 additions & 15 deletions docs/implement-api-bindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,27 +76,18 @@ As mentioned above, the API commands map to HTTP with:
- the request body streams file data - reads files or stdin
- multiple streams are muxed with multipart (todo: add tar stream support)

To date, we have two different HTTP API clients:

- [js-ipfs-api](https://github.com/ipfs/js-ipfs-api) - simple javascript
wrapper -- best to look at
- [kubo/commands/http](https://github.com/ipfs/kubo/tree/916f987de2c35db71815b54bbb9a0a71df829838/commands/http) -
generalized transport based on the [command definitions](https://github.com/ipfs/kubo/tree/916f987de2c35db71815b54bbb9a0a71df829838/core/commands)
You can see the latest [list of our HTTP clients here](http-clients.md)
SgtPooki marked this conversation as resolved.
Show resolved Hide resolved

The Go implementation is good to answer harder questions, like how is multipart
handled, or what headers should be set in edge conditions. But the javascript
implementation is very concise, and easy to follow.

#### Anatomy of node-ipfs-api
#### Anatomy of `kubo-rpc-client`

Currently, node-ipfs-api has three main files
- [src/index.js](https://github.com/ipfs-inactive/js-ipfs-http-client/blob/66d1462bd02181d46e8baf4cd9d476b213426ad8/src/index.js) defines the functions clients of the API
module will use. uses `RequestAPI`, and translates function call parameters to
the API almost directly.
- [src/get-files-stream.js](https://github.com/ipfs-inactive/js-ipfs-http-client/blob/66d1462bd02181d46e8baf4cd9d476b213426ad8/src/get-files-stream.js) implements the hardest part:
file streaming. This one uses multipart.
- [src/request-api.js](https://github.com/ipfs-inactive/js-ipfs-http-client/blob/66d1462bd02181d46e8baf4cd9d476b213426ad8/src/request-api.js) generic function call to perform
the actual HTTP requests
Currently, `kubo-rpc-client` has one main file, and folders where subcommands are implemented
- [`src/index.js`](https://github.com/ipfs/js-kubo-rpc-client/blob/ef63c43a8dcc44d94683ed353def3ef906a6ffb5/src/index.js#L105-L143) defines the functions clients of the API
module will use. Translates function call parameters to the API almost directly.
- [`src/*/*.js`](https://github.com/ipfs/js-kubo-rpc-client/tree/ef63c43a8dcc44d94683ed353def3ef906a6ffb5/src) folders within `src/` contain the logic for the relevant subcommand.
SgtPooki marked this conversation as resolved.
Show resolved Hide resolved

## Note on multipart + inspecting requests

Expand Down