Skip to content

Instantly share code, notes, and snippets.

@rhyskentish
rhyskentish / installpdfmakebower
Last active May 2, 2018 14:29
Install pdfmake
bower install pdfmake
function generateGoogleToken() {
// This will prompt a dialogue to allow cGOA access to see drive
DriveApp.getFileById(‘YOUR_FILE_ID’)
var propertyStore = PropertiesService.getScriptProperties();
// service account for play console
cGoa.GoaApp.setPackage (propertyStore ,
cGoa.GoaApp.createServiceAccount (DriveApp, {
packageName: 'PlayConsole',
fileId:‘YOUR_FILE_ID’,
/**
* namespace to deal with oauth
* @namespace Oauth
*/
var Goth = (function(ns) {
/**
* get a goa or fail
* @param {string} packageName the package name
* @param {PropertiesService} [props=ScriptProperties]
function getLatestReviews() {
var token = Goth.getToken('PlayConsole')
var response = UrlFetchApp.fetch("https://www.googleapis.com/androidpublisher/v3/applications/your_package_name/reviews?access_token=your_auth_token");
// Parse the JSON reply
var json = response.getContentText();
var data = JSON.parse(json);
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var reviews = data["reviews"].reverse()
var lastRow = sheet.getLastRow();
function getColByName(name){
var headers = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Sheet1').getDataRange().getValues()[1];
var colindex = headers.indexOf(name);
return colindex+1;
}
var ui = SpreadsheetApp.getUi();
ui.createMenu('Reviews')
.addItem('Get Latest Reivews','getLatestReviews')
.addToUi();
var response = UrlFetchApp.fetch("https://www.googleapis.com/androidpublisher/v3/applications/your_package_name/reviews?access_token=your_auth_token");
// Parse the JSON reply
var json = response.getContentText();
var data = JSON.parse(json);
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
UrlFetchApp.fetch("https://www.googleapis.com/androidpublisher/v3/applications/your_package_name/reviews?access_token=your_auth_token");
const { KeyManagementServiceClient } = require('@google-cloud/kms');
const projectId = <YourProjectID>;
const locationId = <YourPreferedStorageLocationID>; //Based on the google cloud regions e.g. us-central1
const keyRingId = <KeyRingID>;
const kmsClient = new KeyManagementServiceClient();
const locationName = kmsClient.locationPath(projectId, locationId);
const projectId = <YourProjectID>;
const locationId = <YourPreferedStorageLocationID>; //Based on the google cloud regions e.g. us-central1
const keyRingId = <KeyRingID>;
const kmsClient = new KeyManagementServiceClient();
const locationName = kmsClient.locationPath(projectId, locationId);
async function createKeySymmetricEncryptDecrypt() {
const keyRingName = await kmsClient.keyRingPath(projectId, locationId, keyRingId);