Skip to content

Commit

Permalink
feat(toggl): 🐛 use reports api base url
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesNZL committed May 15, 2023
1 parent 8e4d33c commit 4c78d72
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Toggl/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,18 @@ public class TogglClient
private readonly static string _baseUrl = "https://api.track.toggl.com/api/v9/";
private readonly static string _reportsUrl = "https://api.track.toggl.com/reports/api/v3/";
private readonly AuthenticatedFetch _api;
private readonly AuthenticatedFetch _reportsApi;

public TogglClient(string token)
{
this._api = new AuthenticatedFetch(token, TogglClient._baseUrl);
this._reportsApi = new AuthenticatedFetch(token, TogglClient._reportsUrl);
}

public void UpdateToken(string token)
{
this._api.UpdateToken(token);
this._reportsApi.UpdateToken(token);
}

/*
Expand Down Expand Up @@ -121,7 +124,7 @@ public void UpdateToken(string token)

public async Task<List<SummaryProjectReport>?> GetSummaryProjectReports(long workspaceId, DateTimeOffset start, DateTimeOffset? end)
{
return await this._api.Post<List<SummaryProjectReport>>($"workspace/{workspaceId}/projects/summary", new
return await this._reportsApi.Post<List<SummaryProjectReport>>($"workspace/{workspaceId}/projects/summary", new
{
start_date = start.ToString("yyyy-MM-dd"),
end_date = end?.ToString("yyyy-MM-dd"),
Expand Down

0 comments on commit 4c78d72

Please sign in to comment.