Created
January 29, 2015 01:33
-
-
Save wejrowski/ac4594ce5d4d6e3357ba to your computer and use it in GitHub Desktop.
Gmail api Javascript client execution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Gmail Client (ideas) | |
Usage: | |
var gmailClient = newGmailClient(myAccessToken); | |
var response = gmailClient.execute({ | |
url: "users/me/messages", | |
headers: {}, | |
parameters: { | |
q: x, | |
} | |
}) | |
// return responseObject: | |
{ | |
header_lines: headers, // header as array of strings | |
http_status: http_status, // HTTP status number | |
data: data, // Parsed JSON output | |
raw: rawResponse // complete raw request page as string | |
}; | |
var batchRequest = newBatchRequest(); | |
// add single requests to a batch | |
batchRequest.add({ | |
url: "users/me/messages", | |
headers: {}, | |
parameters: { | |
q: x, | |
} | |
}) | |
// Returns array of batchRequest objects | |
batchRequest.execute(); | |
*/ | |
function newGmailClient (accessToken) { | |
var client = {} | |
client.baseUrl = "https://www.googleapis.com/gmail/v1/users/me/"; | |
client.execute = function (options) { | |
}; | |
client.execute_batch = function (options) { | |
}; | |
return client; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment