import type { ApiClient } from "@promobase/sdk-runtime"; import { Cursor } from "@promobase/sdk-runtime"; import { metaPagination } from "../../pagination.ts"; import type { CommentFields } from "./comment.ts"; import type { DynamicPostChildAttachmentFields } from "./dynamic-post-child-attachment.ts"; import type { ProfileFields } from "./profile.ts"; export interface RTBDynamicPostFields { child_attachments: DynamicPostChildAttachmentFields[]; created: string; description: string; id: string; image_url: string; link: string; message: string; owner_id: string; place_id: string; product_id: string; title: string; } export interface RTBDynamicPostListCommentsParams { filter?: string; live_filter?: string; order?: string; since?: string; [key: string]: unknown; } export function rTBDynamicPostNode(client: ApiClient, id: string) { return { __path: id, __brand: undefined as unknown as RTBDynamicPostFields, get: (opts: { fields: F; params?: Record }) => client.get>(`${id}`, opts), comments: (opts: { fields: F; params?: RTBDynamicPostListCommentsParams }) => new Cursor>(client, `${id}/comments`, opts as { fields: readonly string[]; params?: Record }, metaPagination()), likes: (opts: { fields: F; params?: Record }) => new Cursor>(client, `${id}/likes`, opts as { fields: readonly string[]; params?: Record }, metaPagination()), }; }