Giter VIP home page Giter VIP logo

Comments (11)

paulirwin avatar paulirwin commented on July 18, 2024 1

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.

ithielnor avatar ithielnor commented on July 18, 2024 1

@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.

ithielnor avatar ithielnor commented on July 18, 2024

It hasn't really come up yet. I'd welcome PRs.

from harvest.net.

paulirwin avatar paulirwin commented on July 18, 2024

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.

ithielnor avatar ithielnor commented on July 18, 2024

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.

ithielnor avatar ithielnor commented on July 18, 2024

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.

kfrancis avatar kfrancis commented on July 18, 2024

@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.

paulirwin avatar paulirwin commented on July 18, 2024

@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.

OpenSpacesAndPlaces avatar OpenSpacesAndPlaces commented on July 18, 2024

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.

 avatar commented on July 18, 2024

Any timeline on having this new version or branch or project released?

from harvest.net.

ronnoc536 avatar ronnoc536 commented on July 18, 2024

Just now finding this. Is this currently supporting V2?

from harvest.net.

Related Issues (20)

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.