Table of Contents

Class DefaultFacetExtractor

Namespace
idunno.Bluesky.RichText
Assembly
idunno.Bluesky.dll

Extracts facets from a supplied string.

public sealed class DefaultFacetExtractor : IFacetExtractor

Inheritance

Implements

Inherited Members

Constructors

DefaultFacetExtractor(Func<string, CancellationToken, Task<Did?>>)

Construct a new instance of idunno.Bluesky.RichText.DefaultFacetExtractor.

public DefaultFacetExtractor(Func<string, CancellationToken, Task<Did?>> resolveHandle)

Parameters

resolveHandle Func<string, CancellationToken, Task<Did?>>

A System.Func`3 that returns a DID for a handle.

Exceptions

ArgumentNullException

Thrown if resolveHandle is null.

DefaultFacetExtractor(Func<string, CancellationToken, Task<Did?>>)

Construct a new instance of idunno.Bluesky.RichText.DefaultFacetExtractor.

public DefaultFacetExtractor(Func<string, CancellationToken, Task<Did?>> resolveHandle)

Parameters

resolveHandle Func<string, CancellationToken, Task<Did?>>

A System.Func`3 that returns a DID for a handle.

Exceptions

ArgumentNullException

Thrown if resolveHandle is null.

DefaultFacetExtractor(Func<string, CancellationToken, Task<Did?>>)

Construct a new instance of idunno.Bluesky.RichText.DefaultFacetExtractor.

public DefaultFacetExtractor(Func<string, CancellationToken, Task<Did?>> resolveHandle)

Parameters

resolveHandle Func<string, CancellationToken, Task<Did?>>

A System.Func`3 that returns a DID for a handle.

Exceptions

ArgumentNullException

Thrown if resolveHandle is null.

Methods

ExtractFacets(string, CancellationToken)

Extracts facets from the specified text.

public Task<IList<Facet>> ExtractFacets(string text, CancellationToken cancellationToken = default)

Parameters

text string

The text to extract any facets from.

cancellationToken CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

Task<IList<Facet>>

The task object representing the asynchronous operation.

Remarks

Every distinct handle mentioned in text is resolved, which is typically a network call, so the work this does grows with the length of text. Callers which accept text from elsewhere should apply their own length limit before calling this.

Exceptions

ArgumentNullException

Thrown if text is null.

RegexMatchTimeoutException

Thrown if matching a pattern against text exceeds the one second match timeout.

ExtractFacets(string, CancellationToken)

Extracts facets from the specified text.

public Task<IList<Facet>> ExtractFacets(string text, CancellationToken cancellationToken = default)

Parameters

text string

The text to extract any facets from.

cancellationToken CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

Task<IList<Facet>>

The task object representing the asynchronous operation.

Remarks

Every distinct handle mentioned in text is resolved, which is typically a network call, so the work this does grows with the length of text. Callers which accept text from elsewhere should apply their own length limit before calling this.

Exceptions

ArgumentNullException

Thrown if text is null.

RegexMatchTimeoutException

Thrown if matching a pattern against text exceeds the one second match timeout.

ExtractFacets(string, CancellationToken)

Extracts facets from the specified text.

public Task<IList<Facet>> ExtractFacets(string text, CancellationToken cancellationToken = default)

Parameters

text string

The text to extract any facets from.

cancellationToken CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

Task<IList<Facet>>

The task object representing the asynchronous operation.

Remarks

Every distinct handle mentioned in text is resolved, which is typically a network call, so the work this does grows with the length of text. Callers which accept text from elsewhere should apply their own length limit before calling this.

Exceptions

ArgumentNullException

Thrown if text is null.

RegexMatchTimeoutException

Thrown if matching a pattern against text exceeds the one second match timeout.