Giter Club home page Giter Club logo

crystalys's Introduction

Crystalys

A wrapper for Valve's DOTA2 Web API. Crystalys is part of the Daedalus suite. Crystalys is intended for server-side requests, while Demon Edge (not yet in development) will handle client-side requests. The Daedalus npm package is a deployable API server written with express.js.

Before you use Crystalys, please note: Crystalys is still being developed and does not yet have a stable release.

Installing

To install Crystalys install it using npm just as you would for any other npm package npm install crystalys

Using Crystalys

In order to use Crystalys you must have a Steam API key which you can grab from here. Also note that if you don't have a Steam account, you will need one in order to retrieve an API key.

Valve's terms of use for their API states that you must make your API calls from the server-side, or redirect your client-side calls to your own server. Crystalys is only intended to make calls server-side. Client-side calls can be made from another tool in the Daedalus suite Demon Edge (link will be provided once its made!)

Once you've got your very own API key, you can start to actually use Crystalys!

var Crystalys = require('crystalys');

Crystalys.setApiKey('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');

var promise = Crystalys.api.Match.GetMatchHistory.sendRequest();

promise.then(function(response) {
    var data = response.result;
    // do things with your retrieved data!
});

In order to pass parameters you can tack function calls on the endpoint before the sendRequest call like so:

var promise = api.Match.GetMatchHistory.heroID(1).matchesRequested(300).sendRequest()

This will grab the most recent 300 matches with Antimage in them (heroID 1) A JSON file with KV pairs for Hero name to HeroID will likely be added in a future update.

For a good reference on the current Steam API I recommend this site over the official documentation on the TF2 wiki.

You may have noticed that currently the parameter functions follow a different naming scheme from what the actual API uses. This may change in the future to match the API's naming scheme, but personally I prefer heroID() to hero_id(), and other underline delimited parameter names, plus using a sort of camelCase naming scheme seems to be more consistent than the API's due to some being camelCase and some being underline_delimited.

If the community feels strongly one way or another it could definitely influence the naming scheme in Crystalys.

If you have any questions or issues with Crystalys feel free to post an issue here on GitHub or shoot me an email at [email protected]

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.