Giter VIP home page Giter VIP logo

mtg-sdk-java's Introduction

Magic: The Gathering Java SDK

Build Status Maven Central Codacy Badge license mtg-developers on discord

Java SDK for using the magicthegathering.io APIs.

Note that API use is free and does not require authentication or registration, but some rate limits apply. Read the official API website for more information.

Add the dependency to your project and you're good to go! If you are on Android make sure you call on a seperate thread than the main.

Prerequisites

  • Java JDK 7 or higher

Integration

Maven

<dependency>
    <groupId>io.magicthegathering</groupId>
    <artifactId>javasdk</artifactId>
    <version>0.0.18</version>
</dependency>

Gradle

implementation 'io.magicthegathering:javasdk:0.0.18'

Ivy

<dependency org="io.magicthegathering" name="javasdk" rev="0.0.18"/>

Usage examples

Get a Card

int multiverseId = 1;
Card card = CardAPI.getCard(multiverseId);

Get all Cards

List<Card> cards = CardAPI.getAllCards();

Get a Set

String setCode = "KLD";
MtgSet set = SetAPI.getSet(setCode);

Get all Sets

This does not populate the card lists by default. This is to improve perfomance if all you need is a set list. Filter also does not currently load set lists. Will be adding in a future release.

List<MtgSet> sets = SetAPI.getAllSets();

Get all Sets with card lists loaded.

List<MtgSet> sets = SetAPI.getAllSetsWithCards();

Generate a Booster

String setCode = "KLD";
List<Card> booster = SetAPI.getBooster(setCode);

Change the connection timeout values that are used by the OkHttpClient

MTGAPI.setConnectTimeout(60);
MTGAPI.setReadTimeout(60);
MTGAPI.setWriteTimeout(60);

License

This project is licensed under MIT license.

mtg-sdk-java's People

Contributors

nyholmniklas avatar thechucklingatom avatar wesleym77 avatar doubi88 avatar bemacized avatar adback03 avatar dependabot[bot] avatar diodaton 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.