https://github.com/abjerner/skybrud.social.toggl
.NET API wrapper and implementation of the Toggl Track API.
https://github.com/abjerner/skybrud.social.toggl
api api-client api-wrapper csharp dotnet limbo package skybrud skybrud-integrations skybrud-social social toggl toggl-track toggl-track-api toogl-api
Last synced: 25 days ago
JSON representation
.NET API wrapper and implementation of the Toggl Track API.
- Host: GitHub
- URL: https://github.com/abjerner/skybrud.social.toggl
- Owner: abjerner
- License: mit
- Created: 2019-07-23T19:13:17.000Z (almost 7 years ago)
- Default Branch: v1/main
- Last Pushed: 2025-04-03T08:17:16.000Z (about 1 year ago)
- Last Synced: 2025-07-22T07:32:56.084Z (11 months ago)
- Topics: api, api-client, api-wrapper, csharp, dotnet, limbo, package, skybrud, skybrud-integrations, skybrud-social, social, toggl, toggl-track, toggl-track-api, toogl-api
- Language: C#
- Homepage: https://social.skybrud.dk/toggl/
- Size: 3.8 MB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Skybrud.Social.Toggl
[](https://github.com/abjerner/Skybrud.Social.Toggl/blob/v1/main/LICENSE.md)
[](https://www.nuget.org/packages/Skybrud.Social.Toggl)
[](https://www.nuget.org/packages/Skybrud.Social.Toggl)
[](https://packages.limbo.works/skybrud.social.toggl/)
.NET API wrapper and implementation of the [**Toggl Track API**](https://developers.track.toggl.com/docs/).
License:
MIT License
Target Framework:
.NET 4.5, .NET 4.6, .NET 4.7, .NET Standard 2.0 and .NET8
## Installation
The package is only available via [**NuGet**](https://www.nuget.org/packages/Skybrud.Social.Toggl/1.0.0-beta011). To install the package, you can either use the .NET CLI:
```
dotnet add package Skybrud.Social.Toggl --version 1.0.0-beta011
```
or the NuGet Package Manager:
```
Install-Package Skybrud.Social.Toggl -Version 1.0.0-beta011
```
## Examples
### Initialize a new HTTP service
The `TogglHttpService` class is the entry point for communicating with the Toggl Track API:
```cshtml
@using Skybrud.Social.Toggl
@{
// Initialize from your API token
TogglHttpService toggl = TogglHttpService.CreateFromApiToken("Your API token");
}
```
### List all clients
```cshtml
@using Skybrud.Social.Toggl
@using Skybrud.Social.Toggl.Exceptions
@using Skybrud.Essentials.Json
@using Newtonsoft.Json.Linq
@using Skybrud.Social.Toggl.Responses.Track.Clients
@inherits UmbracoViewPage
@{
// Declare your workspace ID
int workspaceId = 1234;
// Initialize from your API token
TogglHttpService toggl = TogglHttpService.CreateFromApiToken("Your API token");
try {
// Make the request to the API
TogglClientListResponse response = toggl.Track.Clients.GetClients(workspaceId);
ID
Name
@foreach (TogglClient client in response.Body) {
@client.Id
@client.Name
}
} catch (TogglHttpException ex) {
@ex.Response.StatusCode @ex.Response.ResponseUri
@(JsonUtils.TryParseJsonToken(ex.Response.Body, out JToken token) ? token : ex.Response.Body)
}
}
```
### List all projects
Projects are fetched via the **Projects** endpoint, and you must specify the ID of the workspace to retrieve projects for:
```cshtml
@using Skybrud.Social.Toggl
@using Skybrud.Social.Toggl.Exceptions
@using Skybrud.Essentials.Json
@using Newtonsoft.Json.Linq
@using Skybrud.Social.Toggl.Models.Track.Projects
@using Skybrud.Social.Toggl.Options.Track.Projects
@using Skybrud.Social.Toggl.Responses.Track.Projects
@inherits UmbracoViewPage
@{
// Declare your workspace ID
int workspaceId = 1234;
// Initialize from your API token
TogglHttpService toggl = TogglHttpService.CreateFromApiToken("Your API token");
try {
// Make the request to the API
TogglProjectListResponse response = toggl.Track.Workspaces.GetProjects(workspaceId);
ID
Name
ClientID
HEX
@foreach (TogglProject project in response.Body) {
@project.Id
@project.Name
@project.ClientId
@project.HexColor
}
} catch (TogglHttpException ex) {
@ex.Response.StatusCode @ex.Response.ResponseUri
@(JsonUtils.TryParseJsonToken(ex.Response.Body, out JToken token) ? token : ex.Response.Body)
}
}
```