/* authentik Making authentication simple. API version: 2026.5.0-rc1 Contact: hello@goauthentik.io */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package api import ( "encoding/json" "fmt" ) // checks if the Group type satisfies the MappedNullable interface at compile time var _ MappedNullable = &Group{} // Group Group Serializer type Group struct { Pk string `json:"pk"` NumPk int32 `json:"num_pk"` Name string `json:"name"` // Users added to this group will be superusers. IsSuperuser *bool `json:"is_superuser,omitempty"` Parents []string `json:"parents,omitempty"` ParentsObj []RelatedGroup `json:"parents_obj"` Users []int32 `json:"users,omitempty"` UsersObj []PartialUser `json:"users_obj"` Attributes map[string]interface{} `json:"attributes,omitempty"` Roles []string `json:"roles,omitempty"` RolesObj []Role `json:"roles_obj"` InheritedRolesObj []Role `json:"inherited_roles_obj"` Children []string `json:"children"` ChildrenObj []RelatedGroup `json:"children_obj"` AdditionalProperties map[string]interface{} } type _Group Group // NewGroup instantiates a new Group 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 NewGroup(pk string, numPk int32, name string, parentsObj []RelatedGroup, usersObj []PartialUser, rolesObj []Role, inheritedRolesObj []Role, children []string, childrenObj []RelatedGroup) *Group { this := Group{} this.Pk = pk this.NumPk = numPk this.Name = name this.ParentsObj = parentsObj this.UsersObj = usersObj this.RolesObj = rolesObj this.InheritedRolesObj = inheritedRolesObj this.Children = children this.ChildrenObj = childrenObj return &this } // NewGroupWithDefaults instantiates a new Group 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 NewGroupWithDefaults() *Group { this := Group{} return &this } // GetPk returns the Pk field value func (o *Group) GetPk() string { if o == nil { var ret string return ret } return o.Pk } // GetPkOk returns a tuple with the Pk field value // and a boolean to check if the value has been set. func (o *Group) GetPkOk() (*string, bool) { if o == nil { return nil, false } return &o.Pk, true } // SetPk sets field value func (o *Group) SetPk(v string) { o.Pk = v } // GetNumPk returns the NumPk field value func (o *Group) GetNumPk() int32 { if o == nil { var ret int32 return ret } return o.NumPk } // GetNumPkOk returns a tuple with the NumPk field value // and a boolean to check if the value has been set. func (o *Group) GetNumPkOk() (*int32, bool) { if o == nil { return nil, false } return &o.NumPk, true } // SetNumPk sets field value func (o *Group) SetNumPk(v int32) { o.NumPk = v } // GetName returns the Name field value func (o *Group) GetName() string { if o == nil { var ret string return ret } return o.Name } // GetNameOk returns a tuple with the Name field value // and a boolean to check if the value has been set. func (o *Group) GetNameOk() (*string, bool) { if o == nil { return nil, false } return &o.Name, true } // SetName sets field value func (o *Group) SetName(v string) { o.Name = v } // GetIsSuperuser returns the IsSuperuser field value if set, zero value otherwise. func (o *Group) GetIsSuperuser() bool { if o == nil || IsNil(o.IsSuperuser) { var ret bool return ret } return *o.IsSuperuser } // GetIsSuperuserOk returns a tuple with the IsSuperuser field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Group) GetIsSuperuserOk() (*bool, bool) { if o == nil || IsNil(o.IsSuperuser) { return nil, false } return o.IsSuperuser, true } // HasIsSuperuser returns a boolean if a field has been set. func (o *Group) HasIsSuperuser() bool { if o != nil && !IsNil(o.IsSuperuser) { return true } return false } // SetIsSuperuser gets a reference to the given bool and assigns it to the IsSuperuser field. func (o *Group) SetIsSuperuser(v bool) { o.IsSuperuser = &v } // GetParents returns the Parents field value if set, zero value otherwise. func (o *Group) GetParents() []string { if o == nil || IsNil(o.Parents) { var ret []string return ret } return o.Parents } // GetParentsOk returns a tuple with the Parents field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Group) GetParentsOk() ([]string, bool) { if o == nil || IsNil(o.Parents) { return nil, false } return o.Parents, true } // HasParents returns a boolean if a field has been set. func (o *Group) HasParents() bool { if o != nil && !IsNil(o.Parents) { return true } return false } // SetParents gets a reference to the given []string and assigns it to the Parents field. func (o *Group) SetParents(v []string) { o.Parents = v } // GetParentsObj returns the ParentsObj field value // If the value is explicit nil, the zero value for []RelatedGroup will be returned func (o *Group) GetParentsObj() []RelatedGroup { if o == nil { var ret []RelatedGroup return ret } return o.ParentsObj } // GetParentsObjOk returns a tuple with the ParentsObj field value // 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 *Group) GetParentsObjOk() ([]RelatedGroup, bool) { if o == nil || IsNil(o.ParentsObj) { return nil, false } return o.ParentsObj, true } // SetParentsObj sets field value func (o *Group) SetParentsObj(v []RelatedGroup) { o.ParentsObj = v } // GetUsers returns the Users field value if set, zero value otherwise. func (o *Group) GetUsers() []int32 { if o == nil || IsNil(o.Users) { var ret []int32 return ret } return o.Users } // GetUsersOk returns a tuple with the Users field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Group) GetUsersOk() ([]int32, bool) { if o == nil || IsNil(o.Users) { return nil, false } return o.Users, true } // HasUsers returns a boolean if a field has been set. func (o *Group) HasUsers() bool { if o != nil && !IsNil(o.Users) { return true } return false } // SetUsers gets a reference to the given []int32 and assigns it to the Users field. func (o *Group) SetUsers(v []int32) { o.Users = v } // GetUsersObj returns the UsersObj field value // If the value is explicit nil, the zero value for []PartialUser will be returned func (o *Group) GetUsersObj() []PartialUser { if o == nil { var ret []PartialUser return ret } return o.UsersObj } // GetUsersObjOk returns a tuple with the UsersObj field value // 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 *Group) GetUsersObjOk() ([]PartialUser, bool) { if o == nil || IsNil(o.UsersObj) { return nil, false } return o.UsersObj, true } // SetUsersObj sets field value func (o *Group) SetUsersObj(v []PartialUser) { o.UsersObj = v } // GetAttributes returns the Attributes field value if set, zero value otherwise. func (o *Group) GetAttributes() map[string]interface{} { if o == nil || IsNil(o.Attributes) { var ret map[string]interface{} return ret } return o.Attributes } // GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Group) GetAttributesOk() (map[string]interface{}, bool) { if o == nil || IsNil(o.Attributes) { return map[string]interface{}{}, false } return o.Attributes, true } // HasAttributes returns a boolean if a field has been set. func (o *Group) HasAttributes() bool { if o != nil && !IsNil(o.Attributes) { return true } return false } // SetAttributes gets a reference to the given map[string]interface{} and assigns it to the Attributes field. func (o *Group) SetAttributes(v map[string]interface{}) { o.Attributes = v } // GetRoles returns the Roles field value if set, zero value otherwise. func (o *Group) GetRoles() []string { if o == nil || IsNil(o.Roles) { var ret []string return ret } return o.Roles } // GetRolesOk returns a tuple with the Roles field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *Group) GetRolesOk() ([]string, bool) { if o == nil || IsNil(o.Roles) { return nil, false } return o.Roles, true } // HasRoles returns a boolean if a field has been set. func (o *Group) HasRoles() bool { if o != nil && !IsNil(o.Roles) { return true } return false } // SetRoles gets a reference to the given []string and assigns it to the Roles field. func (o *Group) SetRoles(v []string) { o.Roles = v } // GetRolesObj returns the RolesObj field value func (o *Group) GetRolesObj() []Role { if o == nil { var ret []Role return ret } return o.RolesObj } // GetRolesObjOk returns a tuple with the RolesObj field value // and a boolean to check if the value has been set. func (o *Group) GetRolesObjOk() ([]Role, bool) { if o == nil { return nil, false } return o.RolesObj, true } // SetRolesObj sets field value func (o *Group) SetRolesObj(v []Role) { o.RolesObj = v } // GetInheritedRolesObj returns the InheritedRolesObj field value // If the value is explicit nil, the zero value for []Role will be returned func (o *Group) GetInheritedRolesObj() []Role { if o == nil { var ret []Role return ret } return o.InheritedRolesObj } // GetInheritedRolesObjOk returns a tuple with the InheritedRolesObj field value // 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 *Group) GetInheritedRolesObjOk() ([]Role, bool) { if o == nil || IsNil(o.InheritedRolesObj) { return nil, false } return o.InheritedRolesObj, true } // SetInheritedRolesObj sets field value func (o *Group) SetInheritedRolesObj(v []Role) { o.InheritedRolesObj = v } // GetChildren returns the Children field value func (o *Group) GetChildren() []string { if o == nil { var ret []string return ret } return o.Children } // GetChildrenOk returns a tuple with the Children field value // and a boolean to check if the value has been set. func (o *Group) GetChildrenOk() ([]string, bool) { if o == nil { return nil, false } return o.Children, true } // SetChildren sets field value func (o *Group) SetChildren(v []string) { o.Children = v } // GetChildrenObj returns the ChildrenObj field value // If the value is explicit nil, the zero value for []RelatedGroup will be returned func (o *Group) GetChildrenObj() []RelatedGroup { if o == nil { var ret []RelatedGroup return ret } return o.ChildrenObj } // GetChildrenObjOk returns a tuple with the ChildrenObj field value // 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 *Group) GetChildrenObjOk() ([]RelatedGroup, bool) { if o == nil || IsNil(o.ChildrenObj) { return nil, false } return o.ChildrenObj, true } // SetChildrenObj sets field value func (o *Group) SetChildrenObj(v []RelatedGroup) { o.ChildrenObj = v } func (o Group) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { return []byte{}, err } return json.Marshal(toSerialize) } func (o Group) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["pk"] = o.Pk toSerialize["num_pk"] = o.NumPk toSerialize["name"] = o.Name if !IsNil(o.IsSuperuser) { toSerialize["is_superuser"] = o.IsSuperuser } if !IsNil(o.Parents) { toSerialize["parents"] = o.Parents } if o.ParentsObj != nil { toSerialize["parents_obj"] = o.ParentsObj } if !IsNil(o.Users) { toSerialize["users"] = o.Users } if o.UsersObj != nil { toSerialize["users_obj"] = o.UsersObj } if !IsNil(o.Attributes) { toSerialize["attributes"] = o.Attributes } if !IsNil(o.Roles) { toSerialize["roles"] = o.Roles } toSerialize["roles_obj"] = o.RolesObj if o.InheritedRolesObj != nil { toSerialize["inherited_roles_obj"] = o.InheritedRolesObj } toSerialize["children"] = o.Children if o.ChildrenObj != nil { toSerialize["children_obj"] = o.ChildrenObj } for key, value := range o.AdditionalProperties { toSerialize[key] = value } return toSerialize, nil } func (o *Group) 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{ "pk", "num_pk", "name", "parents_obj", "users_obj", "roles_obj", "inherited_roles_obj", "children", "children_obj", } 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) } } varGroup := _Group{} err = json.Unmarshal(data, &varGroup) if err != nil { return err } *o = Group(varGroup) additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(data, &additionalProperties); err == nil { delete(additionalProperties, "pk") delete(additionalProperties, "num_pk") delete(additionalProperties, "name") delete(additionalProperties, "is_superuser") delete(additionalProperties, "parents") delete(additionalProperties, "parents_obj") delete(additionalProperties, "users") delete(additionalProperties, "users_obj") delete(additionalProperties, "attributes") delete(additionalProperties, "roles") delete(additionalProperties, "roles_obj") delete(additionalProperties, "inherited_roles_obj") delete(additionalProperties, "children") delete(additionalProperties, "children_obj") o.AdditionalProperties = additionalProperties } return err } type NullableGroup struct { value *Group isSet bool } func (v NullableGroup) Get() *Group { return v.value } func (v *NullableGroup) Set(val *Group) { v.value = val v.isSet = true } func (v NullableGroup) IsSet() bool { return v.isSet } func (v *NullableGroup) Unset() { v.value = nil v.isSet = false } func NewNullableGroup(val *Group) *NullableGroup { return &NullableGroup{value: val, isSet: true} } func (v NullableGroup) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableGroup) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }