coreapi.go 1.04 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/QmUSyMZ8Vt4vTZr5HdDEgEfpwAXfQRuDdfCFTt7XBzhxpQ/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 34
	Pin() PinAPI

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

	// ResolvePath resolves the path using Unixfs resolver
35
	ResolvePath(context.Context, Path) (ResolvedPath, error)
36 37 38 39 40

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