forked from jfcote87/esign
-
Notifications
You must be signed in to change notification settings - Fork 0
/
users.go
901 lines (788 loc) · 29.1 KB
/
users.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
// 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 users implements the DocuSign SDK
// category Users.
//
// Use the Users category to manage the users in your accounts.
//
// You can:
//
// * Set custom user settings.
// * Manage a users profile.
// * Add delete users.
// * Add and delete the intials and signature images for a user.
//
// Service Api documentation may be found at:
// https://developers.docusign.com/esign-rest-api/v2/reference/Users
// Usage example:
//
// import (
// "github.com/ICGGroup/esign"
// "github.com/ICGGroup/esign/v2/users"
// "github.com/ICGGroup/esign/v2/model"
// )
// ...
// usersService := users.New(esignCredential)
package users // import "github.com/ICGGroup/esign/v2/users"
import (
"context"
"fmt"
"io"
"net/url"
"strings"
"github.com/ICGGroup/esign"
"github.com/ICGGroup/esign/v2/model"
)
// Service implements DocuSign Users Category API operations
type Service struct {
credential esign.Credential
}
// New initializes a users service using cred to authorize ops.
func New(cred esign.Credential) *Service {
return &Service{credential: cred}
}
// ContactsCreate imports multiple new contacts into the contacts collection from CSV, JSON, or XML (based on content type).
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/contacts/create
//
// SDK Method Users::postContacts
func (s *Service) ContactsCreate(contactModRequest *model.ContactModRequest) *ContactsCreateOp {
return &ContactsCreateOp{
Credential: s.credential,
Method: "POST",
Path: "contacts",
Payload: contactModRequest,
QueryOpts: make(url.Values),
}
}
// ContactsCreateOp implements DocuSign API SDK Users::postContacts
type ContactsCreateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *ContactsCreateOp) Do(ctx context.Context) (*model.ContactUpdateResponse, error) {
var res *model.ContactUpdateResponse
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// ContactsDelete replaces a particular contact associated with an account for the DocuSign service.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/contacts/delete
//
// SDK Method Users::deleteContactWithId
func (s *Service) ContactsDelete(contactID string) *ContactsDeleteOp {
return &ContactsDeleteOp{
Credential: s.credential,
Method: "DELETE",
Path: strings.Join([]string{"contacts", contactID}, "/"),
QueryOpts: make(url.Values),
}
}
// ContactsDeleteOp implements DocuSign API SDK Users::deleteContactWithId
type ContactsDeleteOp esign.Op
// Do executes the op. A nil context will return error.
func (op *ContactsDeleteOp) Do(ctx context.Context) (*model.ContactUpdateResponse, error) {
var res *model.ContactUpdateResponse
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// ContactsDeleteList delete contacts associated with an account for the DocuSign service.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/contacts/deletelist
//
// SDK Method Users::deleteContacts
func (s *Service) ContactsDeleteList(contactModRequest *model.ContactModRequest) *ContactsDeleteListOp {
return &ContactsDeleteListOp{
Credential: s.credential,
Method: "DELETE",
Path: "contacts",
Payload: contactModRequest,
QueryOpts: make(url.Values),
}
}
// ContactsDeleteListOp implements DocuSign API SDK Users::deleteContacts
type ContactsDeleteListOp esign.Op
// Do executes the op. A nil context will return error.
func (op *ContactsDeleteListOp) Do(ctx context.Context) (*model.ContactUpdateResponse, error) {
var res *model.ContactUpdateResponse
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// ContactsGet gets a particular contact associated with the user's account.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/contacts/get
//
// SDK Method Users::getContactById
func (s *Service) ContactsGet(contactID string) *ContactsGetOp {
return &ContactsGetOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"contacts", contactID}, "/"),
QueryOpts: make(url.Values),
}
}
// ContactsGetOp implements DocuSign API SDK Users::getContactById
type ContactsGetOp esign.Op
// Do executes the op. A nil context will return error.
func (op *ContactsGetOp) Do(ctx context.Context) (*model.ContactGetResponse, error) {
var res *model.ContactGetResponse
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// ContactsUpdate replaces contacts associated with an account for the DocuSign service.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/contacts/update
//
// SDK Method Users::putContacts
func (s *Service) ContactsUpdate(contactModRequest *model.ContactModRequest) *ContactsUpdateOp {
return &ContactsUpdateOp{
Credential: s.credential,
Method: "PUT",
Path: "contacts",
Payload: contactModRequest,
QueryOpts: make(url.Values),
}
}
// ContactsUpdateOp implements DocuSign API SDK Users::putContacts
type ContactsUpdateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *ContactsUpdateOp) Do(ctx context.Context) (*model.ContactUpdateResponse, error) {
var res *model.ContactUpdateResponse
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// CustomSettingsDelete deletes custom user settings for a specified user.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/usercustomsettings/delete
//
// SDK Method Users::deleteCustomSettings
func (s *Service) CustomSettingsDelete(userID string, userCustomSettings *model.CustomSettingsInformation) *CustomSettingsDeleteOp {
return &CustomSettingsDeleteOp{
Credential: s.credential,
Method: "DELETE",
Path: strings.Join([]string{"users", userID, "custom_settings"}, "/"),
Payload: userCustomSettings,
QueryOpts: make(url.Values),
}
}
// CustomSettingsDeleteOp implements DocuSign API SDK Users::deleteCustomSettings
type CustomSettingsDeleteOp esign.Op
// Do executes the op. A nil context will return error.
func (op *CustomSettingsDeleteOp) Do(ctx context.Context) (*model.CustomSettingsInformation, error) {
var res *model.CustomSettingsInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// CustomSettingsList retrieves the custom user settings for a specified user.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/usercustomsettings/list
//
// SDK Method Users::listCustomSettings
func (s *Service) CustomSettingsList(userID string) *CustomSettingsListOp {
return &CustomSettingsListOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"users", userID, "custom_settings"}, "/"),
QueryOpts: make(url.Values),
}
}
// CustomSettingsListOp implements DocuSign API SDK Users::listCustomSettings
type CustomSettingsListOp esign.Op
// Do executes the op. A nil context will return error.
func (op *CustomSettingsListOp) Do(ctx context.Context) (*model.CustomSettingsInformation, error) {
var res *model.CustomSettingsInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// CustomSettingsUpdate adds or updates custom user settings for the specified user.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/usercustomsettings/update
//
// SDK Method Users::updateCustomSettings
func (s *Service) CustomSettingsUpdate(userID string, userCustomSettings *model.CustomSettingsInformation) *CustomSettingsUpdateOp {
return &CustomSettingsUpdateOp{
Credential: s.credential,
Method: "PUT",
Path: strings.Join([]string{"users", userID, "custom_settings"}, "/"),
Payload: userCustomSettings,
QueryOpts: make(url.Values),
}
}
// CustomSettingsUpdateOp implements DocuSign API SDK Users::updateCustomSettings
type CustomSettingsUpdateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *CustomSettingsUpdateOp) Do(ctx context.Context) (*model.CustomSettingsInformation, error) {
var res *model.CustomSettingsInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// ProfilesGet retrieves the user profile for a specified user.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/userprofiles/get
//
// SDK Method Users::getProfile
func (s *Service) ProfilesGet(userID string) *ProfilesGetOp {
return &ProfilesGetOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"users", userID, "profile"}, "/"),
QueryOpts: make(url.Values),
}
}
// ProfilesGetOp implements DocuSign API SDK Users::getProfile
type ProfilesGetOp esign.Op
// Do executes the op. A nil context will return error.
func (op *ProfilesGetOp) Do(ctx context.Context) (*model.UserProfile, error) {
var res *model.UserProfile
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// ProfilesUpdate updates the user profile information for the specified user.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/userprofiles/update
//
// SDK Method Users::updateProfile
func (s *Service) ProfilesUpdate(userID string, userProfiles *model.UserProfile) *ProfilesUpdateOp {
return &ProfilesUpdateOp{
Credential: s.credential,
Method: "PUT",
Path: strings.Join([]string{"users", userID, "profile"}, "/"),
Payload: userProfiles,
QueryOpts: make(url.Values),
}
}
// ProfilesUpdateOp implements DocuSign API SDK Users::updateProfile
type ProfilesUpdateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *ProfilesUpdateOp) Do(ctx context.Context) error {
return ((*esign.Op)(op)).Do(ctx, nil)
}
// SignaturesCreate adds user Signature and initials images to a Signature.
// If any uploads[x].Reader is an io.ReadCloser(s), Do() will always close Reader.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/usersignatures/create
//
// SDK Method Users::createSignatures
func (s *Service) SignaturesCreate(userID string, userSignaturesInformation *model.UserSignaturesInformation, uploads ...*esign.UploadFile) *SignaturesCreateOp {
return &SignaturesCreateOp{
Credential: s.credential,
Method: "POST",
Path: strings.Join([]string{"users", userID, "signatures"}, "/"),
Payload: userSignaturesInformation,
Files: uploads,
QueryOpts: make(url.Values),
}
}
// SignaturesCreateOp implements DocuSign API SDK Users::createSignatures
type SignaturesCreateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *SignaturesCreateOp) Do(ctx context.Context) (*model.UserSignaturesInformation, error) {
var res *model.UserSignaturesInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// SignaturesDelete removes removes signature information for the specified user.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/usersignatures/delete
//
// SDK Method Users::deleteSignature
func (s *Service) SignaturesDelete(signatureID string, userID string) *SignaturesDeleteOp {
return &SignaturesDeleteOp{
Credential: s.credential,
Method: "DELETE",
Path: strings.Join([]string{"users", userID, "signatures", signatureID}, "/"),
QueryOpts: make(url.Values),
}
}
// SignaturesDeleteOp implements DocuSign API SDK Users::deleteSignature
type SignaturesDeleteOp esign.Op
// Do executes the op. A nil context will return error.
func (op *SignaturesDeleteOp) Do(ctx context.Context) error {
return ((*esign.Op)(op)).Do(ctx, nil)
}
// SignaturesDeleteImage deletes the user initials image or the user signature image for the specified user.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/usersignatures/deleteimage
//
// SDK Method Users::deleteSignatureImage
func (s *Service) SignaturesDeleteImage(imageType string, signatureID string, userID string) *SignaturesDeleteImageOp {
return &SignaturesDeleteImageOp{
Credential: s.credential,
Method: "DELETE",
Path: strings.Join([]string{"users", userID, "signatures", signatureID, imageType}, "/"),
QueryOpts: make(url.Values),
}
}
// SignaturesDeleteImageOp implements DocuSign API SDK Users::deleteSignatureImage
type SignaturesDeleteImageOp esign.Op
// Do executes the op. A nil context will return error.
func (op *SignaturesDeleteImageOp) Do(ctx context.Context) (*model.UserSignature, error) {
var res *model.UserSignature
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// SignaturesGet gets the user signature information for the specified user.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/usersignatures/get
//
// SDK Method Users::getSignature
func (s *Service) SignaturesGet(signatureID string, userID string) *SignaturesGetOp {
return &SignaturesGetOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"users", userID, "signatures", signatureID}, "/"),
QueryOpts: make(url.Values),
}
}
// SignaturesGetOp implements DocuSign API SDK Users::getSignature
type SignaturesGetOp esign.Op
// Do executes the op. A nil context will return error.
func (op *SignaturesGetOp) Do(ctx context.Context) (*model.UserSignature, error) {
var res *model.UserSignature
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// SignaturesGetImage retrieves the user initials image or the user signature image for the specified user.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/usersignatures/getimage
//
// SDK Method Users::getSignatureImage
func (s *Service) SignaturesGetImage(imageType string, signatureID string, userID string) *SignaturesGetImageOp {
return &SignaturesGetImageOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"users", userID, "signatures", signatureID, imageType}, "/"),
Accept: "image/gif",
QueryOpts: make(url.Values),
}
}
// SignaturesGetImageOp implements DocuSign API SDK Users::getSignatureImage
type SignaturesGetImageOp esign.Op
// Do executes the op. A nil context will return error.
func (op *SignaturesGetImageOp) Do(ctx context.Context) (*esign.Download, error) {
var res *esign.Download
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// IncludeChrome set the call query parameter include_chrome
func (op *SignaturesGetImageOp) IncludeChrome() *SignaturesGetImageOp {
if op != nil {
op.QueryOpts.Set("include_chrome", "true")
}
return op
}
// SignaturesList retrieves a list of user signature definitions for a specified user.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/usersignatures/list
//
// SDK Method Users::listSignatures
func (s *Service) SignaturesList(userID string) *SignaturesListOp {
return &SignaturesListOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"users", userID, "signatures"}, "/"),
QueryOpts: make(url.Values),
}
}
// SignaturesListOp implements DocuSign API SDK Users::listSignatures
type SignaturesListOp esign.Op
// Do executes the op. A nil context will return error.
func (op *SignaturesListOp) Do(ctx context.Context) (*model.UserSignaturesInformation, error) {
var res *model.UserSignaturesInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// StampType set the call query parameter stamp_type
func (op *SignaturesListOp) StampType(val string) *SignaturesListOp {
if op != nil {
op.QueryOpts.Set("stamp_type", val)
}
return op
}
// SignaturesUpdate updates the user signature for a specified user.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/usersignatures/update
//
// SDK Method Users::updateSignature
func (s *Service) SignaturesUpdate(signatureID string, userID string, userSignatureDefinition *model.UserSignatureDefinition) *SignaturesUpdateOp {
return &SignaturesUpdateOp{
Credential: s.credential,
Method: "PUT",
Path: strings.Join([]string{"users", userID, "signatures", signatureID}, "/"),
Payload: userSignatureDefinition,
QueryOpts: make(url.Values),
}
}
// SignaturesUpdateOp implements DocuSign API SDK Users::updateSignature
type SignaturesUpdateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *SignaturesUpdateOp) Do(ctx context.Context) (*model.UserSignature, error) {
var res *model.UserSignature
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// CloseExistingSignature when set to **true**, closes the current signature.
func (op *SignaturesUpdateOp) CloseExistingSignature() *SignaturesUpdateOp {
if op != nil {
op.QueryOpts.Set("close_existing_signature", "true")
}
return op
}
// SignaturesUpdateImage updates the user signature image or user initials image for the specified user.
// If media is an io.ReadCloser, Do() will close media.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/usersignatures/updateimage
//
// SDK Method Users::updateSignatureImage
func (s *Service) SignaturesUpdateImage(imageType string, signatureID string, userID string, media io.Reader, mimeType string) *SignaturesUpdateImageOp {
return &SignaturesUpdateImageOp{
Credential: s.credential,
Method: "PUT",
Path: strings.Join([]string{"users", userID, "signatures", signatureID, imageType}, "/"),
Payload: &esign.UploadFile{Reader: media, ContentType: mimeType},
QueryOpts: make(url.Values),
}
}
// SignaturesUpdateImageOp implements DocuSign API SDK Users::updateSignatureImage
type SignaturesUpdateImageOp esign.Op
// Do executes the op. A nil context will return error.
func (op *SignaturesUpdateImageOp) Do(ctx context.Context) (*model.UserSignature, error) {
var res *model.UserSignature
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// SignaturesUpdateList adds/updates a user signature.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/usersignatures/updatelist
//
// SDK Method Users::updateSignatures
func (s *Service) SignaturesUpdateList(userID string, userSignaturesInformation *model.UserSignaturesInformation) *SignaturesUpdateListOp {
return &SignaturesUpdateListOp{
Credential: s.credential,
Method: "PUT",
Path: strings.Join([]string{"users", userID, "signatures"}, "/"),
Payload: userSignaturesInformation,
QueryOpts: make(url.Values),
}
}
// SignaturesUpdateListOp implements DocuSign API SDK Users::updateSignatures
type SignaturesUpdateListOp esign.Op
// Do executes the op. A nil context will return error.
func (op *SignaturesUpdateListOp) Do(ctx context.Context) (*model.UserSignaturesInformation, error) {
var res *model.UserSignaturesInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// Create adds news user to the specified account.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/users/create
//
// SDK Method Users::create
func (s *Service) Create(newUsersDefinition *model.NewUsersDefinition) *CreateOp {
return &CreateOp{
Credential: s.credential,
Method: "POST",
Path: "users",
Payload: newUsersDefinition,
QueryOpts: make(url.Values),
}
}
// CreateOp implements DocuSign API SDK Users::create
type CreateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *CreateOp) Do(ctx context.Context) (*model.NewUsersSummary, error) {
var res *model.NewUsersSummary
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// Delete removes users account privileges.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/users/delete
//
// SDK Method Users::delete
func (s *Service) Delete(userInfoList *model.UserInfoList) *DeleteOp {
return &DeleteOp{
Credential: s.credential,
Method: "DELETE",
Path: "users",
Payload: userInfoList,
QueryOpts: make(url.Values),
}
}
// DeleteOp implements DocuSign API SDK Users::delete
type DeleteOp esign.Op
// Do executes the op. A nil context will return error.
func (op *DeleteOp) Do(ctx context.Context) (*model.UsersResponse, error) {
var res *model.UsersResponse
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// Delete set the call query parameter delete
func (op *DeleteOp) Delete(val string) *DeleteOp {
if op != nil {
op.QueryOpts.Set("delete", val)
}
return op
}
// DeleteProfileImage deletes the user profile image for the specified user.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/users/deleteprofileimage
//
// SDK Method Users::deleteProfileImage
func (s *Service) DeleteProfileImage(userID string) *DeleteProfileImageOp {
return &DeleteProfileImageOp{
Credential: s.credential,
Method: "DELETE",
Path: strings.Join([]string{"users", userID, "profile", "image"}, "/"),
QueryOpts: make(url.Values),
}
}
// DeleteProfileImageOp implements DocuSign API SDK Users::deleteProfileImage
type DeleteProfileImageOp esign.Op
// Do executes the op. A nil context will return error.
func (op *DeleteProfileImageOp) Do(ctx context.Context) error {
return ((*esign.Op)(op)).Do(ctx, nil)
}
// Get gets the user information for a specified user.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/users/get
//
// SDK Method Users::getInformation
func (s *Service) Get(userID string) *GetOp {
return &GetOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"users", userID}, "/"),
QueryOpts: make(url.Values),
}
}
// GetOp implements DocuSign API SDK Users::getInformation
type GetOp esign.Op
// Do executes the op. A nil context will return error.
func (op *GetOp) Do(ctx context.Context) (*model.UserInformation, error) {
var res *model.UserInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// AdditionalInfo when set to **true**, the full list of user information is returned for each user in the account.
func (op *GetOp) AdditionalInfo() *GetOp {
if op != nil {
op.QueryOpts.Set("additional_info", "true")
}
return op
}
// Email set the call query parameter email
func (op *GetOp) Email(val string) *GetOp {
if op != nil {
op.QueryOpts.Set("email", val)
}
return op
}
// GetProfileImage retrieves the user profile image for the specified user.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/users/getprofileimage
//
// SDK Method Users::getProfileImage
func (s *Service) GetProfileImage(userID string) *GetProfileImageOp {
return &GetProfileImageOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"users", userID, "profile", "image"}, "/"),
Accept: "image/gif",
QueryOpts: make(url.Values),
}
}
// GetProfileImageOp implements DocuSign API SDK Users::getProfileImage
type GetProfileImageOp esign.Op
// Do executes the op. A nil context will return error.
func (op *GetProfileImageOp) Do(ctx context.Context) (*esign.Download, error) {
var res *esign.Download
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// Encoding set the call query parameter encoding
func (op *GetProfileImageOp) Encoding(val string) *GetProfileImageOp {
if op != nil {
op.QueryOpts.Set("encoding", val)
}
return op
}
// GetSettings gets the user account settings for a specified user.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/users/getsettings
//
// SDK Method Users::getSettings
func (s *Service) GetSettings(userID string) *GetSettingsOp {
return &GetSettingsOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"users", userID, "settings"}, "/"),
QueryOpts: make(url.Values),
}
}
// GetSettingsOp implements DocuSign API SDK Users::getSettings
type GetSettingsOp esign.Op
// Do executes the op. A nil context will return error.
func (op *GetSettingsOp) Do(ctx context.Context) (*model.UserSettingsInformation, error) {
var res *model.UserSettingsInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// List retrieves the list of users for the specified account.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/users/list
//
// SDK Method Users::list
func (s *Service) List() *ListOp {
return &ListOp{
Credential: s.credential,
Method: "GET",
Path: "users",
QueryOpts: make(url.Values),
}
}
// ListOp implements DocuSign API SDK Users::list
type ListOp esign.Op
// Do executes the op. A nil context will return error.
func (op *ListOp) Do(ctx context.Context) (*model.UserInformationList, error) {
var res *model.UserInformationList
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// AdditionalInfo when set to **true**, the full list of user information is returned for each user in the account.
func (op *ListOp) AdditionalInfo() *ListOp {
if op != nil {
op.QueryOpts.Set("additional_info", "true")
}
return op
}
// Count number of records to return. The number must be greater than 0 and less than or equal to 100.
func (op *ListOp) Count(val int) *ListOp {
if op != nil {
op.QueryOpts.Set("count", fmt.Sprintf("%d", val))
}
return op
}
// Email set the call query parameter email
func (op *ListOp) Email(val string) *ListOp {
if op != nil {
op.QueryOpts.Set("email", val)
}
return op
}
// EmailSubstring filters the returned user records by the email address or a sub-string of email address.
func (op *ListOp) EmailSubstring(val string) *ListOp {
if op != nil {
op.QueryOpts.Set("email_substring", val)
}
return op
}
// GroupID filters user records returned by one or more group Id's.
func (op *ListOp) GroupID(val string) *ListOp {
if op != nil {
op.QueryOpts.Set("group_id", val)
}
return op
}
// LoginStatus set the call query parameter login_status
func (op *ListOp) LoginStatus(val string) *ListOp {
if op != nil {
op.QueryOpts.Set("login_status", val)
}
return op
}
// NotGroupID set the call query parameter not_group_id
func (op *ListOp) NotGroupID(val string) *ListOp {
if op != nil {
op.QueryOpts.Set("not_group_id", val)
}
return op
}
// StartPosition starting value for the list.
func (op *ListOp) StartPosition(val int) *ListOp {
if op != nil {
op.QueryOpts.Set("start_position", fmt.Sprintf("%d", val))
}
return op
}
// Status filters the user records by account status. One of:
//
// * ActivationRequired
// * ActivationSent
// * Active
// * Closed
// * Disabled
func (op *ListOp) Status(val ...string) *ListOp {
if op != nil {
op.QueryOpts.Set("status", strings.Join(val, ","))
}
return op
}
// UserNameSubstring filters the user records returned by the user name or a sub-string of user name.
func (op *ListOp) UserNameSubstring(val string) *ListOp {
if op != nil {
op.QueryOpts.Set("user_name_substring", val)
}
return op
}
// Update updates the specified user information.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/users/update
//
// SDK Method Users::updateUser
func (s *Service) Update(userID string, users *model.UserInformation) *UpdateOp {
return &UpdateOp{
Credential: s.credential,
Method: "PUT",
Path: strings.Join([]string{"users", userID}, "/"),
Payload: users,
QueryOpts: make(url.Values),
}
}
// UpdateOp implements DocuSign API SDK Users::updateUser
type UpdateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *UpdateOp) Do(ctx context.Context) (*model.UserInformation, error) {
var res *model.UserInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// UpdateList change one or more user in the specified account.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/users/updatelist
//
// SDK Method Users::updateUsers
func (s *Service) UpdateList(userInformationList *model.UserInformationList) *UpdateListOp {
return &UpdateListOp{
Credential: s.credential,
Method: "PUT",
Path: "users",
Payload: userInformationList,
QueryOpts: make(url.Values),
}
}
// UpdateListOp implements DocuSign API SDK Users::updateUsers
type UpdateListOp esign.Op
// Do executes the op. A nil context will return error.
func (op *UpdateListOp) Do(ctx context.Context) (*model.UserInformationList, error) {
var res *model.UserInformationList
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// UpdateProfileImage updates the user profile image for a specified user.
// If media is an io.ReadCloser, Do() will close media.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/users/updateprofileimage
//
// SDK Method Users::updateProfileImage
func (s *Service) UpdateProfileImage(userID string, media io.Reader, mimeType string) *UpdateProfileImageOp {
return &UpdateProfileImageOp{
Credential: s.credential,
Method: "PUT",
Path: strings.Join([]string{"users", userID, "profile", "image"}, "/"),
Payload: &esign.UploadFile{Reader: media, ContentType: mimeType},
QueryOpts: make(url.Values),
}
}
// UpdateProfileImageOp implements DocuSign API SDK Users::updateProfileImage
type UpdateProfileImageOp esign.Op
// Do executes the op. A nil context will return error.
func (op *UpdateProfileImageOp) Do(ctx context.Context) error {
return ((*esign.Op)(op)).Do(ctx, nil)
}
// UpdateSettings updates the user account settings for a specified user.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/users/users/updatesettings
//
// SDK Method Users::updateSettings
func (s *Service) UpdateSettings(userID string, userSettingsInformation *model.UserSettingsInformation) *UpdateSettingsOp {
return &UpdateSettingsOp{
Credential: s.credential,
Method: "PUT",
Path: strings.Join([]string{"users", userID, "settings"}, "/"),
Payload: userSettingsInformation,
QueryOpts: make(url.Values),
}
}
// UpdateSettingsOp implements DocuSign API SDK Users::updateSettings
type UpdateSettingsOp esign.Op
// Do executes the op. A nil context will return error.
func (op *UpdateSettingsOp) Do(ctx context.Context) error {
return ((*esign.Op)(op)).Do(ctx, nil)
}