1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-11-24 07:06:12 +09:00

feat: Roleに関するSchemaを追加 (#12572)

* feat: Roleに関連するschemaを追加

* feat: 新しいRoleSchemaを使うように

* chore: misskey.jsのデータを更新

* chore: misskey-js.api.mdを更新
This commit is contained in:
yupix 2023-12-06 15:47:57 +09:00 committed by GitHub
parent 00b11b1f75
commit e42c91dee7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 429 additions and 71 deletions

View File

@ -37,6 +37,7 @@ import { packedEmojiDetailedSchema, packedEmojiSimpleSchema } from '@/models/jso
import { packedFlashSchema } from '@/models/json-schema/flash.js';
import { packedAnnouncementSchema } from '@/models/json-schema/announcement.js';
import { packedSigninSchema } from '@/models/json-schema/signin.js';
import { packedRoleLiteSchema, packedRoleSchema } from '@/models/json-schema/role.js';
export const refs = {
UserLite: packedUserLiteSchema,
@ -73,6 +74,8 @@ export const refs = {
EmojiDetailed: packedEmojiDetailedSchema,
Flash: packedFlashSchema,
Signin: packedSigninSchema,
RoleLite: packedRoleLiteSchema,
Role: packedRoleSchema,
};
export type Packed<x extends keyof typeof refs> = SchemaType<typeof refs[x]>;

View File

@ -0,0 +1,157 @@
const rolePolicyValue = {
type: 'object',
properties: {
value: {
oneOf: [
{
type: 'integer',
optional: false, nullable: false,
},
{
type: 'boolean',
optional: false, nullable: false,
},
],
},
priority: {
type: 'integer',
optional: false, nullable: false,
},
useDefault: {
type: 'boolean',
optional: false, nullable: false,
},
},
} as const;
export const packedRoleLiteSchema = {
type: 'object',
properties: {
id: {
type: 'string',
optional: false, nullable: false,
format: 'id',
example: 'xxxxxxxxxx',
},
name: {
type: 'string',
optional: false, nullable: false,
example: 'New Role',
},
color: {
type: 'string',
optional: false, nullable: true,
example: '#000000',
},
iconUrl: {
type: 'string',
optional: false, nullable: true,
},
description: {
type: 'string',
optional: false, nullable: false,
},
isModerator: {
type: 'boolean',
optional: false, nullable: false,
example: false,
},
isAdministrator: {
type: 'boolean',
optional: false, nullable: false,
example: false,
},
displayOrder: {
type: 'integer',
optional: false, nullable: false,
example: 0,
},
},
} as const;
export const packedRoleSchema = {
type: 'object',
allOf: [
{
type: 'object',
ref: 'RoleLite',
},
{
type: 'object',
properties: {
createdAt: {
type: 'string',
optional: false, nullable: false,
format: 'date-time',
},
updatedAt: {
type: 'string',
optional: false, nullable: false,
format: 'date-time',
},
target: {
type: 'string',
optional: false, nullable: false,
enum: ['manual', 'conditional'],
},
condFormula: {
type: 'object',
optional: false, nullable: false,
},
isPublic: {
type: 'boolean',
optional: false, nullable: false,
example: false,
},
isExplorable: {
type: 'boolean',
optional: false, nullable: false,
example: false,
},
asBadge: {
type: 'boolean',
optional: false, nullable: false,
example: false,
},
canEditMembersByModerator: {
type: 'boolean',
optional: false, nullable: false,
example: false,
},
policies: {
type: 'object',
optional: false, nullable: false,
properties: {
pinLimit: rolePolicyValue,
canInvite: rolePolicyValue,
clipLimit: rolePolicyValue,
canHideAds: rolePolicyValue,
inviteLimit: rolePolicyValue,
antennaLimit: rolePolicyValue,
gtlAvailable: rolePolicyValue,
ltlAvailable: rolePolicyValue,
webhookLimit: rolePolicyValue,
canPublicNote: rolePolicyValue,
userListLimit: rolePolicyValue,
wordMuteLimit: rolePolicyValue,
alwaysMarkNsfw: rolePolicyValue,
canSearchNotes: rolePolicyValue,
driveCapacityMb: rolePolicyValue,
rateLimitFactor: rolePolicyValue,
inviteLimitCycle: rolePolicyValue,
noteEachClipsLimit: rolePolicyValue,
inviteExpirationTime: rolePolicyValue,
canManageCustomEmojis: rolePolicyValue,
userEachUserListsLimit: rolePolicyValue,
canManageAvatarDecorations: rolePolicyValue,
canUseTranslator: rolePolicyValue,
},
},
usersCount: {
type: 'integer',
optional: false, nullable: false,
},
},
},
],
} as const;

View File

@ -329,41 +329,7 @@ export const packedUserDetailedNotMeOnlySchema = {
items: {
type: 'object',
nullable: false, optional: false,
properties: {
id: {
type: 'string',
nullable: false, optional: false,
format: 'id',
},
name: {
type: 'string',
nullable: false, optional: false,
},
color: {
type: 'string',
nullable: true, optional: false,
},
iconUrl: {
type: 'string',
nullable: true, optional: false,
},
description: {
type: 'string',
nullable: false, optional: false,
},
isModerator: {
type: 'boolean',
nullable: false, optional: false,
},
isAdministrator: {
type: 'boolean',
nullable: false, optional: false,
},
displayOrder: {
type: 'number',
nullable: false, optional: false,
},
},
ref: 'RoleLite',
},
},
memo: {

View File

@ -13,6 +13,12 @@ export const meta = {
requireCredential: true,
requireAdmin: true,
res: {
type: 'object',
optional: false, nullable: false,
ref: 'Role',
},
} as const;
export const paramDef = {

View File

@ -14,6 +14,16 @@ export const meta = {
requireCredential: true,
requireModerator: true,
res: {
type: 'array',
optional: false, nullable: false,
items: {
type: 'object',
optional: false, nullable: false,
ref: 'Role',
},
},
} as const;
export const paramDef = {

View File

@ -23,6 +23,12 @@ export const meta = {
id: '07dc7d34-c0d8-49b7-96c6-db3ce64ee0b3',
},
},
res: {
type: 'object',
optional: false, nullable: false,
ref: 'Role',
},
} as const;
export const paramDef = {

View File

@ -13,6 +13,16 @@ export const meta = {
tags: ['role'],
requireCredential: true,
res: {
type: 'array',
optional: false, nullable: false,
items: {
type: 'object',
optional: false, nullable: false,
ref: 'Role',
},
},
} as const;
export const paramDef = {

View File

@ -22,6 +22,12 @@ export const meta = {
id: 'de5502bf-009a-4639-86c1-fec349e46dcb',
},
},
res: {
type: 'object',
optional: false, nullable: false,
ref: 'Role',
},
} as const;
export const paramDef = {

View File

@ -227,12 +227,21 @@ type AdminRolesAssignRequest = operations['admin/roles/assign']['requestBody']['
// @public (undocumented)
type AdminRolesCreateRequest = operations['admin/roles/create']['requestBody']['content']['application/json'];
// @public (undocumented)
type AdminRolesCreateResponse = operations['admin/roles/create']['responses']['200']['content']['application/json'];
// @public (undocumented)
type AdminRolesDeleteRequest = operations['admin/roles/delete']['requestBody']['content']['application/json'];
// @public (undocumented)
type AdminRolesListResponse = operations['admin/roles/list']['responses']['200']['content']['application/json'];
// @public (undocumented)
type AdminRolesShowRequest = operations['admin/roles/show']['requestBody']['content']['application/json'];
// @public (undocumented)
type AdminRolesShowResponse = operations['admin/roles/show']['responses']['200']['content']['application/json'];
// @public (undocumented)
type AdminRolesUnassignRequest = operations['admin/roles/unassign']['requestBody']['content']['application/json'];
@ -1099,8 +1108,11 @@ declare namespace entities {
AdminDeleteAccountResponse,
AdminUpdateUserNoteRequest,
AdminRolesCreateRequest,
AdminRolesCreateResponse,
AdminRolesDeleteRequest,
AdminRolesListResponse,
AdminRolesShowRequest,
AdminRolesShowResponse,
AdminRolesUpdateRequest,
AdminRolesAssignRequest,
AdminRolesUnassignRequest,
@ -1414,7 +1426,9 @@ declare namespace entities {
PingResponse,
PinnedUsersResponse,
PromoReadRequest,
RolesListResponse,
RolesShowRequest,
RolesShowResponse,
RolesUsersRequest,
RolesNotesRequest,
RolesNotesResponse,
@ -1519,7 +1533,9 @@ declare namespace entities {
EmojiSimple,
EmojiDetailed,
Flash,
Signin
Signin,
RoleLite,
Role
}
}
export { entities }
@ -2312,6 +2328,15 @@ type ResetPasswordRequest = operations['reset-password']['requestBody']['content
// @public (undocumented)
type RetentionResponse = operations['retention']['responses']['200']['content']['application/json'];
// @public (undocumented)
type Role = components['schemas']['Role'];
// @public (undocumented)
type RoleLite = components['schemas']['RoleLite'];
// @public (undocumented)
type RolesListResponse = operations['roles/list']['responses']['200']['content']['application/json'];
// @public (undocumented)
type RolesNotesRequest = operations['roles/notes']['requestBody']['content']['application/json'];
@ -2321,6 +2346,9 @@ type RolesNotesResponse = operations['roles/notes']['responses']['200']['content
// @public (undocumented)
type RolesShowRequest = operations['roles/show']['requestBody']['content']['application/json'];
// @public (undocumented)
type RolesShowResponse = operations['roles/show']['responses']['200']['content']['application/json'];
// @public (undocumented)
type RolesUsersRequest = operations['roles/users']['requestBody']['content']['application/json'];

View File

@ -1,6 +1,6 @@
/*
* version: 2023.12.0-beta.1
* generatedAt: 2023-12-04T07:13:58.541Z
* generatedAt: 2023-12-04T11:17:52.156Z
*/
import type {
@ -87,8 +87,11 @@ import type {
AdminDeleteAccountResponse,
AdminUpdateUserNoteRequest,
AdminRolesCreateRequest,
AdminRolesCreateResponse,
AdminRolesDeleteRequest,
AdminRolesListResponse,
AdminRolesShowRequest,
AdminRolesShowResponse,
AdminRolesUpdateRequest,
AdminRolesAssignRequest,
AdminRolesUnassignRequest,
@ -402,7 +405,9 @@ import type {
PingResponse,
PinnedUsersResponse,
PromoReadRequest,
RolesListResponse,
RolesShowRequest,
RolesShowResponse,
RolesUsersRequest,
RolesNotesRequest,
RolesNotesResponse,
@ -543,10 +548,10 @@ export type Endpoints = {
'admin/update-meta': { req: AdminUpdateMetaRequest; res: EmptyResponse };
'admin/delete-account': { req: AdminDeleteAccountRequest; res: AdminDeleteAccountResponse };
'admin/update-user-note': { req: AdminUpdateUserNoteRequest; res: EmptyResponse };
'admin/roles/create': { req: AdminRolesCreateRequest; res: EmptyResponse };
'admin/roles/create': { req: AdminRolesCreateRequest; res: AdminRolesCreateResponse };
'admin/roles/delete': { req: AdminRolesDeleteRequest; res: EmptyResponse };
'admin/roles/list': { req: EmptyRequest; res: EmptyResponse };
'admin/roles/show': { req: AdminRolesShowRequest; res: EmptyResponse };
'admin/roles/list': { req: EmptyRequest; res: AdminRolesListResponse };
'admin/roles/show': { req: AdminRolesShowRequest; res: AdminRolesShowResponse };
'admin/roles/update': { req: AdminRolesUpdateRequest; res: EmptyResponse };
'admin/roles/assign': { req: AdminRolesAssignRequest; res: EmptyResponse };
'admin/roles/unassign': { req: AdminRolesUnassignRequest; res: EmptyResponse };
@ -750,8 +755,8 @@ export type Endpoints = {
'ping': { req: EmptyRequest; res: PingResponse };
'pinned-users': { req: EmptyRequest; res: PinnedUsersResponse };
'promo/read': { req: PromoReadRequest; res: EmptyResponse };
'roles/list': { req: EmptyRequest; res: EmptyResponse };
'roles/show': { req: RolesShowRequest; res: EmptyResponse };
'roles/list': { req: EmptyRequest; res: RolesListResponse };
'roles/show': { req: RolesShowRequest; res: RolesShowResponse };
'roles/users': { req: RolesUsersRequest; res: EmptyResponse };
'roles/notes': { req: RolesNotesRequest; res: RolesNotesResponse };
'request-reset-password': { req: RequestResetPasswordRequest; res: EmptyResponse };

View File

@ -1,6 +1,6 @@
/*
* version: 2023.12.0-beta.1
* generatedAt: 2023-12-04T07:13:58.538Z
* generatedAt: 2023-12-04T11:17:52.154Z
*/
import { operations } from './types.js';
@ -89,8 +89,11 @@ export type AdminDeleteAccountRequest = operations['admin/delete-account']['requ
export type AdminDeleteAccountResponse = operations['admin/delete-account']['responses']['200']['content']['application/json'];
export type AdminUpdateUserNoteRequest = operations['admin/update-user-note']['requestBody']['content']['application/json'];
export type AdminRolesCreateRequest = operations['admin/roles/create']['requestBody']['content']['application/json'];
export type AdminRolesCreateResponse = operations['admin/roles/create']['responses']['200']['content']['application/json'];
export type AdminRolesDeleteRequest = operations['admin/roles/delete']['requestBody']['content']['application/json'];
export type AdminRolesListResponse = operations['admin/roles/list']['responses']['200']['content']['application/json'];
export type AdminRolesShowRequest = operations['admin/roles/show']['requestBody']['content']['application/json'];
export type AdminRolesShowResponse = operations['admin/roles/show']['responses']['200']['content']['application/json'];
export type AdminRolesUpdateRequest = operations['admin/roles/update']['requestBody']['content']['application/json'];
export type AdminRolesAssignRequest = operations['admin/roles/assign']['requestBody']['content']['application/json'];
export type AdminRolesUnassignRequest = operations['admin/roles/unassign']['requestBody']['content']['application/json'];
@ -404,7 +407,9 @@ export type FlashMyLikesResponse = operations['flash/my-likes']['responses']['20
export type PingResponse = operations['ping']['responses']['200']['content']['application/json'];
export type PinnedUsersResponse = operations['pinned-users']['responses']['200']['content']['application/json'];
export type PromoReadRequest = operations['promo/read']['requestBody']['content']['application/json'];
export type RolesListResponse = operations['roles/list']['responses']['200']['content']['application/json'];
export type RolesShowRequest = operations['roles/show']['requestBody']['content']['application/json'];
export type RolesShowResponse = operations['roles/show']['responses']['200']['content']['application/json'];
export type RolesUsersRequest = operations['roles/users']['requestBody']['content']['application/json'];
export type RolesNotesRequest = operations['roles/notes']['requestBody']['content']['application/json'];
export type RolesNotesResponse = operations['roles/notes']['responses']['200']['content']['application/json'];

View File

@ -1,6 +1,6 @@
/*
* version: 2023.12.0-beta.1
* generatedAt: 2023-12-04T07:13:58.535Z
* generatedAt: 2023-12-04T11:17:52.151Z
*/
import { components } from './types.js';
@ -38,3 +38,5 @@ export type EmojiSimple = components['schemas']['EmojiSimple'];
export type EmojiDetailed = components['schemas']['EmojiDetailed'];
export type Flash = components['schemas']['Flash'];
export type Signin = components['schemas']['Signin'];
export type RoleLite = components['schemas']['RoleLite'];
export type Role = components['schemas']['Role'];

View File

@ -3,7 +3,7 @@
/*
* version: 2023.12.0-beta.1
* generatedAt: 2023-12-04T07:13:58.362Z
* generatedAt: 2023-12-04T11:17:51.997Z
*/
/**
@ -3197,17 +3197,7 @@ export type components = {
usePasswordLessLogin: boolean;
/** @default false */
securityKeys: boolean;
roles: ({
/** Format: id */
id: string;
name: string;
color: string | null;
iconUrl: string | null;
description: string;
isModerator: boolean;
isAdministrator: boolean;
displayOrder: number;
})[];
roles: components['schemas']['RoleLite'][];
memo: string | null;
moderationNote?: string;
isFollowing?: boolean;
@ -3850,6 +3840,160 @@ export type components = {
headers: Record<string, never>;
success: boolean;
};
RoleLite: {
/**
* Format: id
* @example xxxxxxxxxx
*/
id: string;
/** @example New Role */
name: string;
/** @example #000000 */
color: string | null;
iconUrl: string | null;
description: string;
/** @example false */
isModerator: boolean;
/** @example false */
isAdministrator: boolean;
/** @example 0 */
displayOrder: number;
};
Role: components['schemas']['RoleLite'] & ({
/** Format: date-time */
createdAt: string;
/** Format: date-time */
updatedAt: string;
/** @enum {string} */
target: 'manual' | 'conditional';
condFormula: Record<string, never>;
/** @example false */
isPublic: boolean;
/** @example false */
isExplorable: boolean;
/** @example false */
asBadge: boolean;
/** @example false */
canEditMembersByModerator: boolean;
policies: {
pinLimit: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
canInvite: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
clipLimit: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
canHideAds: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
inviteLimit: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
antennaLimit: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
gtlAvailable: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
ltlAvailable: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
webhookLimit: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
canPublicNote: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
userListLimit: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
wordMuteLimit: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
alwaysMarkNsfw: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
canSearchNotes: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
driveCapacityMb: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
rateLimitFactor: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
inviteLimitCycle: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
noteEachClipsLimit: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
inviteExpirationTime: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
canManageCustomEmojis: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
userEachUserListsLimit: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
canManageAvatarDecorations: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
canUseTranslator: {
value: number | boolean;
priority: number;
useDefault: boolean;
};
};
usersCount: number;
});
};
responses: never;
parameters: never;
@ -7847,9 +7991,11 @@ export type operations = {
};
};
responses: {
/** @description OK (without any results) */
204: {
content: never;
/** @description OK (with results) */
200: {
content: {
'application/json': components['schemas']['Role'];
};
};
/** @description Client error */
400: {
@ -7943,9 +8089,11 @@ export type operations = {
*/
'admin/roles/list': {
responses: {
/** @description OK (without any results) */
204: {
content: never;
/** @description OK (with results) */
200: {
content: {
'application/json': components['schemas']['Role'][];
};
};
/** @description Client error */
400: {
@ -7995,9 +8143,11 @@ export type operations = {
};
};
responses: {
/** @description OK (without any results) */
204: {
content: never;
/** @description OK (with results) */
200: {
content: {
'application/json': components['schemas']['Role'];
};
};
/** @description Client error */
400: {
@ -19841,9 +19991,11 @@ export type operations = {
*/
'roles/list': {
responses: {
/** @description OK (without any results) */
204: {
content: never;
/** @description OK (with results) */
200: {
content: {
'application/json': components['schemas']['Role'][];
};
};
/** @description Client error */
400: {
@ -19893,9 +20045,11 @@ export type operations = {
};
};
responses: {
/** @description OK (without any results) */
204: {
content: never;
/** @description OK (with results) */
200: {
content: {
'application/json': components['schemas']['Role'];
};
};
/** @description Client error */
400: {