Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit c785c3b

Browse files
authored
Merge pull request #537 from ipfs/list-api-calls
docs: list out all the api calls
2 parents 9dc4c15 + 3c3747f commit c785c3b

File tree

1 file changed

+123
-10
lines changed

1 file changed

+123
-10
lines changed

README.md

+123-10
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ ipfs-api
1212
![](https://img.shields.io/badge/npm-%3E%3D3.0.0-orange.svg?style=flat-square)
1313
![](https://img.shields.io/badge/Node.js-%3E%3D4.0.0-orange.svg?style=flat-square)
1414

15-
[![Sauce Test Status](https://saucelabs.com/browser-matrix/js-ipfs-api.svg)](https://saucelabs.com/u/ipfs-js-api)
16-
17-
> **Note: If you see CI red, that is due a failing test when adding nested directories in the browser, all the other features work as expect, if this is something you also need, please consider helping us identifying the solution for it, join the discussion at: https://github.com/ipfs/js-ipfs-api/issues/339**
15+
<!-- Hidding this until we have the SauceLabs situation figured out.
16+
[![Sauce Test Status](https://saucelabs.com/browser-matrix/js-ipfs-api.svg)](https://saucelabs.com/u/ipfs-js-api)
17+
-->
1818

1919
> A client library for the IPFS HTTP API, implemented in JavaScript. This client library implements the [interface-ipfs-core](https://github.com/ipfs/interface-ipfs-core) enabling applications to change between a embebed js-ipfs node and any remote IPFS node without having to change the code. In addition, this client library implements a set of utility functions.
2020
@@ -39,25 +39,25 @@ ipfs-api
3939
This module uses node.js, and can be installed through npm:
4040

4141
```bash
42-
$ npm install --save ipfs-api
42+
> npm install --save ipfs-api
4343
```
4444

45-
**Note:** ipfs-api requires Node v4.x (LTS) or higher.
45+
**Note:** ipfs-api requires Node.js v4 (LTS) or higher.
4646

4747
### Running the daemon with the right port
4848

4949
To interact with the API, you need to have a local daemon running. It needs to be open on the right port. `5001` is the default, and is used in the examples below, but it can be set to whatever you need.
5050

5151
```sh
5252
# Show the ipfs config API port to check it is correct
53-
$ ipfs config Addresses.API
53+
> ipfs config Addresses.API
5454
/ip4/127.0.0.1/tcp/5001
5555
# Set it if it does not match the above output
56-
$ ipfs config Addresses.API /ip4/127.0.0.1/tcp/5001
56+
> ipfs config Addresses.API /ip4/127.0.0.1/tcp/5001
5757
# Restart the daemon after changing the config
5858

5959
# Run the daemon
60-
$ ipfs daemon
60+
> ipfs daemon
6161
```
6262

6363
### Importing the module and usage
@@ -111,7 +111,7 @@ integrity="sha384-5bXRcW9kyxxnSMbOoHzraqa7Z0PQWIao+cgeg327zit1hz5LZCEbIMx/LWKPRe
111111
crossorigin="anonymous"></script>
112112
```
113113

114-
CDN-based IPFS API provides the `IpfsApi` constructor as a method of the global `window` object. Example:
114+
CDN-based IPFS API provides the `IpfsApi` constructor as a method of the global `window` object. Example:
115115

116116
```
117117
var ipfs = window.IpfsApi('localhost', '5001')
@@ -137,7 +137,120 @@ $ ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods "[\"PUT\", \"P
137137

138138
### API
139139

140-
> `js-ipfs-api` follows the spec defined by [`interface-ipfs-core`](https://github.com/ipfs/interface-ipfs-core), which concerns the interface to expect from IPFS implementations. This interface is a currently active endeavor - expect it to be complete in the next few weeks (August 2016). You can use it today to consult the methods available.
140+
> `js-ipfs-api` follows the spec defined by [`interface-ipfs-core`](https://github.com/ipfs/interface-ipfs-core), which concerns the interface to expect from IPFS implementations. This interface is a currently active endeavor. You can use it today to consult the methods available.
141+
142+
##### [bitswap]()
143+
144+
- [`ipfs.bitswap.wantlist()`]()
145+
- [`ipfs.bitswap.stat()`]()
146+
- [`ipfs.bitswap.unwant()`]()
147+
148+
##### [block](https://github.com/ipfs/interface-ipfs-core/tree/master/API/block)
149+
150+
- [`ipfs.block.get(cid, [options, callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/block#get)
151+
- [`ipfs.block.put(block, cid, [callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/block#put)
152+
- [`ipfs.block.stat(cid, [callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/block#stat)
153+
154+
##### [bootstrap]()
155+
156+
- [`ipfs.bootstrap.list()`]()
157+
- [`ipfs.bootstrap.add()`]()
158+
- [`ipfs.bootstrap.rm()`]()
159+
160+
##### [config](https://github.com/ipfs/interface-ipfs-core/tree/master/API/config)
161+
162+
- [`ipfs.config.get([key, callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/config#configget)
163+
- [`ipfs.config.set(key, value, [callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/config#configset)
164+
- [`ipfs.config.replace(config, [callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/config#configreplace)
165+
166+
##### [dag (not implemented, yet!)](https://github.com/ipfs/interface-ipfs-core/tree/master/API/dag)
167+
168+
- [`ipfs.dag.put(dagNode, options, callback)`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/dag#dagput)
169+
- [`ipfs.dag.get(cid [, path, options], callback)`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/dag#dagget)
170+
- [`ipfs.dag.tree(cid [, path, options], callback)`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/dag#dagtree)
171+
172+
##### [dht]()
173+
174+
- [`ipfs.dht.findprovs()`]()
175+
- [`ipfs.dht.get()`]()
176+
- [`ipfs.dht.put()`]()
177+
178+
##### [files](https://github.com/ipfs/interface-ipfs-core/tree/master/API/files)
179+
180+
- [`ipfs.files.add(data, [options], [callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/files#add)
181+
- alias to `ipfs.add`
182+
- [`ipfs.files.createAddStream([options], [callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/files#createaddstream)
183+
- [`ipfs.files.cat(multihash, [callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/files#cat)
184+
- alias to `ipfs.cat`
185+
- [`ipfs.files.get(hash, [callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/files#get)
186+
- alias to `ipfs.get`
187+
- [`ipfs.ls`]()
188+
- mfs (mutable file system) specific:
189+
- [`ipfs.files.cp`]()
190+
- [`ipfs.files.ls`]()
191+
- [`ipfs.files.mkdir`]()
192+
- [`ipfs.files.stat`]()
193+
- [`ipfs.files.rm`]()
194+
- [`ipfs.files.read`]()
195+
- [`ipfs.files.write`]()
196+
- [`ipfs.files.mv`]()
197+
198+
##### [generic operations](https://github.com/ipfs/interface-ipfs-core/tree/master/API/generic)
199+
200+
- [`ipfs.id([callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/generic#id)
201+
- [`ipfs.version([callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/generic#version)
202+
- [`ipfs.ping()`]()
203+
- [`ipfs.log()`]()
204+
205+
##### [name]()
206+
207+
- [`ipfs.name.publish()`]()
208+
- [`ipfs.name.resolve()`]()
209+
210+
##### [object](https://github.com/ipfs/interface-ipfs-core/tree/master/API/object)
211+
212+
- [`ipfs.object.new([template][, callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/object#objectnew)
213+
- [`ipfs.object.put(obj, [options, callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/object#objectput)
214+
- [`ipfs.object.get(multihash, [options, callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/object#objectget)
215+
- [`ipfs.object.data(multihash, [options, callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/object#objectdata)
216+
- [`ipfs.object.links(multihash, [options, callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/object#objectlinks)
217+
- [`ipfs.object.stat(multihash, [options, callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/object#objectstat)
218+
- [`ipfs.object.patch.addLink(multihash, DAGLink, [options, callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/object#objectpatchaddlink)
219+
- [`ipfs.object.patch.rmLink(multihash, DAGLink, [options, callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/object#objectpatchrmlink)
220+
- [`ipfs.object.patch.appendData(multihash, data, [options, callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/object#objectpatchappenddata)
221+
- [`ipfs.object.patch.setData(multihash, data, [options, callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/object#objectpatchsetdata)
222+
223+
##### [pin]()
224+
225+
- [`ipfs.pin.add()`]()
226+
- [`ipfs.pin.rm()`]()
227+
- [`ipfs.pin.ls()`]()
228+
229+
##### [pubsub (not implemented, yet!)](https://github.com/ipfs/interface-ipfs-core/tree/master/API/pubsub)
230+
231+
> active branch: https://github.com/ipfs/js-ipfs-api/pull/493
232+
233+
- [`ipfs.pubsub.subscribe(topic, options, handler, callback)`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/pubsub#pubsubsubscribe)
234+
- [`ipfs.pubsub.unsubscribe(topic, handler)`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/pubsub#pubsubunsubscribe)
235+
- [`ipfs.pubsub.publish(topic, data, callback)`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/pubsub#pubsubpublish)
236+
- [`ipfs.pubsub.ls(topic, callback)`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/pubsub#pubsubls)
237+
- [`ipfs.pubsub.peers(topic, callback)`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/pubsub#pubsubpeers)
238+
239+
##### [refs]()
240+
241+
- [`ipfs.refs.local()`]()
242+
243+
##### [repo]()
244+
245+
- [`ipfs.repo.stat()`]()
246+
- [`ipfs.repo.gc()`]()
247+
248+
##### [swarm](https://github.com/ipfs/interface-ipfs-core/tree/master/API/swarm)
249+
250+
- [`ipfs.swarm.addrs([callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/swarm#addrs)
251+
- [`ipfs.swarm.connect(addr, [callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/swarm#connect)
252+
- [`ipfs.swarm.disconnect(addr, [callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/swarm#disconnect)
253+
- [`ipfs.swarm.peers([opts] [, callback])`](https://github.com/ipfs/interface-ipfs-core/tree/master/API/swarm#peers)
141254

142255
### Utility functions
143256

0 commit comments

Comments
 (0)