diff --git a/.gitignore b/.gitignore index b1e3e98..f3a27af 100644 --- a/.gitignore +++ b/.gitignore @@ -129,5 +129,5 @@ dmypy.json .pyre/ -credentials.json +credentials.*json token.pickle diff --git a/app/app.py b/app/app.py index 78b5186..7364b34 100644 --- a/app/app.py +++ b/app/app.py @@ -8,6 +8,7 @@ from slack_sdk.errors import SlackApiError from slugify import slugify from flask import Flask, request, make_response from app.ux import SlackInterface +from app.gdrive import * app = Flask(__name__) @@ -89,6 +90,8 @@ def slack_events(): trigger_id=trigger_id, view=SlackInterface().generate_docs_modal() ) + elif action_id == 'debug_modal': + print(get_drives()) return make_response('', 200) diff --git a/app/gdrive.py b/app/gdrive.py index 025be60..f6f20b5 100644 --- a/app/gdrive.py +++ b/app/gdrive.py @@ -37,8 +37,9 @@ def get_files(): service = gdrive_client() # Call the Drive v3 API results = service.files().list( + q="mimeType='application/vnd.google-apps.folder'", pageSize=10, - spaces='Customers (Clients)' + spaces='drive', fields="nextPageToken, files(id, name)" ).execute() items = results.get('files', []) @@ -50,5 +51,18 @@ def get_files(): for item in items: print(u'{0} ({1})'.format(item['name'], item['id'])) -if __name__ == '__main__': - main() +def get_drives(): + service = gdrive_client() + # Call the Drive v3 API + results = service.drives().list( + q="mimeType='application/vnd.google-apps.folder'", + pageSize=10, + ).execute() + items = results.get('drives', []) + + if not items: + print('No files found.') + else: + print('Files:') + for item in items: + print(item) diff --git a/app/ux.py b/app/ux.py index 2918979..ea81e89 100644 --- a/app/ux.py +++ b/app/ux.py @@ -41,6 +41,21 @@ class SlackInterface(object): }, 'action_id': 'generate_documents_modal' } + }, + { + 'type': 'section', + 'text': { + 'type': 'mrkdwn', + 'text': 'Debug a new feature.' + }, + 'accessory': { + 'type': 'button', + 'text': { + 'type': 'plain_text', + 'text': 'Go' + }, + 'action_id': 'debug_modal' + } } ] }