Skip to content

Post Inputs and Results

These types are in the namespace UmbSocial.Core.Posts.

What a person writes.

public sealed record PostInput(
string Text,
string? LinkUrl,
string? LinkTitle,
string? LinkDescription,
Guid? MediaKey,
string? ImageAltText,
IReadOnlyDictionary<Guid, string?> Channels,
ImageFraming? ImageFraming = null,
string? LinkImageUrl = null);
Property Use
Text The main text. Required.
LinkUrl An absolute https link, or null.
LinkTitle The link’s title. Required for LinkedIn when there is a link.
LinkDescription The link’s description.
MediaKey The image’s media item key, or null.
ImageAltText The image’s alt text.
Channels Channel key → that channel’s own text, or null to use Text. At least one.
ImageFraming The image’s focal point and each network’s own crop, or null (see below). Refused when anything lies outside the image (image.framing_invalid).
LinkImageUrl The link card’s image, an absolute https URL, or null.

UmbSocial.Core.Models. Every value is a fraction (0 to 1) of the image’s width or height, from the top left.

public sealed record ImageFraming(ImageFocalPoint? FocalPoint, IReadOnlyList<ImageCrop> Crops);
public sealed record ImageFocalPoint(decimal Left, decimal Top);
public sealed record ImageCrop(string Network, decimal Left, decimal Top, decimal Right, decimal Bottom);

A crop says how much to trim from each side (Umbraco’s crop coordinates), so each side must leave some of the image, and a network has at most one crop (at most 20). A network with its own crop gets it; the others are cut to their shape around the focal point, or the centre without one. CropFor(network) gives a network’s crop.

The size caps and rules are in Writing and scheduling posts.

When a post goes out.

public sealed record Schedule(When When, DateTime? AtUtc);
Property Use
When When: Draft, Queue, At or Now.
AtUtc The time in UTC, for At. Must not be in the past. Ignored otherwise.

The outcome of a post operation.

Property Type Use
Ok bool Whether it succeeded.
PostKey Guid? The post’s key when it succeeded.
Errors IReadOnlyList<string> The error codes when it didn’t. Every problem found is listed, not only the first.

Which posts to list. At most PostQuery.MaxResults (500) are returned.

public sealed record PostQuery(DateTime? FromUtc, DateTime? ToUtc, PostStatus? Status, Guid? ChannelKey);
Property Use
FromUtc Posts going out at or after this time (the creation time for drafts).
ToUtc Posts going out before this time.
Status Only posts with this PostStatus.
ChannelKey Only posts going to this channel.

What IPostService.CheckAsync returns.

CheckResult property Type Use
Errors IReadOnlyList<string> Errors about the post itself (required text, size caps, https link, unknown or paused channels).
Channels IReadOnlyList<ChannelCheck> One entry for each known channel.
ChannelCheck property Type Use
ChannelKey Guid The channel.
Network string Its network id.
Count int The text’s length as the network counts it, including a link added to the text.
Max int The network’s limit.
Errors IReadOnlyList<string> What the network would refuse (text.too_long:<network>, image.required:<network>, link.title_required:<network>, link.image_conflict:<network>).

The post as handed to a SocialPostSavingNotification handler (in UmbSocial.Core.Notifications). It has the properties of PostInput and Schedule, all settable.

What is about to be sent to one channel, as handed to a SocialPostDispatchingNotification handler (in UmbSocial.Core.Notifications).