{"action":"created","comment":{"url":"https://api.github.com/repos/tidyverse/googledrive/pulls/comments/116367979","pull_request_review_id":37988436,"id":116367979,"diff_hunk":"@@ -0,0 +1,206 @@\n+#' List files on Google Drive\n+#'\n+#' @param path character, path where the Google drive files are\n+#'   that you would like to list. Defaults to the \"My Drive\" directory.\n+#' @param pattern character, regular expression of titles of\n+#'   documents to output in a tibble.\n+#' @param ... name-value pairs to query the API\n+#' @param verbose logical, indicating whether to print informative messages\n+#'   (default `TRUE`)\n+#'\n+#'   This will default to the most recent 100 files on your Google Drive. If you\n+#'   would like more than 100, include the `pageSize` parameter. For example, if\n+#'   I wanted 200, I would run `drive_ls(pageSize = 200)`.\n+\n+#' Helpful links for forming queries:\n+#'   * <https://developers.google.com/drive/v3/web/search-parameters>\n+#'   * <https://developers.google.com/drive/v3/reference/files/list>\n+\n+#' @return tibble containing the name, type, and id of files on your google\n+#'   drive (default 100 files)\n+#' @examples\n+#' \\dontrun{\n+#' ## list user's Google Sheets\n+#' drive_list(q = \"mimeType='application/vnd.google-apps.spreadsheet'\")\n+#' }\n+#'\n+#' @export\n+drive_list <- function(path = NULL, pattern = NULL, ..., verbose = TRUE){\n+\n+  folder <- NULL\n+  if (!is.null(path)) {\n+    folder <- get_leafmost_id(path = path)\n+  }\n+  x <- list(...)\n+\n+  #add default fields if null\n+  if (is.null(x$fields)) {\n+    x$fields <- paste0(\"files/\", .drive$default_fields, collapse = \",\")\n+  }\n+\n+  #add folder if not null\n+  if (!is.null(folder)){\n+    q <- paste0(\"'\", folder, \"'\", \" in parents\")\n+    if (!is.null(x$q)){\n+      x$q <- paste(x$q, \"and\", q)\n+    } else {\n+      x$q <- q\n+    }\n+  }\n+\n+\n+\n+\n+  request <- build_request(endpoint = .drive$base_url_files_v3,\n+                           token = drive_token(),\n+                           params = x)\n+  response <- make_request(request)\n+  proc_res <- process_request(response)\n+  req_tbl <- tibble::tibble(\n+    name = purrr::map_chr(proc_res$files, \"name\"),\n+    type = sub(\".*\\\\.\", \"\", purrr::map_chr(proc_res$files, \"mimeType\")),\n+    folder_id = purrr::map_chr(\n+      purrr::map(\n+        proc_res$files,\n+        \"parents\",\n+        .null = NA\n+      ),\n+      1),","path":"R/drive_list.R","position":68,"original_position":68,"commit_id":"118ce6ae213a2f43441c990680bb5061b3194fd6","original_commit_id":"118ce6ae213a2f43441c990680bb5061b3194fd6","user":{"login":"jennybc","id":599454,"avatar_url":"https://avatars0.githubusercontent.com/u/599454?v=3","gravatar_id":"","url":"https://api.github.com/users/jennybc","html_url":"https://github.com/jennybc","followers_url":"https://api.github.com/users/jennybc/followers","following_url":"https://api.github.com/users/jennybc/following{/other_user}","gists_url":"https://api.github.com/users/jennybc/gists{/gist_id}","starred_url":"https://api.github.com/users/jennybc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jennybc/subscriptions","organizations_url":"https://api.github.com/users/jennybc/orgs","repos_url":"https://api.github.com/users/jennybc/repos","events_url":"https://api.github.com/users/jennybc/events{/privacy}","received_events_url":"https://api.github.com/users/jennybc/received_events","type":"User","site_admin":false},"body":"I don't understand the rationale for renaming `parents` to `folder_id`.","created_at":"2017-05-13T21:56:47Z","updated_at":"2017-05-13T21:56:47Z","html_url":"https://github.com/tidyverse/googledrive/pull/13#discussion_r116367979","pull_request_url":"https://api.github.com/repos/tidyverse/googledrive/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/tidyverse/googledrive/pulls/comments/116367979"},"html":{"href":"https://github.com/tidyverse/googledrive/pull/13#discussion_r116367979"},"pull_request":{"href":"https://api.github.com/repos/tidyverse/googledrive/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/tidyverse/googledrive/pulls/13","id":120250172,"html_url":"https://github.com/tidyverse/googledrive/pull/13","diff_url":"https://github.com/tidyverse/googledrive/pull/13.diff","patch_url":"https://github.com/tidyverse/googledrive/pull/13.patch","issue_url":"https://api.github.com/repos/tidyverse/googledrive/issues/13","number":13,"state":"open","locked":false,"title":"attempt at updating `drive_ls`","user":{"login":"LucyMcGowan","id":8431897,"avatar_url":"https://avatars3.githubusercontent.com/u/8431897?v=3","gravatar_id":"","url":"https://api.github.com/users/LucyMcGowan","html_url":"https://github.com/LucyMcGowan","followers_url":"https://api.github.com/users/LucyMcGowan/followers","following_url":"https://api.github.com/users/LucyMcGowan/following{/other_user}","gists_url":"https://api.github.com/users/LucyMcGowan/gists{/gist_id}","starred_url":"https://api.github.com/users/LucyMcGowan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LucyMcGowan/subscriptions","organizations_url":"https://api.github.com/users/LucyMcGowan/orgs","repos_url":"https://api.github.com/users/LucyMcGowan/repos","events_url":"https://api.github.com/users/LucyMcGowan/events{/privacy}","received_events_url":"https://api.github.com/users/LucyMcGowan/received_events","type":"User","site_admin":false},"body":"I've updated `drive_ls()` to look more like `list.files`\r\n* a small demo is shown [here](https://github.com/tidyverse/googledrive/blob/drive_list/internal/07_drive_ls_demo.md).\r\n","created_at":"2017-05-12T05:16:01Z","updated_at":"2017-05-13T21:56:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2feeb5925a0db628801410b1c2968ecbc8852b21","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/tidyverse/googledrive/pulls/13/commits","review_comments_url":"https://api.github.com/repos/tidyverse/googledrive/pulls/13/comments","review_comment_url":"https://api.github.com/repos/tidyverse/googledrive/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tidyverse/googledrive/issues/13/comments","statuses_url":"https://api.github.com/repos/tidyverse/googledrive/statuses/118ce6ae213a2f43441c990680bb5061b3194fd6","head":{"label":"tidyverse:drive_list","ref":"drive_list","sha":"118ce6ae213a2f43441c990680bb5061b3194fd6","user":{"login":"tidyverse","id":22032646,"avatar_url":"https://avatars1.githubusercontent.com/u/22032646?v=3","gravatar_id":"","url":"https://api.github.com/users/tidyverse","html_url":"https://github.com/tidyverse","followers_url":"https://api.github.com/users/tidyverse/followers","following_url":"https://api.github.com/users/tidyverse/following{/other_user}","gists_url":"https://api.github.com/users/tidyverse/gists{/gist_id}","starred_url":"https://api.github.com/users/tidyverse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tidyverse/subscriptions","organizations_url":"https://api.github.com/users/tidyverse/orgs","repos_url":"https://api.github.com/users/tidyverse/repos","events_url":"https://api.github.com/users/tidyverse/events{/privacy}","received_events_url":"https://api.github.com/users/tidyverse/received_events","type":"Organization","site_admin":false},"repo":{"id":89535184,"name":"googledrive","full_name":"tidyverse/googledrive","owner":{"login":"tidyverse","id":22032646,"avatar_url":"https://avatars1.githubusercontent.com/u/22032646?v=3","gravatar_id":"","url":"https://api.github.com/users/tidyverse","html_url":"https://github.com/tidyverse","followers_url":"https://api.github.com/users/tidyverse/followers","following_url":"https://api.github.com/users/tidyverse/following{/other_user}","gists_url":"https://api.github.com/users/tidyverse/gists{/gist_id}","starred_url":"https://api.github.com/users/tidyverse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tidyverse/subscriptions","organizations_url":"https://api.github.com/users/tidyverse/orgs","repos_url":"https://api.github.com/users/tidyverse/repos","events_url":"https://api.github.com/users/tidyverse/events{/privacy}","received_events_url":"https://api.github.com/users/tidyverse/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tidyverse/googledrive","description":"Google Drive R API","fork":false,"url":"https://api.github.com/repos/tidyverse/googledrive","forks_url":"https://api.github.com/repos/tidyverse/googledrive/forks","keys_url":"https://api.github.com/repos/tidyverse/googledrive/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tidyverse/googledrive/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tidyverse/googledrive/teams","hooks_url":"https://api.github.com/repos/tidyverse/googledrive/hooks","issue_events_url":"https://api.github.com/repos/tidyverse/googledrive/issues/events{/number}","events_url":"https://api.github.com/repos/tidyverse/googledrive/events","assignees_url":"https://api.github.com/repos/tidyverse/googledrive/assignees{/user}","branches_url":"https://api.github.com/repos/tidyverse/googledrive/branches{/branch}","tags_url":"https://api.github.com/repos/tidyverse/googledrive/tags","blobs_url":"https://api.github.com/repos/tidyverse/googledrive/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tidyverse/googledrive/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tidyverse/googledrive/git/refs{/sha}","trees_url":"https://api.github.com/repos/tidyverse/googledrive/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tidyverse/googledrive/statuses/{sha}","languages_url":"https://api.github.com/repos/tidyverse/googledrive/languages","stargazers_url":"https://api.github.com/repos/tidyverse/googledrive/stargazers","contributors_url":"https://api.github.com/repos/tidyverse/googledrive/contributors","subscribers_url":"https://api.github.com/repos/tidyverse/googledrive/subscribers","subscription_url":"https://api.github.com/repos/tidyverse/googledrive/subscription","commits_url":"https://api.github.com/repos/tidyverse/googledrive/commits{/sha}","git_commits_url":"https://api.github.com/repos/tidyverse/googledrive/git/commits{/sha}","comments_url":"https://api.github.com/repos/tidyverse/googledrive/comments{/number}","issue_comment_url":"https://api.github.com/repos/tidyverse/googledrive/issues/comments{/number}","contents_url":"https://api.github.com/repos/tidyverse/googledrive/contents/{+path}","compare_url":"https://api.github.com/repos/tidyverse/googledrive/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tidyverse/googledrive/merges","archive_url":"https://api.github.com/repos/tidyverse/googledrive/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tidyverse/googledrive/downloads","issues_url":"https://api.github.com/repos/tidyverse/googledrive/issues{/number}","pulls_url":"https://api.github.com/repos/tidyverse/googledrive/pulls{/number}","milestones_url":"https://api.github.com/repos/tidyverse/googledrive/milestones{/number}","notifications_url":"https://api.github.com/repos/tidyverse/googledrive/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tidyverse/googledrive/labels{/name}","releases_url":"https://api.github.com/repos/tidyverse/googledrive/releases{/id}","deployments_url":"https://api.github.com/repos/tidyverse/googledrive/deployments","created_at":"2017-04-26T23:22:32Z","updated_at":"2017-05-13T18:47:09Z","pushed_at":"2017-05-13T21:50:49Z","git_url":"git://github.com/tidyverse/googledrive.git","ssh_url":"git@github.com:tidyverse/googledrive.git","clone_url":"https://github.com/tidyverse/googledrive.git","svn_url":"https://github.com/tidyverse/googledrive","homepage":"","size":544,"stargazers_count":28,"watchers_count":28,"language":"R","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":28,"default_branch":"master"}},"base":{"label":"tidyverse:master","ref":"master","sha":"2b537977ea5f152d7f5652a8c53b4b3217ca3054","user":{"login":"tidyverse","id":22032646,"avatar_url":"https://avatars1.githubusercontent.com/u/22032646?v=3","gravatar_id":"","url":"https://api.github.com/users/tidyverse","html_url":"https://github.com/tidyverse","followers_url":"https://api.github.com/users/tidyverse/followers","following_url":"https://api.github.com/users/tidyverse/following{/other_user}","gists_url":"https://api.github.com/users/tidyverse/gists{/gist_id}","starred_url":"https://api.github.com/users/tidyverse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tidyverse/subscriptions","organizations_url":"https://api.github.com/users/tidyverse/orgs","repos_url":"https://api.github.com/users/tidyverse/repos","events_url":"https://api.github.com/users/tidyverse/events{/privacy}","received_events_url":"https://api.github.com/users/tidyverse/received_events","type":"Organization","site_admin":false},"repo":{"id":89535184,"name":"googledrive","full_name":"tidyverse/googledrive","owner":{"login":"tidyverse","id":22032646,"avatar_url":"https://avatars1.githubusercontent.com/u/22032646?v=3","gravatar_id":"","url":"https://api.github.com/users/tidyverse","html_url":"https://github.com/tidyverse","followers_url":"https://api.github.com/users/tidyverse/followers","following_url":"https://api.github.com/users/tidyverse/following{/other_user}","gists_url":"https://api.github.com/users/tidyverse/gists{/gist_id}","starred_url":"https://api.github.com/users/tidyverse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tidyverse/subscriptions","organizations_url":"https://api.github.com/users/tidyverse/orgs","repos_url":"https://api.github.com/users/tidyverse/repos","events_url":"https://api.github.com/users/tidyverse/events{/privacy}","received_events_url":"https://api.github.com/users/tidyverse/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tidyverse/googledrive","description":"Google Drive R API","fork":false,"url":"https://api.github.com/repos/tidyverse/googledrive","forks_url":"https://api.github.com/repos/tidyverse/googledrive/forks","keys_url":"https://api.github.com/repos/tidyverse/googledrive/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tidyverse/googledrive/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tidyverse/googledrive/teams","hooks_url":"https://api.github.com/repos/tidyverse/googledrive/hooks","issue_events_url":"https://api.github.com/repos/tidyverse/googledrive/issues/events{/number}","events_url":"https://api.github.com/repos/tidyverse/googledrive/events","assignees_url":"https://api.github.com/repos/tidyverse/googledrive/assignees{/user}","branches_url":"https://api.github.com/repos/tidyverse/googledrive/branches{/branch}","tags_url":"https://api.github.com/repos/tidyverse/googledrive/tags","blobs_url":"https://api.github.com/repos/tidyverse/googledrive/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tidyverse/googledrive/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tidyverse/googledrive/git/refs{/sha}","trees_url":"https://api.github.com/repos/tidyverse/googledrive/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tidyverse/googledrive/statuses/{sha}","languages_url":"https://api.github.com/repos/tidyverse/googledrive/languages","stargazers_url":"https://api.github.com/repos/tidyverse/googledrive/stargazers","contributors_url":"https://api.github.com/repos/tidyverse/googledrive/contributors","subscribers_url":"https://api.github.com/repos/tidyverse/googledrive/subscribers","subscription_url":"https://api.github.com/repos/tidyverse/googledrive/subscription","commits_url":"https://api.github.com/repos/tidyverse/googledrive/commits{/sha}","git_commits_url":"https://api.github.com/repos/tidyverse/googledrive/git/commits{/sha}","comments_url":"https://api.github.com/repos/tidyverse/googledrive/comments{/number}","issue_comment_url":"https://api.github.com/repos/tidyverse/googledrive/issues/comments{/number}","contents_url":"https://api.github.com/repos/tidyverse/googledrive/contents/{+path}","compare_url":"https://api.github.com/repos/tidyverse/googledrive/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tidyverse/googledrive/merges","archive_url":"https://api.github.com/repos/tidyverse/googledrive/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tidyverse/googledrive/downloads","issues_url":"https://api.github.com/repos/tidyverse/googledrive/issues{/number}","pulls_url":"https://api.github.com/repos/tidyverse/googledrive/pulls{/number}","milestones_url":"https://api.github.com/repos/tidyverse/googledrive/milestones{/number}","notifications_url":"https://api.github.com/repos/tidyverse/googledrive/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tidyverse/googledrive/labels{/name}","releases_url":"https://api.github.com/repos/tidyverse/googledrive/releases{/id}","deployments_url":"https://api.github.com/repos/tidyverse/googledrive/deployments","created_at":"2017-04-26T23:22:32Z","updated_at":"2017-05-13T18:47:09Z","pushed_at":"2017-05-13T21:50:49Z","git_url":"git://github.com/tidyverse/googledrive.git","ssh_url":"git@github.com:tidyverse/googledrive.git","clone_url":"https://github.com/tidyverse/googledrive.git","svn_url":"https://github.com/tidyverse/googledrive","homepage":"","size":544,"stargazers_count":28,"watchers_count":28,"language":"R","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":28,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tidyverse/googledrive/pulls/13"},"html":{"href":"https://github.com/tidyverse/googledrive/pull/13"},"issue":{"href":"https://api.github.com/repos/tidyverse/googledrive/issues/13"},"comments":{"href":"https://api.github.com/repos/tidyverse/googledrive/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/tidyverse/googledrive/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/tidyverse/googledrive/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tidyverse/googledrive/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/tidyverse/googledrive/statuses/118ce6ae213a2f43441c990680bb5061b3194fd6"}}}}
{"actor":{"display_login":"jennybc"}}