Comments (11)
My initial prototype of this is here: https://github.com/paulirwin/harvest.net/tree/netcore-rewrite
This supports .NET Standard 2.0, GETs for the Clients and Companies Harvest v2 APIs so far, and uses Refit to remove the need for any implementation code for the APIs as that is all generated at runtime. Since Refit supports .NET Standard 1.4, we could support as far back as 1.4 with very little effort. Supporting .NET Standard means this library supports .NET Framework, .NET Core, UWP, Xamarin, and more. Since Refit is exclusively async, async support is the default and you can just call .Result
/.Wait()
to make them synchronous (in a context where that won't deadlock, of course). Also since Refit uses JSON.Net, we get easy serialization out of the box.
Example usage:
var harvest = new HarvestRestClient(myAccountId, myAccessToken);
var clients = await harvest.Clients.ListAllAsync();
Let me know your thoughts before I proceed further.
from harvest.net.
@paulirwin Looks pretty good. I'd be happy to use that as the jumping off point for 2.0 in this nuget.
from harvest.net.
It hasn't really come up yet. I'd welcome PRs.
from harvest.net.
I am looking into this and I think it's time for a radical rewrite of Harvest.Net to support API v2 and .NET Core (#63), due to RestSharp not supporting .NET Core. I have a prototype so far of what this could look like using Refit and I'm loving it. It is significantly less code (due to Refit creating the implementation for you) and will allow this project to move more nimbly.
Due to not using nearly any of the existing code, we can either create a new breaking-change version of Harvest.Net once this code is finished, or spin up a separate library (i.e. Harvest.NetCore) to avoid breaking any existing consumers of the library in either this or a separate repo. Thoughts?
from harvest.net.
I think a separate repo would be appropriate, especially if it's not gonna be backward compatible for the non-core users.
from harvest.net.
Alternatively, we could branch 1.0 into a permanent branch and continue maintenance and development there for existing users. This would maintain traction instead of fragmenting usage into multiple libs.
I'm not positive, but I think we could even use the same nuget.
from harvest.net.
@paulirwin Is it possible to show an implementation here? Just a simple console app that gets the token in the correct flow?
from harvest.net.
@kfrancis I don't have the OAuth-related bits hooked up yet but I will soon. However you can also use a Personal Access Token instead of an OAuth token in v2.
from harvest.net.
Props to @paulirwin.
There's no v2 API sample code (for any language I've seen) - it was a great starting point to get going from (we're just considering using Harvest for the first time, so using the deprecated v1 API made no sense).
Even better for our end, I was able to change the target framework to net45 and it just works. So far I have added Projects, ProjectTaskAssigment, Tasks, TimeEntries, and Users.
The weirdness though, is there API docs don't specify which fields are nullable. They also have strange/random partial dtos with different fields attached to other objects (e.g. TimeEntries has a bunch these). So there is an element of, fire it up, watch how it fails, tweak the settings.
Thanks again!
from harvest.net.
Any timeline on having this new version or branch or project released?
from harvest.net.
Just now finding this. Is this currently supporting V2?
from harvest.net.
Related Issues (20)
- .ListProjects() returning null HOT 2
- NuGet package is not signed HOT 3
- Async Support HOT 8
- Currency Updated HOT 1
- Currency field in Invoice HOT 10
- Update DailyOptions Model HOT 1
- Throw a HarvestException for any 4xx or 5xx HTTP status code HOT 2
- C# 6 support? HOT 2
- Getting Data in Postman, but not in c# Code HOT 8
- Add Resource methods to IHarvestRestClient to allow for Mocking of HarvestRestClient for testing. HOT 1
- AUD/USD Currency on getClients() HOT 4
- .net core support HOT 11
- .ListExpenses() returning empty list HOT 1
- .ListProjects() Returning null
- Creating payments using OAuth2 results in a 500 HOT 1
- Weekly Capacity not returned by ListUsers HOT 1
- Listing invoice with only "from" parameter returns incorrect results HOT 1
- project.ListTaskAssignments returns null
- .ListContacts returning null
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from harvest.net.