forked from svix/svix-webhooks
/
model_endpoint_created_event.go
148 lines (122 loc) · 6.43 KB
/
model_endpoint_created_event.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
/*
* Svix API
*
* Welcome to the Svix API documentation! Useful links: [Homepage](https://www.svix.com) | [Support email](mailto:support+docs@svix.com) | [Blog](https://www.svix.com/blog/) | [Slack Community](https://www.svix.com/slack/) # Introduction This is the reference documentation and schemas for the [Svix webhook service](https://www.svix.com) API. For tutorials and other documentation please refer to [the documentation](https://docs.svix.com). ## Main concepts In Svix you have four important entities you will be interacting with: - `messages`: these are the webhooks being sent. They can have contents and a few other properties. - `application`: this is where `messages` are sent to. Usually you want to create one application for each user on your platform. - `endpoint`: endpoints are the URLs messages will be sent to. Each application can have multiple `endpoints` and each message sent to that application will be sent to all of them (unless they are not subscribed to the sent event type). - `event-type`: event types are identifiers denoting the type of the message being sent. Event types are primarily used to decide which events are sent to which endpoint. ## Authentication Get your authentication token (`AUTH_TOKEN`) from the [Svix dashboard](https://dashboard.svix.com) and use it as part of the `Authorization` header as such: `Authorization: Bearer ${AUTH_TOKEN}`. <SecurityDefinitions /> ## Code samples The code samples assume you already have the respective libraries installed and you know how to use them. For the latest information on how to do that, please refer to [the documentation](https://docs.svix.com/). ## Idempotency Svix supports [idempotency](https://en.wikipedia.org/wiki/Idempotence) for safely retrying requests without accidentally performing the same operation twice. This is useful when an API call is disrupted in transit and you do not receive a response. To perform an idempotent request, pass the idempotency key in the `Idempotency-Key` header to the request. The idempotency key should be a unique value generated by the client. You can create the key in however way you like, though we suggest using UUID v4, or any other string with enough entropy to avoid collisions. Svix's idempotency works by saving the resulting status code and body of the first request made for any given idempotency key for any successful request. Subsequent requests with the same key return the same result. Please note that idempotency is only supported for `POST` requests. ## Cross-Origin Resource Sharing This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). And that allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.
*
* API version: 1.4
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package openapi
import (
"encoding/json"
)
// EndpointCreatedEvent Sent when an endpoint is created.
type EndpointCreatedEvent struct {
Data EndpointCreatedEventData `json:"data"`
Type *string `json:"type,omitempty"`
}
// NewEndpointCreatedEvent instantiates a new EndpointCreatedEvent 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 NewEndpointCreatedEvent(data EndpointCreatedEventData) *EndpointCreatedEvent {
this := EndpointCreatedEvent{}
this.Data = data
var type_ string = "endpoint.created"
this.Type = &type_
return &this
}
// NewEndpointCreatedEventWithDefaults instantiates a new EndpointCreatedEvent 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 NewEndpointCreatedEventWithDefaults() *EndpointCreatedEvent {
this := EndpointCreatedEvent{}
var type_ string = "endpoint.created"
this.Type = &type_
return &this
}
// GetData returns the Data field value
func (o *EndpointCreatedEvent) GetData() EndpointCreatedEventData {
if o == nil {
var ret EndpointCreatedEventData
return ret
}
return o.Data
}
// GetDataOk returns a tuple with the Data field value
// and a boolean to check if the value has been set.
func (o *EndpointCreatedEvent) GetDataOk() (*EndpointCreatedEventData, bool) {
if o == nil {
return nil, false
}
return &o.Data, true
}
// SetData sets field value
func (o *EndpointCreatedEvent) SetData(v EndpointCreatedEventData) {
o.Data = v
}
// GetType returns the Type field value if set, zero value otherwise.
func (o *EndpointCreatedEvent) GetType() string {
if o == nil || o.Type == nil {
var ret string
return ret
}
return *o.Type
}
// GetTypeOk returns a tuple with the Type field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *EndpointCreatedEvent) GetTypeOk() (*string, bool) {
if o == nil || o.Type == nil {
return nil, false
}
return o.Type, true
}
// HasType returns a boolean if a field has been set.
func (o *EndpointCreatedEvent) HasType() bool {
if o != nil && o.Type != nil {
return true
}
return false
}
// SetType gets a reference to the given string and assigns it to the Type field.
func (o *EndpointCreatedEvent) SetType(v string) {
o.Type = &v
}
func (o EndpointCreatedEvent) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if true {
toSerialize["data"] = o.Data
}
if o.Type != nil {
toSerialize["type"] = o.Type
}
return json.Marshal(toSerialize)
}
type NullableEndpointCreatedEvent struct {
value *EndpointCreatedEvent
isSet bool
}
func (v NullableEndpointCreatedEvent) Get() *EndpointCreatedEvent {
return v.value
}
func (v *NullableEndpointCreatedEvent) Set(val *EndpointCreatedEvent) {
v.value = val
v.isSet = true
}
func (v NullableEndpointCreatedEvent) IsSet() bool {
return v.isSet
}
func (v *NullableEndpointCreatedEvent) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableEndpointCreatedEvent(val *EndpointCreatedEvent) *NullableEndpointCreatedEvent {
return &NullableEndpointCreatedEvent{value: val, isSet: true}
}
func (v NullableEndpointCreatedEvent) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableEndpointCreatedEvent) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}