274 lines
6.4 KiB
Go
274 lines
6.4 KiB
Go
package bybit_connector
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"github.com/wuhewuhe/bybit.go.api/handlers"
|
|
"net/http"
|
|
)
|
|
|
|
type UserServiceClient struct {
|
|
c *Client
|
|
params map[string]interface{}
|
|
}
|
|
|
|
func (s *UserServiceClient) CreateSubMember(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/user/create-sub-member",
|
|
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 *UserServiceClient) CreateSubApiKey(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/user/create-sub-api",
|
|
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 *UserServiceClient) FreezeSubUID(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/user/frozen-sub-member",
|
|
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 *UserServiceClient) ModifyMasterAPIKey(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/user/update-api",
|
|
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 *UserServiceClient) ModifySubAPIKey(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/user/update-sub-api",
|
|
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 *UserServiceClient) DeleteSubUID(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/user/del-submember",
|
|
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 *UserServiceClient) DeleteMasterAPIKey(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/user/delete-api",
|
|
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 *UserServiceClient) DeleteSubAPIKey(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/user/delete-sub-api",
|
|
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 *UserServiceClient) GetSubUidList(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/user/query-sub-members",
|
|
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 *UserServiceClient) GetAPIKeyInfo(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) {
|
|
r := &request{
|
|
method: http.MethodGet,
|
|
endpoint: "/v5/user/query-api",
|
|
secType: secTypeSigned,
|
|
}
|
|
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 *UserServiceClient) GetUidWalletType(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/user/get-member-type",
|
|
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 *UserServiceClient) GetAffiliateUserInfo(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/user/aff-customer-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
|
|
}
|