Skip to content

Commit

Permalink
Update src/endpoint/timeline.md
Browse files Browse the repository at this point in the history
Co-authored-by: Tatsuto YAMAMOTO <[email protected]>
  • Loading branch information
m1sk9 and laminne committed Jul 17, 2024
1 parent 1b55d43 commit 705debf
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 75 deletions.
8 changes: 4 additions & 4 deletions src/endpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ Pulsate v0 APIでは殆どのエンドポイントで資格情報が必要であ

エンドポイントへアクセスするときの`Authorization` HTTPヘッダーに

```json
```text
Bearer <token>
```

の形式で [認証トークン](./model.md#認証トークン) をつけて送信する必要がある.

例:

```json
```text
Bearer
```

Expand Down Expand Up @@ -117,13 +117,13 @@ Unicodeで規定された文字以外のデータを表現するときの記法
のスキームである`acct:`を取り除き, `@`に置き換えたもの
- 例: アカウント名が `@[email protected]`である場合

```json
```text
<@[email protected]>
```

- 宛先のホスト名(FQDN)は **省略不可**

```md
```text
<@[email protected]> <@[email protected]> <@[email protected]>
```

Expand Down
34 changes: 16 additions & 18 deletions src/endpoint/notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -592,12 +592,10 @@ body: `application/json`

`reactions`:

