Documentation ¶
Overview ¶
Package http provides custom HTTP client and server functionality.
Index ¶
- Constants
- func NewClient(transport http.RoundTripper) *http.Client
- func NewServer(log logging.Interface, session *discordgo.Session, port string) *http.Server
- func NewTransport() *http.Transport
- func WrapTransport(roundTripper http.RoundTripper, transportWrappers ...TransportWrapper) http.RoundTripper
- type SortableGuild
- type SortableGuilds
- type TransportWrapper
Constants ¶
const ( RootEndpoint = "/" GuildsEndpoint = "/guilds" )
Supported endpoints.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
func NewClient(transport http.RoundTripper) *http.Client
NewClient returns a new preconfigured *http.Client.
func NewTransport ¶
NewTransport returns a new pre-configured *http.Transport.
func WrapTransport ¶
func WrapTransport(roundTripper http.RoundTripper, transportWrappers ...TransportWrapper) http.RoundTripper
WrapTransport returns an http.RoundTripper with all the provided TransportWrapper functions wrapping the provided http.RoundTripper in order.
Types ¶
type SortableGuild ¶
SortableGuild is a representation of a guild that can be sorted by member count.
type SortableGuilds ¶
type SortableGuilds []SortableGuild
SortableGuilds is a slice of SortableGuild structs.
func (SortableGuilds) Len ¶
func (guilds SortableGuilds) Len() int
Len returns the length of guilds to satisfy the sort.Interface interface.
func (SortableGuilds) Less ¶
func (guilds SortableGuilds) Less(i, j int) bool
Less returns whether the element i is less than element j to satisfy the sort.Interface interface.
func (SortableGuilds) Swap ¶
func (guilds SortableGuilds) Swap(i, j int)
Swap swaps the elements i and j in the slice to satisfy the sort.Interface interface.
type TransportWrapper ¶
type TransportWrapper func(next http.RoundTripper) http.RoundTripper
TransportWrapper is a function that returns an http.RoundTripper that wraps the next http.RoundTripper by calling its RoundTrip method.
func WrapTransportWithTracer ¶
func WrapTransportWithTracer(jaegerTracer opentracing.Tracer, instanceName string) TransportWrapper
WrapTransportWithTracer wraps the next http.RoundTripper with a Jaeger tracer.