Table of Contents

Interface IASModel<TModel>

Namespace
ActivityPub.Types
Assembly
ActivityPub.Types.dll

Indicates that the class is a convertible ActivityStreams model. This is a low-level base interface; most classes should derive from IASModel<TModel, TEntity> or IASModel<TModel, TEntity, TBaseModel> instead. Implementations MUST use explicit interface implementations for these values!

public interface IASModel<out TModel> where TModel : ASType, IASModel<out TModel>

Type Parameters

TModel

Type of the implementing class (the type of "this")

Constructors

IASModel()

private static IASModel()

Properties

ASTypeName

AS type name of this entity. For the full list of names in the object graph, use ASTypes.

[JsonIgnore]
public static string? ASTypeName { get; }

Property Value

string

BaseTypeName

AS type name of this entity's "base type". When this entity is added to the graph, the target type will be removed if present. This allows one entity type to "extend" another. This should be set to false for extension types.

[JsonIgnore]
public static string? BaseTypeName { get; }

Property Value

string

Remarks

This has no effect unless ASTypeName is non-null.

DefiningContext

JSON-LD context(s) that define this entity.

[JsonIgnore]
public static IJsonLDContext DefiningContext { get; }

Property Value

IJsonLDContext

DerivedTypeNames

AS name of all types that derive from this one.

[JsonIgnore]
internal static HashSet<string>? DerivedTypeNames { get; }

Property Value

HashSet<string>
See Also

EntityType

Type of the entity associated with this model.

[JsonIgnore]
public static abstract Type EntityType { get; }

Property Value

Type

Methods

FromGraph(TypeMap)

Constructs an instance from this type from a pre-populated type graph. The provided TypeMap instance is guaranteed to include an instance of type EntityType.

public static abstract TModel FromGraph(TypeMap typeMap)

Parameters

typeMap TypeMap

Returns

TModel

ShouldConvertFrom(JsonElement, TypeMap)

Overrides the native type-matching logic. This will be called when an object is being converted to check if it contains this type. Return true to forcibly parse the type, true to block parsing, or null to resume native logic.

[PublicAPI]
public static bool? ShouldConvertFrom(JsonElement inputJson, TypeMap typeMap)

Parameters

inputJson JsonElement

JSON message that is being converted. May not be an object.

typeMap TypeMap

Type graph that may contain the object. Contains the JSON-LD context and other metadata.

Returns

bool?