coreapi.go 1.45 KB
Newer Older
1 2 3 4 5 6 7
// Package iface defines IPFS Core API which is a set of interfaces used to
// interact with IPFS nodes.
package iface

import (
	"context"

Łukasz Magiera's avatar
Łukasz Magiera committed
8 9
	"github.com/ipfs/go-ipfs/core/coreapi/interface/options"

Steven Allen's avatar
Steven Allen committed
10
	ipld "gx/ipfs/QmcKKBwfz6FyQdHR2jsXrrF6XeSBXYL86anmWNewpFpoF5/go-ipld-format"
11 12
)

Łukasz Magiera's avatar
Łukasz Magiera committed
13
// CoreAPI defines an unified interface to IPFS for Go programs
14
type CoreAPI interface {
Łukasz Magiera's avatar
Łukasz Magiera committed
15
	// Unixfs returns an implementation of Unixfs API
16 17
	Unixfs() UnixfsAPI

Łukasz Magiera's avatar
Łukasz Magiera committed
18
	// Block returns an implementation of Block API
19 20
	Block() BlockAPI

Łukasz Magiera's avatar
Łukasz Magiera committed
21
	// Dag returns an implementation of Dag API
22
	Dag() APIDagService
23

Łukasz Magiera's avatar
Łukasz Magiera committed
24
	// Name returns an implementation of Name API
25 26
	Name() NameAPI

Łukasz Magiera's avatar
Łukasz Magiera committed
27
	// Key returns an implementation of Key API
28
	Key() KeyAPI
Łukasz Magiera's avatar
Łukasz Magiera committed
29 30

	// Pin returns an implementation of Pin API
31 32 33 34 35
	Pin() PinAPI

	// ObjectAPI returns an implementation of Object API
	Object() ObjectAPI

Łukasz Magiera's avatar
Łukasz Magiera committed
36 37 38
	// Dht returns an implementation of Dht API
	Dht() DhtAPI

Łukasz Magiera's avatar
Łukasz Magiera committed
39 40 41
	// Swarm returns an implementation of Swarm API
	Swarm() SwarmAPI

42 43 44
	// PubSub returns an implementation of PubSub API
	PubSub() PubSubAPI

45
	// ResolvePath resolves the path using Unixfs resolver
46
	ResolvePath(context.Context, Path) (ResolvedPath, error)
47 48 49 50

	// ResolveNode resolves the path (if not resolved already) using Unixfs
	// resolver, gets and returns the resolved Node
	ResolveNode(context.Context, Path) (ipld.Node, error)
Łukasz Magiera's avatar
Łukasz Magiera committed
51 52 53 54

	// WithOptions creates new instance of CoreAPI based on this instance with
	// a set of options applied
	WithOptions(...options.ApiOption) (CoreAPI, error)
55
}