AppHarbor.NET

Created: 2012-03-21 15:59
Updated: 2018-03-14 21:57
License: apache-2.0
c#

README.markdown

AppHarbor SDK - A .NET client for the AppHarbor API

License: Apache License 2.0

Twitter

Features

  • Full support for the AppHarbor API
  • Managed API Access (currently .NET 3.5, send a pull request if you want .NET 2.0 support)
  • Implements AppHarbor OAuth header: Authorization: BEARER :access_token
  • Sample web application with AppHarbor OAuth sample
  • Unit tested

Current uses

Usage

Create Api Client instance

// create an Api Client instance with the token obtained from oAuth
var appHarborClient = new AppHarborClient(new AuthInfo("token obtained via oAuth"));

Get list of AppHarbor applications

// get a list of all applications
var applications = appHarborClient.GetApplications();

foreach (var application in applications)
{
	Console.WriteLine(string.Format("Application name: {0}, Url: {1}", 
		application.Name, application.Url));
}

Create new AppHarbor application

// creating always returns a CreateResult
// which has a Status, ID, Location
var createResult = appHarborClient.CreateApplication("New Application Name", null);

// based on the Status decide on what todo
switch (createResult.Status)
{
	case CreateStatus.Created:
		{
			var newID = createResult.ID;
			var newURL = createResult.Location;

			// get actual application object via the api client
			var newApplication = appHarborClient.GetApplication(newID);

			// more code
			break;
		}
	case CreateStatus.AlreadyExists:
	case CreateStatus.Undefined:
		{
			// handle
			break;
		}
	default:
		break;
}

Sample web application project

  • Basic OAuth Access Token retrieval implementation

Todo

  • More unit tests
  • Add integration tests
  • Add XML Comments for public methods
  • Expand sample web application
Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more