Skip to content

Instantly share code, notes, and snippets.

@pizzacat83
Created March 6, 2019 13:59
Show Gist options
  • Save pizzacat83/3a5b575f48dccc2e8943f570bc49d1db to your computer and use it in GitHub Desktop.
Save pizzacat83/3a5b575f48dccc2e8943f570bc49d1db to your computer and use it in GitHub Desktop.
const creds = {
token: properties.getProperty('trello-token'),
key: properties.getProperty('trello-key')
};
export const request = (
endpoint: string,
options?: GoogleAppsScript.URL_Fetch.URLFetchRequestOptions,
params?: any
) => {
const res = UrlFetchApp.fetch(
'https://api.trello.com/1/' + endpoint + queryString(Object.assign({ ...creds }, params)),
options
);
const text = res.getContentText();
return JSON.parse(text);
};
import * as Trello from './trello';
Trello.request('cards', { method: 'post' }, { name: 'hoge' });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment