forked from SmartThingsOSS/smartapp-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app_lifecycle.go
86 lines (66 loc) · 2.76 KB
/
app_lifecycle.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// Code generated by go-swagger; DO NOT EDIT.
package smartapp
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"encoding/json"
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/validate"
)
// AppLifecycle Every invocation of a SmartApp is associated to a specific lifecycle event. These lifecycles include:
// * INSTALL - Lifecycle that will be invoked once at the time of installation of a SmartApp.
// * UPDATE - Invoked when a user modifies the configuration values assigned to the SmartApp.
// * UNINSTALL - A clean up lifecycle invoked upon the deletion of an SmartApp from a user's account.
// * EVENT - Lifecycle event used when the SmartApp is invoked as the result of a subscription or schedule.
// * PING - Lifecycle used during App creation to verify connectivity, and ownership of a particular target.
// * CONFIGURATION - Lifecycle used to drive the UX during the installation process of a SmartApp into a user's account.
// * OAUTH_CALLBACK - Lifecycle used for integrations that implement a third-party OAuth out.
//
// swagger:model AppLifecycle
type AppLifecycle string
const (
// AppLifecycleINSTALL captures enum value "INSTALL"
AppLifecycleINSTALL AppLifecycle = "INSTALL"
// AppLifecycleUPDATE captures enum value "UPDATE"
AppLifecycleUPDATE AppLifecycle = "UPDATE"
// AppLifecycleUNINSTALL captures enum value "UNINSTALL"
AppLifecycleUNINSTALL AppLifecycle = "UNINSTALL"
// AppLifecycleEVENT captures enum value "EVENT"
AppLifecycleEVENT AppLifecycle = "EVENT"
// AppLifecyclePING captures enum value "PING"
AppLifecyclePING AppLifecycle = "PING"
// AppLifecycleCONFIGURATION captures enum value "CONFIGURATION"
AppLifecycleCONFIGURATION AppLifecycle = "CONFIGURATION"
// AppLifecycleOAUTHCALLBACK captures enum value "OAUTH_CALLBACK"
AppLifecycleOAUTHCALLBACK AppLifecycle = "OAUTH_CALLBACK"
)
// for schema
var appLifecycleEnum []interface{}
func init() {
var res []AppLifecycle
if err := json.Unmarshal([]byte(`["INSTALL","UPDATE","UNINSTALL","EVENT","PING","CONFIGURATION","OAUTH_CALLBACK"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
appLifecycleEnum = append(appLifecycleEnum, v)
}
}
func (m AppLifecycle) validateAppLifecycleEnum(path, location string, value AppLifecycle) error {
if err := validate.Enum(path, location, value, appLifecycleEnum); err != nil {
return err
}
return nil
}
// Validate validates this app lifecycle
func (m AppLifecycle) Validate(formats strfmt.Registry) error {
var res []error
// value enum
if err := m.validateAppLifecycleEnum("", "body", m); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}