Giter VIP home page Giter VIP logo

battlenet-api-android's Introduction

Battle.net API for Android

Download Codacy Badge Build Status License

Introduction

This library gives you access to the APIs of Battle.net based on the Retrofit library.

Oauth2

Some of the APIs require Oauth2, so for getting a valid access token you can use:

OauthActivity.startActivity()

Check out the sampleapp module for the complete flow!

Available APIs

D3 Community API

PROFILE API
  • CAREER PROFILE /D3/PROFILE/:BATTLETAG/
  • HERO PROFILE /D3/PROFILE/:BATTLETAG/HERO/:ID
DATA RESOURCES
  • ITEM DATA /D3/DATA/ITEM/:DATA

Community OAuth Profile API

ACCOUNT API
  • USER /ACCOUNT/USER

Game Data API

D3
  • USER /ACCOUNT/USER
  • SEASON INDEX /DATA/D3/SEASON/
  • SEASON /DATA/D3/SEASON/:ID
  • SEASON LEADERBOARD /DATA/D3/SEASON/:ID/LEADERBOARD/:LEADERBOARD
  • ERA INDEX /DATA/D3/ERA/
  • ERA /DATA/D3/ERA/:ID
  • ERA LEADERBOARD /DATA/D3/ERA/:ID/LEADERBOARD/:LEADERBOARD

Library API

Entry points

For every implemented entry point you get a class of the same name to access the API.

Example: to call the CareerProfile of the D3 Community API:

BattleTag battleTag = new BattleTag(USERNAME, NUMBER);
CareerProfile careerProfile = D3CommunityAPI.getCareerProfile(context, Region.EU, battleTag, Locale.ENGLISH);

Sync vs Async

Every function will have two ways to be called:

  • Synchronous (no callback at the end of the function)
  • Asynchronous (with a retrofit callback at the end)

Example for the D3 Community API:

// Synchronous
public static CareerProfile getCareerProfile(@NonNull Context context, @NonNull Region region, @NonNull BattleTag battleTag, @NonNull Locale locale);

// Asynchronous
public static void getCareerProfile(@NonNull Context context, @NonNull Region region, @NonNull BattleTag battleTag, @NonNull Locale locale, @NonNull Callback<CareerProfile> callback);

Configuration

To set up your own API KEY and API SECRET, override the next values in your strings.xml:

<string name="battlenet_lib_api_key">YOUR-API-KEY-HERE</string>
<string name="battlenet_lib_api_secret">YOUR-API-SECRETKEY-HERE</string>

battlenet-api-android's People

Contributors

galex avatar codacy-badger avatar

Watchers

James Cloos avatar Nicolas SIMON avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.