2017-03-04 20:09:34 -07:00
|
|
|
const ms = require('ms');
|
2016-12-28 15:49:51 -07:00
|
|
|
|
2017-03-01 06:33:43 -07:00
|
|
|
/**
|
|
|
|
* エンドポイントを表します。
|
|
|
|
*/
|
|
|
|
export type Endpoint = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* エンドポイント名
|
|
|
|
*/
|
2016-12-28 15:49:51 -07:00
|
|
|
name: string;
|
2017-03-01 06:33:43 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* このエンドポイントにリクエストするのにユーザー情報が必須か否か
|
|
|
|
* 省略した場合は false として解釈されます。
|
|
|
|
*/
|
|
|
|
withCredential?: boolean;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* エンドポイントのリミテーションに関するやつ
|
|
|
|
* 省略した場合はリミテーションは無いものとして解釈されます。
|
|
|
|
* また、withCredential が false の場合はリミテーションを行うことはできません。
|
|
|
|
*/
|
|
|
|
limit?: {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 複数のエンドポイントでリミットを共有したい場合に指定するキー
|
|
|
|
*/
|
|
|
|
key?: string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* リミットを適用する期間(ms)
|
|
|
|
* このプロパティを設定する場合、max プロパティも設定する必要があります。
|
|
|
|
*/
|
|
|
|
duration?: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* durationで指定した期間内にいくつまでリクエストできるのか
|
|
|
|
* このプロパティを設定する場合、duration プロパティも設定する必要があります。
|
|
|
|
*/
|
|
|
|
max?: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 最低でもどれくらいの間隔を開けてリクエストしなければならないか(ms)
|
|
|
|
*/
|
|
|
|
minInterval?: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ファイルの添付を必要とするか否か
|
|
|
|
* 省略した場合は false として解釈されます。
|
|
|
|
*/
|
2016-12-28 15:49:51 -07:00
|
|
|
withFile?: boolean;
|
2017-03-01 06:33:43 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* サードパーティアプリからはリクエストすることができないか否か
|
|
|
|
* 省略した場合は false として解釈されます。
|
|
|
|
*/
|
2016-12-28 15:49:51 -07:00
|
|
|
secure?: boolean;
|
2017-03-01 06:33:43 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* エンドポイントの種類
|
|
|
|
* パーミッションの実現に利用されます。
|
|
|
|
*/
|
2016-12-28 15:49:51 -07:00
|
|
|
kind?: string;
|
2017-03-01 06:33:43 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
const endpoints: Endpoint[] = [
|
|
|
|
{
|
|
|
|
name: 'meta'
|
|
|
|
},
|
2017-08-12 00:17:03 -06:00
|
|
|
{
|
|
|
|
name: 'stats'
|
|
|
|
},
|
2017-03-01 06:33:43 -07:00
|
|
|
{
|
|
|
|
name: 'username/available'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'my/apps',
|
|
|
|
withCredential: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'app/create',
|
|
|
|
withCredential: true,
|
|
|
|
limit: {
|
|
|
|
duration: ms('1day'),
|
|
|
|
max: 3
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'app/show'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'app/name_id/available'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'auth/session/generate'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'auth/session/show'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'auth/session/userkey'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'auth/accept',
|
|
|
|
withCredential: true,
|
|
|
|
secure: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'auth/deny',
|
|
|
|
withCredential: true,
|
|
|
|
secure: true
|
|
|
|
},
|
2017-08-12 00:17:03 -06:00
|
|
|
{
|
|
|
|
name: 'aggregation/posts',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'aggregation/users',
|
|
|
|
},
|
2017-03-13 08:33:02 -06:00
|
|
|
{
|
|
|
|
name: 'aggregation/users/activity',
|
|
|
|
},
|
2017-03-01 06:33:43 -07:00
|
|
|
{
|
|
|
|
name: 'aggregation/users/post',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'aggregation/users/followers'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'aggregation/users/following'
|
|
|
|
},
|
2017-05-24 01:29:00 -06:00
|
|
|
{
|
|
|
|
name: 'aggregation/users/reaction'
|
|
|
|
},
|
2017-03-01 06:33:43 -07:00
|
|
|
{
|
|
|
|
name: 'aggregation/posts/repost'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'aggregation/posts/reply'
|
|
|
|
},
|
2017-05-24 01:29:00 -06:00
|
|
|
{
|
|
|
|
name: 'aggregation/posts/reaction'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'aggregation/posts/reactions'
|
|
|
|
},
|
2017-03-01 06:33:43 -07:00
|
|
|
|
|
|
|
{
|
|
|
|
name: 'i',
|
|
|
|
withCredential: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'i/update',
|
|
|
|
withCredential: true,
|
|
|
|
limit: {
|
|
|
|
duration: ms('1day'),
|
|
|
|
max: 50
|
|
|
|
},
|
|
|
|
kind: 'account-write'
|
|
|
|
},
|
2017-08-28 09:20:47 -06:00
|
|
|
{
|
|
|
|
name: 'i/change_password',
|
|
|
|
withCredential: true
|
|
|
|
},
|
2017-08-28 08:47:43 -06:00
|
|
|
{
|
|
|
|
name: 'i/regenerate_token',
|
|
|
|
withCredential: true
|
|
|
|
},
|
2017-08-30 02:31:39 -06:00
|
|
|
{
|
|
|
|
name: 'i/pin',
|
|
|
|
kind: 'account-write'
|
|
|
|
},
|
2017-03-01 06:33:43 -07:00
|
|
|
{
|
|
|
|
name: 'i/appdata/get',
|
|
|
|
withCredential: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'i/appdata/set',
|
|
|
|
withCredential: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'i/signin_history',
|
|
|
|
withCredential: true,
|
|
|
|
kind: 'account-read'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'i/authorized_apps',
|
|
|
|
withCredential: true,
|
|
|
|
secure: true
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: 'i/notifications',
|
|
|
|
withCredential: true,
|
|
|
|
kind: 'notification-read'
|
|
|
|
},
|
|
|
|
{
|
2017-10-30 07:12:10 -06:00
|
|
|
name: 'notifications/get_unread_count',
|
2017-03-01 06:33:43 -07:00
|
|
|
withCredential: true,
|
2017-10-30 07:12:10 -06:00
|
|
|
kind: 'notification-read'
|
2017-03-01 06:33:43 -07:00
|
|
|
},
|
|
|
|
{
|
2017-10-30 07:12:10 -06:00
|
|
|
name: 'notifications/delete',
|
2017-03-01 06:33:43 -07:00
|
|
|
withCredential: true,
|
|
|
|
kind: 'notification-write'
|
|
|
|
},
|
|
|
|
{
|
2017-10-30 07:12:10 -06:00
|
|
|
name: 'notifications/delete_all',
|
2017-03-01 06:33:43 -07:00
|
|
|
withCredential: true,
|
|
|
|
kind: 'notification-write'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'notifications/mark_as_read_all',
|
|
|
|
withCredential: true,
|
|
|
|
kind: 'notification-write'
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: 'drive',
|
|
|
|
withCredential: true,
|
|
|
|
kind: 'drive-read'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'drive/stream',
|
|
|
|
withCredential: true,
|
|
|
|
kind: 'drive-read'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'drive/files',
|
|
|
|
withCredential: true,
|
|
|
|
kind: 'drive-read'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'drive/files/create',
|
|
|
|
withCredential: true,
|
|
|
|
limit: {
|
|
|
|
duration: ms('1hour'),
|
|
|
|
max: 100
|
|
|
|
},
|
|
|
|
withFile: true,
|
|
|
|
kind: 'drive-write'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'drive/files/upload_from_url',
|
|
|
|
withCredential: true,
|
|
|
|
limit: {
|
|
|
|
duration: ms('1hour'),
|
|
|
|
max: 10
|
|
|
|
},
|
|
|
|
kind: 'drive-write'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'drive/files/show',
|
|
|
|
withCredential: true,
|
|
|
|
kind: 'drive-read'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'drive/files/find',
|
|
|
|
withCredential: true,
|
|
|
|
kind: 'drive-read'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'drive/files/delete',
|
|
|
|
withCredential: true,
|
|
|
|
kind: 'drive-write'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'drive/files/update',
|
|
|
|
withCredential: true,
|
|
|
|
kind: 'drive-write'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'drive/folders',
|
|
|
|
withCredential: true,
|
|
|
|
kind: 'drive-read'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'drive/folders/create',
|
|
|
|
withCredential: true,
|
|
|
|
limit: {
|
|
|
|
duration: ms('1hour'),
|
|
|
|
max: 50
|
|
|
|
},
|
|
|
|
kind: 'drive-write'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'drive/folders/show',
|
|
|
|
withCredential: true,
|
|
|
|
kind: 'drive-read'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'drive/folders/find',
|
|
|
|
withCredential: true,
|
|
|
|
kind: 'drive-read'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'drive/folders/update',
|
|
|
|
withCredential: true,
|
|
|
|
kind: 'drive-write'
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: 'users'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'users/show'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'users/search'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'users/search_by_username'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'users/posts'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'users/following'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'users/followers'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'users/recommendation',
|
|
|
|
withCredential: true,
|
|
|
|
kind: 'account-read'
|
|
|
|
},
|
2017-09-08 08:29:33 -06:00
|
|
|
{
|
|
|
|
name: 'users/get_frequently_replied_users'
|
|
|
|
},
|
2017-03-01 06:33:43 -07:00
|
|
|
|
|
|
|
{
|
|
|
|
name: 'following/create',
|
|
|
|
withCredential: true,
|
|
|
|
limit: {
|
|
|
|
duration: ms('1hour'),
|
|
|
|
max: 100
|
|
|
|
},
|
|
|
|
kind: 'following-write'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'following/delete',
|
|
|
|
withCredential: true,
|
|
|
|
limit: {
|
|
|
|
duration: ms('1hour'),
|
|
|
|
max: 100
|
|
|
|
},
|
|
|
|
kind: 'following-write'
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
name: 'posts'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'posts/show'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'posts/replies'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'posts/context'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'posts/create',
|
|
|
|
withCredential: true,
|
|
|
|
limit: {
|
|
|
|
duration: ms('1hour'),
|
|
|
|
max: 120,
|
2017-03-02 10:20:34 -07:00
|
|
|
minInterval: ms('1second')
|
2017-03-01 06:33:43 -07:00
|
|
|
},
|
|
|
|
kind: 'post-write'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'posts/reposts'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'posts/search'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'posts/timeline',
|
|
|
|
withCredential: true,
|
|
|
|
limit: {
|
|
|
|
duration: ms('10minutes'),
|
|
|
|
max: 100
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'posts/mentions',
|
|
|
|
withCredential: true,
|
|
|
|
limit: {
|
|
|
|
duration: ms('10minutes'),
|
|
|
|
max: 100
|
|
|
|
}
|
|
|
|
},
|
2017-03-25 08:23:22 -06:00
|
|
|
{
|
|
|
|
name: 'posts/trend',
|
|
|
|
withCredential: true
|
|
|
|
},
|
2017-09-06 08:19:58 -06:00
|
|
|
{
|
|
|
|
name: 'posts/categorize',
|
|
|
|
withCredential: true
|
|
|
|
},
|
2017-03-01 06:33:43 -07:00
|
|
|
{
|
2017-03-19 13:24:19 -06:00
|
|
|
name: 'posts/reactions',
|
2017-03-01 06:33:43 -07:00
|
|
|
withCredential: true
|
|
|
|
},
|
|
|
|
{
|
2017-03-19 13:24:19 -06:00
|
|
|
name: 'posts/reactions/create',
|
2017-03-01 06:33:43 -07:00
|
|
|
withCredential: true,
|
|
|
|
limit: {
|
|
|
|
duration: ms('1hour'),
|
|
|
|
max: 100
|
|
|
|
},
|
2017-03-19 13:24:19 -06:00
|
|
|
kind: 'reaction-write'
|
2017-03-01 06:33:43 -07:00
|
|
|
},
|
|
|
|
{
|
2017-03-19 13:24:19 -06:00
|
|
|
name: 'posts/reactions/delete',
|
2017-03-01 06:33:43 -07:00
|
|
|
withCredential: true,
|
|
|
|
limit: {
|
|
|
|
duration: ms('1hour'),
|
|
|
|
max: 100
|
|
|
|
},
|
2017-03-19 13:24:19 -06:00
|
|
|
kind: 'reaction-write'
|
2017-03-01 06:33:43 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'posts/favorites/create',
|
|
|
|
withCredential: true,
|
|
|
|
limit: {
|
|
|
|
duration: ms('1hour'),
|
|
|
|
max: 100
|
|
|
|
},
|
|
|
|
kind: 'favorite-write'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'posts/favorites/delete',
|
|
|
|
withCredential: true,
|
|
|
|
limit: {
|
|
|
|
duration: ms('1hour'),
|
|
|
|
max: 100
|
|
|
|
},
|
|
|
|
kind: 'favorite-write'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'posts/polls/vote',
|
|
|
|
withCredential: true,
|
|
|
|
limit: {
|
|
|
|
duration: ms('1hour'),
|
|
|
|
max: 100
|
|
|
|
},
|
|
|
|
kind: 'vote-write'
|
|
|
|
},
|
2017-03-25 01:43:55 -06:00
|
|
|
{
|
|
|
|
name: 'posts/polls/recommendation',
|
|
|
|
withCredential: true
|
|
|
|
},
|
2017-03-01 06:33:43 -07:00
|
|
|
|
|
|
|
{
|
|
|
|
name: 'messaging/history',
|
|
|
|
withCredential: true,
|
|
|
|
kind: 'messaging-read'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'messaging/unread',
|
|
|
|
withCredential: true,
|
|
|
|
kind: 'messaging-read'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'messaging/messages',
|
|
|
|
withCredential: true,
|
|
|
|
kind: 'messaging-read'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'messaging/messages/create',
|
|
|
|
withCredential: true,
|
|
|
|
kind: 'messaging-write'
|
2017-10-31 07:35:31 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'channels/create',
|
|
|
|
withCredential: true,
|
|
|
|
limit: {
|
|
|
|
duration: ms('1hour'),
|
|
|
|
max: 3,
|
|
|
|
minInterval: ms('10seconds')
|
|
|
|
}
|
|
|
|
},
|
2017-10-31 08:11:22 -06:00
|
|
|
{
|
|
|
|
name: 'channels/show'
|
|
|
|
},
|
2017-10-31 09:10:30 -06:00
|
|
|
{
|
|
|
|
name: 'channels/posts'
|
|
|
|
},
|
2017-03-01 06:33:43 -07:00
|
|
|
];
|
|
|
|
|
|
|
|
export default endpoints;
|