Skip to content

Instantly share code, notes, and snippets.

@wejrowski
Created January 29, 2015 01:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wejrowski/ac4594ce5d4d6e3357ba to your computer and use it in GitHub Desktop.
Save wejrowski/ac4594ce5d4d6e3357ba to your computer and use it in GitHub Desktop.
Gmail api Javascript client execution
/*
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