public IActionResult SetExpectingConnection([FromBody] AuthIntent intent) { if (intent == null !) { return(BadRequest(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.AUTH_INCORRECT))); } SessionFactory.Instance.ReadyForAuth.AddOrUpdate(intent.AccountName, intent.SessionId, (key, oldValue) => intent.SessionId); return(Ok()); }
public async Task SetAwaitingConnectionAsync(long sessionId, string accountName) { var client = await ConnectAsync().ConfigureAwait(false); if (client == null) { return; } var intent = new AuthIntent() { SessionId = -1, AccountName = accountName, }; using var content = new StringContent(JsonSerializer.Serialize(intent), Encoding.Default, "application/json"); await client.PostAsync(new Uri($"{client.BaseAddress}{ApiUrl}"), content).ConfigureAwait(false); }