/* 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" "fmt" ) // ObservationScopes How to scope observations during consolidation. 'per_tag' runs one consolidation pass per individual tag, creating separate observations for each tag. 'combined' (default) runs a single pass with all tags together. A list of tag lists runs one pass per inner list, giving full control over which combinations to use. type ObservationScopes struct { ArrayOfArrayOfString *[][]string String *string } // Unmarshal JSON data into any of the pointers in the struct func (dst *ObservationScopes) UnmarshalJSON(data []byte) error { var err error // this object is nullable so check if the payload is null or empty string if string(data) == "" || string(data) == "{}" { return nil } // try to unmarshal JSON data into ArrayOfArrayOfString err = json.Unmarshal(data, &dst.ArrayOfArrayOfString); if err == nil { jsonArrayOfArrayOfString, _ := json.Marshal(dst.ArrayOfArrayOfString) if string(jsonArrayOfArrayOfString) == "{}" { // empty struct dst.ArrayOfArrayOfString = nil } else { return nil // data stored in dst.ArrayOfArrayOfString, return on the first match } } else { dst.ArrayOfArrayOfString = nil } // try to unmarshal JSON data into String err = json.Unmarshal(data, &dst.String); if err == nil { jsonString, _ := json.Marshal(dst.String) if string(jsonString) == "{}" { // empty struct dst.String = nil } else { return nil // data stored in dst.String, return on the first match } } else { dst.String = nil } return fmt.Errorf("data failed to match schemas in anyOf(ObservationScopes)") } // Marshal data from the first non-nil pointers in the struct to JSON func (src *ObservationScopes) MarshalJSON() ([]byte, error) { if src.ArrayOfArrayOfString != nil { return json.Marshal(&src.ArrayOfArrayOfString) } if src.String != nil { return json.Marshal(&src.String) } return nil, nil // no data in anyOf schemas } type NullableObservationScopes struct { value *ObservationScopes isSet bool } func (v NullableObservationScopes) Get() *ObservationScopes { return v.value } func (v *NullableObservationScopes) Set(val *ObservationScopes) { v.value = val v.isSet = true } func (v NullableObservationScopes) IsSet() bool { return v.isSet } func (v *NullableObservationScopes) Unset() { v.value = nil v.isSet = false } func NewNullableObservationScopes(val *ObservationScopes) *NullableObservationScopes { return &NullableObservationScopes{value: val, isSet: true} } func (v NullableObservationScopes) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableObservationScopes) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }