Recently, a new version of the Teamwork .Net SDK was released and I’d like to give you a few examples on how this can be used to make development for Teamwork Projects a lot easier when working with .Net.
To begin with, we need to add the library. As its currently still listed as pre-release in nuget we need to add the IncludePreRelease param:
install-package Teamwork -IncludePrerelease
As of writing this theres a .net core and .net 4.6+ version available.
Once we have the library loaded we need to get an authentication token to be used with the api and also the base url for the installation. This part can only be partly done with the SDK.
Getting an Access Token to be used with the client
You need to understand how Teamwork’s App Loginflow is working. Once you have that configured and and ready to receive the callback from the loginflow the SDK offers a handy function to make parsing the callback and fetching the actual access token a lot easier:
The instance of the Teamwork API client is everything you need to start working with the API and actual data.
We can also add or modify all items in Teamwork Projects. This can be done in a similarly easy way to fetching data. Lets just have a look at how we would add a new task. To add a task we need to have a projectid and optionally a tasklist, both can be retreived from the example calls above.
These are pretty much the basics of what you can do with the SDK, however theres a lot more and its constantly updated so always worth to update when a new version comes out.
A few more examples:
The SDK is available on Github: https://github.com/Teamwork/dotnet .
If you want to add something or request a change or even if you just have an issue, feel free to add things on Github. The developers always answer fast and love to help.