Git Product home page Git Product logo

halosharp's Introduction

HaloSharp

The purpose of this project is to create a dead simple C# wrapper for the official Halo® Game Data API (developer.haloapi.com).

HaloSharp attempts to fully support all available official endpoints.

Features

  • All available games (Halo 5, Halo 5: Forge, Halo Wars 2).
  • Query builders for all endpoints.
  • Request rate limiter.
  • Response caching.

Usage

  1. Create an instance of HaloClient. Provide your SubscriptionKey at a minimum, optionally include a RateLimit and CacheDuration(s).
  2. Call the StartSession method.
  3. Call the .Query<TResult>() method and pass in a prepackaged Query object.
Sample
var product = new Product
{
	SubscriptionKey = "00000000000000000000000000000000",
	RateLimit = new RateLimit
	{
		RequestCount = 200,
		TimeSpan = new TimeSpan(0, 0, 0, 10),
		Timeout = new TimeSpan(0, 0, 0, 10)
	}
};

var cacheSettings = new CacheSettings
{
	CacheDuration = new TimeSpan(0, 1, 0, 0)
};

var haloClient = new HaloClient(product, cacheSettings);

using (var session = haloClient.StartSession())
{
    var halo5MatchHistory = new Query.Halo5.Stats.GetMatchHistory("Furiousn00b");

    var halo5MatchSet = await session.Query(halo5MatchHistory);

    foreach (var result in halo5MatchSet.Results)
    {
        System.Console.WriteLine($"H5: MatchId: {result.Id.MatchId}");
    }
	
	var haloWars2MatchHistory = new Query.HaloWars2.Stats.GetMatchHistory("Furiousn00b");

    var haloWars2MatchSet = await session.Query(haloWars2MatchHistory);

    foreach (var result in haloWars2MatchSet.Results)
    {
        System.Console.WriteLine($"HW2: MatchId: {match.MatchId}");
    }
}

NuGet

A Nuget package is available at www.nuget.org/packages/HaloSharp

PM> Install-Package HaloSharp

Notes

  • The Halo® Game Data API is still in a Beta period. Breaking changes are to be expected.
  • Pull requests are welcome.
  • If you see something or think something could be done better, shout out. I'm all ears.
  • Review the HaloSharp.Test project for examples on each of the different endpoints and their usages.
  • You'll need to provide your own API Key to run the test suite. (Setup.cs)

About

This application is offered by Damon Pollard, which is solely responsible for its content. It is not sponsored or endorsed by Microsoft. This application uses the Halo® Game Data API. Halo © 2015 Microsoft Corporation. All rights reserved. Microsoft, Halo, and the Halo Logo are trademarks of the Microsoft group of companies.

halosharp's People

Contributors

ethanr avatar gitfurious avatar jacobsnyder 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.