예제 #1
0
        /// <summary>
        /// Returns the news story with its content.
        /// </summary>
        /// <param name="newsId">The unique id of the news.</param>
        public async Task <News> GetStoryContentAsync(int newsId)
        {
            var news = await WAPI.GetAsync <IEnumerable <News> >(_session,
                                                                 _role.Slug + "/news/index_json/" + newsId).ConfigureAwait(false);

            return(news.First());
        }
예제 #2
0
        /// <summary>
        /// Retrieves the message contents by the unique message identifier.
        /// </summary>
        /// <param name="messageId">The message identifier.</param>
        /// <returns>The message contents.</returns>
        public async Task <Message> GetMessageContentAsync(int messageId)
        {
            var messages = await WAPI.GetAsync <IEnumerable <Message> >(_session,
                                                                        _role.Slug + "/messages/" + messageId).ConfigureAwait(false);

            return(messages.First());
        }
예제 #3
0
        /// <summary>
        /// Retrieves all the messages from the specified folder.
        /// </summary>
        /// <param name="folder">The folder to retrieve messages from, by default <see cref="MessageFolder.Inbox"/>.</param>
        /// <returns>The message records.</returns>
        public Task <IEnumerable <MessageRecord> > GetMessagesAsync(MessageFolder folder = MessageFolder.Inbox)
        {
            string path = "/messages/index_json";

            if (folder != MessageFolder.Inbox)
            {
                path += $"/{folder}";
            }

            return(WAPI.GetAsync <IEnumerable <MessageRecord> >(_session, _role.Slug + path));
        }
예제 #4
0
        public Task <IEnumerable <Observation> > GetLessonNotesAsync(DateTime?date = default)
        {
            string path = "/attendance/index_json";

            if (date is not null)
            {
                path += "?date={date:d.M.yyyy}";
            }

            return(WAPI.GetAsync <IEnumerable <Observation> >(_session, _role.Slug + path));
        }
예제 #5
0
 public Task <RecipientResponse> GetAllRecipientsAsync()
 {
     return(WAPI.GetAsync <RecipientResponse>(_session, _role.Slug + "/messages/recipients"));
 }
예제 #6
0
 /// <summary>
 /// Lists all the news stories available.
 /// </summary>
 public Task <IEnumerable <NewsRecord> > GetStoriesAsync()
 {
     return(WAPI.GetAsync <IEnumerable <NewsRecord> >(_session, _role.Slug + "/news/index_json"));
 }
예제 #7
0
        private async Task <string> GetSessionIdAsync()
        {
            var response = await WAPI.GetAsync <IndexResponse>(_context, "/index_json").ConfigureAwait(false);

            return(response.SessionID);
        }
예제 #8
0
 public Task <IEnumerable <Group> > GetFutureGroupsAsync()
 => WAPI.GetAsync <IEnumerable <Group> >(_session, _role.Slug + "/groups/index_json/future");
예제 #9
0
 public Task <IEnumerable <Group> > GetPastGroupsAsync()
 => WAPI.GetAsync <IEnumerable <Group> >(_session, _role.Slug + "/groups/index_json/past");
예제 #10
0
 public Task <IEnumerable <Exam> > GetExamsAsync()
 => WAPI.GetAsync <IEnumerable <Exam> >(_session, _role.Slug + "/exams/index_json");