http

package
v0.0.0-...-6d2f78d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package http provides custom HTTP client and server functionality.

Index

Constants

View Source
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 NewServer

func NewServer(log logging.Interface, session *discordgo.Session, port string) *http.Server

NewServer returns a new pre-configured *http.Server..

func NewTransport

func NewTransport() *http.Transport

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

type SortableGuild struct {
	Name        string `json:"name"`
	MemberCount int    `json:"memberCount"`
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL