aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sdk
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2024-12-30 16:20:24 +0000
committerMohamed Bassem <me@mbassem.com>2024-12-30 16:56:23 +0000
commit5d8d2de567d8dd228699485d401c3a5b946114b0 (patch)
treea3900594e101aaefcf0ba63130351855e5591b8a /packages/sdk
parent8df424093d135c7107ab0d1d15f4181809e31b59 (diff)
downloadkarakeep-5d8d2de567d8dd228699485d401c3a5b946114b0.tar.zst
feat: Introduce a typescript sdk
Diffstat (limited to 'packages/sdk')
-rw-r--r--packages/sdk/.gitignore1
-rw-r--r--packages/sdk/.npmignore4
-rw-r--r--packages/sdk/package.json47
-rw-r--r--packages/sdk/src/hoarder-api.d.ts1135
-rw-r--r--packages/sdk/src/index.ts5
-rw-r--r--packages/sdk/tsconfig.json15
-rw-r--r--packages/sdk/vite.config.mts18
7 files changed, 1225 insertions, 0 deletions
diff --git a/packages/sdk/.gitignore b/packages/sdk/.gitignore
new file mode 100644
index 00000000..1521c8b7
--- /dev/null
+++ b/packages/sdk/.gitignore
@@ -0,0 +1 @@
+dist
diff --git a/packages/sdk/.npmignore b/packages/sdk/.npmignore
new file mode 100644
index 00000000..18a504f5
--- /dev/null
+++ b/packages/sdk/.npmignore
@@ -0,0 +1,4 @@
+.turbo/**
+src/**
+vite.config.mts
+tsconfig.json
diff --git a/packages/sdk/package.json b/packages/sdk/package.json
new file mode 100644
index 00000000..326f55b3
--- /dev/null
+++ b/packages/sdk/package.json
@@ -0,0 +1,47 @@
+{
+ "$schema": "https://json.schemastore.org/package.json",
+ "name": "@hoarderapp/sdk",
+ "version": "0.20.0",
+ "description": "Typescript SDK for Hoarder",
+ "license": "GNU Affero General Public License version 3",
+ "keywords": [
+ "hoarder",
+ "sdk"
+ ],
+ "exports": "./dist/index.mjs",
+ "types": "./dist/index.d.ts",
+ "devDependencies": {
+ "@hoarder/eslint-config": "workspace:^0.2.0",
+ "@hoarder/prettier-config": "workspace:^0.1.0",
+ "@hoarder/tsconfig": "workspace:^0.1.0",
+ "@tsconfig/node21": "^21.0.1",
+ "tsx": "^4.7.1",
+ "vite": "^5.1.0",
+ "vite-plugin-dts": "^4.4.0"
+ },
+ "scripts": {
+ "build": "vite build",
+ "run": "tsx src/index.ts",
+ "lint": "eslint .",
+ "format": "prettier . --ignore-path ../../.prettierignore",
+ "typecheck": "tsc --noEmit"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/hoarder-app/hoarder.git",
+ "directory": "packages/sdk"
+ },
+ "eslintConfig": {
+ "root": true,
+ "extends": [
+ "@hoarder/eslint-config/base"
+ ],
+ "ignorePatterns": [
+ "src/hoarder-api.d.ts"
+ ]
+ },
+ "prettier": "@hoarder/prettier-config",
+ "dependencies": {
+ "openapi-fetch": "^0.13.3"
+ }
+}
diff --git a/packages/sdk/src/hoarder-api.d.ts b/packages/sdk/src/hoarder-api.d.ts
new file mode 100644
index 00000000..72f3717e
--- /dev/null
+++ b/packages/sdk/src/hoarder-api.d.ts
@@ -0,0 +1,1135 @@
+/**
+ * This file was auto-generated by openapi-typescript.
+ * Do not make direct changes to the file.
+ */
+
+export interface paths {
+ "/bookmarks": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /**
+ * Get all bookmarks
+ * @description Get all bookmarks
+ */
+ get: {
+ parameters: {
+ query?: {
+ archived?: boolean;
+ favourited?: boolean;
+ limit?: number;
+ cursor?: components["schemas"]["Cursor"];
+ };
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Object with all bookmarks data. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["PaginatedBookmarks"];
+ };
+ };
+ };
+ };
+ put?: never;
+ /**
+ * Create a new bookmark
+ * @description Create a new bookmark
+ */
+ post: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** @description The bookmark to create */
+ requestBody?: {
+ content: {
+ "application/json": {
+ title?: string | null;
+ archived?: boolean;
+ favourited?: boolean;
+ note?: string;
+ summary?: string;
+ createdAt?: string | null;
+ } & (
+ | {
+ /** @enum {string} */
+ type: "link";
+ /** Format: uri */
+ url: string;
+ }
+ | {
+ /** @enum {string} */
+ type: "text";
+ text: string;
+ sourceUrl?: string;
+ }
+ | {
+ /** @enum {string} */
+ type: "asset";
+ /** @enum {string} */
+ assetType: "image" | "pdf";
+ assetId: string;
+ fileName?: string;
+ sourceUrl?: string;
+ }
+ );
+ };
+ };
+ responses: {
+ /** @description The created bookmark */
+ 201: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Bookmark"];
+ };
+ };
+ };
+ };
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/bookmarks/{bookmarkId}": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /**
+ * Get a single bookmark
+ * @description Get bookmark by its id
+ */
+ get: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ bookmarkId: components["parameters"]["BookmarkId"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Object with bookmark data. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Bookmark"];
+ };
+ };
+ };
+ };
+ put?: never;
+ post?: never;
+ /**
+ * Delete a bookmark
+ * @description Delete bookmark by its id
+ */
+ delete: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ bookmarkId: components["parameters"]["BookmarkId"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description No content - the bookmark was deleted */
+ 204: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content?: never;
+ };
+ };
+ };
+ options?: never;
+ head?: never;
+ /**
+ * Update a bookmark
+ * @description Update bookmark by its id
+ */
+ patch: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ bookmarkId: components["parameters"]["BookmarkId"];
+ };
+ cookie?: never;
+ };
+ /** @description The data to update. Only the fields you want to update need to be provided. */
+ requestBody?: {
+ content: {
+ "application/json": {
+ archived?: boolean;
+ favourited?: boolean;
+ summary?: string | null;
+ note?: string;
+ title?: string | null;
+ createdAt?: string | null;
+ };
+ };
+ };
+ responses: {
+ /** @description The updated bookmark */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ id: string;
+ createdAt: string;
+ title?: string | null;
+ archived: boolean;
+ favourited: boolean;
+ /** @enum {string|null} */
+ taggingStatus: "success" | "failure" | "pending" | null;
+ note?: string | null;
+ summary?: string | null;
+ };
+ };
+ };
+ };
+ };
+ trace?: never;
+ };
+ "/bookmarks/{bookmarkId}/tags": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ get?: never;
+ put?: never;
+ /**
+ * Attach tags to a bookmark
+ * @description Attach tags to a bookmark
+ */
+ post: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ bookmarkId: components["parameters"]["BookmarkId"];
+ };
+ cookie?: never;
+ };
+ /** @description The tags to attach. */
+ requestBody?: {
+ content: {
+ "application/json": {
+ tags: {
+ tagId?: string;
+ tagName?: string;
+ }[];
+ };
+ };
+ };
+ responses: {
+ /** @description The list of attached tag ids */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ attached: components["schemas"]["TagId"][];
+ };
+ };
+ };
+ };
+ };
+ /**
+ * Detach tags from a bookmark
+ * @description Detach tags from a bookmark
+ */
+ delete: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ bookmarkId: components["parameters"]["BookmarkId"];
+ };
+ cookie?: never;
+ };
+ /** @description The tags to detach. */
+ requestBody?: {
+ content: {
+ "application/json": {
+ tags: {
+ tagId?: string;
+ tagName?: string;
+ }[];
+ };
+ };
+ };
+ responses: {
+ /** @description The list of detached tag ids */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ detached: components["schemas"]["TagId"][];
+ };
+ };
+ };
+ };
+ };
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/bookmarks/{bookmarkId}/highlights": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /**
+ * Get highlights of a bookmark
+ * @description Get highlights of a bookmark
+ */
+ get: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ bookmarkId: components["parameters"]["BookmarkId"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The list of highlights */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ highlights: components["schemas"]["Highlight"][];
+ };
+ };
+ };
+ };
+ };
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/lists": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /**
+ * Get all lists
+ * @description Get all lists
+ */
+ get: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Object with all lists data. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ lists: components["schemas"]["List"][];
+ };
+ };
+ };
+ };
+ };
+ put?: never;
+ /**
+ * Create a new list
+ * @description Create a new list
+ */
+ post: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** @description The list to create */
+ requestBody?: {
+ content: {
+ "application/json": {
+ name: string;
+ icon: string;
+ parentId?: string | null;
+ };
+ };
+ };
+ responses: {
+ /** @description The created list */
+ 201: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["List"];
+ };
+ };
+ };
+ };
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/lists/{listId}": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /**
+ * Get a single list
+ * @description Get list by its id
+ */
+ get: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ listId: components["parameters"]["ListId"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Object with list data. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["List"];
+ };
+ };
+ };
+ };
+ put?: never;
+ post?: never;
+ /**
+ * Delete a list
+ * @description Delete list by its id
+ */
+ delete: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ listId: components["parameters"]["ListId"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description No content - the bookmark was deleted */
+ 204: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content?: never;
+ };
+ };
+ };
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/list/{listId}": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ get?: never;
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ /**
+ * Update a list
+ * @description Update list by its id
+ */
+ patch: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ listId: components["parameters"]["ListId"];
+ };
+ cookie?: never;
+ };
+ /** @description The data to update. Only the fields you want to update need to be provided. */
+ requestBody?: {
+ content: {
+ "application/json": {
+ name?: string;
+ icon?: string;
+ parentId?: string | null;
+ };
+ };
+ };
+ responses: {
+ /** @description The updated list */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["List"];
+ };
+ };
+ };
+ };
+ trace?: never;
+ };
+ "/lists/{listId}/bookmarks": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /**
+ * Get a bookmarks in a list
+ * @description Get the bookmarks in a list
+ */
+ get: {
+ parameters: {
+ query?: {
+ limit?: number;
+ cursor?: components["schemas"]["Cursor"];
+ };
+ header?: never;
+ path: {
+ listId: components["parameters"]["ListId"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Object with list data. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["PaginatedBookmarks"];
+ };
+ };
+ };
+ };
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/lists/{listId}/bookmarks/{bookmarkId}": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ get?: never;
+ /**
+ * Add a bookmark to a list
+ * @description Add the bookmarks to a list
+ */
+ put: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ listId: components["parameters"]["ListId"];
+ bookmarkId: components["parameters"]["BookmarkId"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description No content - the bookmark was added */
+ 204: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content?: never;
+ };
+ };
+ };
+ post?: never;
+ /**
+ * Remove a bookmark from a list
+ * @description Remove the bookmarks from a list
+ */
+ delete: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ listId: components["parameters"]["ListId"];
+ bookmarkId: components["parameters"]["BookmarkId"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description No content - the bookmark was added */
+ 204: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content?: never;
+ };
+ };
+ };
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/tags": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /**
+ * Get all tags
+ * @description Get all tags
+ */
+ get: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Object with all tags data. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ tags: components["schemas"]["Tag"][];
+ };
+ };
+ };
+ };
+ };
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/tags/{tagId}": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /**
+ * Get a single tag
+ * @description Get tag by its id
+ */
+ get: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ tagId: components["parameters"]["TagId"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Object with list data. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Tag"];
+ };
+ };
+ };
+ };
+ put?: never;
+ post?: never;
+ /**
+ * Delete a tag
+ * @description Delete tag by its id
+ */
+ delete: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ tagId: components["parameters"]["TagId"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description No content - the bookmark was deleted */
+ 204: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content?: never;
+ };
+ };
+ };
+ options?: never;
+ head?: never;
+ /**
+ * Update a tag
+ * @description Update tag by its id
+ */
+ patch: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ tagId: components["parameters"]["TagId"];
+ };
+ cookie?: never;
+ };
+ /** @description The data to update. Only the fields you want to update need to be provided. */
+ requestBody?: {
+ content: {
+ "application/json": {
+ name?: string;
+ };
+ };
+ };
+ responses: {
+ /** @description The updated tag */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Tag"];
+ };
+ };
+ };
+ };
+ trace?: never;
+ };
+ "/tags/{tagId}/bookmarks": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /**
+ * Get a bookmarks with the tag
+ * @description Get the bookmarks with the tag
+ */
+ get: {
+ parameters: {
+ query?: {
+ limit?: number;
+ cursor?: components["schemas"]["Cursor"];
+ };
+ header?: never;
+ path: {
+ tagId: components["parameters"]["TagId"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Object with list data. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["PaginatedBookmarks"];
+ };
+ };
+ };
+ };
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/highlights": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /**
+ * Get all highlights
+ * @description Get all highlights
+ */
+ get: {
+ parameters: {
+ query?: {
+ limit?: number;
+ cursor?: components["schemas"]["Cursor"];
+ };
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Object with all highlights data. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["PaginatedHighlights"];
+ };
+ };
+ };
+ };
+ put?: never;
+ /**
+ * Create a new highlight
+ * @description Create a new highlight
+ */
+ post: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** @description The highlight to create */
+ requestBody?: {
+ content: {
+ "application/json": {
+ bookmarkId: string;
+ startOffset: number;
+ endOffset: number;
+ /**
+ * @default yellow
+ * @enum {string}
+ */
+ color?: "yellow" | "red" | "green" | "blue";
+ text: string | null;
+ note: string | null;
+ };
+ };
+ };
+ responses: {
+ /** @description The created highlight */
+ 201: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Highlight"];
+ };
+ };
+ };
+ };
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/highlights/{highlightId}": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /**
+ * Get a single highlight
+ * @description Get highlight by its id
+ */
+ get: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ highlightId: components["parameters"]["HighlightId"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Object with highlight data. */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Highlight"];
+ };
+ };
+ };
+ };
+ put?: never;
+ post?: never;
+ /**
+ * Delete a highlight
+ * @description Delete highlight by its id
+ */
+ delete: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ highlightId: components["parameters"]["HighlightId"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The deleted highlight */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Highlight"];
+ };
+ };
+ };
+ };
+ options?: never;
+ head?: never;
+ /**
+ * Update a highlight
+ * @description Update highlight by its id
+ */
+ patch: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ highlightId: components["parameters"]["HighlightId"];
+ };
+ cookie?: never;
+ };
+ /** @description The data to update. Only the fields you want to update need to be provided. */
+ requestBody?: {
+ content: {
+ "application/json": {
+ /** @enum {string} */
+ color?: "yellow" | "red" | "green" | "blue";
+ };
+ };
+ };
+ responses: {
+ /** @description The updated highlight */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Highlight"];
+ };
+ };
+ };
+ };
+ trace?: never;
+ };
+}
+export type webhooks = Record<string, never>;
+export interface components {
+ schemas: {
+ /** @example ieidlxygmwj87oxz5hxttoc8 */
+ BookmarkId: string;
+ /** @example ieidlxygmwj87oxz5hxttoc8 */
+ ListId: string;
+ /** @example ieidlxygmwj87oxz5hxttoc8 */
+ TagId: string;
+ /** @example ieidlxygmwj87oxz5hxttoc8 */
+ HighlightId: string;
+ Bookmark: {
+ id: string;
+ createdAt: string;
+ title?: string | null;
+ archived: boolean;
+ favourited: boolean;
+ /** @enum {string|null} */
+ taggingStatus: "success" | "failure" | "pending" | null;
+ note?: string | null;
+ summary?: string | null;
+ tags: {
+ id: string;
+ name: string;
+ /** @enum {string} */
+ attachedBy: "ai" | "human";
+ }[];
+ content:
+ | {
+ /** @enum {string} */
+ type: "link";
+ url: string;
+ title?: string | null;
+ description?: string | null;
+ imageUrl?: string | null;
+ imageAssetId?: string | null;
+ screenshotAssetId?: string | null;
+ fullPageArchiveAssetId?: string | null;
+ videoAssetId?: string | null;
+ favicon?: string | null;
+ htmlContent?: string | null;
+ crawledAt?: string | null;
+ }
+ | {
+ /** @enum {string} */
+ type: "text";
+ text: string;
+ sourceUrl?: string | null;
+ }
+ | {
+ /** @enum {string} */
+ type: "asset";
+ /** @enum {string} */
+ assetType: "image" | "pdf";
+ assetId: string;
+ fileName?: string | null;
+ sourceUrl?: string | null;
+ }
+ | {
+ /** @enum {string} */
+ type: "unknown";
+ };
+ assets: {
+ id: string;
+ /** @enum {string} */
+ assetType:
+ | "screenshot"
+ | "bannerImage"
+ | "fullPageArchive"
+ | "video"
+ | "bookmarkAsset"
+ | "unknown";
+ }[];
+ };
+ PaginatedBookmarks: {
+ bookmarks: components["schemas"]["Bookmark"][];
+ nextCursor: string | null;
+ };
+ Cursor: string;
+ Highlight: {
+ bookmarkId: string;
+ startOffset: number;
+ endOffset: number;
+ /**
+ * @default yellow
+ * @enum {string}
+ */
+ color: "yellow" | "red" | "green" | "blue";
+ text: string | null;
+ note: string | null;
+ id: string;
+ userId: string;
+ createdAt: string;
+ };
+ List: {
+ id: string;
+ name: string;
+ icon: string;
+ parentId: string | null;
+ };
+ Tag: {
+ id: string;
+ name: string;
+ numBookmarks: number;
+ numBookmarksByAttachedType: {
+ ai?: number;
+ human?: number;
+ };
+ };
+ PaginatedHighlights: {
+ highlights: components["schemas"]["Highlight"][];
+ nextCursor: string | null;
+ };
+ };
+ responses: never;
+ parameters: {
+ BookmarkId: components["schemas"]["BookmarkId"];
+ ListId: components["schemas"]["ListId"];
+ TagId: components["schemas"]["TagId"];
+ HighlightId: components["schemas"]["HighlightId"];
+ };
+ requestBodies: never;
+ headers: never;
+ pathItems: never;
+}
+export type $defs = Record<string, never>;
+export type operations = Record<string, never>;
diff --git a/packages/sdk/src/index.ts b/packages/sdk/src/index.ts
new file mode 100644
index 00000000..7b148cc6
--- /dev/null
+++ b/packages/sdk/src/index.ts
@@ -0,0 +1,5 @@
+import createClient from "openapi-fetch";
+
+import type { paths } from "./hoarder-api.d.ts";
+
+export const createHoarderClient = createClient<paths>;
diff --git a/packages/sdk/tsconfig.json b/packages/sdk/tsconfig.json
new file mode 100644
index 00000000..bf344404
--- /dev/null
+++ b/packages/sdk/tsconfig.json
@@ -0,0 +1,15 @@
+{
+ "$schema": "https://json.schemastore.org/tsconfig",
+ "extends": "@hoarder/tsconfig/node.json",
+ "include": ["src", "vite.config.mts"],
+ "exclude": ["node_modules", "dist"],
+ "compilerOptions": {
+ "baseUrl": ".",
+ "tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json",
+ "strictNullChecks": true,
+ "paths": {
+ "@/*": ["./src/*"]
+ },
+ "types": ["vite/client"]
+ }
+}
diff --git a/packages/sdk/vite.config.mts b/packages/sdk/vite.config.mts
new file mode 100644
index 00000000..0bcccbd2
--- /dev/null
+++ b/packages/sdk/vite.config.mts
@@ -0,0 +1,18 @@
+// This file is shamelessly copied from immich's CLI vite config
+// https://github.com/immich-app/immich/blob/main/cli/vite.config.ts
+import { defineConfig } from "vite";
+import dts from "vite-plugin-dts";
+import tsconfigPaths from "vite-tsconfig-paths";
+
+export default defineConfig({
+ build: {
+ rollupOptions: {
+ input: "src/index.ts",
+ output: {
+ dir: "dist",
+ },
+ },
+ ssr: true,
+ },
+ plugins: [tsconfigPaths(), dts({ rollupTypes: true, copyDtsFiles: true })],
+});