@cryptotaxi247 / kubo / commits / 680d420f9

docs: replace outdated package paths described in rpc README (#10505)

Closes #10498

Andrew Gillis committed Sep 5, 2024 at 14:20 UTC 680d420f9f878cbf7a56277006d052e276029048
1 file changed +25 -21
client/rpc/README.md
+25 -21
@@ -2,7 +2,7 @@
2
3 > IPFS CoreAPI implementation using HTTP API
4
5 -This packages implements [`coreiface.CoreAPI`](https://pkg.go.dev/github.com/ipfs/boxo/coreiface#CoreAPI) over the HTTP API.
5 +This package implements [`coreiface.CoreAPI`](https://pkg.go.dev/github.com/ipfs/kubo/core/coreiface#CoreAPI) over the HTTP API.
6
7 ## Documentation
8
@@ -16,29 +16,33 @@ Pin file on your local IPFS node based on its CID:
16 package main
17
18 import (
19 - "context"
20 - "fmt"
19 + "context"
20 + "fmt"
21
22 - "github.com/ipfs/kubo/client/rpc"
23 - path "github.com/ipfs/boxo/coreiface/path"
22 + "github.com/ipfs/boxo/path"
23 + "github.com/ipfs/go-cid"
24 + "github.com/ipfs/kubo/client/rpc"
25 )
26
27 func main() {
27 - // "Connect" to local node
28 - node, err := rpc.NewLocalApi()
29 - if err != nil {
30 - fmt.Printf(err)
31 - return
32 - }
33 - // Pin a given file by its CID
34 - ctx := context.Background()
35 - cid := "bafkreidtuosuw37f5xmn65b3ksdiikajy7pwjjslzj2lxxz2vc4wdy3zku"
36 - p := path.New(cid)
37 - err = node.Pin().Add(ctx, p)
38 - if err != nil {
39 - fmt.Printf(err)
40 - return
41 - }
42 - return
28 + // "Connect" to local node
29 + node, err := rpc.NewLocalApi()
30 + if err != nil {
31 + fmt.Println(err)
32 + return
33 + }
34 + // Pin a given file by its CID
35 + ctx := context.Background()
36 + c, err := cid.Decode("bafkreidtuosuw37f5xmn65b3ksdiikajy7pwjjslzj2lxxz2vc4wdy3zku")
37 + if err != nil {
38 + fmt.Println(err)
39 + return
40 + }
41 + p := path.FromCid(c)
42 + err = node.Pin().Add(ctx, p)
43 + if err != nil {
44 + fmt.Println(err)
45 + return
46 + }
47 }
48 ```