Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delete_message fails due to NULL response #79

Closed
josibake opened this issue May 12, 2017 · 0 comments

Comments

@josibake
Copy link
Contributor

commented May 12, 2017

Per the google API documentation regarding DELETE:

If successful, this method returns an empty response body.

This causes gmail_query to fail, as it is expecting a non-empty response

Example


use_secret_file("email-automation.json")

msgs <- messages(label_ids = "Label_14")
local_path <- "."

for (ids in msgs[[1]]$messages) {
  id <- ids$id
  msg <- message(id)
  save_attachments(msg, path = local_path)
  delete_message(id)
}

Error
Error in class(result) <- class : attempt to set an attribute on NULL

josibake added a commit to josibake/gmailr that referenced this issue May 12, 2017

add null check to gmail_query
check for null value in result. this keeps gmailr_DELETE from failing. closes r-lib#79

jimhester added a commit that referenced this issue May 12, 2017

add null check to gmail_query (#80)
* add null check to gmail_query

check for null value in result. this keeps gmailr_DELETE from failing. closes #79

* use && vs &

per the R docs: The longer form is appropriate for programming control-flow and typically preferred in if clauses.

* update news

add note for minor bug fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.