ClockifyClient 1.0.1

dotnet add package ClockifyClient --version 1.0.1
                    
NuGet\Install-Package ClockifyClient -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ClockifyClient" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ClockifyClient" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="ClockifyClient" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ClockifyClient --version 1.0.1
                    
#r "nuget: ClockifyClient, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=ClockifyClient&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=ClockifyClient&version=1.0.1
                    
Install as a Cake Tool

Clockify Client

This project provides a strongly-typed C# client for interacting with the Clockify time tracking API. The client is automatically generated from Clockify's OpenAPI specification using Microsoft Kiota, ensuring type safety and up-to-date API coverage.

Prerequisites

Installation

Get the ClockifyClient package from NuGet:

dotnet add package ClockifyClient

Usage

using ClockifyClient;

// Initialize the client with your API key
var client = ClockifyApiClientFactory.Create("your-api-key-here");

// Get user information
var user = await client.User.GetAsync();
Console.WriteLine($"Hello, {user.Name}!");

// Get workspaces
var workspaces = await client.Workspaces.GetAsync();
foreach (var workspace in workspaces)
{
    Console.WriteLine($"Workspace: {workspace.Name}");
}

// Get active times for the active workspace
var timeEntries = await client.V1.Workspaces[user.ActiveWorkspace].TimeEntries.Status.InProgress.GetAsync();

Error Handling

The client provides structured error handling:

try
{
    var user = await client.User.GetAsync();
}
catch (ApiException ex)
{
    Console.WriteLine($"API Error: {ex.ResponseStatusCode} - {ex.Message}");
}
catch (HttpRequestException ex)
{
    Console.WriteLine($"Network Error: {ex.Message}");
}

Development

Generating the Client

The client is generated using Microsoft Kiota. To regenerate the client:

# Install Kiota CLI
dotnet tool install --global Microsoft.OpenApi.Kiota

# Download the latest OpenAPI specification
curl -o clockify-openapi.json https://docs.clockify.me/openapi.json

# Apply modifications, see below

# Generate the client from OpenAPI spec
kiota generate --language CSharp --openapi clockify-openapi.json --class-name ClockifyApiClient --namespace-name ClockifyClient --output ClockifyClient --structured-mime-types application/json

Modifications

The OpenAPI specification provided by Clockify doesn't work out of the box with Kiota and requires some modifications.

Fixing Enum Types

Replace the following part of the specification

"adminOnlyPages": { "type": "string", "description": "Represents a unique list of protected page enums.", "example": "[\"PROJECT\",\"TEAM\",\"REPORTS\"]", "enum": ["PROJECT", "TEAM", "REPORTS"] },

with this part instead

"adminOnlyPages": { 
    "type": "array", 
    "description": "Represents a unique list of protected page enums.", 
    "items": {
        "type": "string",
        "enum": ["PROJECT", "TEAM", "REPORTS"]
    },
    "example": "[\"PROJECT\", \"TEAM\", \"REPORTS\"]"
},
Fixing Media Types

Replace occurrences of */* with application/json. Except for the file / export endpoints that use byte as format, namely:

  • /v1/workspaces/{workspaceId}/expenses/{expenseId}/files/{fileId}
  • /v1/workspaces/{workspaceId}/invoices/{invoiceId}/export

For example, like this:

"responses": { "200": { "content": { "*/*": { "schema": { "$ref": "#/components/schemas/TimeEntrySummaryReportDto" } } }, "description": "OK" } },
"responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TimeEntrySummaryReportDto" } } }, "description": "OK" } },

License

This project is licensed under the MIT License - see the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 43 7/6/2025