ExOsrsApi

Old-school Runescape Highscore API Wrapper

Todo

  1. Improve documentation
  2. Mock API responses for testing

Installation

If available in Hex, the package can be installed by adding ex_osrs_api to your list of dependencies in mix.exs:

def deps do
  [
    {:ex_osrs_api, "~> 0.1.0"}
  ]
end

Examples

module examples

defmodule MyService do
  alias ExOsrsApi.OsrsApi

  # Get regular highscore data
  def get_data(username) do
    OsrsApi.get_highscores(username, :regular)
  end
end

iex examples

# Get regular (non ironman, deadman mode etc... highscores)
iex(0)> alias ExOsrsApi.OsrsApi

iex(1)> OsrsApi.get_highscores("BstnDynamics", :regular)

iex(2)> {:ok,
 %ExOsrsApi.PlayerHighscores{
   activities: %ExOsrsApi.Models.Activities{
     data: [
       %ExOsrsApi.Models.ActivityEntry{
         actions: nil,
         activity: "League Points",
         empty: true,
         rank: nil
       },
       ...
     ]
   }
  empty: false,
  skills: %ExOsrsApi.Models.Skills{
     data: [
       %ExOsrsApi.Models.SkillEntry{
         empty: false,
         experience: 8460220,
         level: 1205,
         rank: 1087587,
         skill: :overall
       },
       ...
     ]
  }
  type: :regular,
  username: "BstnDynamics"
 }}

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/ex_osrs_api.