hubot-googledrive-search
Google drive search for hubot!
Last updated 4 years ago by aaaschmitt .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install hubot-googledrive-search 
SYNC missed versions from official npm registry.

hubot-googledrive-search

Search your google drive with hubot! Authentication handeled by hubot-google-auth.

Installation

  • In your project repo run:
    npm install hubot-googledrive-search --save
  • Then add the follwing to your external-scripts.json:
    [
      'hubot-googledrive-search'
    ]

Configuration

This script requires you to generate oauth2 credentials for the drive account that you want hubot to be able to access. Currently this scipt is configured to give hubot access to all of drive (the specific scope used is: 'https://www.googleapis.com/auth/drive').

  1. Generate a client secret.json file by following step 1 here
  2. Set these required environemnt variables (found in your client secret.json file):
    • HUBOT_DRIVE_CLIENT_ID**="your_client_id"
    • HUBOT_DRIVE_CLIENT_SECRET**="your_client_secret"
    • HUBOT_DRIVE_REDIRECT_URL**="the_first_uri_in_the_list"
  3. Load the script and attempt to interact with hubot. You will have to authorize the app to get your inital token and refresh token. The script will then store the refresh token in the hubot brain for future use, so this process should only need to be done once. Here's a sample initial interaction:
user>> @hubot drive search title= My Cool File
hubot>> Authorize this app by visiting: https://google.com/some_thing_with_your_client_info
        Then use @hubot drive set code <code>
user>> @hubot drive set code 123412351235
hubot>> Hubot drive code successfully set!
user>> @hubot search title= Cool File
hubot>> 1.) This is a Cool File
		https://google.drive/1234h123h4123h
        2.) Some Cool File
        https://google.drive/qwer1353451asfds

Features

This script can be used to search your drive in a variety of ways:

  1. Use a google query string to search drive. Find information on query strings here: https://developers.google.com/drive/v2/web/search-parameters
user>> @hubot drive search query= fullText contains 'important' and trashed = true
  1. Use either a title and/or a contains parameter. Equivalent query string shown below each example.
user>> @hubot drive search title= My Cool File
#equivalent to:
user>> @hubot drive search query= title contains 'My Cool File'

user>> @hubot drive search contains= This is the coolest file ever
#equivalent to:
user>> @hubot drive search query= fullText contains 'This is the coolest file ever'

user>> @hubot drive search title= My Cool File contains= This is the coolest file ever
#equivalent to:
user>> @hubot drive search query= title contains 'My Cool File' and fullText contains 'This is the coolest file ever'

Notes

Since hubot needs to use the redis brain to store the drive tokens and expiration time make sure that the following keys don't conflict with any other keys being used in the brain:

'HUBOT_DRIVE_GOOGLE_AUTH_TOKEN'
'HUBOT_DRIVE_GOOGLE_AUTH_REFRESH_TOKEN'
'HUBOT_DRIVE_GOOGLE_AUTH_EXPIRE_TIME'

Current Tags

  • 3.0.2                                ...           latest (4 years ago)

7 Versions

  • 3.0.2                                ...           4 years ago
  • 3.0.1                                ...           4 years ago
  • 3.0.0                                ...           4 years ago
  • 2.1.0                                ...           4 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |