public Response <EmptyResponse> SendNotification( TxSessionCredentials credentials, string bracketId, string matchId, SendNotificationRequest request) { return(bracketClient.SendNotification(credentials, bracketId, matchId, request)); }
public Response <EmptyResponse> UpdateMatch( TxSessionCredentials credentials, string bracketId, UpdateMatchRequest request) { return(bracketClient.UpdateMatch(credentials, bracketId, request)); }
public Response <GetTournamentsResponse> GetTournaments(TxSessionCredentials userCredentials) { RequestPreconditions.CheckNotNull(userCredentials, "userCredentials"); Response <GetTournamentsResponse> response = tournamentClient.GetTournaments(userCredentials); RequestPreconditions.CheckNotNull(response.Payload?.Tournaments, "tournaments"); //response.Payload.Tournaments = FilterUserTournaments(userCredentials, response.Payload.Tournaments, userCredentials.Tournaments); return(response); }
public Response <GetTournamentIdsResponse> GetUserTournaments(TxSessionCredentials credentials) { var response = client.PostAsync($"user/temporaryOrganizer/{credentials.UserId}/tournaments", null).Result; if (response.IsSuccessStatusCode) { return(Newtonsoft.Json.JsonConvert.DeserializeObject <Response <GetTournamentIdsResponse> >(response.Content.ReadAsStringAsync().Result)); } return(new Response <GetTournamentIdsResponse>(response.RequestMessage.ToString(), (int)response.StatusCode)); }
private List <string> GetUserTournaments(TxSessionCredentials user) { if (user.IsAdmin) { return(null); } Response <GetTournamentIdsResponse> response = orgClient.GetTemporaryOrganizerTournaments(user); return(response.Payload?.Tournaments); }
public Response <GetTournamentIdsResponse> GetTemporaryOrganizerTournaments(TxSessionCredentials credentials) { client.DefaultRequestHeaders.Add("UserId", credentials.UserId); var response = client.PostAsync(TEMPORARY_ORGANIZER_GET_TOURNAMENTS, null).Result; if (response.IsSuccessStatusCode) { return(Newtonsoft.Json.JsonConvert.DeserializeObject <Response <GetTournamentIdsResponse> >(response.Content.ReadAsStringAsync().Result)); } return(new Response <GetTournamentIdsResponse>(response.RequestMessage.ToString(), (int)response.StatusCode)); }
public Response <GetAccessTokenResponse> GenerateTemporaryOrganizer(TxSessionCredentials credentials, GenerateTemporaryOrganizerRequest request) { client.DefaultRequestHeaders.Add("SessionId", credentials.SessionId); var response = client.PostAsync(TEMPORARY_ORGANIZER, RequestSerializer.Content(request)).Result; if (response.IsSuccessStatusCode) { return(Newtonsoft.Json.JsonConvert.DeserializeObject <Response <GetAccessTokenResponse> >(response.Content.ReadAsStringAsync().Result)); } return(new Response <GetAccessTokenResponse>(response.RequestMessage.ToString(), (int)response.StatusCode)); }
public Response <GetTournamentsResponse> GetTournaments(TxSessionCredentials credentials) { client.DefaultRequestHeaders.Add("UserId", credentials.UserId); client.DefaultRequestHeaders.Add("SessionId", credentials.SessionId); var response = client.GetAsync($"tournament/all").Result; if (response.IsSuccessStatusCode) { return(Newtonsoft.Json.JsonConvert.DeserializeObject <Response <GetTournamentsResponse> >(response.Content.ReadAsStringAsync().Result)); } return(new Response <GetTournamentsResponse>(response.RequestMessage.ToString(), (int)response.StatusCode)); }
public Response <EmptyResponse> UpdatePlayer(TxSessionCredentials credentials, PlayerRequest request) { client.DefaultRequestHeaders.Add("UserId", credentials.UserId); client.DefaultRequestHeaders.Add("SessionId", credentials.SessionId); var response = client.PostAsync($"players/{request.Id}/notifications", RequestSerializer.Content(request)).Result; if (response.IsSuccessStatusCode) { return(Newtonsoft.Json.JsonConvert.DeserializeObject <Response <EmptyResponse> >(response.Content.ReadAsStringAsync().Result)); } return(new Response <EmptyResponse>(response.RequestMessage.ToString(), (int)response.StatusCode)); }
public Response <EmptyResponse> SendNotification(TxSessionCredentials credentials, string bracketId, string matchId, SendNotificationRequest request) { client.DefaultRequestHeaders.Add("UserId", credentials.UserId); client.DefaultRequestHeaders.Add("SessionId", credentials.SessionId); var response = client.PostAsync($"bracket/{bracketId}/match/{matchId}/notification", RequestSerializer.Content(request)).Result; if (response.IsSuccessStatusCode) { return(Newtonsoft.Json.JsonConvert.DeserializeObject <Response <EmptyResponse> >(response.Content.ReadAsStringAsync().Result)); } return(new Response <EmptyResponse>(response.RequestMessage.ToString(), (int)response.StatusCode)); }
public Response <EmptyResponse> DeletePlayer(TxSessionCredentials credentials, string tournamentId, int seed) { client.DefaultRequestHeaders.Add("UserId", credentials.UserId); client.DefaultRequestHeaders.Add("SessionId", credentials.SessionId); var response = client.DeleteAsync($"tournament/{tournamentId}/player/{seed}").Result; if (response.IsSuccessStatusCode) { return(Newtonsoft.Json.JsonConvert.DeserializeObject <Response <EmptyResponse> >(response.Content.ReadAsStringAsync().Result)); } return(new Response <EmptyResponse>(response.RequestMessage.ToString(), (int)response.StatusCode)); }
//private List<string> GetUserTournaments(TxSessionCredentials user) //{ // if (user.IsAdmin) return null; // Response<GetTournamentIdsResponse> response = tournamentClient.GetTournamentIds(user); // return response.Payload == null ? null : response.Payload.Tournaments; //} private List <Tournament> FilterUserTournaments(TxSessionCredentials user, IEnumerable <Tournament> tournaments, List <string> userTournaments) { if (userTournaments == null) { return((List <Tournament>)tournaments); } List <Tournament> filteredTournaments = new List <Tournament>(); foreach (var tournament in tournaments) { if (userTournaments.IndexOf(tournament.TournamentId) > -1) { filteredTournaments.Add(tournament); } } return(filteredTournaments); }
public Response <EmptyResponse> DeletePlayer(TxSessionCredentials credentials, string tournamentId, int seed) { return(tournamentClient.DeletePlayer(credentials, tournamentId, seed)); }
public Response <EmptyResponse> AddPlayer(TxSessionCredentials credentials, string tournamentId, PlayerRequest request) { return(tournamentClient.AddPlayer(credentials, tournamentId, request)); }
public Response <EmptyResponse> SwapPlayers(TxSessionCredentials credentials, string tournamentId, string index1, string index2) { return(tournamentClient.SwapPlayers(credentials, tournamentId, index1, index2)); }
public MockRequestFieldExtractor(TxSessionCredentials credentials) { ExtractTomUserSessionCredentialsData = credentials; }
public Response <EmptyResponse> ResetTournament(TxSessionCredentials userCredentials, string tournamentId) { RequestPreconditions.CheckNotNull(userCredentials, "userCredentials"); return(tournamentClient.ResetTournament(userCredentials, tournamentId)); }
public Response <EmptyResponse> UpdatePlayer(TxSessionCredentials credentials, PlayerRequest request) { return(playerClient.UpdatePlayer(credentials, request)); }
public Response <GetAccessTokenResponse> GetAccessToken(TxSessionCredentials credentials, GenerateTemporaryOrganizerRequest request) { return(orgClient.GenerateTemporaryOrganizer(credentials, request)); }
public void StoreTomUserSessionCredentials <T>(T obj) { ExtractTomUserSessionCredentialsData = obj as TxSessionCredentials; }
public void SetCredentials(TxSessionCredentials credentials) { SessionCredentials = credentials; }
public void ClearTomUserSessionCredentials() { ExtractTomUserSessionCredentialsData = null; }