package bybit_connector import ( "context" "encoding/json" "github.com/wuhewuhe/bybit.go.api/handlers" "net/http" ) type LendingServiceClient struct { c *Client params map[string]interface{} } func (s *LendingServiceClient) GetC2cLendingCoinInfo(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) { if err = handlers.ValidateParams(s.params); err != nil { return nil, err } r := &request{ method: http.MethodGet, endpoint: "/v5/lending/info", secType: secTypeSigned, } r.setParams(s.params) data, err := s.c.callAPI(ctx, r, opts...) if err != nil { return nil, err } res = new(ServerResponse) err = json.Unmarshal(data, res) if err != nil { return nil, err } return res, nil } func (s *LendingServiceClient) GetC2cLendingOrders(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) { if err = handlers.ValidateParams(s.params); err != nil { return nil, err } r := &request{ method: http.MethodGet, endpoint: "/v5/lending/history-order", secType: secTypeSigned, } r.setParams(s.params) data, err := s.c.callAPI(ctx, r, opts...) if err != nil { return nil, err } res = new(ServerResponse) err = json.Unmarshal(data, res) if err != nil { return nil, err } return res, nil } func (s *LendingServiceClient) GetC2cLendingAccountInfo(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) { if err = handlers.ValidateParams(s.params); err != nil { return nil, err } r := &request{ method: http.MethodGet, endpoint: "/v5/lending/account", secType: secTypeSigned, } r.setParams(s.params) data, err := s.c.callAPI(ctx, r, opts...) if err != nil { return nil, err } res = new(ServerResponse) err = json.Unmarshal(data, res) if err != nil { return nil, err } return res, nil } func (s *LendingServiceClient) C2cDepositFunds(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) { if err = handlers.ValidateParams(s.params); err != nil { return nil, err } r := &request{ method: http.MethodPost, endpoint: "/v5/lending/purchase", secType: secTypeSigned, } r.setParams(s.params) data, err := s.c.callAPI(ctx, r, opts...) if err != nil { return nil, err } res = new(ServerResponse) err = json.Unmarshal(data, res) if err != nil { return nil, err } return res, nil } func (s *LendingServiceClient) C2cRedeemFunds(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) { if err = handlers.ValidateParams(s.params); err != nil { return nil, err } r := &request{ method: http.MethodPost, endpoint: "/v5/lending/redeem", secType: secTypeSigned, } r.setParams(s.params) data, err := s.c.callAPI(ctx, r, opts...) if err != nil { return nil, err } res = new(ServerResponse) err = json.Unmarshal(data, res) if err != nil { return nil, err } return res, nil } func (s *LendingServiceClient) C2cCancelRedeemFunds(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) { if err = handlers.ValidateParams(s.params); err != nil { return nil, err } r := &request{ method: http.MethodPost, endpoint: "/v5/lending/redeem-cancel", secType: secTypeSigned, } r.setParams(s.params) data, err := s.c.callAPI(ctx, r, opts...) if err != nil { return nil, err } res = new(ServerResponse) err = json.Unmarshal(data, res) if err != nil { return nil, err } return res, nil }