init
This commit is contained in:
@@ -0,0 +1,296 @@
|
||||
/*
|
||||
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 Timetable type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &Timetable{}
|
||||
|
||||
// Timetable struct for Timetable
|
||||
type Timetable struct {
|
||||
Weekday int32 `json:"weekday"`
|
||||
Starttime string `json:"starttime"`
|
||||
Duration int32 `json:"duration"`
|
||||
Id NullableInt32 `json:"id,omitempty"`
|
||||
AccessauthId *int32 `json:"accessauth_id,omitempty"`
|
||||
}
|
||||
|
||||
type _Timetable Timetable
|
||||
|
||||
// NewTimetable instantiates a new Timetable 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 NewTimetable(weekday int32, starttime string, duration int32) *Timetable {
|
||||
this := Timetable{}
|
||||
this.Weekday = weekday
|
||||
this.Starttime = starttime
|
||||
this.Duration = duration
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewTimetableWithDefaults instantiates a new Timetable 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 NewTimetableWithDefaults() *Timetable {
|
||||
this := Timetable{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetWeekday returns the Weekday field value
|
||||
func (o *Timetable) GetWeekday() int32 {
|
||||
if o == nil {
|
||||
var ret int32
|
||||
return ret
|
||||
}
|
||||
|
||||
return o.Weekday
|
||||
}
|
||||
|
||||
// GetWeekdayOk returns a tuple with the Weekday field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Timetable) GetWeekdayOk() (*int32, bool) {
|
||||
if o == nil {
|
||||
return nil, false
|
||||
}
|
||||
return &o.Weekday, true
|
||||
}
|
||||
|
||||
// SetWeekday sets field value
|
||||
func (o *Timetable) SetWeekday(v int32) {
|
||||
o.Weekday = v
|
||||
}
|
||||
|
||||
// GetStarttime returns the Starttime field value
|
||||
func (o *Timetable) GetStarttime() string {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
|
||||
return o.Starttime
|
||||
}
|
||||
|
||||
// GetStarttimeOk returns a tuple with the Starttime field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Timetable) GetStarttimeOk() (*string, bool) {
|
||||
if o == nil {
|
||||
return nil, false
|
||||
}
|
||||
return &o.Starttime, true
|
||||
}
|
||||
|
||||
// SetStarttime sets field value
|
||||
func (o *Timetable) SetStarttime(v string) {
|
||||
o.Starttime = v
|
||||
}
|
||||
|
||||
// GetDuration returns the Duration field value
|
||||
func (o *Timetable) GetDuration() int32 {
|
||||
if o == nil {
|
||||
var ret int32
|
||||
return ret
|
||||
}
|
||||
|
||||
return o.Duration
|
||||
}
|
||||
|
||||
// GetDurationOk returns a tuple with the Duration field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Timetable) GetDurationOk() (*int32, bool) {
|
||||
if o == nil {
|
||||
return nil, false
|
||||
}
|
||||
return &o.Duration, true
|
||||
}
|
||||
|
||||
// SetDuration sets field value
|
||||
func (o *Timetable) SetDuration(v int32) {
|
||||
o.Duration = v
|
||||
}
|
||||
|
||||
// GetId returns the Id field value if set, zero value otherwise (both if not set or set to explicit null).
|
||||
func (o *Timetable) 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 *Timetable) 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 *Timetable) 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 *Timetable) SetId(v int32) {
|
||||
o.Id.Set(&v)
|
||||
}
|
||||
// SetIdNil sets the value for Id to be an explicit nil
|
||||
func (o *Timetable) SetIdNil() {
|
||||
o.Id.Set(nil)
|
||||
}
|
||||
|
||||
// UnsetId ensures that no value is present for Id, not even an explicit nil
|
||||
func (o *Timetable) UnsetId() {
|
||||
o.Id.Unset()
|
||||
}
|
||||
|
||||
// GetAccessauthId returns the AccessauthId field value if set, zero value otherwise.
|
||||
func (o *Timetable) GetAccessauthId() int32 {
|
||||
if o == nil || IsNil(o.AccessauthId) {
|
||||
var ret int32
|
||||
return ret
|
||||
}
|
||||
return *o.AccessauthId
|
||||
}
|
||||
|
||||
// GetAccessauthIdOk returns a tuple with the AccessauthId field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Timetable) GetAccessauthIdOk() (*int32, bool) {
|
||||
if o == nil || IsNil(o.AccessauthId) {
|
||||
return nil, false
|
||||
}
|
||||
return o.AccessauthId, true
|
||||
}
|
||||
|
||||
// HasAccessauthId returns a boolean if a field has been set.
|
||||
func (o *Timetable) HasAccessauthId() bool {
|
||||
if o != nil && !IsNil(o.AccessauthId) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// SetAccessauthId gets a reference to the given int32 and assigns it to the AccessauthId field.
|
||||
func (o *Timetable) SetAccessauthId(v int32) {
|
||||
o.AccessauthId = &v
|
||||
}
|
||||
|
||||
func (o Timetable) MarshalJSON() ([]byte, error) {
|
||||
toSerialize,err := o.ToMap()
|
||||
if err != nil {
|
||||
return []byte{}, err
|
||||
}
|
||||
return json.Marshal(toSerialize)
|
||||
}
|
||||
|
||||
func (o Timetable) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
toSerialize["weekday"] = o.Weekday
|
||||
toSerialize["starttime"] = o.Starttime
|
||||
toSerialize["duration"] = o.Duration
|
||||
if o.Id.IsSet() {
|
||||
toSerialize["id"] = o.Id.Get()
|
||||
}
|
||||
if !IsNil(o.AccessauthId) {
|
||||
toSerialize["accessauth_id"] = o.AccessauthId
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
func (o *Timetable) 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{
|
||||
"weekday",
|
||||
"starttime",
|
||||
"duration",
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
varTimetable := _Timetable{}
|
||||
|
||||
decoder := json.NewDecoder(bytes.NewReader(data))
|
||||
decoder.DisallowUnknownFields()
|
||||
err = decoder.Decode(&varTimetable)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = Timetable(varTimetable)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
type NullableTimetable struct {
|
||||
value *Timetable
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableTimetable) Get() *Timetable {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableTimetable) Set(val *Timetable) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableTimetable) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableTimetable) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableTimetable(val *Timetable) *NullableTimetable {
|
||||
return &NullableTimetable{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableTimetable) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableTimetable) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user