Shino1024 / google-api-go-client

Automatically exported from code.google.com/p/google-api-go-client
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Support for push notifications #32

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
API Push Notifications were recently announced and demoed at I/O 
(http://www.youtube.com/watch?v=NlZZghBnfdM)

It would be great to have some of these common parts done by Go library code, 
so a developer could skip having to rewrite the protocol code each time.

If the Discovery document exposes the requisite information, Go code could be 
generated to allow developers to write something like:

svc.Playlists.Watch(playlistId).Do()
svc.Playlists.HandleNotification("/notifications", func(w http.ResponseWriter, 
r *http.Request, p youtube.Playlist, s common.StateChange) {
    // Do something with the updated playlist
    // stateChange is an enum describing whether it's an insertion, update, or deletion operation
})

This would register a http.HandleFunc that parses the request headers to 
determine the StateChange being described, and decode the JSON body into the 
Playlist, and pass it to the func.

I'm not sure if Discovery documents expose enough information for this to be 
possible, or if this is a good API surface, but it's worth looking into at 
least.

Original issue reported on code.google.com by imjas...@gmail.com on 22 May 2013 at 3:25

GoogleCodeExporter commented 9 years ago
Successfully auto-migrated to github:
https://github.com/google/google-api-go-client/issues/32
Closing.

Original comment by gmle...@google.com on 7 Apr 2015 at 6:37