dlang / project-ideas

Collection of impactful projects in the D ecosystem
36 stars 12 forks source link

D Language Client Libraries for Google APIs #66

Closed edi33416 closed 3 years ago

edi33416 commented 4 years ago

Description

Google APIs is a set of application programming interfaces (APIs) developed by Google which allow communication with Google Services and their integration to other services. Examples of these include GDrive, Calendar, Search or Gmail. Third-party apps can use these APIs to take advantage of or extend the functionality of the existing services.

There are client libraries in various languages which allow developers to use Google APIs from within their code, including Java, JavaScript and Python. There is currently no client library for the D Programming Language.

I've wrote quite a few Python scripts lately that automate tasks for me, like creating Calendar events, uploading files to Drive and filling Sheets. I would have loved to do this with D, but we're missing the libraries.

I think that we should start by adding support for Google Sheets, Google Calendar and Google Drive.

What are rough milestones of this project?

  1. add oauth support for Google probably to dub oauth library
  2. implement simple http requests
  3. add more complex requests and flows

How does this project help the D community?

The goal of this project is to write client libraries for the D Programming Language which will allow D developers to use various Google APIs.

Point of Contact

@edi33416 @RazvanN7

EmTee70 commented 4 years ago

Important to note, that there are no client libraries for C or C++ available, so a binding alone would not fit.

edi33416 commented 4 years ago

@EmTee70 That is a good point. Even if there was a C or C++ library, I'm not sure how easy it would have been to pass the user defined types from D to C/C++. I think that a fresh implementation that uses vibe.d to make the requests and manage the session is better suited.

wilzbach commented 4 years ago

add oauth support for Google probably to dub oauth library

It already supports Google. OAuth is a standard ;-)

1) You probably want to use the higher-level requests library 2) You definitely want to automatically generate them (see e.g. https://github.com/googleapis/gapic-generator or https://github.com/google/apis-client-generator)

edi33416 commented 4 years ago

add oauth support for Google probably to dub oauth library

It already supports Google. OAuth is a standard ;-)

Has it been tested recently with Google? Now Google's API require token support which I think the current library doesn't support. I tried to make a simple query a couple of months ago, but I've failed to get it to work. Do you have a positive recent experience with it?

  1. You probably want to use the higher-level requests library

Cool! Didn't knew about this

  1. You definitely want to automatically generate them (see e.g. https://github.com/googleapis/gapic-generator or https://github.com/google/apis-client-generator)

This looks like a robust solution, but it's unclear how one should proceed to add support for a new language. Do you have some experience with it? Help is very much appreciated

andre2007 commented 4 years ago

I am also highly interested in having a google api client generator (Kubernetes in my case). I do not know which of the two tools is better, but https://github.com/google/apis-client-generator seems more easier, as you can just have templates (without coding?) See sample for C++ https://github.com/google/apis-client-generator/tree/master/src/googleapis/codegen/languages

ikod commented 4 years ago

Some time ago I tried to generate code from AWS interface description. They have API description in JSON or XML (or may be both). Just parsing these descriptions and generate D code can solve problem (at least I got some services working), but there can be lot of things you have to take in account if you plan to support all API's.

Sidenote - while solve this problem try not make assumptions about underlying http client "driver" - make it pluggable, so that it can be reused with vibe http client or requests or any future libraries.

mdparker commented 3 years ago

This was implemented n SAoC 2020.

RazvanN7 commented 3 years ago

@edi33416 Could you please provide some links to the implementations?

edi33416 commented 3 years ago

@Robert-Aron293 Could you please provide some links and details?

ikod commented 3 years ago

Maybe this https://github.com/Robert-Aron293/google-api-dlang-client

Robert-Aron293 commented 3 years ago

Thanks, @ikod! But that's an outdated version. I am a little bit busy right now, but I will post the links and some details today.

ikod commented 3 years ago

Great, @Robert-Aron293 thanks

Robert-Aron293 commented 3 years ago

Sorry for the delay! I will put here links to some client libraries, the generator, and an example. Google Drive Client: https://github.com/Robert-Aron293/d-google-drive-client Google Mail Client: https://github.com/Robert-Aron293/d-google-gmail-client apis-client-generator with D support: https://github.com/Robert-Aron293/apis-client-generator/tree/d-language-support Google Drive Client example: https://github.com/Robert-Aron293/d-google-drive-client-example

The tool can generate code for all the APIs but it takes a lot of time to test all of their functionalities and I did not manage to test them all yet. This is why I created repositories just for Google Drive and Gmail.