Skip to content

Commit

Permalink
Merge pull request #1 from kitloong/feature/rename
Browse files Browse the repository at this point in the history
Use package name `currconv`
  • Loading branch information
kitloong authored Feb 16, 2023
2 parents 3c2695a + e867820 commit 4ac579e
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 20 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]",
Expand All @@ -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"},
})

Expand All @@ -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"},
})

Expand Down Expand Up @@ -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"},
})

Expand All @@ -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),
})
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand All @@ -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
// &{
Expand All @@ -250,7 +250,7 @@ currencies, err := currAPI.Currencies()
Returns a list of countries:

```go
countries, err := currAPI.Countries()
countries, err := api.Countries()

// countries
// &{
Expand Down Expand Up @@ -281,7 +281,7 @@ countries, err := currAPI.Countries()
Returns your current API usage:

```go
usage, err := currAPI.Usage()
usage, err := api.Usage()

// usage
// &{
Expand Down
2 changes: 1 addition & 1 deletion api/api.go → api.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package api
package currconv

import (
"encoding/json"
Expand Down
2 changes: 1 addition & 1 deletion api/api_test.go → api_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package api
package currconv

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion api/convert.go → convert.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package api
package currconv

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion api/convert_test.go → convert_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package api
package currconv

import (
"encoding/json"
Expand Down
2 changes: 1 addition & 1 deletion api/country.go → country.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package api
package currconv

import "net/url"

Expand Down
2 changes: 1 addition & 1 deletion api/country_test.go → country_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package api
package currconv

import (
"encoding/json"
Expand Down
2 changes: 1 addition & 1 deletion api/currency.go → currency.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package api
package currconv

import (
"net/url"
Expand Down
2 changes: 1 addition & 1 deletion api/currency_test.go → currency_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package api
package currconv

import (
"encoding/json"
Expand Down
2 changes: 1 addition & 1 deletion api/usage.go → usage.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package api
package currconv

import (
"net/url"
Expand Down
2 changes: 1 addition & 1 deletion api/usage_test.go → usage_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package api
package currconv

import (
"encoding/json"
Expand Down

0 comments on commit 4ac579e

Please sign in to comment.