Package: gapps
Build Google Workspace add-ons in Python  🐍 !!!***📝 Table of Contents❗ What is GAPPS?⚡ Key Features🏁 Getting Started🚜 Installation⚙️ CardService: Choose your coding style!⛏️ Card Builder🚀 Demos💬 Tutorials📄 Methods Reference⚠️ Notes✅ Tests✨ Contribute🎓 License❗ What is GAPPS?GAPPSis a library that allows developers to easily and flexibly buildadd-ons for Google Workspaceusing Python 🐍. WithGAPPS, you can create powerful tools and integrations for Gmail, Google Chat, Calendar, Sheets, Drive, Docs and other Google Workspace apps, that can streamline your workflow and automate common tasks.⚡ Key FeaturesA simple and easy-to-use API for building Google Workspace add-ons.Flexible interface that can be used for a variety of use cases.Built-in support for Gmail, Google Calendar, Google Drive and other Google Workspace apps.Well-documented, well-maintained codebase and easy to contribute.🏁 Getting Started🚜 InstallationThis client is hosted atPyPiunder the namegapps, to install it, simply runpip install gappsor install dev version:git clone https://github.com/skoudoro/gapps.git
pip install -e .⚙️ CardService: Choose your coding style!GAPPS allows you to build extensions by following your favorite coding styleAppscript StylefromgappsimportCardServicedefcreate_cat_card(text):# Use the "Cat as a service" API to get the cat image. Add a "time" URL# parameter to act as a cache buster.now=datetime.now()caption=text.replace('/',' ')imageUrl=f'https://cataas.com/cat/says/{caption}?time={now.timestamp()}'image=CardService.newImage()\.setImageUrl(imageUrl)\.setAltText('Meow')# Create a button that changes the cat image when pressed.# Note: Action parameter keys and values must be strings.action=CardService.newAction()\.setFunctionName('on_change_cat')\.setParameters({'text':text,'is_homepage':str(is_homepage)})button=CardService.newTextButton()\.setText('Change cat')\.setOnClickAction(action)\.setTextButtonStyle(CardService.TextButtonStyle.FILLED)buttonSet=CardService.newButtonSet()\.addButton(button)# Assemble the widgets and return the card.section=CardService.newCardSection()\.addWidget(image)\.addWidget(buttonSet)card=CardService.newCardBuilder()\.addSection(section)returncard.build()Pythonic StylefromgappsimportCardServicedefcreate_cat_card(text):# Use the "Cat as a service" API to get the cat image. Add a "time" URL# parameter to act as a cache buster.now=datetime.now()caption=text.replace('/',' ')imageUrl=f'https://cataas.com/cat/says/{caption}?time={now.timestamp()}'image=CardService.Image(image_url=imageUrl,alt_text='Meow')action=CardService.Action(function_name='on_change_cat',parameters={'text':text,'is_homepage':str(is_homepage)})button=CardService.TextButton(text='Change cat',action=action,text_button_style=CardService.TextButtonStyle.FILLED)button_set=CardService.ButtonSet(button=button)section=CardService.CardSection(widget=[image,button_set])card=CardService.CardBuilder(section=section)returncard.build()⛏️ Card BuilderThe onlineCard buildercan help you prototype your app's interface.🚀 DemosCheck out theexamples folderfor sample codes. It contains the following examples:cats.py: Mirror of google Cats example. Compatible with Gmail, Google Calendar, Google Drive, Google Docs and Google sheetssimple_demo.py: minimalistic example to show how to build a basic card.card_builder.py: This example show how to reproduce all the templates from the onlineCard builder. It can help you prototype your app's interface.💬 TutorialsComing soon...📄 Methods referenceCardService:For the complete reference, visit theofficial Google Workspace Add Ons API reference.⚠️ NotesWe still need to handle some widgets/builders but 90% of them are working correctly✅ TestsStep 1: Install pytestpip install pytestStep 2: Run the testspytest -svv gapps✨ ContributeWe love contributions!You've discovered a bug or something else you want to change - excellent!Create an issue!You've worked out a way to fix it – even better! Submit aPull Request!Start with thecontributing guide!Do you like GAPPS?Show us with a star on github...🎓 LicenseProject under MIT license, more informationhere