SteamID (SteamID v0.4.0)
View SourceSummary
Types
The various Steam account types.
The components that make up a %SteamID{}.
A SteamID.
The various Steam universes.
Functions
Converts an integer into a SteamID.
Like from_integer/1, but raises on invalid inputs.
Constructs a %SteamID{} from its components.
Resets the given SteamID's components to the values expected for regular user accounts.
Parses a string into a SteamID.
Like parse/1, but raises on invalid inputs.
Converts a SteamID to an integer.
Converts a SteamID to a string.
Types
@type account_instance() :: 0..1_048_575
@type account_number() :: 0..2_147_483_647
@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.
@type authentication_server() :: 0..1
@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 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.
@type universe() ::
:unspecified | :individual | :public | :beta | :internal | :dev | :rc
The various Steam universes.
Functions
@spec from_integer(value :: integer()) :: {:ok, t()} | :error
@spec from_integer(steamid32()) :: {:ok, t()}
@spec from_integer(steamid64()) :: {:ok, t()}
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/1, 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>
Resets the given SteamID's components to the values expected for regular user accounts.
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/1, but raises on invalid inputs.
Converts a SteamID to an integer.
Options
:size(32or64) - The default value is64.
Converts a SteamID to a string.
Options
:format(one of:id2,:id3,:id32,:id64) - The default value is:id64.