server/types/activitypub.ts

142 lines
2.9 KiB
TypeScript
Raw Normal View History

2024-03-04 01:45:21 +01:00
export type APActivityPubContext =
2024-04-07 07:30:49 +02:00
| "https://www.w3.org/ns/activitystreams"
| {
ostatus: string;
atomUri: string;
inReplyToAtomUri: string;
conversation: string;
sensitive: string;
toot: string;
votersCount: string;
litepub: string;
directMessage: string;
};
2024-03-04 01:45:21 +01:00
export interface APActivityPubObject {
2024-04-07 07:30:49 +02:00
id: string;
type: string;
summary?: string;
inReplyTo?: string;
published: string;
url: string;
attributedTo: string;
to: string[];
cc: string[];
sensitive?: boolean;
atomUri: string;
inReplyToAtomUri?: string;
conversation: string;
content: string;
contentMap: Record<string, string>;
attachment: APActivityPubAttachment[];
tag: APTag[];
context?: string;
quoteUri?: string;
quoteUrl?: string;
source?: {
content: string;
mediaType: string;
};
2024-03-04 01:45:21 +01:00
}
export interface APActivityPubAttachment {
2024-04-07 07:30:49 +02:00
type?: string;
mediaType?: string;
url?: string;
name?: string;
2024-03-04 01:45:21 +01:00
}
2024-04-07 07:30:49 +02:00
export interface APActivityPubCollection<T> {
id: string;
type: string;
first?: {
type: string;
next: string;
partOf: string;
items: T[];
};
2024-03-04 01:45:21 +01:00
}
export interface APActivityPubNote extends APActivityPubObject {
2024-04-07 07:30:49 +02:00
type: "Note";
2024-03-04 01:45:21 +01:00
}
export interface APActivityPubActivity {
2024-04-07 07:30:49 +02:00
"@context": APActivityPubContext[];
id: string;
type: string;
actor: string;
published: string;
to: string[];
cc: string[];
object: APActivityPubNote;
2024-03-04 01:45:21 +01:00
}
export type APActorContext =
2024-04-07 07:30:49 +02:00
| "https://www.w3.org/ns/activitystreams"
| "https://w3id.org/security/v1"
| Record<
string,
| string
| { "@id": string; "@type": string }
| { "@container": string; "@id": string }
>;
2024-03-04 01:45:21 +01:00
export interface APActorPublicKey {
2024-04-07 07:30:49 +02:00
id: string;
owner: string;
publicKeyPem: string;
2024-03-04 01:45:21 +01:00
}
export interface APActorEndpoints {
2024-04-07 07:30:49 +02:00
sharedInbox: string;
2024-03-04 01:45:21 +01:00
}
export interface APActorIcon {
2024-04-07 07:30:49 +02:00
type: string;
mediaType: string;
url: string;
2024-03-04 01:45:21 +01:00
}
export interface APActor {
2024-04-07 07:30:49 +02:00
"@context": APActorContext[];
id: string;
type: string;
following: string;
followers: string;
inbox: string;
outbox: string;
featured: string;
featuredTags: string;
preferredUsername: string;
name: string;
summary: string;
url: string;
manuallyApprovesFollowers: boolean;
discoverable: boolean;
indexable: boolean;
published: string;
memorial: boolean;
devices: string;
publicKey: APActorPublicKey;
tag: APTag[];
attachment: APAttachment[];
endpoints: APActorEndpoints;
icon: APActorIcon;
2024-03-04 01:45:21 +01:00
}
export interface APTag {
2024-04-07 07:30:49 +02:00
type: string;
href: string;
name: string;
2024-03-04 01:45:21 +01:00
}
export interface APAttachment {
2024-04-07 07:30:49 +02:00
type: string;
mediaType: string;
url: string;
name?: string;
blurhash?: string;
description?: string;
2024-03-04 01:45:21 +01:00
}