Files
sdk/model_campaign_campaign_write.go

345 lines
9.8 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 CampaignCampaignWrite type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &CampaignCampaignWrite{}
// CampaignCampaignWrite struct for CampaignCampaignWrite
type CampaignCampaignWrite struct {
// Audience is the segment or audience selector this campaign targets.
Audience *string `json:"audience,omitempty"`
// Budget is the campaign's total budget in CENTS. Negative reads as 0.
Budget *int64 `json:"budget,omitempty"`
// Channels are the fan-out targets, at most one per kind (paid, organic, email) and at most 12. A channel's status and provider id are server-owned: whatever the caller sends for them is replaced with \"pending\".
Channels []CampaignChannelSpec `json:"channels,omitempty"`
// Content is the ordered creative set. Content[0] is the active creative and the rest are A/B variants; at most 32, empty entries dropped.
Content []string `json:"content,omitempty"`
// Name is the campaign's display name. Required; trimmed and capped at 2048 characters.
Name *string `json:"name,omitempty"`
// ScheduleAt is when the campaign should run, in unix seconds. Negative reads as 0 (immediately).
ScheduleAt *int64 `json:"scheduleAt,omitempty"`
AdditionalProperties map[string]interface{}
}
type _CampaignCampaignWrite CampaignCampaignWrite
// NewCampaignCampaignWrite instantiates a new CampaignCampaignWrite 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 NewCampaignCampaignWrite() *CampaignCampaignWrite {
this := CampaignCampaignWrite{}
return &this
}
// NewCampaignCampaignWriteWithDefaults instantiates a new CampaignCampaignWrite 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 NewCampaignCampaignWriteWithDefaults() *CampaignCampaignWrite {
this := CampaignCampaignWrite{}
return &this
}
// GetAudience returns the Audience field value if set, zero value otherwise.
func (o *CampaignCampaignWrite) GetAudience() string {
if o == nil || IsNil(o.Audience) {
var ret string
return ret
}
return *o.Audience
}
// GetAudienceOk returns a tuple with the Audience field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CampaignCampaignWrite) GetAudienceOk() (*string, bool) {
if o == nil || IsNil(o.Audience) {
return nil, false
}
return o.Audience, true
}
// HasAudience returns a boolean if a field has been set.
func (o *CampaignCampaignWrite) HasAudience() bool {
if o != nil && !IsNil(o.Audience) {
return true
}
return false
}
// SetAudience gets a reference to the given string and assigns it to the Audience field.
func (o *CampaignCampaignWrite) SetAudience(v string) {
o.Audience = &v
}
// GetBudget returns the Budget field value if set, zero value otherwise.
func (o *CampaignCampaignWrite) GetBudget() int64 {
if o == nil || IsNil(o.Budget) {
var ret int64
return ret
}
return *o.Budget
}
// GetBudgetOk returns a tuple with the Budget field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CampaignCampaignWrite) GetBudgetOk() (*int64, bool) {
if o == nil || IsNil(o.Budget) {
return nil, false
}
return o.Budget, true
}
// HasBudget returns a boolean if a field has been set.
func (o *CampaignCampaignWrite) HasBudget() bool {
if o != nil && !IsNil(o.Budget) {
return true
}
return false
}
// SetBudget gets a reference to the given int64 and assigns it to the Budget field.
func (o *CampaignCampaignWrite) SetBudget(v int64) {
o.Budget = &v
}
// GetChannels returns the Channels field value if set, zero value otherwise.
func (o *CampaignCampaignWrite) GetChannels() []CampaignChannelSpec {
if o == nil || IsNil(o.Channels) {
var ret []CampaignChannelSpec
return ret
}
return o.Channels
}
// GetChannelsOk returns a tuple with the Channels field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CampaignCampaignWrite) GetChannelsOk() ([]CampaignChannelSpec, bool) {
if o == nil || IsNil(o.Channels) {
return nil, false
}
return o.Channels, true
}
// HasChannels returns a boolean if a field has been set.
func (o *CampaignCampaignWrite) HasChannels() bool {
if o != nil && !IsNil(o.Channels) {
return true
}
return false
}
// SetChannels gets a reference to the given []CampaignChannelSpec and assigns it to the Channels field.
func (o *CampaignCampaignWrite) SetChannels(v []CampaignChannelSpec) {
o.Channels = v
}
// GetContent returns the Content field value if set, zero value otherwise.
func (o *CampaignCampaignWrite) GetContent() []string {
if o == nil || IsNil(o.Content) {
var ret []string
return ret
}
return o.Content
}
// GetContentOk returns a tuple with the Content field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CampaignCampaignWrite) GetContentOk() ([]string, bool) {
if o == nil || IsNil(o.Content) {
return nil, false
}
return o.Content, true
}
// HasContent returns a boolean if a field has been set.
func (o *CampaignCampaignWrite) HasContent() bool {
if o != nil && !IsNil(o.Content) {
return true
}
return false
}
// SetContent gets a reference to the given []string and assigns it to the Content field.
func (o *CampaignCampaignWrite) SetContent(v []string) {
o.Content = v
}
// GetName returns the Name field value if set, zero value otherwise.
func (o *CampaignCampaignWrite) GetName() string {
if o == nil || IsNil(o.Name) {
var ret string
return ret
}
return *o.Name
}
// GetNameOk returns a tuple with the Name field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CampaignCampaignWrite) GetNameOk() (*string, bool) {
if o == nil || IsNil(o.Name) {
return nil, false
}
return o.Name, true
}
// HasName returns a boolean if a field has been set.
func (o *CampaignCampaignWrite) HasName() bool {
if o != nil && !IsNil(o.Name) {
return true
}
return false
}
// SetName gets a reference to the given string and assigns it to the Name field.
func (o *CampaignCampaignWrite) SetName(v string) {
o.Name = &v
}
// GetScheduleAt returns the ScheduleAt field value if set, zero value otherwise.
func (o *CampaignCampaignWrite) GetScheduleAt() int64 {
if o == nil || IsNil(o.ScheduleAt) {
var ret int64
return ret
}
return *o.ScheduleAt
}
// GetScheduleAtOk returns a tuple with the ScheduleAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CampaignCampaignWrite) GetScheduleAtOk() (*int64, bool) {
if o == nil || IsNil(o.ScheduleAt) {
return nil, false
}
return o.ScheduleAt, true
}
// HasScheduleAt returns a boolean if a field has been set.
func (o *CampaignCampaignWrite) HasScheduleAt() bool {
if o != nil && !IsNil(o.ScheduleAt) {
return true
}
return false
}
// SetScheduleAt gets a reference to the given int64 and assigns it to the ScheduleAt field.
func (o *CampaignCampaignWrite) SetScheduleAt(v int64) {
o.ScheduleAt = &v
}
func (o CampaignCampaignWrite) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o CampaignCampaignWrite) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Audience) {
toSerialize["audience"] = o.Audience
}
if !IsNil(o.Budget) {
toSerialize["budget"] = o.Budget
}
if !IsNil(o.Channels) {
toSerialize["channels"] = o.Channels
}
if !IsNil(o.Content) {
toSerialize["content"] = o.Content
}
if !IsNil(o.Name) {
toSerialize["name"] = o.Name
}
if !IsNil(o.ScheduleAt) {
toSerialize["scheduleAt"] = o.ScheduleAt
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *CampaignCampaignWrite) UnmarshalJSON(data []byte) (err error) {
varCampaignCampaignWrite := _CampaignCampaignWrite{}
err = json.Unmarshal(data, &varCampaignCampaignWrite)
if err != nil {
return err
}
*o = CampaignCampaignWrite(varCampaignCampaignWrite)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "audience")
delete(additionalProperties, "budget")
delete(additionalProperties, "channels")
delete(additionalProperties, "content")
delete(additionalProperties, "name")
delete(additionalProperties, "scheduleAt")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableCampaignCampaignWrite struct {
value *CampaignCampaignWrite
isSet bool
}
func (v NullableCampaignCampaignWrite) Get() *CampaignCampaignWrite {
return v.value
}
func (v *NullableCampaignCampaignWrite) Set(val *CampaignCampaignWrite) {
v.value = val
v.isSet = true
}
func (v NullableCampaignCampaignWrite) IsSet() bool {
return v.isSet
}
func (v *NullableCampaignCampaignWrite) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCampaignCampaignWrite(val *CampaignCampaignWrite) *NullableCampaignCampaignWrite {
return &NullableCampaignCampaignWrite{value: val, isSet: true}
}
func (v NullableCampaignCampaignWrite) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCampaignCampaignWrite) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}