ex_jira v0.0.5 ExJira.QueryParams View Source

Helper module to convert parameters passed as a keyword list into a querystring.

Link to this section Summary

Functions

Converts a keyword list and a list of atoms into a querystring containing only entries that exist in both the keyword list and the list of atoms

Link to this section Functions

Link to this function

convert(params, list) View Source
convert([{atom(), String.t()}], [atom()]) :: String.t()

Converts a keyword list and a list of atoms into a querystring containing only entries that exist in both the keyword list and the list of atoms.

Examples

iex> ExJira.QueryParams.convert([asdf: 123, hjkl: 456], [:asdf, :hjkl])
"asdf=123&hjkl=456"

iex> ExJira.QueryParams.convert([asdf: 123, hjkl: 456], [:asdf])
"asdf=123"

iex> ExJira.QueryParams.convert([asdf: 123, hjkl: 456], [:hjkl])
"hjkl=456"

iex> ExJira.QueryParams.convert([asdf: 123, hjkl: 456], [:qwerty])
""

iex> ExJira.QueryParams.convert([asdf: 123, hjkl: 456], [])
""