/// <summary> /// Retrieves the <see cref="PolygonProblemInfo" /> of the problem. /// </summary> /// <param name="ct">Cancellation token.</param> /// <exception cref="PolygonFailedRequestException"> /// When the request fails, containing as the message the reason for the request to fail. /// </exception> public async Task <PolygonProblemInfo> GetInfo(CancellationToken ct = default) { const string methodName = "problem.info"; var parameters = DefaultParameters(); return(await _client.RequestAsync <PolygonProblemInfo>(methodName, parameters, ct)); }
/// <summary> /// Returns a list of problems, available to the user, according to search parameters. /// </summary> /// <param name="showDeleted">Whether to show deleted problems (defaults to false).</param> /// <param name="problemId">Problem id.</param> /// <param name="problemName">Problem name. Ignored if it is null or only whitespaces.</param> /// <param name="problemOwner">Problem owner login. Ignored if it is null or only whitespaces.</param> /// <param name="ct">Cancellation token used in the request.</param> /// <returns>A list of problems, available to the user, according to search parameters.</returns> /// <exception cref="PolygonFailedRequestException"> /// When the request fails, containing as the message the reason for the request to fail. /// </exception> public async Task <List <PolygonProblem> > GetAllAvailable(bool?showDeleted = null, long?problemId = null, string problemName = null, string problemOwner = null, CancellationToken ct = default) { const string methodName = "problems.list"; var parameters = new Dictionary <string, string>(); if (problemId.HasValue) { parameters.Add("id", problemId.ToString()); } if (showDeleted.HasValue) { parameters.Add("showDeleted", showDeleted.ToString()); } if (!string.IsNullOrWhiteSpace(problemName)) { parameters.Add("name", problemName); } if (!string.IsNullOrWhiteSpace(problemOwner)) { parameters.Add("owner", problemOwner); } return(await _client.RequestAsync <List <PolygonProblem> >(methodName, parameters, ct)); }
/// <summary> /// Returns a list of <see cref="PolygonProblem" /> with information about the problems of the contest. /// </summary> /// <param name="ct">Cancellation token.</param> /// <exception cref="PolygonFailedRequestException"> /// When the request fails, containing as the message the reason for the request to fail. /// </exception> public async Task <List <PolygonProblem> > GetProblems(CancellationToken ct = default) { const string methodName = "contest.problems"; var parameters = DefaultParameters(); return(await _client.RequestAsync <List <PolygonProblem> >(methodName, parameters, ct)); }