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
ASLink()
Constructs a new instance and attaches it to a new, empty type graph.
public ASLink()
ASLink(ASType)
public ASLink(ASType existingGraph)
Parameters
existingGraph
ASType
ASLink(TypeMap, ASLinkEntity?)
public ASLink(TypeMap typeMap, ASLinkEntity? entity)
Parameters
typeMap
TypeMapentity
ASLinkEntity
ASLink(TypeMap, bool)
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
Remarks
All overrides MUST call this using
base(typeMap, false)
Exceptions
- InvalidOperationException
If
is true and the entity type already exists in the graphextendGraph
- InvalidOperationException
If
is true and the entity requires another entity that is missing from the graphextendGraph
- InvalidCastException
If
is false and the object is not of typeextendGraph
TEntity
- See Also
Fields
LinkType
ActivityStreams type name for "Link" types.
[PublicAPI]
public const string LinkType = "Link"
Field Value
Properties
Entity
private ASLinkEntity Entity { get; }
Property Value
HRef
The target resource pointed to by a
public required ASUri HRef { get; set; }
Property Value
- See Also
HRefLang
Hints as to the language used by the target resource. Value MUST be a [BCP47] Language-Tag.
public string? HRefLang { get; set; }
Property Value
- See Also
Height
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
Rel
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
- See Also
Width
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
implicit operator ASUri(ASLink)
Implicitly converts the link to an ASUri using the value of HRef.
public static implicit operator ASUri(ASLink link)
Parameters
link
ASLink
Returns
implicit operator string(ASLink)
Implicitly converts the link to a string using the value of HRef.
public static implicit operator string(ASLink link)
Parameters
link
ASLink
Returns
implicit operator Uri(ASLink)
Implicitly converts the link to a Uri using the value of HRef.
public static implicit operator Uri(ASLink link)
Parameters
link
ASLink
Returns
implicit operator ASLink(ASUri)
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
implicit operator ASLink(string)
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
implicit operator ASLink(Uri)
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
Explicit Interface Implementations
IASModel<ASLink>.ASTypeName
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
IASModel<ASLink>.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.
static ASLink IASModel<ASLink>.FromGraph(TypeMap typeMap)
Parameters
typeMap
TypeMap