apiclient

package
v0.0.0-...-fb49ba0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 2 Imported by: 0

README

Adding a new API package

  1. Create a new package for the API.
  2. Define an interface and an implementation.
  3. Add a moq go:generate directive.
  4. Add to bot.Config and bot.sharedDeps.
  5. Add fake to bot_test.scriptTester, and set scriptTester.bc with the fake.
  6. Add directives for specifying the output of the API based on the parameters.
  7. Add the real API to main.go.

Documentation

Overview

Package apiclient provides helpers for hortbot's API clients.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsOK

func IsOK(code int) bool

IsOK return true if the provided status code is okay (2xx).

Types

type Error

type Error struct {
	API        string
	StatusCode int
	Err        error
}

Error is an HTTP error response type, returned by an API.

func (*Error) Error

func (e *Error) Error() string

func (*Error) IsNotFound

func (e *Error) IsNotFound() bool

IsNotFound returns true if the error is a not found.

func (*Error) IsNotPermitted

func (e *Error) IsNotPermitted() bool

IsNotPermitted returns true if the client was not permitted to access a resource.

func (*Error) IsServerError

func (e *Error) IsServerError() bool

IsServerError returns true if the error is a server error.

Directories

Path Synopsis
Package extralife provides an Extra-Life API client.
Package extralife provides an Extra-Life API client.
Package hltb implements a HowLongToBeat client.
Package hltb implements a HowLongToBeat client.
Package lastfm provides a LastFM client.
Package lastfm provides a LastFM client.
Package simple implements a simple HTTP client for accessing URLs.
Package simple implements a simple HTTP client for accessing URLs.
Package steam provides a Steam API client.
Package steam provides a Steam API client.
Package tinyurl provides a TinyURL client.
Package tinyurl provides a TinyURL client.
Package twitch implements a Twitch API client.
Package twitch implements a Twitch API client.
Package urban provides an Urban Dictionary API client.
Package urban provides an Urban Dictionary API client.
Package xkcd provides an XKCD API client.
Package xkcd provides an XKCD API client.
Package youtube proivdes a YouTube API client.
Package youtube proivdes a YouTube API client.

Jump to

Keyboard shortcuts

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