forked from jfcote87/esign
-
Notifications
You must be signed in to change notification settings - Fork 0
/
customtabs.go
171 lines (149 loc) · 4.93 KB
/
customtabs.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
// 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 customtabs implements the DocuSign SDK
// category CustomTabs.
//
// Custom Tabs enable accounts to have one or more pre-configured (custom) tabs. Custom tabs save time when users are tagging documents since the users don't have to manually set the tabs' parameters.
//
// This category enables custom tabs to be managed programmatically, including creation, deletion, etc.
//
// Service Api documentation may be found at:
// https://developers.docusign.com/esign-rest-api/v2/reference/CustomTabs
// Usage example:
//
// import (
// "github.com/thaitanloi365/esign"
// "github.com/thaitanloi365/esign/v2/customtabs"
// "github.com/thaitanloi365/esign/v2/model"
// )
// ...
// customtabsService := customtabs.New(esignCredential)
package customtabs // import "github.com/thaitanloi365/esign/v2/customtabs"
import (
"context"
"net/url"
"strings"
"github.com/thaitanloi365/esign"
"github.com/thaitanloi365/esign/v2/model"
)
// Service implements DocuSign CustomTabs Category API operations
type Service struct {
credential esign.Credential
}
// New initializes a customtabs service using cred to authorize ops.
func New(cred esign.Credential) *Service {
return &Service{credential: cred}
}
// Create creates a custom tab.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/customtabs/customtabs/create
//
// SDK Method CustomTabs::create
func (s *Service) Create(customTabs *model.TabMetadata) *CreateOp {
return &CreateOp{
Credential: s.credential,
Method: "POST",
Path: "tab_definitions",
Payload: customTabs,
QueryOpts: make(url.Values),
}
}
// CreateOp implements DocuSign API SDK CustomTabs::create
type CreateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *CreateOp) Do(ctx context.Context) (*model.TabMetadata, error) {
var res *model.TabMetadata
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// Delete deletes custom tab information.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/customtabs/customtabs/delete
//
// SDK Method CustomTabs::delete
func (s *Service) Delete(customTabID string) *DeleteOp {
return &DeleteOp{
Credential: s.credential,
Method: "DELETE",
Path: strings.Join([]string{"tab_definitions", customTabID}, "/"),
QueryOpts: make(url.Values),
}
}
// DeleteOp implements DocuSign API SDK CustomTabs::delete
type DeleteOp esign.Op
// Do executes the op. A nil context will return error.
func (op *DeleteOp) Do(ctx context.Context) error {
return ((*esign.Op)(op)).Do(ctx, nil)
}
// Get gets custom tab information.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/customtabs/customtabs/get
//
// SDK Method CustomTabs::get
func (s *Service) Get(customTabID string) *GetOp {
return &GetOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"tab_definitions", customTabID}, "/"),
QueryOpts: make(url.Values),
}
}
// GetOp implements DocuSign API SDK CustomTabs::get
type GetOp esign.Op
// Do executes the op. A nil context will return error.
func (op *GetOp) Do(ctx context.Context) (*model.TabMetadata, error) {
var res *model.TabMetadata
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// List gets a list of all account tabs.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/customtabs/customtabs/list
//
// SDK Method CustomTabs::list
func (s *Service) List() *ListOp {
return &ListOp{
Credential: s.credential,
Method: "GET",
Path: "tab_definitions",
QueryOpts: make(url.Values),
}
}
// ListOp implements DocuSign API SDK CustomTabs::list
type ListOp esign.Op
// Do executes the op. A nil context will return error.
func (op *ListOp) Do(ctx context.Context) (*model.TabMetadataList, error) {
var res *model.TabMetadataList
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// CustomTabOnly when set to **true**, only custom tabs are returned in the response.
func (op *ListOp) CustomTabOnly() *ListOp {
if op != nil {
op.QueryOpts.Set("custom_tab_only", "true")
}
return op
}
// Update updates custom tab information.
//
//
//
// https://developers.docusign.com/esign-rest-api/v2/reference/customtabs/customtabs/update
//
// SDK Method CustomTabs::update
func (s *Service) Update(customTabID string, customTabs *model.TabMetadata) *UpdateOp {
return &UpdateOp{
Credential: s.credential,
Method: "PUT",
Path: strings.Join([]string{"tab_definitions", customTabID}, "/"),
Payload: customTabs,
QueryOpts: make(url.Values),
}
}
// UpdateOp implements DocuSign API SDK CustomTabs::update
type UpdateOp esign.Op
// Do executes the op. A nil context will return error.
func (op *UpdateOp) Do(ctx context.Context) (*model.TabMetadata, error) {
var res *model.TabMetadata
return res, ((*esign.Op)(op)).Do(ctx, &res)
}