Table of Contents

Class OpenGraphEmbeddedCardGenerator

Namespace
idunno.Bluesky.Embed
Assembly
idunno.Bluesky.dll

Creates an OpenCard embed, which is a card that can be embedded in Bluesky posts, displaying richer content from a URL. This is used for embedding external content such as websites, videos, and other media.

public class OpenGraphEmbeddedCardGenerator : BaseEmbeddedCardGenerator, IEmbeddedCardGenerator, IDisposable

Inheritance

Derived

Implements

Inherited Members

Constructors

OpenGraphEmbeddedCardGenerator(BlueskyAgent)

Creates a new instance of idunno.Bluesky.Embed.OpenGraphEmbeddedCardGenerator.

public OpenGraphEmbeddedCardGenerator(BlueskyAgent agent)

Parameters

agent BlueskyAgent

The idunno.Bluesky.BlueskyAgent to use for thumbnail uploading.

Exceptions

ArgumentNullException

Thrown if agent is null.

OpenGraphEmbeddedCardGenerator(BlueskyAgent, ILoggerFactory?)

Creates a new instance of idunno.Bluesky.Embed.OpenGraphEmbeddedCardGenerator.

public OpenGraphEmbeddedCardGenerator(BlueskyAgent agent, ILoggerFactory? loggerFactory)

Parameters

agent BlueskyAgent

The idunno.Bluesky.BlueskyAgent to use for thumbnail uploading.

loggerFactory ILoggerFactory?

The Microsoft.Extensions.Logging.ILoggerFactory to use for logging. If null, a no-op logger will be used.

Exceptions

ArgumentNullException

Thrown if agent is null.

OpenGraphEmbeddedCardGenerator(BlueskyAgent, ILogger)

Creates a new instance of idunno.Bluesky.Embed.OpenGraphEmbeddedCardGenerator.

protected OpenGraphEmbeddedCardGenerator(BlueskyAgent agent, ILogger logger)

Parameters

agent BlueskyAgent

The idunno.Bluesky.BlueskyAgent to use for thumbnail uploading.

logger ILogger

The Microsoft.Extensions.Logging.ILogger to use for logging.

Exceptions

ArgumentNullException

Thrown if agent or logger is null.

OpenGraphEmbeddedCardGenerator(BlueskyAgent, HttpClient, ILoggerFactory?)

Creates a new instance of idunno.Bluesky.Embed.OpenGraphEmbeddedCardGenerator.

public OpenGraphEmbeddedCardGenerator(BlueskyAgent agent, HttpClient httpClient, ILoggerFactory? loggerFactory)

Parameters

agent BlueskyAgent

The idunno.Bluesky.BlueskyAgent to use for thumbnail uploading.

httpClient HttpClient

The System.Net.Http.HttpClient to use for making HTTP requests to retrieve OpenGraph data. Ensure the client is hardened against SSRF attacks.

loggerFactory ILoggerFactory?

The Microsoft.Extensions.Logging.ILoggerFactory to use for logging. If null, a no-op logger will be used.

Exceptions

ArgumentNullException

Thrown if agent is null.

OpenGraphEmbeddedCardGenerator(BlueskyAgent, HttpClient, ILogger)

Creates a new instance of idunno.Bluesky.Embed.OpenGraphEmbeddedCardGenerator.

protected OpenGraphEmbeddedCardGenerator(BlueskyAgent agent, HttpClient httpClient, ILogger logger)

Parameters

agent BlueskyAgent

The idunno.Bluesky.BlueskyAgent to use for thumbnail uploading.

httpClient HttpClient

The System.Net.Http.HttpClient to use for making HTTP requests to retrieve OpenGraph data. Ensure the client is hardened against SSRF attacks.

logger ILogger

The Microsoft.Extensions.Logging.ILogger to use for logging.

Exceptions

ArgumentNullException

Thrown if agent, httpClient, or logger is null.

OpenGraphEmbeddedCardGenerator(BlueskyAgent)

Creates a new instance of idunno.Bluesky.Embed.OpenGraphEmbeddedCardGenerator.

public OpenGraphEmbeddedCardGenerator(BlueskyAgent agent)

Parameters

agent BlueskyAgent

The idunno.Bluesky.BlueskyAgent to use for thumbnail uploading.

Exceptions

ArgumentNullException

Thrown if agent is null.

OpenGraphEmbeddedCardGenerator(BlueskyAgent, ILoggerFactory?)

Creates a new instance of idunno.Bluesky.Embed.OpenGraphEmbeddedCardGenerator.

public OpenGraphEmbeddedCardGenerator(BlueskyAgent agent, ILoggerFactory? loggerFactory)

Parameters

agent BlueskyAgent

The idunno.Bluesky.BlueskyAgent to use for thumbnail uploading.

loggerFactory ILoggerFactory?

The Microsoft.Extensions.Logging.ILoggerFactory to use for logging. If null, a no-op logger will be used.

