summaryrefslogtreecommitdiff
path: root/src/models
diff options
context:
space:
mode:
authorYuzuRyo61 <yuzuryo61@yuzulia.work>2021-03-06 22:34:11 +0900
committerGitHub <noreply@github.com>2021-03-06 22:34:11 +0900
commita07d753da84191bc8c185a7bcd6d73fab9529b5d (patch)
tree085bc62b1f979020796a73373c3050f4948ed2bd /src/models
parentfeat: video play inline (using video tag) (#7242) (diff)
downloadsharkey-a07d753da84191bc8c185a7bcd6d73fab9529b5d.tar.gz
sharkey-a07d753da84191bc8c185a7bcd6d73fab9529b5d.tar.bz2
sharkey-a07d753da84191bc8c185a7bcd6d73fab9529b5d.zip
APIドキュメントの改善 (#6757)
* Update api document in admin/announcements * Update api document in announcements * Update api document in i/read-announcements * Update api document in username/available * Update api document & Fix typo in API 403 error * Update api document * Update api document * Update api document * Fix API permission definition * Update api document * Update api document * Update api document * Update api document * Update api document * Update api document * Update api document * Update api document * Fix bug in users (api) * Apply reviews #6757 * Apply reviews #6757 Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
Diffstat (limited to 'src/models')
-rw-r--r--src/models/repositories/antenna.ts70
-rw-r--r--src/models/repositories/app.ts30
-rw-r--r--src/models/repositories/drive-file.ts62
-rw-r--r--src/models/repositories/federation-instance.ts106
-rw-r--r--src/models/repositories/queue.ts30
-rw-r--r--src/models/repositories/user.ts263
6 files changed, 496 insertions, 65 deletions
diff --git a/src/models/repositories/antenna.ts b/src/models/repositories/antenna.ts
index b20da26c5d..0f0a5c0171 100644
--- a/src/models/repositories/antenna.ts
+++ b/src/models/repositories/antenna.ts
@@ -41,20 +41,78 @@ export const packedAntennaSchema = {
id: {
type: 'string' as const,
optional: false as const, nullable: false as const,
- format: 'id',
- description: 'The unique identifier for this Antenna.',
- example: 'xxxxxxxxxx',
+ format: 'id'
},
createdAt: {
type: 'string' as const,
optional: false as const, nullable: false as const,
- format: 'date-time',
- description: 'The date that the Antenna was created.'
+ format: 'date-time'
},
name: {
type: 'string' as const,
+ optional: false as const, nullable: false as const
+ },
+ keywords: {
+ type: 'array' as const,
+ optional: false as const, nullable: false as const,
+ items: {
+ type: 'string' as const,
+ optional: false as const, nullable: false as const
+ }
+ },
+ execludeKeywords: {
+ type: 'array' as const,
+ optional: false as const, nullable: false as const,
+ items: {
+ type: 'string' as const,
+ optional: false as const, nullable: false as const
+ }
+ },
+ src: {
+ type: 'string' as const,
optional: false as const, nullable: false as const,
- description: 'The name of the Antenna.'
+ enum: ['home', 'all', 'users', 'list', 'group']
+ },
+ userListId: {
+ type: 'string' as const,
+ optional: false as const, nullable: true as const,
+ format: 'id'
+ },
+ userGroupId: {
+ type: 'string' as const,
+ optional: false as const, nullable: true as const,
+ format: 'id'
},
+ users: {
+ type: 'array' as const,
+ optional: false as const, nullable: false as const,
+ items: {
+ type: 'string' as const,
+ optional: false as const, nullable: false as const
+ }
+ },
+ caseSensitive: {
+ type: 'boolean' as const,
+ optional: false as const, nullable: false as const,
+ default: false
+ },
+ notify: {
+ type: 'boolean' as const,
+ optional: false as const, nullable: false as const
+ },
+ withReplies: {
+ type: 'boolean' as const,
+ optional: false as const, nullable: false as const,
+ default: false
+ },
+ withFile: {
+ type: 'boolean' as const,
+ optional: false as const, nullable: false as const
+ },
+ hasUnreadNote: {
+ type: 'boolean' as const,
+ optional: false as const, nullable: false as const,
+ default: false
+ }
},
};
diff --git a/src/models/repositories/app.ts b/src/models/repositories/app.ts
index f5cc10787a..33e0f41156 100644
--- a/src/models/repositories/app.ts
+++ b/src/models/repositories/app.ts
@@ -46,33 +46,35 @@ export const packedAppSchema = {
properties: {
id: {
type: 'string' as const,
- optional: false as const, nullable: false as const,
- format: 'id',
- description: 'The unique identifier for this Note.',
- example: 'xxxxxxxxxx',
+ optional: false as const, nullable: false as const
},
name: {
type: 'string' as const,
- optional: false as const, nullable: false as const,
- description: 'アプリケーションの名前'
+ optional: false as const, nullable: false as const
+ },
+ createdAt: {
+ type: 'string' as const,
+ optional: false as const, nullable: false as const
},
- callbackUrl: {
+ lastUsedAt: {
type: 'string' as const,
- optional: false as const, nullable: true as const,
- description: 'コールバックするURL'
+ optional: false as const, nullable: false as const
},
permission: {
type: 'array' as const,
- optional: true as const, nullable: false as const,
+ optional: false as const, nullable: false as const,
items: {
type: 'string' as const,
- optional: false as const, nullable: false as const,
+ optional: false as const, nullable: false as const
}
},
secret: {
type: 'string' as const,
- optional: true as const, nullable: false as const,
- description: 'アプリケーションのシークレットキー'
+ optional: true as const, nullable: false as const
+ },
+ isAuthorized: {
+ type: 'boolean' as const,
+ optional: true as const, nullable: false as const
}
- },
+ }
};
diff --git a/src/models/repositories/drive-file.ts b/src/models/repositories/drive-file.ts
index 3d013b8bb2..5085c76e92 100644
--- a/src/models/repositories/drive-file.ts
+++ b/src/models/repositories/drive-file.ts
@@ -182,12 +182,52 @@ export const packedDriveFileSchema = {
description: 'The size of this Drive file. (bytes)',
example: 51469
},
+ isSensitive: {
+ type: 'boolean' as const,
+ optional: false as const, nullable: false as const,
+ description: 'Whether this Drive file is sensitive.',
+ },
+ blurhash: {
+ type: 'string' as const,
+ optional: false as const, nullable: true as const
+ },
+ properties: {
+ type: 'object' as const,
+ optional: false as const, nullable: false as const,
+ properties: {
+ width: {
+ type: 'number' as const,
+ optional: false as const, nullable: false as const,
+ example: 1280
+ },
+ height: {
+ type: 'number' as const,
+ optional: false as const, nullable: false as const,
+ example: 720
+ },
+ avgColor: {
+ type: 'string' as const,
+ optional: true as const, nullable: false as const,
+ example: 'rgb(40,65,87)'
+ }
+ }
+ },
url: {
type: 'string' as const,
optional: false as const, nullable: true as const,
format: 'url',
description: 'The URL of this Drive file.',
},
+ thumbnailUrl: {
+ type: 'string' as const,
+ optional: false as const, nullable: true as const,
+ format: 'url',
+ description: 'The thumbnail URL of this Drive file.',
+ },
+ comment: {
+ type: 'string' as const,
+ optional: false as const, nullable: true as const
+ },
folderId: {
type: 'string' as const,
optional: false as const, nullable: true as const,
@@ -195,10 +235,24 @@ export const packedDriveFileSchema = {
description: 'The parent folder ID of this Drive file.',
example: 'xxxxxxxxxx',
},
- isSensitive: {
- type: 'boolean' as const,
- optional: false as const, nullable: false as const,
- description: 'Whether this Drive file is sensitive.',
+ folder: {
+ type: 'object' as const,
+ optional: true as const, nullable: true as const,
+ description: 'The parent folder of this Drive file.',
+ ref: 'DriveFolder'
},
+ userId: {
+ type: 'string' as const,
+ optional: false as const, nullable: true as const,
+ format: 'id',
+ description: 'Owner ID of this Drive file.',
+ example: 'xxxxxxxxxx',
+ },
+ user: {
+ type: 'object' as const,
+ optional: true as const, nullable: true as const,
+ description: 'Owner of this Drive file.',
+ ref: 'User'
+ }
},
};
diff --git a/src/models/repositories/federation-instance.ts b/src/models/repositories/federation-instance.ts
new file mode 100644
index 0000000000..c6b08dc101
--- /dev/null
+++ b/src/models/repositories/federation-instance.ts
@@ -0,0 +1,106 @@
+import config from '../../config';
+
+export const packedFederationInstanceSchema = {
+ type: 'object' as const,
+ optional: false as const, nullable: false as const,
+ properties: {
+ id: {
+ type: 'string' as const,
+ optional: false as const, nullable: false as const,
+ format: 'id'
+ },
+ caughtAt: {
+ type: 'string' as const,
+ optional: false as const, nullable: false as const,
+ format: 'date-time'
+ },
+ host: {
+ type: 'string' as const,
+ optional: false as const, nullable: false as const,
+ example: 'misskey.example.com'
+ },
+ usersCount: {
+ type: 'number' as const,
+ optional: false as const, nullable: false as const
+ },
+ notesCount: {
+ type: 'number' as const,
+ optional: false as const, nullable: false as const
+ },
+ followingCount: {
+ type: 'number' as const,
+ optional: false as const, nullable: false as const
+ },
+ followersCount: {
+ type: 'number' as const,
+ optional: false as const, nullable: false as const
+ },
+ driveUsage: {
+ type: 'number' as const,
+ optional: false as const, nullable: false as const
+ },
+ driveFiles: {
+ type: 'number' as const,
+ optional: false as const, nullable: false as const
+ },
+ latestRequestSentAt: {
+ type: 'string' as const,
+ optional: false as const, nullable: true as const,
+ format: 'date-time'
+ },
+ lastCommunicatedAt: {
+ type: 'string' as const,
+ optional: false as const, nullable: false as const,
+ format: 'date-time'
+ },
+ isNotResponding: {
+ type: 'boolean' as const,
+ optional: false as const, nullable: false as const
+ },
+ isSuspended: {
+ type: 'boolean' as const,
+ optional: false as const, nullable: false as const
+ },
+ softwareName: {
+ type: 'string' as const,
+ optional: false as const, nullable: true as const,
+ example: 'misskey'
+ },
+ softwareVersion: {
+ type: 'string' as const,
+ optional: false as const, nullable: true as const,
+ example: config.version
+ },
+ openRegistrations: {
+ type: 'boolean' as const,
+ optional: false as const, nullable: true as const,
+ example: true
+ },
+ name: {
+ type: 'string' as const,
+ optional: false as const, nullable: true as const
+ },
+ description: {
+ type: 'string' as const,
+ optional: false as const, nullable: true as const
+ },
+ maintainerName: {
+ type: 'string' as const,
+ optional: false as const, nullable: true as const
+ },
+ maintainerEmail: {
+ type: 'string' as const,
+ optional: false as const, nullable: true as const
+ },
+ iconUrl: {
+ type: 'string' as const,
+ optional: false as const, nullable: true as const,
+ format: 'url'
+ },
+ infoUpdatedAt: {
+ type: 'string' as const,
+ optional: false as const, nullable: true as const,
+ format: 'date-time'
+ }
+ }
+};
diff --git a/src/models/repositories/queue.ts b/src/models/repositories/queue.ts
new file mode 100644
index 0000000000..161751ddc8
--- /dev/null
+++ b/src/models/repositories/queue.ts
@@ -0,0 +1,30 @@
+export const packedQueueCountSchema = {
+ type: 'object' as const,
+ optional: false as const, nullable: false as const,
+ properties: {
+ waiting: {
+ type: 'number' as const,
+ optional: false as const, nullable: false as const
+ },
+ active: {
+ type: 'number' as const,
+ optional: false as const, nullable: false as const
+ },
+ completed: {
+ type: 'number' as const,
+ optional: false as const, nullable: false as const
+ },
+ failed: {
+ type: 'number' as const,
+ optional: false as const, nullable: false as const
+ },
+ delayed: {
+ type: 'number' as const,
+ optional: false as const, nullable: false as const
+ },
+ paused: {
+ type: 'number' as const,
+ optional: false as const, nullable: false as const
+ }
+ }
+};
diff --git a/src/models/repositories/user.ts b/src/models/repositories/user.ts
index 7502e7a08e..3a6ab48c5f 100644
--- a/src/models/repositories/user.ts
+++ b/src/models/repositories/user.ts
@@ -330,22 +330,22 @@ export const packedUserSchema = {
description: 'The unique identifier for this User.',
example: 'xxxxxxxxxx',
},
+ name: {
+ type: 'string' as const,
+ nullable: true as const, optional: false as const,
+ description: 'The name of the user, as they’ve defined it.',
+ example: '藍'
+ },
username: {
type: 'string' as const,
nullable: false as const, optional: false as const,
description: 'The screen name, handle, or alias that this user identifies themselves with.',
example: 'ai'
},
- name: {
+ host: {
type: 'string' as const,
nullable: true as const, optional: false as const,
- description: 'The name of the user, as they’ve defined it.',
- example: '藍'
- },
- url: {
- type: 'string' as const,
- format: 'url',
- nullable: true as const, optional: true as const,
+ example: 'misskey.example.com'
},
avatarUrl: {
type: 'string' as const,
@@ -356,6 +356,80 @@ export const packedUserSchema = {
type: 'any' as const,
nullable: true as const, optional: false as const,
},
+ avatarColor: {
+ type: 'any' as const,
+ nullable: true as const, optional: false as const,
+ default: null
+ },
+ isAdmin: {
+ type: 'boolean' as const,
+ nullable: false as const, optional: false as const,
+ description: 'Whether this account is the admin.',
+ default: false
+ },
+ isModerator: {
+ type: 'boolean' as const,
+ nullable: false as const, optional: false as const,
+ description: 'Whether this account is a moderator.',
+ default: false
+ },
+ isBot: {
+ type: 'boolean' as const,
+ nullable: false as const, optional: true as const,
+ description: 'Whether this account is a bot.'
+ },
+ isCat: {
+ type: 'boolean' as const,
+ nullable: false as const, optional: true as const,
+ description: 'Whether this account is a cat.'
+ },
+ emojis: {
+ type: 'array' as const,
+ nullable: false as const, optional: false as const,
+ items: {
+ type: 'object' as const,
+ nullable: false as const, optional: false as const,
+ properties: {
+ name: {
+ type: 'string' as const,
+ nullable: false as const, optional: false as const
+ },
+ host: {
+ type: 'string' as const,
+ nullable: true as const, optional: false as const
+ },
+ url: {
+ type: 'string' as const,
+ nullable: false as const, optional: false as const,
+ format: 'url'
+ },
+ aliases: {
+ type: 'array' as const,
+ nullable: false as const, optional: false as const,
+ items: {
+ type: 'string' as const,
+ nullable: false as const, optional: false as const
+ }
+ }
+ }
+ }
+ },
+ url: {
+ type: 'string' as const,
+ format: 'url',
+ nullable: true as const, optional: true as const,
+ },
+ createdAt: {
+ type: 'string' as const,
+ nullable: false as const, optional: true as const,
+ format: 'date-time',
+ description: 'The date that the user account was created on Misskey.'
+ },
+ updatedAt: {
+ type: 'string' as const,
+ nullable: true as const, optional: true as const,
+ format: 'date-time',
+ },
bannerUrl: {
type: 'string' as const,
format: 'url',
@@ -365,14 +439,19 @@ export const packedUserSchema = {
type: 'any' as const,
nullable: true as const, optional: true as const,
},
- emojis: {
+ bannerColor: {
type: 'any' as const,
- nullable: true as const, optional: false as const,
+ nullable: true as const, optional: true as const,
+ default: null
},
- host: {
- type: 'string' as const,
- nullable: true as const, optional: false as const,
- example: 'misskey.example.com'
+ isLocked: {
+ type: 'boolean' as const,
+ nullable: false as const, optional: true as const,
+ },
+ isSuspended: {
+ type: 'boolean' as const,
+ nullable: false as const, optional: false as const,
+ example: false
},
description: {
type: 'string' as const,
@@ -380,25 +459,33 @@ export const packedUserSchema = {
description: 'The user-defined UTF-8 string describing their account.',
example: 'Hi masters, I am Ai!'
},
- birthday: {
+ location: {
type: 'string' as const,
nullable: true as const, optional: true as const,
- example: '2018-03-12'
- },
- createdAt: {
- type: 'string' as const,
- nullable: false as const, optional: true as const,
- format: 'date-time',
- description: 'The date that the user account was created on Misskey.'
},
- updatedAt: {
+ birthday: {
type: 'string' as const,
nullable: true as const, optional: true as const,
- format: 'date-time',
+ example: '2018-03-12'
},
- location: {
- type: 'string' as const,
- nullable: true as const, optional: true as const,
+ fields: {
+ type: 'array' as const,
+ nullable: false as const, optional: false as const,
+ items: {
+ type: 'object' as const,
+ nullable: false as const, optional: false as const,
+ properties: {
+ name: {
+ type: 'string' as const,
+ nullable: false as const, optional: false as const
+ },
+ value: {
+ type: 'string' as const,
+ nullable: false as const, optional: false as const
+ }
+ },
+ maxLength: 4
+ }
},
followersCount: {
type: 'number' as const,
@@ -415,11 +502,6 @@ export const packedUserSchema = {
nullable: false as const, optional: true as const,
description: 'The number of Notes (including renotes) issued by the user.'
},
- isBot: {
- type: 'boolean' as const,
- nullable: false as const, optional: true as const,
- description: 'Whether this account is a bot.'
- },
pinnedNoteIds: {
type: 'array' as const,
nullable: false as const, optional: true as const,
@@ -438,32 +520,131 @@ export const packedUserSchema = {
ref: 'Note'
}
},
- isCat: {
+ pinnedPageId: {
+ type: 'string' as const,
+ nullable: true as const, optional: false as const
+ },
+ pinnedPage: {
+ type: 'object' as const,
+ nullable: true as const, optional: false as const,
+ ref: 'Page'
+ },
+ twoFactorEnabled: {
+ type: 'boolean' as const,
+ nullable: false as const, optional: false as const,
+ default: false
+ },
+ usePasswordLessLogin: {
+ type: 'boolean' as const,
+ nullable: false as const, optional: false as const,
+ default: false
+ },
+ securityKeys: {
+ type: 'boolean' as const,
+ nullable: false as const, optional: false as const,
+ default: false
+ },
+ avatarId: {
+ type: 'string' as const,
+ nullable: true as const, optional: true as const,
+ format: 'id'
+ },
+ bannerId: {
+ type: 'string' as const,
+ nullable: true as const, optional: true as const,
+ format: 'id'
+ },
+ autoWatch: {
+ type: 'boolean' as const,
+ nullable: false as const, optional: true as const
+ },
+ injectFeaturedNote: {
+ type: 'boolean' as const,
+ nullable: false as const, optional: true as const
+ },
+ alwaysMarkNsfw: {
+ type: 'boolean' as const,
+ nullable: false as const, optional: true as const
+ },
+ carefulBot: {
+ type: 'boolean' as const,
+ nullable: false as const, optional: true as const
+ },
+ autoAcceptFollowed: {
+ type: 'boolean' as const,
+ nullable: false as const, optional: true as const
+ },
+ hasUnreadSpecifiedNotes: {
type: 'boolean' as const,
nullable: false as const, optional: true as const,
- description: 'Whether this account is a cat.'
},
- isAdmin: {
+ hasUnreadMentions: {
type: 'boolean' as const,
nullable: false as const, optional: true as const,
- description: 'Whether this account is the admin.'
},
- isModerator: {
+ hasUnreadAnnouncement: {
type: 'boolean' as const,
nullable: false as const, optional: true as const,
- description: 'Whether this account is a moderator.'
},
- isLocked: {
+ hasUnreadAntenna: {
type: 'boolean' as const,
nullable: false as const, optional: true as const,
},
- hasUnreadSpecifiedNotes: {
+ hasUnreadChannel: {
type: 'boolean' as const,
nullable: false as const, optional: true as const,
},
- hasUnreadMentions: {
+ hasUnreadMessagingMessage: {
type: 'boolean' as const,
nullable: false as const, optional: true as const,
},
+ hasUnreadNotification: {
+ type: 'boolean' as const,
+ nullable: false as const, optional: true as const,
+ },
+ hasPendingReceivedFollowRequest: {
+ type: 'boolean' as const,
+ nullable: false as const, optional: true as const,
+ },
+ integrations: {
+ type: 'object' as const,
+ nullable: false as const, optional: true as const
+ },
+ mutedWords: {
+ type: 'array' as const,
+ nullable: false as const, optional: true as const
+ },
+ mutingNotificationTypes: {
+ type: 'array' as const,
+ nullable: false as const, optional: true as const
+ },
+ isFollowing: {
+ type: 'boolean' as const,
+ optional: true as const, nullable: false as const
+ },
+ hasPendingFollowRequestFromYou: {
+ type: 'boolean' as const,
+ optional: true as const, nullable: false as const
+ },
+ hasPendingFollowRequestToYou: {
+ type: 'boolean' as const,
+ optional: true as const, nullable: false as const
+ },
+ isFollowed: {
+ type: 'boolean' as const,
+ optional: true as const, nullable: false as const
+ },
+ isBlocking: {
+ type: 'boolean' as const,
+ optional: true as const, nullable: false as const
+ },
+ isBlocked: {
+ type: 'boolean' as const,
+ optional: true as const, nullable: false as const
+ },
+ isMuted: {
+ type: 'boolean' as const,
+ optional: true as const, nullable: false as const
+ }
},
};