web

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: CC0-1.0 Imports: 5 Imported by: 0

Documentation

Overview

Package web is a simple collection of high-level error and transport types that I end up using over and over.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewError

func NewError(wantStatusCode int, resp *http.Response) error

NewError creates an Error based on an expected HTTP status code vs data populated from an HTTP response.

This consumes the body of the HTTP response.

Types

type Error

type Error struct {
	WantStatus, GotStatus int
	URL                   *url.URL
	Method                string
	ResponseBody          string
}

Error is a web response error. Use this when API calls don't work out like you wanted them to.

func (Error) Error

func (e Error) Error() string

func (Error) LogValue added in v1.7.0

func (e Error) LogValue() slog.Value

LogValue formats this Error for slog.

Directories

Path Synopsis
Package cryptocompare fetches the latest USD price of a given crpytocurrency from CryptoCompare
Package cryptocompare fetches the latest USD price of a given crpytocurrency from CryptoCompare
Package discordwebhook is a simple low-level HTTP client wrapper around Discord webhooks.
Package discordwebhook is a simple low-level HTTP client wrapper around Discord webhooks.
fly
flymachines
Package flymachines is an API client for Fly's machines API.
Package flymachines is an API client for Fly's machines API.
Package marginalia implements the Marginalia search API.
Package marginalia implements the Marginalia search API.
Package mastodon is an API client for Mastodon[1], specifically designed for making bots.
Package mastodon is an API client for Mastodon[1], specifically designed for making bots.
Package mastosan takes Mastodon flavored HTML and emits Slack-flavored markdown.
Package mastosan takes Mastodon flavored HTML and emits Slack-flavored markdown.
Package nodeinfo contains types and a simple client for reading the standard NodeInfo protocol described by Diaspora[1].
Package nodeinfo contains types and a simple client for reading the standard NodeInfo protocol described by Diaspora[1].
chatgpt
Package chatgpt is a simple binding to the ChatGPT API.
Package chatgpt is a simple binding to the ChatGPT API.
Package stablediffusion provides a simple API client for the Automatic1111 Stable Diffusion web UI.
Package stablediffusion provides a simple API client for the Automatic1111 Stable Diffusion web UI.
Package switchcounter is a simple interface to the https://www.switchcounter.science/ API.
Package switchcounter is a simple interface to the https://www.switchcounter.science/ API.
Package tokipana wraps http://inamidst.com/services/tokipana.
Package tokipana wraps http://inamidst.com/services/tokipana.
Package tokiponatokens is a wrapper to a Toki Poka tokenizer.
Package tokiponatokens is a wrapper to a Toki Poka tokenizer.
Package vanity implements custom import paths (Go vanity URLs) as an HTTP handler that can be installed at the vanity URL.
Package vanity implements custom import paths (Go vanity URLs) as an HTTP handler that can be installed at the vanity URL.

Jump to

Keyboard shortcuts

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