Class DefaultFacetExtractor
- Namespace
- idunno.Bluesky.RichText
- Assembly
- idunno.Bluesky.dll
Extracts facets from a supplied string.
public sealed class DefaultFacetExtractor : IFacetExtractorInheritance
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
resolveHandleFunc<string, CancellationToken, Task<Did?>>-
A System.Func`3 that returns a DID for a handle.
Exceptions
- ArgumentNullException
-
Thrown if
resolveHandleis 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
resolveHandleFunc<string, CancellationToken, Task<Did?>>-
A System.Func`3 that returns a DID for a handle.
Exceptions
- ArgumentNullException
-
Thrown if
resolveHandleis 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
resolveHandleFunc<string, CancellationToken, Task<Did?>>-
A System.Func`3 that returns a DID for a handle.
Exceptions
- ArgumentNullException
-
Thrown if
resolveHandleis null.
Methods
ExtractFacets(string, CancellationToken)
Extracts facets from the specified text.
public Task<IList<Facet>> ExtractFacets(string text, CancellationToken cancellationToken = default)Parameters
textstring-
The text to extract any facets from.
cancellationTokenCancellationToken-
A cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
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
textis null. - RegexMatchTimeoutException
-
Thrown if matching a pattern against
textexceeds 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
textstring-
The text to extract any facets from.
cancellationTokenCancellationToken-
A cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
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
textis null. - RegexMatchTimeoutException
-
Thrown if matching a pattern against
textexceeds 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
textstring-
The text to extract any facets from.
cancellationTokenCancellationToken-
A cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
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
textis null. - RegexMatchTimeoutException
-
Thrown if matching a pattern against
textexceeds the one second match timeout.