forked from jfcote87/esign
-
Notifications
You must be signed in to change notification settings - Fork 0
/
diagnostics.go
231 lines (202 loc) · 7.31 KB
/
diagnostics.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
// 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 diagnostics implements the DocuSign SDK
// category Diagnostics.
//
// The Diagnostics category provides miscellaneous end points.
//
// They include:
// * Requesting and managing the API call-logging feature. (Perfect for debugging your app!)
// * Getting information on the API's resources and versions.
//
// Service Api documentation may be found at:
// https://developers.docusign.com/esign-rest-api/v2/reference/Diagnostics
// Usage example:
//
// import (
// "github.com/thaitanloi365/esign"
// "github.com/thaitanloi365/esign/v2/diagnostics"
// "github.com/thaitanloi365/esign/v2/model"
// )
// ...
// diagnosticsService := diagnostics.New(esignCredential)
package diagnostics // import "github.com/thaitanloi365/esign/v2/diagnostics"
import (
"context"
"net/url"
"strings"
"github.com/thaitanloi365/esign"
"github.com/thaitanloi365/esign/v2/model"
)
// Service implements DocuSign Diagnostics Category API operations
type Service struct {
credential esign.Credential
}
// New initializes a diagnostics service using cred to authorize ops.
func New(cred esign.Credential) *Service {
return &Service{credential: cred}
}
// RequestLogsDelete deletes the request log files.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/diagnostics/requestlogs/delete
//
// SDK Method Diagnostics::deleteRequestLogs
func (s *Service) RequestLogsDelete() *RequestLogsDeleteOp {
return &RequestLogsDeleteOp{
Credential: s.credential,
Method: "DELETE",
Path: "/v2/diagnostics/request_logs",
QueryOpts: make(url.Values),
}
}
// RequestLogsDeleteOp implements DocuSign API SDK Diagnostics::deleteRequestLogs
type RequestLogsDeleteOp esign.Op
// Do executes the op. A nil context will return error.
func (op *RequestLogsDeleteOp) Do(ctx context.Context) error {
return ((*esign.Op)(op)).Do(ctx, nil)
}
// RequestLogsGet gets a request logging log file.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/diagnostics/requestlogs/get
//
// SDK Method Diagnostics::getRequestLog
func (s *Service) RequestLogsGet(requestLogID string) *RequestLogsGetOp {
return &RequestLogsGetOp{
Credential: s.credential,
Method: "GET",
Path: strings.Join([]string{"", "v2", "diagnostics", "request_logs", requestLogID}, "/"),
Accept: "text/plain",
QueryOpts: make(url.Values),
}
}
// RequestLogsGetOp implements DocuSign API SDK Diagnostics::getRequestLog
type RequestLogsGetOp esign.Op
// Do executes the op. A nil context will return error.
func (op *RequestLogsGetOp) Do(ctx context.Context) (*esign.Download, error) {
var res *esign.Download
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// RequestLogsGetSettings gets the API request logging settings.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/diagnostics/requestlogs/getsettings
//
// SDK Method Diagnostics::getRequestLogSettings
func (s *Service) RequestLogsGetSettings() *RequestLogsGetSettingsOp {
return &RequestLogsGetSettingsOp{
Credential: s.credential,
Method: "GET",
Path: "/v2/diagnostics/settings",
QueryOpts: make(url.Values),
}
}
// RequestLogsGetSettingsOp implements DocuSign API SDK Diagnostics::getRequestLogSettings
type RequestLogsGetSettingsOp esign.Op
// Do executes the op. A nil context will return error.
func (op *RequestLogsGetSettingsOp) Do(ctx context.Context) (*model.DiagnosticsSettingsInformation, error) {
var res *model.DiagnosticsSettingsInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// RequestLogsList gets the API request logging log files.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/diagnostics/requestlogs/list
//
// SDK Method Diagnostics::listRequestLogs
func (s *Service) RequestLogsList() *RequestLogsListOp {
return &RequestLogsListOp{
Credential: s.credential,
Method: "GET",
Path: "/v2/diagnostics/request_logs",
QueryOpts: make(url.Values),
}
}
// RequestLogsListOp implements DocuSign API SDK Diagnostics::listRequestLogs
type RequestLogsListOp esign.Op
// Do executes the op. A nil context will return error.
func (op *RequestLogsListOp) Do(ctx context.Context) (*model.APIRequestLogsResult, error) {
var res *model.APIRequestLogsResult
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// Encoding set the call query parameter encoding
func (op *RequestLogsListOp) Encoding(val string) *RequestLogsListOp {
if op != nil {
op.QueryOpts.Set("encoding", val)
}
return op
}
// Zip returns a zip file containing log files by setting
// the Accept header to application/zip
//
// **not included in swagger definition
func (op *RequestLogsListOp) Zip(ctx context.Context) (*esign.Download, error) {
var res *esign.Download
if op == nil {
return nil, esign.ErrNilOp
}
newOp := esign.Op(*op)
newOp.Accept = "application/zip"
return res, (&newOp).Do(ctx, &res)
}
// RequestLogsUpdateSettings enables or disables API request logging for troubleshooting.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/diagnostics/requestlogs/updatesettings
//
// SDK Method Diagnostics::updateRequestLogSettings
func (s *Service) RequestLogsUpdateSettings(requestLogs *model.DiagnosticsSettingsInformation) *RequestLogsUpdateSettingsOp {
return &RequestLogsUpdateSettingsOp{
Credential: s.credential,
Method: "PUT",
Path: "/v2/diagnostics/settings",
Payload: requestLogs,
QueryOpts: make(url.Values),
}
}
// RequestLogsUpdateSettingsOp implements DocuSign API SDK Diagnostics::updateRequestLogSettings
type RequestLogsUpdateSettingsOp esign.Op
// Do executes the op. A nil context will return error.
func (op *RequestLogsUpdateSettingsOp) Do(ctx context.Context) (*model.DiagnosticsSettingsInformation, error) {
var res *model.DiagnosticsSettingsInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// ResourcesGet lists resources for REST version specified
//
// https://developers.docusign.com/esign-rest-api/v2/reference/diagnostics/resources/get
//
// SDK Method Diagnostics::getResources
func (s *Service) ResourcesGet() *ResourcesGetOp {
return &ResourcesGetOp{
Credential: s.credential,
Method: "GET",
Path: "/v2",
QueryOpts: make(url.Values),
}
}
// ResourcesGetOp implements DocuSign API SDK Diagnostics::getResources
type ResourcesGetOp esign.Op
// Do executes the op. A nil context will return error.
func (op *ResourcesGetOp) Do(ctx context.Context) (*model.ResourceInformation, error) {
var res *model.ResourceInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}
// ServicesGet retrieves the available REST API versions.
//
// https://developers.docusign.com/esign-rest-api/v2/reference/diagnostics/services/get
//
// SDK Method Diagnostics::getService
func (s *Service) ServicesGet() *ServicesGetOp {
return &ServicesGetOp{
Credential: s.credential,
Method: "GET",
Path: "/service_information",
QueryOpts: make(url.Values),
}
}
// ServicesGetOp implements DocuSign API SDK Diagnostics::getService
type ServicesGetOp esign.Op
// Do executes the op. A nil context will return error.
func (op *ServicesGetOp) Do(ctx context.Context) (*model.ServiceInformation, error) {
var res *model.ServiceInformation
return res, ((*esign.Op)(op)).Do(ctx, &res)
}