/// <summary> /// Gets the specified draft. /// </summary> /// <param name="id">The ID of the draft to retrieve.</param> public async Task <Draft> GetAsync(string id) { string queryString = new DraftQueryStringBuilder() .SetRequestAction(DraftRequestAction.Get, id) .Build(); return(await _proxy.Get <Draft>(queryString)); }
/// <summary> /// Gets the specified label. /// </summary> /// <param name="id">The ID of the label to retrieve.</param> /// <returns></returns> public async Task <Label> GetAsync(string id) { string queryString = new LabelQueryStringBuilder() .SetRequestAction(LabelRequestAction.Get, id) .Build(); return(await _proxy.Get <Label>(queryString)); }
/// <summary> /// Gets the specified thread. /// </summary> /// <param name="id">The ID of the thread to retrieve.</param> /// <returns></returns> public async Task <MessageThread> GetAsync(string id) { string queryString = new ThreadQueryStringBuilder() .SetRequestAction(ThreadRequestAction.Get, id) .Build(); return(await _proxy.Get <MessageThread>(queryString)); }
/// <summary> /// Lists the message IDs. /// </summary> /// <param name="query">Only return messages matching the specified query. /// Supports the same query format as the Gmail search box. For example, "from:[email protected] rfc822msgid: is:unread".</param> /// <param name="maxResults">Maximum number of messages to return</param> /// <param name="includeSpamAndTrash">Include messages from SPAM and TRASH in the results.</param> /// <param name="labelIds">Only return messages with labels that match all of the specified label IDs</param> /// <returns>A <see cref="MessageList"/> containing the message IDs</returns> public async Task <MessageList> ListIdsAsync(string query = null, ushort maxResults = 0, bool includeSpamAndTrash = false, params string[] labelIds) { string queryString = new MessageQueryStringBuilder() .SetRequestAction(MessageRequestAction.List) .SetFields(MessageFields.Id | MessageFields.ResultSizeEstimate | MessageFields.NextPageToken) .SetQuery(query) .SetLabelIds(labelIds) .SetMaxResults(maxResults) .SetIncludeSpamAndTrash(includeSpamAndTrash) .Build(); return(await _proxy.Get <MessageList>(queryString)); }
/// <summary> /// Gets the specified message attachment. /// </summary> /// <param name="messageId">The ID of the message containing the attachment</param> /// <param name="id">The ID of the attachment</param> /// <returns></returns> public async Task <Attachment> GetAsync(string messageId, string id) { string queryString = new AttachmentQueryStringBuilder(messageId, id) .Build(); return(await _proxy.Get <Attachment>(queryString)); }
/// <summary> /// Gets the current user's Gmail profile. /// </summary> /// <returns></returns> public async Task <Profile> GetProfileAsync() { string queryString = new UserQueryStringBuilder() .Build(); return(await _proxy.Get <Profile>(queryString)); }
/// <summary> /// Lists the history of all changes to the given mailbox. History results are returned in chronological order (increasing historyId). /// </summary> /// <param name="startHistoryId">Returns history records after the specified startHistoryId</param> /// <param name="labelId">Only return messages with a label matching the ID</param> /// <param name="pageToken">Page token to retrieve a specific page of results in the list</param> /// <param name="maxResults">The maximum number of history records to return. Use zero ('0') to use the default.</param> /// <returns></returns> public async Task <HistoryList> ListAsync(ulong startHistoryId, string labelId = null, string pageToken = null, uint maxResults = 0) { string queryString = new HistoryQueryStringBuilder() .SetStartHistoryId(startHistoryId) .SetLabelId(labelId) .SetPageToken(pageToken) .SetMaxResults(maxResults) .Build(); return(await _proxy.Get <HistoryList>(queryString)); }