https://www.w3.org/TR/activitystreams-core/ 얘 보세요
여기 거는 misskey 소스 보고 딴 거임 ㅇㅅㅇ;;;
this
= new ApRendeererService()
<aside> 💡
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
</aside>
export type Obj = { [x: string]: any };
export type ApObject = IObject | string | (IObject | string)[];
export interface IObject {
'@context'?: string | string[] | Obj | Obj[];
type: string | string[];
id?: string; name?: string | null;
summary?: string; _misskey_summary?: string;
_misskey_followedMessage?: string | null;
published?: string; updated?: string;
cc?: ApObject; additionalCc?: ApObject,
to?: ApObject; attributedTo?: ApObject;
attachment?: any[];
inReplyTo?: any; replies?: ICollection;
content?: string | null;
startTime?: Date; endTime?: Date;
icon?: any; image?: any; mediaType?: string;
url?: ApObject | string; href?: string;
tag?: IObject | IObject[];
sensitive?: boolean;
}
export interface IActivity extends IObject {
//type: 'Activity';
actor: IObject | string; object: IObject | string;
target?: IObject | string;
/** LD-Signature */
signature?: {
type: string; created: Date; creator: string;
domain?: string; nonce?: string; signatureValue: string;
};
}
export interface ICollection extends IObject {
type: 'Collection'; totalItems: number;
first?: IObject | string; items?: ApObject;
}
export interface IOrderedCollection extends IObject {
type: 'OrderedCollection'; totalItems: number;
first?: IObject | string; orderedItems?: ApObject;
}
export interface IPost extends IObject {
type: 'Note' | 'Question' | 'Article' | 'Audio' | 'Document' | 'Image' | 'Page' | 'Video' | 'Event';
source?: { content: string; mediaType: string; };
_misskey_quote?: string; _misskey_content?: string;
quoteUrl?: string;
}
export interface IQuestion extends IObject {
type: 'Note' | 'Question';
actor: string;
source?: { content: string; mediaType: string; };
_misskey_quote?: string;
quoteUrl?: string;
oneOf?: IQuestionChoice[]; anyOf?: IQuestionChoice[];
endTime?: Date; closed?: Date;
}
interface IQuestionChoice {
name?: string; replies?: ICollection;
_misskey_votes?: number;
}
export interface ITombstone extends IObject {
type: 'Tombstone'; formerType?: string; deleted?: Date;
}
export interface IActor extends IObject {
type: 'Person' | 'Service' | 'Organization' | 'Group' | 'Application';
name?: string; preferredUsername?: string;
manuallyApprovesFollowers?: boolean;
movedTo?: string; alsoKnownAs?: string[];
discoverable?: boolean; inbox: string;
sharedInbox?: string; // 後方互換性のため
publicKey?: { id: string; publicKeyPem: string; };
followers?: string | ICollection | IOrderedCollection;
following?: string | ICollection | IOrderedCollection;
featured?: string | IOrderedCollection;
outbox: string | IOrderedCollection;
endpoints?: { sharedInbox?: string; };
'vcard:bday'?: string; 'vcard:Address'?: string;
}
export interface IApPropertyValue extends IObject {
type: 'PropertyValue'; identifier: IApPropertyValue;
name: string; value: string;
}
export interface IApMention extends IObject {
type: 'Mention'; href: string; name: string;
}
export interface IApHashtag extends IObject { type: 'Hashtag'; name: string; }
export interface IApEmoji extends IObject {
type: 'Emoji'; name: string; updated: string;
}
export interface IKey extends IObject {
type: 'Key'; owner: string; publicKeyPem: string | Buffer;
}
export interface IApDocument extends IObject {
type: 'Audio' | 'Document' | 'Image' | 'Page' | 'Video';
}
export interface IApImage extends IApDocument { type: 'Image'; }
export interface ICreate extends IActivity { type: 'Create'; }
export interface IDelete extends IActivity { type: 'Delete'; }
export interface IUpdate extends IActivity { type: 'Update'; }
export interface IRead extends IActivity { type: 'Read'; }
export interface IUndo extends IActivity { type: 'Undo'; }
export interface IFollow extends IActivity { type: 'Follow'; }
export interface IAccept extends IActivity { type: 'Accept'; }
export interface IReject extends IActivity { type: 'Reject'; }
export interface IAdd extends IActivity { type: 'Add'; }
export interface IRemove extends IActivity { type: 'Remove'; }
export interface ILike extends IActivity {
type: 'Like' | 'EmojiReaction' | 'EmojiReact';
_misskey_reaction?: string;
}
export interface IAnnounce extends IActivity { type: 'Announce'; }
export interface IBlock extends IActivity { type: 'Block'; }
export interface IFlag extends IActivity { type: 'Flag'; }
export interface IMove extends IActivity {
type: 'Move'; target: IObject | string;
}
{
type: 'Accept',
actor: this.userEntityService.genLocalUserUri(user.id),
...(string | IObject) // object
}
{
type: 'Add',
actor: this.userEntityService.genLocalUserUri(user.id),
...(string | IObject | undefined), // target
...(string | IObject) // object
}
{
id: `${this.config.url}/notes/${note.id}/activity`,
actor: this.userEntityService.genLocalUserUri(note.userId),
type: 'Announce',
published: this.idService.parse(note.id).date.toISOString(),
updated: note.updatedAt?.toISOString() ?? undefined, // neko
...string[],
/* to :
public > <https://www.w3.org/ns/activitystreams#Public>
home > ${attributedTo}/followers
followers > ${attributedTo}/followers
*/
...string[],
/* cc :
public > ${attributedTo}/followers
home > <https://www.w3.org/ns/activitystreams#Public>
followers > undefined
*/
...(string | IObject) // object
}