api

package
v0.0.0-...-ad7c93f Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package api provides the useful functions, structures and variables for the api package

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidStatusCode is returned when the status code is different from 200
	ErrInvalidStatusCode = errors.New("status code not ok")
	// ErrInvalidResponse is returned when the response is not valid
	ErrInvalidResponse = errors.New("invalid response")
)

Functions

func Handler

func Handler(r chi.Router)

Handler gather all the handler functions

Types

type Error

type Error struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

Error is the structure for the error response

func (Error) Error

func (e Error) Error() string

type NumberResponse

type NumberResponse struct {
	Numbers []int `json:"numbers"`
}

NumberResponse is the response from the /numbers endpoint

type TestServerResponse

type TestServerResponse struct {
	Numbers []int    `json:"numbers"`
	Strings []string `json:"strings"`
}

TestServerResponse is the response from the test server

Jump to

Keyboard shortcuts

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