319 lines
7.3 KiB
Go
319 lines
7.3 KiB
Go
/*
|
|
FastAPI
|
|
|
|
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
|
|
API version: 0.1.0
|
|
*/
|
|
|
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|
|
|
package openapi
|
|
|
|
import (
|
|
"encoding/json"
|
|
"bytes"
|
|
"fmt"
|
|
)
|
|
|
|
// checks if the UserDB type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &UserDB{}
|
|
|
|
// UserDB struct for UserDB
|
|
type UserDB struct {
|
|
Name string `json:"name"`
|
|
Email NullableString `json:"email,omitempty"`
|
|
IsAdmin *bool `json:"is_admin,omitempty"`
|
|
Id NullableInt32 `json:"id,omitempty"`
|
|
Passwordhash string `json:"passwordhash"`
|
|
}
|
|
|
|
type _UserDB UserDB
|
|
|
|
// NewUserDB instantiates a new UserDB 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 NewUserDB(name string, passwordhash string) *UserDB {
|
|
this := UserDB{}
|
|
this.Name = name
|
|
var isAdmin bool = false
|
|
this.IsAdmin = &isAdmin
|
|
this.Passwordhash = passwordhash
|
|
return &this
|
|
}
|
|
|
|
// NewUserDBWithDefaults instantiates a new UserDB 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 NewUserDBWithDefaults() *UserDB {
|
|
this := UserDB{}
|
|
var isAdmin bool = false
|
|
this.IsAdmin = &isAdmin
|
|
return &this
|
|
}
|
|
|
|
// GetName returns the Name field value
|
|
func (o *UserDB) 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 *UserDB) GetNameOk() (*string, bool) {
|
|
if o == nil {
|
|
return nil, false
|
|
}
|
|
return &o.Name, true
|
|
}
|
|
|
|
// SetName sets field value
|
|
func (o *UserDB) SetName(v string) {
|
|
o.Name = v
|
|
}
|
|
|
|
// GetEmail returns the Email field value if set, zero value otherwise (both if not set or set to explicit null).
|
|
func (o *UserDB) GetEmail() string {
|
|
if o == nil || IsNil(o.Email.Get()) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.Email.Get()
|
|
}
|
|
|
|
// GetEmailOk returns a tuple with the Email 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 *UserDB) GetEmailOk() (*string, bool) {
|
|
if o == nil {
|
|
return nil, false
|
|
}
|
|
return o.Email.Get(), o.Email.IsSet()
|
|
}
|
|
|
|
// HasEmail returns a boolean if a field has been set.
|
|
func (o *UserDB) HasEmail() bool {
|
|
if o != nil && o.Email.IsSet() {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetEmail gets a reference to the given NullableString and assigns it to the Email field.
|
|
func (o *UserDB) SetEmail(v string) {
|
|
o.Email.Set(&v)
|
|
}
|
|
// SetEmailNil sets the value for Email to be an explicit nil
|
|
func (o *UserDB) SetEmailNil() {
|
|
o.Email.Set(nil)
|
|
}
|
|
|
|
// UnsetEmail ensures that no value is present for Email, not even an explicit nil
|
|
func (o *UserDB) UnsetEmail() {
|
|
o.Email.Unset()
|
|
}
|
|
|
|
// GetIsAdmin returns the IsAdmin field value if set, zero value otherwise.
|
|
func (o *UserDB) GetIsAdmin() bool {
|
|
if o == nil || IsNil(o.IsAdmin) {
|
|
var ret bool
|
|
return ret
|
|
}
|
|
return *o.IsAdmin
|
|
}
|
|
|
|
// GetIsAdminOk returns a tuple with the IsAdmin field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *UserDB) GetIsAdminOk() (*bool, bool) {
|
|
if o == nil || IsNil(o.IsAdmin) {
|
|
return nil, false
|
|
}
|
|
return o.IsAdmin, true
|
|
}
|
|
|
|
// HasIsAdmin returns a boolean if a field has been set.
|
|
func (o *UserDB) HasIsAdmin() bool {
|
|
if o != nil && !IsNil(o.IsAdmin) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetIsAdmin gets a reference to the given bool and assigns it to the IsAdmin field.
|
|
func (o *UserDB) SetIsAdmin(v bool) {
|
|
o.IsAdmin = &v
|
|
}
|
|
|
|
// GetId returns the Id field value if set, zero value otherwise (both if not set or set to explicit null).
|
|
func (o *UserDB) GetId() int32 {
|
|
if o == nil || IsNil(o.Id.Get()) {
|
|
var ret int32
|
|
return ret
|
|
}
|
|
return *o.Id.Get()
|
|
}
|
|
|
|
// GetIdOk returns a tuple with the Id 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 *UserDB) GetIdOk() (*int32, bool) {
|
|
if o == nil {
|
|
return nil, false
|
|
}
|
|
return o.Id.Get(), o.Id.IsSet()
|
|
}
|
|
|
|
// HasId returns a boolean if a field has been set.
|
|
func (o *UserDB) HasId() bool {
|
|
if o != nil && o.Id.IsSet() {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetId gets a reference to the given NullableInt32 and assigns it to the Id field.
|
|
func (o *UserDB) SetId(v int32) {
|
|
o.Id.Set(&v)
|
|
}
|
|
// SetIdNil sets the value for Id to be an explicit nil
|
|
func (o *UserDB) SetIdNil() {
|
|
o.Id.Set(nil)
|
|
}
|
|
|
|
// UnsetId ensures that no value is present for Id, not even an explicit nil
|
|
func (o *UserDB) UnsetId() {
|
|
o.Id.Unset()
|
|
}
|
|
|
|
// GetPasswordhash returns the Passwordhash field value
|
|
func (o *UserDB) GetPasswordhash() string {
|
|
if o == nil {
|
|
var ret string
|
|
return ret
|
|
}
|
|
|
|
return o.Passwordhash
|
|
}
|
|
|
|
// GetPasswordhashOk returns a tuple with the Passwordhash field value
|
|
// and a boolean to check if the value has been set.
|
|
func (o *UserDB) GetPasswordhashOk() (*string, bool) {
|
|
if o == nil {
|
|
return nil, false
|
|
}
|
|
return &o.Passwordhash, true
|
|
}
|
|
|
|
// SetPasswordhash sets field value
|
|
func (o *UserDB) SetPasswordhash(v string) {
|
|
o.Passwordhash = v
|
|
}
|
|
|
|
func (o UserDB) MarshalJSON() ([]byte, error) {
|
|
toSerialize,err := o.ToMap()
|
|
if err != nil {
|
|
return []byte{}, err
|
|
}
|
|
return json.Marshal(toSerialize)
|
|
}
|
|
|
|
func (o UserDB) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
toSerialize["name"] = o.Name
|
|
if o.Email.IsSet() {
|
|
toSerialize["email"] = o.Email.Get()
|
|
}
|
|
if !IsNil(o.IsAdmin) {
|
|
toSerialize["is_admin"] = o.IsAdmin
|
|
}
|
|
if o.Id.IsSet() {
|
|
toSerialize["id"] = o.Id.Get()
|
|
}
|
|
toSerialize["passwordhash"] = o.Passwordhash
|
|
return toSerialize, nil
|
|
}
|
|
|
|
func (o *UserDB) 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{
|
|
"name",
|
|
"passwordhash",
|
|
}
|
|
|
|
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)
|
|
}
|
|
}
|
|
|
|
varUserDB := _UserDB{}
|
|
|
|
decoder := json.NewDecoder(bytes.NewReader(data))
|
|
decoder.DisallowUnknownFields()
|
|
err = decoder.Decode(&varUserDB)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*o = UserDB(varUserDB)
|
|
|
|
return err
|
|
}
|
|
|
|
type NullableUserDB struct {
|
|
value *UserDB
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableUserDB) Get() *UserDB {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableUserDB) Set(val *UserDB) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableUserDB) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableUserDB) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableUserDB(val *UserDB) *NullableUserDB {
|
|
return &NullableUserDB{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableUserDB) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableUserDB) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|
|
|
|
|