orchestrator-swagger-go-client/model_models_plug_task.go

230 lines
5.6 KiB
Go

/*
Anthrove Orchestrator API
This service handles the communication between the manager and the plugs
API version: 0.1-PREVIEW
Contact: support@anthrove.art
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package openapi
import (
"bytes"
"encoding/json"
"fmt"
)
// checks if the ModelsPlugTask type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &ModelsPlugTask{}
// ModelsPlugTask struct for ModelsPlugTask
type ModelsPlugTask struct {
Id *string `json:"id,omitempty"`
TaskState *ModelsPlugTaskState `json:"task_state,omitempty"`
UserId string `json:"user_id"`
}
type _ModelsPlugTask ModelsPlugTask
// NewModelsPlugTask instantiates a new ModelsPlugTask 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 NewModelsPlugTask(userId string) *ModelsPlugTask {
this := ModelsPlugTask{}
this.UserId = userId
return &this
}
// NewModelsPlugTaskWithDefaults instantiates a new ModelsPlugTask 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 NewModelsPlugTaskWithDefaults() *ModelsPlugTask {
this := ModelsPlugTask{}
return &this
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *ModelsPlugTask) GetId() string {
if o == nil || IsNil(o.Id) {
var ret string
return ret
}
return *o.Id
}
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ModelsPlugTask) GetIdOk() (*string, bool) {
if o == nil || IsNil(o.Id) {
return nil, false
}
return o.Id, true
}
// HasId returns a boolean if a field has been set.
func (o *ModelsPlugTask) HasId() bool {
if o != nil && !IsNil(o.Id) {
return true
}
return false
}
// SetId gets a reference to the given string and assigns it to the Id field.
func (o *ModelsPlugTask) SetId(v string) {
o.Id = &v
}
// GetTaskState returns the TaskState field value if set, zero value otherwise.
func (o *ModelsPlugTask) GetTaskState() ModelsPlugTaskState {
if o == nil || IsNil(o.TaskState) {
var ret ModelsPlugTaskState
return ret
}
return *o.TaskState
}
// GetTaskStateOk returns a tuple with the TaskState field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ModelsPlugTask) GetTaskStateOk() (*ModelsPlugTaskState, bool) {
if o == nil || IsNil(o.TaskState) {
return nil, false
}
return o.TaskState, true
}
// HasTaskState returns a boolean if a field has been set.
func (o *ModelsPlugTask) HasTaskState() bool {
if o != nil && !IsNil(o.TaskState) {
return true
}
return false
}
// SetTaskState gets a reference to the given ModelsPlugTaskState and assigns it to the TaskState field.
func (o *ModelsPlugTask) SetTaskState(v ModelsPlugTaskState) {
o.TaskState = &v
}
// GetUserId returns the UserId field value
func (o *ModelsPlugTask) GetUserId() string {
if o == nil {
var ret string
return ret
}
return o.UserId
}
// GetUserIdOk returns a tuple with the UserId field value
// and a boolean to check if the value has been set.
func (o *ModelsPlugTask) GetUserIdOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.UserId, true
}
// SetUserId sets field value
func (o *ModelsPlugTask) SetUserId(v string) {
o.UserId = v
}
func (o ModelsPlugTask) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o ModelsPlugTask) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Id) {
toSerialize["id"] = o.Id
}
if !IsNil(o.TaskState) {
toSerialize["task_state"] = o.TaskState
}
toSerialize["user_id"] = o.UserId
return toSerialize, nil
}
func (o *ModelsPlugTask) 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{
"user_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)
}
}
varModelsPlugTask := _ModelsPlugTask{}
decoder := json.NewDecoder(bytes.NewReader(data))
decoder.DisallowUnknownFields()
err = decoder.Decode(&varModelsPlugTask)
if err != nil {
return err
}
*o = ModelsPlugTask(varModelsPlugTask)
return err
}
type NullableModelsPlugTask struct {
value *ModelsPlugTask
isSet bool
}
func (v NullableModelsPlugTask) Get() *ModelsPlugTask {
return v.value
}
func (v *NullableModelsPlugTask) Set(val *ModelsPlugTask) {
v.value = val
v.isSet = true
}
func (v NullableModelsPlugTask) IsSet() bool {
return v.isSet
}
func (v *NullableModelsPlugTask) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableModelsPlugTask(val *ModelsPlugTask) *NullableModelsPlugTask {
return &NullableModelsPlugTask{value: val, isSet: true}
}
func (v NullableModelsPlugTask) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableModelsPlugTask) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}