From 2c363df75632962d94697dd33b6fc02802760dd1 Mon Sep 17 00:00:00 2001 From: Julian Toledano Date: Mon, 30 Dec 2024 10:35:13 +0100 Subject: [PATCH] update: go path to v2 --- assetPlatforms.go | 2 +- categories.go | 2 +- client.go | 2 +- coins.go | 4 ++-- coins/history.go | 2 +- coins/id.go | 2 +- coins/markets.go | 2 +- coins/statusUpdates.go | 2 +- coins/tickers.go | 2 +- companies.go | 2 +- contract.go | 4 ++-- contract/contractAddress.go | 2 +- derivatives.go | 2 +- examples/bitcoinPrice.go | 5 +++-- examples/checkTrending.go | 5 +++-- examples/pro.go | 5 +++-- exchangeRates.go | 2 +- exchanges.go | 2 +- global.go | 2 +- global/global.go | 2 +- go.mod | 7 +------ nfts.go | 2 +- search.go | 2 +- simple.go | 2 +- test/assetPlatforms_test.go | 3 ++- test/categories_test.go | 3 ++- test/coins_test.go | 2 +- test/companies_test.go | 3 ++- test/contract_test.go | 2 +- test/derivatives_test.go | 2 +- test/exchangeRates_test.go | 2 +- test/exchanges_test.go | 3 ++- test/global_test.go | 2 +- test/goingecko_test.go | 2 +- test/nfts_test.go | 3 ++- test/search_test.go | 3 ++- test/simple_test.go | 2 +- test/trending_test.go | 2 +- trending.go | 2 +- 39 files changed, 53 insertions(+), 49 deletions(-) diff --git a/assetPlatforms.go b/assetPlatforms.go index dc4d8a2..0e24069 100644 --- a/assetPlatforms.go +++ b/assetPlatforms.go @@ -6,7 +6,7 @@ import ( "fmt" "net/url" - "github.com/JulianToledano/goingecko/assetPlatforms" + "github.com/JulianToledano/goingecko/v2/assetPlatforms" ) func (c *Client) AssetPlatforms(ctx context.Context, filter string) (*assetPlatforms.AssetPlatforms, error) { diff --git a/categories.go b/categories.go index 051f3a7..2d1f391 100644 --- a/categories.go +++ b/categories.go @@ -6,7 +6,7 @@ import ( "fmt" "net/url" - "github.com/JulianToledano/goingecko/categories" + "github.com/JulianToledano/goingecko/v2/categories" ) // CategoriesList List all categories diff --git a/client.go b/client.go index 650105a..99c3dff 100644 --- a/client.go +++ b/client.go @@ -7,7 +7,7 @@ import ( "io" "net/http" - "github.com/JulianToledano/goingecko/ping" + "github.com/JulianToledano/goingecko/v2/ping" ) const apiHeader = "x-cg-demo-api-key" diff --git a/coins.go b/coins.go index 19fd698..d0a0146 100644 --- a/coins.go +++ b/coins.go @@ -8,8 +8,8 @@ import ( "strconv" "strings" - "github.com/JulianToledano/goingecko/coins" - "github.com/JulianToledano/goingecko/types" + "github.com/JulianToledano/goingecko/v2/coins" + "github.com/JulianToledano/goingecko/v2/types" ) func (c *Client) CoinsList(ctx context.Context) ([]*coins.CoinInfo, error) { diff --git a/coins/history.go b/coins/history.go index 9aa8f45..edf5142 100644 --- a/coins/history.go +++ b/coins/history.go @@ -1,6 +1,6 @@ package coins -import "github.com/JulianToledano/goingecko/types" +import "github.com/JulianToledano/goingecko/v2/types" type History struct { ID string `json:"id"` diff --git a/coins/id.go b/coins/id.go index 3463281..37ba6b0 100644 --- a/coins/id.go +++ b/coins/id.go @@ -1,6 +1,6 @@ package coins -import "github.com/JulianToledano/goingecko/types" +import "github.com/JulianToledano/goingecko/v2/types" type CoinID struct { ID string `json:"id"` diff --git a/coins/markets.go b/coins/markets.go index 3f49df7..7c092e1 100644 --- a/coins/markets.go +++ b/coins/markets.go @@ -1,6 +1,6 @@ package coins -import "github.com/JulianToledano/goingecko/types" +import "github.com/JulianToledano/goingecko/v2/types" type Market struct { ID string `json:"ID"` diff --git a/coins/statusUpdates.go b/coins/statusUpdates.go index 8fafa7e..2ae7e0c 100644 --- a/coins/statusUpdates.go +++ b/coins/statusUpdates.go @@ -1,6 +1,6 @@ package coins -import "github.com/JulianToledano/goingecko/types" +import "github.com/JulianToledano/goingecko/v2/types" type StatusUpdates struct { StatusUpdates []Status `json:"status_updates"` diff --git a/coins/tickers.go b/coins/tickers.go index f3c90a8..4c187df 100644 --- a/coins/tickers.go +++ b/coins/tickers.go @@ -1,6 +1,6 @@ package coins -import "github.com/JulianToledano/goingecko/types" +import "github.com/JulianToledano/goingecko/v2/types" type Tickers struct { Name string `json:"name"` diff --git a/companies.go b/companies.go index 6785c55..c9dcddd 100644 --- a/companies.go +++ b/companies.go @@ -5,7 +5,7 @@ import ( "encoding/json" "fmt" - "github.com/JulianToledano/goingecko/companies" + "github.com/JulianToledano/goingecko/v2/companies" ) func (c *Client) PublicTreasuryCoinId(ctx context.Context, id string) (*companies.Treasury, error) { diff --git a/contract.go b/contract.go index 8c170e0..e599dab 100644 --- a/contract.go +++ b/contract.go @@ -6,8 +6,8 @@ import ( "fmt" "net/url" - "github.com/JulianToledano/goingecko/contract" - "github.com/JulianToledano/goingecko/types" + "github.com/JulianToledano/goingecko/v2/contract" + "github.com/JulianToledano/goingecko/v2/types" ) func (c *Client) ContractInfo(ctx context.Context, id, contractAddress string) (*contract.ContractAddressInfo, error) { diff --git a/contract/contractAddress.go b/contract/contractAddress.go index 44c2ede..8a54aed 100644 --- a/contract/contractAddress.go +++ b/contract/contractAddress.go @@ -1,6 +1,6 @@ package contract -import "github.com/JulianToledano/goingecko/types" +import "github.com/JulianToledano/goingecko/v2/types" // TODO: missing a lot of info type ContractAddressInfo struct { diff --git a/derivatives.go b/derivatives.go index 199b995..a17fd91 100644 --- a/derivatives.go +++ b/derivatives.go @@ -6,7 +6,7 @@ import ( "fmt" "net/url" - "github.com/JulianToledano/goingecko/derivatives" + "github.com/JulianToledano/goingecko/v2/derivatives" ) // Derivatives List all derivative tickers. diff --git a/examples/bitcoinPrice.go b/examples/bitcoinPrice.go index 53a3ffd..40f0bb8 100644 --- a/examples/bitcoinPrice.go +++ b/examples/bitcoinPrice.go @@ -1,16 +1,17 @@ package main import ( + "context" "fmt" - "github.com/JulianToledano/goingecko" + "github.com/JulianToledano/goingecko/v2" ) func main() { cgClient := goingecko.NewClient(nil, "") defer cgClient.Close() - data, err := cgClient.CoinsId("bitcoin", true, true, true, false, false, false) + data, err := cgClient.CoinsId(context.Background(), "bitcoin", true, true, true, false, false, false) if err != nil { fmt.Print("Somethig went wrong...") return diff --git a/examples/checkTrending.go b/examples/checkTrending.go index d6b9a03..e64ad33 100644 --- a/examples/checkTrending.go +++ b/examples/checkTrending.go @@ -1,9 +1,10 @@ package main import ( + "context" "fmt" - "github.com/JulianToledano/goingecko" + "github.com/JulianToledano/goingecko/v2" ) func main() { @@ -16,7 +17,7 @@ func main() { return } for _, coin := range treding.Coins { - coinData, err := cgClient.CoinsId(coin.Item.ID, false, false, true, false, false, false) + coinData, err := cgClient.CoinsId(context.Background(), coin.Item.ID, false, false, true, false, false, false) if err != nil { fmt.Printf("Error: %v", err) } diff --git a/examples/pro.go b/examples/pro.go index c3e3554..eeccbe2 100644 --- a/examples/pro.go +++ b/examples/pro.go @@ -1,16 +1,17 @@ package main import ( + "context" "fmt" - "github.com/JulianToledano/goingecko" + "github.com/JulianToledano/goingecko/v2" ) func main() { cgClient := goingecko.NewClient(nil, "pro api key", true) defer cgClient.Close() - data, err := cgClient.CoinsId("bitcoin", true, true, true, false, false, false) + data, err := cgClient.CoinsId(context.Background(), "bitcoin", true, true, true, false, false, false) if err != nil { fmt.Print("Somethig went wrong...") return diff --git a/exchangeRates.go b/exchangeRates.go index ebeeb71..7f24367 100644 --- a/exchangeRates.go +++ b/exchangeRates.go @@ -5,7 +5,7 @@ import ( "encoding/json" "fmt" - "github.com/JulianToledano/goingecko/exchangeRates" + "github.com/JulianToledano/goingecko/v2/exchangeRates" ) func (c *Client) ExchangeRates(ctx context.Context) (*exchangeRates.Rates, error) { diff --git a/exchanges.go b/exchanges.go index a41fe1d..403a180 100644 --- a/exchanges.go +++ b/exchanges.go @@ -7,7 +7,7 @@ import ( "fmt" "net/url" - "github.com/JulianToledano/goingecko/exchanges" + "github.com/JulianToledano/goingecko/v2/exchanges" ) // Exchanges List all exchanges diff --git a/global.go b/global.go index b53fe53..6f44545 100644 --- a/global.go +++ b/global.go @@ -5,7 +5,7 @@ import ( "encoding/json" "fmt" - "github.com/JulianToledano/goingecko/global" + "github.com/JulianToledano/goingecko/v2/global" ) func (c *Client) Global(ctx context.Context) (*global.Global, error) { diff --git a/global/global.go b/global/global.go index e73e284..f12865a 100644 --- a/global/global.go +++ b/global/global.go @@ -1,6 +1,6 @@ package global -import "github.com/JulianToledano/goingecko/types" +import "github.com/JulianToledano/goingecko/v2/types" type Global struct { Data data `json:"data"` diff --git a/go.mod b/go.mod index db47873..7690800 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,3 @@ -module github.com/JulianToledano/goingecko +module github.com/JulianToledano/goingecko/v2 go 1.21 - -retract ( - v1.0.0 // Published accidentally. - v1.0.1 // Published accidentally. -) \ No newline at end of file diff --git a/nfts.go b/nfts.go index 63bd104..705045d 100644 --- a/nfts.go +++ b/nfts.go @@ -6,7 +6,7 @@ import ( "fmt" "net/url" - "github.com/JulianToledano/goingecko/nfts" + "github.com/JulianToledano/goingecko/v2/nfts" ) // NftsList Use this to obtain all the NFT ids in order to make API calls, paginated to 100 items. diff --git a/search.go b/search.go index e64d5ef..74797e5 100644 --- a/search.go +++ b/search.go @@ -6,7 +6,7 @@ import ( "fmt" "net/url" - "github.com/JulianToledano/goingecko/search" + "github.com/JulianToledano/goingecko/v2/search" ) // Search for coins, categories and markets listed on CoinGecko ordered by largest Market Cap first. diff --git a/simple.go b/simple.go index 0355f98..4859459 100644 --- a/simple.go +++ b/simple.go @@ -7,7 +7,7 @@ import ( "net/url" "strconv" - "github.com/JulianToledano/goingecko/simple" + "github.com/JulianToledano/goingecko/v2/simple" ) func (c *Client) SimplePrice(ctx context.Context, ids, vsCurrencies string, includeMarketCap, includeDayVolume, includeDayChange, includeLastTimeUpdated bool) (simple.Price, error) { diff --git a/test/assetPlatforms_test.go b/test/assetPlatforms_test.go index b7b7cfb..94a72e4 100644 --- a/test/assetPlatforms_test.go +++ b/test/assetPlatforms_test.go @@ -2,8 +2,9 @@ package test import ( "context" - "github.com/JulianToledano/goingecko" "testing" + + "github.com/JulianToledano/goingecko/v2" ) func TestAssetPlatforms(t *testing.T) { diff --git a/test/categories_test.go b/test/categories_test.go index 9d44093..84d070c 100644 --- a/test/categories_test.go +++ b/test/categories_test.go @@ -2,8 +2,9 @@ package test import ( "context" - "github.com/JulianToledano/goingecko" "testing" + + "github.com/JulianToledano/goingecko/v2" ) func TestCategoriesList(t *testing.T) { diff --git a/test/coins_test.go b/test/coins_test.go index 181eb2a..9ebe335 100644 --- a/test/coins_test.go +++ b/test/coins_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/JulianToledano/goingecko" + "github.com/JulianToledano/goingecko/v2" ) func TestCoinsList(t *testing.T) { diff --git a/test/companies_test.go b/test/companies_test.go index 15e8967..c388c89 100644 --- a/test/companies_test.go +++ b/test/companies_test.go @@ -2,8 +2,9 @@ package test import ( "context" - "github.com/JulianToledano/goingecko" "testing" + + "github.com/JulianToledano/goingecko/v2" ) func TestPublicTreasuryCoinId(t *testing.T) { diff --git a/test/contract_test.go b/test/contract_test.go index 26630f0..568bf06 100644 --- a/test/contract_test.go +++ b/test/contract_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/JulianToledano/goingecko" + "github.com/JulianToledano/goingecko/v2" ) func TestContractInfo(t *testing.T) { diff --git a/test/derivatives_test.go b/test/derivatives_test.go index faf2e5b..ee854f7 100644 --- a/test/derivatives_test.go +++ b/test/derivatives_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/JulianToledano/goingecko" + "github.com/JulianToledano/goingecko/v2" ) func TestDerivatives(t *testing.T) { diff --git a/test/exchangeRates_test.go b/test/exchangeRates_test.go index 497d1d9..160c0b8 100644 --- a/test/exchangeRates_test.go +++ b/test/exchangeRates_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/JulianToledano/goingecko" + "github.com/JulianToledano/goingecko/v2" ) func TestExchangeRates(t *testing.T) { diff --git a/test/exchanges_test.go b/test/exchanges_test.go index c3119ee..214ce1e 100644 --- a/test/exchanges_test.go +++ b/test/exchanges_test.go @@ -2,8 +2,9 @@ package test import ( "context" - "github.com/JulianToledano/goingecko" "testing" + + "github.com/JulianToledano/goingecko/v2" ) func TestExchanges(t *testing.T) { diff --git a/test/global_test.go b/test/global_test.go index aee2713..c530d26 100644 --- a/test/global_test.go +++ b/test/global_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/JulianToledano/goingecko" + "github.com/JulianToledano/goingecko/v2" ) func TestGlobal(t *testing.T) { diff --git a/test/goingecko_test.go b/test/goingecko_test.go index cf7df7d..72950d6 100644 --- a/test/goingecko_test.go +++ b/test/goingecko_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/JulianToledano/goingecko" + "github.com/JulianToledano/goingecko/v2" ) func TestCoins(t *testing.T) { diff --git a/test/nfts_test.go b/test/nfts_test.go index 45b080a..7d98a2a 100644 --- a/test/nfts_test.go +++ b/test/nfts_test.go @@ -2,8 +2,9 @@ package test import ( "context" - "github.com/JulianToledano/goingecko" "testing" + + "github.com/JulianToledano/goingecko/v2" ) func TestNftsList(t *testing.T) { diff --git a/test/search_test.go b/test/search_test.go index 25e6cde..8f3a8b6 100644 --- a/test/search_test.go +++ b/test/search_test.go @@ -2,8 +2,9 @@ package test import ( "context" - "github.com/JulianToledano/goingecko" "testing" + + "github.com/JulianToledano/goingecko/v2" ) func TestSearch(t *testing.T) { diff --git a/test/simple_test.go b/test/simple_test.go index a4d64d2..c8dcdf6 100644 --- a/test/simple_test.go +++ b/test/simple_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/JulianToledano/goingecko" + "github.com/JulianToledano/goingecko/v2" ) func TestSimplePrice(t *testing.T) { diff --git a/test/trending_test.go b/test/trending_test.go index 5f09e50..566a44c 100644 --- a/test/trending_test.go +++ b/test/trending_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/JulianToledano/goingecko" + "github.com/JulianToledano/goingecko/v2" ) func TestTrending(t *testing.T) { diff --git a/trending.go b/trending.go index 024bcf6..6cc63dd 100644 --- a/trending.go +++ b/trending.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" - "github.com/JulianToledano/goingecko/trending" + "github.com/JulianToledano/goingecko/v2/trending" ) func (c *Client) Trending(ctx context.Context) (*trending.Trending, error) {