Documentation
¶
Overview ¶
Httpclient: wasmcloud capability contract for http client
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HttpClientContractId ¶
func HttpClientContractId() string
HttpClientContractId returns the capability contract id for this interface
func HttpClientHandler ¶
func HttpClientHandler(actor_ HttpClient) actor.Handler
HttpClientHandler is called by an actor during `main` to generate a dispatch handler The output of this call should be passed into `actor.RegisterHandlers`
Types ¶
type HeaderMap ¶
type HeaderMap map[string]HeaderValues
map data structure for holding http headers
func CDecodeHeaderMap ¶
CDecodeHeaderMap deserializes a HeaderMap using cbor
func MDecodeHeaderMap ¶
MDecodeHeaderMap deserializes a HeaderMap using msgpack
type HeaderValues ¶
type HeaderValues []string
func CDecodeHeaderValues ¶
func CDecodeHeaderValues(d *cbor.Decoder) (HeaderValues, error)
CDecodeHeaderValues deserializes a HeaderValues using cbor
func MDecodeHeaderValues ¶
func MDecodeHeaderValues(d *msgpack.Decoder) (HeaderValues, error)
MDecodeHeaderValues deserializes a HeaderValues using msgpack
type HttpClient ¶
type HttpClient interface { // Issue outgoing http request Request(ctx *actor.Context, arg HttpRequest) (*HttpResponse, error) }
HttpClient - issue outgoing http requests via an external provider To use this capability, the actor must be linked with "wasmcloud:httpclient"
type HttpClientReceiver ¶
type HttpClientReceiver struct{}
HttpClientReceiver receives messages defined in the HttpClient service interface HttpClient - issue outgoing http requests via an external provider To use this capability, the actor must be linked with "wasmcloud:httpclient"
func (*HttpClientReceiver) Dispatch ¶
func (r *HttpClientReceiver) Dispatch(ctx *actor.Context, svc interface{}, message *actor.Message) (*actor.Message, error)
type HttpClientSender ¶
type HttpClientSender struct {
// contains filtered or unexported fields
}
HttpClientSender sends messages to a HttpClient service HttpClient - issue outgoing http requests via an external provider To use this capability, the actor must be linked with "wasmcloud:httpclient"
func NewProviderHttpClient ¶
func NewProviderHttpClient() *HttpClientSender
NewProvider constructs a client for sending to a HttpClient provider implementing the 'wasmcloud:httpclient' capability contract, with the "default" link
func NewProviderHttpClientLink ¶
func NewProviderHttpClientLink(linkName string) *HttpClientSender
NewProviderHttpClientLink constructs a client for sending to a HttpClient provider implementing the 'wasmcloud:httpclient' capability contract, with the specified link name
func (*HttpClientSender) Request ¶
func (s *HttpClientSender) Request(ctx *actor.Context, arg HttpRequest) (*HttpResponse, error)
Issue outgoing http request
type HttpRequest ¶
type HttpRequest struct { // http method, defaults to "GET" Method string Url string // optional headers. defaults to empty Headers HeaderMap // request body, defaults to empty Body []byte }
http request to be sent through the provider
func CDecodeHttpRequest ¶
func CDecodeHttpRequest(d *cbor.Decoder) (HttpRequest, error)
CDecodeHttpRequest deserializes a HttpRequest using cbor
func MDecodeHttpRequest ¶
func MDecodeHttpRequest(d *msgpack.Decoder) (HttpRequest, error)
MDecodeHttpRequest deserializes a HttpRequest using msgpack
type HttpResponse ¶
type HttpResponse struct { // response status code StatusCode uint16 // Case is not guaranteed to be normalized, so // actors checking response headers need to do their own // case conversion. // Example (rust): // // check for 'Content-Type' header // let content_type:Option<&Vec<String>> = header.iter() // .map(|(k,_)| k.to_ascii_lowercase()) // .find(|(k,_)| k == "content-type") // .map(|(_,v)| v); Header HeaderMap // response body Body []byte }
response from the http request
func CDecodeHttpResponse ¶
func CDecodeHttpResponse(d *cbor.Decoder) (HttpResponse, error)
CDecodeHttpResponse deserializes a HttpResponse using cbor
func MDecodeHttpResponse ¶
func MDecodeHttpResponse(d *msgpack.Decoder) (HttpResponse, error)
MDecodeHttpResponse deserializes a HttpResponse using msgpack