/* Hindsight HTTP API HTTP API for Hindsight API version: 0.4.16 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package hindsight import ( "encoding/json" "bytes" "fmt" ) // checks if the CreateWebhookRequest type satisfies the MappedNullable interface at compile time var _ MappedNullable = &CreateWebhookRequest{} // CreateWebhookRequest Request model for registering a webhook. type CreateWebhookRequest struct { // HTTP(S) endpoint URL to deliver events to Url string `json:"url"` Secret NullableString `json:"secret,omitempty"` // List of event types to deliver. Currently supported: 'consolidation.completed' EventTypes []string `json:"event_types,omitempty"` // Whether this webhook is active Enabled *bool `json:"enabled,omitempty"` // HTTP delivery configuration (method, timeout, headers, params) HttpConfig *WebhookHttpConfig `json:"http_config,omitempty"` } type _CreateWebhookRequest CreateWebhookRequest // NewCreateWebhookRequest instantiates a new CreateWebhookRequest 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 NewCreateWebhookRequest(url string) *CreateWebhookRequest { this := CreateWebhookRequest{} this.Url = url var enabled bool = true this.Enabled = &enabled return &this } // NewCreateWebhookRequestWithDefaults instantiates a new CreateWebhookRequest 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 NewCreateWebhookRequestWithDefaults() *CreateWebhookRequest { this := CreateWebhookRequest{} var enabled bool = true this.Enabled = &enabled return &this } // GetUrl returns the Url field value func (o *CreateWebhookRequest) GetUrl() string { if o == nil { var ret string return ret } return o.Url } // GetUrlOk returns a tuple with the Url field value // and a boolean to check if the value has been set. func (o *CreateWebhookRequest) GetUrlOk() (*string, bool) { if o == nil { return nil, false } return &o.Url, true } // SetUrl sets field value func (o *CreateWebhookRequest) SetUrl(v string) { o.Url = v } // GetSecret returns the Secret field value if set, zero value otherwise (both if not set or set to explicit null). func (o *CreateWebhookRequest) GetSecret() string { if o == nil || IsNil(o.Secret.Get()) { var ret string return ret } return *o.Secret.Get() } // GetSecretOk returns a tuple with the Secret field value if set, nil otherwise // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *CreateWebhookRequest) GetSecretOk() (*string, bool) { if o == nil { return nil, false } return o.Secret.Get(), o.Secret.IsSet() } // HasSecret returns a boolean if a field has been set. func (o *CreateWebhookRequest) HasSecret() bool { if o != nil && o.Secret.IsSet() { return true } return false } // SetSecret gets a reference to the given NullableString and assigns it to the Secret field. func (o *CreateWebhookRequest) SetSecret(v string) { o.Secret.Set(&v) } // SetSecretNil sets the value for Secret to be an explicit nil func (o *CreateWebhookRequest) SetSecretNil() { o.Secret.Set(nil) } // UnsetSecret ensures that no value is present for Secret, not even an explicit nil func (o *CreateWebhookRequest) UnsetSecret() { o.Secret.Unset() } // GetEventTypes returns the EventTypes field value if set, zero value otherwise. func (o *CreateWebhookRequest) GetEventTypes() []string { if o == nil || IsNil(o.EventTypes) { var ret []string return ret } return o.EventTypes } // GetEventTypesOk returns a tuple with the EventTypes field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *CreateWebhookRequest) GetEventTypesOk() ([]string, bool) { if o == nil || IsNil(o.EventTypes) { return nil, false } return o.EventTypes, true } // HasEventTypes returns a boolean if a field has been set. func (o *CreateWebhookRequest) HasEventTypes() bool { if o != nil && !IsNil(o.EventTypes) { return true } return false } // SetEventTypes gets a reference to the given []string and assigns it to the EventTypes field. func (o *CreateWebhookRequest) SetEventTypes(v []string) { o.EventTypes = v } // GetEnabled returns the Enabled field value if set, zero value otherwise. func (o *CreateWebhookRequest) GetEnabled() bool { if o == nil || IsNil(o.Enabled) { var ret bool return ret } return *o.Enabled } // GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *CreateWebhookRequest) GetEnabledOk() (*bool, bool) { if o == nil || IsNil(o.Enabled) { return nil, false } return o.Enabled, true } // HasEnabled returns a boolean if a field has been set. func (o *CreateWebhookRequest) HasEnabled() bool { if o != nil && !IsNil(o.Enabled) { return true } return false } // SetEnabled gets a reference to the given bool and assigns it to the Enabled field. func (o *CreateWebhookRequest) SetEnabled(v bool) { o.Enabled = &v } // GetHttpConfig returns the HttpConfig field value if set, zero value otherwise. func (o *CreateWebhookRequest) GetHttpConfig() WebhookHttpConfig { if o == nil || IsNil(o.HttpConfig) { var ret WebhookHttpConfig return ret } return *o.HttpConfig } // GetHttpConfigOk returns a tuple with the HttpConfig field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *CreateWebhookRequest) GetHttpConfigOk() (*WebhookHttpConfig, bool) { if o == nil || IsNil(o.HttpConfig) { return nil, false } return o.HttpConfig, true } // HasHttpConfig returns a boolean if a field has been set. func (o *CreateWebhookRequest) HasHttpConfig() bool { if o != nil && !IsNil(o.HttpConfig) { return true } return false } // SetHttpConfig gets a reference to the given WebhookHttpConfig and assigns it to the HttpConfig field. func (o *CreateWebhookRequest) SetHttpConfig(v WebhookHttpConfig) { o.HttpConfig = &v } func (o CreateWebhookRequest) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } return json.Marshal(toSerialize) } func (o CreateWebhookRequest) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["url"] = o.Url if o.Secret.IsSet() { toSerialize["secret"] = o.Secret.Get() } if !IsNil(o.EventTypes) { toSerialize["event_types"] = o.EventTypes } if !IsNil(o.Enabled) { toSerialize["enabled"] = o.Enabled } if !IsNil(o.HttpConfig) { toSerialize["http_config"] = o.HttpConfig } return toSerialize, nil } func (o *CreateWebhookRequest) UnmarshalJSON(data []byte) (err error) { // This validates that all required properties are included in the JSON object // by unmarshalling the object into a generic map with string keys and checking // that every required field exists as a key in the generic map. requiredProperties := []string{ "url", } allProperties := make(map[string]interface{}) err = json.Unmarshal(data, &allProperties) if err != nil { return err; } for _, requiredProperty := range(requiredProperties) { if _, exists := allProperties[requiredProperty]; !exists { return fmt.Errorf("no value given for required property %v", requiredProperty) } } varCreateWebhookRequest := _CreateWebhookRequest{} decoder := json.NewDecoder(bytes.NewReader(data)) decoder.DisallowUnknownFields() err = decoder.Decode(&varCreateWebhookRequest) if err != nil { return err } *o = CreateWebhookRequest(varCreateWebhookRequest) return err } type NullableCreateWebhookRequest struct { value *CreateWebhookRequest isSet bool } func (v NullableCreateWebhookRequest) Get() *CreateWebhookRequest { return v.value } func (v *NullableCreateWebhookRequest) Set(val *CreateWebhookRequest) { v.value = val v.isSet = true } func (v NullableCreateWebhookRequest) IsSet() bool { return v.isSet } func (v *NullableCreateWebhookRequest) Unset() { v.value = nil v.isSet = false } func NewNullableCreateWebhookRequest(val *CreateWebhookRequest) *NullableCreateWebhookRequest { return &NullableCreateWebhookRequest{value: val, isSet: true} } func (v NullableCreateWebhookRequest) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableCreateWebhookRequest) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }