-
Notifications
You must be signed in to change notification settings - Fork 26
/
regions.go
executable file
·192 lines (168 loc) · 5.77 KB
/
regions.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
// 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 regions implements the DocuSign SDK
// category Regions.
//
// This section shows you how to create and manage regions for a Rooms account.
//
//
// Service Api documentation may be found at:
// https://developers.docusign.com/docs/rooms-api/reference/Regions
// Usage example:
//
// import (
// "github.com/jfcote87/esign"
// "github.com/jfcote87/esign/rooms"
// )
// ...
// regionsService := regions.New(esignCredential)
package regions // import "github.com/jfcote87/esignrooms//regions"
import (
"context"
"fmt"
"net/url"
"strings"
"github.com/jfcote87/esign"
"github.com/jfcote87/esign/rooms"
)
// Service implements DocuSign Regions API operations
type Service struct {
credential esign.Credential
}
// New initializes a regions service using cred to authorize ops.
func New(cred esign.Credential) *Service {
return &Service{credential: cred}
}
// CreateRegion creates a region.
//
// https://developers.docusign.com/docs/rooms-api/reference/regions/regions/createregion
//
// SDK Method Regions::CreateRegion
func (s *Service) CreateRegion(body *rooms.Region) *CreateRegionOp {
return &CreateRegionOp{
Credential: s.credential,
Method: "POST",
Path: "regions",
Payload: body,
Accept: "application/json-patch+json, application/json, text/json, application/*+json",
QueryOpts: make(url.Values),
Version: esign.RoomsV2,
}
}
// CreateRegionOp implements DocuSign API SDK Regions::CreateRegion
type CreateRegionOp esign.Op
// Do executes the op. A nil context will return error.
func (op *CreateRegionOp) Do(ctx context.Context) (*rooms.Region, error) {
var res *rooms.Region
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// DeleteRegion deletes a region.
//
// https://developers.docusign.com/docs/rooms-api/reference/regions/regions/deleteregion
//
// SDK Method Regions::DeleteRegion
func (s *Service) DeleteRegion(regionID string) *DeleteRegionOp {
return &DeleteRegionOp{
Credential: s.credential,
Method: "DELETE",
Path: strings.Join([]string{"regions", regionID}, "/"),
QueryOpts: make(url.Values),
Version: esign.RoomsV2,
}
}
// DeleteRegionOp implements DocuSign API SDK Regions::DeleteRegion
type DeleteRegionOp esign.Op
// Do executes the op. A nil context will return error.
func (op *DeleteRegionOp) Do(ctx context.Context) error {
return ((*esign.Op)(op)).Do(ctx, nil)
}
// GetRegion gets information about a region.
//
// https://developers.docusign.com/docs/rooms-api/reference/regions/regions/getregion
//
// SDK Method Regions::GetRegion
func (s *Service) GetRegion(regionID string) *GetRegionOp {
return &GetRegionOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"regions", regionID}, "/"),
Accept: "application/json",
QueryOpts: make(url.Values),
Version: esign.RoomsV2,
}
}
// GetRegionOp implements DocuSign API SDK Regions::GetRegion
type GetRegionOp esign.Op
// Do executes the op. A nil context will return error.
func (op *GetRegionOp) Do(ctx context.Context) (*rooms.Region, error) {
var res *rooms.Region
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// GetRegionReferenceCounts retrieves the number and type of objects that reference a region.
//
// https://developers.docusign.com/docs/rooms-api/reference/regions/regions/getregionreferencecounts
//
// SDK Method Regions::GetRegionReferenceCounts
func (s *Service) GetRegionReferenceCounts(regionID string) *GetRegionReferenceCountsOp {
return &GetRegionReferenceCountsOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"regions", regionID, "reference_counts"}, "/"),
Accept: "application/json",
QueryOpts: make(url.Values),
Version: esign.RoomsV2,
}
}
// GetRegionReferenceCountsOp implements DocuSign API SDK Regions::GetRegionReferenceCounts
type GetRegionReferenceCountsOp esign.Op
// Do executes the op. A nil context will return error.
func (op *GetRegionReferenceCountsOp) Do(ctx context.Context) (*rooms.RegionReferenceCountList, error) {
var res *rooms.RegionReferenceCountList
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// GetRegions gets regions.
//
// https://developers.docusign.com/docs/rooms-api/reference/regions/regions/getregions
//
// SDK Method Regions::GetRegions
func (s *Service) GetRegions() *GetRegionsOp {
return &GetRegionsOp{
Credential: s.credential,
Method: "GET",
Path: "regions",
Accept: "application/json",
QueryOpts: make(url.Values),
Version: esign.RoomsV2,
}
}
// GetRegionsOp implements DocuSign API SDK Regions::GetRegions
type GetRegionsOp esign.Op
// Do executes the op. A nil context will return error.
func (op *GetRegionsOp) Do(ctx context.Context) (*rooms.RegionSummaryList, error) {
var res *rooms.RegionSummaryList
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// Count (Optional) The number of results to return. This value must be a number between `1` and `100` (default).
func (op *GetRegionsOp) Count(val int) *GetRegionsOp {
if op != nil {
op.QueryOpts.Set("count", fmt.Sprintf("%d", val))
}
return op
}
// StartPosition (Optional) The starting zero-based index position of the results set from which to begin returning values. The default value is `0`.
func (op *GetRegionsOp) StartPosition(val int) *GetRegionsOp {
if op != nil {
op.QueryOpts.Set("startPosition", fmt.Sprintf("%d", val))
}
return op
}
// ManagedOnly (Optional) When set to **true**, only the regions that the current user manages are returned. The default value is **false**.
func (op *GetRegionsOp) ManagedOnly() *GetRegionsOp {
if op != nil {
op.QueryOpts.Set("managedOnly", "true")
}
return op
}