File tree Expand file tree Collapse file tree 23 files changed +802
-749
lines changed Expand file tree Collapse file tree 23 files changed +802
-749
lines changed Original file line number Diff line number Diff line change 1+ import type {
2+ CommitId ,
3+ LineId ,
4+ PageId ,
5+ StringLc ,
6+ UnixTime ,
7+ UserId ,
8+ } from "../../../base.ts" ;
9+ import type {
10+ ChangeLine ,
11+ CharsCountChange ,
12+ DeleteChange ,
13+ DescriptionsChange ,
14+ FilesChange ,
15+ HelpFeelsChange ,
16+ ImageChange ,
17+ InfoboxDefinitionChange ,
18+ InsertChange ,
19+ LinesCountChange ,
20+ PinChange ,
21+ } from "../../../change.ts" ;
22+
23+ /** the response type of /api/commits/:projectname/:pageid */
24+ export interface CommitsResponse {
25+ /** 指定したページのcommits */
26+ commits : Commit [ ] ;
27+ }
28+
29+ /** Scrapboxのページの編集commit */
30+ export interface Commit {
31+ id : CommitId ;
32+
33+ /** 一つ前のcommitのID
34+ *
35+ * 存在しないときは`null`になる
36+ */
37+ parentId : CommitId | null ;
38+
39+ pageId : PageId ;
40+
41+ /** commitの作成者 */
42+ userId : UserId ;
43+
44+ /** commitの作成日時 */
45+ created : UnixTime ;
46+
47+ /** 変更内容 */
48+ changes : Change [ ] ;
49+
50+ /** 詳細不明 */
51+ kind : "page" ;
52+ }
53+ /** ページの変更内容 */
54+ export type Change =
55+ | InsertChange
56+ | UpdateChange
57+ | DeleteChange
58+ | LinksChange
59+ | ProjectLinksChange
60+ | IconsChange
61+ | DescriptionsChange
62+ | ImageChange
63+ | FilesChange
64+ | HelpFeelsChange
65+ | InfoboxDefinitionChange
66+ | TitleChange
67+ | LinesCountChange
68+ | CharsCountChange
69+ | PinChange ;
70+
71+ /** 既存の行を書き換える変更 */
72+ export interface UpdateChange {
73+ /** 書き換える行のID */
74+ _update : LineId ;
75+
76+ /** 行の変更内容 */
77+ lines : ChangeLine ;
78+ }
79+
80+ /** ページ中のリンクが変更されると発生する */
81+ export interface LinksChange {
82+ /** 新しいリンク */
83+ links : string [ ] ;
84+
85+ /** 新しいリンク */
86+ linksLc : StringLc [ ] ;
87+ }
88+
89+ /** ページ中のproject linksが変更されると発生する */
90+ export interface ProjectLinksChange {
91+ /** 新しいリンク */
92+ projectLinks : string [ ] ;
93+
94+ /** 新しいリンク */
95+ projectLinksLc : StringLc [ ] ;
96+ }
97+
98+ /** ページ中のiconsが変更されると発生する */
99+ export interface IconsChange {
100+ /** 新しいicons */
101+ icons : string [ ] ;
102+
103+ /** 新しいicons */
104+ iconsLc : StringLc [ ] ;
105+ }
106+
107+ /** ページのタイトルが変更されると発生する */
108+ export interface TitleChange {
109+ /** 新しいタイトル */
110+ title : string ;
111+
112+ /** 新しいタイトル */
113+ titleLc : StringLc ;
114+ }
Original file line number Diff line number Diff line change 1+ /** the response type of /api/embed-text/twitter */
2+ export interface TweetInfo {
3+ /** Tweet本文 */
4+ description ?: string ;
5+
6+ /** Tweet投稿者の表示名 */
7+ screenName : string ;
8+
9+ /** Tweetに添付された画像 */
10+ images : string [ ] ;
11+ }
Original file line number Diff line number Diff line change 1+ import type { BaseLine , UnixTime } from "../../../base.ts" ;
2+ import type { Page , UserInfo } from "../../pages/project/title.ts" ;
3+
4+ /** exportしたときのページデータ */
5+ export interface ExportedPage < hasMetadata extends true | false = false >
6+ extends Pick < Page , "title" | "updated" | "created" | "id" | "views" > {
7+ /** ページ本文
8+ *
9+ * `hasMetadata === true`のときは行のmetadataが入る
10+ * それ以外の場合は行のテキストが入る
11+ */
12+ lines : hasMetadata extends true ? Omit < BaseLine , "id" > [ ] : string [ ] ;
13+ }
14+
15+ /** JSON data exported from https://scrapbox.io/api/page-data/export/:projectname.json */
16+ export interface ExportedData < hasMetadata extends true | false = false > {
17+ /** project's name */
18+ name : string ;
19+
20+ /** project's display name */
21+ displayName : string ;
22+
23+ /** このデータを生成した日時 (UNIX時刻) */
24+ exported : UnixTime ;
25+
26+ /** project members */
27+ users : UserForExport [ ] ;
28+
29+ /** exported pages */
30+ pages : ExportedPage < hasMetadata > [ ] ;
31+ }
32+
33+ /** user infomation included in exported data */
34+ export interface UserForExport
35+ extends Pick < UserInfo , "id" | "name" | "displayName" | "email" > { }
Original file line number Diff line number Diff line change 1+ import type { UnixTime } from "../../../base.ts" ;
2+
3+ /** JSON data for importing by https://scrapbox.io/api/page-data/import/:projectname.json */
4+ export interface ImportedData < hasMetadata extends true | false = false > {
5+ /** pages importing to a project */
6+ pages : hasMetadata extends true ? ImportedPage [ ] : ImportedLightPage [ ] ;
7+ }
8+
9+ /** メタデータ無しインポート用ページデータ */
10+ export interface ImportedLightPage {
11+ /** page's title
12+ *
13+ * `title` should be equal to `lines[0]`
14+ */
15+ title : string ;
16+
17+ /** page's text
18+ *
19+ * `lines[0]` should be equal to `title`
20+ */
21+ lines : string [ ] ;
22+ }
23+ /** インポート用メタデータ付き行データ */
24+ export interface ImportedLine {
25+ /** line text */
26+ text : string ;
27+
28+ /** 行の最終更新日時 (UNIX時刻) */
29+ updated ?: UnixTime ;
30+
31+ /** 行の最終作成日時 (UNIX時刻) */
32+ created ?: UnixTime ;
33+ }
34+ /** メタデータ付きインポート用ページデータ */
35+ export interface ImportedPage {
36+ /** page's title
37+ *
38+ * `title` should be equal to `lines[0].text`
39+ */
40+ title : string ;
41+
42+ /** page's line data
43+ *
44+ * `lines[0].text` should be equal to `title`
45+ */
46+ lines : ImportedLine [ ] ;
47+ }
Original file line number Diff line number Diff line change 1+ import type { PageId , UnixTime } from "../../../base.ts" ;
2+
3+ /** the response type of /api/page-snapshots/:projectname/:pageid */
4+ export interface PageSnapshotList {
5+ pageId : PageId ;
6+
7+ /** 作成されているsnapshotsのtimestamp idのリスト */
8+ timestamps : SnapshotTimestamp [ ] ;
9+ }
10+
11+ export interface SnapshotTimestamp {
12+ id : string ;
13+ created : UnixTime ;
14+ }
Original file line number Diff line number Diff line change 1+ import type { BaseLine , BasePage , UnixTime } from "../../../../base.ts" ;
2+ import type { User } from "../../../pages/project/title.ts" ;
3+
4+ /** the response type of /api/page-snapshots/:projectname/:pageid/:timestampid */
5+ export interface PageSnapshotResult {
6+ page : PageWithSnapshot ;
7+
8+ snapshot : Snapshot ;
9+ }
10+
11+ export interface PageWithSnapshot extends BasePage {
12+ user : Pick < User , "id" > ;
13+ lastupdateUser : Pick < User , "id" > | null ;
14+ }
15+
16+ /** a page snapshot */
17+ export interface Snapshot {
18+ /** snapshotを撮ったときのページタイトル */
19+ title : string ;
20+
21+ /** snapshotの作成日時 */
22+ created : UnixTime ;
23+
24+ /** snapshotしたページ本文 */
25+ lines : BaseLine [ ] ;
26+ }
Original file line number Diff line number Diff line change 1+ import type { BasePage } from "../../base.ts" ;
2+
3+ /** the response type of https://scrpabox.io/api/pages/:projectname */
4+ export interface PageList {
5+ /** data取得先のproject名 */
6+ projectName : string ;
7+
8+ /** parameterに渡したskipと同じ */
9+ skip : number ;
10+
11+ /** parameterに渡したlimitと同じ */
12+ limit : number ;
13+
14+ /** projectの全ページ数 (中身のないページを除く) */
15+ count : number ;
16+
17+ /** 取得できたページ情報 */
18+ pages : BasePage [ ] ;
19+ }
Original file line number Diff line number Diff line change 1+ import type { FoundPage , SearchResult } from "./query.ts" ;
2+
3+ /** the response type of /api/pages/:projectname/search/files */
4+ export interface FileSearchResult
5+ extends Omit < SearchResult , "field" | "pages" > {
6+ /** 見つかったページ */
7+ pages : FoundPageByFile [ ] ;
8+ }
9+
10+ /** /api/pages/:projectname/search/files で見つかったページ */
11+ export interface FoundPageByFile extends FoundPage {
12+ file : string ;
13+ }
Original file line number Diff line number Diff line change 1+ import type { PageId } from "../../../../base.ts" ;
2+
3+ /** the response type of /api/pages/:projectname/search/query */
4+ export interface SearchResult {
5+ /** 検索したprojectの名前 */
6+ projectName : string ;
7+
8+ /** 検索文字列 */
9+ searchQuery : string ;
10+
11+ /** 検索語句 */
12+ query : SearchQuery ;
13+
14+ /** 検索件数の上限 */
15+ limit : number ;
16+
17+ /** 検索件数 */
18+ count : number ;
19+
20+ /** 検索文字列と完全一致するタイトルが見つかったら`true` */
21+ existsExactTitleMatch : boolean ;
22+
23+ field : "title" | "helpfeels" | "lines" ;
24+
25+ /** 全文検索エンジンの名前 */
26+ backend : string ;
27+
28+ /** 見つかったページ */
29+ pages : FoundPage [ ] ;
30+ }
31+
32+ /** /api/pages/:projectname/search/query で見つかったページ */
33+ export interface FoundPage {
34+ id : PageId ;
35+
36+ /** page title */
37+ title : string ;
38+
39+ /** page thumbnail
40+ *
41+ * 無いときは空文字が入る
42+ */
43+ image : string ;
44+
45+ /** 検索語句の中で、このページに含まれている語句 */
46+ words : string [ ] ;
47+
48+ /** 検索語句に一致した行
49+ *
50+ * タイトル行のみが一致した場合は、検索語句の有無にかかわらずその次の行のみが入る
51+ */
52+ lines : string [ ] ;
53+ }
54+
55+ /** 検索クエリ */
56+ export interface SearchQuery {
57+ /** AND検索に使う語句 */
58+ words : string [ ] ;
59+
60+ /** NOT検索に使う語句 */
61+ excludes : string [ ] ;
62+ }
Original file line number Diff line number Diff line change 1+ import type { BasePage } from "../../../../base.ts" ;
2+
3+ /** the response type of https://scrapbox.io/api/pages/:projectname/search/titles */
4+ export interface SearchedTitle
5+ extends Pick < BasePage , "id" | "title" | "updated" > {
6+ /** thumbnail URL */
7+ image ?: string ;
8+
9+ /** ページ内のリンク */
10+ links : string [ ] ;
11+ }
You can’t perform that action at this time.
0 commit comments