Files
sdk/model_graph_graph_apple_scorecard.go

236 lines
6.7 KiB
Go

/*
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
API version: v1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package hanzoai
import (
"encoding/json"
"fmt"
)
// checks if the GraphGraphAppleScorecard type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &GraphGraphAppleScorecard{}
// GraphGraphAppleScorecard struct for GraphGraphAppleScorecard
type GraphGraphAppleScorecard struct {
// Entity is the person's identifier in the graph. Required.
Entity string `json:"entity"`
// Features is the optional 144-element numeric input vector in metadata.json order (0..19 identity, 20..59 communication, 60..143 photos).
Features []float64 `json:"features,omitempty"`
// Scores maps each relationship column (mother, father, parent, sister, brother, sibling, daughter, son, child, partner, coworker, friend, family, familyAndFriends, alumni, unknown) to its probability in [0,1].
Scores map[string]float64 `json:"scores"`
AdditionalProperties map[string]interface{}
}
type _GraphGraphAppleScorecard GraphGraphAppleScorecard
// NewGraphGraphAppleScorecard instantiates a new GraphGraphAppleScorecard 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 NewGraphGraphAppleScorecard(entity string, scores map[string]float64) *GraphGraphAppleScorecard {
this := GraphGraphAppleScorecard{}
this.Entity = entity
this.Scores = scores
return &this
}
// NewGraphGraphAppleScorecardWithDefaults instantiates a new GraphGraphAppleScorecard 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 NewGraphGraphAppleScorecardWithDefaults() *GraphGraphAppleScorecard {
this := GraphGraphAppleScorecard{}
return &this
}
// GetEntity returns the Entity field value
func (o *GraphGraphAppleScorecard) GetEntity() string {
if o == nil {
var ret string
return ret
}
return o.Entity
}
// GetEntityOk returns a tuple with the Entity field value
// and a boolean to check if the value has been set.
func (o *GraphGraphAppleScorecard) GetEntityOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Entity, true
}
// SetEntity sets field value
func (o *GraphGraphAppleScorecard) SetEntity(v string) {
o.Entity = v
}
// GetFeatures returns the Features field value if set, zero value otherwise.
func (o *GraphGraphAppleScorecard) GetFeatures() []float64 {
if o == nil || IsNil(o.Features) {
var ret []float64
return ret
}
return o.Features
}
// GetFeaturesOk returns a tuple with the Features field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GraphGraphAppleScorecard) GetFeaturesOk() ([]float64, bool) {
if o == nil || IsNil(o.Features) {
return nil, false
}
return o.Features, true
}
// HasFeatures returns a boolean if a field has been set.
func (o *GraphGraphAppleScorecard) HasFeatures() bool {
if o != nil && !IsNil(o.Features) {
return true
}
return false
}
// SetFeatures gets a reference to the given []float64 and assigns it to the Features field.
func (o *GraphGraphAppleScorecard) SetFeatures(v []float64) {
o.Features = v
}
// GetScores returns the Scores field value
func (o *GraphGraphAppleScorecard) GetScores() map[string]float64 {
if o == nil {
var ret map[string]float64
return ret
}
return o.Scores
}
// GetScoresOk returns a tuple with the Scores field value
// and a boolean to check if the value has been set.
func (o *GraphGraphAppleScorecard) GetScoresOk() (map[string]float64, bool) {
if o == nil {
return map[string]float64{}, false
}
return o.Scores, true
}
// SetScores sets field value
func (o *GraphGraphAppleScorecard) SetScores(v map[string]float64) {
o.Scores = v
}
func (o GraphGraphAppleScorecard) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o GraphGraphAppleScorecard) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["entity"] = o.Entity
if !IsNil(o.Features) {
toSerialize["features"] = o.Features
}
toSerialize["scores"] = o.Scores
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *GraphGraphAppleScorecard) 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{
"entity",
"scores",
}
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)
}
}
varGraphGraphAppleScorecard := _GraphGraphAppleScorecard{}
err = json.Unmarshal(data, &varGraphGraphAppleScorecard)
if err != nil {
return err
}
*o = GraphGraphAppleScorecard(varGraphGraphAppleScorecard)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "entity")
delete(additionalProperties, "features")
delete(additionalProperties, "scores")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableGraphGraphAppleScorecard struct {
value *GraphGraphAppleScorecard
isSet bool
}
func (v NullableGraphGraphAppleScorecard) Get() *GraphGraphAppleScorecard {
return v.value
}
func (v *NullableGraphGraphAppleScorecard) Set(val *GraphGraphAppleScorecard) {
v.value = val
v.isSet = true
}
func (v NullableGraphGraphAppleScorecard) IsSet() bool {
return v.isSet
}
func (v *NullableGraphGraphAppleScorecard) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableGraphGraphAppleScorecard(val *GraphGraphAppleScorecard) *NullableGraphGraphAppleScorecard {
return &NullableGraphGraphAppleScorecard{value: val, isSet: true}
}
func (v NullableGraphGraphAppleScorecard) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableGraphGraphAppleScorecard) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}