Coder Social home page Coder Social logo

async-google-apis's Introduction

async-google-apis

This software generates asynchronous API stubs for Google APIs (and most likely any other API described by a Discovery document). It uses yup-oauth2 for the authorization logic.

This project is still experimental. While for many complex APIs (Cloud Storage, Drive v3, Sheets v4) usable APIs including types and documentation are generated successfully, this doesn't mean that it will work on any other current or future Google API.

What it looks like

There are examples in this repository:

Also consider the documentation of these exemplary APIs:

Parts

  • generate contains a Python program fetching current Google Discovery documents (https://www.googleapis.com/discovery/v1/apis, see documentation) and generating Rust code in the generate/gen directory. This is done very non-fancily using a few mustache templates and the chevron package. The script only takes two parameters, which you can discover using --help. In short, to generate an API stub for the API with ID storage:v1 (Google Cloud Storage v1), run
    $ pipenv run ./generate.py --apis=storage:v1
    (install pipenv using pip install --user pipenv && pipenv sync before, if you don't have it yet). See more details in that directory.
  • Consult drive_example or gcs_example for simple but useful examples of using the generated code. As you can see, it is reasonably easy! Use cargo doc to generate the documentation for generated code, as the API comments is translated into Rust doc comments. I try keeping them up-to-date as the API of the generated code occasionally changes.
  • async-google-apis-common contains shared code, for example the HTTP logic, used by the generated code, as well as some types (like errors) and as well as all imports. Include this crate in your dependencies when you are using the generated code in your project.
  • NOTE: some parts of the API -- for example: URL query parameters that are not represented as enums -- may require small manual adjustments to the generated code. If possible, this should be solved automatically, but sometimes it isn't yet. Refer to the example crates for more details.

To Do

  • Integration tests: E.g. by writing a custom JSON service description and an accompanying server binary to run test code against.

async-google-apis's People

Contributors

dermesser avatar ddboline avatar jasonmccampbell avatar mike-kfed avatar davids avatar sabify avatar daihpos avatar

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.