Graphrt

Google Drive

Cari (query di-escape) dan tampilkan file, ekspor dan unduh ke folder, unggah, folder, salin, ganti nama dan pindah, shared drive. Berbagi, trash dan hapus hanya lewat node (OAuth atau service account)

Beta v0.1.0 Node.js 17 aksi
Pakai di Graphrt Desktop

Tentang

Plugin Graphrt untuk Google Drive API v3. Tampilkan dan cari file, baca metadata, ekspor file Google dan unduh file yang tersimpan ke folder, unggah, buat folder, salin (misalnya template), ganti nama dan pindahkan, baca pengaturan berbagi, dan (hanya lewat node) bagikan, pindahkan ke trash dan hapus. Shared drive termasuk.

Yang bisa dilakukan

  • Find: search_files (name words, content words, type, folder, modified after an RFC 3339 date-time, trashed files excluded), list_files (raw q), get_file, get_about, list_drives
  • Content: export_file (Google Docs/Sheets/Slides to PDF, DOCX, CSV, ..., Drive caps exports at 10 MB), download_file (stored files, up to 200 MB), both saved into $GOOGLE_DRIVE_DOWNLOAD_DIR and returning {path, bytes, content_type}
  • Write: upload_file (up to 5 MB, optional conversion to a Google file), create_folder, copy_file, update_file (rename, describe, star, move with add/remove parents)
  • Sharing: list_permissions, share_file and remove_permission (node only)
  • Remove: trash_file and delete_file (node only)
  • api_request: any other endpoint (GET only for agents)

Aksi

Setiap aksi adalah langkah yang bisa ditambahkan ke workflow. Agent juga bisa memakai sebagian besar aksi sebagai tool.

  • Account and quota google-drive.get_about
  • List files google-drive.list_files
  • Search files google-drive.search_files
  • Get file google-drive.get_file
  • Export Google file google-drive.export_file
  • Download file google-drive.download_file
  • List sharing google-drive.list_permissions
  • Shared drives google-drive.list_drives
  • Create folder google-drive.create_folder
  • Copy file google-drive.copy_file
Tampilkan semua 17 aksi
  • Rename or move google-drive.update_file
  • Share file google-drive.share_file
  • Unshare google-drive.remove_permission
  • Trash file google-drive.trash_file
  • Delete file google-drive.delete_file
  • Upload file google-drive.upload_file
  • Google Drive API request google-drive.api_request

Pengaturan

Graphrt menyalakan plugin dengan environment yang bersih. Hanya nilai ini yang sampai ke plugin, dan secret tidak masuk log.

  • GOOGLE_REFRESH_TOKEN
    OAuth refresh trio
  • GOOGLE_SERVICE_ACCOUNT_JSON
    Path to a service account key file (scope drive), it sees only files shared with its email (and its own Drive)
  • GOOGLE_ACCESS_TOKEN
    A ready access token (used only when neither of the above is set)
  • GOOGLE_DRIVE_DOWNLOAD_DIR
    Absolute directory for export_file and download_file
  • GOOGLE_DRIVE_UPLOAD_DIR
    Directory upload_file may read local files from (https URLs work without it)
  • GOOGLE_DRIVE_TOOL_FOLDER_ALLOWLIST
    Comma-separated folder ids agent tools may put files into (* = any folder)
  • GOOGLE_CLIENT_ID
  • GOOGLE_CLIENT_SECRET
  • GOOGLE_DRIVE_TOOL_TOKEN_SOURCE

Cara memakainya

Di Graphrt Desktop

  1. Buka Plugins dan cari Google Drive.
  2. Klik Install lalu setujui.
  3. Ikuti langkah setup di halaman plugin, lalu tempel pengaturan yang dibutuhkan.
  4. Jelaskan pekerjaan yang membutuhkannya, dan builder menambahkan langkahnya.
Plugin di Graphrt Desktop

Dengan CLI

terminal
$ graphrt plugin install google-drive
workflow.yaml
- id: template
  type: google-drive.search_files
  name_contains: Invoice template
  mime_type: application/vnd.google-apps.document
- id: copy
  type: google-drive.copy_file
  file_id: "{{#template.data.0.id#}}"
  name: "Invoice {{#start.number#}}"
  parent_ids: ["{{#start.folder_id#}}"]
- id: pdf
  type: google-drive.export_file
  file_id: "{{#copy.data.id#}}"
  mime_type: application/pdf          # saved into $GOOGLE_DRIVE_DOWNLOAD_DIR
Plugin di docs