View Source StickerClient.Validator (stickerclient v0.2.0)
StickerClient.Validator
is a utility module which provides parsing and validation to support StickerClient
.
Link to this section Summary
Functions
Attempts to parse an https://signal.art/addstickers
URL to extract the Pack ID and Key.
Link to this section Functions
@spec parse_download_url(url :: String.t()) :: {:ok, String.t(), String.t()} | {:error, StickerClient.Exception.t()}
Attempts to parse an https://signal.art/addstickers
URL to extract the Pack ID and Key.
examples
Examples
iex> parse_download_url("https://signal.art/addstickers/#pack_id=45bdc863f62e6a2548052e0a0c4cb153&pack_key=9dc85e4d5d65d0b272274e5bd4f047fcda3551e77f89053c06078ace81fa6a41")
{:ok, "45bdc863f62e6a2548052e0a0c4cb153", "9dc85e4d5d65d0b272274e5bd4f047fcda3551e77f89053c06078ace81fa6a41"}
# Typo in pack_key
iex> parse_download_url("https://signal.art/addstickers/#pack_id=45bdc863f62e6a2548052e0a0c4cb153&pack_ke=9dc85e4d5d65d0b272274e5bd4f047fcda3551e77f89053c06078ace81fa6a41")
{:error, %StickerClient.Exception{message: "Invalid format, Pack ID and Key could not be parsed"}}