Files
sdk/model_webhook_endpoint.go

535 lines
15 KiB
Go

/*
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
API version: v1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package hanzoai
import (
"encoding/json"
)
// checks if the WebhookEndpoint type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &WebhookEndpoint{}
// WebhookEndpoint struct for WebhookEndpoint
type WebhookEndpoint struct {
// CreatedAt is when the endpoint was registered, RFC3339 in UTC — stored in that spelling because it sorts as a string.
Created *string `json:"created,omitempty"`
// Deliveries7d is how many deliveries SETTLED in the trailing 7 days — the attempts that ended ok or failed, so a delivery still retrying is in neither counter yet. It is counted from the log at read time rather than stored, and it is filled only on a list or a get; a create answers 0 because there is no history, which is why it is never omitted.
Deliveries7d *int64 `json:"deliveries7d,omitempty"`
// Description is the operator's own label for the endpoint. Never sent anywhere.
Description *string `json:"description,omitempty"`
// Events are the subject patterns this endpoint subscribes to (\"commerce.order.>\"). An EMPTY list means every event, not none.
Events []string `json:"events,omitempty"`
// Failures7d is how many of those settled as failed — the subscriber never accepted it and no further attempt will be made. It is the numerator to Deliveries7d, over the same window.
Failures7d *int64 `json:"failures7d,omitempty"`
// ID is the endpoint's handle, server-minted and stable for its life. It is what every other route here addresses.
Id *string `json:"id,omitempty"`
// Org is the tenant that owns the endpoint, taken from the validated principal rather than from any request field.
Org *string `json:"org,omitempty"`
// Secret is the HMAC-SHA256 signing key a subscriber recomputes the signature with. It is returned exactly ONCE, on create: a later read of the endpoint omits it, so a lost secret is replaced rather than recovered.
Secret *string `json:"secret,omitempty"`
// Status is \"active\" or \"disabled\" — nothing else is accepted. A disabled endpoint keeps its subscription and receives no deliveries, except a manual test send, which goes out anyway.
Status *string `json:"status,omitempty"`
// UpdatedAt is when its url, events, status or description last changed.
Updated *string `json:"updated,omitempty"`
// URL is where the POST goes. Changing it is the one edit that redirects an org's events, which is why it is never bindable from a query string.
Url *string `json:"url,omitempty"`
AdditionalProperties map[string]interface{}
}
type _WebhookEndpoint WebhookEndpoint
// NewWebhookEndpoint instantiates a new WebhookEndpoint 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 NewWebhookEndpoint() *WebhookEndpoint {
this := WebhookEndpoint{}
return &this
}
// NewWebhookEndpointWithDefaults instantiates a new WebhookEndpoint 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 NewWebhookEndpointWithDefaults() *WebhookEndpoint {
this := WebhookEndpoint{}
return &this
}
// GetCreated returns the Created field value if set, zero value otherwise.
func (o *WebhookEndpoint) GetCreated() string {
if o == nil || IsNil(o.Created) {
var ret string
return ret
}
return *o.Created
}
// GetCreatedOk returns a tuple with the Created field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *WebhookEndpoint) GetCreatedOk() (*string, bool) {
if o == nil || IsNil(o.Created) {
return nil, false
}
return o.Created, true
}
// HasCreated returns a boolean if a field has been set.
func (o *WebhookEndpoint) HasCreated() bool {
if o != nil && !IsNil(o.Created) {
return true
}
return false
}
// SetCreated gets a reference to the given string and assigns it to the Created field.
func (o *WebhookEndpoint) SetCreated(v string) {
o.Created = &v
}
// GetDeliveries7d returns the Deliveries7d field value if set, zero value otherwise.
func (o *WebhookEndpoint) GetDeliveries7d() int64 {
if o == nil || IsNil(o.Deliveries7d) {
var ret int64
return ret
}
return *o.Deliveries7d
}
// GetDeliveries7dOk returns a tuple with the Deliveries7d field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *WebhookEndpoint) GetDeliveries7dOk() (*int64, bool) {
if o == nil || IsNil(o.Deliveries7d) {
return nil, false
}
return o.Deliveries7d, true
}
// HasDeliveries7d returns a boolean if a field has been set.
func (o *WebhookEndpoint) HasDeliveries7d() bool {
if o != nil && !IsNil(o.Deliveries7d) {
return true
}
return false
}
// SetDeliveries7d gets a reference to the given int64 and assigns it to the Deliveries7d field.
func (o *WebhookEndpoint) SetDeliveries7d(v int64) {
o.Deliveries7d = &v
}
// GetDescription returns the Description field value if set, zero value otherwise.
func (o *WebhookEndpoint) GetDescription() string {
if o == nil || IsNil(o.Description) {
var ret string
return ret
}
return *o.Description
}
// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *WebhookEndpoint) GetDescriptionOk() (*string, bool) {
if o == nil || IsNil(o.Description) {
return nil, false
}
return o.Description, true
}
// HasDescription returns a boolean if a field has been set.
func (o *WebhookEndpoint) HasDescription() bool {
if o != nil && !IsNil(o.Description) {
return true
}
return false
}
// SetDescription gets a reference to the given string and assigns it to the Description field.
func (o *WebhookEndpoint) SetDescription(v string) {
o.Description = &v
}
// GetEvents returns the Events field value if set, zero value otherwise.
func (o *WebhookEndpoint) GetEvents() []string {
if o == nil || IsNil(o.Events) {
var ret []string
return ret
}
return o.Events
}
// GetEventsOk returns a tuple with the Events field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *WebhookEndpoint) GetEventsOk() ([]string, bool) {
if o == nil || IsNil(o.Events) {
return nil, false
}
return o.Events, true
}
// HasEvents returns a boolean if a field has been set.
func (o *WebhookEndpoint) HasEvents() bool {
if o != nil && !IsNil(o.Events) {
return true
}
return false
}
// SetEvents gets a reference to the given []string and assigns it to the Events field.
func (o *WebhookEndpoint) SetEvents(v []string) {
o.Events = v
}
// GetFailures7d returns the Failures7d field value if set, zero value otherwise.
func (o *WebhookEndpoint) GetFailures7d() int64 {
if o == nil || IsNil(o.Failures7d) {
var ret int64
return ret
}
return *o.Failures7d
}
// GetFailures7dOk returns a tuple with the Failures7d field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *WebhookEndpoint) GetFailures7dOk() (*int64, bool) {
if o == nil || IsNil(o.Failures7d) {
return nil, false
}
return o.Failures7d, true
}
// HasFailures7d returns a boolean if a field has been set.
func (o *WebhookEndpoint) HasFailures7d() bool {
if o != nil && !IsNil(o.Failures7d) {
return true
}
return false
}
// SetFailures7d gets a reference to the given int64 and assigns it to the Failures7d field.
func (o *WebhookEndpoint) SetFailures7d(v int64) {
o.Failures7d = &v
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *WebhookEndpoint) GetId() string {
if o == nil || IsNil(o.Id) {
var ret string
return ret
}
return *o.Id
}
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *WebhookEndpoint) GetIdOk() (*string, bool) {
if o == nil || IsNil(o.Id) {
return nil, false
}
return o.Id, true
}
// HasId returns a boolean if a field has been set.
func (o *WebhookEndpoint) HasId() bool {
if o != nil && !IsNil(o.Id) {
return true
}
return false
}
// SetId gets a reference to the given string and assigns it to the Id field.
func (o *WebhookEndpoint) SetId(v string) {
o.Id = &v
}
// GetOrg returns the Org field value if set, zero value otherwise.
func (o *WebhookEndpoint) GetOrg() string {
if o == nil || IsNil(o.Org) {
var ret string
return ret
}
return *o.Org
}
// GetOrgOk returns a tuple with the Org field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *WebhookEndpoint) GetOrgOk() (*string, bool) {
if o == nil || IsNil(o.Org) {
return nil, false
}
return o.Org, true
}
// HasOrg returns a boolean if a field has been set.
func (o *WebhookEndpoint) HasOrg() bool {
if o != nil && !IsNil(o.Org) {
return true
}
return false
}
// SetOrg gets a reference to the given string and assigns it to the Org field.
func (o *WebhookEndpoint) SetOrg(v string) {
o.Org = &v
}
// GetSecret returns the Secret field value if set, zero value otherwise.
func (o *WebhookEndpoint) GetSecret() string {
if o == nil || IsNil(o.Secret) {
var ret string
return ret
}
return *o.Secret
}
// GetSecretOk returns a tuple with the Secret field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *WebhookEndpoint) GetSecretOk() (*string, bool) {
if o == nil || IsNil(o.Secret) {
return nil, false
}
return o.Secret, true
}
// HasSecret returns a boolean if a field has been set.
func (o *WebhookEndpoint) HasSecret() bool {
if o != nil && !IsNil(o.Secret) {
return true
}
return false
}
// SetSecret gets a reference to the given string and assigns it to the Secret field.
func (o *WebhookEndpoint) SetSecret(v string) {
o.Secret = &v
}
// GetStatus returns the Status field value if set, zero value otherwise.
func (o *WebhookEndpoint) GetStatus() string {
if o == nil || IsNil(o.Status) {
var ret string
return ret
}
return *o.Status
}
// GetStatusOk returns a tuple with the Status field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *WebhookEndpoint) GetStatusOk() (*string, bool) {
if o == nil || IsNil(o.Status) {
return nil, false
}
return o.Status, true
}
// HasStatus returns a boolean if a field has been set.
func (o *WebhookEndpoint) HasStatus() bool {
if o != nil && !IsNil(o.Status) {
return true
}
return false
}
// SetStatus gets a reference to the given string and assigns it to the Status field.
func (o *WebhookEndpoint) SetStatus(v string) {
o.Status = &v
}
// GetUpdated returns the Updated field value if set, zero value otherwise.
func (o *WebhookEndpoint) GetUpdated() string {
if o == nil || IsNil(o.Updated) {
var ret string
return ret
}
return *o.Updated
}
// GetUpdatedOk returns a tuple with the Updated field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *WebhookEndpoint) GetUpdatedOk() (*string, bool) {
if o == nil || IsNil(o.Updated) {
return nil, false
}
return o.Updated, true
}
// HasUpdated returns a boolean if a field has been set.
func (o *WebhookEndpoint) HasUpdated() bool {
if o != nil && !IsNil(o.Updated) {
return true
}
return false
}
// SetUpdated gets a reference to the given string and assigns it to the Updated field.
func (o *WebhookEndpoint) SetUpdated(v string) {
o.Updated = &v
}
// GetUrl returns the Url field value if set, zero value otherwise.
func (o *WebhookEndpoint) GetUrl() string {
if o == nil || IsNil(o.Url) {
var ret string
return ret
}
return *o.Url
}
// GetUrlOk returns a tuple with the Url field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *WebhookEndpoint) GetUrlOk() (*string, bool) {
if o == nil || IsNil(o.Url) {
return nil, false
}
return o.Url, true
}
// HasUrl returns a boolean if a field has been set.
func (o *WebhookEndpoint) HasUrl() bool {
if o != nil && !IsNil(o.Url) {
return true
}
return false
}
// SetUrl gets a reference to the given string and assigns it to the Url field.
func (o *WebhookEndpoint) SetUrl(v string) {
o.Url = &v
}
func (o WebhookEndpoint) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o WebhookEndpoint) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Created) {
toSerialize["created"] = o.Created
}
if !IsNil(o.Deliveries7d) {
toSerialize["deliveries7d"] = o.Deliveries7d
}
if !IsNil(o.Description) {
toSerialize["description"] = o.Description
}
if !IsNil(o.Events) {
toSerialize["events"] = o.Events
}
if !IsNil(o.Failures7d) {
toSerialize["failures7d"] = o.Failures7d
}
if !IsNil(o.Id) {
toSerialize["id"] = o.Id
}
if !IsNil(o.Org) {
toSerialize["org"] = o.Org
}
if !IsNil(o.Secret) {
toSerialize["secret"] = o.Secret
}
if !IsNil(o.Status) {
toSerialize["status"] = o.Status
}
if !IsNil(o.Updated) {
toSerialize["updated"] = o.Updated
}
if !IsNil(o.Url) {
toSerialize["url"] = o.Url
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *WebhookEndpoint) UnmarshalJSON(data []byte) (err error) {
varWebhookEndpoint := _WebhookEndpoint{}
err = json.Unmarshal(data, &varWebhookEndpoint)
if err != nil {
return err
}
*o = WebhookEndpoint(varWebhookEndpoint)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "created")
delete(additionalProperties, "deliveries7d")
delete(additionalProperties, "description")
delete(additionalProperties, "events")
delete(additionalProperties, "failures7d")
delete(additionalProperties, "id")
delete(additionalProperties, "org")
delete(additionalProperties, "secret")
delete(additionalProperties, "status")
delete(additionalProperties, "updated")
delete(additionalProperties, "url")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableWebhookEndpoint struct {
value *WebhookEndpoint
isSet bool
}
func (v NullableWebhookEndpoint) Get() *WebhookEndpoint {
return v.value
}
func (v *NullableWebhookEndpoint) Set(val *WebhookEndpoint) {
v.value = val
v.isSet = true
}
func (v NullableWebhookEndpoint) IsSet() bool {
return v.isSet
}
func (v *NullableWebhookEndpoint) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableWebhookEndpoint(val *WebhookEndpoint) *NullableWebhookEndpoint {
return &NullableWebhookEndpoint{value: val, isSet: true}
}
func (v NullableWebhookEndpoint) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableWebhookEndpoint) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}