| 項目名 || 説明 ||
| ---------------------------------------------------------------------------------- | ------------------ | ---------------------------- | ---------- |
| emoji | `string` | 絵文字 | |
| 表記法は [Untitled](https://www.notion.so/74411becb886427fb512a32d523d6faf) を参照 | `<:alias:11938437` | | |
| `🎉` | | | |
| reacted_by | `snowflake` | リアクションしたアカウントID | `48499372` |
| 項目名 || 説明 ||
| ---------- | ----------- | ------------------------------------------------------------------- | ------------------------- |
| emoji | `string` | 絵文字. 表記法は [絵文字の扱い](../endpoint.md#絵文字の扱い) を参照 | `🎉`, `<:alias:11938437>` |
| reacted_by | `snowflake` | リアクションしたアカウントID | `48499372` |

**`400`** **`Bad Request`**

Expand Down Expand Up @@ -739,12 +737,12 @@ body: `application/json`

`reactions`:

| 項目名 || 説明 ||
| ---------------------------------------------------------------------------------- | ------------------ | ---------------------------- | ---------- |
| emoji | `string` | 絵文字 | |
| 表記法は [Untitled](https://www.notion.so/74411becb886427fb512a32d523d6faf) を参照 | `<:alias:11938437` | | |
| `🎉` | | | |
| reacted_by | `snowflake` | リアクションしたアカウントID | `48499372` |
| 項目名 || 説明 ||
| ----------------------------------------------------------- | ------------------ | ---------------------------- | ---------- |
| emoji | `string` | 絵文字 | |
| 表記法は [絵文字の扱い](../endpoint.md#絵文字の扱い) を参照 | `<:alias:11938437` | | |
| `🎉` | | | |
| reacted_by | `snowflake` | リアクションしたアカウントID | `48499372` |

**`404 Not Found`**

Expand Down Expand Up @@ -806,9 +804,9 @@ body: `application/json`
| blur | `string` | 添付ファイルが画像であるときのサムネイルの [blurhash](https://blurha.sh/) | | |
| nsfw | `boolean` | ToDo | | |

| 項目名 || 説明 ||
| ---------------------------------------------------------------------------------- | ------------------ | ---------------------------- | ---------- |
| emoji | `string` | 絵文字 | |
| 表記法は [Untitled](https://www.notion.so/74411becb886427fb512a32d523d6faf) を参照 | `<:alias:11938437` | | |
| `🎉` | | | |
| reacted_by | `snowflake` | リアクションしたアカウントID | `48499372` |
| 項目名 || 説明 ||
| ----------------------------------------------------------- | ------------------ | ---------------------------- | ---------- |
| emoji | `string` | 絵文字 | |
| 表記法は [絵文字の扱い](../endpoint.md#絵文字の扱い) を参照 | `<:alias:11938437` | | |
| `🎉` | | | |
| reacted_by | `snowflake` | リアクションしたアカウントID | `48499372` |
6 changes: 3 additions & 3 deletions src/endpoint/timeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
### 入力

- パスパラメータ
- `timeline_type`: ```string``, `undefined``
- `timeline_type`: `string`, `undefined`
- とり得る値: `home` / `global`
- デフォルト: `home`
- クエリパラメータ
Expand All @@ -22,7 +22,7 @@
- `no_nsfw` : `bool | undefined`
- デフォルト: `false`
- NSFWフラグの立っているファイルを含む投稿を返さなくなります
- `before_id` : ``snowflake`| undefined`
- `before_id` : `snowflake| undefined`
- デフォルト: `undefined`
- ~~デフォルトでは現在取得できる最新の投稿から20件取得します.~~
- 指定したIDより古い投稿を返します.指定したIDの投稿は含まれません
Expand Down Expand Up @@ -112,7 +112,7 @@
- `no_nsfw` : `bool | undefined`
- デフォルト: `false`
- NSFWフラグの立っているファイルを1つでも含む投稿を返さなくなります
- `before_id` : ``snowflake`| undefined`
- `before_id` : `snowflake`| undefined`
- デフォルト: `undefined`
- デフォルトでは現在取得できる最新の投稿から20件取得します.
- 指定したIDより古い投稿を返します.指定したIDの投稿は含まれません
Expand Down
3 changes: 2 additions & 1 deletion src/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

<!-- toc -->

Pulsate Specification は Pulsate プロジェクトに関する APIエンドポイントや設計などの仕様を記述したドキュメントです.
<!-- deno-fmt-ignore -->
Pulsate Specification は Pulsate プロジェクトに関するAPIエンドポイントや設計などの仕様を記述したドキュメントです.

プロジェクトの概要については [こちら](./project.md) をご覧ください.

Expand Down
26 changes: 0 additions & 26 deletions src/model.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,29 +224,3 @@ Pulsate に対して送信されたユーザー生成コンテンツのエンテ
以下の属性が関連付けられます.

(wip)

# タイムライン

[アカウント関係](#アカウント関係)[検索述語](#検索述語) をベースに,
ページネーションされた [投稿](#投稿)
のコレクションを高速に取得するためのモデルです.

まず, この Pulsate システム全体で (Redis のようなインメモリ DB 内に)
検索述語をキーとした大きな木構造を構築します. それらによる投稿 ID
コレクションのフィルタ結果が常に全アカウント間で共有されます.

その木におけるノードでは, 要素数が 1000 以下の投稿 ID コレクションを保持します.

この木の更新は,
誰かがタイムラインの作成および条件の編集を行ったタイミングで変更プランが保持され,
一定時間ごとに履行されます.

## 投稿 ID コレクション

投稿 ID コレクションは, 投稿 ID を時系列データとしてページネーション &
ランダムアクセスできるキューを実現します.
対数時間以内に挿入とクエリができるデータ構造で構築します.

タイムラインとしての投稿 ID リストを取得するときは,
そのパラメータである検索述語に最も近い ID コレクションを取得しつつ,
取得後に細かい条件で別途フィルタします.
23 changes: 0 additions & 23 deletions src/module.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,3 @@ TimelineModule ->> ActivityPubModule: 投稿作成イベント発火

- ActivityPubを経由した外部サーバーへのノート配送を行う.
- ActivityPubを経由したノートの受信を行う.

## モジュール間通信

- Accountモジュールのモジュール間通信用サービスはこのように書く.
- `pkg/intermodule/<モジュール名>.ts`のようなファイル名をつける.

```ts
import { type Result } from "@mikuroxina/mini-fn";

import { type Account, type AccountName } from "../accounts/model/account.js";
import type { FetchAccountService } from "../accounts/service/fetchAccount.js";

// Accountモジュールの他モジュールに対して公開するメソッド
export class AccountModule {
constructor(private readonly fetchAccountService: FetchAccountService) {}

async fetchAccount(
name: AccountName,
): Promise<Result.Result<Error, Account>> {
return await this.fetchAccountService.fetchAccount(name);
}
}
```

0 comments on commit 705debf

Please sign in to comment.