Documentation
¶
Index ¶
- Constants
- Variables
- type Client
- type Option
- type Request
- func Connect(uriTemplate string) *Request
- func Delete(uriTemplate string) *Request
- func Get(uriTemplate string) *Request
- func Head(uriTemplate string) *Request
- func NewRequest(method, uriTemplate string) *Request
- func Options(uriTemplate string) *Request
- func Patch(uriTemplate string) *Request
- func Post(uriTemplate string) *Request
- func Put(uriTemplate string) *Request
- func Trace(uriTemplate string) *Request
- type Response
Constants ¶
View Source
const ( DefaultUserAgent string = "go-rest-utility/v1" DefaultAcceptEncoding string = "gzip" )
Variables ¶
View Source
var ( ErrForbidden = errors.New("forbidden") ErrNotFound = errors.New("not found") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { BaseURL *url.URL TokenProvider auth.TokenProvider // contains filtered or unexported fields }
type Option ¶
type Option func(*Client)
func WithBaseURL ¶
func WithDatadogTracing ¶ added in v0.2.0
func WithDatadogTracing(opts ...dd_http.RoundTripperOption) Option
WithDatadogTracing will add a Datadog transport to the client so that it will automatically inject trace-headers.
Should be used when you trace your application with Datadog.
Note, when used in AWS Lambda, make sure to set the service name. client.WithDatadogTracing(
dd_http.RTWithServiceName("<service_name>"),
)
func WithDefaultHeader ¶ added in v0.5.1
func WithOpenCensusTracing ¶ added in v0.2.0
func WithOpenCensusTracing() Option
WithDatadogTracing will add an OpenCensus transport to the client so that it will automatically inject trace-headers.
Should be used when you trace your application with OpenCensus.
func WithTokenProvider ¶
func WithTokenProvider(provider auth.TokenProvider) Option
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func NewRequest ¶
func (*Request) ExpandURL ¶
ExpandURL combines the baseURL with the expanded URI template to form the final URL to be used for this Request. If no baseURL is provided the returned URL is just the expanded URI template
func (*Request) WithJSONPayload ¶
Click to show internal directories.
Click to hide internal directories.