[mastodon-client] Remove compiled megalodon code
This commit is contained in:
parent
a8f58fa912
commit
3ebd35ec0e
2
.gitignore
vendored
2
.gitignore
vendored
@ -48,6 +48,8 @@ packages/backend/assets/sounds/None.mp3
|
|||||||
|
|
||||||
!packages/backend/src/db
|
!packages/backend/src/db
|
||||||
|
|
||||||
|
/packages/megalodon/lib
|
||||||
|
|
||||||
# blender backups
|
# blender backups
|
||||||
*.blend1
|
*.blend1
|
||||||
*.blend2
|
*.blend2
|
||||||
|
5
packages/megalodon/lib/src/cancel.d.ts
vendored
5
packages/megalodon/lib/src/cancel.d.ts
vendored
@ -1,5 +0,0 @@
|
|||||||
export declare class RequestCanceledError extends Error {
|
|
||||||
isCancel: boolean;
|
|
||||||
constructor(msg: string);
|
|
||||||
}
|
|
||||||
export declare const isCancel: (value: any) => boolean;
|
|
@ -1,33 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __extends = (this && this.__extends) || (function () {
|
|
||||||
var extendStatics = function (d, b) {
|
|
||||||
extendStatics = Object.setPrototypeOf ||
|
|
||||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
||||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
||||||
return extendStatics(d, b);
|
|
||||||
};
|
|
||||||
return function (d, b) {
|
|
||||||
if (typeof b !== "function" && b !== null)
|
|
||||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
||||||
extendStatics(d, b);
|
|
||||||
function __() { this.constructor = d; }
|
|
||||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.isCancel = exports.RequestCanceledError = void 0;
|
|
||||||
var RequestCanceledError = (function (_super) {
|
|
||||||
__extends(RequestCanceledError, _super);
|
|
||||||
function RequestCanceledError(msg) {
|
|
||||||
var _this = _super.call(this, msg) || this;
|
|
||||||
_this.isCancel = true;
|
|
||||||
Object.setPrototypeOf(_this, RequestCanceledError);
|
|
||||||
return _this;
|
|
||||||
}
|
|
||||||
return RequestCanceledError;
|
|
||||||
}(Error));
|
|
||||||
exports.RequestCanceledError = RequestCanceledError;
|
|
||||||
var isCancel = function (value) {
|
|
||||||
return value && value.isCancel;
|
|
||||||
};
|
|
||||||
exports.isCancel = isCancel;
|
|
3
packages/megalodon/lib/src/converter.d.ts
vendored
3
packages/megalodon/lib/src/converter.d.ts
vendored
@ -1,3 +0,0 @@
|
|||||||
import MisskeyAPI from "./misskey/api_client";
|
|
||||||
declare const _default: typeof MisskeyAPI.Converter;
|
|
||||||
export default _default;
|
|
@ -1,7 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
var api_client_1 = __importDefault(require("./misskey/api_client"));
|
|
||||||
exports.default = api_client_1.default.Converter;
|
|
3
packages/megalodon/lib/src/default.d.ts
vendored
3
packages/megalodon/lib/src/default.d.ts
vendored
@ -1,3 +0,0 @@
|
|||||||
export declare const NO_REDIRECT = "urn:ietf:wg:oauth:2.0:oob";
|
|
||||||
export declare const DEFAULT_SCOPE: string[];
|
|
||||||
export declare const DEFAULT_UA = "megalodon";
|
|
@ -1,6 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.DEFAULT_UA = exports.DEFAULT_SCOPE = exports.NO_REDIRECT = void 0;
|
|
||||||
exports.NO_REDIRECT = 'urn:ietf:wg:oauth:2.0:oob';
|
|
||||||
exports.DEFAULT_SCOPE = ['read', 'write', 'follow'];
|
|
||||||
exports.DEFAULT_UA = 'megalodon';
|
|
27
packages/megalodon/lib/src/entities/account.d.ts
vendored
27
packages/megalodon/lib/src/entities/account.d.ts
vendored
@ -1,27 +0,0 @@
|
|||||||
/// <reference path="emoji.d.ts" />
|
|
||||||
/// <reference path="source.d.ts" />
|
|
||||||
/// <reference path="field.d.ts" />
|
|
||||||
declare namespace Entity {
|
|
||||||
type Account = {
|
|
||||||
id: string;
|
|
||||||
username: string;
|
|
||||||
acct: string;
|
|
||||||
display_name: string;
|
|
||||||
locked: boolean;
|
|
||||||
created_at: string;
|
|
||||||
followers_count: number;
|
|
||||||
following_count: number;
|
|
||||||
statuses_count: number;
|
|
||||||
note: string;
|
|
||||||
url: string;
|
|
||||||
avatar: string;
|
|
||||||
avatar_static: string;
|
|
||||||
header: string;
|
|
||||||
header_static: string;
|
|
||||||
emojis: Array<Emoji>;
|
|
||||||
moved: Account | null;
|
|
||||||
fields: Array<Field>;
|
|
||||||
bot: boolean | null;
|
|
||||||
source?: Source;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,8 +0,0 @@
|
|||||||
declare namespace Entity {
|
|
||||||
type Activity = {
|
|
||||||
week: string;
|
|
||||||
statuses: string;
|
|
||||||
logins: string;
|
|
||||||
registrations: string;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,31 +0,0 @@
|
|||||||
/// <reference path="tag.d.ts" />
|
|
||||||
/// <reference path="emoji.d.ts" />
|
|
||||||
/// <reference path="reaction.d.ts" />
|
|
||||||
declare namespace Entity {
|
|
||||||
type Announcement = {
|
|
||||||
id: string;
|
|
||||||
content: string;
|
|
||||||
starts_at: string | null;
|
|
||||||
ends_at: string | null;
|
|
||||||
published: boolean;
|
|
||||||
all_day: boolean;
|
|
||||||
published_at: string;
|
|
||||||
updated_at: string;
|
|
||||||
read?: boolean;
|
|
||||||
mentions: Array<AnnouncementAccount>;
|
|
||||||
statuses: Array<AnnouncementStatus>;
|
|
||||||
tags: Array<Tag>;
|
|
||||||
emojis: Array<Emoji>;
|
|
||||||
reactions: Array<Reaction>;
|
|
||||||
};
|
|
||||||
type AnnouncementAccount = {
|
|
||||||
id: string;
|
|
||||||
username: string;
|
|
||||||
url: string;
|
|
||||||
acct: string;
|
|
||||||
};
|
|
||||||
type AnnouncementStatus = {
|
|
||||||
id: string;
|
|
||||||
url: string;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,7 +0,0 @@
|
|||||||
declare namespace Entity {
|
|
||||||
type Application = {
|
|
||||||
name: string;
|
|
||||||
website?: string | null;
|
|
||||||
vapid_key?: string | null;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,14 +0,0 @@
|
|||||||
/// <reference path="attachment.d.ts" />
|
|
||||||
declare namespace Entity {
|
|
||||||
type AsyncAttachment = {
|
|
||||||
id: string;
|
|
||||||
type: 'unknown' | 'image' | 'gifv' | 'video' | 'audio';
|
|
||||||
url: string | null;
|
|
||||||
remote_url: string | null;
|
|
||||||
preview_url: string;
|
|
||||||
text_url: string | null;
|
|
||||||
meta: Meta | null;
|
|
||||||
description: string | null;
|
|
||||||
blurhash: string | null;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,41 +0,0 @@
|
|||||||
declare namespace Entity {
|
|
||||||
type Sub = {
|
|
||||||
width?: number;
|
|
||||||
height?: number;
|
|
||||||
size?: string;
|
|
||||||
aspect?: number;
|
|
||||||
frame_rate?: string;
|
|
||||||
duration?: number;
|
|
||||||
bitrate?: number;
|
|
||||||
};
|
|
||||||
type Focus = {
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
};
|
|
||||||
type Meta = {
|
|
||||||
original?: Sub;
|
|
||||||
small?: Sub;
|
|
||||||
focus?: Focus;
|
|
||||||
length?: string;
|
|
||||||
duration?: number;
|
|
||||||
fps?: number;
|
|
||||||
size?: string;
|
|
||||||
width?: number;
|
|
||||||
height?: number;
|
|
||||||
aspect?: number;
|
|
||||||
audio_encode?: string;
|
|
||||||
audio_bitrate?: string;
|
|
||||||
audio_channel?: string;
|
|
||||||
};
|
|
||||||
type Attachment = {
|
|
||||||
id: string;
|
|
||||||
type: 'unknown' | 'image' | 'gifv' | 'video' | 'audio';
|
|
||||||
url: string;
|
|
||||||
remote_url: string | null;
|
|
||||||
preview_url: string | null;
|
|
||||||
text_url: string | null;
|
|
||||||
meta: Meta | null;
|
|
||||||
description: string | null;
|
|
||||||
blurhash: string | null;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
16
packages/megalodon/lib/src/entities/card.d.ts
vendored
16
packages/megalodon/lib/src/entities/card.d.ts
vendored
@ -1,16 +0,0 @@
|
|||||||
declare namespace Entity {
|
|
||||||
type Card = {
|
|
||||||
url: string;
|
|
||||||
title: string;
|
|
||||||
description: string;
|
|
||||||
type: 'link' | 'photo' | 'video' | 'rich';
|
|
||||||
image?: string;
|
|
||||||
author_name?: string;
|
|
||||||
author_url?: string;
|
|
||||||
provider_name?: string;
|
|
||||||
provider_url?: string;
|
|
||||||
html?: string;
|
|
||||||
width?: number;
|
|
||||||
height?: number;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,7 +0,0 @@
|
|||||||
/// <reference path="status.d.ts" />
|
|
||||||
declare namespace Entity {
|
|
||||||
type Context = {
|
|
||||||
ancestors: Array<Status>;
|
|
||||||
descendants: Array<Status>;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,10 +0,0 @@
|
|||||||
/// <reference path="account.d.ts" />
|
|
||||||
/// <reference path="status.d.ts" />
|
|
||||||
declare namespace Entity {
|
|
||||||
type Conversation = {
|
|
||||||
id: string;
|
|
||||||
accounts: Array<Account>;
|
|
||||||
last_status: Status | null;
|
|
||||||
unread: boolean;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,9 +0,0 @@
|
|||||||
declare namespace Entity {
|
|
||||||
type Emoji = {
|
|
||||||
shortcode: string;
|
|
||||||
static_url: string;
|
|
||||||
url: string;
|
|
||||||
visible_in_picker: boolean;
|
|
||||||
category: string;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,8 +0,0 @@
|
|||||||
declare namespace Entity {
|
|
||||||
type FeaturedTag = {
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
statuses_count: number;
|
|
||||||
last_status_at: string;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,7 +0,0 @@
|
|||||||
declare namespace Entity {
|
|
||||||
type Field = {
|
|
||||||
name: string;
|
|
||||||
value: string;
|
|
||||||
verified_at: string | null;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
11
packages/megalodon/lib/src/entities/filter.d.ts
vendored
11
packages/megalodon/lib/src/entities/filter.d.ts
vendored
@ -1,11 +0,0 @@
|
|||||||
declare namespace Entity {
|
|
||||||
type Filter = {
|
|
||||||
id: string;
|
|
||||||
phrase: string;
|
|
||||||
context: Array<FilterContext>;
|
|
||||||
expires_at: string | null;
|
|
||||||
irreversible: boolean;
|
|
||||||
whole_word: boolean;
|
|
||||||
};
|
|
||||||
type FilterContext = string;
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,7 +0,0 @@
|
|||||||
declare namespace Entity {
|
|
||||||
type History = {
|
|
||||||
day: string;
|
|
||||||
uses: number;
|
|
||||||
accounts: number;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,9 +0,0 @@
|
|||||||
declare namespace Entity {
|
|
||||||
type IdentityProof = {
|
|
||||||
provider: string;
|
|
||||||
provider_username: string;
|
|
||||||
updated_at: string;
|
|
||||||
proof_url: string;
|
|
||||||
profile_url: string;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,40 +0,0 @@
|
|||||||
/// <reference path="account.d.ts" />
|
|
||||||
/// <reference path="urls.d.ts" />
|
|
||||||
/// <reference path="stats.d.ts" />
|
|
||||||
declare namespace Entity {
|
|
||||||
type Instance = {
|
|
||||||
uri: string;
|
|
||||||
title: string;
|
|
||||||
description: string;
|
|
||||||
email: string;
|
|
||||||
version: string;
|
|
||||||
thumbnail: string | null;
|
|
||||||
urls: URLs;
|
|
||||||
stats: Stats;
|
|
||||||
languages: Array<string>;
|
|
||||||
contact_account: Account | null;
|
|
||||||
max_toot_chars?: number;
|
|
||||||
registrations?: boolean;
|
|
||||||
configuration?: {
|
|
||||||
statuses: {
|
|
||||||
max_characters: number;
|
|
||||||
max_media_attachments: number;
|
|
||||||
characters_reserved_per_url: number;
|
|
||||||
};
|
|
||||||
media_attachments: {
|
|
||||||
supported_mime_types: Array<string>;
|
|
||||||
image_size_limit: number;
|
|
||||||
image_matrix_limit: number;
|
|
||||||
video_size_limit: number;
|
|
||||||
video_frame_limit: number;
|
|
||||||
video_matrix_limit: number;
|
|
||||||
};
|
|
||||||
polls: {
|
|
||||||
max_options: number;
|
|
||||||
max_characters_per_option: number;
|
|
||||||
min_expiration: number;
|
|
||||||
max_expiration: number;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,6 +0,0 @@
|
|||||||
declare namespace Entity {
|
|
||||||
type List = {
|
|
||||||
id: string;
|
|
||||||
title: string;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
15
packages/megalodon/lib/src/entities/marker.d.ts
vendored
15
packages/megalodon/lib/src/entities/marker.d.ts
vendored
@ -1,15 +0,0 @@
|
|||||||
declare namespace Entity {
|
|
||||||
type Marker = {
|
|
||||||
home?: {
|
|
||||||
last_read_id: string;
|
|
||||||
version: number;
|
|
||||||
updated_at: string;
|
|
||||||
};
|
|
||||||
notifications?: {
|
|
||||||
last_read_id: string;
|
|
||||||
version: number;
|
|
||||||
updated_at: string;
|
|
||||||
unread_count?: number;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,8 +0,0 @@
|
|||||||
declare namespace Entity {
|
|
||||||
type Mention = {
|
|
||||||
id: string;
|
|
||||||
username: string;
|
|
||||||
url: string;
|
|
||||||
acct: string;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,13 +0,0 @@
|
|||||||
/// <reference path="account.d.ts" />
|
|
||||||
/// <reference path="status.d.ts" />
|
|
||||||
declare namespace Entity {
|
|
||||||
type Notification = {
|
|
||||||
account: Account;
|
|
||||||
created_at: string;
|
|
||||||
id: string;
|
|
||||||
status?: Status;
|
|
||||||
emoji?: string;
|
|
||||||
type: NotificationType;
|
|
||||||
};
|
|
||||||
type NotificationType = string;
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
12
packages/megalodon/lib/src/entities/poll.d.ts
vendored
12
packages/megalodon/lib/src/entities/poll.d.ts
vendored
@ -1,12 +0,0 @@
|
|||||||
/// <reference path="poll_option.d.ts" />
|
|
||||||
declare namespace Entity {
|
|
||||||
type Poll = {
|
|
||||||
id: string;
|
|
||||||
expires_at: string | null;
|
|
||||||
expired: boolean;
|
|
||||||
multiple: boolean;
|
|
||||||
votes_count: number;
|
|
||||||
options: Array<PollOption>;
|
|
||||||
voted: boolean;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,6 +0,0 @@
|
|||||||
declare namespace Entity {
|
|
||||||
type PollOption = {
|
|
||||||
title: string;
|
|
||||||
votes_count: number | null;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,9 +0,0 @@
|
|||||||
declare namespace Entity {
|
|
||||||
type Preferences = {
|
|
||||||
'posting:default:visibility': 'public' | 'unlisted' | 'private' | 'direct';
|
|
||||||
'posting:default:sensitive': boolean;
|
|
||||||
'posting:default:language': string | null;
|
|
||||||
'reading:expand:media': 'default' | 'show_all' | 'hide_all';
|
|
||||||
'reading:expand:spoilers': boolean;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,15 +0,0 @@
|
|||||||
declare namespace Entity {
|
|
||||||
type Alerts = {
|
|
||||||
follow: boolean;
|
|
||||||
favourite: boolean;
|
|
||||||
mention: boolean;
|
|
||||||
reblog: boolean;
|
|
||||||
poll: boolean;
|
|
||||||
};
|
|
||||||
type PushSubscription = {
|
|
||||||
id: string;
|
|
||||||
endpoint: string;
|
|
||||||
server_key: string;
|
|
||||||
alerts: Alerts;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,10 +0,0 @@
|
|||||||
/// <reference path="account.d.ts" />
|
|
||||||
declare namespace Entity {
|
|
||||||
type Reaction = {
|
|
||||||
count: number;
|
|
||||||
me: boolean;
|
|
||||||
name: string;
|
|
||||||
url?: string;
|
|
||||||
accounts?: Array<Account>;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,17 +0,0 @@
|
|||||||
declare namespace Entity {
|
|
||||||
type Relationship = {
|
|
||||||
id: string;
|
|
||||||
following: boolean;
|
|
||||||
followed_by: boolean;
|
|
||||||
delivery_following?: boolean;
|
|
||||||
blocking: boolean;
|
|
||||||
blocked_by: boolean;
|
|
||||||
muting: boolean;
|
|
||||||
muting_notifications: boolean;
|
|
||||||
requested: boolean;
|
|
||||||
domain_blocking: boolean;
|
|
||||||
showing_reblogs: boolean;
|
|
||||||
endorsed: boolean;
|
|
||||||
notifying: boolean;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,9 +0,0 @@
|
|||||||
declare namespace Entity {
|
|
||||||
type Report = {
|
|
||||||
id: string;
|
|
||||||
action_taken: string;
|
|
||||||
comment: string;
|
|
||||||
account_id: string;
|
|
||||||
status_ids: Array<string>;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
10
packages/megalodon/lib/src/entities/results.d.ts
vendored
10
packages/megalodon/lib/src/entities/results.d.ts
vendored
@ -1,10 +0,0 @@
|
|||||||
/// <reference path="account.d.ts" />
|
|
||||||
/// <reference path="status.d.ts" />
|
|
||||||
/// <reference path="tag.d.ts" />
|
|
||||||
declare namespace Entity {
|
|
||||||
type Results = {
|
|
||||||
accounts: Array<Account>;
|
|
||||||
statuses: Array<Status>;
|
|
||||||
hashtags: Array<Tag>;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,10 +0,0 @@
|
|||||||
/// <reference path="attachment.d.ts" />
|
|
||||||
/// <reference path="status_params.d.ts" />
|
|
||||||
declare namespace Entity {
|
|
||||||
type ScheduledStatus = {
|
|
||||||
id: string;
|
|
||||||
scheduled_at: string;
|
|
||||||
params: StatusParams;
|
|
||||||
media_attachments: Array<Attachment>;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
10
packages/megalodon/lib/src/entities/source.d.ts
vendored
10
packages/megalodon/lib/src/entities/source.d.ts
vendored
@ -1,10 +0,0 @@
|
|||||||
/// <reference path="field.d.ts" />
|
|
||||||
declare namespace Entity {
|
|
||||||
type Source = {
|
|
||||||
privacy: string | null;
|
|
||||||
sensitive: boolean | null;
|
|
||||||
language: string | null;
|
|
||||||
note: string;
|
|
||||||
fields: Array<Field>;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,7 +0,0 @@
|
|||||||
declare namespace Entity {
|
|
||||||
type Stats = {
|
|
||||||
user_count: number;
|
|
||||||
status_count: number;
|
|
||||||
domain_count: number;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
44
packages/megalodon/lib/src/entities/status.d.ts
vendored
44
packages/megalodon/lib/src/entities/status.d.ts
vendored
@ -1,44 +0,0 @@
|
|||||||
/// <reference path="account.d.ts" />
|
|
||||||
/// <reference path="application.d.ts" />
|
|
||||||
/// <reference path="mention.d.ts" />
|
|
||||||
/// <reference path="tag.d.ts" />
|
|
||||||
/// <reference path="attachment.d.ts" />
|
|
||||||
/// <reference path="emoji.d.ts" />
|
|
||||||
/// <reference path="card.d.ts" />
|
|
||||||
/// <reference path="poll.d.ts" />
|
|
||||||
/// <reference path="reaction.d.ts" />
|
|
||||||
declare namespace Entity {
|
|
||||||
type Status = {
|
|
||||||
id: string;
|
|
||||||
uri: string;
|
|
||||||
url: string;
|
|
||||||
account: Account;
|
|
||||||
in_reply_to_id: string | null;
|
|
||||||
in_reply_to_account_id: string | null;
|
|
||||||
reblog: Status | null;
|
|
||||||
content: string;
|
|
||||||
plain_content: string | null;
|
|
||||||
created_at: string;
|
|
||||||
emojis: Emoji[];
|
|
||||||
replies_count: number;
|
|
||||||
reblogs_count: number;
|
|
||||||
favourites_count: number;
|
|
||||||
reblogged: boolean | null;
|
|
||||||
favourited: boolean | null;
|
|
||||||
muted: boolean | null;
|
|
||||||
sensitive: boolean;
|
|
||||||
spoiler_text: string;
|
|
||||||
visibility: 'public' | 'unlisted' | 'private' | 'direct';
|
|
||||||
media_attachments: Array<Attachment>;
|
|
||||||
mentions: Array<Mention>;
|
|
||||||
tags: Array<Tag>;
|
|
||||||
card: Card | null;
|
|
||||||
poll: Poll | null;
|
|
||||||
application: Application | null;
|
|
||||||
language: string | null;
|
|
||||||
pinned: boolean | null;
|
|
||||||
emoji_reactions: Array<Reaction>;
|
|
||||||
quote: Status | null;
|
|
||||||
bookmarked: boolean;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,22 +0,0 @@
|
|||||||
/// <reference path="account.d.ts" />
|
|
||||||
/// <reference path="application.d.ts" />
|
|
||||||
/// <reference path="mention.d.ts" />
|
|
||||||
/// <reference path="tag.d.ts" />
|
|
||||||
/// <reference path="attachment.d.ts" />
|
|
||||||
/// <reference path="emoji.d.ts" />
|
|
||||||
/// <reference path="card.d.ts" />
|
|
||||||
/// <reference path="poll.d.ts" />
|
|
||||||
/// <reference path="reaction.d.ts" />
|
|
||||||
declare namespace Entity {
|
|
||||||
type StatusEdit = {
|
|
||||||
account: Account;
|
|
||||||
content: string;
|
|
||||||
plain_content: string | null;
|
|
||||||
created_at: string;
|
|
||||||
emojis: Emoji[];
|
|
||||||
sensitive: boolean;
|
|
||||||
spoiler_text: string;
|
|
||||||
media_attachments: Array<Attachment>;
|
|
||||||
poll: Poll | null;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,12 +0,0 @@
|
|||||||
declare namespace Entity {
|
|
||||||
type StatusParams = {
|
|
||||||
text: string;
|
|
||||||
in_reply_to_id: string | null;
|
|
||||||
media_ids: Array<string> | null;
|
|
||||||
sensitive: boolean | null;
|
|
||||||
spoiler_text: string | null;
|
|
||||||
visibility: 'public' | 'unlisted' | 'private' | 'direct';
|
|
||||||
scheduled_at: string | null;
|
|
||||||
application_id: string;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
9
packages/megalodon/lib/src/entities/tag.d.ts
vendored
9
packages/megalodon/lib/src/entities/tag.d.ts
vendored
@ -1,9 +0,0 @@
|
|||||||
/// <reference path="history.d.ts" />
|
|
||||||
declare namespace Entity {
|
|
||||||
type Tag = {
|
|
||||||
name: string;
|
|
||||||
url: string;
|
|
||||||
history: Array<History> | null;
|
|
||||||
following?: boolean;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,8 +0,0 @@
|
|||||||
declare namespace Entity {
|
|
||||||
type Token = {
|
|
||||||
access_token: string;
|
|
||||||
token_type: string;
|
|
||||||
scope: string;
|
|
||||||
created_at: number;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,5 +0,0 @@
|
|||||||
declare namespace Entity {
|
|
||||||
type URLs = {
|
|
||||||
streaming_api: string;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
37
packages/megalodon/lib/src/entity.d.ts
vendored
37
packages/megalodon/lib/src/entity.d.ts
vendored
@ -1,37 +0,0 @@
|
|||||||
/// <reference path="entities/account.d.ts" />
|
|
||||||
/// <reference path="entities/activity.d.ts" />
|
|
||||||
/// <reference path="entities/announcement.d.ts" />
|
|
||||||
/// <reference path="entities/application.d.ts" />
|
|
||||||
/// <reference path="entities/async_attachment.d.ts" />
|
|
||||||
/// <reference path="entities/attachment.d.ts" />
|
|
||||||
/// <reference path="entities/card.d.ts" />
|
|
||||||
/// <reference path="entities/context.d.ts" />
|
|
||||||
/// <reference path="entities/conversation.d.ts" />
|
|
||||||
/// <reference path="entities/emoji.d.ts" />
|
|
||||||
/// <reference path="entities/featured_tag.d.ts" />
|
|
||||||
/// <reference path="entities/field.d.ts" />
|
|
||||||
/// <reference path="entities/filter.d.ts" />
|
|
||||||
/// <reference path="entities/history.d.ts" />
|
|
||||||
/// <reference path="entities/identity_proof.d.ts" />
|
|
||||||
/// <reference path="entities/instance.d.ts" />
|
|
||||||
/// <reference path="entities/list.d.ts" />
|
|
||||||
/// <reference path="entities/marker.d.ts" />
|
|
||||||
/// <reference path="entities/mention.d.ts" />
|
|
||||||
/// <reference path="entities/notification.d.ts" />
|
|
||||||
/// <reference path="entities/poll.d.ts" />
|
|
||||||
/// <reference path="entities/poll_option.d.ts" />
|
|
||||||
/// <reference path="entities/preferences.d.ts" />
|
|
||||||
/// <reference path="entities/push_subscription.d.ts" />
|
|
||||||
/// <reference path="entities/reaction.d.ts" />
|
|
||||||
/// <reference path="entities/relationship.d.ts" />
|
|
||||||
/// <reference path="entities/report.d.ts" />
|
|
||||||
/// <reference path="entities/results.d.ts" />
|
|
||||||
/// <reference path="entities/scheduled_status.d.ts" />
|
|
||||||
/// <reference path="entities/source.d.ts" />
|
|
||||||
/// <reference path="entities/stats.d.ts" />
|
|
||||||
/// <reference path="entities/status.d.ts" />
|
|
||||||
/// <reference path="entities/status_params.d.ts" />
|
|
||||||
/// <reference path="entities/tag.d.ts" />
|
|
||||||
/// <reference path="entities/token.d.ts" />
|
|
||||||
/// <reference path="entities/urls.d.ts" />
|
|
||||||
export default Entity;
|
|
@ -1,2 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@ -1,9 +0,0 @@
|
|||||||
import Entity from './entity';
|
|
||||||
declare namespace FilterContext {
|
|
||||||
const Home: Entity.FilterContext;
|
|
||||||
const Notifications: Entity.FilterContext;
|
|
||||||
const Public: Entity.FilterContext;
|
|
||||||
const Thread: Entity.FilterContext;
|
|
||||||
const Account: Entity.FilterContext;
|
|
||||||
}
|
|
||||||
export default FilterContext;
|
|
@ -1,11 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
var FilterContext;
|
|
||||||
(function (FilterContext) {
|
|
||||||
FilterContext.Home = 'home';
|
|
||||||
FilterContext.Notifications = 'notifications';
|
|
||||||
FilterContext.Public = 'public';
|
|
||||||
FilterContext.Thread = 'thread';
|
|
||||||
FilterContext.Account = 'account';
|
|
||||||
})(FilterContext || (FilterContext = {}));
|
|
||||||
exports.default = FilterContext;
|
|
12
packages/megalodon/lib/src/index.d.ts
vendored
12
packages/megalodon/lib/src/index.d.ts
vendored
@ -1,12 +0,0 @@
|
|||||||
import Response from './response';
|
|
||||||
import OAuth from './oauth';
|
|
||||||
import { isCancel, RequestCanceledError } from './cancel';
|
|
||||||
import { ProxyConfig } from './proxy_config';
|
|
||||||
import generator, { detector, MegalodonInterface, WebSocketInterface } from './megalodon';
|
|
||||||
import Misskey from './misskey';
|
|
||||||
import Entity from './entity';
|
|
||||||
import NotificationType from './notification';
|
|
||||||
import FilterContext from './filter_context';
|
|
||||||
import Converter from './converter';
|
|
||||||
export { Response, OAuth, RequestCanceledError, isCancel, ProxyConfig, detector, MegalodonInterface, WebSocketInterface, NotificationType, FilterContext, Misskey, Entity, Converter };
|
|
||||||
export default generator;
|
|
@ -1,45 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
||||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
||||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
||||||
}
|
|
||||||
Object.defineProperty(o, k2, desc);
|
|
||||||
}) : (function(o, m, k, k2) {
|
|
||||||
if (k2 === undefined) k2 = k;
|
|
||||||
o[k2] = m[k];
|
|
||||||
}));
|
|
||||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
||||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
||||||
}) : function(o, v) {
|
|
||||||
o["default"] = v;
|
|
||||||
});
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
||||||
__setModuleDefault(result, mod);
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
exports.Converter = exports.Misskey = exports.FilterContext = exports.NotificationType = exports.detector = exports.isCancel = exports.RequestCanceledError = exports.OAuth = void 0;
|
|
||||||
var oauth_1 = __importDefault(require("./oauth"));
|
|
||||||
exports.OAuth = oauth_1.default;
|
|
||||||
var cancel_1 = require("./cancel");
|
|
||||||
Object.defineProperty(exports, "isCancel", { enumerable: true, get: function () { return cancel_1.isCancel; } });
|
|
||||||
Object.defineProperty(exports, "RequestCanceledError", { enumerable: true, get: function () { return cancel_1.RequestCanceledError; } });
|
|
||||||
var megalodon_1 = __importStar(require("./megalodon"));
|
|
||||||
Object.defineProperty(exports, "detector", { enumerable: true, get: function () { return megalodon_1.detector; } });
|
|
||||||
var misskey_1 = __importDefault(require("./misskey"));
|
|
||||||
exports.Misskey = misskey_1.default;
|
|
||||||
var notification_1 = __importDefault(require("./notification"));
|
|
||||||
exports.NotificationType = notification_1.default;
|
|
||||||
var filter_context_1 = __importDefault(require("./filter_context"));
|
|
||||||
exports.FilterContext = filter_context_1.default;
|
|
||||||
var converter_1 = __importDefault(require("./converter"));
|
|
||||||
exports.Converter = converter_1.default;
|
|
||||||
exports.default = megalodon_1.default;
|
|
374
packages/megalodon/lib/src/mastodon.d.ts
vendored
374
packages/megalodon/lib/src/mastodon.d.ts
vendored
@ -1,374 +0,0 @@
|
|||||||
import MastodonAPI from './mastodon/api_client';
|
|
||||||
import WebSocket from './mastodon/web_socket';
|
|
||||||
import { MegalodonInterface } from './megalodon';
|
|
||||||
import Response from './response';
|
|
||||||
import Entity from './entity';
|
|
||||||
import { ProxyConfig } from './proxy_config';
|
|
||||||
import OAuth from './oauth';
|
|
||||||
export default class Mastodon implements MegalodonInterface {
|
|
||||||
client: MastodonAPI.Interface;
|
|
||||||
baseUrl: string;
|
|
||||||
constructor(baseUrl: string, accessToken?: string | null, userAgent?: string | null, proxyConfig?: ProxyConfig | false);
|
|
||||||
cancel(): void;
|
|
||||||
registerApp(client_name: string, options: Partial<{
|
|
||||||
scopes: Array<string>;
|
|
||||||
redirect_uris: string;
|
|
||||||
website: string;
|
|
||||||
}>): Promise<OAuth.AppData>;
|
|
||||||
createApp(client_name: string, options: Partial<{
|
|
||||||
scopes: Array<string>;
|
|
||||||
redirect_uris: string;
|
|
||||||
website: string;
|
|
||||||
}>): Promise<OAuth.AppData>;
|
|
||||||
generateAuthUrl(clientId: string, clientSecret: string, options: Partial<{
|
|
||||||
scope: Array<string>;
|
|
||||||
redirect_uri: string;
|
|
||||||
}>): Promise<string>;
|
|
||||||
verifyAppCredentials(): Promise<Response<Entity.Application>>;
|
|
||||||
fetchAccessToken(client_id: string | null, client_secret: string, code: string, redirect_uri?: string): Promise<OAuth.TokenData>;
|
|
||||||
refreshToken(client_id: string, client_secret: string, refresh_token: string): Promise<OAuth.TokenData>;
|
|
||||||
revokeToken(client_id: string, client_secret: string, token: string): Promise<Response<{}>>;
|
|
||||||
registerAccount(username: string, email: string, password: string, agreement: boolean, locale: string, reason?: string | null): Promise<Response<Entity.Token>>;
|
|
||||||
verifyAccountCredentials(): Promise<Response<Entity.Account>>;
|
|
||||||
updateCredentials(options?: {
|
|
||||||
discoverable?: boolean;
|
|
||||||
bot?: boolean;
|
|
||||||
display_name?: string;
|
|
||||||
note?: string;
|
|
||||||
avatar?: string;
|
|
||||||
header?: string;
|
|
||||||
locked?: boolean;
|
|
||||||
source?: {
|
|
||||||
privacy?: string;
|
|
||||||
sensitive?: boolean;
|
|
||||||
language?: string;
|
|
||||||
};
|
|
||||||
fields_attributes?: Array<{
|
|
||||||
name: string;
|
|
||||||
value: string;
|
|
||||||
}>;
|
|
||||||
}): Promise<Response<Entity.Account>>;
|
|
||||||
getAccount(id: string): Promise<Response<Entity.Account>>;
|
|
||||||
getAccountStatuses(id: string, options?: {
|
|
||||||
limit?: number;
|
|
||||||
max_id?: string;
|
|
||||||
since_id?: string;
|
|
||||||
min_id?: string;
|
|
||||||
pinned?: boolean;
|
|
||||||
exclude_replies?: boolean;
|
|
||||||
exclude_reblogs?: boolean;
|
|
||||||
only_media: boolean;
|
|
||||||
}): Promise<Response<Array<Entity.Status>>>;
|
|
||||||
subscribeAccount(id: string): Promise<Response<Entity.Relationship>>;
|
|
||||||
unsubscribeAccount(id: string): Promise<Response<Entity.Relationship>>;
|
|
||||||
getAccountFavourites(_id: string, _options?: {
|
|
||||||
limit?: number;
|
|
||||||
max_id?: string;
|
|
||||||
since_id?: string;
|
|
||||||
}): Promise<Response<Array<Entity.Status>>>;
|
|
||||||
getAccountFollowers(id: string, options?: {
|
|
||||||
limit?: number;
|
|
||||||
max_id?: string;
|
|
||||||
since_id?: string;
|
|
||||||
get_all?: boolean;
|
|
||||||
sleep_ms?: number;
|
|
||||||
}): Promise<Response<Array<Entity.Account>>>;
|
|
||||||
getAccountFollowing(id: string, options?: {
|
|
||||||
limit?: number;
|
|
||||||
max_id?: string;
|
|
||||||
since_id?: string;
|
|
||||||
get_all?: boolean;
|
|
||||||
sleep_ms?: number;
|
|
||||||
}): Promise<Response<Array<Entity.Account>>>;
|
|
||||||
private urlToAccounts;
|
|
||||||
getAccountLists(id: string): Promise<Response<Array<Entity.List>>>;
|
|
||||||
getIdentityProof(id: string): Promise<Response<Array<Entity.IdentityProof>>>;
|
|
||||||
followAccount(id: string, options?: {
|
|
||||||
reblog?: boolean;
|
|
||||||
}): Promise<Response<Entity.Relationship>>;
|
|
||||||
unfollowAccount(id: string): Promise<Response<Entity.Relationship>>;
|
|
||||||
blockAccount(id: string): Promise<Response<Entity.Relationship>>;
|
|
||||||
unblockAccount(id: string): Promise<Response<Entity.Relationship>>;
|
|
||||||
muteAccount(id: string, notifications?: boolean): Promise<Response<Entity.Relationship>>;
|
|
||||||
unmuteAccount(id: string): Promise<Response<Entity.Relationship>>;
|
|
||||||
pinAccount(id: string): Promise<Response<Entity.Relationship>>;
|
|
||||||
unpinAccount(id: string): Promise<Response<Entity.Relationship>>;
|
|
||||||
getRelationship(id: string): Promise<Response<Entity.Relationship>>;
|
|
||||||
getRelationships(ids: Array<string>): Promise<Response<Array<Entity.Relationship>>>;
|
|
||||||
searchAccount(q: string, options?: {
|
|
||||||
following?: boolean;
|
|
||||||
resolve?: boolean;
|
|
||||||
limit?: number;
|
|
||||||
max_id?: string;
|
|
||||||
since_id?: string;
|
|
||||||
}): Promise<Response<Array<Entity.Account>>>;
|
|
||||||
getBookmarks(options?: {
|
|
||||||
limit?: number;
|
|
||||||
max_id?: string;
|
|
||||||
since_id?: string;
|
|
||||||
min_id?: string;
|
|
||||||
}): Promise<Response<Array<Entity.Status>>>;
|
|
||||||
getFavourites(options?: {
|
|
||||||
limit?: number;
|
|
||||||
max_id?: string;
|
|
||||||
min_id?: string;
|
|
||||||
}): Promise<Response<Array<Entity.Status>>>;
|
|
||||||
getMutes(options?: {
|
|
||||||
limit?: number;
|
|
||||||
max_id?: string;
|
|
||||||
min_id?: string;
|
|
||||||
}): Promise<Response<Array<Entity.Account>>>;
|
|
||||||
getBlocks(options?: {
|
|
||||||
limit?: number;
|
|
||||||
max_id?: string;
|
|
||||||
min_id?: string;
|
|
||||||
}): Promise<Response<Array<Entity.Account>>>;
|
|
||||||
getDomainBlocks(options?: {
|
|
||||||
limit?: number;
|
|
||||||
max_id?: string;
|
|
||||||
min_id?: string;
|
|
||||||
}): Promise<Response<Array<string>>>;
|
|
||||||
blockDomain(domain: string): Promise<Response<{}>>;
|
|
||||||
unblockDomain(domain: string): Promise<Response<{}>>;
|
|
||||||
getFilters(): Promise<Response<Array<Entity.Filter>>>;
|
|
||||||
getFilter(id: string): Promise<Response<Entity.Filter>>;
|
|
||||||
createFilter(phrase: string, context: Array<Entity.FilterContext>, options?: {
|
|
||||||
irreversible?: boolean;
|
|
||||||
whole_word?: boolean;
|
|
||||||
expires_in?: string;
|
|
||||||
}): Promise<Response<Entity.Filter>>;
|
|
||||||
updateFilter(id: string, phrase: string, context: Array<Entity.FilterContext>, options?: {
|
|
||||||
irreversible?: boolean;
|
|
||||||
whole_word?: boolean;
|
|
||||||
expires_in?: string;
|
|
||||||
}): Promise<Response<Entity.Filter>>;
|
|
||||||
deleteFilter(id: string): Promise<Response<Entity.Filter>>;
|
|
||||||
report(account_id: string, comment: string, options?: {
|
|
||||||
status_ids?: Array<string>;
|
|
||||||
forward?: boolean;
|
|
||||||
}): Promise<Response<Entity.Report>>;
|
|
||||||
getFollowRequests(limit?: number): Promise<Response<Array<Entity.Account>>>;
|
|
||||||
acceptFollowRequest(id: string): Promise<Response<Entity.Relationship>>;
|
|
||||||
rejectFollowRequest(id: string): Promise<Response<Entity.Relationship>>;
|
|
||||||
getEndorsements(options?: {
|
|
||||||
limit?: number;
|
|
||||||
max_id?: string;
|
|
||||||
since_id?: string;
|
|
||||||
}): Promise<Response<Array<Entity.Account>>>;
|
|
||||||
getFeaturedTags(): Promise<Response<Array<Entity.FeaturedTag>>>;
|
|
||||||
getAccountFeaturedTags(id: string): Promise<Response<Array<Entity.FeaturedTag>>>;
|
|
||||||
createFeaturedTag(name: string): Promise<Response<Entity.FeaturedTag>>;
|
|
||||||
deleteFeaturedTag(id: string): Promise<Response<{}>>;
|
|
||||||
getSuggestedTags(): Promise<Response<Array<Entity.Tag>>>;
|
|
||||||
getPreferences(): Promise<Response<Entity.Preferences>>;
|
|
||||||
getSuggestions(limit?: number): Promise<Response<Array<Entity.Account>>>;
|
|
||||||
getTag(id: string): Promise<Response<Entity.Tag>>;
|
|
||||||
followTag(id: string): Promise<Response<Entity.Tag>>;
|
|
||||||
unfollowTag(id: string): Promise<Response<Entity.Tag>>;
|
|
||||||
postStatus(status: string, options: {
|
|
||||||
media_ids?: Array<string>;
|
|
||||||
poll?: {
|
|
||||||
options: Array<string>;
|
|
||||||
expires_in: number;
|
|
||||||
multiple?: boolean;
|
|
||||||
hide_totals?: boolean;
|
|
||||||
};
|
|
||||||
in_reply_to_id?: string;
|
|
||||||
sensitive?: boolean;
|
|
||||||
spoiler_text?: string;
|
|
||||||
visibility?: 'public' | 'unlisted' | 'private' | 'direct';
|
|
||||||
scheduled_at?: string;
|
|
||||||
language?: string;
|
|
||||||
quote_id?: string;
|
|
||||||
}): Promise<Response<Entity.Status>>;
|
|
||||||
getStatus(id: string): Promise<Response<Entity.Status>>;
|
|
||||||
editStatus(id: string, options: {
|
|
||||||
status?: string;
|
|
||||||
spoiler_text?: string;
|
|
||||||
sensitive?: boolean;
|
|
||||||
media_ids?: Array<string>;
|
|
||||||
poll?: {
|
|
||||||
options?: Array<string>;
|
|
||||||
expires_in?: number;
|
|
||||||
multiple?: boolean;
|
|
||||||
hide_totals?: boolean;
|
|
||||||
};
|
|
||||||
}): Promise<Response<Entity.Status>>;
|
|
||||||
deleteStatus(id: string): Promise<Response<Entity.Status>>;
|
|
||||||
getStatusContext(id: string, options?: {
|
|
||||||
limit?: number;
|
|
||||||
max_id?: string;
|
|
||||||
since_id?: string;
|
|
||||||
}): Promise<Response<Entity.Context>>;
|
|
||||||
getStatusRebloggedBy(id: string): Promise<Response<Array<Entity.Account>>>;
|
|
||||||
getStatusFavouritedBy(id: string): Promise<Response<Array<Entity.Account>>>;
|
|
||||||
favouriteStatus(id: string): Promise<Response<Entity.Status>>;
|
|
||||||
unfavouriteStatus(id: string): Promise<Response<Entity.Status>>;
|
|
||||||
reblogStatus(id: string): Promise<Response<Entity.Status>>;
|
|
||||||
unreblogStatus(id: string): Promise<Response<Entity.Status>>;
|
|
||||||
bookmarkStatus(id: string): Promise<Response<Entity.Status>>;
|
|
||||||
unbookmarkStatus(id: string): Promise<Response<Entity.Status>>;
|
|
||||||
muteStatus(id: string): Promise<Response<Entity.Status>>;
|
|
||||||
unmuteStatus(id: string): Promise<Response<Entity.Status>>;
|
|
||||||
pinStatus(id: string): Promise<Response<Entity.Status>>;
|
|
||||||
unpinStatus(id: string): Promise<Response<Entity.Status>>;
|
|
||||||
uploadMedia(file: any, options?: {
|
|
||||||
description?: string;
|
|
||||||
focus?: string;
|
|
||||||
}): Promise<Response<Entity.Attachment | Entity.AsyncAttachment>>;
|
|
||||||
getMedia(id: string): Promise<Response<Entity.Attachment>>;
|
|
||||||
updateMedia(id: string, options?: {
|
|
||||||
file?: any;
|
|
||||||
description?: string;
|
|
||||||
focus?: string;
|
|
||||||
}): Promise<Response<Entity.Attachment>>;
|
|
||||||
getPoll(id: string): Promise<Response<Entity.Poll>>;
|
|
||||||
votePoll(id: string, choices: Array<number>): Promise<Response<Entity.Poll>>;
|
|
||||||
getScheduledStatuses(options?: {
|
|
||||||
limit?: number | null;
|
|
||||||
max_id?: string | null;
|
|
||||||
since_id?: string | null;
|
|
||||||
min_id?: string | null;
|
|
||||||
}): Promise<Response<Array<Entity.ScheduledStatus>>>;
|
|
||||||
getScheduledStatus(id: string): Promise<Response<Entity.ScheduledStatus>>;
|
|
||||||
scheduleStatus(id: string, scheduled_at?: string | null): Promise<Response<Entity.ScheduledStatus>>;
|
|
||||||
cancelScheduledStatus(id: string): Promise<Response<{}>>;
|
|
||||||
getPublicTimeline(options?: {
|
|
||||||
only_media?: boolean;
|
|
||||||
limit?: number;
|
|
||||||
max_id?: string;
|
|
||||||
since_id?: string;
|
|
||||||
min_id?: string;
|
|
||||||
}): Promise<Response<Array<Entity.Status>>>;
|
|
||||||
getLocalTimeline(options?: {
|
|
||||||
only_media?: boolean;
|
|
||||||
limit?: number;
|
|
||||||
max_id?: string;
|
|
||||||
since_id?: string;
|
|
||||||
min_id?: string;
|
|
||||||
}): Promise<Response<Array<Entity.Status>>>;
|
|
||||||
getTagTimeline(hashtag: string, options?: {
|
|
||||||
local?: boolean;
|
|
||||||
only_media?: boolean;
|
|
||||||
limit?: number;
|
|
||||||
max_id?: string;
|
|
||||||
since_id?: string;
|
|
||||||
min_id?: string;
|
|
||||||
}): Promise<Response<Array<Entity.Status>>>;
|
|
||||||
getHomeTimeline(options?: {
|
|
||||||
local?: boolean;
|
|
||||||
limit?: number;
|
|
||||||
max_id?: string;
|
|
||||||
since_id?: string;
|
|
||||||
min_id?: string;
|
|
||||||
}): Promise<Response<Array<Entity.Status>>>;
|
|
||||||
getListTimeline(list_id: string, options?: {
|
|
||||||
limit?: number;
|
|
||||||
max_id?: string;
|
|
||||||
since_id?: string;
|
|
||||||
min_id?: string;
|
|
||||||
}): Promise<Response<Array<Entity.Status>>>;
|
|
||||||
getConversationTimeline(options?: {
|
|
||||||
limit?: number;
|
|
||||||
max_id?: string;
|
|
||||||
since_id?: string;
|
|
||||||
min_id?: string;
|
|
||||||
}): Promise<Response<Array<Entity.Conversation>>>;
|
|
||||||
deleteConversation(id: string): Promise<Response<{}>>;
|
|
||||||
readConversation(id: string): Promise<Response<Entity.Conversation>>;
|
|
||||||
getLists(): Promise<Response<Array<Entity.List>>>;
|
|
||||||
getList(id: string): Promise<Response<Entity.List>>;
|
|
||||||
createList(title: string): Promise<Response<Entity.List>>;
|
|
||||||
updateList(id: string, title: string): Promise<Response<Entity.List>>;
|
|
||||||
deleteList(id: string): Promise<Response<{}>>;
|
|
||||||
getAccountsInList(id: string, options?: {
|
|
||||||
limit?: number;
|
|
||||||
max_id?: string;
|
|
||||||
since_id?: string;
|
|
||||||
}): Promise<Response<Array<Entity.Account>>>;
|
|
||||||
addAccountsToList(id: string, account_ids: Array<string>): Promise<Response<{}>>;
|
|
||||||
deleteAccountsFromList(id: string, account_ids: Array<string>): Promise<Response<{}>>;
|
|
||||||
getMarkers(timeline: Array<string>): Promise<Response<Entity.Marker | {}>>;
|
|
||||||
saveMarkers(options?: {
|
|
||||||
home?: {
|
|
||||||
last_read_id: string;
|
|
||||||
};
|
|
||||||
notifications?: {
|
|
||||||
last_read_id: string;
|
|
||||||
};
|
|
||||||
}): Promise<Response<Entity.Marker>>;
|
|
||||||
getNotifications(options?: {
|
|
||||||
limit?: number;
|
|
||||||
max_id?: string;
|
|
||||||
since_id?: string;
|
|
||||||
min_id?: string;
|
|
||||||
exclude_types?: Array<Entity.NotificationType>;
|
|
||||||
account_id?: string;
|
|
||||||
}): Promise<Response<Array<Entity.Notification>>>;
|
|
||||||
getNotification(id: string): Promise<Response<Entity.Notification>>;
|
|
||||||
dismissNotifications(): Promise<Response<{}>>;
|
|
||||||
dismissNotification(id: string): Promise<Response<{}>>;
|
|
||||||
readNotifications(_options: {
|
|
||||||
id?: string;
|
|
||||||
max_id?: string;
|
|
||||||
}): Promise<Response<Entity.Notification | Array<Entity.Notification>>>;
|
|
||||||
subscribePushNotification(subscription: {
|
|
||||||
endpoint: string;
|
|
||||||
keys: {
|
|
||||||
p256dh: string;
|
|
||||||
auth: string;
|
|
||||||
};
|
|
||||||
}, data?: {
|
|
||||||
alerts: {
|
|
||||||
follow?: boolean;
|
|
||||||
favourite?: boolean;
|
|
||||||
reblog?: boolean;
|
|
||||||
mention?: boolean;
|
|
||||||
poll?: boolean;
|
|
||||||
};
|
|
||||||
} | null): Promise<Response<Entity.PushSubscription>>;
|
|
||||||
getPushSubscription(): Promise<Response<Entity.PushSubscription>>;
|
|
||||||
updatePushSubscription(data?: {
|
|
||||||
alerts: {
|
|
||||||
follow?: boolean;
|
|
||||||
favourite?: boolean;
|
|
||||||
reblog?: boolean;
|
|
||||||
mention?: boolean;
|
|
||||||
poll?: boolean;
|
|
||||||
};
|
|
||||||
} | null): Promise<Response<Entity.PushSubscription>>;
|
|
||||||
deletePushSubscription(): Promise<Response<{}>>;
|
|
||||||
search(q: string, type: 'accounts' | 'hashtags' | 'statuses', options?: {
|
|
||||||
limit?: number;
|
|
||||||
max_id?: string;
|
|
||||||
min_id?: string;
|
|
||||||
resolve?: boolean;
|
|
||||||
offset?: number;
|
|
||||||
following?: boolean;
|
|
||||||
account_id?: string;
|
|
||||||
exclude_unreviewed?: boolean;
|
|
||||||
}): Promise<Response<Entity.Results>>;
|
|
||||||
getInstance(): Promise<Response<Entity.Instance>>;
|
|
||||||
getInstancePeers(): Promise<Response<Array<string>>>;
|
|
||||||
getInstanceActivity(): Promise<Response<Array<Entity.Activity>>>;
|
|
||||||
getInstanceTrends(limit?: number | null): Promise<Response<Array<Entity.Tag>>>;
|
|
||||||
getInstanceDirectory(options?: {
|
|
||||||
limit?: number;
|
|
||||||
offset?: number;
|
|
||||||
order?: 'active' | 'new';
|
|
||||||
local?: boolean;
|
|
||||||
}): Promise<Response<Array<Entity.Account>>>;
|
|
||||||
getInstanceCustomEmojis(): Promise<Response<Array<Entity.Emoji>>>;
|
|
||||||
getInstanceAnnouncements(with_dismissed?: boolean | null): Promise<Response<Array<Entity.Announcement>>>;
|
|
||||||
dismissInstanceAnnouncement(id: string): Promise<Response<{}>>;
|
|
||||||
createEmojiReaction(_id: string, _emoji: string): Promise<Response<Entity.Status>>;
|
|
||||||
deleteEmojiReaction(_id: string, _emoji: string): Promise<Response<Entity.Status>>;
|
|
||||||
getEmojiReactions(_id: string): Promise<Response<Array<Entity.Reaction>>>;
|
|
||||||
getEmojiReaction(_id: string, _emoji: string): Promise<Response<Entity.Reaction>>;
|
|
||||||
userSocket(): WebSocket;
|
|
||||||
publicSocket(): WebSocket;
|
|
||||||
localSocket(): WebSocket;
|
|
||||||
tagSocket(tag: string): WebSocket;
|
|
||||||
listSocket(list_id: string): WebSocket;
|
|
||||||
directSocket(): WebSocket;
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
152
packages/megalodon/lib/src/mastodon/api_client.d.ts
vendored
152
packages/megalodon/lib/src/mastodon/api_client.d.ts
vendored
@ -1,152 +0,0 @@
|
|||||||
import WebSocket from './web_socket';
|
|
||||||
import Response from '../response';
|
|
||||||
import { ProxyConfig } from '../proxy_config';
|
|
||||||
import MastodonEntity from './entity';
|
|
||||||
import MegalodonEntity from '../entity';
|
|
||||||
import NotificationType from '../notification';
|
|
||||||
declare namespace MastodonAPI {
|
|
||||||
interface Interface {
|
|
||||||
get<T = any>(path: string, params?: any, headers?: {
|
|
||||||
[key: string]: string;
|
|
||||||
}, pathIsFullyQualified?: boolean): Promise<Response<T>>;
|
|
||||||
put<T = any>(path: string, params?: any, headers?: {
|
|
||||||
[key: string]: string;
|
|
||||||
}): Promise<Response<T>>;
|
|
||||||
putForm<T = any>(path: string, params?: any, headers?: {
|
|
||||||
[key: string]: string;
|
|
||||||
}): Promise<Response<T>>;
|
|
||||||
patch<T = any>(path: string, params?: any, headers?: {
|
|
||||||
[key: string]: string;
|
|
||||||
}): Promise<Response<T>>;
|
|
||||||
patchForm<T = any>(path: string, params?: any, headers?: {
|
|
||||||
[key: string]: string;
|
|
||||||
}): Promise<Response<T>>;
|
|
||||||
post<T = any>(path: string, params?: any, headers?: {
|
|
||||||
[key: string]: string;
|
|
||||||
}): Promise<Response<T>>;
|
|
||||||
postForm<T = any>(path: string, params?: any, headers?: {
|
|
||||||
[key: string]: string;
|
|
||||||
}): Promise<Response<T>>;
|
|
||||||
del<T = any>(path: string, params?: any, headers?: {
|
|
||||||
[key: string]: string;
|
|
||||||
}): Promise<Response<T>>;
|
|
||||||
cancel(): void;
|
|
||||||
socket(path: string, stream: string, params?: string): WebSocket;
|
|
||||||
}
|
|
||||||
class Client implements Interface {
|
|
||||||
static DEFAULT_SCOPE: string[];
|
|
||||||
static DEFAULT_URL: string;
|
|
||||||
static NO_REDIRECT: string;
|
|
||||||
private accessToken;
|
|
||||||
private baseUrl;
|
|
||||||
private userAgent;
|
|
||||||
private abortController;
|
|
||||||
private proxyConfig;
|
|
||||||
constructor(baseUrl: string, accessToken?: string | null, userAgent?: string, proxyConfig?: ProxyConfig | false);
|
|
||||||
get<T>(path: string, params?: {}, headers?: {
|
|
||||||
[key: string]: string;
|
|
||||||
}, pathIsFullyQualified?: boolean): Promise<Response<T>>;
|
|
||||||
put<T>(path: string, params?: {}, headers?: {
|
|
||||||
[key: string]: string;
|
|
||||||
}): Promise<Response<T>>;
|
|
||||||
putForm<T>(path: string, params?: {}, headers?: {
|
|
||||||
[key: string]: string;
|
|
||||||
}): Promise<Response<T>>;
|
|
||||||
patch<T>(path: string, params?: {}, headers?: {
|
|
||||||
[key: string]: string;
|
|
||||||
}): Promise<Response<T>>;
|
|
||||||
patchForm<T>(path: string, params?: {}, headers?: {
|
|
||||||
[key: string]: string;
|
|
||||||
}): Promise<Response<T>>;
|
|
||||||
post<T>(path: string, params?: {}, headers?: {
|
|
||||||
[key: string]: string;
|
|
||||||
}): Promise<Response<T>>;
|
|
||||||
postForm<T>(path: string, params?: {}, headers?: {
|
|
||||||
[key: string]: string;
|
|
||||||
}): Promise<Response<T>>;
|
|
||||||
del<T>(path: string, params?: {}, headers?: {
|
|
||||||
[key: string]: string;
|
|
||||||
}): Promise<Response<T>>;
|
|
||||||
cancel(): void;
|
|
||||||
socket(path: string, stream: string, params?: string): WebSocket;
|
|
||||||
}
|
|
||||||
namespace Entity {
|
|
||||||
type Account = MastodonEntity.Account;
|
|
||||||
type Activity = MastodonEntity.Activity;
|
|
||||||
type Announcement = MastodonEntity.Announcement;
|
|
||||||
type Application = MastodonEntity.Application;
|
|
||||||
type AsyncAttachment = MegalodonEntity.AsyncAttachment;
|
|
||||||
type Attachment = MastodonEntity.Attachment;
|
|
||||||
type Card = MastodonEntity.Card;
|
|
||||||
type Context = MastodonEntity.Context;
|
|
||||||
type Conversation = MastodonEntity.Conversation;
|
|
||||||
type Emoji = MastodonEntity.Emoji;
|
|
||||||
type FeaturedTag = MastodonEntity.FeaturedTag;
|
|
||||||
type Field = MastodonEntity.Field;
|
|
||||||
type Filter = MastodonEntity.Filter;
|
|
||||||
type History = MastodonEntity.History;
|
|
||||||
type IdentityProof = MastodonEntity.IdentityProof;
|
|
||||||
type Instance = MastodonEntity.Instance;
|
|
||||||
type List = MastodonEntity.List;
|
|
||||||
type Marker = MastodonEntity.Marker;
|
|
||||||
type Mention = MastodonEntity.Mention;
|
|
||||||
type Notification = MastodonEntity.Notification;
|
|
||||||
type Poll = MastodonEntity.Poll;
|
|
||||||
type PollOption = MastodonEntity.PollOption;
|
|
||||||
type Preferences = MastodonEntity.Preferences;
|
|
||||||
type PushSubscription = MastodonEntity.PushSubscription;
|
|
||||||
type Relationship = MastodonEntity.Relationship;
|
|
||||||
type Reaction = MastodonEntity.Reaction;
|
|
||||||
type Report = MastodonEntity.Report;
|
|
||||||
type Results = MastodonEntity.Results;
|
|
||||||
type ScheduledStatus = MastodonEntity.ScheduledStatus;
|
|
||||||
type Source = MastodonEntity.Source;
|
|
||||||
type Stats = MastodonEntity.Stats;
|
|
||||||
type Status = MastodonEntity.Status;
|
|
||||||
type StatusParams = MastodonEntity.StatusParams;
|
|
||||||
type Tag = MastodonEntity.Tag;
|
|
||||||
type Token = MastodonEntity.Token;
|
|
||||||
type URLs = MastodonEntity.URLs;
|
|
||||||
}
|
|
||||||
namespace Converter {
|
|
||||||
const encodeNotificationType: (t: MegalodonEntity.NotificationType) => MastodonEntity.NotificationType;
|
|
||||||
const decodeNotificationType: (t: MastodonEntity.NotificationType) => MegalodonEntity.NotificationType;
|
|
||||||
const account: (a: Entity.Account) => MegalodonEntity.Account;
|
|
||||||
const activity: (a: Entity.Activity) => MegalodonEntity.Activity;
|
|
||||||
const announcement: (a: Entity.Announcement) => MegalodonEntity.Announcement;
|
|
||||||
const application: (a: Entity.Application) => MegalodonEntity.Application;
|
|
||||||
const attachment: (a: Entity.Attachment) => MegalodonEntity.Attachment;
|
|
||||||
const async_attachment: (a: Entity.AsyncAttachment) => MegalodonEntity.Attachment | MegalodonEntity.AsyncAttachment;
|
|
||||||
const card: (c: Entity.Card) => MegalodonEntity.Card;
|
|
||||||
const context: (c: Entity.Context) => MegalodonEntity.Context;
|
|
||||||
const conversation: (c: Entity.Conversation) => MegalodonEntity.Conversation;
|
|
||||||
const emoji: (e: Entity.Emoji) => MegalodonEntity.Emoji;
|
|
||||||
const featured_tag: (e: Entity.FeaturedTag) => MegalodonEntity.FeaturedTag;
|
|
||||||
const field: (f: Entity.Field) => MegalodonEntity.Field;
|
|
||||||
const filter: (f: Entity.Filter) => MegalodonEntity.Filter;
|
|
||||||
const history: (h: Entity.History) => MegalodonEntity.History;
|
|
||||||
const identity_proof: (i: Entity.IdentityProof) => MegalodonEntity.IdentityProof;
|
|
||||||
const instance: (i: Entity.Instance) => MegalodonEntity.Instance;
|
|
||||||
const list: (l: Entity.List) => MegalodonEntity.List;
|
|
||||||
const marker: (m: Entity.Marker) => MegalodonEntity.Marker;
|
|
||||||
const mention: (m: Entity.Mention) => MegalodonEntity.Mention;
|
|
||||||
const notification: (n: Entity.Notification) => MegalodonEntity.Notification;
|
|
||||||
const poll: (p: Entity.Poll) => MegalodonEntity.Poll;
|
|
||||||
const poll_option: (p: Entity.PollOption) => MegalodonEntity.PollOption;
|
|
||||||
const preferences: (p: Entity.Preferences) => MegalodonEntity.Preferences;
|
|
||||||
const push_subscription: (p: Entity.PushSubscription) => MegalodonEntity.PushSubscription;
|
|
||||||
const relationship: (r: Entity.Relationship) => MegalodonEntity.Relationship;
|
|
||||||
const reaction: (r: Entity.Reaction) => MegalodonEntity.Reaction;
|
|
||||||
const report: (r: Entity.Report) => MegalodonEntity.Report;
|
|
||||||
const results: (r: Entity.Results) => MegalodonEntity.Results;
|
|
||||||
const scheduled_status: (s: Entity.ScheduledStatus) => MegalodonEntity.ScheduledStatus;
|
|
||||||
const source: (s: Entity.Source) => MegalodonEntity.Source;
|
|
||||||
const stats: (s: Entity.Stats) => MegalodonEntity.Stats;
|
|
||||||
const status: (s: Entity.Status) => MegalodonEntity.Status;
|
|
||||||
const status_params: (s: Entity.StatusParams) => MegalodonEntity.StatusParams;
|
|
||||||
const tag: (t: Entity.Tag) => MegalodonEntity.Tag;
|
|
||||||
const token: (t: Entity.Token) => MegalodonEntity.Token;
|
|
||||||
const urls: (u: Entity.URLs) => MegalodonEntity.URLs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export default MastodonAPI;
|
|
@ -1,614 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __assign = (this && this.__assign) || function () {
|
|
||||||
__assign = Object.assign || function(t) {
|
|
||||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
||||||
s = arguments[i];
|
|
||||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
||||||
t[p] = s[p];
|
|
||||||
}
|
|
||||||
return t;
|
|
||||||
};
|
|
||||||
return __assign.apply(this, arguments);
|
|
||||||
};
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
||||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
||||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
||||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
||||||
function step(op) {
|
|
||||||
if (f) throw new TypeError("Generator is already executing.");
|
|
||||||
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
||||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
||||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
||||||
switch (op[0]) {
|
|
||||||
case 0: case 1: t = op; break;
|
|
||||||
case 4: _.label++; return { value: op[1], done: false };
|
|
||||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
||||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
||||||
default:
|
|
||||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
||||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
||||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
||||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
||||||
if (t[2]) _.ops.pop();
|
|
||||||
_.trys.pop(); continue;
|
|
||||||
}
|
|
||||||
op = body.call(thisArg, _);
|
|
||||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
||||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
var axios_1 = __importDefault(require("axios"));
|
|
||||||
var object_assign_deep_1 = __importDefault(require("object-assign-deep"));
|
|
||||||
var web_socket_1 = __importDefault(require("./web_socket"));
|
|
||||||
var cancel_1 = require("../cancel");
|
|
||||||
var proxy_config_1 = __importDefault(require("../proxy_config"));
|
|
||||||
var default_1 = require("../default");
|
|
||||||
var notification_1 = __importDefault(require("../notification"));
|
|
||||||
var notification_2 = __importDefault(require("./notification"));
|
|
||||||
var MastodonAPI;
|
|
||||||
(function (MastodonAPI) {
|
|
||||||
var Client = (function () {
|
|
||||||
function Client(baseUrl, accessToken, userAgent, proxyConfig) {
|
|
||||||
if (accessToken === void 0) { accessToken = null; }
|
|
||||||
if (userAgent === void 0) { userAgent = default_1.DEFAULT_UA; }
|
|
||||||
if (proxyConfig === void 0) { proxyConfig = false; }
|
|
||||||
this.proxyConfig = false;
|
|
||||||
this.accessToken = accessToken;
|
|
||||||
this.baseUrl = baseUrl;
|
|
||||||
this.userAgent = userAgent;
|
|
||||||
this.proxyConfig = proxyConfig;
|
|
||||||
this.abortController = new AbortController();
|
|
||||||
axios_1.default.defaults.signal = this.abortController.signal;
|
|
||||||
}
|
|
||||||
Client.prototype.get = function (path, params, headers, pathIsFullyQualified) {
|
|
||||||
if (params === void 0) { params = {}; }
|
|
||||||
if (headers === void 0) { headers = {}; }
|
|
||||||
if (pathIsFullyQualified === void 0) { pathIsFullyQualified = false; }
|
|
||||||
return __awaiter(this, void 0, void 0, function () {
|
|
||||||
var options;
|
|
||||||
return __generator(this, function (_a) {
|
|
||||||
options = {
|
|
||||||
params: params,
|
|
||||||
headers: headers,
|
|
||||||
maxContentLength: Infinity,
|
|
||||||
maxBodyLength: Infinity
|
|
||||||
};
|
|
||||||
if (this.accessToken) {
|
|
||||||
options = (0, object_assign_deep_1.default)({}, options, {
|
|
||||||
headers: {
|
|
||||||
Authorization: "Bearer ".concat(this.accessToken)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (this.proxyConfig) {
|
|
||||||
options = Object.assign(options, {
|
|
||||||
httpAgent: (0, proxy_config_1.default)(this.proxyConfig),
|
|
||||||
httpsAgent: (0, proxy_config_1.default)(this.proxyConfig)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return [2, axios_1.default
|
|
||||||
.get((pathIsFullyQualified ? '' : this.baseUrl) + path, options)
|
|
||||||
.catch(function (err) {
|
|
||||||
if (axios_1.default.isCancel(err)) {
|
|
||||||
throw new cancel_1.RequestCanceledError(err.message);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(function (resp) {
|
|
||||||
var res = {
|
|
||||||
data: resp.data,
|
|
||||||
status: resp.status,
|
|
||||||
statusText: resp.statusText,
|
|
||||||
headers: resp.headers
|
|
||||||
};
|
|
||||||
return res;
|
|
||||||
})];
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Client.prototype.put = function (path, params, headers) {
|
|
||||||
if (params === void 0) { params = {}; }
|
|
||||||
if (headers === void 0) { headers = {}; }
|
|
||||||
return __awaiter(this, void 0, void 0, function () {
|
|
||||||
var options;
|
|
||||||
return __generator(this, function (_a) {
|
|
||||||
options = {
|
|
||||||
headers: headers,
|
|
||||||
maxContentLength: Infinity,
|
|
||||||
maxBodyLength: Infinity
|
|
||||||
};
|
|
||||||
if (this.accessToken) {
|
|
||||||
options = (0, object_assign_deep_1.default)({}, options, {
|
|
||||||
headers: {
|
|
||||||
Authorization: "Bearer ".concat(this.accessToken)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (this.proxyConfig) {
|
|
||||||
options = Object.assign(options, {
|
|
||||||
httpAgent: (0, proxy_config_1.default)(this.proxyConfig),
|
|
||||||
httpsAgent: (0, proxy_config_1.default)(this.proxyConfig)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return [2, axios_1.default
|
|
||||||
.put(this.baseUrl + path, params, options)
|
|
||||||
.catch(function (err) {
|
|
||||||
if (axios_1.default.isCancel(err)) {
|
|
||||||
throw new cancel_1.RequestCanceledError(err.message);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(function (resp) {
|
|
||||||
var res = {
|
|
||||||
data: resp.data,
|
|
||||||
status: resp.status,
|
|
||||||
statusText: resp.statusText,
|
|
||||||
headers: resp.headers
|
|
||||||
};
|
|
||||||
return res;
|
|
||||||
})];
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Client.prototype.putForm = function (path, params, headers) {
|
|
||||||
if (params === void 0) { params = {}; }
|
|
||||||
if (headers === void 0) { headers = {}; }
|
|
||||||
return __awaiter(this, void 0, void 0, function () {
|
|
||||||
var options;
|
|
||||||
return __generator(this, function (_a) {
|
|
||||||
options = {
|
|
||||||
headers: headers,
|
|
||||||
maxContentLength: Infinity,
|
|
||||||
maxBodyLength: Infinity
|
|
||||||
};
|
|
||||||
if (this.accessToken) {
|
|
||||||
options = (0, object_assign_deep_1.default)({}, options, {
|
|
||||||
headers: {
|
|
||||||
Authorization: "Bearer ".concat(this.accessToken)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (this.proxyConfig) {
|
|
||||||
options = Object.assign(options, {
|
|
||||||
httpAgent: (0, proxy_config_1.default)(this.proxyConfig),
|
|
||||||
httpsAgent: (0, proxy_config_1.default)(this.proxyConfig)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return [2, axios_1.default
|
|
||||||
.putForm(this.baseUrl + path, params, options)
|
|
||||||
.catch(function (err) {
|
|
||||||
if (axios_1.default.isCancel(err)) {
|
|
||||||
throw new cancel_1.RequestCanceledError(err.message);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(function (resp) {
|
|
||||||
var res = {
|
|
||||||
data: resp.data,
|
|
||||||
status: resp.status,
|
|
||||||
statusText: resp.statusText,
|
|
||||||
headers: resp.headers
|
|
||||||
};
|
|
||||||
return res;
|
|
||||||
})];
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Client.prototype.patch = function (path, params, headers) {
|
|
||||||
if (params === void 0) { params = {}; }
|
|
||||||
if (headers === void 0) { headers = {}; }
|
|
||||||
return __awaiter(this, void 0, void 0, function () {
|
|
||||||
var options;
|
|
||||||
return __generator(this, function (_a) {
|
|
||||||
options = {
|
|
||||||
headers: headers,
|
|
||||||
maxContentLength: Infinity,
|
|
||||||
maxBodyLength: Infinity
|
|
||||||
};
|
|
||||||
if (this.accessToken) {
|
|
||||||
options = (0, object_assign_deep_1.default)({}, options, {
|
|
||||||
headers: {
|
|
||||||
Authorization: "Bearer ".concat(this.accessToken)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (this.proxyConfig) {
|
|
||||||
options = Object.assign(options, {
|
|
||||||
httpAgent: (0, proxy_config_1.default)(this.proxyConfig),
|
|
||||||
httpsAgent: (0, proxy_config_1.default)(this.proxyConfig)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return [2, axios_1.default
|
|
||||||
.patch(this.baseUrl + path, params, options)
|
|
||||||
.catch(function (err) {
|
|
||||||
if (axios_1.default.isCancel(err)) {
|
|
||||||
throw new cancel_1.RequestCanceledError(err.message);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(function (resp) {
|
|
||||||
var res = {
|
|
||||||
data: resp.data,
|
|
||||||
status: resp.status,
|
|
||||||
statusText: resp.statusText,
|
|
||||||
headers: resp.headers
|
|
||||||
};
|
|
||||||
return res;
|
|
||||||
})];
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Client.prototype.patchForm = function (path, params, headers) {
|
|
||||||
if (params === void 0) { params = {}; }
|
|
||||||
if (headers === void 0) { headers = {}; }
|
|
||||||
return __awaiter(this, void 0, void 0, function () {
|
|
||||||
var options;
|
|
||||||
return __generator(this, function (_a) {
|
|
||||||
options = {
|
|
||||||
headers: headers,
|
|
||||||
maxContentLength: Infinity,
|
|
||||||
maxBodyLength: Infinity
|
|
||||||
};
|
|
||||||
if (this.accessToken) {
|
|
||||||
options = (0, object_assign_deep_1.default)({}, options, {
|
|
||||||
headers: {
|
|
||||||
Authorization: "Bearer ".concat(this.accessToken)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (this.proxyConfig) {
|
|
||||||
options = Object.assign(options, {
|
|
||||||
httpAgent: (0, proxy_config_1.default)(this.proxyConfig),
|
|
||||||
httpsAgent: (0, proxy_config_1.default)(this.proxyConfig)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return [2, axios_1.default
|
|
||||||
.patchForm(this.baseUrl + path, params, options)
|
|
||||||
.catch(function (err) {
|
|
||||||
if (axios_1.default.isCancel(err)) {
|
|
||||||
throw new cancel_1.RequestCanceledError(err.message);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(function (resp) {
|
|
||||||
var res = {
|
|
||||||
data: resp.data,
|
|
||||||
status: resp.status,
|
|
||||||
statusText: resp.statusText,
|
|
||||||
headers: resp.headers
|
|
||||||
};
|
|
||||||
return res;
|
|
||||||
})];
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Client.prototype.post = function (path, params, headers) {
|
|
||||||
if (params === void 0) { params = {}; }
|
|
||||||
if (headers === void 0) { headers = {}; }
|
|
||||||
return __awaiter(this, void 0, void 0, function () {
|
|
||||||
var options;
|
|
||||||
return __generator(this, function (_a) {
|
|
||||||
options = {
|
|
||||||
headers: headers,
|
|
||||||
maxContentLength: Infinity,
|
|
||||||
maxBodyLength: Infinity
|
|
||||||
};
|
|
||||||
if (this.accessToken) {
|
|
||||||
options = (0, object_assign_deep_1.default)({}, options, {
|
|
||||||
headers: {
|
|
||||||
Authorization: "Bearer ".concat(this.accessToken)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (this.proxyConfig) {
|
|
||||||
options = Object.assign(options, {
|
|
||||||
httpAgent: (0, proxy_config_1.default)(this.proxyConfig),
|
|
||||||
httpsAgent: (0, proxy_config_1.default)(this.proxyConfig)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return [2, axios_1.default.post(this.baseUrl + path, params, options).then(function (resp) {
|
|
||||||
var res = {
|
|
||||||
data: resp.data,
|
|
||||||
status: resp.status,
|
|
||||||
statusText: resp.statusText,
|
|
||||||
headers: resp.headers
|
|
||||||
};
|
|
||||||
return res;
|
|
||||||
})];
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Client.prototype.postForm = function (path, params, headers) {
|
|
||||||
if (params === void 0) { params = {}; }
|
|
||||||
if (headers === void 0) { headers = {}; }
|
|
||||||
return __awaiter(this, void 0, void 0, function () {
|
|
||||||
var options;
|
|
||||||
return __generator(this, function (_a) {
|
|
||||||
options = {
|
|
||||||
headers: headers,
|
|
||||||
maxContentLength: Infinity,
|
|
||||||
maxBodyLength: Infinity
|
|
||||||
};
|
|
||||||
if (this.accessToken) {
|
|
||||||
options = (0, object_assign_deep_1.default)({}, options, {
|
|
||||||
headers: {
|
|
||||||
Authorization: "Bearer ".concat(this.accessToken)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (this.proxyConfig) {
|
|
||||||
options = Object.assign(options, {
|
|
||||||
httpAgent: (0, proxy_config_1.default)(this.proxyConfig),
|
|
||||||
httpsAgent: (0, proxy_config_1.default)(this.proxyConfig)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return [2, axios_1.default.postForm(this.baseUrl + path, params, options).then(function (resp) {
|
|
||||||
var res = {
|
|
||||||
data: resp.data,
|
|
||||||
status: resp.status,
|
|
||||||
statusText: resp.statusText,
|
|
||||||
headers: resp.headers
|
|
||||||
};
|
|
||||||
return res;
|
|
||||||
})];
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Client.prototype.del = function (path, params, headers) {
|
|
||||||
if (params === void 0) { params = {}; }
|
|
||||||
if (headers === void 0) { headers = {}; }
|
|
||||||
return __awaiter(this, void 0, void 0, function () {
|
|
||||||
var options;
|
|
||||||
return __generator(this, function (_a) {
|
|
||||||
options = {
|
|
||||||
data: params,
|
|
||||||
headers: headers,
|
|
||||||
maxContentLength: Infinity,
|
|
||||||
maxBodyLength: Infinity
|
|
||||||
};
|
|
||||||
if (this.accessToken) {
|
|
||||||
options = (0, object_assign_deep_1.default)({}, options, {
|
|
||||||
headers: {
|
|
||||||
Authorization: "Bearer ".concat(this.accessToken)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (this.proxyConfig) {
|
|
||||||
options = Object.assign(options, {
|
|
||||||
httpAgent: (0, proxy_config_1.default)(this.proxyConfig),
|
|
||||||
httpsAgent: (0, proxy_config_1.default)(this.proxyConfig)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return [2, axios_1.default
|
|
||||||
.delete(this.baseUrl + path, options)
|
|
||||||
.catch(function (err) {
|
|
||||||
if (axios_1.default.isCancel(err)) {
|
|
||||||
throw new cancel_1.RequestCanceledError(err.message);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(function (resp) {
|
|
||||||
var res = {
|
|
||||||
data: resp.data,
|
|
||||||
status: resp.status,
|
|
||||||
statusText: resp.statusText,
|
|
||||||
headers: resp.headers
|
|
||||||
};
|
|
||||||
return res;
|
|
||||||
})];
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Client.prototype.cancel = function () {
|
|
||||||
return this.abortController.abort();
|
|
||||||
};
|
|
||||||
Client.prototype.socket = function (path, stream, params) {
|
|
||||||
if (!this.accessToken) {
|
|
||||||
throw new Error('accessToken is required');
|
|
||||||
}
|
|
||||||
var url = this.baseUrl + path;
|
|
||||||
var streaming = new web_socket_1.default(url, stream, params, this.accessToken, this.userAgent, this.proxyConfig);
|
|
||||||
process.nextTick(function () {
|
|
||||||
streaming.start();
|
|
||||||
});
|
|
||||||
return streaming;
|
|
||||||
};
|
|
||||||
Client.DEFAULT_SCOPE = default_1.DEFAULT_SCOPE;
|
|
||||||
Client.DEFAULT_URL = 'https://mastodon.social';
|
|
||||||
Client.NO_REDIRECT = default_1.NO_REDIRECT;
|
|
||||||
return Client;
|
|
||||||
}());
|
|
||||||
MastodonAPI.Client = Client;
|
|
||||||
var Converter;
|
|
||||||
(function (Converter) {
|
|
||||||
Converter.encodeNotificationType = function (t) {
|
|
||||||
switch (t) {
|
|
||||||
case notification_1.default.Follow:
|
|
||||||
return notification_2.default.Follow;
|
|
||||||
case notification_1.default.Favourite:
|
|
||||||
return notification_2.default.Favourite;
|
|
||||||
case notification_1.default.Reblog:
|
|
||||||
return notification_2.default.Reblog;
|
|
||||||
case notification_1.default.Mention:
|
|
||||||
return notification_2.default.Mention;
|
|
||||||
case notification_1.default.FollowRequest:
|
|
||||||
return notification_2.default.FollowRequest;
|
|
||||||
case notification_1.default.Status:
|
|
||||||
return notification_2.default.Status;
|
|
||||||
case notification_1.default.PollExpired:
|
|
||||||
return notification_2.default.Poll;
|
|
||||||
default:
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Converter.decodeNotificationType = function (t) {
|
|
||||||
switch (t) {
|
|
||||||
case notification_2.default.Follow:
|
|
||||||
return notification_1.default.Follow;
|
|
||||||
case notification_2.default.Favourite:
|
|
||||||
return notification_1.default.Favourite;
|
|
||||||
case notification_2.default.Mention:
|
|
||||||
return notification_1.default.Mention;
|
|
||||||
case notification_2.default.Reblog:
|
|
||||||
return notification_1.default.Reblog;
|
|
||||||
case notification_2.default.FollowRequest:
|
|
||||||
return notification_1.default.FollowRequest;
|
|
||||||
case notification_2.default.Status:
|
|
||||||
return notification_1.default.Status;
|
|
||||||
case notification_2.default.Poll:
|
|
||||||
return notification_1.default.PollExpired;
|
|
||||||
default:
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Converter.account = function (a) { return a; };
|
|
||||||
Converter.activity = function (a) { return a; };
|
|
||||||
Converter.announcement = function (a) { return (__assign(__assign({}, a), { reactions: a.reactions.map(function (r) { return Converter.reaction(r); }) })); };
|
|
||||||
Converter.application = function (a) { return a; };
|
|
||||||
Converter.attachment = function (a) { return a; };
|
|
||||||
Converter.async_attachment = function (a) {
|
|
||||||
if (a.url) {
|
|
||||||
return {
|
|
||||||
id: a.id,
|
|
||||||
type: a.type,
|
|
||||||
url: a.url,
|
|
||||||
remote_url: a.remote_url,
|
|
||||||
preview_url: a.preview_url,
|
|
||||||
text_url: a.text_url,
|
|
||||||
meta: a.meta,
|
|
||||||
description: a.description,
|
|
||||||
blurhash: a.blurhash
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Converter.card = function (c) { return c; };
|
|
||||||
Converter.context = function (c) { return ({
|
|
||||||
ancestors: c.ancestors.map(function (a) { return Converter.status(a); }),
|
|
||||||
descendants: c.descendants.map(function (d) { return Converter.status(d); })
|
|
||||||
}); };
|
|
||||||
Converter.conversation = function (c) { return ({
|
|
||||||
id: c.id,
|
|
||||||
accounts: c.accounts.map(function (a) { return Converter.account(a); }),
|
|
||||||
last_status: c.last_status ? Converter.status(c.last_status) : null,
|
|
||||||
unread: c.unread
|
|
||||||
}); };
|
|
||||||
Converter.emoji = function (e) { return e; };
|
|
||||||
Converter.featured_tag = function (e) { return e; };
|
|
||||||
Converter.field = function (f) { return f; };
|
|
||||||
Converter.filter = function (f) { return f; };
|
|
||||||
Converter.history = function (h) { return h; };
|
|
||||||
Converter.identity_proof = function (i) { return i; };
|
|
||||||
Converter.instance = function (i) { return i; };
|
|
||||||
Converter.list = function (l) { return l; };
|
|
||||||
Converter.marker = function (m) { return m; };
|
|
||||||
Converter.mention = function (m) { return m; };
|
|
||||||
Converter.notification = function (n) {
|
|
||||||
if (n.status) {
|
|
||||||
return {
|
|
||||||
account: Converter.account(n.account),
|
|
||||||
created_at: n.created_at,
|
|
||||||
id: n.id,
|
|
||||||
status: Converter.status(n.status),
|
|
||||||
type: Converter.decodeNotificationType(n.type)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return {
|
|
||||||
account: Converter.account(n.account),
|
|
||||||
created_at: n.created_at,
|
|
||||||
id: n.id,
|
|
||||||
type: Converter.decodeNotificationType(n.type)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Converter.poll = function (p) { return p; };
|
|
||||||
Converter.poll_option = function (p) { return p; };
|
|
||||||
Converter.preferences = function (p) { return p; };
|
|
||||||
Converter.push_subscription = function (p) { return p; };
|
|
||||||
Converter.relationship = function (r) { return r; };
|
|
||||||
Converter.reaction = function (r) {
|
|
||||||
var _a;
|
|
||||||
return ({
|
|
||||||
count: r.count,
|
|
||||||
me: (_a = r.me) !== null && _a !== void 0 ? _a : false,
|
|
||||||
name: r.name,
|
|
||||||
url: r.url,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Converter.report = function (r) { return r; };
|
|
||||||
Converter.results = function (r) { return ({
|
|
||||||
accounts: r.accounts.map(function (a) { return Converter.account(a); }),
|
|
||||||
statuses: r.statuses.map(function (s) { return Converter.status(s); }),
|
|
||||||
hashtags: r.hashtags.map(function (h) { return Converter.tag(h); })
|
|
||||||
}); };
|
|
||||||
Converter.scheduled_status = function (s) { return s; };
|
|
||||||
Converter.source = function (s) { return s; };
|
|
||||||
Converter.stats = function (s) { return s; };
|
|
||||||
Converter.status = function (s) { return ({
|
|
||||||
id: s.id,
|
|
||||||
uri: s.uri,
|
|
||||||
url: s.url,
|
|
||||||
account: Converter.account(s.account),
|
|
||||||
in_reply_to_id: s.in_reply_to_id,
|
|
||||||
in_reply_to_account_id: s.in_reply_to_account_id,
|
|
||||||
reblog: s.reblog ? Converter.status(s.reblog) : s.quote ? Converter.status(s.quote) : null,
|
|
||||||
content: s.content,
|
|
||||||
plain_content: null,
|
|
||||||
created_at: s.created_at,
|
|
||||||
emojis: s.emojis.map(function (e) { return Converter.emoji(e); }),
|
|
||||||
replies_count: s.replies_count,
|
|
||||||
reblogs_count: s.reblogs_count,
|
|
||||||
favourites_count: s.favourites_count,
|
|
||||||
reblogged: s.reblogged,
|
|
||||||
favourited: s.favourited,
|
|
||||||
muted: s.muted,
|
|
||||||
sensitive: s.sensitive,
|
|
||||||
spoiler_text: s.spoiler_text,
|
|
||||||
visibility: s.visibility,
|
|
||||||
media_attachments: s.media_attachments.map(function (m) { return Converter.attachment(m); }),
|
|
||||||
mentions: s.mentions.map(function (m) { return Converter.mention(m); }),
|
|
||||||
tags: s.tags.map(function (t) { return Converter.tag(t); }),
|
|
||||||
card: s.card ? Converter.card(s.card) : null,
|
|
||||||
poll: s.poll ? Converter.poll(s.poll) : null,
|
|
||||||
application: s.application ? Converter.application(s.application) : null,
|
|
||||||
language: s.language,
|
|
||||||
pinned: s.pinned,
|
|
||||||
emoji_reactions: [],
|
|
||||||
bookmarked: s.bookmarked ? s.bookmarked : false,
|
|
||||||
quote: s.quote ? Converter.status(s.quote) : null
|
|
||||||
}); };
|
|
||||||
Converter.status_params = function (s) { return s; };
|
|
||||||
Converter.tag = function (t) { return t; };
|
|
||||||
Converter.token = function (t) { return t; };
|
|
||||||
Converter.urls = function (u) { return u; };
|
|
||||||
})(Converter = MastodonAPI.Converter || (MastodonAPI.Converter = {}));
|
|
||||||
})(MastodonAPI || (MastodonAPI = {}));
|
|
||||||
exports.default = MastodonAPI;
|
|
@ -1,27 +0,0 @@
|
|||||||
/// <reference path="emoji.d.ts" />
|
|
||||||
/// <reference path="source.d.ts" />
|
|
||||||
/// <reference path="field.d.ts" />
|
|
||||||
declare namespace MastodonEntity {
|
|
||||||
type Account = {
|
|
||||||
id: string;
|
|
||||||
username: string;
|
|
||||||
acct: string;
|
|
||||||
display_name: string;
|
|
||||||
locked: boolean;
|
|
||||||
created_at: string;
|
|
||||||
followers_count: number;
|
|
||||||
following_count: number;
|
|
||||||
statuses_count: number;
|
|
||||||
note: string;
|
|
||||||
url: string;
|
|
||||||
avatar: string;
|
|
||||||
avatar_static: string;
|
|
||||||
header: string;
|
|
||||||
header_static: string;
|
|
||||||
emojis: Array<Emoji>;
|
|
||||||
moved: Account | null;
|
|
||||||
fields: Array<Field>;
|
|
||||||
bot: boolean | null;
|
|
||||||
source?: Source;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,8 +0,0 @@
|
|||||||
declare namespace MastodonEntity {
|
|
||||||
type Activity = {
|
|
||||||
week: string;
|
|
||||||
statuses: string;
|
|
||||||
logins: string;
|
|
||||||
registrations: string;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,37 +0,0 @@
|
|||||||
/// <reference path="tag.d.ts" />
|
|
||||||
/// <reference path="emoji.d.ts" />
|
|
||||||
declare namespace MastodonEntity {
|
|
||||||
type Announcement = {
|
|
||||||
id: string;
|
|
||||||
content: string;
|
|
||||||
starts_at: string | null;
|
|
||||||
ends_at: string | null;
|
|
||||||
published: boolean;
|
|
||||||
all_day: boolean;
|
|
||||||
published_at: string;
|
|
||||||
updated_at: string;
|
|
||||||
read?: boolean;
|
|
||||||
mentions: Array<AnnouncementAccount>;
|
|
||||||
statuses: Array<AnnouncementStatus>;
|
|
||||||
tags: Array<Tag>;
|
|
||||||
emojis: Array<Emoji>;
|
|
||||||
reactions: Array<Reaction>;
|
|
||||||
};
|
|
||||||
type AnnouncementAccount = {
|
|
||||||
id: string;
|
|
||||||
username: string;
|
|
||||||
url: string;
|
|
||||||
acct: string;
|
|
||||||
};
|
|
||||||
type AnnouncementStatus = {
|
|
||||||
id: string;
|
|
||||||
url: string;
|
|
||||||
};
|
|
||||||
type Reaction = {
|
|
||||||
name: string;
|
|
||||||
count: number;
|
|
||||||
me?: boolean;
|
|
||||||
url?: string;
|
|
||||||
static_url?: string;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,7 +0,0 @@
|
|||||||
declare namespace MastodonEntity {
|
|
||||||
type Application = {
|
|
||||||
name: string;
|
|
||||||
website?: string | null;
|
|
||||||
vapid_key?: string | null;
|
|
||||||
};
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
"use strict";
|
|
@ -1,14 +0,0 @@
|
|||||||
/// <reference path="attachment.d.ts" />
|
|
||||||
declare namespace MastodonEntity {
|
|
||||||
type AsyncAttachment = {
|
|
||||||
id: string;
|
|
||||||
type: 'unknown' | 'image' | 'gifv' | 'video' | 'audio';
|
|
||||||
url: string | null;
|
|
||||||
remote_url: string | null;
|
|
||||||
preview_url: string;
|
|
||||||
text_url: string | null;
|
|
||||||
meta: Meta | null;
|
|
||||||
description: string | null;
|
|
||||||
blurhash: string | null;
|
|
||||||
};
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user