Endjin.FreeAgent.Client.Extensions 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Endjin.FreeAgent.Client.Extensions --version 1.0.0
                    
NuGet\Install-Package Endjin.FreeAgent.Client.Extensions -Version 1.0.0
                    
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="Endjin.FreeAgent.Client.Extensions" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Endjin.FreeAgent.Client.Extensions" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Endjin.FreeAgent.Client.Extensions" />
                    
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 Endjin.FreeAgent.Client.Extensions --version 1.0.0
                    
#r "nuget: Endjin.FreeAgent.Client.Extensions, 1.0.0"
                    
#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.
#:package Endjin.FreeAgent.Client.Extensions@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Endjin.FreeAgent.Client.Extensions&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Endjin.FreeAgent.Client.Extensions&version=1.0.0
                    
Install as a Cake Tool

Endjin.FreeAgent.Client.Extensions

Extension methods and additional functionality for the Endjin.FreeAgent.Client library, providing enhanced features for working with the FreeAgent API.

Features

  • Extension Members - .NET 10 extension member support for FreeAgent client
  • Timesheets Module - Comprehensive timesheet management and aggregation
  • Project Extensions - Advanced project filtering and management
  • User Settings - User preference and settings management
  • Activity Summaries - Time tracking and activity reporting
  • Flexible Architecture - Extensible registry pattern for adding custom modules

Installation

Install via NuGet Package Manager:

dotnet add package Endjin.FreeAgent.Client.Extensions

Or via Package Manager Console:

Install-Package Endjin.FreeAgent.Client.Extensions

Quick Start

Timesheets Extension

The Timesheets extension provides comprehensive time tracking functionality:

using Endjin.FreeAgent.Client;
using Endjin.FreeAgent.Client.Extensions;
using Microsoft.Extensions.Caching.Memory;

// Initialize client with Timesheets extension
FreeAgentClient client = FreeAgentClient.CreateWithTimesheets(
    options,
    cache,
    httpClientFactory,
    loggerFactory);

// Or add to existing client
client.WithTimesheets(cache);

// Access timesheet functionality
IEnumerable<WeeklyTimesheet> weeklyTimesheets = await client.Timesheets.GetWeeklyTimesheetsAsync(
    DateOnly.FromDateTime(DateTime.Now.AddDays(-30)),
    DateOnly.FromDateTime(DateTime.Now));

// Get monthly summary
MonthlyTimesheet monthlyTimesheet = await client.Timesheets.GetMonthlyTimesheetAsync(
    DateTime.Now.Year,
    DateTime.Now.Month);

Project Extensions

Advanced project filtering and management:

using Endjin.FreeAgent.Client.Extensions;

// Configure project filtering
ProjectFilterOptions filterOptions = new()
{
    ExcludePreProjects = true,
    RequireContactEntry = true,
    RequireOrganizationName = true,
    ExcludeEndjinProjectsByDefault = true,
    IncludedEndjinProjectIds = new HashSet<string> { "123", "456" },
    ExcludedProjectIds = new HashSet<string> { "789" }
};

// Get filtered active projects
IEnumerable<Project> filteredProjects = await client.Projects.GetIncludedActiveAsync(filterOptions);

// Get project details with time tracking
Dictionary<Project, List<(string Customer, string Project, string User, DateTimeOffset Date,
    int Year, int WeekNumber, decimal Effort, decimal? DayRate, decimal? HourlyRate,
    string Level, decimal? Cost, string Comment)>> projectDetails =
    await client.Projects.GetActiveProjectsDetailsByDateRangeAsync(dateRange);

User Settings

Manage user preferences and settings:

using Endjin.FreeAgent.Client.Extensions;

// Initialize user settings service
UserSettingsService settingsService = new(cache);

// Get user settings
UserSettings? settings = await settingsService.GetUserSettingsAsync("user123");

// Update settings
UserSettings newSettings = new()
{
    UserId = "user123",
    DefaultProjectId = "project456",
    DefaultTaskId = "task789",
    PreferredTimeFormat = "24h",
    WeekStartDay = DayOfWeek.Monday
};

await settingsService.SaveUserSettingsAsync(newSettings);

Extension Registry

The extension registry pattern allows for modular functionality:

// Check if extensions are available
if (client.HasTimesheets)
{
    Timesheets timesheets = client.Timesheets;
    // Use timesheet functionality
}

// Register custom extensions
ExtensionRegistry registry = new();
registry.Register("CustomModule", new CustomModule());

// Access registered extensions
CustomModule? custom = registry.Get<CustomModule>("CustomModule");

Advanced Features

Activity Summaries

Aggregate time tracking data:

// Get user activity summary
UserActivitySummary summary = await client.Timesheets.GetUserActivitySummaryAsync(
    "user123",
    DateOnly.FromDateTime(DateTime.Now.AddMonths(-1)),
    DateOnly.FromDateTime(DateTime.Now));

// Get project summaries
ProjectsSummary projectsSummary = await client.Projects.GetProjectsSummaryAsync(dateRange);

Weekly and Monthly Aggregations

// Weekly timesheets with detailed entries
IEnumerable<WeeklyTimesheet> weeklyData = await client.Timesheets.GetWeeklyTimesheetsAsync(
    startDate,
    endDate);

foreach (WeeklyTimesheet week in weeklyData)
{
    Console.WriteLine($"Week {week.WeekNumber}: {week.TotalHours} hours");
    foreach (TimeSheetActivityEntry entry in week.Entries)
    {
        Console.WriteLine($"  {entry.ProjectName}: {entry.Hours}h");
    }
}

// Monthly aggregation
MonthlyTimesheet monthly = await client.Timesheets.GetMonthlyTimesheetAsync(2024, 9);
Console.WriteLine($"September 2024: {monthly.TotalHours} hours, {monthly.BillableHours} billable");

Filtering and Queries

// Complex project queries
IEnumerable<Project> projects = await client.Projects.GetIncludedActiveAsync(
    new ProjectFilterOptions
    {
        ExcludePreProjects = true,
        RequireContactEntry = true,
        MinimumBudget = 10000m,
        Currency = "GBP",
        Status = "Active"
    });

// Time-based filtering
IEnumerable<Timeslip> recentWork = await client.Timesheets.GetTimeslipsByDateRangeAsync(
    DateOnly.FromDateTime(DateTime.Now.AddDays(-7)),
    DateOnly.FromDateTime(DateTime.Now),
    userId: "user123",
    projectId: "project456");

Extension Members (C# 14)

This library leverages .NET 10's extension members feature for cleaner API design:

// Extension members provide direct access to extended functionality
client.Timesheets.GetWeeklyTimesheetsAsync(...);  // Direct member access
client.Projects.GetIncludedActiveAsync(...);       // Enhanced project methods

Requirements

  • .NET 10.0 or later
  • Endjin.FreeAgent.Client
  • Endjin.FreeAgent.Domain

License

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

Support

For support, please contact Endjin Limited or raise an issue on our GitHub repository.


Copyright (c) Endjin Limited. All rights reserved.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
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.5 313 11/21/2025
1.0.4 238 11/16/2025
1.0.3 233 11/16/2025
1.0.2 231 11/16/2025
1.0.1 169 11/15/2025
1.0.0 290 11/13/2025
1.0.0-preview.2 145 9/23/2025