Skip to content

Post Service

The post service creates, changes, lists, deletes and resolves posts.

You can access it by injecting IPostService, which can be found within the namespace UmbSocial.Core.Posts.

The inputs and results (PostInput, Schedule, PostResult, PostQuery, CheckResult) are described in Post inputs and results.

Lists posts, with their targets and channels, ordered by when they go (or went) out. At most 500 are returned. The edition’s history window is applied, sealed posts are left out, and SocialPostsLoadedNotification handlers can hide more.

Parameters:

Name Detail
query A PostQuery: from and to (UTC, on the scheduled time, or the creation time for drafts), a status and a channel key. Any can be null.
Task<IReadOnlyList<SocialPost>> ListAsync(PostQuery query, CancellationToken cancellationToken);

Gets one SocialPost with its targets and channels, or null when it doesn’t exist or is hidden (by the history window, sealing, or a loaded handler).

Name Detail
postKey The post’s key.
Task<SocialPost?> GetAsync(Guid postKey, CancellationToken cancellationToken);

Checks a post against its channels’ networks without saving anything, for live counts while writing. Returns the errors about the post itself (required text, size caps, https link, unknown or paused channels) and, for each channel, its count, its limit and its errors.

Name Detail
input The post as written.
Task<CheckResult> CheckAsync(PostInput input, CancellationToken cancellationToken);

Creates a post and schedules it. Publishes SocialPostSavingNotification first, then SocialPostSavedNotification.

Name Detail
input The post.
schedule When it goes out: Draft, Queue, At (with a UTC time) or Now.
userKey The backoffice user creating it.
Task<PostResult> CreateAsync(PostInput input, Schedule schedule, Guid userKey, CancellationToken cancellationToken);

Changes a post and its schedule. Channels where it is published keep the text they went out with; channels where it failed are sent again as a new attempt. Refused while the post is being sent (post.in_flight), while any channel’s outcome is Unknown (post.outcome_unknown), or once it is sealed (post.sealed). See Writing and scheduling posts.

Name Detail
postKey The post’s key.
input The post as it should be.
schedule When it goes out.
userKey The backoffice user changing it.
Task<PostResult> UpdateAsync(Guid postKey, PostInput input, Schedule schedule, Guid userKey, CancellationToken cancellationToken);

Deletes a post from Social (not from the networks). Refused while it is being sent. Publishes SocialPostDeletingNotification, then SocialPostDeletedNotification.

Name Detail
postKey The post’s key.
Task<PostResult> DeleteAsync(Guid postKey, CancellationToken cancellationToken);

Sends a Failed or Unknown target again, as a new attempt: its attempt number goes up and it goes out at the next check. Only ever a person’s decision. Any other target is refused (target.not_retryable).

Name Detail
targetId The target’s id (SocialPostTarget Id).
Task<PostResult> RetryTargetAsync(int targetId, CancellationToken cancellationToken);

Records that a Failed or Unknown target is in fact live, after a person checked the account. Any other target is refused (target.not_resolvable).

Name Detail
targetId The target’s id.
postUrl The live post’s URL, or null. Must be an absolute https URL (link.https_required).
Task<PostResult> MarkPublishedAsync(int targetId, string? postUrl, CancellationToken cancellationToken);

The management API rate limits retries (10 per user per minute); the service itself doesn’t.