/* 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 ChildOperationStatus type satisfies the MappedNullable interface at compile time var _ MappedNullable = &ChildOperationStatus{} // ChildOperationStatus Status of a child operation (for batch operations). type ChildOperationStatus struct { OperationId string `json:"operation_id"` Status string `json:"status"` SubBatchIndex NullableInt32 `json:"sub_batch_index,omitempty"` ItemsCount NullableInt32 `json:"items_count,omitempty"` ErrorMessage NullableString `json:"error_message,omitempty"` } type _ChildOperationStatus ChildOperationStatus // NewChildOperationStatus instantiates a new ChildOperationStatus 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 NewChildOperationStatus(operationId string, status string) *ChildOperationStatus { this := ChildOperationStatus{} this.OperationId = operationId this.Status = status return &this } // NewChildOperationStatusWithDefaults instantiates a new ChildOperationStatus 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 NewChildOperationStatusWithDefaults() *ChildOperationStatus { this := ChildOperationStatus{} return &this } // GetOperationId returns the OperationId field value func (o *ChildOperationStatus) 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 *ChildOperationStatus) GetOperationIdOk() (*string, bool) { if o == nil { return nil, false } return &o.OperationId, true } // SetOperationId sets field value func (o *ChildOperationStatus) SetOperationId(v string) { o.OperationId = v } // GetStatus returns the Status field value func (o *ChildOperationStatus) GetStatus() string { if o == nil { var ret string return ret } return o.Status } // GetStatusOk returns a tuple with the Status field value // and a boolean to check if the value has been set. func (o *ChildOperationStatus) GetStatusOk() (*string, bool) { if o == nil { return nil, false } return &o.Status, true } // SetStatus sets field value func (o *ChildOperationStatus) SetStatus(v string) { o.Status = v } // GetSubBatchIndex returns the SubBatchIndex field value if set, zero value otherwise (both if not set or set to explicit null). func (o *ChildOperationStatus) GetSubBatchIndex() int32 { if o == nil || IsNil(o.SubBatchIndex.Get()) { var ret int32 return ret } return *o.SubBatchIndex.Get() } // GetSubBatchIndexOk returns a tuple with the SubBatchIndex 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 *ChildOperationStatus) GetSubBatchIndexOk() (*int32, bool) { if o == nil { return nil, false } return o.SubBatchIndex.Get(), o.SubBatchIndex.IsSet() } // HasSubBatchIndex returns a boolean if a field has been set. func (o *ChildOperationStatus) HasSubBatchIndex() bool { if o != nil && o.SubBatchIndex.IsSet() { return true } return false } // SetSubBatchIndex gets a reference to the given NullableInt32 and assigns it to the SubBatchIndex field. func (o *ChildOperationStatus) SetSubBatchIndex(v int32) { o.SubBatchIndex.Set(&v) } // SetSubBatchIndexNil sets the value for SubBatchIndex to be an explicit nil func (o *ChildOperationStatus) SetSubBatchIndexNil() { o.SubBatchIndex.Set(nil) } // UnsetSubBatchIndex ensures that no value is present for SubBatchIndex, not even an explicit nil func (o *ChildOperationStatus) UnsetSubBatchIndex() { o.SubBatchIndex.Unset() } // GetItemsCount returns the ItemsCount field value if set, zero value otherwise (both if not set or set to explicit null). func (o *ChildOperationStatus) GetItemsCount() int32 { if o == nil || IsNil(o.ItemsCount.Get()) { var ret int32 return ret } return *o.ItemsCount.Get() } // GetItemsCountOk returns a tuple with the ItemsCount 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 *ChildOperationStatus) GetItemsCountOk() (*int32, bool) { if o == nil { return nil, false } return o.ItemsCount.Get(), o.ItemsCount.IsSet() } // HasItemsCount returns a boolean if a field has been set. func (o *ChildOperationStatus) HasItemsCount() bool { if o != nil && o.ItemsCount.IsSet() { return true } return false } // SetItemsCount gets a reference to the given NullableInt32 and assigns it to the ItemsCount field. func (o *ChildOperationStatus) SetItemsCount(v int32) { o.ItemsCount.Set(&v) } // SetItemsCountNil sets the value for ItemsCount to be an explicit nil func (o *ChildOperationStatus) SetItemsCountNil() { o.ItemsCount.Set(nil) } // UnsetItemsCount ensures that no value is present for ItemsCount, not even an explicit nil func (o *ChildOperationStatus) UnsetItemsCount() { o.ItemsCount.Unset() } // GetErrorMessage returns the ErrorMessage field value if set, zero value otherwise (both if not set or set to explicit null). func (o *ChildOperationStatus) GetErrorMessage() string { if o == nil || IsNil(o.ErrorMessage.Get()) { var ret string return ret } return *o.ErrorMessage.Get() } // GetErrorMessageOk returns a tuple with the ErrorMessage 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 *ChildOperationStatus) GetErrorMessageOk() (*string, bool) { if o == nil { return nil, false } return o.ErrorMessage.Get(), o.ErrorMessage.IsSet() } // HasErrorMessage returns a boolean if a field has been set. func (o *ChildOperationStatus) HasErrorMessage() bool { if o != nil && o.ErrorMessage.IsSet() { return true } return false } // SetErrorMessage gets a reference to the given NullableString and assigns it to the ErrorMessage field. func (o *ChildOperationStatus) SetErrorMessage(v string) { o.ErrorMessage.Set(&v) } // SetErrorMessageNil sets the value for ErrorMessage to be an explicit nil func (o *ChildOperationStatus) SetErrorMessageNil() { o.ErrorMessage.Set(nil) } // UnsetErrorMessage ensures that no value is present for ErrorMessage, not even an explicit nil func (o *ChildOperationStatus) UnsetErrorMessage() { o.ErrorMessage.Unset() } func (o ChildOperationStatus) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { return []byte{}, err } return json.Marshal(toSerialize) } func (o ChildOperationStatus) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["operation_id"] = o.OperationId toSerialize["status"] = o.Status if o.SubBatchIndex.IsSet() { toSerialize["sub_batch_index"] = o.SubBatchIndex.Get() } if o.ItemsCount.IsSet() { toSerialize["items_count"] = o.ItemsCount.Get() } if o.ErrorMessage.IsSet() { toSerialize["error_message"] = o.ErrorMessage.Get() } return toSerialize, nil } func (o *ChildOperationStatus) 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", "status", } 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) } } varChildOperationStatus := _ChildOperationStatus{} decoder := json.NewDecoder(bytes.NewReader(data)) decoder.DisallowUnknownFields() err = decoder.Decode(&varChildOperationStatus) if err != nil { return err } *o = ChildOperationStatus(varChildOperationStatus) return err } type NullableChildOperationStatus struct { value *ChildOperationStatus isSet bool } func (v NullableChildOperationStatus) Get() *ChildOperationStatus { return v.value } func (v *NullableChildOperationStatus) Set(val *ChildOperationStatus) { v.value = val v.isSet = true } func (v NullableChildOperationStatus) IsSet() bool { return v.isSet } func (v *NullableChildOperationStatus) Unset() { v.value = nil v.isSet = false } func NewNullableChildOperationStatus(val *ChildOperationStatus) *NullableChildOperationStatus { return &NullableChildOperationStatus{value: val, isSet: true} } func (v NullableChildOperationStatus) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableChildOperationStatus) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }