Documentation
¶
Index ¶
- type Client
- func (c *Client[C]) Delete(ctx context.Context, path string, opts ...message.Option) (*pool.Message, error)
- func (c *Client[C]) Get(ctx context.Context, path string, opts ...message.Option) (*pool.Message, error)
- func (c *Client[C]) GetObservationRequest(token message.Token) (*pool.Message, bool)
- func (c *Client[C]) GetToken() (message.Token, error)
- func (c *Client[C]) NewDeleteRequest(ctx context.Context, path string, opts ...message.Option) (*pool.Message, error)
- func (c *Client[C]) NewGetRequest(ctx context.Context, path string, opts ...message.Option) (*pool.Message, error)
- func (c *Client[C]) NewObserveRequest(ctx context.Context, path string, opts ...message.Option) (*pool.Message, error)
- func (c *Client[C]) NewPostRequest(ctx context.Context, path string, contentFormat message.MediaType, ...) (*pool.Message, error)
- func (c *Client[C]) NewPutRequest(ctx context.Context, path string, contentFormat message.MediaType, ...) (*pool.Message, error)
- func (c *Client[C]) Observe(ctx context.Context, path string, observeFunc func(req *pool.Message), ...) (Observation, error)
- func (c *Client[C]) Ping(ctx context.Context) error
- func (c *Client[C]) Post(ctx context.Context, path string, contentFormat message.MediaType, ...) (*pool.Message, error)
- func (c *Client[C]) Put(ctx context.Context, path string, contentFormat message.MediaType, ...) (*pool.Message, error)
- type Conn
- type GetTokenFunc
- type Observation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client[C Conn] struct { *limitparallelrequests.LimitParallelRequests // contains filtered or unexported fields }
func New ¶
func New[C Conn](cc C, observationHandler *observation.Handler[C], getToken GetTokenFunc, limitParallelRequests *limitparallelrequests.LimitParallelRequests) *Client[C]
func (*Client[C]) Delete ¶
func (c *Client[C]) Delete(ctx context.Context, path string, opts ...message.Option) (*pool.Message, error)
Delete deletes the resource identified by the request path.
Use ctx to set timeout.
func (*Client[C]) Get ¶
func (c *Client[C]) Get(ctx context.Context, path string, opts ...message.Option) (*pool.Message, error)
Get issues a GET to the specified path.
Use ctx to set timeout.
An error is returned if by failure to speak COAP (such as a network connectivity problem). Any status code doesn't cause an error.
func (*Client[C]) GetObservationRequest ¶
func (*Client[C]) NewDeleteRequest ¶
func (c *Client[C]) NewDeleteRequest(ctx context.Context, path string, opts ...message.Option) (*pool.Message, error)
NewDeleteRequest creates delete request.
Use ctx to set timeout.
func (*Client[C]) NewGetRequest ¶
func (c *Client[C]) NewGetRequest(ctx context.Context, path string, opts ...message.Option) (*pool.Message, error)
NewGetRequest creates get request.
Use ctx to set timeout.
func (*Client[C]) NewObserveRequest ¶
func (c *Client[C]) NewObserveRequest(ctx context.Context, path string, opts ...message.Option) (*pool.Message, error)
NewObserveRequest creates observe request.
Use ctx to set timeout.
func (*Client[C]) NewPostRequest ¶
func (c *Client[C]) NewPostRequest(ctx context.Context, path string, contentFormat message.MediaType, payload io.ReadSeeker, opts ...message.Option) (*pool.Message, error)
NewPostRequest creates post request.
Use ctx to set timeout.
An error is returned if by failure to speak COAP (such as a network connectivity problem). Any status code doesn't cause an error.
If payload is nil then content format is not used.
func (*Client[C]) NewPutRequest ¶
func (c *Client[C]) NewPutRequest(ctx context.Context, path string, contentFormat message.MediaType, payload io.ReadSeeker, opts ...message.Option) (*pool.Message, error)
NewPutRequest creates put request.
Use ctx to set timeout.
If payload is nil then content format is not used.
func (*Client[C]) Observe ¶
func (c *Client[C]) Observe(ctx context.Context, path string, observeFunc func(req *pool.Message), opts ...message.Option) (Observation, error)
Observe subscribes for every change of resource on path.
func (*Client[C]) Ping ¶
Ping issues a PING to the client and waits for PONG response.
Use ctx to set timeout.
func (*Client[C]) Post ¶
func (c *Client[C]) Post(ctx context.Context, path string, contentFormat message.MediaType, payload io.ReadSeeker, opts ...message.Option) (*pool.Message, error)
Post issues a POST to the specified path.
Use ctx to set timeout.
An error is returned if by failure to speak COAP (such as a network connectivity problem). Any status code doesn't cause an error.
If payload is nil then content format is not used.
func (*Client[C]) Put ¶
func (c *Client[C]) Put(ctx context.Context, path string, contentFormat message.MediaType, payload io.ReadSeeker, opts ...message.Option) (*pool.Message, error)
Put issues a PUT to the specified path.
Use ctx to set timeout.
An error is returned if by failure to speak COAP (such as a network connectivity problem). Any status code doesn't cause an error.
If payload is nil then content format is not used.