示例#1
0
        public async Task <TimelinesResource> GetTimelinesAsync(CancellationToken cancellationToken)
        {
            HomeResource home = await GetHomeAsync(cancellationToken);

            string timelinesUrl = home == null ? null : home.Links.Url(Relations.Timelines);

            if (timelinesUrl != null)
            {
                return(await SendAsync <TimelinesResource>(timelinesUrl, HttpMethod.Get, null, cancellationToken));
            }
            return(null);
        }
示例#2
0
        public async Task <TagCombinationListResource> PostTagCombinationsAsync(TagCombinationListResource tagCombinationList, CancellationToken cancellationToken)
        {
            HomeResource home = await GetHomeAsync(cancellationToken);

            string tagCombinationListUrl = home == null ? null : home.Links.Url(Relations.TagCombinationList);

            if (tagCombinationListUrl == null)
            {
                return(null);
            }
            return(await SendAsync <TagCombinationListResource>(tagCombinationListUrl, HttpMethod.Post, tagCombinationList, cancellationToken));
        }
示例#3
0
        public async Task <TimelineResource> PublishTimeline(TimelineResource timeline, CancellationToken cancellationToken)
        {
            HomeResource home = await GetHomeAsync(cancellationToken);

            string timelinesUrl = home == null ? null : home.Links.Url(Relations.Timelines);

            if (timelinesUrl == null)
            {
                throw new InvalidOperationException("Cannot publish timeline. Timelines url not found.");
            }

            return(await SendAsync <TimelineResource>(timelinesUrl, HttpMethod.Post, timeline, cancellationToken));
        }
示例#4
0
 public HomeController(HomeResource homeResource)
 {
     this.homeResource = homeResource;
 }
示例#5
0
 public HomeHandler(HomeResource home)
 {
     this.home = home;
 }