JikanEx.UrlBuilders (JikanEx v0.1.5) View Source

Creates the URLs for Jikan endpoints. These are called from JikanEx.Request and aren't typically used by calling them directly.

Link to this section Summary

Functions

Builds a URL from a list of paths and a param_map

Similar to build_url/4 but doesn't accept a MAL ID

Build a URL from a function name, (MAL) id, paths, parameter map

Link to this section Functions

Link to this function

build(path_list, param_map \\ %{})

View Source

Specs

Builds a URL from a list of paths and a param_map

Example

iex> JikanEx.UrlBuilders.build([:user, "nekomata1037", :animelist, :completed, 2], %{year: 2019})
"user/nekomata1037/animelist/completed/2?year=2019&"
Link to this function

build_url(function_env, paths, parameters)

View Source

Specs

Similar to build_url/4 but doesn't accept a MAL ID

Example

iex> JikanEx.UrlBuilders.build_url({:search!, 0}, ["anime"], %{:q => "k-on", "limit" => 5})
"search/anime?q=k-on&limit=5&"
Link to this function

build_url(function_env, id, paths, parameters)

View Source

Specs

Build a URL from a function name, (MAL) id, paths, parameter map

Accepts the __ENV__.function from the calling function as the first argument (to turn into the first URL part), the MAL ID for the second and additional paths/params as third/fourth

Example

iex> JikanEx.UrlBuilders.build_url({:anime!, 0}, 1, [:characters_staff], %{})
"anime/1/characters_staff/"