Skip to content

A small api-client for Nextcloud Apps like Deck, Bookmarks, Notes. Additionally featuring general API's like auth, capabilities, user-info and auto-complete for users.

Notifications You must be signed in to change notification settings

samuelspagl/nextcloud-api-client

Repository files navigation

Nextcloud Apps TS Client

Some AI-Mimimi for the beginning:

A powerful API client for Nextcloud apps, written in TypeScript. This client provides an easy way to interact with various Nextcloud apps, including Bookmarks, Deck, and Notes. Additionally, you can use the NextcloudAuthClient to handle authentication based on the LoginFlowV2 proposed by Nextcloud. The "General" app includes calls for capabilities and auto-completion.

I created this client out of personal curiosity to

  • a) create an npm package
  • b) a personal project using deck / notes and bookmark

I am not sure how much support I can give, but lets see.

📦 Installation

bun add @samuelspagl/nc-api-client

📚 Features

General Functions

  • Capabilities: Retrieve the capabilities of the Nextcloud instance.
  • User Info: Retrieve the information of the user
  • Auto-completion: User and group auto-completion.

Bookmarks App

  • Manage Bookmarks: Create, update, retrieve, and delete bookmarks.
  • Manage Folders: Create, update, retrieve, and delete folders.
  • Manage Tags: Retrieve, rename, and delete tags.
  • Manage Shares: Create, update, retrieve, and delete shares.

Deck App

  • Manage Boards: Create, update, retrieve, and delete boards.
  • Manage Stacks: Create, update, retrieve, and delete stacks.
  • Manage Cards: Create, update, retrieve, and delete cards.
  • Manage Labels: Create, update, retrieve, and delete labels.
  • Manage Attachments: Upload, retrieve, and delete attachments.

Notes App

  • Manage Notes: Create, update, retrieve, and delete notes.
  • Manage Settings: Retrieve and update note settings.

Authentication

  • LoginFlowV2: Handle authentication based on the LoginFlowV2 proposed by Nextcloud.

🛠️ Usage

import { NextcloudClient } from '@samuelspagl/nc-api-client';

const client = new NextcloudClient('https://cloud.example.com', 'username', 'password');

async function fetchBookmarks() {
    try {
        const bookmarks = await client.bookmarks.queryBookmarks();
        console.log('Fetched bookmarks:', bookmarks);
    } catch (error) {
        console.error('Error fetching bookmarks:', error);
    }
}

One can also import the single clients from:

import { DeckClient, GeneralClient, AuthClient, BookmarksClient, NotesClient } from '@samuelspagl/nc-api-client/scopes';

📱 Other Apps

Other apps can be added, just open a PR add the new client and some tests 🤓

📄 License

I didn't think of a licence yet 🤷🏻‍♂️

About

A small api-client for Nextcloud Apps like Deck, Bookmarks, Notes. Additionally featuring general API's like auth, capabilities, user-info and auto-complete for users.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published