Skip to content

Commit

Permalink
Merge pull request #51 from takker99:project
Browse files Browse the repository at this point in the history
feat: Keep up with the latest scrapbox REST API types
  • Loading branch information
takker99 authored Jul 14, 2024
2 parents ce13eda + 90580b0 commit e13e63b
Showing 1 changed file with 52 additions and 11 deletions.
63 changes: 52 additions & 11 deletions response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,6 @@ export interface Project {

loginStrategies: string[];

theme: string;

gyazoTeamsName: string | null;

googleAnalyticsCode: string | null;

/** planの種類
*
* public projectの場合は`null`になる
Expand All @@ -215,11 +209,21 @@ export interface Project {
*/
plan?: string | null;

theme: string;

gyazoTeamsName: string | null;

translation: boolean;

infobox: boolean;

created: UnixTime;

updated: UnixTime;

isMember: boolean;

trialing: boolean;
}

/** the response type of /api/projects */
Expand All @@ -228,25 +232,26 @@ export interface ProjectResponse {
}

/** project information which isn't joined */
export interface NotMemberProject extends Omit<Project, "isMember"> {
export interface NotMemberProject
extends Omit<Project, "isMember" | "plan" | "trialing"> {
image?: string;

isMember: false;
}

/** project information which is joined */
export interface MemberProject extends Omit<NotMemberProject, "isMember"> {
export interface MemberProject extends Omit<Project, "isMember"> {
isMember: true;

plan?: string | null;
image?: string;

users: UserInfo[];

admins: UserId[];

owner: UserId;

trialing: boolean;
isUserPageExists: boolean;

trialMaxPages: number;

Expand All @@ -258,6 +263,8 @@ export interface MemberProject extends Omit<NotMemberProject, "isMember"> {

emailAddressPatterns: string[];

projectScript: boolean;

backuped: UnixTime | null;
}

Expand Down Expand Up @@ -420,6 +427,8 @@ export interface SearchResult {
/** 検索文字列と完全一致するタイトルが見つかったら`true` */
existsExactTitleMatch: boolean;

field: "title" | "helpfeels" | "lines";

/** 全文検索エンジンの名前 */
backend: string;

Expand Down Expand Up @@ -450,6 +459,18 @@ export interface FoundPage {
lines: string[];
}

/** the response type of /api/pages/:projectname/search/files */
export interface FileSearchResult
extends Omit<SearchResult, "field" | "pages"> {
/** 見つかったページ */
pages: FoundPageByFile[];
}

/** /api/pages/:projectname/search/files で見つかったページ */
export interface FoundPageByFile extends FoundPage {
file: string;
}

/** the response type of /api/projects/search/query and /api/projects/search/watch-list */
export interface ProjectSearchResult {
/** 検索文字列 */
Expand Down Expand Up @@ -495,13 +516,33 @@ export interface CommitsResponse {
}

/** the response type of /api/page-snapshots/:projectname/:pageid */
export interface PageSnapshot {
export interface PageSnapshotList {
pageId: PageId;

/** 作成されているsnapshotsのtimestamp idのリスト */
timestamps: SnapshotTimestamp[];

/** 作成されているsnapshots */
snapshots: Snapshot[];
}

export interface SnapshotTimestamp {
id: string;
created: UnixTime;
}

/** the response type of /api/page-snapshots/:projectname/:pageid/:timestampid */
export interface PageSnapshotResult {
page: PageWithSnapshot;

snapshot: Snapshot;
}

export interface PageWithSnapshot extends BasePage {
user: Pick<User, "id">;
lastupdateUser: Pick<User, "id"> | null;
}

/** a page snapshot */
export interface Snapshot {
/** snapshotを撮ったときのページタイトル */
Expand Down

0 comments on commit e13e63b

Please sign in to comment.