-
Notifications
You must be signed in to change notification settings - Fork 14
/
inbound.go
96 lines (84 loc) · 2.42 KB
/
inbound.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
// This file was auto-generated by Fern from our API Definition.
package api
import (
json "encoding/json"
fmt "fmt"
core "github.com/trycourier/courier-go/v3/core"
)
type InboundTrackEvent struct {
// A descriptive name of the event. This name will appear as a trigger in the Courier Automation Trigger node.
Event string `json:"event" url:"event"`
// A required unique identifier that will be used to de-duplicate requests. If not unique, will respond with 409 Conflict status
MessageId string `json:"messageId" url:"messageId"`
Properties map[string]interface{} `json:"properties,omitempty" url:"properties,omitempty"`
// The user id assocatiated with the track
UserId *string `json:"userId,omitempty" url:"userId,omitempty"`
type_ string
_rawJSON json.RawMessage
}
func (i *InboundTrackEvent) Type() string {
return i.type_
}
func (i *InboundTrackEvent) UnmarshalJSON(data []byte) error {
type embed InboundTrackEvent
var unmarshaler = struct {
embed
}{
embed: embed(*i),
}
if err := json.Unmarshal(data, &unmarshaler); err != nil {
return err
}
*i = InboundTrackEvent(unmarshaler.embed)
i.type_ = "track"
i._rawJSON = json.RawMessage(data)
return nil
}
func (i *InboundTrackEvent) MarshalJSON() ([]byte, error) {
type embed InboundTrackEvent
var marshaler = struct {
embed
Type string `json:"type"`
}{
embed: embed(*i),
Type: "track",
}
return json.Marshal(marshaler)
}
func (i *InboundTrackEvent) String() string {
if len(i._rawJSON) > 0 {
if value, err := core.StringifyJSON(i._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(i); err == nil {
return value
}
return fmt.Sprintf("%#v", i)
}
type TrackAcceptedResponse struct {
// A successful call returns a `202` status code along with a `requestId` in the response body.
MessageId string `json:"messageId" url:"messageId"`
_rawJSON json.RawMessage
}
func (t *TrackAcceptedResponse) UnmarshalJSON(data []byte) error {
type unmarshaler TrackAcceptedResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*t = TrackAcceptedResponse(value)
t._rawJSON = json.RawMessage(data)
return nil
}
func (t *TrackAcceptedResponse) String() string {
if len(t._rawJSON) > 0 {
if value, err := core.StringifyJSON(t._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(t); err == nil {
return value
}
return fmt.Sprintf("%#v", t)
}