entities_api_token.js.html 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JSDoc: Source: entities/api_token.js</title>
  6. <script src="scripts/prettify/prettify.js"> </script>
  7. <script src="scripts/prettify/lang-css.js"> </script>
  8. <!--[if lt IE 9]>
  9. <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  10. <![endif]-->
  11. <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
  12. <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
  13. </head>
  14. <body>
  15. <div id="main">
  16. <h1 class="page-title">Source: entities/api_token.js</h1>
  17. <section>
  18. <article>
  19. <pre class="prettyprint source linenums"><code>"use strict";
  20. const Entity = require('./entity');
  21. const dateUtils = require('../services/date_utils');
  22. /**
  23. * ApiToken is an entity representing token used to authenticate against Trilium API from client applications. Currently used only by Trilium Sender.
  24. *
  25. * @property {string} apiTokenId - primary key
  26. * @property {string} token
  27. * @property {boolean} isDeleted - true if API token is deleted
  28. * @property {string} utcDateCreated
  29. *
  30. * @extends Entity
  31. */
  32. class ApiToken extends Entity {
  33. static get entityName() { return "api_tokens"; }
  34. static get primaryKeyName() { return "apiTokenId"; }
  35. static get hashedProperties() { return ["apiTokenId", "token", "utcDateCreated", "isDeleted"]; }
  36. beforeSaving() {
  37. if (!this.isDeleted) {
  38. this.isDeleted = false;
  39. }
  40. if (!this.utcDateCreated) {
  41. this.utcDateCreated = dateUtils.utcNowDateTime();
  42. }
  43. super.beforeSaving();
  44. }
  45. }
  46. module.exports = ApiToken;</code></pre>
  47. </article>
  48. </section>
  49. </div>
  50. <nav>
  51. <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Entity.html">Entity</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
  52. </nav>
  53. <br class="clear">
  54. <footer>
  55. Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.4</a>
  56. </footer>
  57. <script> prettyPrint(); </script>
  58. <script src="scripts/linenumber.js"> </script>
  59. </body>
  60. </html>