AcManager.Tools.Helpers.Api.Rsr.RsrApiProvider.GetEventInformationAsync C# (CSharp) Method

GetEventInformationAsync() private method

private GetEventInformationAsync ( int eventId, CancellationToken cancellation = default(CancellationToken) ) : Task
eventId int
cancellation System.Threading.CancellationToken
return Task
        public static async Task<RsrEventInformation> GetEventInformationAsync(int eventId, CancellationToken cancellation = default(CancellationToken)) {
            try {
                using (var client = new WebClient { Headers = {
                    [HttpRequestHeader.UserAgent] = "Assetto Corsa Launcher",
                    ["X-User-Agent"] = CmApiProvider.UserAgent
                } }) {
                    var result = await client.DownloadDataTaskAsync(GetUrl(eventId));
                    if (cancellation.IsCancellationRequested) return null;



                    return null;
                }
            } catch (Exception e) {
                if (!cancellation.IsCancellationRequested) {
                    Logging.Warning($"Cannot get {eventId}: " + e);
                }

                return null;
            }
        }
    }