Documentation ¶
Index ¶
- func NewRequest(ctx context.Context, url, namespace string, header http.Header) *request
- func PostJsonRPC(client *http.Client, url string, in Request, requestHeader http.Header) ([]byte, error)
- type Builder
- func (r *Builder) Body(body io.Reader) *Builder
- func (r *Builder) BodyBytes(body []byte) *Builder
- func (r *Builder) BodyString(body string) *Builder
- func (r *Builder) Exec(ctx context.Context, res interface{}) error
- func (r *Builder) Get(ctx context.Context) (*response, error)
- func (r *Builder) Head(ctx context.Context) (http.Header, error)
- func (r *Builder) Header(name, value string) *Builder
- func (r *Builder) Option(key string, value interface{}) *Builder
- func (r *Builder) Post(ctx context.Context) (*response, error)
- type Error
- type ErrorCode
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRequest ¶
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is an IPFS commands request builder.
func NewBuilder ¶
func (*Builder) BodyString ¶
BodyString sets the request body to the given string.
type Request ¶
type Request struct { Jsonrpc string `json:"jsonrpc"` ID interface{} `json:"id,omitempty"` Method string `json:"method"` Params json.RawMessage `json:"params"` Meta map[string]string `json:"meta,omitempty"` }
Request defines a JSON RPC request from the spec http://www.jsonrpc.org/specification#request_object
type Response ¶
type Response struct { Jsonrpc string `json:"jsonrpc"` Result interface{} `json:"result,omitempty"` ID interface{} `json:"id"` Error *respError `json:"error,omitempty"` }
Response defines a JSON RPC response from the spec http://www.jsonrpc.org/specification#response_object
Click to show internal directories.
Click to hide internal directories.