/Harvest.Api

.Net client for Harvest API Version 2

Primary LanguageC#Apache License 2.0Apache-2.0

zv MyGet Build Status NuGet

Harvest.Api

A .Net client for the Harvest API v2.

Installation

This library is hosted as a nuget package.

To install Harvest.Net, run the following command in the Package Manager Console

PM> Install-Package Harvest.Api

Usage

Create a client object:

var client = HarvestClient.FromAccessToken("user_agent", "access_token");

Call API methods

var projects = await client.GetProjectAssignmentsAsync();

Use authorization helper for OAuth2 Authorization

var client = new HarvestClient("HavestApiClient")
{
    ClientId = "<ClientId>",
    ClientSecret = "<ClientSecret>",
    RedirectUri = new Uri("http://redirect/url"),
};

var authUrl = auth.BuildAuthorizationUrl();

// open url via web browser component for WPF, Windows Forms application or redirect to this url for asp.net application

// you can use helper to parse redirect url 
var client = await client.AuthorizeAsync(callbackUri);

// OR for existing accessToken/personal access token

client.Authorize(accessToken);

// OR

var client = HarvestClient.FromAccessToken("HavestApiClient", accessToken);

Current State

Library contains all API I needed. Everything else will be added someday. Pull requests are welcome.