uniratefiber

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package uniratefiber exposes the UniRate API as a set of Fiber HTTP handlers.

Register wires four routes onto a *fiber.App (or any fiber.Router such as a group), each backed by a *unirate.Client:

/rate?from=USD&to=EUR
/convert?from=USD&to=EUR&amount=100
/currencies
/vat?country=DE   (country optional; omit for all countries)

UniRate client errors are mapped to appropriate HTTP status codes and a JSON error body of the form {"error": "...", "status": <code>}.

Index

Constants

This section is empty.

Variables

View Source
var (
	WithTimeout    = unirate.WithTimeout
	WithHTTPClient = unirate.WithHTTPClient
	WithBaseURL    = unirate.WithBaseURL
)

WithTimeout, WithHTTPClient and WithBaseURL are re-exported client options.

Functions

func ConvertHandler

func ConvertHandler(client *Client) fiber.Handler

ConvertHandler returns the /convert handler.

func CurrenciesHandler

func CurrenciesHandler(client *Client) fiber.Handler

CurrenciesHandler returns the /currencies handler.

func RateHandler

func RateHandler(client *Client) fiber.Handler

RateHandler returns the /rate handler.

func Register

func Register(r fiber.Router, client *Client)

Register attaches the UniRate routes to r using client. r may be a *fiber.App or any fiber.Router (e.g. an app.Group).

func VATHandler

func VATHandler(client *Client) fiber.Handler

VATHandler returns the /vat handler.

Types

type Client

type Client = unirate.Client

Client is the UniRate client type this adapter wraps.

func New

func New(apiKey string, opts ...Option) *Client

New constructs a UniRate Client for use with Register. Thin re-export of the underlying client's constructor so callers need only import this package.

type Option

type Option = unirate.Option

Option configures a Client (alias of the underlying client's Option).

Jump to

Keyboard shortcuts

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