/* 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 RecallResult type satisfies the MappedNullable interface at compile time var _ MappedNullable = &RecallResult{} // RecallResult Single recall result item. type RecallResult struct { Id string `json:"id"` Text string `json:"text"` Type NullableString `json:"type,omitempty"` Entities []string `json:"entities,omitempty"` Context NullableString `json:"context,omitempty"` OccurredStart NullableString `json:"occurred_start,omitempty"` OccurredEnd NullableString `json:"occurred_end,omitempty"` MentionedAt NullableString `json:"mentioned_at,omitempty"` DocumentId NullableString `json:"document_id,omitempty"` Metadata map[string]string `json:"metadata,omitempty"` ChunkId NullableString `json:"chunk_id,omitempty"` Tags []string `json:"tags,omitempty"` SourceFactIds []string `json:"source_fact_ids,omitempty"` } type _RecallResult RecallResult // NewRecallResult instantiates a new RecallResult 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 NewRecallResult(id string, text string) *RecallResult { this := RecallResult{} this.Id = id this.Text = text return &this } // NewRecallResultWithDefaults instantiates a new RecallResult 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 NewRecallResultWithDefaults() *RecallResult { this := RecallResult{} return &this } // GetId returns the Id field value func (o *RecallResult) GetId() string { if o == nil { var ret string return ret } return o.Id } // GetIdOk returns a tuple with the Id field value // and a boolean to check if the value has been set. func (o *RecallResult) GetIdOk() (*string, bool) { if o == nil { return nil, false } return &o.Id, true } // SetId sets field value func (o *RecallResult) SetId(v string) { o.Id = v } // GetText returns the Text field value func (o *RecallResult) 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 *RecallResult) GetTextOk() (*string, bool) { if o == nil { return nil, false } return &o.Text, true } // SetText sets field value func (o *RecallResult) 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 *RecallResult) 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 *RecallResult) 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 *RecallResult) 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 *RecallResult) SetType(v string) { o.Type.Set(&v) } // SetTypeNil sets the value for Type to be an explicit nil func (o *RecallResult) SetTypeNil() { o.Type.Set(nil) } // UnsetType ensures that no value is present for Type, not even an explicit nil func (o *RecallResult) UnsetType() { o.Type.Unset() } // GetEntities returns the Entities field value if set, zero value otherwise (both if not set or set to explicit null). func (o *RecallResult) GetEntities() []string { if o == nil { var ret []string return ret } return o.Entities } // GetEntitiesOk returns a tuple with the Entities 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 *RecallResult) GetEntitiesOk() ([]string, bool) { if o == nil || IsNil(o.Entities) { return nil, false } return o.Entities, true } // HasEntities returns a boolean if a field has been set. func (o *RecallResult) HasEntities() bool { if o != nil && !IsNil(o.Entities) { return true } return false } // SetEntities gets a reference to the given []string and assigns it to the Entities field. func (o *RecallResult) SetEntities(v []string) { o.Entities = v } // GetContext returns the Context field value if set, zero value otherwise (both if not set or set to explicit null). func (o *RecallResult) 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 *RecallResult) 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 *RecallResult) 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 *RecallResult) SetContext(v string) { o.Context.Set(&v) } // SetContextNil sets the value for Context to be an explicit nil func (o *RecallResult) SetContextNil() { o.Context.Set(nil) } // UnsetContext ensures that no value is present for Context, not even an explicit nil func (o *RecallResult) 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 *RecallResult) 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 *RecallResult) 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 *RecallResult) 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 *RecallResult) SetOccurredStart(v string) { o.OccurredStart.Set(&v) } // SetOccurredStartNil sets the value for OccurredStart to be an explicit nil func (o *RecallResult) SetOccurredStartNil() { o.OccurredStart.Set(nil) } // UnsetOccurredStart ensures that no value is present for OccurredStart, not even an explicit nil func (o *RecallResult) 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 *RecallResult) 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 *RecallResult) 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 *RecallResult) 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 *RecallResult) SetOccurredEnd(v string) { o.OccurredEnd.Set(&v) } // SetOccurredEndNil sets the value for OccurredEnd to be an explicit nil func (o *RecallResult) SetOccurredEndNil() { o.OccurredEnd.Set(nil) } // UnsetOccurredEnd ensures that no value is present for OccurredEnd, not even an explicit nil func (o *RecallResult) UnsetOccurredEnd() { o.OccurredEnd.Unset() } // GetMentionedAt returns the MentionedAt field value if set, zero value otherwise (both if not set or set to explicit null). func (o *RecallResult) GetMentionedAt() string { if o == nil || IsNil(o.MentionedAt.Get()) { var ret string return ret } return *o.MentionedAt.Get() } // GetMentionedAtOk returns a tuple with the MentionedAt 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 *RecallResult) GetMentionedAtOk() (*string, bool) { if o == nil { return nil, false } return o.MentionedAt.Get(), o.MentionedAt.IsSet() } // HasMentionedAt returns a boolean if a field has been set. func (o *RecallResult) HasMentionedAt() bool { if o != nil && o.MentionedAt.IsSet() { return true } return false } // SetMentionedAt gets a reference to the given NullableString and assigns it to the MentionedAt field. func (o *RecallResult) SetMentionedAt(v string) { o.MentionedAt.Set(&v) } // SetMentionedAtNil sets the value for MentionedAt to be an explicit nil func (o *RecallResult) SetMentionedAtNil() { o.MentionedAt.Set(nil) } // UnsetMentionedAt ensures that no value is present for MentionedAt, not even an explicit nil func (o *RecallResult) UnsetMentionedAt() { o.MentionedAt.Unset() } // GetDocumentId returns the DocumentId field value if set, zero value otherwise (both if not set or set to explicit null). func (o *RecallResult) GetDocumentId() string { if o == nil || IsNil(o.DocumentId.Get()) { var ret string return ret } return *o.DocumentId.Get() } // GetDocumentIdOk returns a tuple with the DocumentId 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 *RecallResult) GetDocumentIdOk() (*string, bool) { if o == nil { return nil, false } return o.DocumentId.Get(), o.DocumentId.IsSet() } // HasDocumentId returns a boolean if a field has been set. func (o *RecallResult) HasDocumentId() bool { if o != nil && o.DocumentId.IsSet() { return true } return false } // SetDocumentId gets a reference to the given NullableString and assigns it to the DocumentId field. func (o *RecallResult) SetDocumentId(v string) { o.DocumentId.Set(&v) } // SetDocumentIdNil sets the value for DocumentId to be an explicit nil func (o *RecallResult) SetDocumentIdNil() { o.DocumentId.Set(nil) } // UnsetDocumentId ensures that no value is present for DocumentId, not even an explicit nil func (o *RecallResult) UnsetDocumentId() { o.DocumentId.Unset() } // GetMetadata returns the Metadata field value if set, zero value otherwise (both if not set or set to explicit null). func (o *RecallResult) GetMetadata() map[string]string { if o == nil { var ret map[string]string return ret } return o.Metadata } // GetMetadataOk returns a tuple with the Metadata 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 *RecallResult) GetMetadataOk() (map[string]string, bool) { if o == nil || IsNil(o.Metadata) { return map[string]string{}, false } return o.Metadata, true } // HasMetadata returns a boolean if a field has been set. func (o *RecallResult) HasMetadata() bool { if o != nil && !IsNil(o.Metadata) { return true } return false } // SetMetadata gets a reference to the given map[string]string and assigns it to the Metadata field. func (o *RecallResult) SetMetadata(v map[string]string) { o.Metadata = v } // GetChunkId returns the ChunkId field value if set, zero value otherwise (both if not set or set to explicit null). func (o *RecallResult) GetChunkId() string { if o == nil || IsNil(o.ChunkId.Get()) { var ret string return ret } return *o.ChunkId.Get() } // GetChunkIdOk returns a tuple with the ChunkId 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 *RecallResult) GetChunkIdOk() (*string, bool) { if o == nil { return nil, false } return o.ChunkId.Get(), o.ChunkId.IsSet() } // HasChunkId returns a boolean if a field has been set. func (o *RecallResult) HasChunkId() bool { if o != nil && o.ChunkId.IsSet() { return true } return false } // SetChunkId gets a reference to the given NullableString and assigns it to the ChunkId field. func (o *RecallResult) SetChunkId(v string) { o.ChunkId.Set(&v) } // SetChunkIdNil sets the value for ChunkId to be an explicit nil func (o *RecallResult) SetChunkIdNil() { o.ChunkId.Set(nil) } // UnsetChunkId ensures that no value is present for ChunkId, not even an explicit nil func (o *RecallResult) UnsetChunkId() { o.ChunkId.Unset() } // GetTags returns the Tags field value if set, zero value otherwise (both if not set or set to explicit null). func (o *RecallResult) GetTags() []string { if o == nil { var ret []string return ret } return o.Tags } // GetTagsOk returns a tuple with the Tags 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 *RecallResult) GetTagsOk() ([]string, bool) { if o == nil || IsNil(o.Tags) { return nil, false } return o.Tags, true } // HasTags returns a boolean if a field has been set. func (o *RecallResult) HasTags() bool { if o != nil && !IsNil(o.Tags) { return true } return false } // SetTags gets a reference to the given []string and assigns it to the Tags field. func (o *RecallResult) SetTags(v []string) { o.Tags = v } // GetSourceFactIds returns the SourceFactIds field value if set, zero value otherwise (both if not set or set to explicit null). func (o *RecallResult) GetSourceFactIds() []string { if o == nil { var ret []string return ret } return o.SourceFactIds } // GetSourceFactIdsOk returns a tuple with the SourceFactIds 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 *RecallResult) GetSourceFactIdsOk() ([]string, bool) { if o == nil || IsNil(o.SourceFactIds) { return nil, false } return o.SourceFactIds, true } // HasSourceFactIds returns a boolean if a field has been set. func (o *RecallResult) HasSourceFactIds() bool { if o != nil && !IsNil(o.SourceFactIds) { return true } return false } // SetSourceFactIds gets a reference to the given []string and assigns it to the SourceFactIds field. func (o *RecallResult) SetSourceFactIds(v []string) { o.SourceFactIds = v } func (o RecallResult) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } return json.Marshal(toSerialize) } func (o RecallResult) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["id"] = o.Id toSerialize["text"] = o.Text if o.Type.IsSet() { toSerialize["type"] = o.Type.Get() } if o.Entities != nil { toSerialize["entities"] = o.Entities } 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() } if o.MentionedAt.IsSet() { toSerialize["mentioned_at"] = o.MentionedAt.Get() } if o.DocumentId.IsSet() { toSerialize["document_id"] = o.DocumentId.Get() } if o.Metadata != nil { toSerialize["metadata"] = o.Metadata } if o.ChunkId.IsSet() { toSerialize["chunk_id"] = o.ChunkId.Get() } if o.Tags != nil { toSerialize["tags"] = o.Tags } if o.SourceFactIds != nil { toSerialize["source_fact_ids"] = o.SourceFactIds } return toSerialize, nil } func (o *RecallResult) 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{ "id", "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) } } varRecallResult := _RecallResult{} decoder := json.NewDecoder(bytes.NewReader(data)) decoder.DisallowUnknownFields() err = decoder.Decode(&varRecallResult) if err != nil { return err } *o = RecallResult(varRecallResult) return err } type NullableRecallResult struct { value *RecallResult isSet bool } func (v NullableRecallResult) Get() *RecallResult { return v.value } func (v *NullableRecallResult) Set(val *RecallResult) { v.value = val v.isSet = true } func (v NullableRecallResult) IsSet() bool { return v.isSet } func (v *NullableRecallResult) Unset() { v.value = nil v.isSet = false } func NewNullableRecallResult(val *RecallResult) *NullableRecallResult { return &NullableRecallResult{value: val, isSet: true} } func (v NullableRecallResult) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableRecallResult) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }