/* Hindsight HTTP API HTTP API for Hindsight API version: 0.5.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package hindsight import ( "encoding/json" "bytes" "fmt" ) // checks if the ReflectFact type satisfies the MappedNullable interface at compile time var _ MappedNullable = &ReflectFact{} // ReflectFact A fact used in think response. type ReflectFact struct { Id NullableString `json:"id,omitempty"` // Fact text. When type='observation', this contains markdown-formatted consolidated knowledge Text string `json:"text"` Type NullableString `json:"type,omitempty"` Context NullableString `json:"context,omitempty"` OccurredStart NullableString `json:"occurred_start,omitempty"` OccurredEnd NullableString `json:"occurred_end,omitempty"` } type _ReflectFact ReflectFact // NewReflectFact instantiates a new ReflectFact 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 NewReflectFact(text string) *ReflectFact { this := ReflectFact{} this.Text = text return &this } // NewReflectFactWithDefaults instantiates a new ReflectFact 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 NewReflectFactWithDefaults() *ReflectFact { this := ReflectFact{} return &this } // GetId returns the Id field value if set, zero value otherwise (both if not set or set to explicit null). func (o *ReflectFact) GetId() string { if o == nil || IsNil(o.Id.Get()) { var ret string return ret } return *o.Id.Get() } // GetIdOk returns a tuple with the Id 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 *ReflectFact) GetIdOk() (*string, bool) { if o == nil { return nil, false } return o.Id.Get(), o.Id.IsSet() } // HasId returns a boolean if a field has been set. func (o *ReflectFact) HasId() bool { if o != nil && o.Id.IsSet() { return true } return false } // SetId gets a reference to the given NullableString and assigns it to the Id field. func (o *ReflectFact) SetId(v string) { o.Id.Set(&v) } // SetIdNil sets the value for Id to be an explicit nil func (o *ReflectFact) SetIdNil() { o.Id.Set(nil) } // UnsetId ensures that no value is present for Id, not even an explicit nil func (o *ReflectFact) UnsetId() { o.Id.Unset() } // GetText returns the Text field value func (o *ReflectFact) GetText() string { if o == nil { var ret string return ret } return o.Text } // GetTextOk returns a tuple with the Text field value // and a boolean to check if the value has been set. func (o *ReflectFact) GetTextOk() (*string, bool) { if o == nil { return nil, false } return &o.Text, true } // SetText sets field value func (o *ReflectFact) SetText(v string) { o.Text = v } // GetType returns the Type field value if set, zero value otherwise (both if not set or set to explicit null). func (o *ReflectFact) GetType() string { if o == nil || IsNil(o.Type.Get()) { var ret string return ret } return *o.Type.Get() } // GetTypeOk returns a tuple with the Type 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 *ReflectFact) GetTypeOk() (*string, bool) { if o == nil { return nil, false } return o.Type.Get(), o.Type.IsSet() } // HasType returns a boolean if a field has been set. func (o *ReflectFact) HasType() bool { if o != nil && o.Type.IsSet() { return true } return false } // SetType gets a reference to the given NullableString and assigns it to the Type field. func (o *ReflectFact) SetType(v string) { o.Type.Set(&v) } // SetTypeNil sets the value for Type to be an explicit nil func (o *ReflectFact) SetTypeNil() { o.Type.Set(nil) } // UnsetType ensures that no value is present for Type, not even an explicit nil func (o *ReflectFact) UnsetType() { o.Type.Unset() } // GetContext returns the Context field value if set, zero value otherwise (both if not set or set to explicit null). func (o *ReflectFact) GetContext() string { if o == nil || IsNil(o.Context.Get()) { var ret string return ret } return *o.Context.Get() } // GetContextOk returns a tuple with the Context 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 *ReflectFact) GetContextOk() (*string, bool) { if o == nil { return nil, false } return o.Context.Get(), o.Context.IsSet() } // HasContext returns a boolean if a field has been set. func (o *ReflectFact) HasContext() bool { if o != nil && o.Context.IsSet() { return true } return false } // SetContext gets a reference to the given NullableString and assigns it to the Context field. func (o *ReflectFact) SetContext(v string) { o.Context.Set(&v) } // SetContextNil sets the value for Context to be an explicit nil func (o *ReflectFact) SetContextNil() { o.Context.Set(nil) } // UnsetContext ensures that no value is present for Context, not even an explicit nil func (o *ReflectFact) UnsetContext() { o.Context.Unset() } // GetOccurredStart returns the OccurredStart field value if set, zero value otherwise (both if not set or set to explicit null). func (o *ReflectFact) GetOccurredStart() string { if o == nil || IsNil(o.OccurredStart.Get()) { var ret string return ret } return *o.OccurredStart.Get() } // GetOccurredStartOk returns a tuple with the OccurredStart 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 *ReflectFact) GetOccurredStartOk() (*string, bool) { if o == nil { return nil, false } return o.OccurredStart.Get(), o.OccurredStart.IsSet() } // HasOccurredStart returns a boolean if a field has been set. func (o *ReflectFact) HasOccurredStart() bool { if o != nil && o.OccurredStart.IsSet() { return true } return false } // SetOccurredStart gets a reference to the given NullableString and assigns it to the OccurredStart field. func (o *ReflectFact) SetOccurredStart(v string) { o.OccurredStart.Set(&v) } // SetOccurredStartNil sets the value for OccurredStart to be an explicit nil func (o *ReflectFact) SetOccurredStartNil() { o.OccurredStart.Set(nil) } // UnsetOccurredStart ensures that no value is present for OccurredStart, not even an explicit nil func (o *ReflectFact) UnsetOccurredStart() { o.OccurredStart.Unset() } // GetOccurredEnd returns the OccurredEnd field value if set, zero value otherwise (both if not set or set to explicit null). func (o *ReflectFact) GetOccurredEnd() string { if o == nil || IsNil(o.OccurredEnd.Get()) { var ret string return ret } return *o.OccurredEnd.Get() } // GetOccurredEndOk returns a tuple with the OccurredEnd 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 *ReflectFact) GetOccurredEndOk() (*string, bool) { if o == nil { return nil, false } return o.OccurredEnd.Get(), o.OccurredEnd.IsSet() } // HasOccurredEnd returns a boolean if a field has been set. func (o *ReflectFact) HasOccurredEnd() bool { if o != nil && o.OccurredEnd.IsSet() { return true } return false } // SetOccurredEnd gets a reference to the given NullableString and assigns it to the OccurredEnd field. func (o *ReflectFact) SetOccurredEnd(v string) { o.OccurredEnd.Set(&v) } // SetOccurredEndNil sets the value for OccurredEnd to be an explicit nil func (o *ReflectFact) SetOccurredEndNil() { o.OccurredEnd.Set(nil) } // UnsetOccurredEnd ensures that no value is present for OccurredEnd, not even an explicit nil func (o *ReflectFact) UnsetOccurredEnd() { o.OccurredEnd.Unset() } func (o ReflectFact) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } return json.Marshal(toSerialize) } func (o ReflectFact) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if o.Id.IsSet() { toSerialize["id"] = o.Id.Get() } toSerialize["text"] = o.Text if o.Type.IsSet() { toSerialize["type"] = o.Type.Get() } if o.Context.IsSet() { toSerialize["context"] = o.Context.Get() } if o.OccurredStart.IsSet() { toSerialize["occurred_start"] = o.OccurredStart.Get() } if o.OccurredEnd.IsSet() { toSerialize["occurred_end"] = o.OccurredEnd.Get() } return toSerialize, nil } func (o *ReflectFact) 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{ "text", } 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) } } varReflectFact := _ReflectFact{} decoder := json.NewDecoder(bytes.NewReader(data)) decoder.DisallowUnknownFields() err = decoder.Decode(&varReflectFact) if err != nil { return err } *o = ReflectFact(varReflectFact) return err } type NullableReflectFact struct { value *ReflectFact isSet bool } func (v NullableReflectFact) Get() *ReflectFact { return v.value } func (v *NullableReflectFact) Set(val *ReflectFact) { v.value = val v.isSet = true } func (v NullableReflectFact) IsSet() bool { return v.isSet } func (v *NullableReflectFact) Unset() { v.value = nil v.isSet = false } func NewNullableReflectFact(val *ReflectFact) *NullableReflectFact { return &NullableReflectFact{value: val, isSet: true} } func (v NullableReflectFact) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableReflectFact) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }