Code Monkey home page Code Monkey logo

trilium-etapi's Introduction

Trilium ETAPI (TEPI)

A Node.js wrapper around the ETAPI for Trilium Notes. The library will continue to match the stable release of Trilium and release updates as needed.

Installation

npm install trilium-etapi

Usage

ESM (Preferred)

// tepi = Trilium Etapi Programming Interface
import tepi from "trilium-etapi";

tepi.server("https://my.trilium.com:8080/etapi").token(process.env.TRILIUM_TOKEN);
tepi.getNoteById("root").then(console.log).catch(console.error);

CommonJS

// tepi = Trilium Etapi Programming Interface
const tepi = require("trilium-etapi").default;

tepi.server("https://my.trilium.com:8080/etapi").token(process.env.TRILIUM_TOKEN);
tepi.getNoteById("root").then(console.log).catch(console.error);

Documentation

Documentation is available on GitHub Pages built with TypeDoc!

Links

Check out my other Trilium-based projects:

Want more? Be sure to check out the Awesome Trilium list!

trilium-etapi's People

Contributors

zerebos avatar

Stargazers

banshan avatar  avatar  avatar Elian Doran avatar James Turnbull avatar Chris Rutherford avatar perfectra1n avatar Thilo Billerbeck avatar Nate River avatar

Watchers

James Turnbull avatar  avatar  avatar

trilium-etapi's Issues

searchNotes not working.

Hi

Just started using the wrapper.

My code:

async function fetchParentNotes() {
  setupTepiApi();

  const searchOptions = {
    search: "Inbox",
  };

  try {
    const notes = await tepi.searchNotes(searchOptions);
    return notes.results.map((note) => ({ id: note.noteId, title: note.title }));
  } catch (error) {
    if (error instanceof APIError && error) {
      console.error("API Error:", error);
      console.error("Response Status:", error.status);
    } else {
      console.error("Unknown Error:", error);
    }
    return [];
  }

The error:

17:28:58.514 API Error: APIError
    at TriliumETAPI.searchNotes (/Users/james/.config/raycast/extensions/trilium/index.js:432:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async fetchParentNotes (/Users/james/.config/raycast/extensions/trilium/index.js:864:19)
    at async loadParentNotes (/Users/james/.config/raycast/extensions/trilium/index.js:891:21) {
  status: undefined,
  code: undefined
}
17:28:58.515 Response Status: undefined

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.