Skip to content

Commit

Permalink
Fix field alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
ksysoev committed Aug 17, 2024
1 parent 106b3c8 commit 77bfe8b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 23 deletions.
32 changes: 16 additions & 16 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,27 @@ import (

// DerivAPI is the main struct for the DerivAPI client.
type DerivAPI struct {
Origin *url.URL // The origin URL for the DerivAPI server
Endpoint *url.URL // The WebSocket endpoint URL for the DerivAPI server
AppID int // The app ID for the DerivAPI server
Lang string // The language code (ISO 639-1) for the DerivAPI server
ws *websocket.Conn // The WebSocket connection to the DerivAPI server
lastRequestID int64 // The last request ID used for the DerivAPI server
TimeOut time.Duration // The timeout duration for the DerivAPI server api calls
connectionLock sync.Mutex // A lock for the DerivAPI server connection
reqChan chan ApiReqest // A channel for sending requests to the DerivAPI server
closingChan chan int // A channel for closing the DerivAPI server connection
keepAlive bool // A flag to keep the connection alive
keepAliveOnDisconnect chan bool // A channel to keep the connection alive
keepAliveInterval time.Duration // The interval to send ping requests
debugEnabled bool // A flag to print debug messages
reqChan chan ApiReqest
Endpoint *url.URL
keepAliveOnDisconnect chan bool
Origin *url.URL
ws *websocket.Conn
closingChan chan int
Lang string
TimeOut time.Duration
lastRequestID int64
AppID int
keepAliveInterval time.Duration
connectionLock sync.Mutex
keepAlive bool
debugEnabled bool
}

// ApiReqest is an interface for all API requests.
type ApiReqest struct {
id int
msg []byte
respChan chan []byte
msg []byte
id int
}

type APIResponseReqID struct {
Expand Down
7 changes: 2 additions & 5 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@ import (

// APIError represents an error returned by the Deriv API service.
type APIError struct {
// Code is a string representing the error code returned by the Deriv API service.
Code string `json:"code"`
// Message is a human-readable string describing the error.
Message string `json:"message"`
// Details is a map of additional error details.
Details map[string]interface{} `json:"details"`
Code string `json:"code"`
Message string `json:"message"`
}

// Error returns the error message associated with the APIError.
Expand Down
4 changes: 2 additions & 2 deletions subscriptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import (
type Subsciption[initResp any, Resp any] struct {
API *DerivAPI
Stream chan Resp
reqID int
isActive bool
SubsciptionID string
reqID int
statusLock sync.Mutex
isActive bool
}

type SubscriptionResponse struct {
Expand Down

0 comments on commit 77bfe8b

Please sign in to comment.