spacetraders/model_shipyard.go

250 lines
6.9 KiB
Go

/*
SpaceTraders API
SpaceTraders is an open-universe game and learning platform that offers a set of HTTP endpoints to control a fleet of ships and explore a multiplayer universe. The API is documented using [OpenAPI](https://github.com/SpaceTradersAPI/api-docs). You can send your first request right here in your browser to check the status of the game server. ```json http { \"method\": \"GET\", \"url\": \"https://api.spacetraders.io/v2\", } ``` Unlike a traditional game, SpaceTraders does not have a first-party client or app to play the game. Instead, you can use the API to build your own client, write a script to automate your ships, or try an app built by the community. We have a [Discord channel](https://discord.com/invite/jh6zurdWk5) where you can share your projects, ask questions, and get help from other players.
API version: 2.0.0
Contact: joel@spacetraders.io
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package spacetraders
import (
"encoding/json"
)
// checks if the Shipyard type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Shipyard{}
// Shipyard
type Shipyard struct {
// The symbol of the shipyard. The symbol is the same as the waypoint where the shipyard is located.
Symbol string `json:"symbol"`
// The list of ship types available for purchase at this shipyard.
ShipTypes []ShipyardShipTypesInner `json:"shipTypes"`
// The list of recent transactions at this shipyard.
Transactions []ShipyardTransaction `json:"transactions,omitempty"`
// The ships that are currently available for purchase at the shipyard.
Ships []ShipyardShip `json:"ships,omitempty"`
AdditionalProperties map[string]interface{}
}
type _Shipyard Shipyard
// NewShipyard instantiates a new Shipyard 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 NewShipyard(symbol string, shipTypes []ShipyardShipTypesInner) *Shipyard {
this := Shipyard{}
this.Symbol = symbol
this.ShipTypes = shipTypes
return &this
}
// NewShipyardWithDefaults instantiates a new Shipyard 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 NewShipyardWithDefaults() *Shipyard {
this := Shipyard{}
return &this
}
// GetSymbol returns the Symbol field value
func (o *Shipyard) GetSymbol() string {
if o == nil {
var ret string
return ret
}
return o.Symbol
}
// GetSymbolOk returns a tuple with the Symbol field value
// and a boolean to check if the value has been set.
func (o *Shipyard) GetSymbolOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Symbol, true
}
// SetSymbol sets field value
func (o *Shipyard) SetSymbol(v string) {
o.Symbol = v
}
// GetShipTypes returns the ShipTypes field value
func (o *Shipyard) GetShipTypes() []ShipyardShipTypesInner {
if o == nil {
var ret []ShipyardShipTypesInner
return ret
}
return o.ShipTypes
}
// GetShipTypesOk returns a tuple with the ShipTypes field value
// and a boolean to check if the value has been set.
func (o *Shipyard) GetShipTypesOk() ([]ShipyardShipTypesInner, bool) {
if o == nil {
return nil, false
}
return o.ShipTypes, true
}
// SetShipTypes sets field value
func (o *Shipyard) SetShipTypes(v []ShipyardShipTypesInner) {
o.ShipTypes = v
}
// GetTransactions returns the Transactions field value if set, zero value otherwise.
func (o *Shipyard) GetTransactions() []ShipyardTransaction {
if o == nil || isNil(o.Transactions) {
var ret []ShipyardTransaction
return ret
}
return o.Transactions
}
// GetTransactionsOk returns a tuple with the Transactions field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Shipyard) GetTransactionsOk() ([]ShipyardTransaction, bool) {
if o == nil || isNil(o.Transactions) {
return nil, false
}
return o.Transactions, true
}
// HasTransactions returns a boolean if a field has been set.
func (o *Shipyard) HasTransactions() bool {
if o != nil && !isNil(o.Transactions) {
return true
}
return false
}
// SetTransactions gets a reference to the given []ShipyardTransaction and assigns it to the Transactions field.
func (o *Shipyard) SetTransactions(v []ShipyardTransaction) {
o.Transactions = v
}
// GetShips returns the Ships field value if set, zero value otherwise.
func (o *Shipyard) GetShips() []ShipyardShip {
if o == nil || isNil(o.Ships) {
var ret []ShipyardShip
return ret
}
return o.Ships
}
// GetShipsOk returns a tuple with the Ships field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Shipyard) GetShipsOk() ([]ShipyardShip, bool) {
if o == nil || isNil(o.Ships) {
return nil, false
}
return o.Ships, true
}
// HasShips returns a boolean if a field has been set.
func (o *Shipyard) HasShips() bool {
if o != nil && !isNil(o.Ships) {
return true
}
return false
}
// SetShips gets a reference to the given []ShipyardShip and assigns it to the Ships field.
func (o *Shipyard) SetShips(v []ShipyardShip) {
o.Ships = v
}
func (o Shipyard) MarshalJSON() ([]byte, error) {
toSerialize,err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o Shipyard) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["symbol"] = o.Symbol
toSerialize["shipTypes"] = o.ShipTypes
if !isNil(o.Transactions) {
toSerialize["transactions"] = o.Transactions
}
if !isNil(o.Ships) {
toSerialize["ships"] = o.Ships
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return toSerialize, nil
}
func (o *Shipyard) UnmarshalJSON(bytes []byte) (err error) {
varShipyard := _Shipyard{}
if err = json.Unmarshal(bytes, &varShipyard); err == nil {
*o = Shipyard(varShipyard)
}
additionalProperties := make(map[string]interface{})
if err = json.Unmarshal(bytes, &additionalProperties); err == nil {
delete(additionalProperties, "symbol")
delete(additionalProperties, "shipTypes")
delete(additionalProperties, "transactions")
delete(additionalProperties, "ships")
o.AdditionalProperties = additionalProperties
}
return err
}
type NullableShipyard struct {
value *Shipyard
isSet bool
}
func (v NullableShipyard) Get() *Shipyard {
return v.value
}
func (v *NullableShipyard) Set(val *Shipyard) {
v.value = val
v.isSet = true
}
func (v NullableShipyard) IsSet() bool {
return v.isSet
}
func (v *NullableShipyard) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableShipyard(val *Shipyard) *NullableShipyard {
return &NullableShipyard{value: val, isSet: true}
}
func (v NullableShipyard) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableShipyard) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}