-
-
Notifications
You must be signed in to change notification settings - Fork 756
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
430 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
query GetConsumerInformation { | ||
myStar { | ||
__typename | ||
getConsumer { | ||
__typename | ||
...MyStarConsumerDetails | ||
} | ||
getOrders { | ||
__typename | ||
...MyStarOrderDetails | ||
} | ||
getConsumerCars { | ||
__typename | ||
...MyStarCarDetails | ||
} | ||
} | ||
} | ||
fragment MyStarConsumerDetails on MyStarConsumer { | ||
__typename | ||
birthdate | ||
city | ||
country | ||
countryCode | ||
firstName | ||
lastName | ||
mobilePhone | ||
salesforceId | ||
streetAddress | ||
zipCode | ||
additionalCustomerIds { | ||
__typename | ||
code | ||
id | ||
} | ||
} | ||
fragment MyStarOrderDetails on MyStarOrder { | ||
__typename | ||
type | ||
address | ||
city | ||
configurationId | ||
consumerId | ||
country | ||
countryCode | ||
deposit | ||
district | ||
downPayment | ||
externalOrderId | ||
orderId | ||
orderState | ||
packageId | ||
placedAt | ||
province | ||
redirectUrl | ||
totalPrice | ||
zipCode | ||
car { | ||
__typename | ||
...MyStarCarDetails | ||
} | ||
items { | ||
__typename | ||
...MyStarOrderItemDetails | ||
} | ||
} | ||
fragment MyStarCarDetails on MyStarCar { | ||
__typename | ||
id | ||
consumerId | ||
engine | ||
exterior | ||
exteriorCode | ||
exteriorImageUrl | ||
gearbox | ||
interior | ||
interiorCode | ||
interiorImageUrl | ||
model | ||
modelYear | ||
package | ||
packageCode | ||
pdfUrl | ||
status | ||
steering | ||
vin | ||
wheels | ||
wheelsCode | ||
} | ||
fragment MyStarOrderItemDetails on MyStarOrderItem { | ||
__typename | ||
id | ||
currency | ||
deposit | ||
downPayment | ||
price | ||
quantity | ||
title | ||
type | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,41 @@ | ||
package polestar | ||
|
||
import ( | ||
"strconv" | ||
"time" | ||
) | ||
|
||
type StatusResponse struct { | ||
PreCond struct { | ||
Data struct { | ||
ChargingPower FloatValue | ||
ChargingActive BoolValue | ||
ChargingStatus IntValue | ||
} `json:"data"` | ||
} | ||
ChargeOpt struct{} | ||
Status struct { | ||
Data struct { | ||
Odo FloatValue | ||
RangeElectric FloatValue | ||
Soc FloatValue | ||
} `json:"data"` | ||
} | ||
Images []string | ||
Error string | ||
ErrorDescription string `json:"error_description"` | ||
} | ||
|
||
type BoolValue struct { | ||
Status int | ||
Value bool | ||
Ts TimeSecs | ||
type Consumer struct { | ||
// Type string `graphql:"__typename"` | ||
MyStarConsumerDetails `graphql:"... on MyStarConsumer"` | ||
} | ||
|
||
type IntValue struct { | ||
Status int | ||
Value int | ||
Ts TimeSecs | ||
type MyStarConsumerDetails struct { | ||
// Type string `graphql:"__typename"` | ||
Email string | ||
FirstName string | ||
LastName string | ||
} | ||
|
||
type FloatValue struct { | ||
Status int | ||
Value float64 | ||
Ts TimeSecs | ||
type ConsumerCar struct { | ||
// Type string `graphql:"__typename"` | ||
MyStarCarDetails `graphql:"... on MyStarCar"` | ||
} | ||
|
||
// TimeSecs implements JSON unmarshal for Unix timestamps in seconds | ||
type TimeSecs struct { | ||
time.Time | ||
} | ||
|
||
// UnmarshalJSON decodes unix timestamps in ms into time.Time | ||
func (ct *TimeSecs) UnmarshalJSON(data []byte) error { | ||
i, err := strconv.ParseInt(string(data), 10, 64) | ||
|
||
if err == nil { | ||
t := time.Unix(i, 0) | ||
(*ct).Time = t | ||
} | ||
|
||
return err | ||
type MyStarCarDetails struct { | ||
Id int | ||
// ConsumerId string | ||
// Engine string | ||
// Exterior string | ||
// ExteriorCode string | ||
// ExteriorImageUrl string | ||
// Gearbox string | ||
// Interior string | ||
// InteriorCode string | ||
// InteriorImageUrl string | ||
Model string | ||
ModelYear int | ||
// Package string | ||
// PackageCode string | ||
// PdfUrl string | ||
// Status string | ||
// Steering string | ||
Vin string | ||
// Wheels string | ||
// WheelsCode string | ||
} |
Oops, something went wrong.