Skip to content

Commit dc5d2e2

Browse files
authored
Add a Validation function for ClientOptions. (#52)
1 parent 3a41c71 commit dc5d2e2

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

client.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,19 @@ type ClientOptions struct {
6767
DestURL string `json:"dest_url,omitempty" yaml:"dest_url,omitempty"`
6868
}
6969

70+
func (o ClientOptions) Validate() error {
71+
if o.Identity.Oid == "" {
72+
return errors.New("missing oid")
73+
}
74+
if o.Identity.InstallationKey == "" {
75+
return errors.New("missing installation_key")
76+
}
77+
if o.Platform == "" {
78+
return errors.New("missing platform")
79+
}
80+
return nil
81+
}
82+
7083
var ErrorBufferFull = errors.New("buffer full")
7184

7285
func NewClient(o ClientOptions) (*Client, error) {

0 commit comments

Comments
 (0)