coreapi.go 1.16 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"

8
	ipld "gx/ipfs/QmdDXJs4axxefSPgK6Y1QhpJWKuDPnGJiqgq4uncb4rFHL/go-ipld-format"
9 10
)

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

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

Łukasz Magiera's avatar
Łukasz Magiera committed
19
	// Dag returns an implementation of Dag API
20 21
	Dag() DagAPI

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

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

	// Pin returns an implementation of Pin API
29 30 31 32 33
	Pin() PinAPI

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

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

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

40
	// ResolvePath resolves the path using Unixfs resolver
41
	ResolvePath(context.Context, Path) (ResolvedPath, error)
42 43 44 45 46

	// ResolveNode resolves the path (if not resolved already) using Unixfs
	// resolver, gets and returns the resolved Node
	ResolveNode(context.Context, Path) (ipld.Node, error)
}