From 1dad29c7f3ec58617fbd038f73c7947954bc3165 Mon Sep 17 00:00:00 2001 From: linstohu Date: Tue, 26 Dec 2023 00:56:42 +0800 Subject: [PATCH] feat: rename some packages --- bitfinex/restauth/api.go | 2 +- bitfinex/restauth/client.go | 2 +- bitfinex/restauth/client_test.go | 2 +- bitfinex/restpub/api.go | 2 +- bitfinex/restpub/client.go | 2 +- bitfinex/restpub/client_test.go | 2 +- mexc/contract/account/client.go | 16 ++++++++-------- mexc/contract/account/client_test.go | 6 +++--- mexc/contract/marketdata/client.go | 16 ++++++++-------- mexc/contract/marketdata/client_test.go | 6 +++--- mexc/contract/utils/client.go | 2 +- mexc/contract/utils/request.go | 2 +- mexc/contract/utils/vars.go | 2 +- okx/tradingaccount/client.go | 2 +- okx/tradingaccount/client_test.go | 6 +++--- okx/utils/request.go | 2 +- okx/utils/rest.go | 2 +- okx/utils/vars.go | 2 +- 18 files changed, 38 insertions(+), 38 deletions(-) diff --git a/bitfinex/restauth/api.go b/bitfinex/restauth/api.go index 27623e7..f08eaeb 100644 --- a/bitfinex/restauth/api.go +++ b/bitfinex/restauth/api.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package bitfinexrestauth +package restauth import ( "context" diff --git a/bitfinex/restauth/client.go b/bitfinex/restauth/client.go index 6016041..c5c22c1 100644 --- a/bitfinex/restauth/client.go +++ b/bitfinex/restauth/client.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package bitfinexrestauth +package restauth import ( "bytes" diff --git a/bitfinex/restauth/client_test.go b/bitfinex/restauth/client_test.go index 5e10810..695a93c 100644 --- a/bitfinex/restauth/client_test.go +++ b/bitfinex/restauth/client_test.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package bitfinexrestauth +package restauth import ( "context" diff --git a/bitfinex/restpub/api.go b/bitfinex/restpub/api.go index ece1833..72bd38e 100644 --- a/bitfinex/restpub/api.go +++ b/bitfinex/restpub/api.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package bitfinexrestpub +package restpub import ( "context" diff --git a/bitfinex/restpub/client.go b/bitfinex/restpub/client.go index 72978f9..40f82ac 100644 --- a/bitfinex/restpub/client.go +++ b/bitfinex/restpub/client.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package bitfinexrestpub +package restpub import ( "bytes" diff --git a/bitfinex/restpub/client_test.go b/bitfinex/restpub/client_test.go index 52dc943..684ec80 100644 --- a/bitfinex/restpub/client_test.go +++ b/bitfinex/restpub/client_test.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package bitfinexrestpub +package restpub import ( "context" diff --git a/mexc/contract/account/client.go b/mexc/contract/account/client.go index 71d690f..40d1332 100644 --- a/mexc/contract/account/client.go +++ b/mexc/contract/account/client.go @@ -25,11 +25,11 @@ import ( "github.com/go-playground/validator" "github.com/linstohu/nexapi/mexc/contract/account/types" - ctutils "github.com/linstohu/nexapi/mexc/contract/utils" + "github.com/linstohu/nexapi/mexc/contract/utils" ) type ContractAccountClient struct { - *ctutils.ContractClient + *utils.ContractClient // validate struct fields validate *validator.Validate @@ -46,7 +46,7 @@ type ContractAccountClientCfg struct { RecvWindow int } -func NewContractAccountClient(cfg *ctutils.ContractClientCfg) (*ContractAccountClient, error) { +func NewContractAccountClient(cfg *utils.ContractClientCfg) (*ContractAccountClient, error) { validator := validator.New() err := validator.Struct(cfg) @@ -54,7 +54,7 @@ func NewContractAccountClient(cfg *ctutils.ContractClientCfg) (*ContractAccountC return nil, err } - cli, err := ctutils.NewContractClient(&ctutils.ContractClientCfg{ + cli, err := utils.NewContractClient(&utils.ContractClientCfg{ Debug: cfg.Debug, Logger: cfg.Logger, BaseURL: cfg.BaseURL, @@ -73,7 +73,7 @@ func NewContractAccountClient(cfg *ctutils.ContractClientCfg) (*ContractAccountC } func (c *ContractAccountClient) GetAccountAsset(ctx context.Context) (*types.GetAccountAsset, error) { - req := ctutils.HTTPRequest{ + req := utils.HTTPRequest{ BaseURL: c.GetBaseURL(), Path: "/api/v1/private/account/assets", Method: http.MethodGet, @@ -106,7 +106,7 @@ func (c *ContractAccountClient) GetOpenPositions(ctx context.Context, param type return nil, err } - req := ctutils.HTTPRequest{ + req := utils.HTTPRequest{ BaseURL: c.GetBaseURL(), Path: "/api/v1/private/position/open_positions", Method: http.MethodGet, @@ -140,7 +140,7 @@ func (c *ContractAccountClient) GetPositionLeverage(ctx context.Context, param t return nil, err } - req := ctutils.HTTPRequest{ + req := utils.HTTPRequest{ BaseURL: c.GetBaseURL(), Path: "/api/v1/private/position/leverage", Method: http.MethodGet, @@ -174,7 +174,7 @@ func (c *ContractAccountClient) SetPositionLeverage(ctx context.Context, param t return nil, err } - req := ctutils.HTTPRequest{ + req := utils.HTTPRequest{ BaseURL: c.GetBaseURL(), Path: "/api/v1/private/position/change_leverage", Method: http.MethodPost, diff --git a/mexc/contract/account/client_test.go b/mexc/contract/account/client_test.go index 3fca630..2bce45c 100644 --- a/mexc/contract/account/client_test.go +++ b/mexc/contract/account/client_test.go @@ -22,13 +22,13 @@ import ( "os" "testing" - ctutils "github.com/linstohu/nexapi/mexc/contract/utils" + "github.com/linstohu/nexapi/mexc/contract/utils" "github.com/stretchr/testify/assert" ) func testNewAccountClient(t *testing.T) *ContractAccountClient { - cli, err := NewContractAccountClient(&ctutils.ContractClientCfg{ - BaseURL: ctutils.BaseURL, + cli, err := NewContractAccountClient(&utils.ContractClientCfg{ + BaseURL: utils.BaseURL, Key: os.Getenv("MEXC_KEY"), Secret: os.Getenv("MEXC_SECRET"), Debug: true, diff --git a/mexc/contract/marketdata/client.go b/mexc/contract/marketdata/client.go index 3362ae4..3205fb2 100644 --- a/mexc/contract/marketdata/client.go +++ b/mexc/contract/marketdata/client.go @@ -24,18 +24,18 @@ import ( "github.com/go-playground/validator" "github.com/linstohu/nexapi/mexc/contract/marketdata/types" - ctutils "github.com/linstohu/nexapi/mexc/contract/utils" + "github.com/linstohu/nexapi/mexc/contract/utils" ) type ContractMarketDataClient struct { - *ctutils.ContractClient + *utils.ContractClient // validate struct fields validate *validator.Validate } -func NewContractMarketDataClient(cfg *ctutils.ContractClientCfg) (*ContractMarketDataClient, error) { - cli, err := ctutils.NewContractClient(cfg) +func NewContractMarketDataClient(cfg *utils.ContractClientCfg) (*ContractMarketDataClient, error) { + cli, err := utils.NewContractClient(cfg) if err != nil { return nil, err } @@ -49,7 +49,7 @@ func NewContractMarketDataClient(cfg *ctutils.ContractClientCfg) (*ContractMarke } func (s *ContractMarketDataClient) GetServerTime(ctx context.Context) (*types.ServerTime, error) { - req := ctutils.HTTPRequest{ + req := utils.HTTPRequest{ BaseURL: s.GetBaseURL(), Path: "/api/v1/contract/ping", Method: http.MethodGet, @@ -75,7 +75,7 @@ func (s *ContractMarketDataClient) GetServerTime(ctx context.Context) (*types.Se } func (s *ContractMarketDataClient) GetContractDetails(ctx context.Context, param types.GetContractDetailsParams) (*types.GetContractDetailsResp, error) { - req := ctutils.HTTPRequest{ + req := utils.HTTPRequest{ BaseURL: s.GetBaseURL(), Path: "/api/v1/contract/detail", Method: http.MethodGet, @@ -107,7 +107,7 @@ func (s *ContractMarketDataClient) GetTickerForSymbol(ctx context.Context, param return nil, err } - req := ctutils.HTTPRequest{ + req := utils.HTTPRequest{ BaseURL: s.GetBaseURL(), Path: "/api/v1/contract/ticker", Method: http.MethodGet, @@ -138,7 +138,7 @@ func (s *ContractMarketDataClient) GetTickerForSymbol(ctx context.Context, param } func (s *ContractMarketDataClient) GetTickerForAllSymbols(ctx context.Context) (*types.GetAllTickersResp, error) { - req := ctutils.HTTPRequest{ + req := utils.HTTPRequest{ BaseURL: s.GetBaseURL(), Path: "/api/v1/contract/ticker", Method: http.MethodGet, diff --git a/mexc/contract/marketdata/client_test.go b/mexc/contract/marketdata/client_test.go index 6934cf1..0327c45 100644 --- a/mexc/contract/marketdata/client_test.go +++ b/mexc/contract/marketdata/client_test.go @@ -22,13 +22,13 @@ import ( "testing" "github.com/linstohu/nexapi/mexc/contract/marketdata/types" - ctutils "github.com/linstohu/nexapi/mexc/contract/utils" + "github.com/linstohu/nexapi/mexc/contract/utils" "github.com/stretchr/testify/assert" ) func testNewContractMarketDataClient(t *testing.T) *ContractMarketDataClient { - cli, err := NewContractMarketDataClient(&ctutils.ContractClientCfg{ - BaseURL: ctutils.BaseURL, + cli, err := NewContractMarketDataClient(&utils.ContractClientCfg{ + BaseURL: utils.BaseURL, Debug: true, }) diff --git a/mexc/contract/utils/client.go b/mexc/contract/utils/client.go index 4e58938..bd9d328 100644 --- a/mexc/contract/utils/client.go +++ b/mexc/contract/utils/client.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package ctutils +package utils import ( "bytes" diff --git a/mexc/contract/utils/request.go b/mexc/contract/utils/request.go index f8debd9..60e3dff 100644 --- a/mexc/contract/utils/request.go +++ b/mexc/contract/utils/request.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package ctutils +package utils type HTTPRequest struct { BaseURL string diff --git a/mexc/contract/utils/vars.go b/mexc/contract/utils/vars.go index 3766c42..7908df6 100644 --- a/mexc/contract/utils/vars.go +++ b/mexc/contract/utils/vars.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package ctutils +package utils var ( BaseURL = "https://contract.mexc.com" diff --git a/okx/tradingaccount/client.go b/okx/tradingaccount/client.go index 6964da7..edf7d44 100644 --- a/okx/tradingaccount/client.go +++ b/okx/tradingaccount/client.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package publicdata +package tradingaccount import ( "context" diff --git a/okx/tradingaccount/client_test.go b/okx/tradingaccount/client_test.go index e247b12..10d7a6d 100644 --- a/okx/tradingaccount/client_test.go +++ b/okx/tradingaccount/client_test.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package publicdata +package tradingaccount import ( "context" @@ -23,14 +23,14 @@ import ( "testing" "github.com/linstohu/nexapi/okx/tradingaccount/types" - okxutils "github.com/linstohu/nexapi/okx/utils" + "github.com/linstohu/nexapi/okx/utils" "github.com/stretchr/testify/assert" ) func testNewTradingAccountClient(t *testing.T) *TradingAccountClient { cli, err := NewTradingAccountClient(&TradingAccountClientCfg{ Debug: true, - BaseURL: okxutils.RestURL, + BaseURL: utils.RestURL, Key: os.Getenv("OKX_KEY"), Secret: os.Getenv("OKX_SECRET"), Passphrase: os.Getenv("OKX_PASS"), diff --git a/okx/utils/request.go b/okx/utils/request.go index f34620d..2fdd560 100644 --- a/okx/utils/request.go +++ b/okx/utils/request.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package okxutils +package utils type Response struct { Code string `json:"code"` diff --git a/okx/utils/rest.go b/okx/utils/rest.go index 7a4df55..42456ad 100644 --- a/okx/utils/rest.go +++ b/okx/utils/rest.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package okxutils +package utils import ( "bytes" diff --git a/okx/utils/vars.go b/okx/utils/vars.go index 5e78e99..773c53f 100644 --- a/okx/utils/vars.go +++ b/okx/utils/vars.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package okxutils +package utils var ( RestURL = "https://www.okx.com"