Documentation
¶
Index ¶
- Constants
- Variables
- func Duration(d time.Duration, dicimal int) time.Duration
- func NewLoggingTransport(transport http.RoundTripper) *http.Client
- func WithCredentials(clientid, secret string) settings.Option
- func WithEndpoint(url string) settings.Option
- func WithToken(clientid, token string) settings.Option
- func XID() string
- type LoggingTransport
- type RestClient
- func (c *RestClient) DELETE(uri string, request, response interface{}) (int, error)
- func (c *RestClient) GET(uri string, response interface{}) (int, error)
- func (c *RestClient) POST(uri string, request, response interface{}) (int, error)
- func (c *RestClient) PUT(uri string, request, response interface{}) (int, error)
- func (c *RestClient) SetClient(cl *http.Client)
Constants ¶
View Source
const ( HTTP_ENDPOINT = "HTTP_ENDPOINT" FORCE_TRACE = "FORCE_TRACE" ApiAgent = "txsvc/rest" // format error messages MsgStatus = "%s. status: %d" )
Variables ¶
View Source
var ( // ErrApiInvocationError indicates an error in an API call ErrApiInvocationError = errors.New("api invocation error") )
Functions ¶
func NewLoggingTransport ¶
func NewLoggingTransport(transport http.RoundTripper) *http.Client
func WithCredentials ¶
WithCredentials returns a ClientOption that overrides the default credentials used for a service.
func WithEndpoint ¶
WithEndpoint returns a ClientOption that overrides the default endpoint to be used for a service.
Types ¶
type LoggingTransport ¶
type LoggingTransport struct {
InnerTransport http.RoundTripper
}
RestClient - API client encapsulating the http client
type RestClient ¶
type RestClient struct {
HttpClient *http.Client
Settings *settings.DialSettings
Trace string
}
RestClient - API client encapsulating the http client
func NewRestClient ¶
func (*RestClient) DELETE ¶
func (c *RestClient) DELETE(uri string, request, response interface{}) (int, error)
func (*RestClient) GET ¶
func (c *RestClient) GET(uri string, response interface{}) (int, error)
GET is used to request data from the API. No payload, only queries!
func (*RestClient) POST ¶
func (c *RestClient) POST(uri string, request, response interface{}) (int, error)
func (*RestClient) PUT ¶
func (c *RestClient) PUT(uri string, request, response interface{}) (int, error)
func (*RestClient) SetClient ¶
func (c *RestClient) SetClient(cl *http.Client)
Click to show internal directories.
Click to hide internal directories.