github.com/vmpartner/bitmex@v1.1.0/bitmex/bitmex.go (about)

     1  package bitmex
     2  
     3  import (
     4  	"encoding/json"
     5  )
     6  
     7  type Response struct {
     8  	Success   bool        `json:"success,omitempty"`
     9  	Subscribe string      `json:"subscribe,omitempty"`
    10  	Request   interface{} `json:"request,omitempty"`
    11  	Table     string      `json:"table,omitempty"`
    12  	Action    string      `json:"action,omitempty"`
    13  	Data      interface{} `json:"data,omitempty"`
    14  }
    15  
    16  func DecodeMessage(message []byte) (Response, error) {
    17  	var res Response
    18  	err := json.Unmarshal(message, &res)
    19  
    20  	return res, err
    21  }