Files
sdk/model_train_part.go

307 lines
7.4 KiB
Go

/*
Hanzo Cloud API
The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
API version: v1
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package hanzoai
import (
"encoding/json"
)
// checks if the TrainPart type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &TrainPart{}
// TrainPart struct for TrainPart
type TrainPart struct {
// Headers must be sent verbatim; the signature covers them.
Headers map[string]string `json:"headers,omitempty"`
// Number orders the part from 1.
Number *int64 `json:"number,omitempty"`
// Offset is the part's first byte in the object.
Offset *int64 `json:"offset,omitempty"`
// Size is the part's byte count.
Size *int64 `json:"size,omitempty"`
// URL is the presigned address to PUT the range to.
Url *string `json:"url,omitempty"`
AdditionalProperties map[string]interface{}
}
type _TrainPart TrainPart
// NewTrainPart instantiates a new TrainPart 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 NewTrainPart() *TrainPart {
this := TrainPart{}
return &this
}
// NewTrainPartWithDefaults instantiates a new TrainPart 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 NewTrainPartWithDefaults() *TrainPart {
this := TrainPart{}
return &this
}
// GetHeaders returns the Headers field value if set, zero value otherwise.
func (o *TrainPart) GetHeaders() map[string]string {
if o == nil || IsNil(o.Headers) {
var ret map[string]string
return ret
}
return o.Headers
}
// GetHeadersOk returns a tuple with the Headers field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainPart) GetHeadersOk() (map[string]string, bool) {
if o == nil || IsNil(o.Headers) {
return map[string]string{}, false
}
return o.Headers, true
}
// HasHeaders returns a boolean if a field has been set.
func (o *TrainPart) HasHeaders() bool {
if o != nil && !IsNil(o.Headers) {
return true
}
return false
}
// SetHeaders gets a reference to the given map[string]string and assigns it to the Headers field.
func (o *TrainPart) SetHeaders(v map[string]string) {
o.Headers = v
}
// GetNumber returns the Number field value if set, zero value otherwise.
func (o *TrainPart) GetNumber() int64 {
if o == nil || IsNil(o.Number) {
var ret int64
return ret
}
return *o.Number
}
// GetNumberOk returns a tuple with the Number field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainPart) GetNumberOk() (*int64, bool) {
if o == nil || IsNil(o.Number) {
return nil, false
}
return o.Number, true
}
// HasNumber returns a boolean if a field has been set.
func (o *TrainPart) HasNumber() bool {
if o != nil && !IsNil(o.Number) {
return true
}
return false
}
// SetNumber gets a reference to the given int64 and assigns it to the Number field.
func (o *TrainPart) SetNumber(v int64) {
o.Number = &v
}
// GetOffset returns the Offset field value if set, zero value otherwise.
func (o *TrainPart) GetOffset() int64 {
if o == nil || IsNil(o.Offset) {
var ret int64
return ret
}
return *o.Offset
}
// GetOffsetOk returns a tuple with the Offset field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainPart) GetOffsetOk() (*int64, bool) {
if o == nil || IsNil(o.Offset) {
return nil, false
}
return o.Offset, true
}
// HasOffset returns a boolean if a field has been set.
func (o *TrainPart) HasOffset() bool {
if o != nil && !IsNil(o.Offset) {
return true
}
return false
}
// SetOffset gets a reference to the given int64 and assigns it to the Offset field.
func (o *TrainPart) SetOffset(v int64) {
o.Offset = &v
}
// GetSize returns the Size field value if set, zero value otherwise.
func (o *TrainPart) GetSize() int64 {
if o == nil || IsNil(o.Size) {
var ret int64
return ret
}
return *o.Size
}
// GetSizeOk returns a tuple with the Size field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainPart) GetSizeOk() (*int64, bool) {
if o == nil || IsNil(o.Size) {
return nil, false
}
return o.Size, true
}
// HasSize returns a boolean if a field has been set.
func (o *TrainPart) HasSize() bool {
if o != nil && !IsNil(o.Size) {
return true
}
return false
}
// SetSize gets a reference to the given int64 and assigns it to the Size field.
func (o *TrainPart) SetSize(v int64) {
o.Size = &v
}
// GetUrl returns the Url field value if set, zero value otherwise.
func (o *TrainPart) GetUrl() string {
if o == nil || IsNil(o.Url) {
var ret string
return ret
}
return *o.Url
}
// GetUrlOk returns a tuple with the Url field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TrainPart) GetUrlOk() (*string, bool) {
if o == nil || IsNil(o.Url) {
return nil, false
}
return o.Url, true
}
// HasUrl returns a boolean if a field has been set.
func (o *TrainPart) HasUrl() bool {
if o != nil && !IsNil(o.Url) {
return true
}
return false
}
// SetUrl gets a reference to the given string and assigns it to the Url field.
func (o *TrainPart) SetUrl(v string) {
o.Url = &v
}
func (o TrainPart) MarshalJSON() ([]byte, error) {
toSerialize, err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o TrainPart) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if !IsNil(o.Headers) {
toSerialize["headers"] = o.Headers
}
if !IsNil(o.Number) {
toSerialize["number"] = o.Number
}
if !IsNil(o.Offset) {
toSerialize["offset"] = o.Offset
}
if !IsNil(o.Size) {
toSerialize["size"] = o.Size
}
if !IsNil(o.Url) {
toSerialize["url"] = o.Url
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *TrainPart) UnmarshalJSON(data []byte) (err error) {
varTrainPart := _TrainPart{}
err = json.Unmarshal(data, &varTrainPart)
if err != nil {
return err
}
*o = TrainPart(varTrainPart)
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(data, &additionalProperties); err == nil {
delete(additionalProperties, "headers")
delete(additionalProperties, "number")
delete(additionalProperties, "offset")
delete(additionalProperties, "size")
delete(additionalProperties, "url")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableTrainPart struct {
value *TrainPart
isSet bool
}
func (v NullableTrainPart) Get() *TrainPart {
return v.value
}
func (v *NullableTrainPart) Set(val *TrainPart) {
v.value = val
v.isSet = true
}
func (v NullableTrainPart) IsSet() bool {
return v.isSet
}
func (v *NullableTrainPart) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTrainPart(val *TrainPart) *NullableTrainPart {
return &NullableTrainPart{value: val, isSet: true}
}
func (v NullableTrainPart) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTrainPart) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}