lib/vr_chat/model/instance.ex

# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
# https://openapi-generator.tech
# Do not edit the class manually.

defmodule VRChat.Model.Instance do
  @moduledoc """
  * `hidden` field is only present if InstanceType is `hidden` aka \"Friends+\", and is instance creator. * `friends` field is only present if InstanceType is `friends` aka \"Friends\", and is instance creator. * `private` field is only present if InstanceType is `private` aka \"Invite\" or \"Invite+\", and is instance creator.
  """

  @derive [Poison.Encoder]
  defstruct [
    :active,
    :canRequestInvite,
    :capacity,
    :clientNumber,
    :full,
    :id,
    :instanceId,
    :location,
    :n_users,
    :name,
    :ownerId,
    :permanent,
    :photonRegion,
    :platforms,
    :region,
    :shortName,
    :tags,
    :type,
    :worldId,
    :hidden,
    :friends,
    :private
  ]

  @type t :: %__MODULE__{
    :active => boolean(),
    :canRequestInvite => boolean(),
    :capacity => integer(),
    :clientNumber => String.t,
    :full => boolean(),
    :id => String.t,
    :instanceId => String.t,
    :location => String.t,
    :n_users => integer(),
    :name => String.t,
    :ownerId => String.t | nil,
    :permanent => boolean(),
    :photonRegion => VRChat.Model.Region.t,
    :platforms => VRChat.Model.InstancePlatforms.t,
    :region => VRChat.Model.Region.t,
    :shortName => String.t,
    :tags => [VRChat.Model.String.t],
    :type => VRChat.Model.InstanceType.t,
    :worldId => String.t,
    :hidden => String.t | nil,
    :friends => String.t | nil,
    :private => String.t | nil
  }
end

defimpl Poison.Decoder, for: VRChat.Model.Instance do
  import VRChat.Deserializer
  def decode(value, options) do
    value
    |> deserialize(:photonRegion, :struct, VRChat.Model.Region, options)
    |> deserialize(:platforms, :struct, VRChat.Model.InstancePlatforms, options)
    |> deserialize(:region, :struct, VRChat.Model.Region, options)
    |> deserialize(:type, :struct, VRChat.Model.InstanceType, options)
  end
end