forked from jfcote87/esign
-
Notifications
You must be signed in to change notification settings - Fork 0
/
templates.go
1468 lines (1285 loc) · 50.8 KB
/
templates.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
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2019 James Cote
// All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated by gen-esign; DO NOT EDIT.
// Package templates implements the DocuSign SDK
// category Templates.
//
// Use the Templates category to manage your account's templates.
//
// You can:
//
// * Create, list, get, update, and delete templates.
// * Manage templates' notification and group sharing settings.
// * Fetch and rotate pages from a document used by a template.
//
// Templates can be created programmatically or can be created via the DocuSign web interface and then used by your application.
//
// Service Api documentation may be found at:
// https://developers.docusign.com/esign-rest-api/v2/reference/Templates
// Usage example:
//
// import (
// "github.com/pwaterz/esign"
// "github.com/pwaterz/esign/v2/templates"
// "github.com/pwaterz/esign/v2/model"
// )
// ...
// templatesService := templates.New(esignCredential)
package templates // import "github.com/pwaterz/esign/v2/templates"
import (
"context"
"fmt"
"net/url"
"strings"
"time"
"github.com/pwaterz/esign"
"github.com/pwaterz/esign/v2/model"
)
// Service implements DocuSign Templates Category API operations
type Service struct {
credential esign.Credential
}
// New initializes a templates service using cred to authorize ops.
func New(cred esign.Credential) *Service {
return &Service{credential: cred}
}
// BulkRecipientsDelete deletes the bulk recipient list on a template.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templatebulkrecipients/delete
//
// SDK Method Templates::deleteBulkRecipients
func (s *Service) BulkRecipientsDelete(recipientID string, templateID string) *BulkRecipientsDeleteOp {
return &BulkRecipientsDeleteOp{
Credential: s.credential,
Method: "DELETE",
Path: strings.Join([]string{"templates", templateID, "recipients", recipientID, "bulk_recipients"}, "/"),
QueryOpts: make(url.Values),
}
}
// BulkRecipientsDeleteOp implements DocuSign API SDK Templates::deleteBulkRecipients
type BulkRecipientsDeleteOp esign.Op
// Do executes the op. A nil context will return error.
func (op *BulkRecipientsDeleteOp) Do(ctx context.Context) (*model.BulkRecipientsUpdateResponse, error) {
var res *model.BulkRecipientsUpdateResponse
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// BulkRecipientsList gets the bulk recipient file from a template.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templatebulkrecipients/list
//
// SDK Method Templates::listBulkRecipients
func (s *Service) BulkRecipientsList(recipientID string, templateID string) *BulkRecipientsListOp {
return &BulkRecipientsListOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"templates", templateID, "recipients", recipientID, "bulk_recipients"}, "/"),
QueryOpts: make(url.Values),
}
}
// BulkRecipientsListOp implements DocuSign API SDK Templates::listBulkRecipients
type BulkRecipientsListOp esign.Op
// Do executes the op. A nil context will return error.
func (op *BulkRecipientsListOp) Do(ctx context.Context) (*model.BulkRecipientsResponse, error) {
var res *model.BulkRecipientsResponse
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// IncludeTabs when set to **true**, the tab information associated with the recipient is included in the response.
func (op *BulkRecipientsListOp) IncludeTabs() *BulkRecipientsListOp {
if op != nil {
op.QueryOpts.Set("include_tabs", "true")
}
return op
}
// StartPosition reserved for DocuSign.
func (op *BulkRecipientsListOp) StartPosition(val int) *BulkRecipientsListOp {
if op != nil {
op.QueryOpts.Set("start_position", fmt.Sprintf("%d", val))
}
return op
}
// BulkRecipientsUpdate adds or replaces the bulk recipients list in a template.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templatebulkrecipients/update
//
// SDK Method Templates::updateBulkRecipients
func (s *Service) BulkRecipientsUpdate(recipientID string, templateID string, bulkRecipientsRequest *model.BulkRecipientsRequest) *BulkRecipientsUpdateOp {
return &BulkRecipientsUpdateOp{
Credential: s.credential,
Method: "PUT",
Path: strings.Join([]string{"templates", templateID, "recipients", recipientID, "bulk_recipients"}, "/"),
Payload: bulkRecipientsRequest,
QueryOpts: make(url.Values),
}
}
// BulkRecipientsUpdateOp implements DocuSign API SDK Templates::updateBulkRecipients
type BulkRecipientsUpdateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *BulkRecipientsUpdateOp) Do(ctx context.Context) (*model.BulkRecipientsSummaryResponse, error) {
var res *model.BulkRecipientsSummaryResponse
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// CustomFieldsCreate creates custom document fields in an existing template document.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templatecustomfields/create
//
// SDK Method Templates::createCustomFields
func (s *Service) CustomFieldsCreate(templateID string, templateCustomFields *model.TemplateCustomFields) *CustomFieldsCreateOp {
return &CustomFieldsCreateOp{
Credential: s.credential,
Method: "POST",
Path: strings.Join([]string{"templates", templateID, "custom_fields"}, "/"),
Payload: templateCustomFields,
QueryOpts: make(url.Values),
}
}
// CustomFieldsCreateOp implements DocuSign API SDK Templates::createCustomFields
type CustomFieldsCreateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *CustomFieldsCreateOp) Do(ctx context.Context) (*model.CustomFields, error) {
var res *model.CustomFields
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// CustomFieldsDelete deletes envelope custom fields in a template.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templatecustomfields/delete
//
// SDK Method Templates::deleteCustomFields
func (s *Service) CustomFieldsDelete(templateID string, templateCustomFields *model.TemplateCustomFields) *CustomFieldsDeleteOp {
return &CustomFieldsDeleteOp{
Credential: s.credential,
Method: "DELETE",
Path: strings.Join([]string{"templates", templateID, "custom_fields"}, "/"),
Payload: templateCustomFields,
QueryOpts: make(url.Values),
}
}
// CustomFieldsDeleteOp implements DocuSign API SDK Templates::deleteCustomFields
type CustomFieldsDeleteOp esign.Op
// Do executes the op. A nil context will return error.
func (op *CustomFieldsDeleteOp) Do(ctx context.Context) (*model.CustomFields, error) {
var res *model.CustomFields
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// CustomFieldsList gets the custom document fields from a template.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templatecustomfields/list
//
// SDK Method Templates::listCustomFields
func (s *Service) CustomFieldsList(templateID string) *CustomFieldsListOp {
return &CustomFieldsListOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"templates", templateID, "custom_fields"}, "/"),
QueryOpts: make(url.Values),
}
}
// CustomFieldsListOp implements DocuSign API SDK Templates::listCustomFields
type CustomFieldsListOp esign.Op
// Do executes the op. A nil context will return error.
func (op *CustomFieldsListOp) Do(ctx context.Context) (*model.CustomFields, error) {
var res *model.CustomFields
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// CustomFieldsUpdate updates envelope custom fields in a template.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templatecustomfields/update
//
// SDK Method Templates::updateCustomFields
func (s *Service) CustomFieldsUpdate(templateID string, templateCustomFields *model.TemplateCustomFields) *CustomFieldsUpdateOp {
return &CustomFieldsUpdateOp{
Credential: s.credential,
Method: "PUT",
Path: strings.Join([]string{"templates", templateID, "custom_fields"}, "/"),
Payload: templateCustomFields,
QueryOpts: make(url.Values),
}
}
// CustomFieldsUpdateOp implements DocuSign API SDK Templates::updateCustomFields
type CustomFieldsUpdateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *CustomFieldsUpdateOp) Do(ctx context.Context) (*model.CustomFields, error) {
var res *model.CustomFields
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// DocumentFieldsCreate creates custom document fields in an existing template document.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templatedocumentfields/create
//
// SDK Method Templates::createDocumentFields
func (s *Service) DocumentFieldsCreate(documentID string, templateID string, templateDocumentFields *model.DocumentFieldsInformation) *DocumentFieldsCreateOp {
return &DocumentFieldsCreateOp{
Credential: s.credential,
Method: "POST",
Path: strings.Join([]string{"templates", templateID, "documents", documentID, "fields"}, "/"),
Payload: templateDocumentFields,
QueryOpts: make(url.Values),
}
}
// DocumentFieldsCreateOp implements DocuSign API SDK Templates::createDocumentFields
type DocumentFieldsCreateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *DocumentFieldsCreateOp) Do(ctx context.Context) (*model.DocumentFieldsInformation, error) {
var res *model.DocumentFieldsInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// DocumentFieldsDelete deletes custom document fields from an existing template document.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templatedocumentfields/delete
//
// SDK Method Templates::deleteDocumentFields
func (s *Service) DocumentFieldsDelete(documentID string, templateID string, templateDocumentFields *model.DocumentFieldsInformation) *DocumentFieldsDeleteOp {
return &DocumentFieldsDeleteOp{
Credential: s.credential,
Method: "DELETE",
Path: strings.Join([]string{"templates", templateID, "documents", documentID, "fields"}, "/"),
Payload: templateDocumentFields,
QueryOpts: make(url.Values),
}
}
// DocumentFieldsDeleteOp implements DocuSign API SDK Templates::deleteDocumentFields
type DocumentFieldsDeleteOp esign.Op
// Do executes the op. A nil context will return error.
func (op *DocumentFieldsDeleteOp) Do(ctx context.Context) (*model.DocumentFieldsInformation, error) {
var res *model.DocumentFieldsInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// DocumentFieldsList gets the custom document fields for a an existing template document.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templatedocumentfields/list
//
// SDK Method Templates::listDocumentFields
func (s *Service) DocumentFieldsList(documentID string, templateID string) *DocumentFieldsListOp {
return &DocumentFieldsListOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"templates", templateID, "documents", documentID, "fields"}, "/"),
QueryOpts: make(url.Values),
}
}
// DocumentFieldsListOp implements DocuSign API SDK Templates::listDocumentFields
type DocumentFieldsListOp esign.Op
// Do executes the op. A nil context will return error.
func (op *DocumentFieldsListOp) Do(ctx context.Context) (*model.DocumentFieldsInformation, error) {
var res *model.DocumentFieldsInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// DocumentFieldsUpdate updates existing custom document fields in an existing template document.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templatedocumentfields/update
//
// SDK Method Templates::updateDocumentFields
func (s *Service) DocumentFieldsUpdate(documentID string, templateID string, templateDocumentFields *model.DocumentFieldsInformation) *DocumentFieldsUpdateOp {
return &DocumentFieldsUpdateOp{
Credential: s.credential,
Method: "PUT",
Path: strings.Join([]string{"templates", templateID, "documents", documentID, "fields"}, "/"),
Payload: templateDocumentFields,
QueryOpts: make(url.Values),
}
}
// DocumentFieldsUpdateOp implements DocuSign API SDK Templates::updateDocumentFields
type DocumentFieldsUpdateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *DocumentFieldsUpdateOp) Do(ctx context.Context) (*model.DocumentFieldsInformation, error) {
var res *model.DocumentFieldsInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// DocumentTabsGet returns tabs on the document.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templatedocumenttabs/get
//
// SDK Method Templates::getDocumentTabs
func (s *Service) DocumentTabsGet(documentID string, templateID string) *DocumentTabsGetOp {
return &DocumentTabsGetOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"templates", templateID, "documents", documentID, "tabs"}, "/"),
QueryOpts: make(url.Values),
}
}
// DocumentTabsGetOp implements DocuSign API SDK Templates::getDocumentTabs
type DocumentTabsGetOp esign.Op
// Do executes the op. A nil context will return error.
func (op *DocumentTabsGetOp) Do(ctx context.Context) (*model.Tabs, error) {
var res *model.Tabs
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// PageNumbers set the call query parameter page_numbers
func (op *DocumentTabsGetOp) PageNumbers(val string) *DocumentTabsGetOp {
if op != nil {
op.QueryOpts.Set("page_numbers", val)
}
return op
}
// DocumentTabsGetByPage returns tabs on the specified page.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templatedocumenttabs/getbypage
//
// SDK Method Templates::getPageTabs
func (s *Service) DocumentTabsGetByPage(documentID string, pageNumber string, templateID string) *DocumentTabsGetByPageOp {
return &DocumentTabsGetByPageOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"templates", templateID, "documents", documentID, "pages", pageNumber, "tabs"}, "/"),
QueryOpts: make(url.Values),
}
}
// DocumentTabsGetByPageOp implements DocuSign API SDK Templates::getPageTabs
type DocumentTabsGetByPageOp esign.Op
// Do executes the op. A nil context will return error.
func (op *DocumentTabsGetByPageOp) Do(ctx context.Context) (*model.Tabs, error) {
var res *model.Tabs
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// DocumentsDelete deletes documents from a template.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templatedocuments/delete
//
// SDK Method Templates::deleteDocuments
func (s *Service) DocumentsDelete(templateID string, envelopeDefinition *model.EnvelopeDefinition) *DocumentsDeleteOp {
return &DocumentsDeleteOp{
Credential: s.credential,
Method: "DELETE",
Path: strings.Join([]string{"templates", templateID, "documents"}, "/"),
Payload: envelopeDefinition,
QueryOpts: make(url.Values),
}
}
// DocumentsDeleteOp implements DocuSign API SDK Templates::deleteDocuments
type DocumentsDeleteOp esign.Op
// Do executes the op. A nil context will return error.
func (op *DocumentsDeleteOp) Do(ctx context.Context) (*model.TemplateDocumentsResult, error) {
var res *model.TemplateDocumentsResult
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// DocumentsGet gets PDF documents from a template.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templatedocuments/get
//
// SDK Method Templates::getDocument
func (s *Service) DocumentsGet(documentID string, templateID string) *DocumentsGetOp {
return &DocumentsGetOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"templates", templateID, "documents", documentID}, "/"),
Accept: "application/pdf",
QueryOpts: make(url.Values),
}
}
// DocumentsGetOp implements DocuSign API SDK Templates::getDocument
type DocumentsGetOp esign.Op
// Do executes the op. A nil context will return error.
func (op *DocumentsGetOp) Do(ctx context.Context) (*esign.Download, error) {
var res *esign.Download
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// Encrypt set the call query parameter encrypt
func (op *DocumentsGetOp) Encrypt() *DocumentsGetOp {
if op != nil {
op.QueryOpts.Set("encrypt", "true")
}
return op
}
// ShowChanges set the call query parameter show_changes
func (op *DocumentsGetOp) ShowChanges() *DocumentsGetOp {
if op != nil {
op.QueryOpts.Set("show_changes", "true")
}
return op
}
// DocumentsList gets a list of documents associated with a template.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templatedocuments/list
//
// SDK Method Templates::listDocuments
func (s *Service) DocumentsList(templateID string) *DocumentsListOp {
return &DocumentsListOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"templates", templateID, "documents"}, "/"),
QueryOpts: make(url.Values),
}
}
// DocumentsListOp implements DocuSign API SDK Templates::listDocuments
type DocumentsListOp esign.Op
// Do executes the op. A nil context will return error.
func (op *DocumentsListOp) Do(ctx context.Context) (*model.TemplateDocumentsResult, error) {
var res *model.TemplateDocumentsResult
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// DocumentsUpdate adds a document to a template document.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templatedocuments/update
//
// SDK Method Templates::updateDocument
func (s *Service) DocumentsUpdate(documentID string, templateID string, envelopeDefinition *model.EnvelopeDefinition) *DocumentsUpdateOp {
return &DocumentsUpdateOp{
Credential: s.credential,
Method: "PUT",
Path: strings.Join([]string{"templates", templateID, "documents", documentID}, "/"),
Payload: envelopeDefinition,
QueryOpts: make(url.Values),
}
}
// DocumentsUpdateOp implements DocuSign API SDK Templates::updateDocument
type DocumentsUpdateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *DocumentsUpdateOp) Do(ctx context.Context) (*model.EnvelopeDocument, error) {
var res *model.EnvelopeDocument
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// ApplyDocumentFields when **true**, document fields
// can be added or modified
// while adding or modifying envelope documents.
func (op *DocumentsUpdateOp) ApplyDocumentFields() *DocumentsUpdateOp {
if op != nil {
op.QueryOpts.Set("apply_document_fields", "true")
}
return op
}
// IsEnvelopeDefinition set the call query parameter is_envelope_definition
func (op *DocumentsUpdateOp) IsEnvelopeDefinition() *DocumentsUpdateOp {
if op != nil {
op.QueryOpts.Set("is_envelope_definition", "true")
}
return op
}
// DocumentsUpdateList adds documents to a template document.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templatedocuments/updatelist
//
// SDK Method Templates::updateDocuments
func (s *Service) DocumentsUpdateList(templateID string, envelopeDefinition *model.EnvelopeDefinition) *DocumentsUpdateListOp {
return &DocumentsUpdateListOp{
Credential: s.credential,
Method: "PUT",
Path: strings.Join([]string{"templates", templateID, "documents"}, "/"),
Payload: envelopeDefinition,
QueryOpts: make(url.Values),
}
}
// DocumentsUpdateListOp implements DocuSign API SDK Templates::updateDocuments
type DocumentsUpdateListOp esign.Op
// Do executes the op. A nil context will return error.
func (op *DocumentsUpdateListOp) Do(ctx context.Context) (*model.TemplateDocumentsResult, error) {
var res *model.TemplateDocumentsResult
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// ApplyDocumentFields when **true**, document fields
// can be added or modified
// while adding or modifying envelope documents.
func (op *DocumentsUpdateListOp) ApplyDocumentFields() *DocumentsUpdateListOp {
if op != nil {
op.QueryOpts.Set("apply_document_fields", "true")
}
return op
}
// PersistTabs set the call query parameter persist_tabs
func (op *DocumentsUpdateListOp) PersistTabs() *DocumentsUpdateListOp {
if op != nil {
op.QueryOpts.Set("persist_tabs", "true")
}
return op
}
// LocksCreate lock a template.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templatelocks/create
//
// SDK Method Templates::createLock
func (s *Service) LocksCreate(templateID string, lockRequest *model.LockRequest) *LocksCreateOp {
return &LocksCreateOp{
Credential: s.credential,
Method: "POST",
Path: strings.Join([]string{"templates", templateID, "lock"}, "/"),
Payload: lockRequest,
QueryOpts: make(url.Values),
}
}
// LocksCreateOp implements DocuSign API SDK Templates::createLock
type LocksCreateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *LocksCreateOp) Do(ctx context.Context) (*model.LockInformation, error) {
var res *model.LockInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// LocksDelete deletes a template lock.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templatelocks/delete
//
// SDK Method Templates::deleteLock
func (s *Service) LocksDelete(templateID string, lockRequest *model.LockRequest) *LocksDeleteOp {
return &LocksDeleteOp{
Credential: s.credential,
Method: "DELETE",
Path: strings.Join([]string{"templates", templateID, "lock"}, "/"),
Payload: lockRequest,
QueryOpts: make(url.Values),
}
}
// LocksDeleteOp implements DocuSign API SDK Templates::deleteLock
type LocksDeleteOp esign.Op
// Do executes the op. A nil context will return error.
func (op *LocksDeleteOp) Do(ctx context.Context) (*model.LockInformation, error) {
var res *model.LockInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// LocksGet gets template lock information.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templatelocks/get
//
// SDK Method Templates::getLock
func (s *Service) LocksGet(templateID string) *LocksGetOp {
return &LocksGetOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"templates", templateID, "lock"}, "/"),
QueryOpts: make(url.Values),
}
}
// LocksGetOp implements DocuSign API SDK Templates::getLock
type LocksGetOp esign.Op
// Do executes the op. A nil context will return error.
func (op *LocksGetOp) Do(ctx context.Context) (*model.LockInformation, error) {
var res *model.LockInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// LocksUpdate updates a template lock.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templatelocks/update
//
// SDK Method Templates::updateLock
func (s *Service) LocksUpdate(templateID string, lockRequest *model.LockRequest) *LocksUpdateOp {
return &LocksUpdateOp{
Credential: s.credential,
Method: "PUT",
Path: strings.Join([]string{"templates", templateID, "lock"}, "/"),
Payload: lockRequest,
QueryOpts: make(url.Values),
}
}
// LocksUpdateOp implements DocuSign API SDK Templates::updateLock
type LocksUpdateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *LocksUpdateOp) Do(ctx context.Context) (*model.LockInformation, error) {
var res *model.LockInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// RecipientTabsCreate adds tabs for a recipient.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templaterecipienttabs/create
//
// SDK Method Templates::createTabs
func (s *Service) RecipientTabsCreate(recipientID string, templateID string, templateTabs *model.TemplateTabs) *RecipientTabsCreateOp {
return &RecipientTabsCreateOp{
Credential: s.credential,
Method: "POST",
Path: strings.Join([]string{"templates", templateID, "recipients", recipientID, "tabs"}, "/"),
Payload: templateTabs,
QueryOpts: make(url.Values),
}
}
// RecipientTabsCreateOp implements DocuSign API SDK Templates::createTabs
type RecipientTabsCreateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *RecipientTabsCreateOp) Do(ctx context.Context) (*model.Tabs, error) {
var res *model.Tabs
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// RecipientTabsDelete deletes the tabs associated with a recipient in a template.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templaterecipienttabs/delete
//
// SDK Method Templates::deleteTabs
func (s *Service) RecipientTabsDelete(recipientID string, templateID string, templateTabs *model.TemplateTabs) *RecipientTabsDeleteOp {
return &RecipientTabsDeleteOp{
Credential: s.credential,
Method: "DELETE",
Path: strings.Join([]string{"templates", templateID, "recipients", recipientID, "tabs"}, "/"),
Payload: templateTabs,
QueryOpts: make(url.Values),
}
}
// RecipientTabsDeleteOp implements DocuSign API SDK Templates::deleteTabs
type RecipientTabsDeleteOp esign.Op
// Do executes the op. A nil context will return error.
func (op *RecipientTabsDeleteOp) Do(ctx context.Context) (*model.Tabs, error) {
var res *model.Tabs
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// RecipientTabsList gets the tabs information for a signer or sign-in-person recipient in a template.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templaterecipienttabs/list
//
// SDK Method Templates::listTabs
func (s *Service) RecipientTabsList(recipientID string, templateID string) *RecipientTabsListOp {
return &RecipientTabsListOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"templates", templateID, "recipients", recipientID, "tabs"}, "/"),
QueryOpts: make(url.Values),
}
}
// RecipientTabsListOp implements DocuSign API SDK Templates::listTabs
type RecipientTabsListOp esign.Op
// Do executes the op. A nil context will return error.
func (op *RecipientTabsListOp) Do(ctx context.Context) (*model.Tabs, error) {
var res *model.Tabs
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// IncludeAnchorTabLocations when set to **true**, all tabs with anchor tab properties are included in the response.
func (op *RecipientTabsListOp) IncludeAnchorTabLocations() *RecipientTabsListOp {
if op != nil {
op.QueryOpts.Set("include_anchor_tab_locations", "true")
}
return op
}
// IncludeMetadata reserved for DocuSign.
func (op *RecipientTabsListOp) IncludeMetadata(val string) *RecipientTabsListOp {
if op != nil {
op.QueryOpts.Set("include_metadata", val)
}
return op
}
// RecipientTabsUpdate updates the tabs for a recipient.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templaterecipienttabs/update
//
// SDK Method Templates::updateTabs
func (s *Service) RecipientTabsUpdate(recipientID string, templateID string, templateTabs *model.TemplateTabs) *RecipientTabsUpdateOp {
return &RecipientTabsUpdateOp{
Credential: s.credential,
Method: "PUT",
Path: strings.Join([]string{"templates", templateID, "recipients", recipientID, "tabs"}, "/"),
Payload: templateTabs,
QueryOpts: make(url.Values),
}
}
// RecipientTabsUpdateOp implements DocuSign API SDK Templates::updateTabs
type RecipientTabsUpdateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *RecipientTabsUpdateOp) Do(ctx context.Context) (*model.Tabs, error) {
var res *model.Tabs
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// RecipientsCreate adds tabs for a recipient.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templaterecipients/create
//
// SDK Method Templates::createRecipients
func (s *Service) RecipientsCreate(templateID string, templateRecipients *model.TemplateRecipients) *RecipientsCreateOp {
return &RecipientsCreateOp{
Credential: s.credential,
Method: "POST",
Path: strings.Join([]string{"templates", templateID, "recipients"}, "/"),
Payload: templateRecipients,
QueryOpts: make(url.Values),
}
}
// RecipientsCreateOp implements DocuSign API SDK Templates::createRecipients
type RecipientsCreateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *RecipientsCreateOp) Do(ctx context.Context) (*model.Recipients, error) {
var res *model.Recipients
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// ResendEnvelope when set to **true**, resends the envelope if the new recipient's routing order is before or the same as the envelope's next recipient.
func (op *RecipientsCreateOp) ResendEnvelope() *RecipientsCreateOp {
if op != nil {
op.QueryOpts.Set("resend_envelope", "true")
}
return op
}
// RecipientsDelete deletes the specified recipient file from a template.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templaterecipients/delete
//
// SDK Method Templates::deleteRecipient
func (s *Service) RecipientsDelete(recipientID string, templateID string, templateRecipients *model.TemplateRecipients) *RecipientsDeleteOp {
return &RecipientsDeleteOp{
Credential: s.credential,
Method: "DELETE",
Path: strings.Join([]string{"templates", templateID, "recipients", recipientID}, "/"),
Payload: templateRecipients,
QueryOpts: make(url.Values),
}
}
// RecipientsDeleteOp implements DocuSign API SDK Templates::deleteRecipient
type RecipientsDeleteOp esign.Op
// Do executes the op. A nil context will return error.
func (op *RecipientsDeleteOp) Do(ctx context.Context) (*model.Recipients, error) {
var res *model.Recipients
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// RecipientsDeleteList deletes recipients from a template.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templaterecipients/deletelist
//
// SDK Method Templates::deleteRecipients
func (s *Service) RecipientsDeleteList(templateID string, templateRecipients *model.TemplateRecipients) *RecipientsDeleteListOp {
return &RecipientsDeleteListOp{
Credential: s.credential,
Method: "DELETE",
Path: strings.Join([]string{"templates", templateID, "recipients"}, "/"),
Payload: templateRecipients,
QueryOpts: make(url.Values),
}
}
// RecipientsDeleteListOp implements DocuSign API SDK Templates::deleteRecipients
type RecipientsDeleteListOp esign.Op
// Do executes the op. A nil context will return error.
func (op *RecipientsDeleteListOp) Do(ctx context.Context) (*model.Recipients, error) {
var res *model.Recipients
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// RecipientsList gets recipient information from a template.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templaterecipients/list
//
// SDK Method Templates::listRecipients
func (s *Service) RecipientsList(templateID string) *RecipientsListOp {
return &RecipientsListOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"templates", templateID, "recipients"}, "/"),
QueryOpts: make(url.Values),
}
}
// RecipientsListOp implements DocuSign API SDK Templates::listRecipients
type RecipientsListOp esign.Op
// Do executes the op. A nil context will return error.
func (op *RecipientsListOp) Do(ctx context.Context) (*model.Recipients, error) {
var res *model.Recipients
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// IncludeAnchorTabLocations when set to **true** and `include_tabs` is set to **true**, all tabs with anchor tab properties are included in the response.
func (op *RecipientsListOp) IncludeAnchorTabLocations() *RecipientsListOp {
if op != nil {
op.QueryOpts.Set("include_anchor_tab_locations", "true")
}
return op
}
// IncludeExtended when set to **true**, the extended properties are included in the response.
func (op *RecipientsListOp) IncludeExtended() *RecipientsListOp {
if op != nil {
op.QueryOpts.Set("include_extended", "true")
}
return op
}
// IncludeTabs when set to **true**, the tab information associated with the recipient is included in the response.
func (op *RecipientsListOp) IncludeTabs() *RecipientsListOp {
if op != nil {
op.QueryOpts.Set("include_tabs", "true")
}
return op
}
// RecipientsUpdate updates recipients in a template.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templaterecipients/update
//
// SDK Method Templates::updateRecipients
func (s *Service) RecipientsUpdate(templateID string, templateRecipients *model.TemplateRecipients) *RecipientsUpdateOp {
return &RecipientsUpdateOp{
Credential: s.credential,
Method: "PUT",
Path: strings.Join([]string{"templates", templateID, "recipients"}, "/"),
Payload: templateRecipients,
QueryOpts: make(url.Values),
}
}
// RecipientsUpdateOp implements DocuSign API SDK Templates::updateRecipients
type RecipientsUpdateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *RecipientsUpdateOp) Do(ctx context.Context) (*model.RecipientsUpdateSummary, error) {
var res *model.RecipientsUpdateSummary
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// ResendEnvelope when set to **true**, resends the envelope if the new recipient's routing order is before or the same as the envelope's next recipient.
func (op *RecipientsUpdateOp) ResendEnvelope() *RecipientsUpdateOp {
if op != nil {
op.QueryOpts.Set("resend_envelope", "true")
}
return op
}
// ViewsCreateEdit provides a URL to start an edit view of the Template UI
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templateviews/createedit
//
// SDK Method Templates::createEditView
func (s *Service) ViewsCreateEdit(templateID string, returnURLRequest *model.ReturnURLRequest) *ViewsCreateEditOp {
return &ViewsCreateEditOp{
Credential: s.credential,
Method: "POST",
Path: strings.Join([]string{"templates", templateID, "views", "edit"}, "/"),
Payload: returnURLRequest,
QueryOpts: make(url.Values),
}
}
// ViewsCreateEditOp implements DocuSign API SDK Templates::createEditView
type ViewsCreateEditOp esign.Op
// Do executes the op. A nil context will return error.
func (op *ViewsCreateEditOp) Do(ctx context.Context) (*model.ViewURL, error) {
var res *model.ViewURL
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// Create creates a template.
// If any uploads[x].Reader is an io.ReadCloser(s), Do() will always close Reader.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templates/create
//
// SDK Method Templates::createTemplate
func (s *Service) Create(templates *model.EnvelopeTemplate, uploads ...*esign.UploadFile) *CreateOp {
return &CreateOp{
Credential: s.credential,
Method: "POST",
Path: "templates",
Payload: templates,
Files: uploads,
QueryOpts: make(url.Values),
}
}
// CreateOp implements DocuSign API SDK Templates::createTemplate
type CreateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *CreateOp) Do(ctx context.Context) (*model.TemplateSummary, error) {
var res *model.TemplateSummary
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// DeleteDocumentPage deletes a page from a document in an template.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templates/deletedocumentpage
//
// SDK Method Templates::deleteDocumentPage
func (s *Service) DeleteDocumentPage(documentID string, pageNumber string, templateID string, pageRequest *model.PageRequest) *DeleteDocumentPageOp {
return &DeleteDocumentPageOp{
Credential: s.credential,
Method: "DELETE",
Path: strings.Join([]string{"templates", templateID, "documents", documentID, "pages", pageNumber}, "/"),
Payload: pageRequest,
QueryOpts: make(url.Values),
}
}
// DeleteDocumentPageOp implements DocuSign API SDK Templates::deleteDocumentPage
type DeleteDocumentPageOp esign.Op
// Do executes the op. A nil context will return error.
func (op *DeleteDocumentPageOp) Do(ctx context.Context) error {
return ((*esign.Op)(op)).Do(ctx, nil)
}
// DeleteGroupShare removes a member group's sharing permissions for a template.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/templates/templates/deletegroupshare
//
// SDK Method Templates::deleteGroupShare
func (s *Service) DeleteGroupShare(templateID string, templatePart string, groups *model.GroupInformation) *DeleteGroupShareOp {
return &DeleteGroupShareOp{