protected virtual Task <string> GetJsonMenuEntriesAsync(string feedId, DateTime dayDate, CancellationToken cancellationToken) { var webClient = new NativeHttpClient(this.httpClientConfiguration); webClient .AssignAgent(this.device) .AssignAcceptTypeJson() .AssignAuthToken(this.serviceApi.Menu); return(webClient.GetStringAsync(string.Format(this.serviceApi.MenuUri, feedId, dayDate), cancellationToken)); }
protected virtual Task <string> GetJsonFeedsAsync(CancellationToken cancellationToken) { var webClient = new NativeHttpClient(this.httpClientConfiguration); webClient .AssignAgent(this.device) .AssignAcceptTypeJson() .AssignAuthToken(this.serviceApi.Menu); return(webClient.GetStringAsync(this.serviceApi.MenuFeedsUri, cancellationToken)); }
protected virtual async Task <string> GetBalanceJsonAsync(CancellationToken cancellationToken) { var webClient = new NativeHttpClient(this.httpClientConfiguration); webClient .AssignAgent(this.device) .AssignBearerToken(await this.oAuth.BearerTokenAsync()) .AssignAcceptTypeJson(); return(await webClient.GetStringAsync(this.serviceApi.AccountApiUri, cancellationToken)); }
/// <summary> /// Returns the raw JSON data from the NewsFeed-Service /// </summary> /// <param name="feed">Name of the feed</param> /// <param name="before">Maximum date of the newest entry which will be returned</param> /// <param name="cancellationToken">Token which can be used to cancel the process</param> /// <returns>JSON-String with the news entries</returns> protected virtual Task <string> GetJsonNewsEntriesAsync(SqlNewsFeed feed, DateTime before, CancellationToken cancellationToken) { var webClient = new NativeHttpClient(this.httpClientConfiguration); webClient .AssignAgent(this.device) .AssignAcceptTypeJson() .AssignAuthToken(this.serviceApi.News); return(webClient.GetStringAsync(string.Format(this.serviceApi.NewsUri, feed.Key, before), cancellationToken)); }
protected virtual async Task <string> GetDirectoryListingJsonAsync(FilerViewModel.FilerArgs args, CancellationToken cancellationToken) { var webClient = new NativeHttpClient(this.httpClientConfiguration); webClient .AssignAgent(this.device) .AssignAcceptTypeJson() .AssignBearerToken(await this.oAuth.BearerTokenAsync()); return(await webClient.GetStringAsync(this.serviceApi.FilerApiUriBase + args.CurrentDirectory, cancellationToken)); }
public async Task <IEnumerable <WhTimeperiod> > GetTimeperiodsAsync(string identity, CancellationToken cancellationToken) { var webClient = new NativeHttpClient(this.httpClientConfiguration); webClient .AssignAgent(this.device) .AssignAcceptTypeJson() .AssignBearerToken(await this.oAuth.BearerTokenAsync()); var response = await webClient.GetStringAsync(string.Format(this.serviceApi.TimeperiodUri, identity), cancellationToken); return(cancellationToken.IsCancellationRequested ? null : response.CreateFromJsonString <IEnumerable <WhTimeperiod> >()); }
public virtual async Task <MapOverview> GetHashesAsync(CancellationToken cancellationToken) { var webClient = new NativeHttpClient(this.httpClientConfiguration); webClient .AssignAgent(this.device) .AssignAcceptTypeJson() .AssignAuthToken(this.serviceApi.Map); var response = await webClient.GetStringAsync(this.serviceApi.BuildingsUri, cancellationToken); return(response.CreateFromJsonString <MapOverview>()); }
public async Task <IEnumerable <WhAdunisCourse> > GetCourseDataAsync(string identity, int termId, AdunisType type, CancellationToken cancellationToken) { var requestUrlTemplate = type == AdunisType.Timetable ? this.serviceApi.TimetableUri : this.serviceApi.ExamUri; var requestUrl = string.Format(requestUrlTemplate, identity, termId); var webClient = new NativeHttpClient(this.httpClientConfiguration); webClient .AssignAgent(this.device) .AssignAcceptTypeJson() .AssignBearerToken(await this.oAuth.BearerTokenAsync()); var response = await webClient.GetStringAsync(requestUrl, cancellationToken); if (cancellationToken.IsCancellationRequested) { return(null); } var holder = response.CreateFromJsonString <Holder>(); return(holder?.Courses); }