Repository navigation
Expand file tree
/
Copy pathmodel_error_info.go
More file actions
527 lines (440 loc) · 16.9 KB
/
Copy pathmodel_error_info.go
File metadata and controls
527 lines (440 loc) · 16.9 KB
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
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
/*
DocSpring API
Use DocSpring's API to fill PDF forms, generate PDFs and Word documents from HTML or Word templates, merge PDFs, and request legally binding e-signatures.
API version: v2
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package docspring
import (
"encoding/json"
"fmt"
)
// checks if the ErrorInfo type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &ErrorInfo{}
// ErrorInfo What went wrong.
type ErrorInfo struct {
// A machine-readable error code. Clients should handle codes they don't know: new codes can be added. `invalid_data`: a submission's data doesn't match its template's fields. The submission is still recorded. `insufficient_credits` (402): your credit balance can't cover a live PDF. The record was saved and waits for credits in the `insufficient_credits` state: its ID is in `submission_id`, `submission_batch_id` or `combined_pdf_id`. `insufficient_credits_to_send` (402): your credit balance can't cover a live signature request that DocSpring would email, so nothing was saved. Add credits and send the request again. `upgrade_required` (403): your plan doesn't include this, such as more templates, another active integration (webhooks count), the embedded template editor, email actions, or live signature requests before your account's first payment. `account_suspended` (403): the account is suspended, so it can't create submissions. `polling_timeout`: on a sync.api host, the files weren't ready in time. The record was created and is still being processed: its ID is in `submission_id`, `submission_batch_id`, `combined_pdf_id` or `template_id`. Without one of these IDs, the request itself got no answer in time, and the record may or may not have been created. `idempotency_key_in_use` (409): the first request with the same Idempotency-Key is still being processed, and the response has a `Retry-After` header: send the request again then. Without the header, the first request was processed but its response is no longer kept. When the first request created a record, its ID is in `submission_id`, `submission_batch_id`, `combined_pdf_id`, `template_id`, `folder_id`, `custom_file_id` or `webhook_id`. `idempotency_key_reused` (422): the Idempotency-Key was already used for a different request. `rate_limited` (429): too many API requests. Wait for the `Retry-After` header's seconds. `daily_email_limit_reached` (429): a submission that DocSpring would email would take your account over its daily email limit, so nothing was saved. Send it again after the `Retry-After` header's seconds (midnight UTC), or send the signing links yourself (`send_email: false`).
Code ErrorCode `json:"code"`
// A human-readable explanation, safe to show to developers.
Message string `json:"message"`
// What was wrong with each part of the request. Empty when the error isn't about one part of it.
Details []ErrorDetail `json:"details"`
// The ID of the request. Include it when you contact support.
RequestId NullableString `json:"request_id"`
// When a submission's data fails validation, the submission is still recorded (state `invalid_data`) so you can see it in the dashboard. This is its ID. With `insufficient_credits`, the submission that waits for credits. With `polling_timeout`, the submission that's still being processed. With `idempotency_key_in_use`, the submission the first request with the key created.
SubmissionId *string `json:"submission_id,omitempty"`
// The ID of the recorded batch, when items in a batch fail validation. With `insufficient_credits`, the batch whose submissions wait for credits. With `polling_timeout`, the batch that's still being processed. With `idempotency_key_in_use`, the batch the first request with the key created.
SubmissionBatchId *string `json:"submission_batch_id,omitempty"`
// With `insufficient_credits`, the combined PDF that waits for credits. With `polling_timeout`, the combined PDF that's still being processed. With `idempotency_key_in_use`, the combined PDF the first request with the key created.
CombinedPdfId *string `json:"combined_pdf_id,omitempty"`
// With `polling_timeout`, the template whose PDF is still being processed. With `idempotency_key_in_use`, the template the first request with the key created.
TemplateId *string `json:"template_id,omitempty"`
// With `idempotency_key_in_use`, the folder the first request with the key created.
FolderId *string `json:"folder_id,omitempty"`
// With `idempotency_key_in_use`, the custom file the first request with the key created.
CustomFileId *string `json:"custom_file_id,omitempty"`
// With `idempotency_key_in_use`, the webhook the first request with the key created.
WebhookId *string `json:"webhook_id,omitempty"`
AdditionalProperties map[string]interface{}
}
type _ErrorInfo ErrorInfo
// NewErrorInfo instantiates a new ErrorInfo object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewErrorInfo(code ErrorCode, message string, details []ErrorDetail, requestId NullableString) *ErrorInfo {
this := ErrorInfo{}
this.Code = code
this.Message = message
this.Details = details
this.RequestId = requestId
return &this
}
// NewErrorInfoWithDefaults instantiates a new ErrorInfo object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewErrorInfoWithDefaults() *ErrorInfo {
this := ErrorInfo{}
return &this
}
// GetCode returns the Code field value
func (o *ErrorInfo) GetCode() ErrorCode {
if o == nil {
var ret ErrorCode
return ret
}
return o.Code
}
// GetCodeOk returns a tuple with the Code field value
// and a boolean to check if the value has been set.
func (o *ErrorInfo) GetCodeOk() (*ErrorCode, bool) {
if o == nil {
return nil, false
}
return &o.Code, true
}
// SetCode sets field value
func (o *ErrorInfo) SetCode(v ErrorCode) {
o.Code = v
}
// GetMessage returns the Message field value
func (o *ErrorInfo) GetMessage() string {
if o == nil {
var ret string
return ret
}
return o.Message
}
// GetMessageOk returns a tuple with the Message field value
// and a boolean to check if the value has been set.
func (o *ErrorInfo) GetMessageOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Message, true
}
// SetMessage sets field value
func (o *ErrorInfo) SetMessage(v string) {
o.Message = v
}
// GetDetails returns the Details field value
func (o *ErrorInfo) GetDetails() []ErrorDetail {
if o == nil {
var ret []ErrorDetail
return ret
}
return o.Details
}
// GetDetailsOk returns a tuple with the Details field value
// and a boolean to check if the value has been set.
func (o *ErrorInfo) GetDetailsOk() ([]ErrorDetail, bool) {
if o == nil {
return nil, false
}
return o.Details, true
}
// SetDetails sets field value
func (o *ErrorInfo) SetDetails(v []ErrorDetail) {
o.Details = v
}
// GetRequestId returns the RequestId field value
// If the value is explicit nil, the zero value for string will be returned
func (o *ErrorInfo) GetRequestId() string {
if o == nil || o.RequestId.Get() == nil {
var ret string
return ret
}
return *o.RequestId.Get()
}
// GetRequestIdOk returns a tuple with the RequestId field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *ErrorInfo) GetRequestIdOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.RequestId.Get(), o.RequestId.IsSet()
}
// SetRequestId sets field value
func (o *ErrorInfo) SetRequestId(v string) {
o.RequestId.Set(&v)
}
// GetSubmissionId returns the SubmissionId field value if set, zero value otherwise.
func (o *ErrorInfo) GetSubmissionId() string {
if o == nil || IsNil(o.SubmissionId) {
var ret string
return ret
}
return *o.SubmissionId
}
// GetSubmissionIdOk returns a tuple with the SubmissionId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ErrorInfo) GetSubmissionIdOk() (*string, bool) {
if o == nil || IsNil(o.SubmissionId) {
return nil, false
}
return o.SubmissionId, true
}
// HasSubmissionId returns a boolean if a field has been set.
func (o *ErrorInfo) HasSubmissionId() bool {
if o != nil && !IsNil(o.SubmissionId) {
return true
}
return false
}
// SetSubmissionId gets a reference to the given string and assigns it to the SubmissionId field.
func (o *ErrorInfo) SetSubmissionId(v string) {
o.SubmissionId = &v
}
// GetSubmissionBatchId returns the SubmissionBatchId field value if set, zero value otherwise.
func (o *ErrorInfo) GetSubmissionBatchId() string {
if o == nil || IsNil(o.SubmissionBatchId) {
var ret string
return ret
}
return *o.SubmissionBatchId
}
// GetSubmissionBatchIdOk returns a tuple with the SubmissionBatchId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ErrorInfo) GetSubmissionBatchIdOk() (*string, bool) {
if o == nil || IsNil(o.SubmissionBatchId) {
return nil, false
}
return o.SubmissionBatchId, true
}
// HasSubmissionBatchId returns a boolean if a field has been set.
func (o *ErrorInfo) HasSubmissionBatchId() bool {
if o != nil && !IsNil(o.SubmissionBatchId) {
return true
}
return false
}
// SetSubmissionBatchId gets a reference to the given string and assigns it to the SubmissionBatchId field.
func (o *ErrorInfo) SetSubmissionBatchId(v string) {
o.SubmissionBatchId = &v
}
// GetCombinedPdfId returns the CombinedPdfId field value if set, zero value otherwise.
func (o *ErrorInfo) GetCombinedPdfId() string {
if o == nil || IsNil(o.CombinedPdfId) {
var ret string
return ret
}
return *o.CombinedPdfId
}
// GetCombinedPdfIdOk returns a tuple with the CombinedPdfId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ErrorInfo) GetCombinedPdfIdOk() (*string, bool) {
if o == nil || IsNil(o.CombinedPdfId) {
return nil, false
}
return o.CombinedPdfId, true
}
// HasCombinedPdfId returns a boolean if a field has been set.
func (o *ErrorInfo) HasCombinedPdfId() bool {
if o != nil && !IsNil(o.CombinedPdfId) {
return true
}
return false
}
// SetCombinedPdfId gets a reference to the given string and assigns it to the CombinedPdfId field.
func (o *ErrorInfo) SetCombinedPdfId(v string) {
o.CombinedPdfId = &v
}
// GetTemplateId returns the TemplateId field value if set, zero value otherwise.
func (o *ErrorInfo) GetTemplateId() string {
if o == nil || IsNil(o.TemplateId) {
var ret string
return ret
}
return *o.TemplateId
}
// GetTemplateIdOk returns a tuple with the TemplateId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ErrorInfo) GetTemplateIdOk() (*string, bool) {
if o == nil || IsNil(o.TemplateId) {
return nil, false
}
return o.TemplateId, true
}
// HasTemplateId returns a boolean if a field has been set.
func (o *ErrorInfo) HasTemplateId() bool {
if o != nil && !IsNil(o.TemplateId) {
return true
}
return false
}
// SetTemplateId gets a reference to the given string and assigns it to the TemplateId field.
func (o *ErrorInfo) SetTemplateId(v string) {
o.TemplateId = &v
}
// GetFolderId returns the FolderId field value if set, zero value otherwise.
func (o *ErrorInfo) GetFolderId() string {
if o == nil || IsNil(o.FolderId) {
var ret string
return ret
}
return *o.FolderId
}
// GetFolderIdOk returns a tuple with the FolderId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ErrorInfo) GetFolderIdOk() (*string, bool) {
if o == nil || IsNil(o.FolderId) {
return nil, false
}
return o.FolderId, true
}
// HasFolderId returns a boolean if a field has been set.
func (o *ErrorInfo) HasFolderId() bool {
if o != nil && !IsNil(o.FolderId) {
return true
}
return false
}
// SetFolderId gets a reference to the given string and assigns it to the FolderId field.
func (o *ErrorInfo) SetFolderId(v string) {
o.FolderId = &v
}
// GetCustomFileId returns the CustomFileId field value if set, zero value otherwise.
func (o *ErrorInfo) GetCustomFileId() string {
if o == nil || IsNil(o.CustomFileId) {
var ret string
return ret
}
return *o.CustomFileId
}
// GetCustomFileIdOk returns a tuple with the CustomFileId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ErrorInfo) GetCustomFileIdOk() (*string, bool) {
if o == nil || IsNil(o.CustomFileId) {
return nil, false
}
return o.CustomFileId, true
}
// HasCustomFileId returns a boolean if a field has been set.
func (o *ErrorInfo) HasCustomFileId() bool {
if o != nil && !IsNil(o.CustomFileId) {
return true
}
return false
}
// SetCustomFileId gets a reference to the given string and assigns it to the CustomFileId field.
func (o *ErrorInfo) SetCustomFileId(v string) {
o.CustomFileId = &v
}
// GetWebhookId returns the WebhookId field value if set, zero value otherwise.
func (o *ErrorInfo) GetWebhookId() string {
if o == nil || IsNil(o.WebhookId) {
var ret string
return ret
}
return *o.WebhookId
}
// GetWebhookIdOk returns a tuple with the WebhookId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ErrorInfo) GetWebhookIdOk() (*string, bool) {
if o == nil || IsNil(o.WebhookId) {
return nil, false
}
return o.WebhookId, true
}
// HasWebhookId returns a boolean if a field has been set.
func (o *ErrorInfo) HasWebhookId() bool {
if o != nil && !IsNil(o.WebhookId) {
return true
}
return false
}
// SetWebhookId gets a reference to the given string and assigns it to the WebhookId field.
func (o *ErrorInfo) SetWebhookId(v string) {
o.WebhookId = &v
}
func (o ErrorInfo) MarshalJSON() ([]byte, error) {
toSerialize,err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o ErrorInfo) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["code"] = o.Code
toSerialize["message"] = o.Message
toSerialize["details"] = o.Details
toSerialize["request_id"] = o.RequestId.Get()
if !IsNil(o.SubmissionId) {
toSerialize["submission_id"] = o.SubmissionId
}
if !IsNil(o.SubmissionBatchId) {
toSerialize["submission_batch_id"] = o.SubmissionBatchId
}
if !IsNil(o.CombinedPdfId) {
toSerialize["combined_pdf_id"] = o.CombinedPdfId
}
if !IsNil(o.TemplateId) {
toSerialize["template_id"] = o.TemplateId
}
if !IsNil(o.FolderId) {
toSerialize["folder_id"] = o.FolderId
}
if !IsNil(o.CustomFileId) {
toSerialize["custom_file_id"] = o.CustomFileId
}
if !IsNil(o.WebhookId) {
toSerialize["webhook_id"] = o.WebhookId
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *ErrorInfo) UnmarshalJSON(data []byte) (err error) {
// This validates that all required properties are included in the JSON object
// by unmarshalling the object into a generic map with string keys and checking
// that every required field exists as a key in the generic map.
requiredProperties := []string{
"code",
"message",
"details",
"request_id",
}
allProperties := make(map[string]interface{})
err = json.Unmarshal(data, &allProperties)
if err != nil {
return err;
}
for _, requiredProperty := range(requiredProperties) {
if _, exists := allProperties[requiredProperty]; !exists {
return fmt.Errorf("no value given for required property %v", requiredProperty)
}
}
varErrorInfo := _ErrorInfo{}
err = json.Unmarshal(data, &varErrorInfo)
if err != nil {
return err
}
*o = ErrorInfo(varErrorInfo)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "code")
delete(additionalProperties, "message")
delete(additionalProperties, "details")
delete(additionalProperties, "request_id")
delete(additionalProperties, "submission_id")
delete(additionalProperties, "submission_batch_id")
delete(additionalProperties, "combined_pdf_id")
delete(additionalProperties, "template_id")
delete(additionalProperties, "folder_id")
delete(additionalProperties, "custom_file_id")
delete(additionalProperties, "webhook_id")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableErrorInfo struct {
value *ErrorInfo
isSet bool
}
func (v NullableErrorInfo) Get() *ErrorInfo {
return v.value
}
func (v *NullableErrorInfo) Set(val *ErrorInfo) {
v.value = val
v.isSet = true
}
func (v NullableErrorInfo) IsSet() bool {
return v.isSet
}
func (v *NullableErrorInfo) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableErrorInfo(val *ErrorInfo) *NullableErrorInfo {
return &NullableErrorInfo{value: val, isSet: true}
}
func (v NullableErrorInfo) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableErrorInfo) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}