API型完成
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import InputError from "1.6.11/types/modules/error/input";
|
||||
import AuthError from "1.6.11/types/modules/error/auth";
|
||||
import Page from "1.6.11/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.11/types/modules/error/input";
|
||||
import AuthError from "1.6.11/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.11/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.11/types/modules/error/input";
|
||||
import AuthError from "1.6.11/types/modules/error/auth";
|
||||
import { UserDataNotFound } from "1.6.11/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.11/types/modules/error/input";
|
||||
import AuthError from "1.6.11/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.11/types/modules/error/input";
|
||||
import AuthError from "1.6.11/types/modules/error/auth";
|
||||
|
||||
export default interface FavoriteGet {
|
||||
"favorite/get": {
|
||||
body: {
|
||||
/** ユーズのユニークID */
|
||||
uniqid: string;
|
||||
};
|
||||
response: {
|
||||
/** 成功かどうか */
|
||||
success: true;
|
||||
/** いいねしたユーザー */
|
||||
favorite_list: string[];
|
||||
} | InputError | AuthError;
|
||||
}
|
||||
};
|
||||
@@ -1,14 +1,10 @@
|
||||
import InputError from "1.6.11/types/modules/error/input";
|
||||
import AuthError from "1.6.11/types/modules/error/auth";
|
||||
import Page from "1.6.11/types/modules/page";
|
||||
|
||||
export default interface MeNotification {
|
||||
"me/notification/": {
|
||||
body?: {
|
||||
/** 制限数 */
|
||||
limit?: number;
|
||||
/** ページ */
|
||||
page?: number;
|
||||
};
|
||||
body?: Page;
|
||||
response: {
|
||||
/** 成功かどうか */
|
||||
success: true;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import InputError from "1.6.11/types/modules/error/input";
|
||||
import { UserDataNotFound } from "1.6.11/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.11/types/modules/error/input";
|
||||
import AuthError from "1.6.11/types/modules/error/auth";
|
||||
import { ueuseModule } from "1.6.11/types/modules/ueuse";
|
||||
import ueuseError from "1.6.11/types/modules/error/ueuse";
|
||||
import Page from "1.6.11/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.11/types/modules/error/input";
|
||||
import AuthError from "1.6.11/types/modules/error/auth";
|
||||
import { Media } from "1.6.11/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.11/types/modules/error/input";
|
||||
import AuthError from "1.6.11/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.11/types/modules/error/input";
|
||||
import AuthError from "1.6.11/types/modules/error/auth";
|
||||
import { ueuseModule } from "1.6.11/types/modules/ueuse";
|
||||
import ueuseError from "1.6.11/types/modules/error/ueuse";
|
||||
|
||||
export default interface UeuseGet {
|
||||
"ueuse/get": {
|
||||
body: {
|
||||
/** 取得するユーズのユニークID */
|
||||
uniqid: string;
|
||||
};
|
||||
response: {
|
||||
/** 成功かどうか */
|
||||
success: true;
|
||||
/** ユーズ(要求したユーズのみ) */
|
||||
data: ueuseModule[];
|
||||
} | InputError | AuthError | ueuseError;
|
||||
}
|
||||
};
|
||||
@@ -2,15 +2,11 @@ import InputError from "1.6.11/types/modules/error/input";
|
||||
import AuthError from "1.6.11/types/modules/error/auth";
|
||||
import { ueuseModule } from "1.6.11/types/modules/ueuse";
|
||||
import ueuseError from "1.6.11/types/modules/error/ueuse";
|
||||
import Page from "1.6.11/types/modules/page";
|
||||
|
||||
export default interface Ueuse {
|
||||
"ueuse/": {
|
||||
body?: {
|
||||
/** 制限数 */
|
||||
limit?: number;
|
||||
/** ページ */
|
||||
page?: number;
|
||||
};
|
||||
body?: Page;
|
||||
response: {
|
||||
/** 成功かどうか */
|
||||
success: true;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import InputError from "1.6.11/types/modules/error/input";
|
||||
import AuthError from "1.6.11/types/modules/error/auth";
|
||||
import { ueuseModule } from "1.6.11/types/modules/ueuse";
|
||||
import ueuseError from "1.6.11/types/modules/error/ueuse";
|
||||
import Page from "1.6.11/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.11/types/modules/error/input";
|
||||
import AuthError from "1.6.11/types/modules/error/auth";
|
||||
import { ueuseModule } from "1.6.11/types/modules/ueuse";
|
||||
import ueuseError from "1.6.11/types/modules/error/ueuse";
|
||||
import Page from "1.6.11/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.11/types/modules/error/input";
|
||||
import AuthError from "1.6.11/types/modules/error/auth";
|
||||
import { ueuseModule } from "1.6.11/types/modules/ueuse";
|
||||
import ueuseError from "1.6.11/types/modules/error/ueuse";
|
||||
import Page from "1.6.11/types/modules/page";
|
||||
|
||||
export default interface UeuseSearch {
|
||||
"ueuse/search": {
|
||||
body: {
|
||||
/** 検索キーワード */
|
||||
keyword: string;
|
||||
} & Page;
|
||||
response: {
|
||||
/** 成功かどうか */
|
||||
success: true;
|
||||
/** 検索結果 */
|
||||
data: ueuseModule[];
|
||||
} | InputError | AuthError | ueuseError;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
export default interface Page {
|
||||
/** 制限数 */
|
||||
limit?: number;
|
||||
/** ページ */
|
||||
page?: number;
|
||||
}
|
||||
@@ -19,7 +19,7 @@ type Abi = {
|
||||
abidatetime: "0000-00-00 00:00:00";
|
||||
}
|
||||
|
||||
type Media =
|
||||
export type Media =
|
||||
| {
|
||||
/**
|
||||
* 画像1URL
|
||||
@@ -197,8 +197,10 @@ interface QuoteReuse extends ueuseBase {
|
||||
reuseid: string;
|
||||
}
|
||||
|
||||
type Ext = Abi & Media;
|
||||
|
||||
export type ueuseModule =
|
||||
| (NormalUeuse & Abi & Media)
|
||||
| (ReplyUeuse & Abi & Media)
|
||||
| (QuoteReuse & Abi & Media)
|
||||
| (NormalUeuse & Ext)
|
||||
| (ReplyUeuse & Ext)
|
||||
| (QuoteReuse & Ext)
|
||||
| Reuse;
|
||||
@@ -109,6 +109,17 @@ export default class uwuzu<
|
||||
};
|
||||
}
|
||||
|
||||
if (res.favorite_list !== undefined && res.success === true) {
|
||||
res.success = undefined;
|
||||
|
||||
const list = res.favorite_list.split(",");
|
||||
|
||||
return {
|
||||
success: true,
|
||||
favorite_list: list,
|
||||
};
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user