More changes
All checks were successful
Golan Testing / testing (1.24.x, ubuntu-latest) (push) Successful in 23s
All checks were successful
Golan Testing / testing (1.24.x, ubuntu-latest) (push) Successful in 23s
This commit is contained in:
28
client.go
28
client.go
@ -40,9 +40,7 @@ func (c *Client) auth() []byte {
|
||||
"pushToken": ""}
|
||||
reqURL := MOBILE_API_VERSION + apiURLs["API_LOGIN"]
|
||||
resp := c.execute(reqURL, POST, params, "", false)
|
||||
|
||||
c.logger.Debug("AUTH HTTP OUTPUT", "body", string([]byte(resp)))
|
||||
|
||||
// c.logger.Debug("AUTH HTTP OUTPUT", "body", string([]byte(resp)))
|
||||
return resp
|
||||
}
|
||||
|
||||
@ -171,18 +169,18 @@ func (c *Client) validateSession() bool {
|
||||
// }
|
||||
reqURL := MOBILE_API_VERSION + apiURLs["API_VALIDATE_SESSION"]
|
||||
resp := c.execute(reqURL, GET, map[string]string{}, "", false)
|
||||
c.logger.Debug("http request output", "request", "GetVehicleStatus", "body", resp)
|
||||
c.logger.Debug("http request output", "request", "validateSession", "body", resp)
|
||||
|
||||
var r Response
|
||||
err := json.Unmarshal(resp, &r)
|
||||
if err != nil {
|
||||
c.logger.Error("error while parsing json", "request", "GetClimatePresets", "error", err.Error())
|
||||
c.logger.Error("error while parsing json", "request", "validateSession", "error", err.Error())
|
||||
}
|
||||
|
||||
if !r.Success {
|
||||
return false
|
||||
if r.Success {
|
||||
return true
|
||||
}
|
||||
return true
|
||||
return false
|
||||
|
||||
// result = False
|
||||
// js_resp = await self.__open(API_VALIDATE_SESSION, GET)
|
||||
@ -240,7 +238,7 @@ func New(config *config.Config) (*Client, error) {
|
||||
if err != nil {
|
||||
client.logger.Error("error while parsing json", "request", "auth", "error", err.Error())
|
||||
}
|
||||
client.logger.Debug("unmarshaled json data", "request", "auth", "type", "sessionData", "body", sd)
|
||||
// client.logger.Debug("unmarshaled json data", "request", "auth", "type", "sessionData", "body", sd)
|
||||
|
||||
if client.isRegistered {
|
||||
client.logger.Debug("Client authentication successful", "isRegistered", sd.DeviceRegistered)
|
||||
@ -250,10 +248,10 @@ func New(config *config.Config) (*Client, error) {
|
||||
client.registerDevice()
|
||||
}
|
||||
|
||||
client.logger.Debug("parcing cars assigned to the account", "quantity", len(sd.Vehicles))
|
||||
// client.logger.Debug("parsing cars assigned to the account", "quantity", len(sd.Vehicles))
|
||||
if len(sd.Vehicles) > 0 {
|
||||
for _, vehicle := range sd.Vehicles {
|
||||
client.logger.Debug("parsing car", "vin", vehicle.Vin)
|
||||
// client.logger.Debug("parsing car", "vin", vehicle.Vin)
|
||||
client.listOfVins = append(client.listOfVins, vehicle.Vin)
|
||||
}
|
||||
client.currentVin = client.listOfVins[0]
|
||||
@ -294,7 +292,7 @@ func (c *Client) SelectVehicle(vin string) VehicleData {
|
||||
"_": timestamp()}
|
||||
reqURL := MOBILE_API_VERSION + apiURLs["API_SELECT_VEHICLE"]
|
||||
resp := c.execute(reqURL, GET, params, "", false)
|
||||
c.logger.Debug("http request output", "request", "SelectVehicle", "body", resp)
|
||||
// c.logger.Debug("http request output", "request", "SelectVehicle", "body", resp)
|
||||
|
||||
var r Response
|
||||
err := json.Unmarshal(resp, &r)
|
||||
@ -308,7 +306,7 @@ func (c *Client) SelectVehicle(vin string) VehicleData {
|
||||
if err != nil {
|
||||
c.logger.Error("error while parsing json", "request", "GetClimatePresets", "error", err.Error())
|
||||
}
|
||||
c.logger.Debug("http request output", "request", "GetVehicleStatus", "body", resp)
|
||||
// c.logger.Debug("http request output", "request", "GetVehicleStatus", "body", resp)
|
||||
|
||||
return vd
|
||||
} else {
|
||||
@ -359,7 +357,7 @@ func (c *Client) GetVehicleByVIN(vin string) *Vehicle {
|
||||
"_": timestamp()}
|
||||
reqURL := MOBILE_API_VERSION + apiURLs["API_SELECT_VEHICLE"]
|
||||
resp := c.execute(reqURL, GET, params, "", false)
|
||||
c.logger.Debug("http request output", "request", "GetVehicleByVIN", "body", resp)
|
||||
// c.logger.Debug("http request output", "request", "GetVehicleByVIN", "body", resp)
|
||||
|
||||
var r Response
|
||||
err := json.Unmarshal(resp, &r)
|
||||
@ -373,7 +371,7 @@ func (c *Client) GetVehicleByVIN(vin string) *Vehicle {
|
||||
if err != nil {
|
||||
c.logger.Error("error while parsing json", "request", "GetVehicleByVIN", "error", err.Error())
|
||||
}
|
||||
c.logger.Debug("http request output", "request", "GetVehicleByVIN", "body", resp)
|
||||
// c.logger.Debug("http request output", "request", "GetVehicleByVIN", "body", resp)
|
||||
|
||||
vehicle = &Vehicle{
|
||||
Vin: vin,
|
||||
|
Reference in New Issue
Block a user