Files
portal/openapi/model_card_create.go
2026-08-04 15:28:33 +02:00

227 lines
5.1 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 CardCreate type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &CardCreate{}
// CardCreate struct for CardCreate
type CardCreate struct {
Name string `json:"name"`
Enabled *bool `json:"enabled,omitempty"`
GroupId int32 `json:"group_id"`
}
type _CardCreate CardCreate
// NewCardCreate instantiates a new CardCreate 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 NewCardCreate(name string, groupId int32) *CardCreate {
this := CardCreate{}
this.Name = name
var enabled bool = true
this.Enabled = &enabled
this.GroupId = groupId
return &this
}
// NewCardCreateWithDefaults instantiates a new CardCreate 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 NewCardCreateWithDefaults() *CardCreate {
this := CardCreate{}
var enabled bool = true
this.Enabled = &enabled
return &this
}
// GetName returns the Name field value
func (o *CardCreate) 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 *CardCreate) GetNameOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Name, true
}
// SetName sets field value
func (o *CardCreate) SetName(v string) {
o.Name = v
}
// GetEnabled returns the Enabled field value if set, zero value otherwise.
func (o *CardCreate) GetEnabled() bool {
if o == nil || IsNil(o.Enabled) {
var ret bool
return ret
}
return *o.Enabled
}
// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CardCreate) GetEnabledOk() (*bool, bool) {
if o == nil || IsNil(o.Enabled) {
return nil, false
}
return o.Enabled, true
}
// HasEnabled returns a boolean if a field has been set.
func (o *CardCreate) HasEnabled() bool {
if o != nil && !IsNil(o.Enabled) {
return true
}
return false
}
// SetEnabled gets a reference to the given bool and assigns it to the Enabled field.
func (o *CardCreate) SetEnabled(v bool) {
o.Enabled = &v
}
// GetGroupId returns the GroupId field value
func (o *CardCreate) GetGroupId() int32 {
if o == nil {
var ret int32
return ret
}
return o.GroupId
}
// GetGroupIdOk returns a tuple with the GroupId field value
// and a boolean to check if the value has been set.
func (o *CardCreate) GetGroupIdOk() (*int32, bool) {
if o == nil {
return nil, false
}
return &o.GroupId, true
}
// SetGroupId sets field value
func (o *CardCreate) SetGroupId(v int32) {
o.GroupId = v
}
func (o CardCreate) MarshalJSON() ([]byte, error) {
toSerialize,err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o CardCreate) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["name"] = o.Name
if !IsNil(o.Enabled) {
toSerialize["enabled"] = o.Enabled
}
toSerialize["group_id"] = o.GroupId
return toSerialize, nil
}
func (o *CardCreate) 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",
"group_id",
}
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)
}
}
varCardCreate := _CardCreate{}
decoder := json.NewDecoder(bytes.NewReader(data))
decoder.DisallowUnknownFields()
err = decoder.Decode(&varCardCreate)
if err != nil {
return err
}
*o = CardCreate(varCardCreate)
return err
}
type NullableCardCreate struct {
value *CardCreate
isSet bool
}
func (v NullableCardCreate) Get() *CardCreate {
return v.value
}
func (v *NullableCardCreate) Set(val *CardCreate) {
v.value = val
v.isSet = true
}
func (v NullableCardCreate) IsSet() bool {
return v.isSet
}
func (v *NullableCardCreate) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCardCreate(val *CardCreate) *NullableCardCreate {
return &NullableCardCreate{value: val, isSet: true}
}
func (v NullableCardCreate) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCardCreate) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}