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

200 lines
4.8 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"
"time"
"bytes"
"fmt"
)
// checks if the OneShotAccessBase type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &OneShotAccessBase{}
// OneShotAccessBase struct for OneShotAccessBase
type OneShotAccessBase struct {
Uses *int32 `json:"uses,omitempty"`
EndsAt time.Time `json:"ends_at"`
}
type _OneShotAccessBase OneShotAccessBase
// NewOneShotAccessBase instantiates a new OneShotAccessBase 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 NewOneShotAccessBase(endsAt time.Time) *OneShotAccessBase {
this := OneShotAccessBase{}
var uses int32 = 1
this.Uses = &uses
this.EndsAt = endsAt
return &this
}
// NewOneShotAccessBaseWithDefaults instantiates a new OneShotAccessBase 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 NewOneShotAccessBaseWithDefaults() *OneShotAccessBase {
this := OneShotAccessBase{}
var uses int32 = 1
this.Uses = &uses
return &this
}
// GetUses returns the Uses field value if set, zero value otherwise.
func (o *OneShotAccessBase) GetUses() int32 {
if o == nil || IsNil(o.Uses) {
var ret int32
return ret
}
return *o.Uses
}
// GetUsesOk returns a tuple with the Uses field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OneShotAccessBase) GetUsesOk() (*int32, bool) {
if o == nil || IsNil(o.Uses) {
return nil, false
}
return o.Uses, true
}
// HasUses returns a boolean if a field has been set.
func (o *OneShotAccessBase) HasUses() bool {
if o != nil && !IsNil(o.Uses) {
return true
}
return false
}
// SetUses gets a reference to the given int32 and assigns it to the Uses field.
func (o *OneShotAccessBase) SetUses(v int32) {
o.Uses = &v
}
// GetEndsAt returns the EndsAt field value
func (o *OneShotAccessBase) GetEndsAt() time.Time {
if o == nil {
var ret time.Time
return ret
}
return o.EndsAt
}
// GetEndsAtOk returns a tuple with the EndsAt field value
// and a boolean to check if the value has been set.
func (o *OneShotAccessBase) GetEndsAtOk() (*time.Time, bool) {
if o == nil {
return nil, false
}
return &o.EndsAt, true
}
// SetEndsAt sets field value
func (o *OneShotAccessBase) SetEndsAt(v time.Time) {
o.EndsAt = v
}
func (o OneShotAccessBase) MarshalJSON() ([]byte, error) {
toSerialize,err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o OneShotAccessBase) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Uses) {
toSerialize["uses"] = o.Uses
}
toSerialize["ends_at"] = o.EndsAt
return toSerialize, nil
}
func (o *OneShotAccessBase) 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{
"ends_at",
}
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)
}
}
varOneShotAccessBase := _OneShotAccessBase{}
decoder := json.NewDecoder(bytes.NewReader(data))
decoder.DisallowUnknownFields()
err = decoder.Decode(&varOneShotAccessBase)
if err != nil {
return err
}
*o = OneShotAccessBase(varOneShotAccessBase)
return err
}
type NullableOneShotAccessBase struct {
value *OneShotAccessBase
isSet bool
}
func (v NullableOneShotAccessBase) Get() *OneShotAccessBase {
return v.value
}
func (v *NullableOneShotAccessBase) Set(val *OneShotAccessBase) {
v.value = val
v.isSet = true
}
func (v NullableOneShotAccessBase) IsSet() bool {
return v.isSet
}
func (v *NullableOneShotAccessBase) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableOneShotAccessBase(val *OneShotAccessBase) *NullableOneShotAccessBase {
return &NullableOneShotAccessBase{value: val, isSet: true}
}
func (v NullableOneShotAccessBase) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableOneShotAccessBase) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}