forked from jfcote87/esign
-
Notifications
You must be signed in to change notification settings - Fork 0
/
usergroups.go
336 lines (294 loc) · 10.3 KB
/
usergroups.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
// 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 usergroups implements the DocuSign SDK
// category UserGroups.
//
// Use the User Groups category to manage your permissions groups.
//
// You can:
//
// * Create and delete groups.
// * Add users to, and delete users from, your groups.
// * Manage the brand information associated with a group.
//
// Service Api documentation may be found at:
// https://developers.docusign.com/esign-rest-api/v2/reference/UserGroups
// Usage example:
//
// import (
// "github.com/bradwheel/esign"
// "github.com/bradwheel/esign/v2/usergroups"
// "github.com/bradwheel/esign/v2/model"
// )
// ...
// usergroupsService := usergroups.New(esignCredential)
package usergroups // import "github.com/bradwheel/esign/v2/usergroups"
import (
"context"
"fmt"
"net/url"
"strings"
"github.com/bradwheel/esign"
"github.com/bradwheel/esign/v2/model"
)
// Service implements DocuSign UserGroups Category API operations
type Service struct {
credential esign.Credential
}
// New initializes a usergroups service using cred to authorize ops.
func New(cred esign.Credential) *Service {
return &Service{credential: cred}
}
// GroupBrandsDelete deletes brand information from the requested group.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/usergroups/groupbrands/delete
//
// SDK Method UserGroups::deleteBrands
func (s *Service) GroupBrandsDelete(groupID string, brandsRequest *model.BrandsRequest) *GroupBrandsDeleteOp {
return &GroupBrandsDeleteOp{
Credential: s.credential,
Method: "DELETE",
Path: strings.Join([]string{"groups", groupID, "brands"}, "/"),
Payload: brandsRequest,
QueryOpts: make(url.Values),
}
}
// GroupBrandsDeleteOp implements DocuSign API SDK UserGroups::deleteBrands
type GroupBrandsDeleteOp esign.Op
// Do executes the op. A nil context will return error.
func (op *GroupBrandsDeleteOp) Do(ctx context.Context) (*model.BrandsResponse, error) {
var res *model.BrandsResponse
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// GroupBrandsGet gets group brand ID Information.
//
//
// https://developers.docusign.com/esign-rest-api/v2/reference/usergroups/groupbrands/get
//
// SDK Method UserGroups::getBrands
func (s *Service) GroupBrandsGet(groupID string) *GroupBrandsGetOp {
return &GroupBrandsGetOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"groups", groupID, "brands"}, "/"),
QueryOpts: make(url.Values),
}
}
// GroupBrandsGetOp implements DocuSign API SDK UserGroups::getBrands
type GroupBrandsGetOp esign.Op
// Do executes the op. A nil context will return error.
func (op *GroupBrandsGetOp) Do(ctx context.Context) (*model.BrandsResponse, error) {
var res *model.BrandsResponse
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// GroupBrandsUpdate adds group brand ID information to a group.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/usergroups/groupbrands/update
//
// SDK Method UserGroups::updateBrands
func (s *Service) GroupBrandsUpdate(groupID string, brandsRequest *model.BrandsRequest) *GroupBrandsUpdateOp {
return &GroupBrandsUpdateOp{
Credential: s.credential,
Method: "PUT",
Path: strings.Join([]string{"groups", groupID, "brands"}, "/"),
Payload: brandsRequest,
QueryOpts: make(url.Values),
}
}
// GroupBrandsUpdateOp implements DocuSign API SDK UserGroups::updateBrands
type GroupBrandsUpdateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *GroupBrandsUpdateOp) Do(ctx context.Context) (*model.BrandsResponse, error) {
var res *model.BrandsResponse
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// GroupUsersDelete deletes one or more users from a gro
//
// https://developers.docusign.com/esign-rest-api/v2/reference/usergroups/groupusers/delete
//
// SDK Method UserGroups::deleteGroupUsers
func (s *Service) GroupUsersDelete(groupID string, userInfoList *model.UserInfoList) *GroupUsersDeleteOp {
return &GroupUsersDeleteOp{
Credential: s.credential,
Method: "DELETE",
Path: strings.Join([]string{"groups", groupID, "users"}, "/"),
Payload: userInfoList,
QueryOpts: make(url.Values),
}
}
// GroupUsersDeleteOp implements DocuSign API SDK UserGroups::deleteGroupUsers
type GroupUsersDeleteOp esign.Op
// Do executes the op. A nil context will return error.
func (op *GroupUsersDeleteOp) Do(ctx context.Context) (*model.UsersResponse, error) {
var res *model.UsersResponse
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// GroupUsersList gets a list of users in a group.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/usergroups/groupusers/list
//
// SDK Method UserGroups::listGroupUsers
func (s *Service) GroupUsersList(groupID string) *GroupUsersListOp {
return &GroupUsersListOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"groups", groupID, "users"}, "/"),
QueryOpts: make(url.Values),
}
}
// GroupUsersListOp implements DocuSign API SDK UserGroups::listGroupUsers
type GroupUsersListOp esign.Op
// Do executes the op. A nil context will return error.
func (op *GroupUsersListOp) Do(ctx context.Context) (*model.UsersResponse, error) {
var res *model.UsersResponse
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// Count number of records to return. The number must be greater than 1 and less than or equal to 100.
func (op *GroupUsersListOp) Count(val int) *GroupUsersListOp {
if op != nil {
op.QueryOpts.Set("count", fmt.Sprintf("%d", val))
}
return op
}
// StartPosition starting value for the list.
func (op *GroupUsersListOp) StartPosition(val int) *GroupUsersListOp {
if op != nil {
op.QueryOpts.Set("start_position", fmt.Sprintf("%d", val))
}
return op
}
// GroupUsersUpdate adds one or more users to an existing group.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/usergroups/groupusers/update
//
// SDK Method UserGroups::updateGroupUsers
func (s *Service) GroupUsersUpdate(groupID string, userInfoList *model.UserInfoList) *GroupUsersUpdateOp {
return &GroupUsersUpdateOp{
Credential: s.credential,
Method: "PUT",
Path: strings.Join([]string{"groups", groupID, "users"}, "/"),
Payload: userInfoList,
QueryOpts: make(url.Values),
}
}
// GroupUsersUpdateOp implements DocuSign API SDK UserGroups::updateGroupUsers
type GroupUsersUpdateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *GroupUsersUpdateOp) Do(ctx context.Context) (*model.UsersResponse, error) {
var res *model.UsersResponse
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// GroupsCreate creates one or more groups for the account.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/usergroups/groups/create
//
// SDK Method UserGroups::createGroups
func (s *Service) GroupsCreate(groups *model.GroupInformation) *GroupsCreateOp {
return &GroupsCreateOp{
Credential: s.credential,
Method: "POST",
Path: "groups",
Payload: groups,
QueryOpts: make(url.Values),
}
}
// GroupsCreateOp implements DocuSign API SDK UserGroups::createGroups
type GroupsCreateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *GroupsCreateOp) Do(ctx context.Context) (*model.GroupInformation, error) {
var res *model.GroupInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// GroupsDelete deletes an existing user group.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/usergroups/groups/delete
//
// SDK Method UserGroups::deleteGroups
func (s *Service) GroupsDelete(groups *model.GroupInformation) *GroupsDeleteOp {
return &GroupsDeleteOp{
Credential: s.credential,
Method: "DELETE",
Path: "groups",
Payload: groups,
QueryOpts: make(url.Values),
}
}
// GroupsDeleteOp implements DocuSign API SDK UserGroups::deleteGroups
type GroupsDeleteOp esign.Op
// Do executes the op. A nil context will return error.
func (op *GroupsDeleteOp) Do(ctx context.Context) (*model.GroupInformation, error) {
var res *model.GroupInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// GroupsList gets information about groups associated with the account.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/usergroups/groups/list
//
// SDK Method UserGroups::listGroups
func (s *Service) GroupsList() *GroupsListOp {
return &GroupsListOp{
Credential: s.credential,
Method: "GET",
Path: "groups",
QueryOpts: make(url.Values),
}
}
// GroupsListOp implements DocuSign API SDK UserGroups::listGroups
type GroupsListOp esign.Op
// Do executes the op. A nil context will return error.
func (op *GroupsListOp) Do(ctx context.Context) (*model.GroupInformation, error) {
var res *model.GroupInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// Count number of records to return. The number must be greater than 1 and less than or equal to 100.
func (op *GroupsListOp) Count(val int) *GroupsListOp {
if op != nil {
op.QueryOpts.Set("count", fmt.Sprintf("%d", val))
}
return op
}
// GroupType set the call query parameter group_type
func (op *GroupsListOp) GroupType(val string) *GroupsListOp {
if op != nil {
op.QueryOpts.Set("group_type", val)
}
return op
}
// SearchText set the call query parameter search_text
func (op *GroupsListOp) SearchText(val string) *GroupsListOp {
if op != nil {
op.QueryOpts.Set("search_text", val)
}
return op
}
// StartPosition starting value for the list.
func (op *GroupsListOp) StartPosition(val int) *GroupsListOp {
if op != nil {
op.QueryOpts.Set("start_position", fmt.Sprintf("%d", val))
}
return op
}
// GroupsUpdate updates the group information for a group.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/usergroups/groups/update
//
// SDK Method UserGroups::updateGroups
func (s *Service) GroupsUpdate(groups *model.GroupInformation) *GroupsUpdateOp {
return &GroupsUpdateOp{
Credential: s.credential,
Method: "PUT",
Path: "groups",
Payload: groups,
QueryOpts: make(url.Values),
}
}
// GroupsUpdateOp implements DocuSign API SDK UserGroups::updateGroups
type GroupsUpdateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *GroupsUpdateOp) Do(ctx context.Context) (*model.GroupInformation, error) {
var res *model.GroupInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}