@pleasync/client
v0.1.0
Published
Pleasanter API client powered by Rust (napi-rs)
Maintainers
Readme
@pleasync/client
Pleasanter API クライアント。Rust (napi-rs) で実装された高速ネイティブバインディング。
インストール
npm install @pleasync/client使い方
基本
import { PleasanterClient } from '@pleasync/client'
const client = new PleasanterClient({
baseUrl: 'https://pleasanter.example.com',
apiKey: 'your-api-key',
apiVersion: '1.1',
})サイト操作
// サイト情報を取得
const site = await client.getSite(12345)
// サイト設定を更新
await client.updateSite(12345, { Title: '新しいタイトル' })レコード操作
// レコードを全件取得(自動ページネーション)
const records = await client.getRecords(67890)JSON 正規化
diff 安定化のためのユーティリティ。不要キー(UpdatedTime, CreatedTime, Creator, Updator, Guid, Ver)を除外し、キーをソートする。
import { normalize, sortedJsonStringify } from '@pleasync/client'
// 不要キー除外 + キーソート
const cleaned = normalize(rawJson)
// キーソートして文字列化(indent: 2)
const json = sortedJsonStringify(rawData, 2)API
new PleasanterClient(config)
| パラメータ | 型 | 必須 | 説明 |
|-----------|------|------|------|
| config.baseUrl | string | Yes | サーバー URL |
| config.apiKey | string | Yes | API キー |
| config.apiVersion | string | Yes | API バージョン(例: "1.1") |
メソッド
| メソッド | 戻り値 | 説明 |
|---------|--------|------|
| getSite(siteId) | Promise<any> | サイト情報を取得 |
| updateSite(siteId, data) | Promise<any> | サイト設定を更新 |
| getRecords(siteId) | Promise<any[]> | レコードを全件取得 |
ユーティリティ関数
| 関数 | 説明 |
|------|------|
| normalize(value) | 不要キー除外 + キーソート |
| sortedJsonStringify(value, indent?) | キーソートして JSON 文字列化 |
対応プラットフォーム
| OS | アーキテクチャ | |----|--------------| | Windows | x64 | | macOS | x64, ARM64 | | Linux | x64, ARM64 |
ライセンス
MIT
