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

Steven Allen's avatar
Steven Allen committed
8
	ipld "gx/ipfs/QmZtNq8dArGfnpCZfx2pUNY7UcjGhVp5qqwQ4hH6mpTMRQ/go-ipld-format"
9
	cid "gx/ipfs/QmapdYm1b22Frv3k17fqrBYTFRxwiaVJkB299Mfn33edeB/go-cid"
10 11
)

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

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

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

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

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

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

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

	// ResolvePath resolves the path using Unixfs resolver
36
	ResolvePath(context.Context, Path) (ResolvedPath, error)
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)
41 42

	// ParsePath parses string path to a Path
43
	ParsePath(context.Context, string) (Path, error)
44 45

	// ParseCid creates new path from the provided CID
46
	ParseCid(*cid.Cid) ResolvedPath
47
}