/* Hindsight HTTP API HTTP API for Hindsight API version: 0.4.15 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package hindsight import ( "encoding/json" "bytes" "fmt" ) // checks if the ChunkResponse type satisfies the MappedNullable interface at compile time var _ MappedNullable = &ChunkResponse{} // ChunkResponse Response model for get chunk endpoint. type ChunkResponse struct { ChunkId string `json:"chunk_id"` DocumentId string `json:"document_id"` BankId string `json:"bank_id"` ChunkIndex int32 `json:"chunk_index"` ChunkText string `json:"chunk_text"` CreatedAt string `json:"created_at"` } type _ChunkResponse ChunkResponse // NewChunkResponse instantiates a new ChunkResponse 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 NewChunkResponse(chunkId string, documentId string, bankId string, chunkIndex int32, chunkText string, createdAt string) *ChunkResponse { this := ChunkResponse{} this.ChunkId = chunkId this.DocumentId = documentId this.BankId = bankId this.ChunkIndex = chunkIndex this.ChunkText = chunkText this.CreatedAt = createdAt return &this } // NewChunkResponseWithDefaults instantiates a new ChunkResponse 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 NewChunkResponseWithDefaults() *ChunkResponse { this := ChunkResponse{} return &this } // GetChunkId returns the ChunkId field value func (o *ChunkResponse) GetChunkId() string { if o == nil { var ret string return ret } return o.ChunkId } // GetChunkIdOk returns a tuple with the ChunkId field value // and a boolean to check if the value has been set. func (o *ChunkResponse) GetChunkIdOk() (*string, bool) { if o == nil { return nil, false } return &o.ChunkId, true } // SetChunkId sets field value func (o *ChunkResponse) SetChunkId(v string) { o.ChunkId = v } // GetDocumentId returns the DocumentId field value func (o *ChunkResponse) GetDocumentId() string { if o == nil { var ret string return ret } return o.DocumentId } // GetDocumentIdOk returns a tuple with the DocumentId field value // and a boolean to check if the value has been set. func (o *ChunkResponse) GetDocumentIdOk() (*string, bool) { if o == nil { return nil, false } return &o.DocumentId, true } // SetDocumentId sets field value func (o *ChunkResponse) SetDocumentId(v string) { o.DocumentId = v } // GetBankId returns the BankId field value func (o *ChunkResponse) GetBankId() string { if o == nil { var ret string return ret } return o.BankId } // GetBankIdOk returns a tuple with the BankId field value // and a boolean to check if the value has been set. func (o *ChunkResponse) GetBankIdOk() (*string, bool) { if o == nil { return nil, false } return &o.BankId, true } // SetBankId sets field value func (o *ChunkResponse) SetBankId(v string) { o.BankId = v } // GetChunkIndex returns the ChunkIndex field value func (o *ChunkResponse) GetChunkIndex() int32 { if o == nil { var ret int32 return ret } return o.ChunkIndex } // GetChunkIndexOk returns a tuple with the ChunkIndex field value // and a boolean to check if the value has been set. func (o *ChunkResponse) GetChunkIndexOk() (*int32, bool) { if o == nil { return nil, false } return &o.ChunkIndex, true } // SetChunkIndex sets field value func (o *ChunkResponse) SetChunkIndex(v int32) { o.ChunkIndex = v } // GetChunkText returns the ChunkText field value func (o *ChunkResponse) GetChunkText() string { if o == nil { var ret string return ret } return o.ChunkText } // GetChunkTextOk returns a tuple with the ChunkText field value // and a boolean to check if the value has been set. func (o *ChunkResponse) GetChunkTextOk() (*string, bool) { if o == nil { return nil, false } return &o.ChunkText, true } // SetChunkText sets field value func (o *ChunkResponse) SetChunkText(v string) { o.ChunkText = v } // GetCreatedAt returns the CreatedAt field value func (o *ChunkResponse) GetCreatedAt() string { if o == nil { var ret string return ret } return o.CreatedAt } // GetCreatedAtOk returns a tuple with the CreatedAt field value // and a boolean to check if the value has been set. func (o *ChunkResponse) GetCreatedAtOk() (*string, bool) { if o == nil { return nil, false } return &o.CreatedAt, true } // SetCreatedAt sets field value func (o *ChunkResponse) SetCreatedAt(v string) { o.CreatedAt = v } func (o ChunkResponse) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } return json.Marshal(toSerialize) } func (o ChunkResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["chunk_id"] = o.ChunkId toSerialize["document_id"] = o.DocumentId toSerialize["bank_id"] = o.BankId toSerialize["chunk_index"] = o.ChunkIndex toSerialize["chunk_text"] = o.ChunkText toSerialize["created_at"] = o.CreatedAt return toSerialize, nil } func (o *ChunkResponse) 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{ "chunk_id", "document_id", "bank_id", "chunk_index", "chunk_text", "created_at", } 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) } } varChunkResponse := _ChunkResponse{} decoder := json.NewDecoder(bytes.NewReader(data)) decoder.DisallowUnknownFields() err = decoder.Decode(&varChunkResponse) if err != nil { return err } *o = ChunkResponse(varChunkResponse) return err } type NullableChunkResponse struct { value *ChunkResponse isSet bool } func (v NullableChunkResponse) Get() *ChunkResponse { return v.value } func (v *NullableChunkResponse) Set(val *ChunkResponse) { v.value = val v.isSet = true } func (v NullableChunkResponse) IsSet() bool { return v.isSet } func (v *NullableChunkResponse) Unset() { v.value = nil v.isSet = false } func NewNullableChunkResponse(val *ChunkResponse) *NullableChunkResponse { return &NullableChunkResponse{value: val, isSet: true} } func (v NullableChunkResponse) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableChunkResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }