Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update RestSharp and fix Client ctor #92

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Clockify.Net/Clockify.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
<PackageReference Include="RestSharp" Version="110.2.0" />
<PackageReference Include="RestSharp.Serializers.NewtonsoftJson" Version="110.2.0" />
<PackageReference Include="RestSharp" Version="112.1.0" />
<PackageReference Include="RestSharp.Serializers.NewtonsoftJson" Version="112.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
30 changes: 21 additions & 9 deletions Clockify.Net/ClockifyClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,29 @@ private void InitClients(string apiKey, string apiUrl, string experimentalApiUrl
ContractResolver = new CamelCasePropertyNamesContractResolver(),
};

_client = new RestClient(apiUrl, configureSerialization: config => config.UseNewtonsoftJson(jsonSerializerSettings));
_client.AddDefaultHeader(Constants.ApiKeyHeaderName, apiKey);
_client =
new RestClient(
new Uri(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);
_experimentalClient =
new RestClient(
new Uri(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);

_ptoClient = new RestClient(ptoApi, configureSerialization: config => config.UseNewtonsoftJson(jsonSerializerSettings));
_ptoClient.AddDefaultHeader(Constants.ApiKeyHeaderName, apiKey);
_reportsClient =
new RestClient(
new Uri(reportsApi),
configureSerialization: config => config.UseNewtonsoftJson(jsonSerializerSettings));
_reportsClient.AddDefaultHeader(Constants.ApiKeyHeaderName, apiKey);

_ptoClient =
new RestClient(
new Uri(ptoApi),
configureSerialization: config => config.UseNewtonsoftJson(jsonSerializerSettings));
_ptoClient.AddDefaultHeader(Constants.ApiKeyHeaderName, apiKey);
}
#endregion
}
Loading