diff --git a/src/models/actor/Actor.model.ts b/src/models/actor/Actor.model.ts new file mode 100644 index 0000000..afbc0ee --- /dev/null +++ b/src/models/actor/Actor.model.ts @@ -0,0 +1,22 @@ +import {APBase} from "../apBase/APBase.model"; +import {ASModelType} from "../../common/common.types"; +import {ActorFields} from "./Actor.types"; + +/** + * ActivityPub actors are generally one of the ActivityStreams Actor Types, but + * they don't have to be. For example, a Profile object might be used as an actor, + * or a type from an ActivityStreams extension. Actors are retrieved like any other + * Object in ActivityPub. Like other ActivityStreams objects, actors have an id, + * which is a URI. When entered directly into a user interface (for example on a + * login form), it is desirable to support simplified naming. + * + * {@link https://www.w3.org/TR/activitypub/#actors Docs} + */ +export class Actor extends APBase{ + constructor(fields: ActorFields) { + super({ + type: ASModelType.Profile, + ...fields + }) + } +} \ No newline at end of file diff --git a/src/models/actor/Actor.types.ts b/src/models/actor/Actor.types.ts new file mode 100644 index 0000000..1075005 --- /dev/null +++ b/src/models/actor/Actor.types.ts @@ -0,0 +1,27 @@ +import {APObjectFields} from "../apObject/APObject.types"; + +// TODO edit +type Endpoints = { + proxyUrl?: any; + oauthAuthorizationEndpoint?: any; + oauthTokenEndpoint?: any; + provideClientKey?: any; + signClientKey?: any; + sharedInbox?: any; +} + +export interface ActorFields extends APObjectFields { + inbox: any; + outbox: any; + following?: any; + followers?: any; + liked?: any; + streams?: any; + + // TODO preferredUsername or preferredUsernameMap at one time + + preferredUsername?: any; + preferredUsernameMap?: any; + endpoints?: any; + +} diff --git a/src/models/apObject/APObject.types.ts b/src/models/apObject/APObject.types.ts index f739155..49c6745 100644 --- a/src/models/apObject/APObject.types.ts +++ b/src/models/apObject/APObject.types.ts @@ -47,13 +47,13 @@ export interface APObjectFields { /** * Identifies the {@link https://www.w3.org/TR/activitystreams-vocabulary/#dfn-object Object} * type. Multiple values may be specified. - * All objects must have type. + * All objects must have type. There is already a bunch of default types presented by this library. * * {@link https://www.w3.org/TR/activitystreams-vocabulary/#dfn-object AS Docs (@type)} * * {@link https://www.w3.org/TR/activitypub/#obj-id AP Docs} */ - type: TypeValue | TypeValue[]; + type?: TypeValue | TypeValue[]; /** * Identifies resources attached or related to an object that potentially requires special handling.