-
Notifications
You must be signed in to change notification settings - Fork 26
/
cloudstorage.go
executable file
·388 lines (346 loc) · 11.9 KB
/
cloudstorage.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
// Copyright 2022 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 cloudstorage implements the DocuSign SDK
// category CloudStorage.
//
// Use the Cloud Storage category to list the user's cloud storage document contents.
//
// It is also used to manage the user's authentication/accounts with cloud storage service providers.
//
//
// Service Api documentation may be found at:
// https://developers.docusign.com/docs/esign-rest-api/reference/CloudStorage
// Usage example:
//
// import (
// "github.com/jfcote87/esign"
// "github.com/jfcote87/esign/v2.1/model"
// )
// ...
// cloudstorageService := cloudstorage.New(esignCredential)
package cloudstorage // import "github.com/jfcote87/esignv2.1/cloudstorage"
import (
"context"
"fmt"
"net/url"
"strings"
"github.com/jfcote87/esign"
"github.com/jfcote87/esign/v2.1/model"
)
// Service implements DocuSign CloudStorage API operations
type Service struct {
credential esign.Credential
}
// New initializes a cloudstorage service using cred to authorize ops.
func New(cred esign.Credential) *Service {
return &Service{credential: cred}
}
// List gets a list of items from a cloud storage provider.
//
// https://developers.docusign.com/docs/esign-rest-api/reference/cloudstorage/cloudstorage/list
//
// SDK Method CloudStorage::list
func (s *Service) List(folderID string, serviceID string, userID string) *ListOp {
return &ListOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"users", userID, "cloud_storage", serviceID, "folders", folderID}, "/"),
Accept: "application/json",
QueryOpts: make(url.Values),
Version: esign.APIv21,
}
}
// ListOp implements DocuSign API SDK CloudStorage::list
type ListOp esign.Op
// Do executes the op. A nil context will return error.
func (op *ListOp) Do(ctx context.Context) (*model.ExternalFolder, error) {
var res *model.ExternalFolder
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// CloudStorageFolderPath is the file path to a cloud storage folder.
func (op *ListOp) CloudStorageFolderPath(val string) *ListOp {
if op != nil {
op.QueryOpts.Set("cloud_storage_folder_path", val)
}
return op
}
// CloudStorageFolderidPlain is a plain-text folder ID that you can use as an alternative to the existing folder id. This property is mainly used for rooms. Enter multiple folder IDs as a comma-separated list.
func (op *ListOp) CloudStorageFolderidPlain(val string) *ListOp {
if op != nil {
op.QueryOpts.Set("cloud_storage_folderid_plain", val)
}
return op
}
// Count is the maximum number of results to return.
//
// Use `start_position` to specify the number of results to skip.
//
// Default: `25`
func (op *ListOp) Count(val int) *ListOp {
if op != nil {
op.QueryOpts.Set("count", fmt.Sprintf("%d", val))
}
return op
}
// Order is the order in which to sort the results.
//
// Valid values are:
//
//
// * `asc`: Ascending order.
// * `desc`: Descending order.
func (op *ListOp) Order(val string) *ListOp {
if op != nil {
op.QueryOpts.Set("order", val)
}
return op
}
// OrderBy is the file attribute to use to sort the results.
//
// Valid values are:
//
// * `modified`
// * `name`
func (op *ListOp) OrderBy(val string) *ListOp {
if op != nil {
op.QueryOpts.Set("order_by", val)
}
return op
}
// SearchText use this parameter to search for specific text.
func (op *ListOp) SearchText(val string) *ListOp {
if op != nil {
op.QueryOpts.Set("search_text", val)
}
return op
}
// StartPosition is the zero-based index of the
// result from which to start returning results.
//
// Use with `count` to limit the number
// of results.
//
// The default value is `0`.
func (op *ListOp) StartPosition(val int) *ListOp {
if op != nil {
op.QueryOpts.Set("start_position", fmt.Sprintf("%d", val))
}
return op
}
// ListFolders retrieves a list of all the items in a specified folder from the specified cloud storage provider.
//
// https://developers.docusign.com/docs/esign-rest-api/reference/cloudstorage/cloudstorage/listfolders
//
// SDK Method CloudStorage::listFolders
func (s *Service) ListFolders(serviceID string, userID string) *ListFoldersOp {
return &ListFoldersOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"users", userID, "cloud_storage", serviceID, "folders"}, "/"),
Accept: "application/json",
QueryOpts: make(url.Values),
Version: esign.APIv21,
}
}
// ListFoldersOp implements DocuSign API SDK CloudStorage::listFolders
type ListFoldersOp esign.Op
// Do executes the op. A nil context will return error.
func (op *ListFoldersOp) Do(ctx context.Context) (*model.ExternalFolder, error) {
var res *model.ExternalFolder
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// CloudStorageFolderPath is a comma separated list of folder IDs included in the request.
func (op *ListFoldersOp) CloudStorageFolderPath(val ...string) *ListFoldersOp {
if op != nil {
op.QueryOpts.Set("cloud_storage_folder_path", strings.Join(val, ","))
}
return op
}
// Count is the maximum number of results to return.
//
// Use `start_position` to specify the number of results to skip.
//
// Default: `25`
func (op *ListFoldersOp) Count(val int) *ListFoldersOp {
if op != nil {
op.QueryOpts.Set("count", fmt.Sprintf("%d", val))
}
return op
}
// Order is the order in which to sort the results.
//
// Valid values are:
//
//
// * `asc`: Ascending order.
// * `desc`: Descending order.
func (op *ListFoldersOp) Order(val string) *ListFoldersOp {
if op != nil {
op.QueryOpts.Set("order", val)
}
return op
}
// OrderBy is the file attribute to use to sort the results.
//
// Valid values are:
//
// * `modified`
// * `name`
func (op *ListFoldersOp) OrderBy(val string) *ListFoldersOp {
if op != nil {
op.QueryOpts.Set("order_by", val)
}
return op
}
// SearchText use this parameter to search for specific text.
func (op *ListFoldersOp) SearchText(val string) *ListFoldersOp {
if op != nil {
op.QueryOpts.Set("search_text", val)
}
return op
}
// StartPosition is the zero-based index of the
// result from which to start returning results.
//
// Use with `count` to limit the number
// of results.
//
// The default value is `0`.
func (op *ListFoldersOp) StartPosition(val int) *ListFoldersOp {
if op != nil {
op.QueryOpts.Set("start_position", fmt.Sprintf("%d", val))
}
return op
}
// ProvidersCreate configures the redirect URL information for one or more cloud storage providers for the specified user.
//
// https://developers.docusign.com/docs/esign-rest-api/reference/cloudstorage/cloudstorageproviders/create
//
// SDK Method CloudStorage::createProvider
func (s *Service) ProvidersCreate(userID string, cloudStorageProviders *model.CloudStorageProviders) *ProvidersCreateOp {
return &ProvidersCreateOp{
Credential: s.credential,
Method: "POST",
Path: strings.Join([]string{"users", userID, "cloud_storage"}, "/"),
Payload: cloudStorageProviders,
QueryOpts: make(url.Values),
Version: esign.APIv21,
}
}
// ProvidersCreateOp implements DocuSign API SDK CloudStorage::createProvider
type ProvidersCreateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *ProvidersCreateOp) Do(ctx context.Context) (*model.CloudStorageProviders, error) {
var res *model.CloudStorageProviders
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// ProvidersDelete deletes the user authentication information for the specified cloud storage provider.
//
// https://developers.docusign.com/docs/esign-rest-api/reference/cloudstorage/cloudstorageproviders/delete
//
// SDK Method CloudStorage::deleteProvider
func (s *Service) ProvidersDelete(serviceID string, userID string) *ProvidersDeleteOp {
return &ProvidersDeleteOp{
Credential: s.credential,
Method: "DELETE",
Path: strings.Join([]string{"users", userID, "cloud_storage", serviceID}, "/"),
Accept: "application/json",
QueryOpts: make(url.Values),
Version: esign.APIv21,
}
}
// ProvidersDeleteOp implements DocuSign API SDK CloudStorage::deleteProvider
type ProvidersDeleteOp esign.Op
// Do executes the op. A nil context will return error.
func (op *ProvidersDeleteOp) Do(ctx context.Context) (*model.CloudStorageProviders, error) {
var res *model.CloudStorageProviders
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// ProvidersDeleteList deletes the user authentication information for one or more cloud storage providers.
//
// https://developers.docusign.com/docs/esign-rest-api/reference/cloudstorage/cloudstorageproviders/deletelist
//
// SDK Method CloudStorage::deleteProviders
func (s *Service) ProvidersDeleteList(userID string, cloudStorageProviders *model.CloudStorageProviders) *ProvidersDeleteListOp {
return &ProvidersDeleteListOp{
Credential: s.credential,
Method: "DELETE",
Path: strings.Join([]string{"users", userID, "cloud_storage"}, "/"),
Payload: cloudStorageProviders,
Accept: "application/json",
QueryOpts: make(url.Values),
Version: esign.APIv21,
}
}
// ProvidersDeleteListOp implements DocuSign API SDK CloudStorage::deleteProviders
type ProvidersDeleteListOp esign.Op
// Do executes the op. A nil context will return error.
func (op *ProvidersDeleteListOp) Do(ctx context.Context) (*model.CloudStorageProviders, error) {
var res *model.CloudStorageProviders
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// ProvidersGet gets the specified Cloud Storage Provider configuration for the User.
//
// https://developers.docusign.com/docs/esign-rest-api/reference/cloudstorage/cloudstorageproviders/get
//
// SDK Method CloudStorage::getProvider
func (s *Service) ProvidersGet(serviceID string, userID string) *ProvidersGetOp {
return &ProvidersGetOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"users", userID, "cloud_storage", serviceID}, "/"),
Accept: "application/json",
QueryOpts: make(url.Values),
Version: esign.APIv21,
}
}
// ProvidersGetOp implements DocuSign API SDK CloudStorage::getProvider
type ProvidersGetOp esign.Op
// Do executes the op. A nil context will return error.
func (op *ProvidersGetOp) Do(ctx context.Context) (*model.CloudStorageProviders, error) {
var res *model.CloudStorageProviders
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// RedirectURL is the URL the user is redirected to after the cloud storage provider authenticates the user. Using this will append the redirectUrl to the authenticationUrl.
//
// The redirectUrl is restricted to URLs in the docusign.com or docusign.net domains.
func (op *ProvidersGetOp) RedirectURL(val string) *ProvidersGetOp {
if op != nil {
op.QueryOpts.Set("redirectUrl", val)
}
return op
}
// ProvidersList get the Cloud Storage Provider configuration for the specified user.
//
// https://developers.docusign.com/docs/esign-rest-api/reference/cloudstorage/cloudstorageproviders/list
//
// SDK Method CloudStorage::listProviders
func (s *Service) ProvidersList(userID string) *ProvidersListOp {
return &ProvidersListOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"users", userID, "cloud_storage"}, "/"),
Accept: "application/json",
QueryOpts: make(url.Values),
Version: esign.APIv21,
}
}
// ProvidersListOp implements DocuSign API SDK CloudStorage::listProviders
type ProvidersListOp esign.Op
// Do executes the op. A nil context will return error.
func (op *ProvidersListOp) Do(ctx context.Context) (*model.CloudStorageProviders, error) {
var res *model.CloudStorageProviders
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// RedirectURL is the URL the user is redirected to after the cloud storage provider authenticates the user. Using this will append the redirectUrl to the authenticationUrl.
//
// The redirectUrl is restricted to URLs in the docusign.com or docusign.net domains.
func (op *ProvidersListOp) RedirectURL(val string) *ProvidersListOp {
if op != nil {
op.QueryOpts.Set("redirectUrl", val)
}
return op
}