-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefinitions.go
146 lines (128 loc) · 4.74 KB
/
definitions.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
package gocvent
import "github.com/matthewpoer/gocvent/gosoap"
// CventAPI the primary receiver, referencing a gosoap handler and
// authenticated session information
type CventAPI struct {
ServerURL string
CventSessionHeader string
soap *gosoap.Client
}
// CvObject is a generic result of a Retrieve call, so this is mostly just metadata fields
type CvObject struct {
Type string `xml:"type,attr"`
ID string `xml:"Id,attr"`
CreatedBy string `xml:"CreatedBy,attr"`
CreatedDate string `xml:"CreatedDate,attr"`
LastModifiedDate string `xml:"LastModifiedDate,attr"`
}
// AnswerDetail looks and smells a lot like LookUpDetail IMO
type AnswerDetail struct {
AnswerText string `xml:"AnswerText,attr"`
}
// CustomField is a lot like Field, but it's custom, so it has some additional
// attributes and may not exist at all
type CustomField struct {
ID string `xml:"Id,attr"`
Name string `xml:"Name,attr"`
Category string `xml:"Category,attr"`
FieldType string `xml:"FieldType,attr"`
Format string `xml:"Format,attr"`
SortOrder int `xml:"SortOrder,attr"`
AnswerDetails []AnswerDetail `xml:"AnswerDetail"`
}
// DescribeCvObjectResponse part of the DescribeCvObject API Calls
type DescribeCvObjectResponse struct {
DescribeCvObjectResults []DescribeCvObjectResult `xml:"DescribeCvObjectResult>DescribeCvObjectResult"`
}
// DescribeCvObjectResult part of the DescribeCvObject API Calls
type DescribeCvObjectResult struct {
Name string `xml:"Name,attr"`
Creatable bool `xml:"Creatable,attr"`
Updateable bool `xml:"Updateable,attr"`
Deletable bool `xml:"Deletable,attr"`
Replicateable bool `xml:"Replicateable,attr"`
Retrieveable bool `xml:"Retrieveable,attr"`
Searchable bool `xml:"Searchable,attr"`
Fields []Field `xml:"Field"`
CustomFields []CustomField `xml:"CustomField"`
}
// DescribeGlobalResponse part of the DescribeGlobal API calls
type DescribeGlobalResponse struct {
DescribeGlobalResult DescribeGlobalResult
}
// DescribeGlobalResult part of the DescribeGlobal API calls
type DescribeGlobalResult struct {
CurrentAPICalls int `xml:"CurrentAPICalls,attr"`
CvObjectTypes []string `xml:"CvObjectTypes"`
MaxAPICalls int `xml:"MaxAPICalls,attr"`
MaxBatchSize int `xml:"MaxBatchSize,attr"`
MaxRecordSet int `xml:"MaxRecordSet,attr"`
/*
Lookups not yet supported, e.g.
```
<LookUps>
<LookUp Type="ContactCustomField">
<Id>12345678-1EBA-4936-9CB2-E7E13C21F4E6</Id>
<Name>Emergency Contact Name</Name>
<Code></Code>
</LookUp>
<LookUp Type="ContactCustomField">
<Id>12345678-674C-4E50-BF52-914E5B439E49</Id>
<Name>Emergency Contact Phone</Name>
<Code></Code>
</LookUp>
</LookUps>
```
*/
}
// Field information about a single Field on an object
type Field struct {
Name string `xml:"Name,attr"`
ObjectLocation string `xml:"ObjectLocation,attr"`
DataType string `xml:"DataType,attr"`
Searchable bool `xml:"Searchable,attr"`
Required bool `xml:"Required,attr"`
ReadOnly bool `xml:"ReadOnly,attr"`
DefaultValue string `xml:"DefaultValue,attr"`
DefaultSearchValue string `xml:"DefaultSearchValue,attr"`
LookUpDetails []LookUpDetail `xml:"LookUpDetail"`
}
// Filter is used by Search API calls
type Filter struct {
Field string `xml:"Field"`
Operator string `xml:"Operator"`
Value string `xml:"Value"`
ValueArray []string `xml:"ValueArray"`
}
// LoginResponse wrapper for LoginResult
type LoginResponse struct {
LoginResult LoginResult
}
// LoginResult contains information about the Login attempt
type LoginResult struct {
LoginSuccess string `xml:"LoginSuccess,attr"`
CventSessionHeader string `xml:"CventSessionHeader,attr"`
ServerURL string `xml:"ServerURL,attr"`
ErrorMessage string `xml:"ErrorMessage,attr"`
}
// LookUpDetail holds values available in a list (i.e. a dropdown or picklist)
// as part of a Field definition
type LookUpDetail struct {
Value string `xml:"Value,attr"`
}
// RetrieveResponse wrapper for RetrieveResult
type RetrieveResponse struct {
RetrieveResult RetrieveResult
}
// RetrieveResult contains information about the records returned by a Retrieve API Call
type RetrieveResult struct {
CvObject CvObject `xml:"CvObject"`
}
// SearchResponse wrapper for SearchResult
type SearchResponse struct {
SearchResult SearchResult
}
// SearchResult contains information about the IDs returned by a Search API Call
type SearchResult struct {
Ids []string `xml:"Id"`
}