Giter Site home page Giter Site logo

dreamos82 / mtgrestservice Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 41 KB

Implementation of a small set of rest api for MagicTheGathering that will provide users with: Expansion details (name, composition, launch, etc.).

Go 97.84% Dockerfile 2.16%

mtgrestservice's Introduction

Mtgrestservice

This README is still in draft

This tool is a small set of rest api, to be used to fetch some information regarding the game Magic The Gathering. The information that are currently available are:

  1. All expansion names in English, Spanish and Italian (Spanish and Italian where available).
  2. Card composition of every expansion (Number of lands, commons, uncommons, etc)
  3. If the set is preconstructed: number of decks in the set, and type (duel, planechase, etc.)
  4. If it is an edition available only online or it is a "From the vault" set

Please note, that having a list of all the cards is beyond the purpose of this project (even because it has already done in the mtgjson), so for now i prefer to focus on other information that are not accessible in an organized way (for developers :) )

My future plans are to add list of all magic abilities, with their translations, and what is their effect.

Prerequisites

No particular prerequisites

Compile

In order to compile this tool you must have go language installed. And you need the following go libraries:

  • gorilla/mux

To download this package just type in your go workspace:

go get -u github.com/gorilla/mux

Then to compile just move into project directory and run:

go install

Launch

If it is the first time that you run this tool, make sure to copy the asset folder into the same folder of the executable file (in the future the path will be provided using a configuration file)

Cd into the folder where the executable is installed and run (if you have compiled it from sources it should in your workspace bin folder):

mtgrestservice

Once the service is started just try to access:

  • http://<hostname>:4040/listeditions for a list of all editions in json format
  • http://<hostname>:4040/getedition/{key}/{format} where key is the edition code, and format is xml or json, will return the information available for the edition specified in key in the selected format.

The port used by default is 4040, if you change it in config.properties, change the port accordingly in the above examples.

Using Docker

If you are using docker you can build a container containing the service. First you need to build the container with:

docker build --tag=mtgrestservicedocker .

Then to run it:

docker run -p 4040:4040 --name=mtgrestservice -d mtgrestservicedocker

And that's it, now you are running mtgrestservice in a docker container! In this case you don't need to install any go dependency.

Help

I will be very happy if you want to help me with this project, you can do it in three ways:

  1. Reporting bugs (using the project issue tracker)
  2. Keeping the xml information up to date, and add more languages.
  3. Help me in the development
  4. Using it :)

Known issues/TODO

There are several known issue:

  • When the information is not available the node will be inserted even if is empty.
  • Vault and Online information are empty nodes, so if the node is present for an edition, this mean that this edition has that attribute. Now when the tool generate the JSON output they are both present with the value null, in the case the edition doesn't have these attributes
  • Fix bugs
  • The english of this README should be fixed :)

mtgrestservice's People

Contributors

inuyasha82 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

mtgrestservice's Issues

Add getEditionLogo

Add geteditionlogo endpoint.

The sintax should be:
/geteditionlogo/XXX

where XXX is the Edition Code.

Create configuration file

Create configuration file.
List of parameters:

  • Server Port
  • Assets folder
  • Hostname
  • Max connections

Add gitignore file

Files to ignore:
.DS_Store
mtgrestservice executable
vim lock files
etc.

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.