Summary
Functions
Resets the given SteamID's components to the values expected for regular user accounts.
Components
The various Steam account types.
The components that make up a %SteamID{}.
The various Steam universes.
Constructors
Converts an integer into a SteamID.
Like from_integer/2, but raises on invalid inputs.
Constructs a %SteamID{} from its components.
Parses a string into a SteamID.
Like parse/2, but raises on invalid inputs.
Types
@type steamid32() :: 0..4_294_967_295
@type steamid64() :: 0..409_827_566_090_715_135
@type t() :: %SteamID{value: term()}
A SteamID.
You may pattern match on this struct, but not read or write its fields. Use the functions in this module instead.
Functions
Components
@type account_instance() :: 0..1_048_575
@spec account_instance(t()) :: account_instance()
@type account_number() :: 0..2_147_483_647
@spec account_number(t()) :: account_number()
@type account_type() ::
:invalid
| :individual
| :multiseat
| :game_server
| :anon_game_server
| :pending
| :content_server
| :clan
| :chat
| :p2p_super_seeder
| :anon_user
The various Steam account types.
@spec account_type(t()) :: account_type()
@type authentication_server() :: 0..1
@spec authentication_server(t()) :: authentication_server()
@type component() :: {:universe, universe()} | {:account_type, account_type()} | {:account_instance, account_instance()} | {:account_number, account_number()} | {:authentication_server, authentication_server()}
The components that make up a %SteamID{}.
@type universe() ::
:unspecified | :individual | :public | :beta | :internal | :dev | :rc
The various Steam universes.
Constructors
@spec from_integer(value :: integer(), [option]) :: {:ok, t()} | :error when option: {:size, 32 | 64}
Converts an integer into a SteamID.
Examples
iex> {:ok, steam_id} = SteamID.from_integer(76561198282622073)
iex> steam_id
#SteamID<76561198282622073>
iex> {:ok, steam_id} = SteamID.from_integer(322356345)
iex> steam_id
#SteamID<4503604244694137>
iex> {:ok, steam_id} = SteamID.from_integer(322356345)
iex> SteamID.normalize(steam_id)
#SteamID<76561198282622073>
iex> :error = SteamID.from_integer(-42)
:error
Like from_integer/2, but raises on invalid inputs.
Constructs a %SteamID{} from its components.
Examples
iex> SteamID.new(account_number: 161178172, authentication_server: 1)
#SteamID<4503604244694137>
iex> SteamID.new(account_number: 161178172, authentication_server: 1)
...> |> SteamID.normalize()
#SteamID<76561198282622073>
@spec parse(binary(), [option]) :: {:ok, t()} | :error when option: {:format, :id2 | :id3 | :id32 | :id64}
Parses a string into a SteamID.
Examples
iex> with {:ok, steam_id} = SteamID.parse("76561198282622073"), do: steam_id
#SteamID<76561198282622073>
iex> with {:ok, steam_id} = SteamID.parse("STEAM_1:1:161178172"), do: steam_id
#SteamID<76561198282622073>
iex> SteamID.parse("bingus")
:error
Like parse/2, but raises on invalid inputs.