import type { RequestOptions } from "../base-client"; import { RequestBuilder } from "../request-builder"; /** Attributes accepted by `POST /social/accounts` (create action). */ export interface SocialAccountCreateAttributes { platform: string; platform_user_id?: string; display_name?: string; avatar_url?: string; account_type?: string; is_active?: boolean; posting_enabled?: boolean; metadata?: Record; } /** Attributes accepted by `PATCH /social/accounts/:id` (update action). */ export interface SocialAccountUpdateAttributes { display_name?: string; avatar_url?: string; metadata?: Record; last_verified_at?: string; } /** Attributes accepted by `POST /social/posts` (create action). */ export interface SocialPostCreateAttributes { platform: string; content: string; media_urls?: string[]; hashtags?: string[]; link_url?: string; link_metadata?: Record; max_retries?: number; social_account_id: string; social_campaign_id?: string; } /** Attributes accepted by `PATCH /social/posts/:id` (update action). */ export interface SocialPostUpdateAttributes { content?: string; media_urls?: string[]; hashtags?: string[]; link_url?: string; link_metadata?: Record; platform_metadata?: Record; } /** Attributes accepted by `POST /social/campaigns` (create action). */ export interface SocialCampaignCreateAttributes { /** Required. Campaign name. */ name: string; /** Content brief that the AI will use to generate master copy. */ content_brief?: string; /** Target platforms, e.g. ["twitter", "linkedin", "instagram"]. */ target_platforms?: string[]; /** Media URLs to include in generated posts. */ media_urls?: string[]; /** SEO keywords for content optimization. */ seo_keywords?: string[]; /** Optional brand identity UUID for tone/style guidance. */ brand_identity_id?: string; } /** Attributes accepted by `PATCH /social/campaigns/:id` (update action). */ export interface SocialCampaignUpdateAttributes { name?: string; content_brief?: string; target_platforms?: string[]; media_urls?: string[]; seo_keywords?: string[]; brand_identity_id?: string; } /** * Social media management namespace — accounts, posts, metrics, and campaigns. * * Covers the full social publishing lifecycle: connect accounts, create and * schedule posts, collect engagement metrics, and run AI-powered social campaigns. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * // List connected accounts * const accounts = await admin.social.accounts.listByWorkspace('ws_abc'); * * // Create and schedule a post * const post = await admin.social.posts.create({ ... }); * await admin.social.posts.schedule(post.id, '2026-03-10T12:00:00Z'); * * // Get latest metrics * const metrics = await admin.social.metrics.latestForPost(post.id); * ``` */ export declare function createSocialNamespace(rb: RequestBuilder): { /** Social account management — connect, enable/disable, and deactivate accounts. */ accounts: { /** List social accounts for a workspace. */ listByWorkspace: (workspaceId: string, options?: RequestOptions) => Promise; /** List social accounts by platform (e.g. "twitter", "instagram"). */ listByPlatform: (platform: string, options?: RequestOptions) => Promise; /** Get a single social account by ID. */ get: (id: string, options?: RequestOptions) => Promise; /** Connect a new social account. */ create: (attributes: SocialAccountCreateAttributes, options?: RequestOptions) => Promise; /** Update a social account. */ update: (id: string, attributes: SocialAccountUpdateAttributes, options?: RequestOptions) => Promise; /** Delete a social account. */ delete: (id: string, options?: RequestOptions) => Promise; /** Enable posting on an account. */ enablePosting: (id: string, options?: RequestOptions) => Promise; /** Disable posting on an account. */ disablePosting: (id: string, options?: RequestOptions) => Promise; /** Deactivate (disconnect) an account. */ deactivate: (id: string, options?: RequestOptions) => Promise; }; /** Social post management — create, schedule, publish, cancel, and retry posts. */ posts: { /** Create a new social post draft. */ create: (attributes: SocialPostCreateAttributes, options?: RequestOptions) => Promise; /** Get a single post by ID. */ get: (id: string, options?: RequestOptions) => Promise; /** Update a draft post. */ update: (id: string, attributes: SocialPostUpdateAttributes, options?: RequestOptions) => Promise; /** Delete a post. */ delete: (id: string, options?: RequestOptions) => Promise; /** Schedule a post for future publishing. */ schedule: (id: string, scheduledAt: string, options?: RequestOptions) => Promise; /** Publish a post immediately. */ publishNow: (id: string, options?: RequestOptions) => Promise; /** Cancel a scheduled or draft post. */ cancel: (id: string, options?: RequestOptions) => Promise; /** Retry a failed post. */ retry: (id: string, options?: RequestOptions) => Promise; /** Update SEO metadata on a post. */ updateSeo: (id: string, attributes: { seo_score?: number; seo_analysis?: Record; }, options?: RequestOptions) => Promise; /** List scheduled posts. */ listScheduled: (options?: RequestOptions) => Promise; /** List posts by account. */ listByAccount: (socialAccountId: string, options?: RequestOptions) => Promise; /** List posts by campaign. */ listByCampaign: (socialCampaignId: string, options?: RequestOptions) => Promise; /** List all posts for a workspace. */ listByWorkspace: (workspaceId: string, options?: RequestOptions) => Promise; }; /** Post engagement metrics — impressions, reach, likes, comments, and more. */ metrics: { /** Get a single metric record by ID. */ get: (id: string, options?: RequestOptions) => Promise; /** List all metrics for a post. */ listByPost: (socialPostId: string, options?: RequestOptions) => Promise; /** Get the latest metric per collection window for a post. */ latestForPost: (socialPostId: string, options?: RequestOptions) => Promise; /** Aggregate metrics across all posts for a social account. */ byAccount: (socialAccountId: string, options?: RequestOptions) => Promise; /** Aggregate metrics across all posts in a social campaign. */ byCampaign: (socialCampaignId: string, options?: RequestOptions) => Promise; }; /** AI-powered social campaigns — generate master copy and adapt for platforms. */ campaigns: { /** * List all social campaigns across workspaces. * * @param options - Optional request-level overrides. * @returns A promise that resolves to an array of social campaign records. */ list: (options?: RequestOptions) => Promise; /** * Fetch a single social campaign by its unique ID. * * @param id - The unique identifier of the social campaign to retrieve. * @param options - Optional request-level overrides. * @returns A promise that resolves to the matching social campaign record. */ get: (id: string, options?: RequestOptions) => Promise; /** * Create a new social campaign. * * The campaign starts in `draft` status. Use `generateMasterCopy` to * produce AI-generated content from the content brief, then * `adaptForPlatforms` to create platform-specific posts. * * @param workspaceId - Workspace ID (passed as query parameter for tenant resolution). * @param attributes - Campaign attributes (name, content_brief, etc.). * @param options - Optional request-level overrides. * @returns A promise that resolves to the newly created social campaign record. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const campaign = await admin.social.campaigns.create('ws_abc123', { * name: 'Product Launch', * content_brief: 'Exciting new features for Q2', * target_platforms: ['instagram', 'linkedin'], * }); * ``` */ create: (workspaceId: string, attributes: SocialCampaignCreateAttributes, options?: RequestOptions) => Promise; /** * Update an existing social campaign's attributes (PATCH semantics). * * @param id - The unique identifier of the social campaign to update. * @param attributes - Key/value map of attributes to change. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated social campaign record. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const updated = await admin.social.campaigns.update('sc_abc123', { * content_brief: 'Updated brief with new messaging', * target_platforms: ['instagram', 'linkedin', 'twitter'], * }); * ``` */ update: (id: string, attributes: SocialCampaignUpdateAttributes, options?: RequestOptions) => Promise; /** * Permanently delete a social campaign. * * @param id - The unique identifier of the social campaign to delete. * @param options - Optional request-level overrides. * @returns A promise that resolves once the campaign has been deleted. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * await admin.social.campaigns.delete('sc_abc123'); * ``` */ delete: (id: string, options?: RequestOptions) => Promise; /** * Schedule a social campaign for future publishing. * * Transitions the campaign to `scheduled` status with the given timestamp. * * @param id - The unique identifier of the social campaign to schedule. * @param scheduledAt - The ISO 8601 datetime at which to publish the campaign. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated social campaign record. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const scheduled = await admin.social.campaigns.schedule( * 'sc_abc123', * '2026-04-01T09:00:00Z', * ); * ``` */ schedule: (id: string, scheduledAt: string, options?: RequestOptions) => Promise; /** * Cancel a social campaign. * * Only campaigns in `draft`, `generating`, `review`, or `scheduled` * status can be cancelled. * * @param id - The unique identifier of the social campaign to cancel. * @param options - Optional request-level overrides. * @returns A promise that resolves to the updated social campaign record. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const cancelled = await admin.social.campaigns.cancel('sc_abc123'); * console.log(cancelled.attributes.status); // 'cancelled' * ``` */ cancel: (id: string, options?: RequestOptions) => Promise; /** * Generate master copy from the campaign's content brief using AI. * * Transitions the campaign to `review` status on success. The generated * master copy is stored on the campaign and can then be adapted for * individual platforms via `adaptForPlatforms`. * * @param id - The unique identifier of the social campaign. * @param workspaceId - The workspace ID that owns the campaign. * @param options - Optional request-level overrides. * @returns A promise resolving to the generation result including master copy text. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const result = await admin.social.campaigns.generateMasterCopy( * 'sc_abc123', * 'ws_abc123', * ); * console.log(result.master_copy); * ``` */ generateMasterCopy: (id: string, workspaceId: string, options?: RequestOptions) => Promise; /** * Adapt the campaign's master copy for each target platform. * * Creates individual SocialPost draft records for each platform with * platform-appropriate tone, length, and formatting. * * @param id - The unique identifier of the social campaign. * @param workspaceId - The workspace ID that owns the campaign. * @param socialAccountId - The social account to attribute the created posts to. * @param options - Optional request-level overrides. * @returns A promise resolving to the adaptation result with post creation counts. * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const result = await admin.social.campaigns.adaptForPlatforms( * 'sc_abc123', * 'ws_abc123', * 'sa_xyz', * ); * console.log(result.posts_created, result.failures); * ``` */ adaptForPlatforms: (id: string, workspaceId: string, socialAccountId: string, options?: RequestOptions) => Promise; /** * Preview adapted copy per platform without creating SocialPost records. * * Returns the AI-adapted text for each target platform so the user can * review before committing via `adaptForPlatforms`. * * @param id - Campaign UUID. * @param workspaceId - Workspace UUID. * @param options - Optional request options. * @returns `{ adaptations: [{ platform: string, content: string }] }` * * @example * ```typescript * const admin = new GptAdmin({ apiKey: 'sk_srv_...' }); * * const result = await admin.social.campaigns.previewAdaptations( * 'sc_abc123', * 'ws_abc123', * ); * console.log(result.adaptations); // [{platform: 'instagram', content: '...'}, ...] * ``` */ previewAdaptations: (id: string, workspaceId: string, options?: RequestOptions) => Promise; }; /** Trending content discovery — snapshots, items, and watch alerts. */ trending: { /** * Get a trending snapshot by ID. * @param id - Snapshot UUID * @returns TrendingSnapshot with metadata (query, enrichment level, item count) * @example * ```typescript * const snapshot = await admin.social.trending.get('snap_abc'); * ``` */ get: (id: string, options?: RequestOptions) => Promise; /** * List trending snapshots for a workspace. * @param workspaceId - Workspace UUID * @returns Array of TrendingSnapshot records * @example * ```typescript * const snapshots = await admin.social.trending.listByWorkspace('ws_abc'); * ``` */ listByWorkspace: (workspaceId: string, options?: RequestOptions) => Promise; /** * Create a trending snapshot (trigger on-demand collection). * @param attributes - Snapshot attributes (workspace_id, enrichment_level, etc.) * @returns Created TrendingSnapshot * @example * ```typescript * const snapshot = await admin.social.trending.create({ * workspace_id: 'ws_abc', * enrichment_level: 'scored', * fetched_at: new Date().toISOString(), * }); * ``` */ create: (attributes: { workspace_id: string; enrichment_level?: "raw" | "scored" | "summarized" | "full"; query?: string; source_breakdown?: Record; item_count?: number; fetched_at?: string; }, options?: RequestOptions) => Promise; /** Delete a trending snapshot by ID. */ delete: (id: string, options?: RequestOptions) => Promise; /** * List trending snapshots within a date range. * @param from - Start date (ISO 8601 string) * @param to - End date (ISO 8601 string) * @returns Array of TrendingSnapshot records in the range * @example * ```typescript * const snapshots = await admin.social.trending.listByDateRange( * '2026-03-01T00:00:00Z', * '2026-03-21T23:59:59Z', * ); * ``` */ listByDateRange: (from: string, to: string, options?: RequestOptions) => Promise; /** Trending snapshot items — individual content pieces within a snapshot. */ items: { /** Get a single trending item by ID. */ get: (id: string, options?: RequestOptions) => Promise; /** * List trending items for a snapshot. * @param snapshotId - Parent snapshot UUID * @returns Array of TrendingSnapshotItem records * @example * ```typescript * const items = await admin.social.trending.items.listBySnapshot('snap_abc'); * ``` */ listBySnapshot: (snapshotId: string, options?: RequestOptions) => Promise; }; }; /** Trending watch alerts — monitor topics and get notified on matches. */ watches: { /** * Get a trending watch by ID. * @param id - Watch UUID * @returns TrendingWatch with conditions and notification config */ get: (id: string, options?: RequestOptions) => Promise; /** * List trending watches for a workspace. * @param workspaceId - Workspace UUID * @returns Array of TrendingWatch records * @example * ```typescript * const watches = await admin.social.watches.listByWorkspace('ws_abc'); * ``` */ listByWorkspace: (workspaceId: string, options?: RequestOptions) => Promise; /** * Create a new trending watch alert. * @param attributes - Watch attributes (name, query, conditions, notification_config) * @returns Created TrendingWatch * @example * ```typescript * const watch = await admin.social.watches.create({ * workspace_id: 'ws_abc', * name: 'AI Industry News', * query: 'artificial intelligence', * conditions: { min_score: 0.7 }, * notification_config: { channel: 'webhook', url: 'https://...' }, * }); * ``` */ create: (attributes: { workspace_id: string; name: string; query: string; sources?: string[]; conditions?: Record; notification_config?: Record; enabled?: boolean; }, options?: RequestOptions) => Promise; /** * Update a trending watch. * @param id - Watch UUID * @param attributes - Fields to update (name, query, conditions, enabled, etc.) */ update: (id: string, attributes: { name?: string; query?: string; sources?: string[]; conditions?: Record; notification_config?: Record; enabled?: boolean; }, options?: RequestOptions) => Promise; /** Delete a trending watch by ID. */ delete: (id: string, options?: RequestOptions) => Promise; /** * Mark a watch as triggered (updates last_triggered_at). * @param id - Watch UUID */ markTriggered: (id: string, options?: RequestOptions) => Promise; }; }; //# sourceMappingURL=social.d.ts.map