Code Monkey home page Code Monkey logo

skoudoro / gapps Goto Github PK

View Code? Open in Web Editor NEW
16.0 1.0 2.0 306 KB

GAPPS is a library that allows developers to easily and flexibly build add-ons for Google Workspace using Python ๐Ÿ. With GAPPS, 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.

License: MIT License

Python 100.00%
cardservice gmail-add-ons google-cloud google-workspace-add-on python sheets google-chat google-slides

gapps's Introduction

Build Google Workspace add-ons in Python ๐Ÿ !!!

***

Build Status Deployment Code Quality License Contribution PR


๐Ÿ“ Table of Contents

โ— What is GAPPS?

GAPPS is a library that allows developers to easily and flexibly build add-ons for Google Workspace using Python ๐Ÿ. With GAPPS, 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 Features

  • A 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

๐Ÿšœ Installation

This client is hosted at PyPi under the name gapps, to install it, simply run

pip install gapps

or 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 style

Appscript Style

from gapps import CardService

def create_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)

    return card.build()

Pythonic Style

from gapps import CardService

def create_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)

    return card.build()

โ›๏ธ Card Builder

The online Card builder can help you prototype your app's interface.

๐Ÿš€ Demos

Check out the examples folder for 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 sheets
  • simple_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 online Card builder. It can help you prototype your app's interface.

๐Ÿ’ฌ Tutorials

Coming soon...

๐Ÿ“„ Methods reference

CardService: For the complete reference, visit the official Google Workspace Add Ons API reference.

โš ๏ธ Notes

We still need to handle some widgets/builders but 90% of them are working correctly

โœ… Tests

  • Step 1: Install pytest
  pip install pytest
  • Step 2: Run the tests
  pytest -svv gapps

โœจ Contribute

We 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 a Pull Request!

Start with the contributing guide!

Do you like GAPPS?

Show us with a star on github...

Star GAPPS

๐ŸŽ“ License

Project under MIT license, more information here

gapps's People

Contributors

dependabot[bot] avatar skoudoro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

gapps's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.