Skip to content

Commit

Permalink
feat: rename some packages
Browse files Browse the repository at this point in the history
  • Loading branch information
linstohu committed Dec 25, 2023
1 parent 4d69e01 commit 1dad29c
Show file tree
Hide file tree
Showing 18 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion bitfinex/restauth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package bitfinexrestauth
package restauth

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion bitfinex/restauth/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package bitfinexrestauth
package restauth

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion bitfinex/restauth/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package bitfinexrestauth
package restauth

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion bitfinex/restpub/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package bitfinexrestpub
package restpub

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion bitfinex/restpub/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package bitfinexrestpub
package restpub

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion bitfinex/restpub/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package bitfinexrestpub
package restpub

import (
"context"
Expand Down
16 changes: 8 additions & 8 deletions mexc/contract/account/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -46,15 +46,15 @@ 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)
if err != nil {
return nil, err
}

cli, err := ctutils.NewContractClient(&ctutils.ContractClientCfg{
cli, err := utils.NewContractClient(&utils.ContractClientCfg{
Debug: cfg.Debug,
Logger: cfg.Logger,
BaseURL: cfg.BaseURL,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions mexc/contract/account/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 8 additions & 8 deletions mexc/contract/marketdata/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions mexc/contract/marketdata/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})

Expand Down
2 changes: 1 addition & 1 deletion mexc/contract/utils/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package ctutils
package utils

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion mexc/contract/utils/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package ctutils
package utils

type HTTPRequest struct {
BaseURL string
Expand Down
2 changes: 1 addition & 1 deletion mexc/contract/utils/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package ctutils
package utils

var (
BaseURL = "https://contract.mexc.com"
Expand Down
2 changes: 1 addition & 1 deletion okx/tradingaccount/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package publicdata
package tradingaccount

import (
"context"
Expand Down
6 changes: 3 additions & 3 deletions okx/tradingaccount/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@
* limitations under the License.
*/

package publicdata
package tradingaccount

import (
"context"
"os"
"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"),
Expand Down
2 changes: 1 addition & 1 deletion okx/utils/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package okxutils
package utils

type Response struct {
Code string `json:"code"`
Expand Down
2 changes: 1 addition & 1 deletion okx/utils/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package okxutils
package utils

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion okx/utils/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package okxutils
package utils

var (
RestURL = "https://www.okx.com"
Expand Down

0 comments on commit 1dad29c

Please sign in to comment.