kubo/client/httpapi
João Pedro 5c21cf0ce9 docs: adding example of connection and pinning to README (#173)
Co-authored-by: JPexplorer <jpexplorer@pop-os.localdomain>


This commit was moved from ipfs/go-ipfs-http-client@b0de2b028e
2023-03-28 12:38:24 +02:00
..
api_test.go stop using the deprecated io/ioutil package 2022-09-23 07:43:33 +00:00
api.go chore: bumps for Kubo 0.18 and Routing API with stub for Put 2023-02-10 03:36:15 +01:00
apifile.go chore: bumps for Kubo 0.18 and Routing API with stub for Put 2023-02-10 03:36:15 +01:00
block.go fix: interop with 'block put' from go-ipfs 0.13 (#158) 2022-04-21 22:18:19 +02:00
dag.go chore: bumps for Kubo 0.18 and Routing API with stub for Put 2023-02-10 03:36:15 +01:00
dht.go chore: bumps for Kubo 0.18 and Routing API with stub for Put 2023-02-10 03:36:15 +01:00
errors_test.go correctness: only match CIDs matching go-cid.Cid.String output 2022-04-05 20:14:40 +02:00
errors.go chore: remove unused linter directives 2022-10-01 17:37:23 +02:00
key.go chore: bumps for Kubo 0.18 and Routing API with stub for Put 2023-02-10 03:36:15 +01:00
name.go stop using the deprecated io/ioutil package 2022-09-23 07:43:33 +00:00
object.go stop using the deprecated io/ioutil package 2022-09-23 07:43:33 +00:00
path.go gomod: update iface with path refactor 2019-04-26 20:30:55 +02:00
pin.go fix staticcheck 2021-05-15 18:21:24 -07:00
pubsub.go chore: bumps for Kubo 0.18 and Routing API with stub for Put 2023-02-10 03:36:15 +01:00
README.md docs: adding example of connection and pinning to README (#173) 2023-03-28 12:38:24 +02:00
request.go feed through context 2019-04-04 00:37:23 -07:00
requestbuilder.go chore: bumps for Kubo 0.18 and Routing API with stub for Put 2023-02-10 03:36:15 +01:00
response.go chore: bumps for Kubo 0.18 and Routing API with stub for Put 2023-02-10 03:36:15 +01:00
routing.go chore: bumps for Kubo 0.18 and Routing API with stub for Put 2023-02-10 03:36:15 +01:00
swarm.go chore: bumps for Kubo 0.18 and Routing API with stub for Put 2023-02-10 03:36:15 +01:00
unixfs.go chore: bumps for Kubo 0.18 and Routing API with stub for Put 2023-02-10 03:36:15 +01:00

go-ipfs-http-api

standard-readme compliant GoDoc

IPFS CoreAPI implementation using HTTP API

This package is experimental and subject to change. If you need to depend on something less likely to change, please use go-ipfs-api. If you'd like the latest and greatest features, please use this package.

Documentation

https://godoc.org/github.com/ipfs/go-ipfs-http-api

Example

Pin file on your local IPFS node based on its CID:

package main

import (
    "context"
    "fmt"

    ipfsClient "github.com/ipfs/go-ipfs-http-client"
    path "github.com/ipfs/interface-go-ipfs-core/path"
)

func main() {
    // "Connect" to local node
    node, err := ipfsClient.NewLocalApi()
    if err != nil {
        fmt.Printf(err)
        return
    }
    // Pin a given file by its CID
    ctx := context.Background()
    cid := "bafkreidtuosuw37f5xmn65b3ksdiikajy7pwjjslzj2lxxz2vc4wdy3zku"
    p := path.New(cid)
    err = node.Pin().Add(ctx, p)
    if err != nil {
    	fmt.Printf(err)
        return
    }
    return
}

Contribute

Feel free to join in. All welcome. Open an issue!

This repository falls under the IPFS Code of Conduct.

Want to hack on IPFS?

License

MIT