Exceptions

ArgumentNullException

Thrown if agent is null.

OpenGraphEmbeddedCardGenerator(BlueskyAgent, ILogger)

Creates a new instance of idunno.Bluesky.Embed.OpenGraphEmbeddedCardGenerator.

protected OpenGraphEmbeddedCardGenerator(BlueskyAgent agent, ILogger logger)

Parameters

agent BlueskyAgent

The idunno.Bluesky.BlueskyAgent to use for thumbnail uploading.

logger ILogger

The Microsoft.Extensions.Logging.ILogger to use for logging.

Exceptions

ArgumentNullException

Thrown if agent or logger is null.

OpenGraphEmbeddedCardGenerator(BlueskyAgent, HttpClient, ILoggerFactory?)

Creates a new instance of idunno.Bluesky.Embed.OpenGraphEmbeddedCardGenerator.

public OpenGraphEmbeddedCardGenerator(BlueskyAgent agent, HttpClient httpClient, ILoggerFactory? loggerFactory)

Parameters

agent BlueskyAgent

The idunno.Bluesky.BlueskyAgent to use for thumbnail uploading.

httpClient HttpClient

The System.Net.Http.HttpClient to use for making HTTP requests to retrieve OpenGraph data. Ensure the client is hardened against SSRF attacks.

loggerFactory ILoggerFactory?

The Microsoft.Extensions.Logging.ILoggerFactory to use for logging. If null, a no-op logger will be used.

Exceptions

ArgumentNullException

Thrown if agent is null.

OpenGraphEmbeddedCardGenerator(BlueskyAgent, HttpClient, ILogger)

Creates a new instance of idunno.Bluesky.Embed.OpenGraphEmbeddedCardGenerator.

protected OpenGraphEmbeddedCardGenerator(BlueskyAgent agent, HttpClient httpClient, ILogger logger)

Parameters

agent BlueskyAgent

The idunno.Bluesky.BlueskyAgent to use for thumbnail uploading.

httpClient HttpClient

The System.Net.Http.HttpClient to use for making HTTP requests to retrieve OpenGraph data. Ensure the client is hardened against SSRF attacks.

logger ILogger

The Microsoft.Extensions.Logging.ILogger to use for logging.

Exceptions

ArgumentNullException

Thrown if agent, httpClient, or logger is null.

OpenGraphEmbeddedCardGenerator(BlueskyAgent)

Creates a new instance of idunno.Bluesky.Embed.OpenGraphEmbeddedCardGenerator.

public OpenGraphEmbeddedCardGenerator(BlueskyAgent agent)

Parameters

agent BlueskyAgent

The idunno.Bluesky.BlueskyAgent to use for thumbnail uploading.

Exceptions

ArgumentNullException

Thrown if agent is null.

OpenGraphEmbeddedCardGenerator(BlueskyAgent, ILoggerFactory?)

Creates a new instance of idunno.Bluesky.Embed.OpenGraphEmbeddedCardGenerator.

public OpenGraphEmbeddedCardGenerator(BlueskyAgent agent, ILoggerFactory? loggerFactory)

Parameters

agent BlueskyAgent

The idunno.Bluesky.BlueskyAgent to use for thumbnail uploading.

loggerFactory ILoggerFactory?

The Microsoft.Extensions.Logging.ILoggerFactory to use for logging. If null, a no-op logger will be used.

Exceptions

ArgumentNullException

Thrown if agent is null.

OpenGraphEmbeddedCardGenerator(BlueskyAgent, ILogger)

Creates a new instance of idunno.Bluesky.Embed.OpenGraphEmbeddedCardGenerator.

protected OpenGraphEmbeddedCardGenerator(BlueskyAgent agent, ILogger logger)

Parameters

agent BlueskyAgent

The idunno.Bluesky.BlueskyAgent to use for thumbnail uploading.

logger ILogger

The Microsoft.Extensions.Logging.ILogger to use for logging.

Exceptions

ArgumentNullException

Thrown if agent or logger is null.

OpenGraphEmbeddedCardGenerator(BlueskyAgent, HttpClient, ILoggerFactory?)

Creates a new instance of idunno.Bluesky.Embed.OpenGraphEmbeddedCardGenerator.

public OpenGraphEmbeddedCardGenerator(BlueskyAgent agent, HttpClient httpClient, ILoggerFactory? loggerFactory)

Parameters

agent BlueskyAgent

The idunno.Bluesky.BlueskyAgent to use for thumbnail uploading.

httpClient HttpClient

The System.Net.Http.HttpClient to use for making HTTP requests to retrieve OpenGraph data. Ensure the client is hardened against SSRF attacks.

loggerFactory ILoggerFactory?

The Microsoft.Extensions.Logging.ILoggerFactory to use for logging. If null, a no-op logger will be used.

Exceptions

ArgumentNullException

Thrown if agent is null.

OpenGraphEmbeddedCardGenerator(BlueskyAgent, HttpClient, ILogger)

