-
Notifications
You must be signed in to change notification settings - Fork 2
/
webhooktest.go
69 lines (58 loc) · 2.96 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
package files_sdk
import (
"encoding/json"
lib "github.com/Files-com/files-sdk-go/v2/lib"
)
type WebhookTest struct {
Code int64 `json:"code,omitempty" path:"code"`
Message string `json:"message,omitempty" path:"message"`
Status string `json:"status,omitempty" path:"status"`
Data Auto `json:"data,omitempty" path:"data"`
Success *bool `json:"success,omitempty" path:"success"`
Url string `json:"url,omitempty" path:"url"`
Method string `json:"method,omitempty" path:"method"`
Encoding string `json:"encoding,omitempty" path:"encoding"`
Headers json.RawMessage `json:"headers,omitempty" path:"headers"`
Body json.RawMessage `json:"body,omitempty" path:"body"`
RawBody string `json:"raw_body,omitempty" path:"raw_body"`
FileAsBody *bool `json:"file_as_body,omitempty" path:"file_as_body"`
FileFormField string `json:"file_form_field,omitempty" path:"file_form_field"`
Action string `json:"action,omitempty" path:"action"`
}
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 json.RawMessage `url:"headers,omitempty" required:"false" json:"headers,omitempty" path:"headers"`
Body json.RawMessage `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"`
}
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
}