diff --git a/README.md b/README.md index f48d9df..fe0915b 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Firstly, create an API instance with | `APIKey` | Your secret API key. | ```go -currAPI := api.NewAPI(api.Config{ +api := currconv.NewAPI(currconv.Config{ BaseURL: "https://free.currconv.com", Version: "v7", APIKey: "[KEY]", @@ -54,7 +54,7 @@ Returns the currency conversion rate with `[FROM]_[TO]` request. To convert currency from `USD` to `MYR`, construct a request struct and set `USD_MYR` to the `Q` field: ```go -convert, err := currAPI.Convert(api.ConvertRequest{ +convert, err := api.Convert(currconv.ConvertRequest{ Q: []string{"USD_MYR"}, }) @@ -77,7 +77,7 @@ convert, err := currAPI.Convert(api.ConvertRequest{ Since `Q` is a string slice, you can append more currencies to request multiple conversion in a single request: ```go -convert, err := currAPI.Convert(api.ConvertRequest{ +convert, err := api.Convert(currconv.ConvertRequest{ Q: []string{"USD_MYR", "MYR_USD"}, }) @@ -108,7 +108,7 @@ convert, err := currAPI.Convert(api.ConvertRequest{ Returns conversion result with compact mode: ```go -convert, err := currAPI.ConvertCompact(api.ConvertRequest{ +convert, err := api.ConvertCompact(currconv.ConvertRequest{ Q: []string{"USD_MYR", "MYR_USD"}, }) @@ -124,7 +124,7 @@ convert, err := currAPI.ConvertCompact(api.ConvertRequest{ Returns historical currency conversion rate data: ```go -convert, err := currAPI.ConvertHistorical(api.ConvertHistoricalRequest{ +convert, err := api.ConvertHistorical(currconv.ConvertHistoricalRequest{ Q: []string{"USD_MYR", "MYR_USD"}, Date: time.Date(2023, 2, 14, 0, 0, 0, 0, time.UTC), }) @@ -158,7 +158,7 @@ convert, err := currAPI.ConvertHistorical(api.ConvertHistoricalRequest{ Set `EndDate` to request historical data with date range: ```go -convert, err := currAPI.ConvertHistorical(api.ConvertHistoricalRequest{ +convert, err := api.ConvertHistorical(currconv.ConvertHistoricalRequest{ Q: []string{"USD_MYR", "MYR_USD"}, Date: time.Date(2023, 2, 1, 0, 0, 0, 0, time.UTC), EndDate: time.Date(2023, 2, 5, 0, 0, 0, 0, time.UTC), @@ -204,7 +204,7 @@ convert, err := currAPI.ConvertHistorical(api.ConvertHistoricalRequest{ Returns historical data with compact mode: ```go -convert, err := currAPI.ConvertHistoricalCompact(api.ConvertHistoricalRequest{ +convert, err := api.ConvertHistoricalCompact(currconv.ConvertHistoricalRequest{ Q: []string{"USD_MYR", "MYR_USD"}, Date: time.Date(2023, 2, 1, 0, 0, 0, 0, time.UTC), EndDate: time.Date(2023, 2, 5, 0, 0, 0, 0, time.UTC), @@ -225,7 +225,7 @@ convert, err := currAPI.ConvertHistoricalCompact(api.ConvertHistoricalRequest{ Returns a list of currencies: ```go -currencies, err := currAPI.Currencies() +currencies, err := api.Currencies() // currencies // &{ @@ -250,7 +250,7 @@ currencies, err := currAPI.Currencies() Returns a list of countries: ```go -countries, err := currAPI.Countries() +countries, err := api.Countries() // countries // &{ @@ -281,7 +281,7 @@ countries, err := currAPI.Countries() Returns your current API usage: ```go -usage, err := currAPI.Usage() +usage, err := api.Usage() // usage // &{ diff --git a/api/api.go b/api.go similarity index 99% rename from api/api.go rename to api.go index aad37de..fab0014 100644 --- a/api/api.go +++ b/api.go @@ -1,4 +1,4 @@ -package api +package currconv import ( "encoding/json" diff --git a/api/api_test.go b/api_test.go similarity index 98% rename from api/api_test.go rename to api_test.go index 9f290f8..8dfa6ef 100644 --- a/api/api_test.go +++ b/api_test.go @@ -1,4 +1,4 @@ -package api +package currconv import ( "testing" diff --git a/api/convert.go b/convert.go similarity index 99% rename from api/convert.go rename to convert.go index 9d5f492..5909765 100644 --- a/api/convert.go +++ b/convert.go @@ -1,4 +1,4 @@ -package api +package currconv import ( "errors" diff --git a/api/convert_test.go b/convert_test.go similarity index 99% rename from api/convert_test.go rename to convert_test.go index 935fd1f..1c27332 100644 --- a/api/convert_test.go +++ b/convert_test.go @@ -1,4 +1,4 @@ -package api +package currconv import ( "encoding/json" diff --git a/api/country.go b/country.go similarity index 97% rename from api/country.go rename to country.go index 9f50a77..0d63cce 100644 --- a/api/country.go +++ b/country.go @@ -1,4 +1,4 @@ -package api +package currconv import "net/url" diff --git a/api/country_test.go b/country_test.go similarity index 98% rename from api/country_test.go rename to country_test.go index e2e3eb7..017bef3 100644 --- a/api/country_test.go +++ b/country_test.go @@ -1,4 +1,4 @@ -package api +package currconv import ( "encoding/json" diff --git a/api/currency.go b/currency.go similarity index 96% rename from api/currency.go rename to currency.go index 9ab87d6..ef0c81e 100644 --- a/api/currency.go +++ b/currency.go @@ -1,4 +1,4 @@ -package api +package currconv import ( "net/url" diff --git a/api/currency_test.go b/currency_test.go similarity index 98% rename from api/currency_test.go rename to currency_test.go index 9e1e9ab..54f225d 100644 --- a/api/currency_test.go +++ b/currency_test.go @@ -1,4 +1,4 @@ -package api +package currconv import ( "encoding/json" diff --git a/api/usage.go b/usage.go similarity index 95% rename from api/usage.go rename to usage.go index ea6a42b..e0800e1 100644 --- a/api/usage.go +++ b/usage.go @@ -1,4 +1,4 @@ -package api +package currconv import ( "net/url" diff --git a/api/usage_test.go b/usage_test.go similarity index 98% rename from api/usage_test.go rename to usage_test.go index 9160a83..1a34023 100644 --- a/api/usage_test.go +++ b/usage_test.go @@ -1,4 +1,4 @@ -package api +package currconv import ( "encoding/json"