Rising Tide Developers
SDKCore

rtClient.styleSets

SDK methods for querying and rendering style sets.

rtClient.styleSets backs style-set CRUD and SVG preview. A style set belongs to one domain: PAGE, EVENT, PREDICTION or GAME.

Methods

rtClient.styleSets.listStyleSets(params?)

List style sets. Returns ApiResponse<{ data: StyleSet[], meta: { total, availableFormats } }> - the array is at res.data.data.

const res = await rtClient.styleSets.listStyleSets({ productTypeSlug: "haiku" });
const sets = res.data.data;

Filters (StyleListParams):

FilterTypeDescription
searchstringFree-text search over name
productTypeSlugstringFilter by product type slug (resolves to id server-side)
productTypeIdnumberFilter by numeric product type id
isDefaultbooleanOnly default sets
submissionStatus'DRAFT' | 'SUBMITTED' | 'APPROVED' | 'REJECTED'Filter by approval state
includeUnapprovedbooleanOwner/operator views: include non-approved sets (default false = APPROVED only)
includeAppScopedbooleanOperator views: include sets owned by a single app (default false, so a catalog picker sees general stock only)
limitnumberCaps the returned set; the listing is not paginated
sortBy'name' | 'createdAt' | 'updatedAt'Sort key
sortOrder'asc' | 'desc'Sort direction

rtClient.styleSets.listByArtist(artistUserId, params?)

Everything one artist has made - their series, and every sticker they own whether it belongs to a series or not. Returns ApiResponse<ArtistAssets>.

const { data } = await rtClient.styleSets.listByArtist(artistId, {
  includeUnapproved: true,
  includeInactive: true,
  includeSvg: true,
});

data.series;   // StyleSet & { _count: { styles, productTypes, stickers } }
data.stickers; // Sticker[] - styleSetId is null when standalone

Unlike listStyleSets, this asks no domain question, and that is the reason it exists. A style set's domain is derived from its StyleSetProductType rows, so a series holding only stickers has no domain and cannot appear in a catalog list. This read is the artist's own view of their own work, where that question does not apply.

ParamTypeDescription
includeUnapprovedbooleanInclude DRAFT / SUBMITTED / REJECTED work. Artist or operator only
includeInactivebooleanInclude deactivated work. Artist or operator only
includeSvgbooleanInclude SVG source on styles and stickers

Approved-and-active is public; either owner flag requires the artist themselves or an operator holding MANAGE_TEMPLATES.


rtClient.styleSets.getStyleSetById(id)

Get a style set by numeric id. Returns ApiResponse<StyleSet>.

const { data: styleSet } = await rtClient.styleSets.getStyleSetById(7);
console.log(styleSet.royaltyPercentage); // 20
console.log(styleSet.styles?.map((s) => s.canvasId)); // ["letter-l", "5x7-p"]

rtClient.styleSets.generateLivePreview(id, data)

Render a style set against supplied content - the live authoring/preview path. Returns TemplatePreviewApiResponse; the SVG is at res.data.data.preview.svg.

const res = await rtClient.styleSets.generateLivePreview(styleSetId, {
  title: "morning rain",
  author: user.stxAddress,
  content: { line1: "...", line2: "...", line3: "..." },
  format: "landscape",
  productType: "haiku",
});
const svg = res.data.data.preview.svg;

generatePreview(id, format?, productType?) renders the product type's sample content instead of your own; it returns the same TemplatePreviewApiResponse shape. generateLivePreview also takes subtitle, authorName and stickerData: { stickerId, placement: { x, y, scale, rotation } } to draw one sticker on the preview.

getAuthoredCanvases(styleSetId) returns every canvas a style set ships with its real width, height and aspect; validateStyle, previewDraft and the createStyleSet / addStyle family are the artist and operator authoring surface.


StyleSet shape

interface StyleSet {
  id: number;
  name: string;
  description?: string;
  artistUserId: number;         // FK to the artist User
  royaltyPercentage: number;    // TEMPLATE_ARTIST royalty rate
  previewUrl?: string;
  isActive: boolean;
  isDefault: boolean;
  tags?: string[];
  submissionStatus?: SubmissionStatus; // 'DRAFT' | 'SUBMITTED' | 'APPROVED' | 'REJECTED'
  createdAt: string;
  updatedAt: string;
  artist?: User;                        // embedded when requested
  styles?: Style[];                     // the canvases
  productTypes?: StyleSetProductType[]; // compatible product types + per-type royalty
}

Each Style (canvas) carries a canvasId (e.g. 'letter-p', '5x7-l'), a derived format, its svgContent / dataBindings, and width / height - the artifact's own size, read off the SVG at ingest. The canvas id names a slot and an orientation, never a size, so those two columns are the only place a real dimension comes from. Both are nullable: a row whose SVG declares no usable size reports null rather than a guess.


rtClient.ticketStyles

Ticket style sets are a parallel catalog to page styles, on their own service.

const res = await rtClient.ticketStyles.listStyleSets(params);
const { data } = await rtClient.ticketStyles.getStyleSetById(id);

Beyond the set-level reads it carries the individual styles (listStyles, getStyleById), the authoring CRUD an artist surface needs, and the render helpers getPreviewUrl, getReservationThumbnailUrl, generatePreview and generateLivePreview.

generateLivePreview is the one worth knowing: it renders exactly what the contract will render, so a composer can show the real artifact before anything is broadcast rather than an approximation of it.