Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Wrapper for Google Calendar API #54

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

TheCedarPrince
Copy link
Collaborator

Hi GoogleCloud Maintainers,

I apologize for the random PR out of the blue but I had the impression that GoogleCloud.jl would be the ideal place to contribute new features/wrappers too for the suite of Google Cloud Platform products based on the documentation. I have been developing some "homemade" features for Google Calendar's API that utilizes HTTP payloads. I opened this PR in the hopes of building out support for this API within GoogleCloud.jl as I need it for another project. Here is how it currently can be invoked:

import Google: Calendar.Calendars

calendar_id = "primary"
key = "API KEY"
client_id = "GCP Client ID"
access_token = "ya29. ... REST OF ACCESS TOKEN"

Calendars.get(calendar_id, key, client_id, access_token)

Which would return a JSON Calendar Resource payload that could be parsed via JSON3 or otherwise:

HTTP.Messages.Response:
"""
HTTP/1.1 200 OK
Expires: Wed, 31 May 2023 20:04:14 GMT
Date: Wed, 31 May 2023 20:04:14 GMT
Content-Type: application/json; charset=UTF-8
Content-Length: 326
Cache-Control: private, max-age=0, must-revalidate, no-transform
ETag: "redacted"
Vary: Origin, X-Origin, Referer
Server: ESF
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000

{
 "kind": "calendar#calendar",
 "etag": "\"redacted\"",
 "id": "redacted",
 "summary": "JZ Calendar",
 "description": "My main calendar - where all the magic happens",
 "timeZone": "America/New_York",
 "conferenceProperties": {
  "allowedConferenceSolutionTypes": [
   "hangoutsMeet"
  ]
 }
}
"""

I paused for now in adding any additional features/functionality as I wanted to get some feedback before proceeding and also ran into some issues on integrating with the rest of GoogleCloud.jl. Here were the points I was thinking about and wanted get y'all's feedback on:

  1. How can I set-up authentication using the package already? I want to use the authentication tools you have but I am unsure how to generate access tokens and integrate with the functions I have already built.
  2. If you look at the functions I created, I basically created a 1-to-1 wrapper to the calendar API's corresponding function. I was rather ham-fisted with just manually mapping everything over but am not too sure if there is a more elegant way to build GET/POST requests via HTTP.jl (I was looking at the query kwarg but I am not sure if that would be too low-level).
  3. I don't know how to build effective tests for this module -- would we want to set-up a dummy account for testing or how would you all do it?
  4. I introduced submodules to organize things better since in this case, I found multiple dispatch (in a rare circumstance) a bit more convoluted here than having a more OOP/module based approach.

I apologize if this should not be supported within GoogleCloud.jl but I thought I'd try adding here first before making a separate package for the calendar. Otherwise, I look forward to your feedback! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant