OsuEx.API — Osu!ex V0.2.0 - HexDocs

A wrapper around the osu! API.

Usage

iex> {:ok,u}=OsuEx.API.get_user("cookiezi");u%{accuracy:98.85315704345703,count100:368145,count300:9087788,count50:32334,count_rank_a:505,count_rank_s:99,count_rank_sh:568,count_rank_ss:22,count_rank_ssh:70,country:"KR",events:[],level:101.69,playcount:22667,pp_country_rank:2,pp_rank:3,pp_raw:13849.5,ranked_score:34166564378,total_score:195920565377,total_seconds_played:1832614,user_id:124493,username:"Cookiezi"}

The get_* function names mirror the API itself as do the parameter names, which can be passed as a trailing keyword list.

The returned data is mostly identical to the osu! API documentation, except for the following:

  • The return value of functions which return at most one result (get_user/2 for example) is a map instead of a list containing one map. If no result is found, then the value is nil, instead of an empty list.
  • Numbers, booleans, dates, and lists are parsed to their native types.

To parse enum values like approved: 3 into more human-readable atoms, or encode/decode mods, see the OsuEx.API.Utils module.

Configuration

To access the osu! API, you need to provide an API key. You can pass the k parameter around if you want, but otherwise you can configure its value in config.exs:

config:osu_api,api_key:"<your key here>"

You can also set the OSU_API_KEY environment variable.

Tag » How To Use Osu Api