diff --git a/Clockify.Net/Clients/ClockifyExperimentalClient.cs b/Clockify.Net/Clients/ClockifyExperimentalClient.cs
deleted file mode 100644
index 324132f..0000000
--- a/Clockify.Net/Clients/ClockifyExperimentalClient.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Clockify.Net.Clients
-{
- internal class ClockifyExperimentalClient
- {
- }
-}
diff --git a/Clockify.Net/Clients/ClockifyReportsClient.cs b/Clockify.Net/Clients/ClockifyReportsClient.cs
deleted file mode 100644
index baf2995..0000000
--- a/Clockify.Net/Clients/ClockifyReportsClient.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Clockify.Net.Clients
-{
- internal class ClockifyReportsClient
- {
- }
-}
diff --git a/Clockify.Net/Clients/IClockifyClient.cs b/Clockify.Net/Clients/IClockifyClient.cs
deleted file mode 100644
index a220a94..0000000
--- a/Clockify.Net/Clients/IClockifyClient.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Clockify.Net.Clients;
-
-///
-/// The core Clockify client
-///
-public interface IClockifyClient
-{
- ///
- /// Access to Experimental features of the Clockify API
- ///
- public IClockifyExperimentalClient Experimental { get; }
-
- ///
- /// Access to Reporting features of the Clockify API
- ///
- public IClockifyReportsClient Reports { get; }
-}
diff --git a/Clockify.Net/Clients/IClockifyExperimentalClient.cs b/Clockify.Net/Clients/IClockifyExperimentalClient.cs
deleted file mode 100644
index 1a950ce..0000000
--- a/Clockify.Net/Clients/IClockifyExperimentalClient.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Clockify.Net.Clients;
-
-public interface IClockifyExperimentalClient
-{
-}
diff --git a/Clockify.Net/Clients/IClockifyReportsClient.cs b/Clockify.Net/Clients/IClockifyReportsClient.cs
deleted file mode 100644
index 74b7680..0000000
--- a/Clockify.Net/Clients/IClockifyReportsClient.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Clockify.Net.Clients;
-
-public interface IClockifyReportsClient
-{
-}
diff --git a/Clockify.Net/ClockifyClient.Projects.cs b/Clockify.Net/ClockifyClient.Projects.cs
index 99113cf..8fb62ee 100644
--- a/Clockify.Net/ClockifyClient.Projects.cs
+++ b/Clockify.Net/ClockifyClient.Projects.cs
@@ -87,7 +87,7 @@ public async Task DeleteProjectAsync(string workspaceId, string id)
public async Task FindProjectByIdAsync(string workspaceId, string id)
{
var request = new RestRequest($"workspaces/{workspaceId}/projects/{id}");
- return Response.FromRestResponse(await _experimentalClient.ExecuteAsync(request, Method.Get).ConfigureAwait(false));
+ return Response.FromRestResponse(await _client.ExecuteAsync(request, Method.Get).ConfigureAwait(false));
}
///
diff --git a/Clockify.Net/ClockifyClient.Reports.cs b/Clockify.Net/ClockifyClient.Reports.cs
index c909eec..99a4438 100644
--- a/Clockify.Net/ClockifyClient.Reports.cs
+++ b/Clockify.Net/ClockifyClient.Reports.cs
@@ -17,7 +17,7 @@ public async Task> GetDetailedReportAsync(string wor
var request = new RestRequest($"workspaces/{workspaceId}/reports/detailed", Method.Post);
request.AddJsonBody(detailedReportRequest);
- return Response.FromRestResponse(await _reportsClient.ExecutePostAsync(request).ConfigureAwait(false));
+ return Response.FromRestResponse(await _client.ExecutePostAsync(request).ConfigureAwait(false));
}
///
@@ -32,7 +32,7 @@ public async Task> GetSummaryReportAsync(string works
var request = new RestRequest($"workspaces/{workspaceId}/reports/summary", Method.Post);
request.AddJsonBody(summaryReportRequest);
- return Response.FromRestResponse(await _reportsClient.ExecuteAsync(request).ConfigureAwait(false));
+ return Response.FromRestResponse(await _client.ExecuteAsync(request).ConfigureAwait(false));
}
///
@@ -43,7 +43,7 @@ public async Task> GetWeeklyReportAsync(string workspa
var request = new RestRequest($"workspaces/{workspaceId}/reports/weekly", Method.Post);
request.AddJsonBody(weeklyReportRequest);
- return Response.FromRestResponse(await _reportsClient.ExecuteAsync(request, Method.Post).ConfigureAwait(false));
+ return Response.FromRestResponse(await _client.ExecuteAsync(request, Method.Post).ConfigureAwait(false));
}
}
}
diff --git a/Clockify.Net/ClockifyClient.TimeEntries.cs b/Clockify.Net/ClockifyClient.TimeEntries.cs
index 14ebbc8..904451c 100644
--- a/Clockify.Net/ClockifyClient.TimeEntries.cs
+++ b/Clockify.Net/ClockifyClient.TimeEntries.cs
@@ -251,7 +251,7 @@ public async Task>> FindAllTimeEntriesFor
// Find project
var requestProject = new RestRequest($"workspaces/{workspaceId}/projects/{projectId}");
var projectResponse =
- await _experimentalClient.ExecuteAsync(requestProject, Method.Get).ConfigureAwait(false);
+ await _client.ExecuteAsync(requestProject, Method.Get).ConfigureAwait(false);
var project = JsonConvert.DeserializeObject(projectResponse.Content);
diff --git a/Clockify.Net/ClockifyClient.Users.cs b/Clockify.Net/ClockifyClient.Users.cs
index 1fae657..8b876ff 100644
--- a/Clockify.Net/ClockifyClient.Users.cs
+++ b/Clockify.Net/ClockifyClient.Users.cs
@@ -45,7 +45,7 @@ public async Task> GetCurrentUserAsync(bool includeMemb
public async Task> SetActiveWorkspaceFor(string userId, string workspaceId)
{
var request = new RestRequest($"users/{userId}/activeWorkspace/{workspaceId}");
- return Response.FromRestResponse(await _experimentalClient.ExecutePostAsync(request).ConfigureAwait(false));
+ return Response.FromRestResponse(await _client.ExecutePostAsync(request).ConfigureAwait(false));
}
public async Task>> FilterWorkspaceUsers(string workspaceId, WorkspaceUsersRequest requestBody)
diff --git a/Clockify.Net/ClockifyClient.Workspaces.cs b/Clockify.Net/ClockifyClient.Workspaces.cs
index 715eff3..d783d07 100644
--- a/Clockify.Net/ClockifyClient.Workspaces.cs
+++ b/Clockify.Net/ClockifyClient.Workspaces.cs
@@ -35,7 +35,7 @@ public async Task> CreateWorkspaceAsync(WorkspaceRequest
public async Task DeleteWorkspaceAsync(string id)
{
var request = new RestRequest($"workspaces/{id}");
- return Response.FromRestResponse(await _experimentalClient.ExecuteAsync(request, Method.Delete).ConfigureAwait(false));
+ return Response.FromRestResponse(await _client.ExecuteAsync(request, Method.Delete).ConfigureAwait(false));
}
///
diff --git a/Clockify.Net/ClockifyClient.cs b/Clockify.Net/ClockifyClient.cs
index 7e807c8..f425e32 100644
--- a/Clockify.Net/ClockifyClient.cs
+++ b/Clockify.Net/ClockifyClient.cs
@@ -1,5 +1,4 @@
-using Clockify.Net.Clients;
-using Newtonsoft.Json;
+using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
using RestSharp;
@@ -8,23 +7,15 @@
using System.Collections.Generic;
namespace Clockify.Net;
-public partial class ClockifyClient : IClockifyClient {
+public partial class ClockifyClient
+{
private RestClient _client;
- private RestClient _experimentalClient;
- private RestClient _reportsClient;
-
public ClockifyClient(string apiKey,
- string apiUrl = Constants.ApiUrl,
- string experimentalApiUrl = Constants.ExperimentalApiUrl,
- string reportsApiUrl = Constants.ReportsApiUrl) {
- InitClients(apiKey, apiUrl, experimentalApiUrl, reportsApiUrl);
+ string apiUrl = Constants.ApiUrl) {
+ InitClients(apiKey, apiUrl);
}
- public IClockifyExperimentalClient Experimental => throw new NotImplementedException();
-
- public IClockifyReportsClient Reports => throw new NotImplementedException();
-
///
/// Creates new .
/// Uses value from environment variable named "CAPI_KEY"
@@ -32,7 +23,7 @@ public ClockifyClient(string apiKey,
#region Private methods
- private void InitClients(string apiKey, string apiUrl, string experimentalApiUrl, string reportsApi) {
+ private void InitClients(string apiKey, string apiUrl) {
var jsonSerializerSettings = new JsonSerializerSettings() {
NullValueHandling = NullValueHandling.Ignore,
@@ -46,13 +37,7 @@ private void InitClients(string apiKey, string apiUrl, string experimentalApiUrl
};
_client = new RestClient(apiUrl, configureSerialization: config => config.UseNewtonsoftJson(jsonSerializerSettings));
- _client.AddDefaultHeader(Constants.ApiKeyHeaderName, apiKey);
-
- _experimentalClient = new RestClient(experimentalApiUrl, configureSerialization: config => config.UseNewtonsoftJson(jsonSerializerSettings));
- _experimentalClient.AddDefaultHeader(Constants.ApiKeyHeaderName, apiKey);
-
- _reportsClient = new RestClient(reportsApi, configureSerialization: config => config.UseNewtonsoftJson(jsonSerializerSettings));
- _reportsClient.AddDefaultHeader(Constants.ApiKeyHeaderName, apiKey);
+ _client.AddDefaultHeader(Constants.ApiKeyHeaderName, apiKey);
}
#endregion
}
\ No newline at end of file
diff --git a/Clockify.Net/Extensions/ServiceCollectionExtensions.cs b/Clockify.Net/Extensions/ServiceCollectionExtensions.cs
index 62793f7..ef11c6f 100644
--- a/Clockify.Net/Extensions/ServiceCollectionExtensions.cs
+++ b/Clockify.Net/Extensions/ServiceCollectionExtensions.cs
@@ -1,7 +1,8 @@
using Clockify.Net;
-using Clockify.Net.Clients;
using Clockify.Net.Exceptions;
+
using Microsoft.Extensions.Configuration;
+
using System;
namespace Microsoft.Extensions.DependencyInjection;
@@ -30,27 +31,13 @@ public static IServiceCollection AddClockifyClient(this IServiceCollection servi
if (string.IsNullOrWhiteSpace(finalApiKey))
throw new InvalidClockifyConfigurationException($"Cannot a configuration value for the Environment Variable {Constants.ApiKeyVariableName} or the config key {Constants.ApiKeyConfigurationKey}");
+ services.AddTransient();
- services.AddTransient();
-
-
- services.AddHttpClient(Constants.ExperimentalClientName, httpClient =>
- {
- httpClient.BaseAddress = new Uri(Constants.ExperimentalApiUrl);
- httpClient.DefaultRequestHeaders.Add(Constants.ApiKeyHeaderName, finalApiKey);
- });
-
- services.AddHttpClient(Constants.ReportsClientName, httpClient =>
- {
- httpClient.BaseAddress = new Uri(Constants.ReportsApiUrl);
- httpClient.DefaultRequestHeaders.Add(Constants.ApiKeyHeaderName, finalApiKey);
- });
-
- services.AddHttpClient(Constants.ClockifyClientName, httpClient =>
- {
- httpClient.BaseAddress = new Uri(Constants.ApiUrl);
- httpClient.DefaultRequestHeaders.Add(Constants.ApiKeyHeaderName, finalApiKey);
- });
+ services.AddHttpClient(Constants.ClockifyClientName, httpClient =>
+ {
+ httpClient.BaseAddress = new Uri(Constants.ApiUrl);
+ httpClient.DefaultRequestHeaders.Add(Constants.ApiKeyHeaderName, finalApiKey);
+ });
return services;
}
diff --git a/Clockify.Tests/Clockify.Tests.csproj b/Clockify.Tests/Clockify.Tests.csproj
index 4259bef..7d46e60 100644
--- a/Clockify.Tests/Clockify.Tests.csproj
+++ b/Clockify.Tests/Clockify.Tests.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net10.0
false
false
false
@@ -9,10 +9,10 @@
-
-
-
-
+
+
+
+