Parses the scheme-specific part of a uuid URL as described in
draft-kindel-uuid-uri,
and the urn:uuid: form of the same identifier.
The primary API is parse/1, which URL.new/1 calls for any
URL with the uuid or urn scheme. A urn whose namespace is
not uuid is accepted but yields no parsed path.
Summary
Types
Functions
Parses the path of a uuid or urn URI into a t/0 struct.
Arguments
uriis aURI.t/0whose:schemeis"uuid"or"urn".
Returns
{:ok, t:t/0}with the UUID and any parameters, or{:ok, nil}for aurnwhose namespace is notuuid, or{:error, {URL.Parser.ParseError, reason}}if the path is not a valid UUID, or theurnhas no namespace identifier.
Examples
iex> uuid = URI.parse("uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6;a=b")
iex> URL.UUID.parse(uuid)
{:ok,
%URL.UUID{uuid: "f81d4fae-7dec-11d0-a765-00a0c91e6bf6", params: %{"a" => "b"}}}
iex> uuid = URI.parse("urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6;a=b")
iex> URL.UUID.parse(uuid)
{:ok, %URL.UUID{params: %{"a" => "b"}, uuid: "f81d4fae-7dec-11d0-a765-00a0c91e6bf6"}}
iex> URL.UUID.parse(URI.parse("urn:isbn:0451450523"))
{:ok, nil}
iex> {:error, {URL.Parser.ParseError, _reason}} = URL.UUID.parse(URI.parse("uuid:not-a-uuid"))