実装:#4
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import InputError from "1.6.8/types/modules/error/input";
|
||||
import AuthError from "1.6.8/types/modules/error/auth";
|
||||
import Page from "1.6.8/types/modules/page";
|
||||
|
||||
export default interface AdminReports {
|
||||
"admin/reports/": {
|
||||
body?: Page;
|
||||
response: {
|
||||
/** 成功かどうか */
|
||||
success: true;
|
||||
/** 未解決の通報 */
|
||||
data: {
|
||||
/** 通報されたユーザーID */
|
||||
reported_userid: string;
|
||||
/** reported_useridへの通報数 */
|
||||
total_count: number;
|
||||
/** reported_useridへの通報内容 */
|
||||
details: {
|
||||
/** 通報のユニークID */
|
||||
uniqid: string;
|
||||
/** 通報者 */
|
||||
reporter_userid: string;
|
||||
/** メッセージ */
|
||||
message: string;
|
||||
/** 通報時刻 */
|
||||
datetime: string;
|
||||
}[]
|
||||
}[];
|
||||
} | InputError | AuthError;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
import InputError from "1.6.8/types/modules/error/input";
|
||||
import AuthError from "1.6.8/types/modules/error/auth";
|
||||
|
||||
export default interface AdminReportsResolve {
|
||||
"admin/reports/resolve": {
|
||||
body: {
|
||||
/** 対象のユーザーへの通報を全て解決済みにする場合の対象のユーザーID */
|
||||
reported_userid: string;
|
||||
} | {
|
||||
/** 特定の通報を解決済みにする場合の通報のユニークID */
|
||||
uniqid: string;
|
||||
};
|
||||
response: {
|
||||
/** 成功かどうか */
|
||||
success: true;
|
||||
/** 解決済みにした通報の宛先のユーザーID */
|
||||
reported_userid: string;
|
||||
} | InputError | AuthError | {
|
||||
/** 成功かどうか */
|
||||
success: false;
|
||||
/** エラーコード */
|
||||
error_code: "could_not_complete" | "db_error_update";
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
import { UserResponse } from "1.6.8/types/api/users";
|
||||
|
||||
export default interface AdminUsers {
|
||||
"admin/users/": {
|
||||
body: {
|
||||
/** ユーザーID */
|
||||
userid: string;
|
||||
};
|
||||
response: UserResponse & {
|
||||
/**
|
||||
* オンラインステータス
|
||||
* nullになることはなく、記録がない場合はOffline、非公開設定であっても入力されます。
|
||||
*/
|
||||
real_online_status: "Online" | "Away" | "Offline";
|
||||
/**
|
||||
* 最終利用時刻
|
||||
* YYYY-MM-DD HH:MM:SS形式です。
|
||||
*/
|
||||
last_login_datetime?: string;
|
||||
/** 最終利用IPアドレス */
|
||||
last_login_ipaddress?: string;
|
||||
/** メールアドレス */
|
||||
mailaddress?: string;
|
||||
/** 二段階認証を設定しているかどうか */
|
||||
is_2fa_configured: boolean;
|
||||
// last_login_*とメアドは任意かわからないので検証が必要
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,57 @@
|
||||
import InputError from "1.6.8/types/modules/error/input";
|
||||
import AuthError from "1.6.8/types/modules/error/auth";
|
||||
import { UserDataNotFound } from "1.6.8/types/modules/error/critical";
|
||||
|
||||
interface RequestBase<T extends string> {
|
||||
/** 対象のユーザーID */
|
||||
userid: T;
|
||||
}
|
||||
|
||||
interface Message {
|
||||
/** メッセージ */
|
||||
notification_message: string;
|
||||
}
|
||||
|
||||
type Notification<T extends string> = RequestBase<T> & Message & {
|
||||
/** 内容 */
|
||||
type: "notification";
|
||||
/** タイトル */
|
||||
notification_title: string;
|
||||
}
|
||||
|
||||
type Frozen<T extends string> = RequestBase<T> & Message & {
|
||||
/** 内容 */
|
||||
type: "frozen";
|
||||
}
|
||||
|
||||
type UnFrozen<T extends string> = RequestBase<T> & {
|
||||
/** 内容 */
|
||||
type: "unfrozen";
|
||||
}
|
||||
|
||||
type Ban<T extends string> = RequestBase<T> & {
|
||||
/** 内容 */
|
||||
type: "ban";
|
||||
/**
|
||||
* 確認文字列
|
||||
* トークンのユーザーのTOTPが有効な場合はTOTPコード、無効な場合はyes_i_will_delete_{対象のユーザーID}を入力してください。
|
||||
*/
|
||||
really: string;
|
||||
}
|
||||
|
||||
export default interface AdminUsersSanction<T extends string> {
|
||||
"admin/users/sanction": {
|
||||
body: Notification<T> | Frozen<T> | UnFrozen<T> | Ban<T>;
|
||||
response: {
|
||||
/** 成功かどうか */
|
||||
success: true;
|
||||
/** ユーザーID */
|
||||
userid: T;
|
||||
} | InputError | AuthError | UserDataNotFound | {
|
||||
/** 成功かどうか */
|
||||
success: false;
|
||||
/** エラーコード */
|
||||
error_code: "content_to_512_characters" | "content_to_16777216_characters" | "could_not_complete" | "already_been_completed" | "user_not_frozen_cant_be_banned";
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
import InputError from "1.6.8/types/modules/error/input";
|
||||
import AuthError from "1.6.8/types/modules/error/auth";
|
||||
|
||||
export default interface FavoriteChange {
|
||||
"favorite/change": {
|
||||
body: {
|
||||
/** ユーズのユニークID */
|
||||
uniqid: string;
|
||||
};
|
||||
response: {
|
||||
/** 成功かどうか */
|
||||
success: true;
|
||||
/** いいね後のいいねしたユーザー */
|
||||
favorite_list: string[];
|
||||
} | InputError | AuthError;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
import InputError from "1.6.8/types/modules/error/input";
|
||||
import AuthError from "1.6.8/types/modules/error/auth";
|
||||
|
||||
export default interface FavoriteGet {
|
||||
"favorite/get": {
|
||||
body: {
|
||||
/** ユーズのユニークID */
|
||||
uniqid: string;
|
||||
};
|
||||
response: {
|
||||
/** 成功かどうか */
|
||||
success: true;
|
||||
/** いいねしたユーザー */
|
||||
favorite_list: string[];
|
||||
} | InputError | AuthError;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
import ServerInfo from "1.6.8/types/api/serverinfo-api";
|
||||
import Users from "1.6.8/types/api/users";
|
||||
import UsersFollow from "1.6.8/types/api/users/follow";
|
||||
import Me from "1.6.8/types/api/me";
|
||||
import MeNotification from "1.6.8/types/api/me/notification";
|
||||
import MeNotificationRead from "1.6.8/types/api/me/notification/read";
|
||||
import MeSettings from "1.6.8/types/api/me/settings";
|
||||
import Ueuse from "1.6.8/types/api/ueuse";
|
||||
|
||||
export type ApiMap =
|
||||
& ServerInfo
|
||||
& Me
|
||||
& MeNotification
|
||||
& MeNotificationRead
|
||||
& MeSettings
|
||||
& Users
|
||||
& UsersFollow
|
||||
& Ueuse;
|
||||
@@ -0,0 +1,8 @@
|
||||
import { UserResponse } from "1.6.8/types/api/users";
|
||||
|
||||
export default interface Me {
|
||||
"me/": {
|
||||
body: never;
|
||||
response: UserResponse;
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,54 @@
|
||||
import InputError from "1.6.8/types/modules/error/input";
|
||||
import AuthError from "1.6.8/types/modules/error/auth";
|
||||
import Page from "1.6.8/types/modules/page";
|
||||
|
||||
export default interface MeNotification {
|
||||
"me/notification/": {
|
||||
body?: Page;
|
||||
response: {
|
||||
/** 成功かどうか */
|
||||
success: true;
|
||||
/** 通知 */
|
||||
data: {
|
||||
/** 送信元 */
|
||||
from: {
|
||||
/** ユーザー名(表示名) */
|
||||
username: string;
|
||||
/** ユーザーID */
|
||||
userid: string;
|
||||
/** アイコン画像URL */
|
||||
user_icon: string;
|
||||
/** ヘッダー画像URL */
|
||||
user_header: string;
|
||||
};
|
||||
/** カテゴリ */
|
||||
category: "system" | "favorite" |
|
||||
"reply" | "reuse" |
|
||||
"ueuse" | "follow" |
|
||||
"mention" | "other" |
|
||||
"login";
|
||||
/** タイトル */
|
||||
title: string;
|
||||
/** 内容 */
|
||||
text: string;
|
||||
/**
|
||||
* 送信時刻
|
||||
* YYYY-MM-DD HH:MM:SS形式です。
|
||||
*/
|
||||
datetime: string;
|
||||
/**
|
||||
* 関連するuniqid
|
||||
* 例えば、返信やリユーズ、メンションなどの場合に参照ユーズのuniqidが入ります。
|
||||
*/
|
||||
valueid?: string;
|
||||
/** 既読かどうか */
|
||||
is_checked: boolean;
|
||||
}[];
|
||||
} | InputError | AuthError | {
|
||||
/** 成功かどうか */
|
||||
success: false;
|
||||
/** エラーコード */
|
||||
error_code: "notification_not_found";
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
import InputError from "1.6.8/types/modules/error/input";
|
||||
import AuthError from "1.6.8/types/modules/error/auth";
|
||||
import UpdateError from "1.6.8/types/modules/error/update";
|
||||
|
||||
export default interface MeNotificationRead {
|
||||
"me/notification/read": {
|
||||
body: never;
|
||||
response: {
|
||||
/** 成功かどうか */
|
||||
success: true;
|
||||
} | InputError | AuthError | UpdateError;
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,62 @@
|
||||
import InputError from "1.6.8/types/modules/error/input";
|
||||
import AuthError from "1.6.8/types/modules/error/auth";
|
||||
import UpdateError from "1.6.8/types/modules/error/update";
|
||||
import { Upload1Error, Upload2Error, UploadCommonError } from "1.6.8/types/modules/error/upload";
|
||||
|
||||
type AtLeastOne<T> = {
|
||||
[K in keyof T]: Required<Pick<T, K>> & Partial<Omit<T, K>>
|
||||
}[keyof T];
|
||||
|
||||
type EmptyString = "";
|
||||
|
||||
type UsernameErrors<B> =
|
||||
B extends { username: EmptyString }
|
||||
? {
|
||||
success: false;
|
||||
error_code:
|
||||
| "表示名を入力してください。(USERNAME_INPUT_PLEASE)";
|
||||
}
|
||||
: B extends { username: string }
|
||||
? {
|
||||
success: false;
|
||||
error_code:
|
||||
| "ユーザーネームは50文字以内で入力してください。(USERNAME_OVER_MAX_COUNT)";
|
||||
}
|
||||
: never;
|
||||
|
||||
type ProfileErrors<B> =
|
||||
B extends { profile: string }
|
||||
? {
|
||||
success: false;
|
||||
error_code:
|
||||
| "プロフィールは1024文字以内で入力してください。(INPUT_OVER_MAX_COUNT)";
|
||||
}
|
||||
: never;
|
||||
|
||||
type Response<B> =
|
||||
| {
|
||||
/** 成功かどうか */
|
||||
success: true;
|
||||
}
|
||||
| InputError
|
||||
| AuthError
|
||||
| UpdateError
|
||||
| UploadCommonError
|
||||
| Upload1Error
|
||||
| Upload2Error
|
||||
| UsernameErrors<B>
|
||||
| ProfileErrors<B>;
|
||||
|
||||
export default interface MeSettings {
|
||||
"me/settings/": {
|
||||
body: AtLeastOne<{
|
||||
username: string | EmptyString;
|
||||
profile: string;
|
||||
icon: string;
|
||||
header: string;
|
||||
}>;
|
||||
response: Response<
|
||||
MeSettings["me/settings/"]["body"]
|
||||
>;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
export default interface ServerInfo {
|
||||
"serverinfo-api": {
|
||||
body: never;
|
||||
response: {
|
||||
server_info: {
|
||||
/** サーバー名 */
|
||||
server_name: string;
|
||||
/** サーバーアイコン画像URL */
|
||||
server_icon: string;
|
||||
/** サーバー説明文 */
|
||||
server_description: string;
|
||||
/** サーバー管理者 */
|
||||
adminstor: {
|
||||
/** 名前 */
|
||||
name: string;
|
||||
/** メールアドレス */
|
||||
email: string;
|
||||
};
|
||||
/** 利用規約URL */
|
||||
terms_url: string;
|
||||
/** プライバシーポリシーURL */
|
||||
privacy_policy_url: string;
|
||||
/** 最大文字数 */
|
||||
max_ueuse_length: number;
|
||||
/** 招待制である */
|
||||
invitation_code: boolean;
|
||||
/** アカウント移行が許可されている */
|
||||
account_migration: boolean;
|
||||
/** 統計 */
|
||||
usage: {
|
||||
/** ユーザー数 */
|
||||
users: number;
|
||||
/** ユーズ数 */
|
||||
ueuse: number;
|
||||
};
|
||||
};
|
||||
/** ソフトウェア */
|
||||
software: {
|
||||
/**
|
||||
* 名称
|
||||
* 公式uwuzuである場合はuwuzuです。
|
||||
* 改変uwuzuでかつその改変に名称がある場合はuwuzu以外です。
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* バージョン
|
||||
* vは入りません。
|
||||
*/
|
||||
version: string;
|
||||
/**
|
||||
* リポジトリURL
|
||||
* 公式uwuzuである場合はhttps://github.com/Daichimarukana/uwuzuです。
|
||||
* 改変uwuzuでかつその改変内容が公開されている場合は各リポジトリURLです。
|
||||
*/
|
||||
repository: string;
|
||||
};
|
||||
/** お知らせ */
|
||||
server_notice: {
|
||||
/** タイトル */
|
||||
title: string;
|
||||
/** 内容 */
|
||||
note: string;
|
||||
/** 作成者(ユーザーID) */
|
||||
editor: string;
|
||||
/**
|
||||
* 作成時刻
|
||||
* YYYY-MM-DD HH:MM:SS形式です。
|
||||
*/
|
||||
datetime: string;
|
||||
}[];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import InputError from "1.6.8/types/modules/error/input";
|
||||
import { UserDataNotFound } from "1.6.8/types/modules/error/critical";
|
||||
|
||||
export default interface TokenGet {
|
||||
"ueuse/get": {
|
||||
body: {
|
||||
/** api/authで使用したセッション */
|
||||
session: string;
|
||||
};
|
||||
response: {
|
||||
/** 成功かどうか */
|
||||
success: true;
|
||||
/** ユーザー名 */
|
||||
username: string;
|
||||
/** ユーザーID */
|
||||
userid: string;
|
||||
/** APIトークン */
|
||||
token: string;
|
||||
} | InputError | UserDataNotFound | {
|
||||
/** 成功かどうか */
|
||||
success: false;
|
||||
/** エラーコード */
|
||||
error_code: "session_invalid";
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
import InputError from "1.6.8/types/modules/error/input";
|
||||
import AuthError from "1.6.8/types/modules/error/auth";
|
||||
import { ueuseModule } from "1.6.8/types/modules/ueuse";
|
||||
import ueuseError from "1.6.8/types/modules/error/ueuse";
|
||||
import Page from "1.6.8/types/modules/page";
|
||||
|
||||
export default interface UeuseBookmark {
|
||||
"ueuse/bookmark/": {
|
||||
body?: Page;
|
||||
response: {
|
||||
/** 成功かどうか */
|
||||
success: true;
|
||||
/** ブックマークしているユーズ */
|
||||
data: ueuseModule[];
|
||||
} | InputError | AuthError | ueuseError;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
import InputError from "1.6.8/types/modules/error/input";
|
||||
import AuthError from "1.6.8/types/modules/error/auth";
|
||||
import { Media } from "1.6.8/types/modules/ueuse";
|
||||
|
||||
export default interface UeuseCreate {
|
||||
"ueuse/get": {
|
||||
body: {
|
||||
/** 本文 */
|
||||
text: string;
|
||||
/** NSFWにするかどうか */
|
||||
nsfw?: boolean;
|
||||
/** 返信先ユーズのユニークID */
|
||||
replyid?: string;
|
||||
/** リユーズ/引用元ユーズのユニークID */
|
||||
reuseid?: string;
|
||||
} & Media;
|
||||
response: {
|
||||
/** 成功かどうか */
|
||||
success: true;
|
||||
/** ユーズのユニークID */
|
||||
uniqid: string;
|
||||
/** ユーザーID */
|
||||
userid: string;
|
||||
} | InputError | AuthError | {
|
||||
/** 成功かどうか */
|
||||
success: false;
|
||||
/** エラーコード */
|
||||
error_code: "could_not_complete" | "upload_error" |
|
||||
"contains_prohibited_url" | "over_rate_limit" | string;
|
||||
// 文字数超過が動的なので補完+string
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,21 @@
|
||||
import InputError from "1.6.8/types/modules/error/input";
|
||||
import AuthError from "1.6.8/types/modules/error/auth";
|
||||
|
||||
interface ResponseBase<T extends string, S extends boolean> {
|
||||
/** 成功かどうか */
|
||||
success: S;
|
||||
/** ユーズのユニークID */
|
||||
uniqid: T;
|
||||
/** ユーザーID */
|
||||
userid: string;
|
||||
}
|
||||
|
||||
export default interface UeuseDelete<T extends string> {
|
||||
"ueuse/delete": {
|
||||
body: {
|
||||
/** ユーズのユニークID */
|
||||
uniqid: T;
|
||||
};
|
||||
response: ResponseBase<T, true> | InputError | AuthError | ResponseBase<T, false>;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
import InputError from "1.6.8/types/modules/error/input";
|
||||
import AuthError from "1.6.8/types/modules/error/auth";
|
||||
import { ueuseModule } from "1.6.8/types/modules/ueuse";
|
||||
import ueuseError from "1.6.8/types/modules/error/ueuse";
|
||||
|
||||
export default interface UeuseGet {
|
||||
"ueuse/get": {
|
||||
body: {
|
||||
/** 取得するユーズのユニークID */
|
||||
uniqid: string;
|
||||
};
|
||||
response: {
|
||||
/** 成功かどうか */
|
||||
success: true;
|
||||
/** ユーズ(要求したユーズのみ) */
|
||||
data: ueuseModule[];
|
||||
} | InputError | AuthError | ueuseError;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
import InputError from "1.6.8/types/modules/error/input";
|
||||
import AuthError from "1.6.8/types/modules/error/auth";
|
||||
import { ueuseModule } from "1.6.8/types/modules/ueuse";
|
||||
import ueuseError from "1.6.8/types/modules/error/ueuse";
|
||||
import Page from "1.6.8/types/modules/page";
|
||||
|
||||
export default interface Ueuse {
|
||||
"ueuse/": {
|
||||
body?: Page;
|
||||
response: {
|
||||
/** 成功かどうか */
|
||||
success: true;
|
||||
/** ユーズ(LTL) */
|
||||
data: ueuseModule[];
|
||||
} | InputError | AuthError | ueuseError;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
import InputError from "1.6.8/types/modules/error/input";
|
||||
import AuthError from "1.6.8/types/modules/error/auth";
|
||||
import { ueuseModule } from "1.6.8/types/modules/ueuse";
|
||||
import ueuseError from "1.6.8/types/modules/error/ueuse";
|
||||
import Page from "1.6.8/types/modules/page";
|
||||
|
||||
export default interface UeuseMentions {
|
||||
"ueuse/mentions": {
|
||||
body?: Page;
|
||||
response: {
|
||||
/** 成功かどうか */
|
||||
success: true;
|
||||
/** メンションされているユーズ */
|
||||
data: ueuseModule[];
|
||||
} | InputError | AuthError | ueuseError;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
import InputError from "1.6.8/types/modules/error/input";
|
||||
import AuthError from "1.6.8/types/modules/error/auth";
|
||||
import { ueuseModule } from "1.6.8/types/modules/ueuse";
|
||||
import ueuseError from "1.6.8/types/modules/error/ueuse";
|
||||
import Page from "1.6.8/types/modules/page";
|
||||
|
||||
export default interface UeuseReplies {
|
||||
"ueuse/replies": {
|
||||
body: {
|
||||
/** 元ユーズのユニークID */
|
||||
uniqid: string;
|
||||
} & Page;
|
||||
response: {
|
||||
/** 成功かどうか */
|
||||
success: true;
|
||||
/**
|
||||
* 元ユーズ(1番目)と返信(2番目以降)
|
||||
* 元ユーズが削除されている場合は返信が1番目以降になります。
|
||||
*/
|
||||
data: ueuseModule[];
|
||||
} | InputError | AuthError | ueuseError;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
import InputError from "1.6.8/types/modules/error/input";
|
||||
import AuthError from "1.6.8/types/modules/error/auth";
|
||||
import { ueuseModule } from "1.6.8/types/modules/ueuse";
|
||||
import ueuseError from "1.6.8/types/modules/error/ueuse";
|
||||
import Page from "1.6.8/types/modules/page";
|
||||
|
||||
export default interface UeuseSearch {
|
||||
"ueuse/search": {
|
||||
body: {
|
||||
/** 検索キーワード */
|
||||
keyword: string;
|
||||
} & Page;
|
||||
response: {
|
||||
/** 成功かどうか */
|
||||
success: true;
|
||||
/** 検索結果 */
|
||||
data: ueuseModule[];
|
||||
} | InputError | AuthError | ueuseError;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
import InputError from "1.6.8/types/modules/error/input";
|
||||
import AuthError from "1.6.8/types/modules/error/auth";
|
||||
import UpdateError, { CouldNotComplete } from "1.6.8/types/modules/error/update";
|
||||
import ToYouNotAllowed from "1.6.8/types/modules/error/follow";
|
||||
import { UserDataNotFound } from "1.6.8/types/modules/error/critical";
|
||||
|
||||
interface Follow<T extends string> {
|
||||
body: {
|
||||
/** ユーザーID */
|
||||
userid: T;
|
||||
};
|
||||
response: {
|
||||
/** 成功かどうか */
|
||||
success: true;
|
||||
/** ユーザーID */
|
||||
userid: T;
|
||||
} | InputError | AuthError | UpdateError | CouldNotComplete | ToYouNotAllowed | UserDataNotFound;
|
||||
}
|
||||
|
||||
export default interface UsersFollow {
|
||||
"users/follow": Follow<string>;
|
||||
"users/unfollow": Follow<string>;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import Role from "1.6.8/types/modules/role";
|
||||
import InputError from "1.6.8/types/modules/error/input";
|
||||
import AuthError from "1.6.8/types/modules/error/auth";
|
||||
import { UserDataNotFound } from "1.6.8/types/modules/error/critical";
|
||||
|
||||
export type UserResponse = {
|
||||
/** 成功かどうか */
|
||||
success: true;
|
||||
/** ユーザー名(表示名) */
|
||||
username: string;
|
||||
/** ユーザーID */
|
||||
userid: string;
|
||||
/** プロフィール */
|
||||
profile: string;
|
||||
/** アイコン画像URL */
|
||||
user_icon: string;
|
||||
/** ヘッダー画像URL */
|
||||
user_header: string;
|
||||
/**
|
||||
* 登録時刻
|
||||
* YYYY-MM-DD HH:MM:SS形式です。
|
||||
*/
|
||||
registered_date: string;
|
||||
/** フォロー */
|
||||
followee: string[];
|
||||
/** フォロー数 */
|
||||
followee_cnt: number;
|
||||
/** フォロワー */
|
||||
follower: string[];
|
||||
/** フォロワー数 */
|
||||
follower_cnt: number;
|
||||
/** ユーズ数 */
|
||||
ueuse_cnt: number;
|
||||
/** Botである */
|
||||
isBot: boolean;
|
||||
/** 管理者である */
|
||||
isAdmin: boolean;
|
||||
/** ロール */
|
||||
role: Role[];
|
||||
/** オンラインステータス */
|
||||
online_status: "Online" | "Away" | "Offline" | null;
|
||||
/** 言語 */
|
||||
language: "ja-JP";
|
||||
} | InputError | AuthError | UserDataNotFound;
|
||||
|
||||
export default interface Users {
|
||||
"users/": {
|
||||
body: {
|
||||
/** ユーザーID */
|
||||
userid: string;
|
||||
};
|
||||
response: UserResponse;
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
export type scope =
|
||||
"read:me" | "write:me" |
|
||||
"read:ueuse" | "write:ueuse" |
|
||||
"read:users" |
|
||||
"write:follow" |
|
||||
"write:favorite" |
|
||||
"read:notifications" | "write:notifications" |
|
||||
"read:bookmark" | "write:bookmark";
|
||||
|
||||
export interface generateAuthURIOptions {
|
||||
/** uwuzuサーバーのorigin */
|
||||
origin: string;
|
||||
/** * アプリケーションの名称 */
|
||||
name: string;
|
||||
/** 要求する権限 */
|
||||
scope: scope[];
|
||||
/** アプリケーションの説明 */
|
||||
about?: string;
|
||||
/** アプリケーションのアイコンURL */
|
||||
icon?: URL;
|
||||
/** 許可された際に移動するURL */
|
||||
callback?: {
|
||||
/** コールバックURL */
|
||||
url: URL;
|
||||
/**
|
||||
* sessionをURLパラメータに挿入します。
|
||||
* 指定することでcallback.urlにcallback.insertSessionという名前でsessionを挿入します。
|
||||
* 指定しない場合は挿入しません。
|
||||
*/
|
||||
insertSession?: string;
|
||||
};
|
||||
/**
|
||||
* sessionを明示的に指定します。
|
||||
* sessionはサーバー全体で一意になるようにしてください。
|
||||
* 指定しない場合はUUID v4を使用します。
|
||||
*/
|
||||
session?: string;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
export default interface AuthError {
|
||||
/** 成功かどうか */
|
||||
success: false;
|
||||
/** エラーコード */
|
||||
error_code:
|
||||
"this_account_has_been_frozen" |
|
||||
"token_invalid" |
|
||||
"not_allow_scope" |
|
||||
"token_invalid_scope";
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export type UserDataNotFound = {
|
||||
/** 成功かどうか */
|
||||
success: false;
|
||||
/** エラーコード */
|
||||
error_code: "critical_error_userdata_not_found";
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
export default interface ToYouNotAllowed {
|
||||
/** 成功かどうか */
|
||||
success: false;
|
||||
/** エラーコード */
|
||||
error_code: "you_cant_it_to_yourself";
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export default interface InputError {
|
||||
/** 成功かどうか */
|
||||
success: false;
|
||||
/** エラーコード */
|
||||
error_code: "input_not_found";
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export default interface ueuseError {
|
||||
/** 成功かどうか */
|
||||
success: false;
|
||||
/** エラーコード */
|
||||
error_code: "ueuse_not_found";
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
export default interface UpdateError {
|
||||
/** 成功かどうか */
|
||||
success: false;
|
||||
/** エラーコード */
|
||||
error_code: "update_failed";
|
||||
}
|
||||
|
||||
export interface CouldNotComplete {
|
||||
/** 成功かどうか */
|
||||
success: false;
|
||||
/** エラーコード */
|
||||
error_code: "could_not_complete";
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
export interface UploadCommonError {
|
||||
/** 成功かどうか */
|
||||
success: false;
|
||||
/** エラーコード */
|
||||
error_code:
|
||||
"ERROR" |
|
||||
"使用できない画像形式です。(FILE_UPLOAD_DEKINAKATTA)";
|
||||
}
|
||||
|
||||
export interface Upload1Error {
|
||||
/** 成功かどうか */
|
||||
success: false;
|
||||
/** エラーコード */
|
||||
error_code:
|
||||
"アップロード失敗!(1)エラーコード:FILE_DEKASUGUI_PHP_INI_KAKUNIN" |
|
||||
"アップロード失敗!(1)エラーコード:FILE_DEKASUGUI_HTML_KAKUNIN" |
|
||||
"アップロード失敗!(1)エラーコード:FILE_SUKOSHIDAKE_UPLOAD" |
|
||||
"アップロード失敗!(1)エラーコード:FILE_UPLOAD_DEKINAKATTA" |
|
||||
"アップロード失敗!(1)エラーコード:TMP_FOLDER_NAI" |
|
||||
"アップロード失敗!(1)エラーコード:FILE_KAKIKOMI_SIPPAI" |
|
||||
"アップロード失敗!(1)エラーコード:PHPINFO()_KAKUNIN" |
|
||||
"アップロード失敗!(1)エラーコード:TMP_FILE_NAI" |
|
||||
"アップロード失敗!(1)エラーコード:SAVE_FOLDER_KAKIKOMI_KENNAI" |
|
||||
"アップロード失敗!(1)エラーコード:MOVE_UPLOAD_FILE_SIPPAI" |
|
||||
"アップロード失敗!(1)エラーコード: S3ERROR";
|
||||
}
|
||||
|
||||
export interface Upload2Error {
|
||||
/** 成功かどうか */
|
||||
success: false;
|
||||
/** エラーコード */
|
||||
error_code:
|
||||
"アップロード失敗!(2)エラーコード:FILE_DEKASUGUI_PHP_INI_KAKUNIN" |
|
||||
"アップロード失敗!(2)エラーコード:FILE_DEKASUGUI_HTML_KAKUNIN" |
|
||||
"アップロード失敗!(2)エラーコード:FILE_SUKOSHIDAKE_UPLOAD" |
|
||||
"アップロード失敗!(2)エラーコード:FILE_UPLOAD_DEKINAKATTA" |
|
||||
"アップロード失敗!(2)エラーコード:TMP_FOLDER_NAI" |
|
||||
"アップロード失敗!(2)エラーコード:FILE_KAKIKOMI_SIPPAI" |
|
||||
"アップロード失敗!(2)エラーコード:PHPINFO()_KAKUNIN" |
|
||||
"アップロード失敗!(2)エラーコード:TMP_FILE_NAI" |
|
||||
"アップロード失敗!(2)エラーコード:SAVE_FOLDER_KAKIKOMI_KENNAI" |
|
||||
"アップロード失敗!(2)エラーコード:MOVE_UPLOAD_FILE_SIPPAI" |
|
||||
"アップロード失敗!(2)エラーコード: S3ERROR";
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export default interface Page {
|
||||
/** 制限数 */
|
||||
limit?: number;
|
||||
/** ページ */
|
||||
page?: number;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
export default interface Role {
|
||||
/** ロール名(表示名) */
|
||||
name: string;
|
||||
/** HEXカラー(#なし) */
|
||||
color: string;
|
||||
/** エフェクト */
|
||||
effect: "none" | "shine" | "rainbow";
|
||||
/** ロールID */
|
||||
id: string;
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
type Abi = {
|
||||
/**
|
||||
* 追記
|
||||
* 追記がない場合は空文字列です。
|
||||
*/
|
||||
abi: string;
|
||||
/** 追記時刻 */
|
||||
abidatetime: string;
|
||||
} | {
|
||||
/**
|
||||
* 追記
|
||||
* 追記が入力できないため常に空文字列です。
|
||||
*/
|
||||
abi: "";
|
||||
/**
|
||||
* 追記時刻
|
||||
* 追記が入力できないため常に0000-00-00 00:00:00です。
|
||||
*/
|
||||
abidatetime: "0000-00-00 00:00:00";
|
||||
}
|
||||
|
||||
export type Media =
|
||||
| {
|
||||
/**
|
||||
* 画像1URL
|
||||
* 画像1がないため常に空文字列です。
|
||||
*/
|
||||
photo1?: undefined;
|
||||
/**
|
||||
* 画像2URL
|
||||
* 画像2がないため常に空文字列です。
|
||||
* 画像2は画像1が入力されていることの内包条件です。
|
||||
*/
|
||||
photo2?: undefined;
|
||||
/**
|
||||
* 画像3URL
|
||||
* 画像3がないため常に空文字列です。
|
||||
* 画像3は画像2が入力されていることの内包条件です。
|
||||
*/
|
||||
photo3?: undefined;
|
||||
/**
|
||||
* 画像4URL
|
||||
* 画像4がないため常に空文字列です。
|
||||
* 画像4は画像3が入力されていることの内包条件です。
|
||||
*/
|
||||
photo4?: undefined;
|
||||
/**
|
||||
* 動画URL
|
||||
* 動画がないため常に空文字列です。
|
||||
*/
|
||||
video1?: undefined;
|
||||
} | {
|
||||
/** 画像1URL */
|
||||
photo1: string;
|
||||
/**
|
||||
* 画像2URL
|
||||
* 画像2がない場合は空文字列です。
|
||||
* 画像2は画像1が入力されていることの内包条件です。
|
||||
*/
|
||||
photo2?: string;
|
||||
/**
|
||||
* 画像3URL
|
||||
* 画像3がない場合は空文字列です。
|
||||
* 画像3は画像2が入力されていることの内包条件です。
|
||||
*/
|
||||
photo3?: string;
|
||||
/**
|
||||
* 画像4URL
|
||||
* 画像4がない場合は空文字列です。
|
||||
* 画像4は画像3が入力されていることの内包条件です。
|
||||
*/
|
||||
photo4?: string;
|
||||
/**
|
||||
* 動画URL
|
||||
* 動画がないため常に空文字列です。
|
||||
*/
|
||||
video1?: undefined;
|
||||
} | {
|
||||
/** 動画URL */
|
||||
video1: string;
|
||||
/**
|
||||
* 画像1URL
|
||||
* 画像1がないため常に空文字列です。
|
||||
*/
|
||||
photo1?: undefined;
|
||||
/**
|
||||
* 画像2URL
|
||||
* 画像2がないため常に空文字列です。
|
||||
* 画像2は画像1が入力されていることの内包条件です。
|
||||
*/
|
||||
photo2?: undefined;
|
||||
/**
|
||||
* 画像3URL
|
||||
* 画像3がないため常に空文字列です。
|
||||
* 画像3は画像1が入力されていることの内包条件です。
|
||||
*/
|
||||
photo3?: undefined;
|
||||
/**
|
||||
* 画像4URL
|
||||
* 画像4がないため常に空文字列です。
|
||||
* 画像4は画像1が入力されていることの内包条件です。
|
||||
*/
|
||||
photo4?: undefined;
|
||||
};
|
||||
|
||||
interface ueuseBase {
|
||||
/** ユニークID */
|
||||
uniqid: string;
|
||||
/** 送信者 */
|
||||
account: {
|
||||
/** ユーザー名 */
|
||||
username: string;
|
||||
/** ユーザーID */
|
||||
userid: string;
|
||||
/** ユーザーアイコン画像URL */
|
||||
user_icon: string;
|
||||
/** ユーザーヘッダー画像URL */
|
||||
user_header: string;
|
||||
/** Botフラグ(自主設定)かどうか */
|
||||
is_bot: boolean;
|
||||
};
|
||||
/** いいねしたユーザーID */
|
||||
favorite: string[];
|
||||
/** いいね数 */
|
||||
favorite_cnt: number;
|
||||
/** 返信数 */
|
||||
reply_cnt: number;
|
||||
/** リユーズ+引用数 */
|
||||
reuse_cnt: number;
|
||||
/** 送信時刻 */
|
||||
datetime: string;
|
||||
/** NSFW(自主設定)かどうか */
|
||||
nsfw: boolean;
|
||||
}
|
||||
|
||||
interface NormalUeuse extends ueuseBase {
|
||||
/** 本文 */
|
||||
text: string;
|
||||
/**
|
||||
* 返信先ID
|
||||
* 返信でないため空文字列です。
|
||||
*/
|
||||
replyid: "";
|
||||
/**
|
||||
* リユーズ/引用元ID
|
||||
* リユーズ/引用でないため空文字列です。
|
||||
*/
|
||||
reuseid: "";
|
||||
}
|
||||
|
||||
interface ReplyUeuse extends ueuseBase {
|
||||
/** 本文 */
|
||||
text: string;
|
||||
/** 返信先ID */
|
||||
replyid: string;
|
||||
/**
|
||||
* リユーズ/引用元ID
|
||||
* リユーズ/引用でないため空文字列です。
|
||||
*/
|
||||
reuseid: "";
|
||||
}
|
||||
|
||||
interface Reuse extends ueuseBase {
|
||||
/**
|
||||
* 本文
|
||||
* リユーズであるため常に空文字列です。
|
||||
*/
|
||||
text: "";
|
||||
/**
|
||||
* 返信先ID
|
||||
* 返信でないため空文字列です。
|
||||
*/
|
||||
replyid: "";
|
||||
/** リユーズ/引用元ID */
|
||||
reuseid: string;
|
||||
/**
|
||||
* 追記
|
||||
* リユーズであるため常に空文字列です。
|
||||
*/
|
||||
abi: "";
|
||||
/**
|
||||
* 追記時刻
|
||||
* リユーズであるため常に0000-00-00 00:00:00です。
|
||||
*/
|
||||
abidatetime: "0000-00-00 00:00:00";
|
||||
}
|
||||
|
||||
interface QuoteReuse extends ueuseBase {
|
||||
/** 本文 */
|
||||
text: string;
|
||||
/**
|
||||
* 返信先ID
|
||||
* 返信でないため空文字列です。
|
||||
*/
|
||||
replyid: "";
|
||||
/** 引用元ID */
|
||||
reuseid: string;
|
||||
}
|
||||
|
||||
type Ext = Abi & Media;
|
||||
|
||||
export type ueuseModule =
|
||||
| (NormalUeuse & Ext)
|
||||
| (ReplyUeuse & Ext)
|
||||
| (QuoteReuse & Ext)
|
||||
| Reuse;
|
||||
Reference in New Issue
Block a user