master
go 58 lines 1.6 KB
Raw
1 // Package iface defines IPFS Core API which is a set of interfaces used to
2 // interact with IPFS nodes.
3 package iface
4
5 import (
6 "context"
7
8 "github.com/ipfs/boxo/path"
9 "github.com/ipfs/kubo/core/coreiface/options"
10
11 ipld "github.com/ipfs/go-ipld-format"
12 )
13
14 // CoreAPI defines an unified interface to IPFS for Go programs
15 type CoreAPI interface {
16 // Unixfs returns an implementation of Unixfs API
17 Unixfs() UnixfsAPI
18
19 // Block returns an implementation of Block API
20 Block() BlockAPI
21
22 // Dag returns an implementation of Dag API
23 Dag() APIDagService
24
25 // Name returns an implementation of Name API
26 Name() NameAPI
27
28 // Key returns an implementation of Key API
29 Key() KeyAPI
30
31 // Pin returns an implementation of Pin API
32 Pin() PinAPI
33
34 // Object returns an implementation of Object API
35 Object() ObjectAPI
36
37 // Swarm returns an implementation of Swarm API
38 Swarm() SwarmAPI
39
40 // PubSub returns an implementation of PubSub API
41 PubSub() PubSubAPI
42
43 // Routing returns an implementation of Routing API
44 Routing() RoutingAPI
45
46 // ResolvePath resolves the path using UnixFS resolver, and returns the resolved
47 // immutable path, and the remainder of the path segments that cannot be resolved
48 // within UnixFS.
49 ResolvePath(context.Context, path.Path) (path.ImmutablePath, []string, error)
50
51 // ResolveNode resolves the path (if not resolved already) using Unixfs
52 // resolver, gets and returns the resolved Node
53 ResolveNode(context.Context, path.Path) (ipld.Node, error)
54
55 // WithOptions creates new instance of CoreAPI based on this instance with
56 // a set of options applied
57 WithOptions(...options.ApiOption) (CoreAPI, error)
58 }