From 05212fcb3156d5711cc26e67d76493e443883902 Mon Sep 17 00:00:00 2001 From: Dylan Moreland <79415431+elffjs@users.noreply.github.com> Date: Wed, 29 May 2024 14:16:44 -0400 Subject: [PATCH] Put the credential data definitions in a central place for now (#68) * Put the credential data definitions in a central place for now * Some notes about region and version * Casing --- sdtask/sdtask.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 sdtask/sdtask.go diff --git a/sdtask/sdtask.go b/sdtask/sdtask.go new file mode 100644 index 0000000..20e69c7 --- /dev/null +++ b/sdtask/sdtask.go @@ -0,0 +1,31 @@ +package sdtask + +import ( + "time" + + "github.com/ethereum/go-ethereum/common" +) + +type CredentialData struct { + TaskID string `json:"taskId"` + UserDeviceID string `json:"userDeviceId"` + IntegrationID string `json:"integrationId"` + AccessToken string `json:"accessToken"` + Expiry time.Time `json:"expiry"` + RefreshToken string `json:"refreshToken"` + // Version is an API version. Currently only used for Tesla: 1 is the old + // "Owner API" and 2 is the new "Fleet API". + Version int `json:"version,omitempty"` + // Region is a lowercase two-letter code for the region. Currently only used for + // Tesla, and can only be "na" or "eu". + Region string `json:"region,omitempty"` + SyntheticDevice *SyntheticDevice `json:"syntheticDevice,omitempty"` +} + +type SyntheticDevice struct { + TokenID int `json:"tokenId"` + Address common.Address `json:"address"` + IntegrationTokenID int `json:"integrationTokenId"` + WalletChildNumber int `json:"walletChildNumber"` + VehicleTokenID int `json:"vehicleTokenId"` +}