From 86fa80f3eb7f0a9ad777115d5b6b58ebec79da9f Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 10 Jan 2022 19:55:09 +0100 Subject: [PATCH] updated API docs --- docs/backend_api/EtapiToken.html | 587 ++++++++++++++++++ .../becca_entities_etapi_token.js.html | 125 ++++ 2 files changed, 712 insertions(+) create mode 100644 docs/backend_api/EtapiToken.html create mode 100644 docs/backend_api/becca_entities_etapi_token.js.html diff --git a/docs/backend_api/EtapiToken.html b/docs/backend_api/EtapiToken.html new file mode 100644 index 000000000..8a212b1a0 --- /dev/null +++ b/docs/backend_api/EtapiToken.html @@ -0,0 +1,587 @@ + + + + + JSDoc: Class: EtapiToken + + + + + + + + + + +
+ +

Class: EtapiToken

+ + + + + + +
+ +
+ +

EtapiToken()

+ +
EtapiToken is an entity representing token used to authenticate against Trilium REST API from client applications. +Used by: +- Trilium Sender +- ETAPI clients
+ + +
+ +
+
+ + + + +

Constructor

+ + + +

new EtapiToken()

+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Members

+ + + +

etapiTokenId :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

isDeleted :boolean

+ + + + + + +
Type:
+
    +
  • + +boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

name :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

tokenHash :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

utcDateCreated :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

utcDateModified :string

+ + + + + + +
Type:
+
    +
  • + +string + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/docs/backend_api/becca_entities_etapi_token.js.html b/docs/backend_api/becca_entities_etapi_token.js.html new file mode 100644 index 000000000..3bf851b3e --- /dev/null +++ b/docs/backend_api/becca_entities_etapi_token.js.html @@ -0,0 +1,125 @@ + + + + + JSDoc: Source: becca/entities/etapi_token.js + + + + + + + + + + +
+ +

Source: becca/entities/etapi_token.js

+ + + + + + +
+
+
"use strict";
+
+const dateUtils = require('../../services/date_utils');
+const AbstractEntity = require("./abstract_entity");
+const sql = require("../../services/sql.js");
+
+/**
+ * EtapiToken is an entity representing token used to authenticate against Trilium REST API from client applications.
+ * Used by:
+ * - Trilium Sender
+ * - ETAPI clients
+ */
+class EtapiToken extends AbstractEntity {
+    static get entityName() { return "etapi_tokens"; }
+    static get primaryKeyName() { return "etapiTokenId"; }
+    static get hashedProperties() { return ["etapiTokenId", "name", "tokenHash", "utcDateCreated", "utcDateModified", "isDeleted"]; }
+
+    constructor(row) {
+        super();
+
+        if (!row) {
+            return;
+        }
+
+        this.updateFromRow(row);
+        this.init();
+    }
+
+    updateFromRow(row) {
+        /** @type {string} */
+        this.etapiTokenId = row.etapiTokenId;
+        /** @type {string} */
+        this.name = row.name;
+        /** @type {string} */
+        this.tokenHash = row.tokenHash;
+        /** @type {string} */
+        this.utcDateCreated = row.utcDateCreated || dateUtils.utcNowDateTime();
+        /** @type {string} */
+        this.utcDateModified = row.utcDateModified || this.utcDateCreated;
+        /** @type {boolean} */
+        this.isDeleted = !!row.isDeleted;
+        
+        this.becca.etapiTokens[this.etapiTokenId] = this;
+    }
+    
+    init() {
+        if (this.etapiTokenId) {
+            this.becca.etapiTokens[this.etapiTokenId] = this;
+        }
+    }
+
+    getPojo() {
+        return {
+            etapiTokenId: this.etapiTokenId,
+            name: this.name,
+            tokenHash: this.tokenHash,
+            utcDateCreated: this.utcDateCreated,
+            utcDateModified: this.utcDateModified,
+            isDeleted: this.isDeleted
+        }
+    }
+
+    beforeSaving() {
+        this.utcDateModified = dateUtils.utcNowDateTime();
+
+        super.beforeSaving();
+
+        this.becca.etapiTokens[this.etapiTokenId] = this;
+    }
+}
+
+module.exports = EtapiToken;
+
+
+
+ + + + +
+ + + +
+ + + + + + +