Table of Contents

Class ASLink

Namespace
ActivityPub.Types.AS
Assembly
ActivityPub.Types.dll

A Link is an indirect, qualified reference to a resource identified by a URL. The fundamental model for links is established by RFC5988. Many of the properties defined by the Activity Vocabulary allow values that are either instances of Object or When a Link is used, it establishes a qualified relation connecting the subject (the containing object) to the resource identified by the href. Properties of the Link are properties of the reference as opposed to properties of the resource.

public class ASLink : ASType, IASModel<ASType, ASTypeEntity>, IASModel<ASType>, IASModel<ASLink, ASLinkEntity, ASType>, IASModel<ASLink, ASLinkEntity>, IASModel<ASLink>
Inheritance
ASLink
Implements
Derived
Inherited Members

Constructors

Constructs a new instance and attaches it to a new, empty type graph.

public ASLink()
public ASLink(ASType existingGraph)

Parameters

existingGraph ASType
public ASLink(TypeMap typeMap, ASLinkEntity? entity)

Parameters

typeMap TypeMap
entity ASLinkEntity

Constructs a new instance from an existing type graph. The existing graph is either extended or wrapped, depending on the value of

isExtending
public ASLink(TypeMap typeMap, bool isExtending = true)

Parameters

typeMap TypeMap
isExtending bool

All overrides MUST call this using

base(typeMap, false)

Exceptions

InvalidOperationException

If

extendGraph
is true and the entity type already exists in the graph
InvalidOperationException

If

extendGraph
is true and the entity requires another entity that is missing from the graph
InvalidCastException

If

extendGraph
is false and the object is not of type
TEntity
See Also
ProjectTo<TModel, TEntity>(bool)

Fields

ActivityStreams type name for "Link" types.

[PublicAPI]
public const string LinkType = "Link"

Field Value

string

Properties

private ASLinkEntity Entity { get; }

Property Value

ASLinkEntity

The target resource pointed to by a

public required ASUri HRef { get; set; }

Property Value

ASUri
See Also

Hints as to the language used by the target resource. Value MUST be a [BCP47] Language-Tag.

public string? HRefLang { get; set; }

Property Value

string
See Also

On a Link, specifies a hint as to the rendering height in device-independent pixels of the linked resource.

public int? Height { get; set; }

Property Value

int?
See Also

A link relation associated with a The value MUST conform to both the [HTML5] and [RFC5988] "link relation" definitions. In the [HTML5], any string not containing the "space" U+0020, "tab" (U+0009), "LF" (U+000A), "FF" (U+000C), "CR" (U+000D) or "," (U+002C) characters can be used as a valid link relation.

public HashSet<LinkRel> Rel { get; set; }

Property Value

HashSet<LinkRel>
See Also

On a Link, specifies a hint as to the rendering width in device-independent pixels of the linked resource.

public int? Width { get; set; }

Property Value

int?
See Also

Operators

Implicitly converts the link to an ASUri using the value of HRef.

public static implicit operator ASUri(ASLink link)

Parameters

link ASLink

Returns

ASUri

Implicitly converts the link to a string using the value of HRef.

public static implicit operator string(ASLink link)

Parameters

link ASLink

Returns

string

Implicitly converts the link to a Uri using the value of HRef.

public static implicit operator Uri(ASLink link)

Parameters

link ASLink

Returns

Uri

Implicitly converts an ASUri into a link. Uri value will be assigned to HRef.

public static implicit operator ASLink(ASUri asUri)

Parameters

asUri ASUri

Returns

ASLink

Implicitly converts a string into a link. String value will be assigned to HRef.

public static implicit operator ASLink(string str)

Parameters

str string

Returns

ASLink

Implicitly converts a Uri into a link. Uri value will be assigned to HRef.

public static implicit operator ASLink(Uri uri)

Parameters

uri Uri

Returns

ASLink

Explicit Interface Implementations

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

static string IASModel<ASLink>.ASTypeName { get; }

Returns

string

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.

static ASLink IASModel<ASLink>.FromGraph(TypeMap typeMap)

Parameters

typeMap TypeMap

Returns

ASLink

See Also