Skip to content

Commit

Permalink
docs: update
Browse files Browse the repository at this point in the history
  • Loading branch information
rxliuli committed Jan 14, 2025
1 parent 81bcc2d commit d3ed821
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 21 deletions.
Empty file removed packages/joplin-api/.nojekyll
Empty file.
74 changes: 71 additions & 3 deletions packages/joplin-api/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,73 @@
# joplin api
# joplin-api

A JavaScript wrapper for the Joplin API written in TypeScript. It provides complete type definitions and covers all currently documented APIs.
[![npm version](https://badge.fury.io/js/joplin-api.svg)](https://www.npmjs.com/package/joplin-api)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Official documentation: <https://joplinapp.org/help/api/references/rest_api/>
A JavaScript wrapper library for accessing the Joplin Data API, providing type-safe and intuitive interfaces.

## Features

- 🚀 Support multiple runtime environments: Browser, NodeJS and Joplin plugin
- 📦 Complete TypeScript type definitions
- 🔒 Type-safe API calls
- 📚 Compliant with official API specifications

## Installation

```bash
npm install joplin-api
# or
yarn add joplin-api
# or
pnpm add joplin-api
```

## Quick Start

### REST API Mode (Browser/NodeJS)

```typescript
import { joplinDataApi } from 'joplin-api'

const api = joplinDataApi({
type: 'rest',
token: 'your-token-here',
baseUrl: 'http://localhost:41184',
})

// Get note list
const notes = await api.note.list()
console.log(notes)
```

### Plugin Mode (Joplin Plugin)

```typescript
import { joplinDataApi } from 'joplin-api'

const api = joplinDataApi({
type: 'plugin',
})

// API call example
const notes = await api.note.list()
```

## Documentation

For complete API documentation, please refer to:

- [Joplin Official REST API Documentation](https://joplinapp.org/help/api/references/rest_api/)
- [Project TypeScript Type Definitions](https://joplin-utils.rxliuli.com/en-US/api/joplin-api/)

## Contributing

Issues and Pull Requests are welcome!

## License

MIT License

---

> 📝 Note: To use REST API mode, you need to enable Web Clipper service in Joplin settings and obtain an authorization token first.
4 changes: 0 additions & 4 deletions packages/joplin-api/src/model/PageData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ export interface PageParam<T> {
order_dir?: 'ASC' | 'DESC'
}

/**
* 分页返回数据
* @link https://joplinapp.org/api/references/rest_api/#pagination
*/
export interface PageRes<T> {
has_more: boolean
items: T[]
Expand Down
24 changes: 10 additions & 14 deletions packages/website/docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ export default defineConfig({
text: 'Joplin Batch',
link: '/en-US/joplin-batch/',
},
{
text: 'Joplin Batch Web(Legacy)',
link: '/en-US/joplin-batch-web/',
},
{
text: 'API',
items: typedocSidebar,
Expand Down Expand Up @@ -117,10 +113,6 @@ export default defineConfig({
text: 'Joplin Batch',
link: '/zh-CN/joplin-batch/',
},
{
text: 'Joplin Batch Web(Legacy)',
link: '/zh-CN/joplin-batch-web/',
},
{
text: 'API',
items: typedocSidebar,
Expand All @@ -132,16 +124,20 @@ export default defineConfig({
themeConfig: {
search: { provider: 'local' },
logo: '/images/logo.svg',
nav: [
{
text: 'GitHub',
link: 'https://github.com/rxliuli/joplin-utils',
},
],
footer: {
message: 'Released under the MIT License.',
copyright: 'Copyright © 2021-present rxliuli',
},
socialLinks: [
{
icon: 'github',
link: 'https://github.com/rxliuli/joplin-utils',
},
{
icon: 'twitter',
link: 'https://x.com/moeruri',
},
],
},
head: [
['link', { rel: 'icon', href: '/images/logo.svg' }],
Expand Down

0 comments on commit d3ed821

Please sign in to comment.