Skip to content

Instantly share code, notes, and snippets.

View dimitrispaxinos's full-sized avatar

Dimitris Paxinos dimitrispaxinos

View GitHub Profile
const localLogger = new LocalLogger();
function onOpen(e) {
localLogger.init();
}
function doPost(e) {
// Read JSON content from the request
const requestBody = JSON.parse(e.postData.contents);
const AUTHENTICATION_ENABLED_SETTING = 'Authentication Enabled';
const AUTHENTICATION_TOKEN_SETTING = 'Authentication Token';
/**
* Constants for boolean settings values.
*/
const YES = 'Yes';
const NO = 'No';
[
{
"teachername":"Alexandra",
"gender":"Female",
"homestate":"CA",
"major":"English"
},
{
"teachername":"Anna",
"gender":"Female",
[
{
"teachername":"Alexandra",
"gender":"Female",
"homestate":"CA",
"major":"English"
},
{
"teachername":"Andrew",
"gender":"Male",
const notificationEmailAddress = "[email protected]";
const showNewestMessageFirst = true;
const logger = new LocalLogger(notificationEmailAddress, showNewestMessageFirst);
function onOpen() {
logger.init();
let ui = SpreadsheetApp.getUi();
ui.createMenu('Logging')
.addItem("Generate Debug Message", 'generateDebugMessage')
// Mimic an Enum for Severity Levels
const Severity = {
INFO: 'INFO',
WARNING: 'WARNING',
ERROR: 'ERROR',
DEBUG: 'DEBUG'
};
/**
* Class representing a logger with functionality to log messages to a Google Spreadsheet.
function onOpen() {
const ui = SpreadsheetApp.getUi();
ui.createMenu('Settings')
.addItem('Show Message', 'showMessage')
.addToUi();
}
function showMessage() {
if (settings.getBooleanSetting("ShowModal")) {
// Constants for settings labels
const SETTINGS_API_KEY_LABEL = 'Stripe API Key';
const SETTINGS_SELECTED_PRODUCT_LABEL = 'Selected Product';
const SETTINGS_DEFAULT_TRIAL_PERIOD_LABEL = 'Default Trial Period (Days)';
const MAIN_SHEET_NAME = 'Subscription Data';
const CURRENCY = 'EUR';
/**
* Constants for boolean settings values.
*/
const YES = 'Yes';
const NO = 'No';
/**
* The Settings class provides a way to manage script parameters/settings
* directly within a Google Sheet, making it accessible for non-technical users.
*/
/**
* Stripe API Client for handling various Stripe operations.
*/
class StripeApiClient {
constructor(apiKey) {
this.apiKey = apiKey;
}
/**
* Private method to make requests to the Stripe API.