Blitz.CSharp: A Nuget package for Blitz.io

Since the Blitz folks lacked a C# library to interact with their API, I took the task upon myself. I've spun up a Github repository for it as well as a Nuget package.

To take it for a test drive, create a new project, run "Install-Package Blitz.CSharp" from the Package Manager console, and paste the following code:

Code Snippet
  1. using System;
  2. using Blitz.CSharp;
  3.  
  4. namespace Blitz.Console
  5. {
  6.     public class Program
  7.     {
  8.         private const string apiKey = "xxx-xxx-xxx-xxx";
  9.         private const string userName = "jon.doe@foo.com";
  10.         const string url = "http://foo.com";
  11.  
  12.         private static void Main()
  13.         {
  14.             var sprintRequest = new SprintBuilder()
  15.                 .FromRegion("virginia")
  16.                 .WithStep(url)
  17.                 .AsSprintRequest();
  18.  
  19.             var rushRequest = new RushBuilder()
  20.                 .FromRegion("oregon")
  21.                 .WithStep(url)
  22.                 .WithInterval(1, 10, TimeSpan.FromSeconds(10))
  23.                 .WithInterval(10, 250, TimeSpan.FromSeconds(50))
  24.                 .AsRushRequest();
  25.  
  26.             var sprint = new Sprint(userName, apiKey);
  27.             sprint.SprintStatusChanged += (s, sprintStatus) =>
  28.             {
  29.                 System.Console.Out.WriteLine(sprintStatus.status);
  30.             };
  31.             sprint.Execute(sprintRequest);
  32.  
  33.             var rush = new Rush(userName, apiKey);
  34.             rush.RushStatusChanged += (r, rushStatus) =>
  35.             {
  36.                 System.Console.Out.WriteLine(rushStatus.status);
  37.             };
  38.             rush.Execute(rushRequest);
  39.         }
  40.  
  41.     }
  42. }

Feedback warmly welcomed.

 

Discuss this post

You're in Easy Mode. If you prefer, you can use XHTML Mode instead.
As a new user, you may notice a few temporary content restrictions. Click here for more info.