Creates a new instance of idunno.Bluesky.Embed.OpenGraphEmbeddedCardGenerator.

protected OpenGraphEmbeddedCardGenerator(BlueskyAgent agent, HttpClient httpClient, ILogger logger)

Parameters

agent BlueskyAgent

The idunno.Bluesky.BlueskyAgent to use for thumbnail uploading.

httpClient HttpClient

The System.Net.Http.HttpClient to use for making HTTP requests to retrieve OpenGraph data. Ensure the client is hardened against SSRF attacks.

logger ILogger

The Microsoft.Extensions.Logging.ILogger to use for logging.

Exceptions

ArgumentNullException

Thrown if agent, httpClient, or logger is null.

Methods

CreateEmbeddedExternalFromOpenGraphMetadata(Uri, string, CancellationToken)

Creates an idunno.Bluesky.Embed.EmbeddedExternal from OpenGraph metadata.

protected Task<EmbeddedExternal?> CreateEmbeddedExternalFromOpenGraphMetadata(Uri uri, string pageContent, CancellationToken cancellationToken = default)

Parameters

uri Uri

The URI to retrieve OpenGraph data from.

pageContent string

The HTML content of the page.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<EmbeddedExternal?>

An idunno.Bluesky.Embed.EmbeddedExternal if enough OpenGraph data is found; otherwise, null.

Exceptions

ArgumentNullException

Thrown if uri is null

ArgumentException

Thrown if uri is not an absolute URI.

CreateEmbeddedExternalFromOpenGraphMetadata(Uri, string, CancellationToken)

Creates an idunno.Bluesky.Embed.EmbeddedExternal from OpenGraph metadata.

protected Task<EmbeddedExternal?> CreateEmbeddedExternalFromOpenGraphMetadata(Uri uri, string pageContent, CancellationToken cancellationToken = default)

Parameters

uri Uri

The URI to retrieve OpenGraph data from.

pageContent string

The HTML content of the page.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<EmbeddedExternal?>

An idunno.Bluesky.Embed.EmbeddedExternal if enough OpenGraph data is found; otherwise, null.

Exceptions

ArgumentNullException

Thrown if uri is null

ArgumentException

Thrown if uri is not an absolute URI.

CreateEmbeddedExternalFromOpenGraphMetadata(Uri, string, CancellationToken)

Creates an idunno.Bluesky.Embed.EmbeddedExternal from OpenGraph metadata.

protected Task<EmbeddedExternal?> CreateEmbeddedExternalFromOpenGraphMetadata(Uri uri, string pageContent, CancellationToken cancellationToken = default)

Parameters

uri Uri

The URI to retrieve OpenGraph data from.

pageContent string

The HTML content of the page.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<EmbeddedExternal?>

An idunno.Bluesky.Embed.EmbeddedExternal if enough OpenGraph data is found; otherwise, null.

Exceptions

ArgumentNullException

Thrown if uri is null

ArgumentException

Thrown if uri is not an absolute URI.

Generate(Uri, CancellationToken)

Gets an idunno.Bluesky.Embed.EmbeddedExternal for uri, preferring OpenGraph data if available.

public override Task<EmbeddedExternal?> Generate(Uri uri, CancellationToken cancellationToken = default)

Parameters

uri Uri

The URI to retrieve OpenGraph data from.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<EmbeddedExternal?>

An idunno.Bluesky.Embed.EmbeddedExternal if the page can be fetched and a valid canonical URL can be determined; otherwise, null.

Exceptions

ArgumentNullException

Thrown if uri is null

ArgumentException

Thrown if uri is not an absolute URI.

Generate(Uri, CancellationToken)

Gets an idunno.Bluesky.Embed.EmbeddedExternal for uri, preferring OpenGraph data if available.

public override Task<EmbeddedExternal?> Generate(Uri uri, CancellationToken cancellationToken = default)

Parameters

uri Uri

The URI to retrieve OpenGraph data from.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<EmbeddedExternal?>

An idunno.Bluesky.Embed.EmbeddedExternal if the page can be fetched and a valid canonical URL can be determined; otherwise, null.

Exceptions

ArgumentNullException

Thrown if uri is null

ArgumentException

Thrown if uri is not an absolute URI.

Generate(Uri, CancellationToken)

Gets an idunno.Bluesky.Embed.EmbeddedExternal for uri, preferring OpenGraph data if available.

public override Task<EmbeddedExternal?> Generate(Uri uri, CancellationToken cancellationToken = default)

Parameters

uri Uri

The URI to retrieve OpenGraph data from.

cancellationToken CancellationToken

A token to cancel the operation.

Returns

Task<EmbeddedExternal?>

An idunno.Bluesky.Embed.EmbeddedExternal if the page can be fetched and a valid canonical URL can be determined; otherwise, null.

Exceptions

ArgumentNullException

Thrown if uri is null

ArgumentException

Thrown if uri is not an absolute URI.