From 4fd0ba306863e36cc85f1d6db8262076387aa4cf Mon Sep 17 00:00:00 2001 From: Arthur Abelyan Date: Wed, 27 Nov 2024 02:38:49 +0100 Subject: [PATCH] feat: added getter for parameters of request (for testing needs) (#636) * feat: added getter for parameters of request (for testing needs) * fix: keep alive needed flag in conn state --------- Co-authored-by: Artur Abelian --- v2/common/websocket/client.go | 1 + v2/futures/order_cancel_service_ws.go | 4 ++++ v2/futures/order_place_service_ws.go | 4 ++++ v2/order_service_ws_create.go | 4 ++++ 4 files changed, 13 insertions(+) diff --git a/v2/common/websocket/client.go b/v2/common/websocket/client.go index e5b40590..617e59f8 100644 --- a/v2/common/websocket/client.go +++ b/v2/common/websocket/client.go @@ -349,6 +349,7 @@ func NewConnection( lastResponseMu: sync.Mutex{}, initUnderlyingWsConnFn: initUnderlyingWsConnFn, keepaliveTimeout: keepaliveTimeout, + isKeepAliveNeeded: isKeepAliveNeeded, } if isKeepAliveNeeded { diff --git a/v2/futures/order_cancel_service_ws.go b/v2/futures/order_cancel_service_ws.go index 7ff7eb68..f47bfae8 100644 --- a/v2/futures/order_cancel_service_ws.go +++ b/v2/futures/order_cancel_service_ws.go @@ -38,6 +38,10 @@ func (s *OrderCancelRequest) OrigClientOrderID(origClientOrderID string) *OrderC return s } +func (r *OrderCancelRequest) GetParams() map[string]interface{} { + return r.buildParams() +} + // buildParams builds params func (s *OrderCancelRequest) buildParams() params { m := params{ diff --git a/v2/futures/order_place_service_ws.go b/v2/futures/order_place_service_ws.go index 8cb8f66f..40605cba 100644 --- a/v2/futures/order_place_service_ws.go +++ b/v2/futures/order_place_service_ws.go @@ -180,6 +180,10 @@ type CreateOrderWsResponse struct { Error *common.APIError `json:"error,omitempty"` } +func (r *OrderPlaceWsRequest) GetParams() map[string]interface{} { + return r.buildParams() +} + // buildParams builds params func (s *OrderPlaceWsRequest) buildParams() params { m := params{ diff --git a/v2/order_service_ws_create.go b/v2/order_service_ws_create.go index 9940b035..30d93eb4 100644 --- a/v2/order_service_ws_create.go +++ b/v2/order_service_ws_create.go @@ -60,6 +60,10 @@ func NewOrderCreateWsRequest() *OrderCreateWsRequest { return &OrderCreateWsRequest{} } +func (s *OrderCreateWsRequest) GetParams() map[string]interface{} { + return s.buildParams() +} + // buildParams builds params func (s *OrderCreateWsRequest) buildParams() params { m := params{