-
Notifications
You must be signed in to change notification settings - Fork 2
/
webhooktest.go
73 lines (61 loc) · 3.95 KB
/
webhooktest.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
package files_sdk
import (
"encoding/json"
lib "github.com/Files-com/files-sdk-go/v3/lib"
)
type WebhookTest struct {
Code int64 `json:"code,omitempty" path:"code,omitempty" url:"code,omitempty"`
Message string `json:"message,omitempty" path:"message,omitempty" url:"message,omitempty"`
Status string `json:"status,omitempty" path:"status,omitempty" url:"status,omitempty"`
Data Auto `json:"data,omitempty" path:"data,omitempty" url:"data,omitempty"`
Success *bool `json:"success,omitempty" path:"success,omitempty" url:"success,omitempty"`
Url string `json:"url,omitempty" path:"url,omitempty" url:"url,omitempty"`
Method string `json:"method,omitempty" path:"method,omitempty" url:"method,omitempty"`
Encoding string `json:"encoding,omitempty" path:"encoding,omitempty" url:"encoding,omitempty"`
Headers map[string]interface{} `json:"headers,omitempty" path:"headers,omitempty" url:"headers,omitempty"`
Body map[string]interface{} `json:"body,omitempty" path:"body,omitempty" url:"body,omitempty"`
RawBody string `json:"raw_body,omitempty" path:"raw_body,omitempty" url:"raw_body,omitempty"`
FileAsBody *bool `json:"file_as_body,omitempty" path:"file_as_body,omitempty" url:"file_as_body,omitempty"`
FileFormField string `json:"file_form_field,omitempty" path:"file_form_field,omitempty" url:"file_form_field,omitempty"`
Action string `json:"action,omitempty" path:"action,omitempty" url:"action,omitempty"`
UseDedicatedIps *bool `json:"use_dedicated_ips,omitempty" path:"use_dedicated_ips,omitempty" url:"use_dedicated_ips,omitempty"`
}
// Identifier no path or id
type WebhookTestCollection []WebhookTest
type WebhookTestCreateParams struct {
Url string `url:"url,omitempty" required:"true" json:"url,omitempty" path:"url"`
Method string `url:"method,omitempty" required:"false" json:"method,omitempty" path:"method"`
Encoding string `url:"encoding,omitempty" required:"false" json:"encoding,omitempty" path:"encoding"`
Headers map[string]interface{} `url:"headers,omitempty" required:"false" json:"headers,omitempty" path:"headers"`
Body map[string]interface{} `url:"body,omitempty" required:"false" json:"body,omitempty" path:"body"`
RawBody string `url:"raw_body,omitempty" required:"false" json:"raw_body,omitempty" path:"raw_body"`
FileAsBody *bool `url:"file_as_body,omitempty" required:"false" json:"file_as_body,omitempty" path:"file_as_body"`
FileFormField string `url:"file_form_field,omitempty" required:"false" json:"file_form_field,omitempty" path:"file_form_field"`
Action string `url:"action,omitempty" required:"false" json:"action,omitempty" path:"action"`
UseDedicatedIps *bool `url:"use_dedicated_ips,omitempty" required:"false" json:"use_dedicated_ips,omitempty" path:"use_dedicated_ips"`
}
func (w *WebhookTest) UnmarshalJSON(data []byte) error {
type webhookTest WebhookTest
var v webhookTest
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, map[string]interface{}{})
}
*w = WebhookTest(v)
return nil
}
func (w *WebhookTestCollection) UnmarshalJSON(data []byte) error {
type webhookTests WebhookTestCollection
var v webhookTests
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, []map[string]interface{}{})
}
*w = WebhookTestCollection(v)
return nil
}
func (w *WebhookTestCollection) ToSlice() *[]interface{} {
ret := make([]interface{}, len(*w))
for i, v := range *w {
ret[i] = v
}
return &ret
}