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

Commit dd2aed0

Browse files
authored
name API (#37)
* init name API * feat(name): add name.publish spec * feat(name): add name.resolve spec
1 parent 6a154dc commit dd2aed0

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

API/name/README.md

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name API
2+
========
3+
4+
#### `publish`
5+
6+
> Publish an IPNS name with a given value.
7+
8+
##### `Go` **WIP**
9+
10+
##### `JavaScript` - ipfs.name.publish(value, [options, callback])
11+
12+
`value` is a base58 encoded IPFS multihash, such as: `/ipfs/QmbezGequPwcsWo8UL4wDF6a8hYwM1hmbzYv2mnKkEWaUp`.
13+
14+
`options` is an object that may contain:
15+
16+
```JavaScript
17+
{
18+
resolve: // bool - Resolve given path before publishing. Default: true.
19+
lifetime: // string - Time duration of the record. Defaulg: 24h
20+
ttl: // string - Time duration this record should be cached
21+
}
22+
```
23+
24+
`callback` must follow `function (err, name) {}` signature, where `err` is an error if the operation was not successful. `name` is an object that contains the IPNS hash and the IPFS hash, such as:
25+
26+
```JavaScript
27+
{
28+
name: "/ipns/QmHash.."
29+
value: "/ipfs/QmHash.."
30+
}
31+
```
32+
33+
If no `callback` is passed, a promise is returned.
34+
35+
Example:
36+
37+
```JavaScript
38+
// TODO
39+
```
40+
41+
#### `resolve`
42+
43+
> Resolve an IPNS name.
44+
45+
##### `Go` **WIP**
46+
47+
##### `JavaScript` - ipfs.name.resolve([options, callback])
48+
49+
`options` is an object that may contain:
50+
51+
```JavaScript
52+
{
53+
recursive: // bool - Resolve until the result is not an IPNS name. Default: false.
54+
nocache: // bool - Do not use cached entries. Default: false.
55+
}
56+
```
57+
58+
`callback` must follow `function (err, name) {}` signature, where `err` is an error if the operation was not successful. `name` is an object that contains the IPNS hash and the IPFS hash, such as:
59+
60+
```JavaScript
61+
{
62+
name: "/ipns/QmHash.."
63+
value: "/ipfs/QmHash.."
64+
}
65+
```
66+
67+
If no `callback` is passed, a promise is returned.
68+
69+
Example:
70+
71+
```JavaScript
72+
// TODO
73+
```

0 commit comments

Comments
 (0)