Skip to content

Commit

Permalink
Return a gmail_draft from draft() and use that object to send drafts.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimhester committed Jan 29, 2016
1 parent b2d0688 commit 8ae332d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/draft.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ draft <- function(id = ? is_string,
user_id = "me" ? is_string,
format = c("full", "minimal", "raw")) {
format <- match.arg(format)
gmailr_GET(c("drafts", id), user_id, query = list(format=format))
gmailr_GET(c("drafts", id), user_id, query = list(format=format), class = "gmail_draft")
}

#' Get a list of drafts
Expand Down Expand Up @@ -74,7 +74,7 @@ create_draft <- function(mail = ?~ as.character,
#' Subject="hello", "how are you doing?"))
#' send_draft(draft)
#' }
send_draft <- function(draft = ? has_class(x, "gmail_draft"),
send_draft <- function(draft = ? has_class(draft, "gmail_draft"),
user_id = "me" ? is_string) {
gmailr_POST(c("drafts", "send"), user_id, class = "gmail_draft",
body = draft,
Expand Down

0 comments on commit 8ae332d

Please sign in to comment.