feat: declare preview shape on SocialPlatformConfig (#140)#141
Merged
Conversation
Adds a 'preview' key to each handler's meta config array describing how clients should render a post preview for the platform. Per-platform defaults follow the mapping in #140: Twitter 16:9 above feed Bluesky 16:9 above feed Threads native below feed Instagram 1:1 below square Facebook native above card LinkedIn native above card Pinterest 4:5 below square Reddit native above card Refs: #140
Adds RestApi::normalize_preview() applied during /platforms response assembly. Handlers that don't declare a 'preview' array (or declare an incomplete shape) get a generic feed-shaped default: aspectRatio: native captionPosition: above previewSurface: feed The field is always present on the response — clients never have to default it client-side and never need to branch on slug to pick preview chrome. Refs: #140
Adds a 'Handler API' section to README documenting the meta config shape exposed via GET /datamachine/v1/socials/platforms, with field semantics and per-platform mapping for the new preview shape. Refs: #140
3 tasks
Contributor
Homeboy Results —
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #140 — declares a
previewshape on each handler'sSocialPlatformConfigso downstream clients (Studio publish-pane preview, mobile app, etc.) can render platform-canonical post previews without any per-platform branching. The client renders whatever shape the server declares.Changes
8 handlers under
inc/Handlers/{Twitter,Bluesky,Instagram,Threads,Facebook,LinkedIn,Pinterest,Reddit}/*.phpdeclare apreviewarray in their meta config, following the per-platform mapping in SocialPlatformConfig: declare preview shape (aspectRatio, captionPosition, previewSurface) #140.REST assembly (
RestApi::get_platforms()) gains anormalize_preview()step applied to every entry. Handlers that don't declare it (or declare an incomplete shape) get a generic feed-shaped default:The field is always present on the response — clients never default it.
README gets a new "Handler API" section documenting the meta config shape with the per-platform preview mapping.
Per-platform mapping
Companion PR — must merge together
This is the data-contract foundation for the Studio publish-pane preview architecture. The TypeScript types in
@extrachill/api-clientare updated in a companion PR — both should land together so consumers see a consistent surface:Downstream consumers (extrachill-studio#43, #44) are unblocked once both merge.
Backwards compat
previewis purely additive on the response. Existing publish-pane behavior is unchanged.previewignore it (extra JSON fields are tolerated).previewmissing — but this PR ships alongside the api-client companion; once both land, the server always emits the field.Verification
php -lclean on all 9 modified filespreviewkeys placed inside themetaarray passed toregisterHandler()so they flow through to the REST response naturallyRestApi::get_platforms()docblock updated to document the new fieldConstraints
feat:, 1docs:).Refs: #140