Skip to content

Commit

Permalink
Additional condition added to CheckConnectionAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
VaclavElias committed Mar 31, 2022
1 parent f54b57f commit 209fdb4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions src/Bullhorn/Api/BullhornApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using CodeCapital.System.Text.Json;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.Security.Authentication;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
Expand Down Expand Up @@ -51,7 +50,7 @@ public async Task CheckConnectionAsync()
throw new NullReferenceException($"{nameof(BullhornSettings)}, Set the {nameof(BullhornSettings)} parameter before connecting!");
}

if (_session.LoginResponse != null) return;
if (_session.LoginResponse != null || _session.IsValid) return;

//BullhornApi.SetAuthorizationMeta(_bullhornSettings);

Expand Down Expand Up @@ -150,7 +149,7 @@ public async Task<QueryResponse<T>> ApiQueryAsync<T>(string query, int count, in
return await DeserializeAsync<QueryResponse<T>>(response);
}

//ToDo
//ToDo
//public async Task<SearchResponse<JObject>> ApiSearchAsync(string query, int count, int start = 0) => await ApiSearchAsync<JObject>(query, count, start);

public async Task<SearchResponse<T>> ApiSearchAsync<T>(string query, int count, int start = 0)
Expand Down Expand Up @@ -242,7 +241,7 @@ public async Task MassUpdateAsync<T>(string entityName, T updateDto) => await Ap

public async Task DeleteAsync(int id, string entityName) => await ApiDeleteAsync($"entity/{entityName}/{id}?");

//ToDo
//ToDo
//public List<T> MapResults<T>(IEnumerable<JObject> data)
//{
// var objects = data.Select(s => s.ToObject<T>()).ToList();
Expand Down Expand Up @@ -316,8 +315,8 @@ private async Task PingCheckAsync()

if (!_session.IsValid)
{
_logger.LogError("Not logged in yet.");
throw new AuthenticationException("Not logged in yet.");
_logger.LogError("{0}, Not logged in yet.", nameof(PingCheckAsync));
//throw new AuthenticationException("Not logged in yet.");
}

if (_session.Ping?.Valid ?? false) return;
Expand Down
2 changes: 1 addition & 1 deletion src/Bullhorn/Bullhorn.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFrameworks>net6.0</TargetFrameworks>
<Nullable>enable</Nullable>
<Version>6.0.0</Version>
<Version>6.0.0.1</Version>
<ImplicitUsings>enable</ImplicitUsings>
<Description>.NET Core Bullhorn REST API integration.</Description>
<PackageTags>aspnetcore,bullhorn</PackageTags>
Expand Down

0 comments on commit 209fdb4

Please sign in to comment.