Documentation
¶
Overview ¶
Package unirategin exposes the UniRate API as a set of Gin HTTP handlers.
Register wires four routes onto a *gin.Engine (or any gin.IRouter such as a route 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 Handlers ¶
func Handlers(client *Client) (rate, convert, currencies, vat gin.HandlerFunc)
Handlers returns the four route handlers without registering them, letting callers mount them under custom paths or middleware chains.
Types ¶
type Client ¶
Client is the UniRate client type this adapter wraps. It is an alias for the underlying UniRate Go client.
Click to show internal directories.
Click to hide internal directories.