forked from jfcote87/docusign
-
Notifications
You must be signed in to change notification settings - Fork 2
/
structs.go
427 lines (381 loc) · 19.6 KB
/
structs.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
// Copyright 2015 James Cote and Liberty Fund, Inc.
// All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package docusign
import (
"time"
)
// ReturnUrlType is used to generate url for user signing
// see PostSenderView, PostRecipientView, PostEditView, PostCorrection
type ReturnUrlType string
type returnUrlStruct struct {
ReturnUrl ReturnUrlType `json:"returnUrl"`
}
const ReturnUrlTypeSend = "send"
const ReturnUrlTypeSave = "save"
const ReturnUrlTypeCancel = "cancel"
const ReturnUrlTypeError = "error"
const ReturnUrlTypeSessionEnd = "sessionEnd"
const ReturnUrlTypeDecline = "decline"
const ReturnUrlTypeException = "exception"
const ReturnUrlTypeFaxPending = "fax_pending"
const ReturnUrlTypeIdCheckFailed = "id_check_failed"
const ReturnUrlTypeSessionTimeout = "session_timeout"
const ReturnUrlTypeSigningComplete = "signing_complete"
const ReturnUrlTypeTTLExpired = "ttl_expired"
const ReturnUrlTypeViewComplete = "view_complete"
// EnvUrl is a url for an envelope view.
type EnvUrl struct {
Url string `json:"url,omitempty"`
}
// EnvRecipientView is used to create a url for a recipient.
// See PostRecipientView
type EnvRecipientView struct {
ClientUserId string `json:"clientUserId,omitempty"`
AuthenticationMethod string `json:"authenticationMethod,omitempty"`
AssertionId string `json:"assertionId,omitempty"`
AuthenticationInstant time.Time `json:"authenticationInstant,omitempty"`
SecurityDomain string `json:"securityDomain,omitempty"`
Email string `json:"email,omitempty"`
UserId string `json:"userId,omitempty"`
UserName string `json:"userName,omitempty"`
ReturnUrl ReturnUrlType `json:"returnUrl,omitempty"`
}
// FolderEnvList is the response struct for Serivice.GetFolderEnvList()
// and contains a list of envelopes in the folder
type FolderEnvList struct {
EndPosition string `json:"endPosition,omitempty"`
ResultSetSize string `json:"resultSetSize,omitempty"`
StartPosition string `json:"startPosition,omitempty"`
TotalSetSize string `json:"totalSetSize,omitempty"`
TotalRows string `json:"totalRows,omitempty"`
NextUri string `json:"nextUri,omitempty"`
PreviousUri string `json:"previousUri,omitempty"`
FolderItems []FolderItem `json:"folderItems,omitempty"`
}
// FolderTemplateList is the response struct for Service.GetTemplateList
type FolderTemplateList struct {
FolderEnvList
EnvelopeTemplates []TemplateItem `json:"EnvelopeTemplates,omitempty"`
}
// FolderList is the response struct for GetFolderList()
type FolderList struct {
Folders []Folder `json:"folders,omitempty"`
XX string `json:"-"`
}
// Folder Definition and list of Child Folders
type Folder struct {
OwnerUserName string `json:"ownerUserName,omitempty"`
OwnerEmail string `json:"ownerEmail,omitempty"`
OwnerUserId string `json:"ownerUserId,omitempty"`
Type string `json:"type,omitempty"`
Name string `json:"name,omitempty"`
Uri string `json:"uri,omitempty"`
ParentFolderId string `json:"parentFolderId,omitempty"`
ParentFolderUri string `json:"parentFolderUri,omitempty"`
FolderId string `json:"folderId,omitempty"`
Folders []Folder `json:"folders,omitempty"`
Filter map[string]string `json:"filter,omitempty"`
}
// FolderItem describes an envelope in a FolderEnvList
type FolderItem struct {
Name string `json:"name,omitempty"`
CreatedDateTime time.Time `json:"createdDateTime,omitempty"`
EnvelopeId string `json:"envelopeId,omitempty"`
EnvelopeUri string `json:"envelopeUri,omitempty"`
OwnerName string `json:"ownerName,omitempty"`
SenderEmail string `json:"senderEmail,omitempty"`
SenderName string `json:"senderName,omitempty"`
SentDateTime time.Time `json:"sentDateTime,omitempty"`
Status string `json:"status,omitempty"`
Subject string `json:"subject,omitempty"`
Recipients RecipientList `json:"recipients,omitempty"`
}
// Notificaton is the response struct for GetEnvelopeNotification
type Notification struct {
UseAccountDefaults string `json:"useAccountDefaults,omitempty"`
Reminders *Reminder `json:"reminders,omitempty"`
Expirations *Expiration `json:"expirations,omitempty"`
}
type Reminder struct {
ReminderEnabled string `json:"reminderEnabled,omitempty"`
ReminderDelay string `json:"reminderDelay,omitempty"` // Number of days
ReminderFrequency string `json:"reminderFrequency,omitempty"` // Number of intervals
}
type Expiration struct {
ExpireEnabled string `json:"expireEnabled,omitempty"`
ExpireAfter string `json:"expireAfter,omitempty"` // Number of days until expiration
ExpireWarn string `json:"expireWarn,omitempty"` // Number of days until warning
}
type BccEmail struct {
BccEmailAddressId string `json:"bccEmailAddressId,omitempty"`
Email string `json:"email,omitempty"`
}
type ServerTemplate struct {
Sequence string `json:"sequence,omitempty"`
TemplateId string `json:"templateId,omitempty"`
}
type InlineTemplate struct {
Sequence string `json:"sequence,omitempty"`
Documents []Document `json:"documents,omitempty"`
Recipients *RecipientList `json:"recipients,omitempty"`
}
type CompositeTemplate struct {
CompositeTemplateId string `json:"compositeTemplateId,omitempty"`
ServerTemplates []ServerTemplate `json:"serverTemplates,omitempty"`
InlineTemplates []InlineTemplate `json:"inlineTemplates,omitempty"`
PdfMetaDataTemplateSequence string `json:"pdfMetaDataTemplateSequence,omitempty"`
Document Document `json:"document,omitempty"`
}
// https://www.docusign.com/p/RESTAPIGuide/Content/REST%20API%20References/Send%20an%20Envelope.htm
type Envelope struct {
Accessibility string `json:"accessibility,omitempty"`
AllowMarkup string `json:"allowMarkup,omitempty"`
AllowReassign string `json:"allowReassign,omitempty"`
AllowRecipientRecursion string `json:"allowRecipientRecursion,omitempty"`
Asynchronous string `json:"asynchronous,omitempty"`
AuthoritativeCopy string `json:"authoritativeCopy,omitempty"`
AutoNavigation string `json:"autoNavigation,omitempty"`
BrandId string `json:"brandId,omitempty"`
EmailBlurb string `json:"emailBlurb,omitempty"`
EmailSubject string `json:"emailSubject,omitempty"`
EnableWetSign string `json:"enableWetSign,omitempty"`
EnforceSignerVisibility string `json:"enforceSignerVisibility,omitempty"`
EnvelopeIdStamping string `json:"envelopeIdStamping,omitempty"`
MessageLock string `json:"messageLock,omitempty"`
Notification *Notification `json:"notification,omitempty"`
RecipientsLock string `json:"recipientsLock,omitempty"`
SigningLocation string `json:"signingLocation,omitempty"`
Status string `json:"status,omitempty"`
TransactionId string `json:"transactionId,omitempty"`
UseDisclosure bool `json:"useDisclosure,omitempty"`
CustomFields *CustomFieldList `json:"customFields,omitempty"`
Documents []Document `json:"documents,omitempty"`
Recipients *RecipientList `json:"recipients,omitempty"`
EventNotification *EventNotification `json:"eventNotification,omitempty"`
EmailSettings *EmailSetting `json:"emailSettings,omitempty"`
TemplateId string `json:"templateId,omitempty"`
TemplateRoles []TemplateRole `json:"templateRoles,omitempty"`
CompositeTemplates []CompositeTemplate `json:"compositeTemplates,omitempty"`
}
type CustomFieldList struct {
ListCustomFields []ListCustomField `json:"listCustomFields,omitempty"`
TextCustomFields []CustomField `json:"textCustomFields,omitempty"`
}
type CustomField struct {
Id string `json:"fieldId,omitempty"`
Name string `json:"name,omitempty"`
Required string `json:"required,omitempty"`
Show string `json:"show,omitempty"`
Value string `json:"value,omitempty"`
ErrorDetails *ResponseError `json:"errorDetails,omitempty"`
}
type ListCustomField struct {
CustomField
ListItems []string `json:"listItems,omitempty"`
}
// RestApi documentation
// https://www.docusign.com/p/RESTAPIGuide/Content/REST%20API%20References/Document%20Parameters.htm
type Document struct {
Name string `json:"name,omitempty"`
DocumentId string `json:"documentId,omitempty"`
RemoteUrl string `json:"remoteUrl,omitempty"`
Order string `json:"order,omitempty"`
TransformPdfFields string `json:"transformPdfFields,omitempty"`
DocumentFields []NmVal `json:"documentFields,omitempty"`
EncryptedWithKeyManager string `json:"encryptedWithKeyManager,omitempty"`
Pages string `json:"pages,omitempty"`
FileExtension string `json:"fileExtension,omitempty"`
DocumentBase64 []byte `json:"documentBase64,omitempty"`
Matchboxes []Matchbox `json:"matchboxes,omitempty"`
}
// Matchbox describes the area used for template matching
type Matchbox struct {
PageNumber string `json:"pageNumber,omitempty"`
XPosition string `json:"xPosition,omitempty"`
YPosition string `json:"yPosition,omitempty"`
Width string `json:"width,omitempty"`
Height string `json:"height,omitempty"`
}
type DocumentList struct {
//EnvelopeId string `json:"envelopeId,omitempty"`
Documents []Document `json:"documents,omitempty"`
}
type DocumentFieldList struct {
DocumentFields []CustomDocumentField `json:documentFields,omitempty"`
}
type CustomDocumentField struct {
NmVal
ErrorDetails *ResponseError `json:errorDetails,omitempty"`
}
type EventNotification struct {
Url string `json:"url,omitempty"`
LoggingEnabled string `json:"loggingEnabled,omitempty"`
RequireAcknowledgment string `json:"requireAcknowledgment,omitempty"`
UseSoapInterface string `json:"useSoapInterface,omitempty"`
SoapNameSpace string `json:"soapNameSpace,omitempty"`
IncludeCertificateWithSoap string `json:"includeCertificateWithSoap,omitempty"`
SignMessageWithX509Cert string `json:"signMessageWithX509Cert,omitempty"`
IncludeDocuments string `json:"includeDocuments,omitempty"`
IncludeEnvelopeVoidReason string `json:"includeEnvelopeVoidReason,omitempty"`
IncludeTimeZone string `json:"includeTimeZone,omitempty"`
IncludeSenderAccountAsCustomField string `json:"includeSenderAccountAsCustomField,omitempty"`
IncludeDocumentFields string `json:"includeDocumentFields,omitempty"`
IncludeCertificateOfCompletion string `json:"includeCertificateOfCompletion,omitempty"`
EnvelopeEvents []EnvelopeEvent `json:"envelopeEvents,omitempty"`
RecipientEvents []RecipientEvent `json:"recipientEvents,omitempty"`
}
type EnvelopeEvent struct {
StatusCode string `json:"envelopeEventStatusCode,omitempty"`
IncludeDocuments string `json:"includeDocuments,omitempty"`
}
type RecipientEvent struct {
StatusCode string `json:"recipientEventStatusCode,omitempty"`
IncludeDocuments string `json:"includeDocuments,omitempty"`
}
// Documentation: https://www.docusign.com/p/RESTAPIGuide/Content/REST%20API%20References/Add%20Email%20Setting%20Overrides%20to%20an%20Envelope.htm
type EmailSetting struct {
ReplyEmailAddressOverride string `json:"replyEmailAddressOverride,omitempty"`
ReplyEmailNameOverride string `json:"replyEmailNameOverride,omitempty"`
BccEmailAddresses string `json:"bccEmailAddresses,omitempty"`
}
type TemplateRole struct {
Email string `json:"email,omitempty"`
Name string `json:"name,omitempty"`
RoleName string `json:"roleName,omitempty"`
ClientUserId string `json:"clientUserId,omitempty"`
DefaultRecipient string `json:"defaultRecipient,omitempty"`
RoutingOrder string `json:"routingOrder,omitempty"`
AccessCode string `json:"accessCode,omitempty"`
InPersonSignerName string `json:"inPersonSignerName,omitempty"`
EmailNotification *EmailNotification `json:"emailNotification,omitempty"`
Tabs *Tabs `json:"tabs,omitempty"`
}
type EnvelopeList struct {
Envelopes []EnvelopeUris `json:"envelopes"`
}
type EnvelopeUris struct {
AllowReassign string `json:"allowReassign,omitempty"`
CertificateUri string `json:"certificateUri,omitempty"`
CreatedDateTime time.Time `json:"createdDateTime,omitempty"`
CustomFieldsUri string `json:"customFieldsUri,omitempty"`
DocumentsCombinedUri string `json:"documentsCombinedUri,omitempty"`
DocumentsUri string `json:"documentsUri,omitempty"`
EmailBlurb string `json:"emailBlurb,omitempty"`
EmailSubject string `json:"emailSubject,omitempty"`
EnableWetSign string `json:"enableWetSign,omitempty"`
EnvelopeId string `json:"envelopeId,omitempty"`
EnvelopeUri string `json:"envelopeUri,omitempty"`
LastModifiedDateTime time.Time `json:"lastModifiedDateTime,omitempty"`
NotificationUri string `json:"notificationUri,omitempty"`
PurgeState string `json:"purgeState,omitempty"`
RecipientsUri string `json:"recipientsUri,omitempty"`
Status string `json:"status,omitempty"`
StatusChangedDateTime time.Time `json:"statusChangedDateTime,omitempty"`
TemplatesUri string `json:"templatesUri,omitempty"`
}
type AuditEventList struct {
AuditEvents []AuditEvent `json:"auditEvents,omitempty"`
}
type AuditEvent struct {
EventFields []NmVal `json:"eventFields,omitempty"`
}
type DocumentAsset struct {
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
DocumentId string `json:"documentId,omitempty"`
Order string `json:"order,omitempty"`
Pages string `json:"pages,omitempty"`
Uri string `json:"uri:omitempty"`
ErrorDetails *ResponseError `json:errorDetails,omitempty"`
}
type DocumentAssetList struct {
EnvelopeId string `json:"EnvelopeId,omitempty"`
EnvelopeDocuments []DocumentAsset `json:"envelopeDocuments,omitempty"`
}
type LoginInfo struct {
ApiPassword string `json:"apiPassword,omitempty"`
LoginAccounts []LoginAccount `json:"loginAccounts"`
}
type LoginAccount struct {
AccountId string `json:"accountId,omitempty"`
AccountIdGuid string `json:"accountIdGuid,omitempty"`
BaseUrl string `json:"baseUrl,omitempty"`
Email string `json:"email,omitempty"`
IsDefault string `json:"isDefault,omitempty"`
LoginAccountSettings []NmVal `json:"loginAccountSettings,omitempty"`
LoginUserSettings []NmVal `json:"loginUserSettings,omitempty"`
Name string `json:"Name,omitempty"`
SiteDescription string `json:"siteDescription,omitempty"`
UserId string `json:"userId,omitempty"`
UserName string `json:"userName,omitempty"`
}
type EnvelopeResponse struct {
EnvelopeId string `json:"envelopeId,omitempty"`
Status string `json:"status,omitempty"`
StatusDateTime time.Time `json:"statusDateTime,omitempty"`
Uri string `json:"uri,omitempty"`
}
// Return structure for GetEnvelopeTemplate call
type TemplateList struct {
Templates []TemplateItem `json:"templates,omitempty"`
}
type TemplateItem struct {
Name string `json:"name,omitempty"`
TemplateId string `json:"templateId,omitempty"`
Uri string `json:"uri,omitempty"`
}
type Template struct {
EnvelopeTemplateDefinition TemplateDefinition `json:"envelopeTemplateDefinition,omitempty"`
Accessibility string `json:"accessibility,omitempty"`
AllowMarkup string `json:"allowMarkup,omitempty"`
AllowReassign string `json:"allowReassign,omitempty"`
AllowRecipientRecursion string `json:"allowRecipientRecursion,omitempty"`
Asynchronous string `json:"asynchronous,omitempty"`
AuthoritativeCopy string `json:"authoritativeCopy,omitempty"`
AutoNavigation string `json:"autoNavigation,omitempty"`
BrandId string `json:"brandId,omitempty"`
EmailBlurb string `json:"emailBlurb,omitempty"`
EmailSubject string `json:"emailSubject,omitempty"`
EnableWetSign string `json:"enableWetSign,omitempty"`
EnforceSignerVisibility string `json:"enforceSignerVisibility,omitempty"`
EnvelopeIdStamping string `json:"envelopeIdStamping,omitempty"`
MessageLock string `json:"messageLock,omitempty"`
Name string `json:"name,omitempty"`
Notification *Notification `json:"notification,omitempty"`
Owner *TemplateOwner `json:"owner,omitempty"`
RecipientsLock string `json:"recipientsLock,omitempty"`
SigningLocation string `json:"signingLocation,omitempty"`
CustomFields *CustomFieldList `json:"customFields,omitempty"`
Documents []Document `json:"documents,omitempty"`
Recipients *RecipientList `json:"recipients,omitempty"`
EventNotification *EventNotification `json:"eventNotification,omitempty"`
}
type TemplateDefinition struct {
TemplateId string `json:"templateId,omitempty"`
Name string `json:"name,omitempty"`
Shared string `json:"shared,omitempty"`
Password string `json:"password,omitempty"`
Description string `json:"description,omitempty"`
LastModified time.Time `json:"lastModified,omitempty"`
LastModifiedBy TemplateModifiedBy `json:"lastModifiedBy,omitempty"`
PageCount int `json:"pageCount,omitempty"`
FolderName string `json:"folderName,omitempty"`
FolderId string `json:"folderId,omitempty"`
Owner TemplateOwner `json:"owner,omitempty"`
}
type TemplateModifiedBy struct {
UserName string `json:"userName,omitempty"`
UserId string `json:"userId,omitempty"`
Email string `json:"email,omitempty"`
URI string `json:"uri,omitempty"`
}
type TemplateOwner struct {
UserName string `json:"userName,omitempty"`
UserId string `json:"userId,omitempty"`
Email string `json:"email,omitempty"`
URI string `json:"uri,omitempty"`
UserType string `json:"userType,omitempty"`
UserStatus string `json:"userStatus,omitempty"`
}