/* Hindsight HTTP API HTTP API for Hindsight API version: 0.4.21 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package hindsight import ( "encoding/json" "bytes" "fmt" ) // checks if the CreateMentalModelResponse type satisfies the MappedNullable interface at compile time var _ MappedNullable = &CreateMentalModelResponse{} // CreateMentalModelResponse Response model for mental model creation. type CreateMentalModelResponse struct { MentalModelId NullableString `json:"mental_model_id,omitempty"` // Operation ID to track refresh progress OperationId string `json:"operation_id"` } type _CreateMentalModelResponse CreateMentalModelResponse // NewCreateMentalModelResponse instantiates a new CreateMentalModelResponse 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 NewCreateMentalModelResponse(operationId string) *CreateMentalModelResponse { this := CreateMentalModelResponse{} this.OperationId = operationId return &this } // NewCreateMentalModelResponseWithDefaults instantiates a new CreateMentalModelResponse 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 NewCreateMentalModelResponseWithDefaults() *CreateMentalModelResponse { this := CreateMentalModelResponse{} return &this } // GetMentalModelId returns the MentalModelId field value if set, zero value otherwise (both if not set or set to explicit null). func (o *CreateMentalModelResponse) GetMentalModelId() string { if o == nil || IsNil(o.MentalModelId.Get()) { var ret string return ret } return *o.MentalModelId.Get() } // GetMentalModelIdOk returns a tuple with the MentalModelId 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 *CreateMentalModelResponse) GetMentalModelIdOk() (*string, bool) { if o == nil { return nil, false } return o.MentalModelId.Get(), o.MentalModelId.IsSet() } // HasMentalModelId returns a boolean if a field has been set. func (o *CreateMentalModelResponse) HasMentalModelId() bool { if o != nil && o.MentalModelId.IsSet() { return true } return false } // SetMentalModelId gets a reference to the given NullableString and assigns it to the MentalModelId field. func (o *CreateMentalModelResponse) SetMentalModelId(v string) { o.MentalModelId.Set(&v) } // SetMentalModelIdNil sets the value for MentalModelId to be an explicit nil func (o *CreateMentalModelResponse) SetMentalModelIdNil() { o.MentalModelId.Set(nil) } // UnsetMentalModelId ensures that no value is present for MentalModelId, not even an explicit nil func (o *CreateMentalModelResponse) UnsetMentalModelId() { o.MentalModelId.Unset() } // GetOperationId returns the OperationId field value func (o *CreateMentalModelResponse) GetOperationId() string { if o == nil { var ret string return ret } return o.OperationId } // GetOperationIdOk returns a tuple with the OperationId field value // and a boolean to check if the value has been set. func (o *CreateMentalModelResponse) GetOperationIdOk() (*string, bool) { if o == nil { return nil, false } return &o.OperationId, true } // SetOperationId sets field value func (o *CreateMentalModelResponse) SetOperationId(v string) { o.OperationId = v } func (o CreateMentalModelResponse) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } return json.Marshal(toSerialize) } func (o CreateMentalModelResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if o.MentalModelId.IsSet() { toSerialize["mental_model_id"] = o.MentalModelId.Get() } toSerialize["operation_id"] = o.OperationId return toSerialize, nil } func (o *CreateMentalModelResponse) 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{ "operation_id", } 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) } } varCreateMentalModelResponse := _CreateMentalModelResponse{} decoder := json.NewDecoder(bytes.NewReader(data)) decoder.DisallowUnknownFields() err = decoder.Decode(&varCreateMentalModelResponse) if err != nil { return err } *o = CreateMentalModelResponse(varCreateMentalModelResponse) return err } type NullableCreateMentalModelResponse struct { value *CreateMentalModelResponse isSet bool } func (v NullableCreateMentalModelResponse) Get() *CreateMentalModelResponse { return v.value } func (v *NullableCreateMentalModelResponse) Set(val *CreateMentalModelResponse) { v.value = val v.isSet = true } func (v NullableCreateMentalModelResponse) IsSet() bool { return v.isSet } func (v *NullableCreateMentalModelResponse) Unset() { v.value = nil v.isSet = false } func NewNullableCreateMentalModelResponse(val *CreateMentalModelResponse) *NullableCreateMentalModelResponse { return &NullableCreateMentalModelResponse{value: val, isSet: true} } func (v NullableCreateMentalModelResponse) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableCreateMentalModelResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }