forked from evcc-io/evcc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.go
35 lines (27 loc) · 770 Bytes
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package vehicle
import "errors"
// ClientCredentials contains OAuth2 client id and secret
type ClientCredentials struct {
ID, Secret string
}
// Error validates the credentials and returns an error if they are incomplete
func (c *ClientCredentials) Error() error {
if c.ID == "" {
return errors.New("missing credentials id")
}
if c.Secret == "" {
return errors.New("missing credentials secret")
}
return nil
}
// Tokens contains access and refresh tokens
type Tokens struct {
Access, Refresh string
}
// Error validates the token and returns an error if they are incomplete
func (t *Tokens) Error() error {
if t.Access == "" || t.Refresh == "" {
return errors.New("missing access and/or refresh token, use `evcc token` to create")
}
return nil
}