This commit is contained in:
arc-alex
2023-11-26 17:29:12 +01:00
parent 6880f459b6
commit cb198bc3fe
+12 -10
View File
@@ -61,9 +61,9 @@ class sheet {
} }
/** /**
* test existance of sheet and workssheet and get is index * test existence of sheet and worksheet
* @param {string} sheetId - https://docs.google.com/spreadsheets/d/[[spreadsheetId]]/edit#gid=0 * @param {string} sheetId - https://docs.google.com/spreadsheets/d/[[spreadsheetId]]/edit#gid=0
* @param {string} worksheet - the name of the worksheet containg ontime data * @param {string} worksheet - the name of the worksheet containing ontime data
* @returns {Promise<false | {worksheetId: number, range: string}>} - false if not found | true if sheetId existes | id of worksheet and rage of worksheet * @returns {Promise<false | {worksheetId: number, range: string}>} - false if not found | true if sheetId existes | id of worksheet and rage of worksheet
* @throws * @throws
*/ */
@@ -87,6 +87,10 @@ class sheet {
return false; return false;
} }
/**
* push sheet
* @throws
*/
public async push() { public async push() {
const { auth, id, worksheet } = await this.getSheetState(); const { auth, id, worksheet } = await this.getSheetState();
if (!auth && !id && !worksheet) { if (!auth && !id && !worksheet) {
@@ -164,14 +168,11 @@ class sheet {
} }
/** /**
* `parse` a given sheet * pull sheet
* @param {string} sheetId - https://docs.google.com/spreadsheets/d/[[spreadsheetId]]/edit#gid=0
* @param {string} worksheetName - the name of the worksheet containg ontime data
* @param {ExcelImportOptions} options
* @returns {Promise<Partial<ResponseOK>>} * @returns {Promise<Partial<ResponseOK>>}
* @throws * @throws
*/ */
public async pull() { public async pull(): Promise<Partial<ResponseOK>> {
const { auth, id, worksheet } = await this.getSheetState(); const { auth, id, worksheet } = await this.getSheetState();
if (!auth && !id && !worksheet) { if (!auth && !id && !worksheet) {
throw new Error(`Sheet not authorized or incorrect ID or worksheet`); throw new Error(`Sheet not authorized or incorrect ID or worksheet`);
@@ -201,8 +202,9 @@ class sheet {
} }
/** /**
* saves Object to appdata path as client_secret.json * saves secrets Object to appdata path as client_secret.json
* @param {Object} secrets * @param {Object} secrets
* @throws
*/ */
public async saveClientSecrets(secrets: Object) { public async saveClientSecrets(secrets: Object) {
sheet.client = null; sheet.client = null;
@@ -241,8 +243,8 @@ class sheet {
private authServerTimeout; private authServerTimeout;
/** /**
* create local Auth Server - returns url to serve on success * create local Auth Server
* @returns {Promise<string | false>} * @returns {Promise<string | false>} - returns url to serve on success
* @throws * @throws
*/ */
public async openAuthServer(): Promise<string | false> { public async openAuthServer(): Promise<string | false> {