Skip to content

Commit 21f2d94

Browse files
doc: バージョン0.0.2-betaのリリースの為docとpubspec更新
1 parent ff72a72 commit 21f2d94

3 files changed

Lines changed: 38 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.0.2-beta] - 2025-08-19
9+
10+
### Added
11+
- Expose `MisskeyHttpClient.baseUrl` (original base, before `/api` normalization).
12+
- Add `exceptionMapper` hook to `MisskeyHttpClient` to customize thrown exceptions.
13+
- Add `loggerFn` (function-style logger) accepted by `MisskeyHttpClient` and adapt to existing `Logger` interface.
14+
- `MetaClient.getMeta({bool refresh = false})` to force-refresh cache when needed.
15+
16+
### Changed
17+
- Generalize `TokenProvider` to `FutureOr<String?> Function()` to support both sync/async token sources.
18+
819
## [0.0.1-beta] - 2025-08-18
920

1021
### Added

README.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ Misskey API Core is a Dart/Flutter package that provides the core building block
99
### Key Features
1010

1111
- HTTP foundation: base URL handling (/api), timeouts, idempotent retries (429/5xx/network), request/response logging (debug-only)
12+
- Base URL exposure: access original base URL via `client.baseUrl` for derived services
1213
- Auth token injection: automatically injects `i` into POST JSON bodies when `authRequired` is true
14+
- Flexible token providers: support both sync and async token sources via `FutureOr<String?>`
1315
- Unified error: normalize Misskey error response to `MisskeyApiException(statusCode/code/message)`
16+
- Customizable error handling: map exceptions via `exceptionMapper` for unified error policies
17+
- Flexible logging: use `loggerFn` for function-style logging or existing `Logger` interface
1418
- Meta capability: `/api/meta` client with a tiny cache and `supports()` helper
19+
- Meta refresh: force-refresh cached meta data with `getMeta(refresh: true)`
1520
- JSON serialization: `json_serializable`-ready common model(s)
1621

1722
### Install
@@ -20,7 +25,7 @@ Add to `pubspec.yaml`:
2025

2126
```yaml
2227
dependencies:
23-
misskey_api_core: ^0.0.1-beta
28+
misskey_api_core: ^0.0.2-beta
2429
```
2530
2631
Then:
@@ -41,18 +46,24 @@ void main() async {
4146
timeout: const Duration(seconds: 10),
4247
enableLog: true, // logs only in debug mode
4348
),
44-
tokenProvider: () async => 'YOUR_TOKEN',
49+
tokenProvider: () async => 'YOUR_TOKEN', // or sync: () => 'TOKEN'
4550
);
4651
4752
// Fetch meta (no auth)
4853
final meta = await MetaClient(client).getMeta();
54+
55+
// Force refresh meta data
56+
final freshMeta = await MetaClient(client).getMeta(refresh: true);
4957
5058
// Example POST (token `i` will be injected automatically)
5159
final res = await client.send<List<dynamic>>(
5260
'/notes/timeline',
5361
body: {'limit': 10},
5462
options: const RequestOptions(idempotent: true),
5563
);
64+
65+
// Access base URL for derived services (e.g., streaming)
66+
final origin = client.baseUrl;
5667
}
5768
```
5869

@@ -73,9 +84,14 @@ Misskey API Core は、Misskeyサーバーと連携するためのDart/Flutter
7384
### 機能
7485

7586
- HTTP基盤: ベースURL(/api付与)・タイムアウト・冪等時の自動リトライ(429/5xx/ネットワーク)・デバッグ時のみログ
87+
- ベースURL公開: `client.baseUrl` で元URLにアクセス(派生サービス用)
7688
- 認証: POSTのJSONボディに `i` を自動注入(`authRequired`で制御)
89+
- 柔軟なトークン供給: 同期・非同期両方に対応(`FutureOr<String?>`
7790
- 共通例外: Misskeyのエラーを `MisskeyApiException(statusCode/code/message)` に正規化
91+
- カスタマイズ可能な例外処理: `exceptionMapper` で例外を一元変換
92+
- 柔軟なログ出力: 関数ベースロガー(`loggerFn`)または既存Logger IF
7893
- メタ/能力検出: `/api/meta` の取得と簡易キャッシュ、`supports()` ヘルパー
94+
- メタ更新: `getMeta(refresh: true)` でキャッシュを強制更新
7995
- JSONシリアライズ: `json_serializable`対応の共通モデル
8096

8197
### インストール
@@ -84,7 +100,7 @@ Misskey API Core は、Misskeyサーバーと連携するためのDart/Flutter
84100

85101
```yaml
86102
dependencies:
87-
misskey_api_core: ^0.0.1-beta
103+
misskey_api_core: ^0.0.2-beta
88104
```
89105
90106
実行:
@@ -104,18 +120,24 @@ final client = MisskeyHttpClient(
104120
timeout: const Duration(seconds: 10),
105121
enableLog: true, // デバッグ時のみ
106122
),
107-
tokenProvider: () async => 'YOUR_TOKEN',
123+
tokenProvider: () async => 'YOUR_TOKEN', // または同期: () => 'TOKEN'
108124
);
109125
110126
// 認証不要
111127
final meta = await MetaClient(client).getMeta();
112128
129+
// メタデータを強制更新
130+
final freshMeta = await MetaClient(client).getMeta(refresh: true);
131+
113132
// 読み取り系POST(`i`は自動注入)
114133
final list = await client.send<List<dynamic>>(
115134
'/notes/timeline',
116135
body: {'limit': 10},
117136
options: const RequestOptions(idempotent: true),
118137
);
138+
139+
// 派生サービス用にベースURLにアクセス(例: ストリーミング)
140+
final origin = client.baseUrl;
119141
```
120142

121143
サンプルアプリ(`/example`)では、`misskey_auth` を使った認証、ノート投稿、ホームタイムライン、フォロー中/フォロワーの取得まで一通り確認できます。

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: misskey_api_core
22
description: "A library to make it easy to use the Misskey API in your Flutter and Dart apps."
3-
version: 0.0.1-beta
3+
version: 0.0.2-beta
44
homepage: https://librarylibrarian.com/
55
repository: https://github.com/LibraryLibrarian/misskey_api_core
66
issue_tracker: https://github.com/LibraryLibrarian/misskey_api_core/issues

0 commit comments

Comments
 (0)