8 type PublishResponse struct {
9 Name string `json:"name"`
10 Value string `json:"value"`
13 // Publish updates a mutable name to point to a given value
14 func (s *Shell) Publish(node string, value string) error {
15 var pubResp PublishResponse
16 req := s.Request("name/publish")
22 return req.Exec(context.Background(), &pubResp)
25 // PublishWithDetails is used for fine grained control over record publishing
26 func (s *Shell) PublishWithDetails(contentHash, key string, lifetime, ttl time.Duration, resolve bool) (*PublishResponse, error) {
27 var pubResp PublishResponse
28 req := s.Request("name/publish", contentHash).Option("resolve", resolve)
30 req.Option("key", key)
33 req.Option("lifetime", lifetime)
35 if ttl.Seconds() > 0 {
36 req.Option("ttl", ttl)
38 err := req.Exec(context.Background(), &pubResp)
45 // Resolve gets resolves the string provided to an /ipns/[name]. If asked to
46 // resolve an empty string, resolve instead resolves the node's own /ipns value.
47 func (s *Shell) Resolve(id string) (string, error) {
48 req := s.Request("name/resolve")
52 var out struct{ Path string }
53 err := req.Exec(context.Background(), &out)