apihttp

package module
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2020 License: Apache-2.0 Imports: 25 Imported by: 1

README

go-xpx-dfms-api-http

Documentation Go Report Card proximax standard-readme compliant

The Client's API is experimental and can often change.

Current status: under active development

Welcome to DFMS!

The package is the HTTP client for all DFMS's applications. It gives an ability to operate DFMS(Clients) and DFMSR(Replicators) nodes remotely through a generic API.

Table of Contents

Background

DFMS(Decentralized File Management System) - is a new advanced technology developed by ProximaX which represents the Storage Layer of ProximaX infrastructure platform solution.

DFMS provides an easy-to-use decentralized market of disk space using the Blockchain and the DLT powdered with cryptography magic.

Requirements

go version 1.12 or higher

Install

$ go get github.com/proximax-storage/go-xpx-dfms-http-client

Usage

Simply create new Client using an address the DFMS application's API listens to and you are ready to go:

client := client.New(address)

...

Creating new Drive contract:

contract, err := client.ContractAPI().Compose(ctx, space, duration)

...

API

TODO

Maintainers

@Wondertan @BramBear @mrLSD

Contributing

Feel free to dive in! Open an issue or submit PRs.

License

Apache 2.0 © 2019 ProximaX Limited

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	APIPath = "/api/v1"
)

Functions

func NewClientAPI

func NewClientAPI(address string) api.Client

New creates new apiHttp.Client from given address and default http.Client

func NewCustomClientAPI

func NewCustomClientAPI(address string, client *http.Client) api.Client

NewCustomClientAPI creates new apiHttp.Client from given address and custom http.Client

func NewCustomReplicatorAPI

func NewCustomReplicatorAPI(address string, client *http.Client) api.Replicator

NewCustomReplicatorAPI creates new api.Client from given address and custom http.Client

func NewReplicatorAPI

func NewReplicatorAPI(address string) api.Replicator

NewReplicatorAPI creates new api.Client from given address and default http.Client

Types

type Error

type Error = cmds.Error

type FileInfo

type FileInfo struct {
	// contains filtered or unexported fields
}

func (*FileInfo) IsDir

func (ref *FileInfo) IsDir() bool

func (*FileInfo) ModTime

func (ref *FileInfo) ModTime() time.Time

func (*FileInfo) Mode

func (ref *FileInfo) Mode() os.FileMode

func (*FileInfo) Name

func (ref *FileInfo) Name() string

func (*FileInfo) Size

func (ref *FileInfo) Size() int64

func (*FileInfo) Sys

func (ref *FileInfo) Sys() interface{}

type Request

type Request struct {
	Ctx     context.Context
	ApiBase string
	Command string
	Args    []string
	Opts    map[string]string
	Body    io.Reader
	Headers map[string]string
}

func NewRequest

func NewRequest(ctx context.Context, url, command string, args ...string) *Request

func (*Request) Send

func (r *Request) Send(c *http.Client) (*Response, error)

type RequestBuilder

type RequestBuilder interface {
	Arguments(args ...string) RequestBuilder
	BodyString(body string) RequestBuilder
	BodyBytes(body []byte) RequestBuilder
	Body(body io.Reader) RequestBuilder
	FileBody(file files.Node) RequestBuilder
	Option(key string, value interface{}) RequestBuilder
	Header(name, value string) RequestBuilder
	Send(ctx context.Context) (*Response, error)
	Exec(ctx context.Context, res interface{}) error
}

type Response

type Response struct {
	Output io.ReadCloser
	Error  error
}

func (*Response) Cancel

func (r *Response) Cancel() error

Cancel aborts running request (without draining request body)

func (*Response) Close

func (r *Response) Close() error

type Stat

type Stat struct {
	Name string
	Size int64
	Type string
	Cid  cid.Cid
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL