import SchedulerRoute from "../routes/SchedulerRoute"; import Requests from "../util/Requests"; import Response from "../util/Response"; import { AxiosPromise } from "axios"; export type DiscordMediaType = 'all' | 'image' | 'video' | 'gif'; export type DiscordMediaAuthorType = 'all' | 'user' | 'bot' | 'webhook'; export interface DiscordMediaSearchParams { cursor?: string; channel_id?: string; search?: string; search_scope?: 'content' | 'filename'; media_type?: DiscordMediaType; author_type?: DiscordMediaAuthorType; date_from?: string; date_to?: string; sort_order?: 'asc' | 'desc'; include_imported?: boolean; include_unsupported?: boolean; include_nsfw?: boolean; } export interface DiscordMediaAttachment { id: string; filename: string; title?: string | null; description?: string | null; mime_type: string; media_type: 'image' | 'video'; size: number; url?: string | null; proxy_url?: string | null; width?: number | null; height?: number | null; duration_secs?: number | null; supported: boolean; unsupported_reason?: string | null; already_imported: boolean; imported_title_update_id?: string | null; imported_media_id?: string | null; duplicate_import: boolean; } export interface DiscordMediaMessage { id: string; channel_id: string; content: string; timestamp?: string | null; edited_timestamp?: string | null; jump_url: string; author: { id?: string | null; username: string; avatar?: string | null; bot: boolean; }; webhook_id?: string | null; attachments: DiscordMediaAttachment[]; } export interface DiscordMediaSearchResponse { items: DiscordMediaMessage[]; total_results: number; next_cursor?: string | null; indexing: boolean; retry_after?: number | null; } export interface DiscordMediaImportGroup { channel_id: string; message_id: string; attachment_ids: string[]; } export type DiscordTitleUpdateMode = 'grouped' | 'separate'; export interface DiscordMediaImportRequest { groups: DiscordMediaImportGroup[]; /** Group files by Discord message or create one pending Library item per file. */ title_update_mode?: DiscordTitleUpdateMode; } export interface DiscordMediaImportAttachmentResult { status: 'imported' | 'duplicate' | 'failed'; channel_id: string; message_id: string; attachment_id: string; media_id?: string; title_update_id?: string; reason?: string; } export interface DiscordMediaImportResponse { imported_count: number; duplicate_count: number; failed_count: number; updates: Array<{ id: string; title?: string | null; scheduled_status: 'pending'; schedule_for_social: false; media_count: number; }>; attachments: DiscordMediaImportAttachmentResult[]; } export interface DiscordUserCommandStatus { linked: boolean; linked_to_this_scheduler: boolean; discord_username?: string | null; destination_scheduler_id?: string | null; destination_scheduler_name?: string | null; installed_at?: string | null; destination_count?: number; linked_account_count?: number; pending_count: number; command_name: string; setup_path: string; configured: boolean; command_ready: boolean; credentials_configured: boolean; user_install_enabled: boolean; interactions_endpoint_configured: boolean; command_registered: boolean; command_id?: string | null; configuration_error?: string | null; checked_at?: string | null; } export type DiscordMediaCaptureStatus = 'processing' | 'ready' | 'complete' | 'failed' | 'expired'; export type DiscordMediaCaptureAttachmentStatus = 'processing' | 'ready' | 'duplicate' | 'unsupported' | 'failed' | 'imported'; export interface DiscordMediaCaptureAttachment { id: string; discord_attachment_id: string; filename: string; mime_type?: string | null; media_type: 'image' | 'video'; size: number; width?: number | null; height?: number | null; duration_secs?: number | null; description?: string | null; status: DiscordMediaCaptureAttachmentStatus; failure_reason?: string | null; preview_url?: string | null; media_id?: string | null; title_update_id?: string | null; } export interface DiscordMediaCapture { id: string; status: DiscordMediaCaptureStatus; content?: string | null; author?: { id?: string | null; username: string; avatar?: string | null; bot: boolean; } | null; timestamp?: string | null; jump_url?: string | null; expires_at: string; failure_reason?: string | null; attachments: DiscordMediaCaptureAttachment[]; } export interface DiscordMediaCaptureListParams { cursor?: string; search?: string; limit?: number; } export interface DiscordMediaCaptureListResponse { items: DiscordMediaCapture[]; next_cursor?: string | null; } export interface DiscordMediaCaptureImportRequest { capture_id: string; attachment_ids: string[]; /** Group selected files together or create one pending Library item per file. */ title_update_mode?: DiscordTitleUpdateMode; } class Scheduler { /** * List promotion schedules. * * @see https://api.glitch.fun/api/documentation#/Scheduler/getTitlePromotionSchedules * * @returns promise */ public static listSchedules(params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.listSchedules, {}, {}, params); } /** * Create a new promotion schedule. * * @see https://api.glitch.fun/api/documentation#/Scheduler/createTitlePromotionSchedule * * @param data The data for the new schedule. * * @returns promise */ public static createSchedule(data: object, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.createSchedule, data, {}, params); } /** * Get a specific promotion schedule. * * @see https://api.glitch.fun/api/documentation#/Scheduler/getTitlePromotionSchedule * * @param scheduler_id The ID of the promotion schedule. * * @returns promise */ public static getSchedule(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.getSchedule, {}, { scheduler_id }, params); } /** * Update a promotion schedule. * * @see https://api.glitch.fun/api/documentation#/Scheduler/updateTitlePromotionSchedule * * @param scheduler_id The ID of the promotion schedule. * @param data The data to update. * * @returns promise */ public static updateSchedule(scheduler_id: string, data: object, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.updateSchedule, data, { scheduler_id }, params); } /** * Delete a promotion schedule. * * @see https://api.glitch.fun/api/documentation#/Scheduler/deleteTitlePromotionSchedule * * @param scheduler_id The ID of the promotion schedule. * * @returns promise */ public static deleteSchedule(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.deleteSchedule, {}, { scheduler_id }, params); } /** * Test the tone of the scheduler. * * @see https://api.glitch.fun/api/documentation#/Scheduler/updateTitlePromotionSchedule * * @param scheduler_id The ID of the promotion schedule. * @param data The data to update. * * @returns promise */ public static testTone(scheduler_id: string, data: object, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.testTone, data, { scheduler_id }, params); } /** * Get social media posts related to a promotion schedule. * * @see https://api.glitch.fun/api/documentation#/Scheduler/getPromotionScheduleSocialPosts * * @param scheduler_id The ID of the promotion schedule. * * @returns promise */ public static getSchedulePosts(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.getSchedulePosts, {}, { scheduler_id }, params); } /** * Rewrite / generate content for a promotion schedule. * * @see https://api.glitch.fun/api/documentation#/Scheduler/generateTitleContent * * @param scheduler_id UUID of the promotion schedule. * @param data Body payload. At minimum you must supply * `{ platform: 'twitter' }` plus either `content` * **or** a `media` array containing at least one * `{ id: '' }`. * @returns Axios promise with `{ content, title? }` */ public static generateTitleContent( scheduler_id: string, data: object, params?: Record ): AxiosPromise> { return Requests.processRoute( SchedulerRoute.routes.generateContent, data, // request body { scheduler_id }, // path params params // query params ); } /** * List title updates for a promotion schedule. * * @see https://api.glitch.fun/api/documentation#/Scheduler/getTitleUpdates * * @param scheduler_id The ID of the promotion schedule. * * @returns promise */ public static listUpdates(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.listUpdates, {}, { scheduler_id }, params); } /** * Search the updates related to a promotion schedule. * * @see https://api.glitch.fun/api/documentation#/Scheduler/searchTitleUpdates * * @param scheduler_id The ID of the promotion schedule. * * @returns promise */ public static searchUpdates(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.listUpdates, {}, { scheduler_id }, params); } /** * Create a new title update for a promotion schedule. * * @see https://api.glitch.fun/api/documentation#/Scheduler/createTitleUpdate * * @param scheduler_id The ID of the promotion schedule. * @param data The data for the new update. * * @returns promise */ public static createUpdate(scheduler_id: string, data: object, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.createUpdate, data, { scheduler_id }, params); } /** * Get a specific title update. * * @see https://api.glitch.fun/api/documentation#/Scheduler/getTitleUpdate * * @param scheduler_id The ID of the promotion schedule. * @param update_id The ID of the title update. * * @returns promise */ public static getUpdate(scheduler_id: string, update_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.getUpdate, {}, { scheduler_id, update_id }, params); } /** * Update a title update. * * @see https://api.glitch.fun/api/documentation#/Scheduler/updateTitleUpdate * * @param scheduler_id The ID of the promotion schedule. * @param update_id The ID of the title update. * @param data The data to update. * * @returns promise */ public static updateUpdate(scheduler_id: string, update_id: string, data: object, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.updateUpdate, data, { scheduler_id, update_id }, params); } /** * Delete a title update. * * @see https://api.glitch.fun/api/documentation#/Scheduler/deleteTitleUpdate * * @param scheduler_id The ID of the promotion schedule. * @param update_id The ID of the title update. * * @returns promise */ public static deleteUpdate(scheduler_id: string, update_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.deleteUpdate, {}, { scheduler_id, update_id }, params); } /** * Schedule title update. * * @see https://api.glitch.fun/api/documentation#/Scheduler/updateTitleUpdate * * @param scheduler_id The ID of the promotion schedule. * @param update_id The ID of the title update. * @param data The data to update. * * @returns promise */ public static scheduleUpdate(scheduler_id: string, update_id: string, data: object, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.scheduleUpdate, data, { scheduler_id, update_id }, params); } /** * Clear Twitter OAuth credentials from a promotion schedule. * * @param scheduler_id The ID of the promotion schedule. * @returns promise */ public static clearTwitterAuth(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.clearTwitterAuth, {}, { scheduler_id }, params); } /** * Clear Facebook OAuth credentials from a promotion schedule. * * @param scheduler_id The ID of the promotion schedule. * @returns promise */ public static clearFacebookAuth(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.clearFacebookAuth, {}, { scheduler_id }, params); } /** * Clear Instagram OAuth credentials from a promotion schedule. * * @param scheduler_id The ID of the promotion schedule. * @returns promise */ public static clearInstagramAuth(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.clearInstagramAuth, {}, { scheduler_id }, params); } /** * Clear Snapchat OAuth credentials from a promotion schedule. * * @param scheduler_id The ID of the promotion schedule. * @returns promise */ public static clearSnapchatAuth(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.clearSnapchatAuth, {}, { scheduler_id }, params); } /** * Clear TikTok OAuth credentials from a promotion schedule. * * @param scheduler_id The ID of the promotion schedule. * @returns promise */ public static clearTikTokAuth(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.clearTikTokAuth, {}, { scheduler_id }, params); } /** * Clear Twitch OAuth credentials from a promotion schedule. * * @param scheduler_id The ID of the promotion schedule. * @returns promise */ public static clearTwitchAuth(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.clearTwitchAuth, {}, { scheduler_id }, params); } /** * Clear Kick OAuth credentials from a promotion schedule. * * @param scheduler_id The ID of the promotion schedule. * @returns promise */ public static clearKickAuth(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.clearKickAuth, {}, { scheduler_id }, params); } /** * Clear Reddit OAuth credentials from a promotion schedule. * * @param scheduler_id The ID of the promotion schedule. * @returns promise */ public static clearRedditAuth(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.clearRedditAuth, {}, { scheduler_id }, params); } /** * Clear Reddit Ads OAuth credentials from a promotion schedule. * * @param scheduler_id The ID of the promotion schedule. * @returns promise */ public static clearRedditAdsAuth(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.clearRedditAdsAuth, {}, { scheduler_id }, params); } /** * Clear YouTube OAuth credentials from a promotion schedule. * * @param scheduler_id The ID of the promotion schedule. * @returns promise */ public static clearYouTubeAuth(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.clearYouTubeAuth, {}, { scheduler_id }, params); } /** * Clear Patreon OAuth credentials from a promotion schedule. * * @param scheduler_id The ID of the promotion schedule. * @returns promise */ public static clearPatreonAuth(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.clearPatreonAuth, {}, { scheduler_id }, params); } /** * Clear Pinterest OAuth credentials from a promotion schedule. * * @param scheduler_id The ID of the promotion schedule. * @returns promise */ public static clearPinterestAuth(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.clearPinterestAuth, {}, { scheduler_id }, params); } /** * Clear Steam OAuth credentials from a promotion schedule. * * @param scheduler_id The ID of the promotion schedule. * @returns promise */ public static clearSteamAuth(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.clearSteamAuth, {}, { scheduler_id }, params); } /** * Clear Discord OAuth credentials from a promotion schedule. * * @param scheduler_id The ID of the promotion schedule. * @returns promise */ public static clearDiscordAuth(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.clearDiscordAuth, {}, { scheduler_id }, params); } /** * Clear Bluesky OAuth credentials from a promotion schedule. * * @param scheduler_id The ID of the promotion schedule. * @returns promise */ public static clearBlueskyAuth(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.clearBlueskyAuth, {}, { scheduler_id }, params); } /** * Get Facebook groups associated with the scheduler's Facebook account. * * @param scheduler_id The ID of the promotion schedule. * @returns promise */ public static getFacebookGroups(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.getFacebookGroups, {}, { scheduler_id }, params); } /** * Get Instagram accounts associated with the scheduler's Instagram account. * * @param scheduler_id The ID of the promotion schedule. * @returns promise */ public static getInstagramAccounts(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.getInstagramAccounts, {}, { scheduler_id }, params); } /** * Get Reddit subreddits associated with the scheduler's Reddit account. * * @param scheduler_id The ID of the promotion schedule. * @returns promise */ public static getRedditSubreddits(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.getRedditSubreddits, {}, { scheduler_id }, params); } /** * Get flairs for a specific Reddit subreddit. * * @param scheduler_id The ID of the promotion schedule. * @param subreddit The name of the subreddit. * @returns promise */ public static getRedditSubredditFlairs(scheduler_id: string, subreddit: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.getRedditSubredditFlairs, {}, { scheduler_id, subreddit }, params); } /** * Get posting rules for a specific Reddit subreddit. * * @param scheduler_id The ID of the promotion schedule. * @param subreddit The name of the subreddit. * @returns promise */ public static getRedditSubredditRules(scheduler_id: string, subreddit: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.getRedditSubredditRules, {}, { scheduler_id, subreddit }, params); } /** * Get Discord channels associated with the scheduler's Discord account. * * @param scheduler_id The ID of the promotion schedule. * @returns promise */ public static getDiscordChannels(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.getDiscordChannels, {}, { scheduler_id }, params); } /** * Search image and video attachments in the connected Discord server. * This call only returns remote candidates; it does not copy files into the * Library and does not create or schedule social posts. */ public static searchDiscordMedia( scheduler_id: string, params?: DiscordMediaSearchParams ): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.searchDiscordMedia, {}, { scheduler_id }, params); } /** * Import explicitly selected Discord attachments as pending, unscheduled * Library updates. Callers can group files by message or create one item * per file through title_update_mode. */ public static importDiscordMedia( scheduler_id: string, data: DiscordMediaImportRequest, params?: Record ): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.importDiscordMedia, data, { scheduler_id }, params); } /** Get the current user's personal Save to Glitch command setup state. */ public static getDiscordUserCommandStatus( scheduler_id: string, params?: Record ): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.getDiscordUserCommandStatus, {}, { scheduler_id }, params); } /** Disconnect the current user's personal command from this Library. */ public static disconnectDiscordUserCommand( scheduler_id: string, params?: Record ): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.disconnectDiscordUserCommand, {}, { scheduler_id }, params); } /** List messages saved through the user-installed Discord command. */ public static listDiscordMediaCaptures( scheduler_id: string, params?: DiscordMediaCaptureListParams ): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.listDiscordMediaCaptures, {}, { scheduler_id }, params); } /** Import selected staged attachments into pending Library content. */ public static importDiscordMediaCapture( scheduler_id: string, data: DiscordMediaCaptureImportRequest, params?: Record ): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.importDiscordMediaCapture, data, { scheduler_id }, params); } /** Dismiss one saved Discord message and delete its temporary staged files. */ public static dismissDiscordMediaCapture( scheduler_id: string, capture_id: string, params?: Record ): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.dismissDiscordMediaCapture, {}, { scheduler_id, capture_id }, params); } /** * Clear Google Ads OAuth credentials from a promotion schedule. * * @param scheduler_id The ID of the promotion schedule. * @returns promise */ public static clearGoogleAdsAuth( scheduler_id: string, params?: Record ): AxiosPromise> { return Requests.processRoute( SchedulerRoute.routes.clearGoogleAdsAuth, {}, // no body { scheduler_id }, // path params params // optional query params ); } /** * Clear Tiktok Ads OAuth credentials from a promotion schedule. * * @param scheduler_id The ID of the promotion schedule. * @returns promise */ public static clearTiktokAdsAuth( scheduler_id: string, params?: Record ): AxiosPromise> { return Requests.processRoute( SchedulerRoute.routes.clearTiktokAdsAuth, {}, // no body { scheduler_id }, // path params params // optional query params ); } /** * Get aggregated reports for a promotion schedule. * * @param scheduler_id The ID of the promotion schedule. * @param params Query parameters (e.g., social_platform, start_date, end_date) * @returns promise */ public static getSchedulerReports(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.getSchedulerReports, {}, { scheduler_id }, params); } /** * Get progression data for social media posts over time. * * @param scheduler_id The ID of the promotion schedule. * @param params Query parameters (e.g., social_platform, start_date, end_date) * @returns promise */ public static getSchedulerProgression(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.getSchedulerProgression, {}, { scheduler_id }, params); } /** * List cross-promote relationships for a scheduler (with optional pagination). * GET /schedulers/{scheduler_id}/crosspromote/relationships */ public static crossPromoteListRelationships(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute( SchedulerRoute.routes.crossPromoteListRelationships, {}, { scheduler_id }, params ); } /** * Find potential cross-promote partners for a scheduler (with optional filters). * GET /schedulers/{scheduler_id}/crosspromote/find */ public static crossPromoteFind(scheduler_id: string, params?: Record): AxiosPromise> { // e.g. { platform:'twitter', min_followers:500, sort:'desc', page:2, limit:5 } return Requests.processRoute( SchedulerRoute.routes.crossPromoteFind, {}, { scheduler_id }, params ); } /** * List cross-promote invites for a scheduler (incoming + outgoing). * GET /schedulers/{scheduler_id}/crosspromote/invites */ public static crossPromoteInvitesList(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute( SchedulerRoute.routes.crossPromoteInvitesList, {}, { scheduler_id }, params ); } /** * Send an invite to cross-promote (from scheduler_id to partner_scheduler_id). * POST /schedulers/{scheduler_id}/crosspromote/invites * * @param data { partner_scheduler_id, optional_message } */ public static crossPromoteInviteSend(scheduler_id: string, data: object, params?: Record): AxiosPromise> { return Requests.processRoute( SchedulerRoute.routes.crossPromoteInviteSend, data, { scheduler_id }, params ); } /** * Accept an invite to cross-promote. * POST /schedulers/{scheduler_id}/crosspromote/invites/{invite_id}/accept */ public static crossPromoteInviteAccept(scheduler_id: string, invite_id: string, params?: Record): AxiosPromise> { return Requests.processRoute( SchedulerRoute.routes.crossPromoteInviteAccept, {}, { scheduler_id, invite_id }, params ); } /** * Reject an invite to cross-promote. * POST /schedulers/{scheduler_id}/crosspromote/invites/{invite_id}/reject */ public static crossPromoteInviteReject(scheduler_id: string, invite_id: string, params?: Record): AxiosPromise> { return Requests.processRoute( SchedulerRoute.routes.crossPromoteInviteReject, {}, { scheduler_id, invite_id }, params ); } /** * End a cross-promote relationship (delete). * DELETE /schedulers/{scheduler_id}/crosspromote/relationships/{relationship_id} */ public static crossPromoteRelationshipDelete(scheduler_id: string, relationship_id: string, params?: Record): AxiosPromise> { return Requests.processRoute( SchedulerRoute.routes.crossPromoteRelationshipDelete, {}, { scheduler_id, relationship_id }, params ); } /** * Get which platforms are cross-promoted in an existing relationship. * GET /schedulers/{scheduler_id}/crosspromote/relationships/{relationship_id}/platforms */ public static crossPromoteRelationshipGetPlatforms(scheduler_id: string, relationship_id: string, params?: Record): AxiosPromise> { return Requests.processRoute( SchedulerRoute.routes.crossPromoteRelationshipGetPlatforms, {}, { scheduler_id, relationship_id }, params ); } /** * Set which platforms are cross-promoted in an existing relationship. * PUT /schedulers/{scheduler_id}/crosspromote/relationships/{relationship_id}/platforms * data = { platforms: ['twitter','facebook',...]} */ public static crossPromoteRelationshipSetPlatforms(scheduler_id: string, relationship_id: string, data: object, params?: Record): AxiosPromise> { return Requests.processRoute( SchedulerRoute.routes.crossPromoteRelationshipSetPlatforms, data, { scheduler_id, relationship_id }, params ); } /** * Get recently cross-promoted logs under a relationship. * GET /schedulers/{scheduler_id}/crosspromote/relationships/{relationship_id}/posts */ public static crossPromoteRelationshipPosts(scheduler_id: string, relationship_id: string, params?: Record): AxiosPromise> { return Requests.processRoute( SchedulerRoute.routes.crossPromoteRelationshipPosts, {}, { scheduler_id, relationship_id }, params ); } /** * Search cross-promote opportunities using the normalized route family. * GET /schedulers/cross-promote/search */ public static crossPromoteSearch(params?: Record): AxiosPromise> { return Requests.processRoute( SchedulerRoute.routes.crossPromoteSearch, {}, {}, params ); } /** * Send a normalized cross-promote invitation. * POST /schedulers/cross-promote/invitations */ public static crossPromoteInvitationSend(data: object, params?: Record): AxiosPromise> { return Requests.processRoute( SchedulerRoute.routes.crossPromoteInvitationSend, data, {}, params ); } /** * Respond to a normalized cross-promote invitation. * POST /schedulers/cross-promote/invitations/{invitation_id}/respond */ public static crossPromoteInvitationRespond(invitation_id: string, data: object, params?: Record): AxiosPromise> { return Requests.processRoute( SchedulerRoute.routes.crossPromoteInvitationRespond, data, { invitation_id }, params ); } /** * List normalized cross-promote relationships. * GET /schedulers/cross-promote/relationships */ public static crossPromoteRelationshipsList(params?: Record): AxiosPromise> { return Requests.processRoute( SchedulerRoute.routes.crossPromoteRelationshipsList, {}, {}, params ); } /** * End a normalized cross-promote relationship. * POST /schedulers/cross-promote/relationships/{relationship_id}/end */ public static crossPromoteRelationshipEnd(relationship_id: string, params?: Record): AxiosPromise> { return Requests.processRoute( SchedulerRoute.routes.crossPromoteRelationshipEnd, {}, { relationship_id }, params ); } /** * List normalized cross-promote relationship logs. * GET /schedulers/cross-promote/relationships/{relationship_id}/logs */ public static crossPromoteRelationshipLogs(relationship_id: string, params?: Record): AxiosPromise> { return Requests.processRoute( SchedulerRoute.routes.crossPromoteRelationshipLogs, {}, { relationship_id }, params ); } /** * List platform-level businesses for the given campaign ID, * as defined by /schedulers/{scheduler_id}/businesses on the backend. * * Typically relevant for Reddit (list businesses), or might return a * "not supported" message for Meta/TikTok. * * @param scheduler_id The UUID of the Ad Campaign * @param params Optional query parameters, e.g. page.size, etc. * @returns A response object with data (business list or messages) */ public static listCampaignBusinesses( scheduler_id: string, params?: Record ): AxiosPromise> { return Requests.processRoute( SchedulerRoute.routes.getCampaignBusinesses, undefined, // no request body { scheduler_id }, // path params params // query params ); } /** * List Ad Accounts for the given campaign ID, * as defined by /schedulers/{scheduler_id}/ad_accounts on the backend. * * E.g. for Reddit, you can pass ?business_id= to get business-level ad accounts, * or for Twitter, it might just return a user’s ad accounts, etc. * * @param scheduler_id The UUID of the Ad Campaign * @param params Optional query parameters, e.g. business_id, page.size, etc. * @returns A response object with data (ad account list) */ public static listCampaignAdAccounts( scheduler_id: string, params?: Record ): AxiosPromise> { return Requests.processRoute( SchedulerRoute.routes.getCampaignAdAccounts, undefined, { scheduler_id }, params ); } /** * List funding instruments for the given campaign ID, * as defined by /schedulers/{scheduler_id}/funding_instruments on the backend. * * For Twitter, pass ?account_id=... * For Reddit, pass ?ad_account_id=... or ?business_id=... * * @param scheduler_id The UUID of the Ad Campaign * @param params Optional query parameters * @returns A response object with data (funding instruments) */ public static listCampaignFundingInstruments( scheduler_id: string, params?: Record ): AxiosPromise> { return Requests.processRoute( SchedulerRoute.routes.getCampaignFundingInstruments, undefined, { scheduler_id }, params ); } /** * List Google Ads conversion actions available to a scheduler account. * GET /schedulers/{scheduler_id}/conversion-actions */ public static listConversionActions( scheduler_id: string, params?: Record ): AxiosPromise> { return Requests.processRoute( SchedulerRoute.routes.getConversionActions, undefined, { scheduler_id }, params ); } /** * List all destinations for a title update. * * @see https://api.glitch.fun/api/documentation#/Scheduler/listTitleUpdateDestinations * * @param scheduler_id The ID of the promotion schedule. * @param update_id The ID of the title update. * @returns promise */ public static listDestinations(scheduler_id: string, update_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.listDestinations, {}, { scheduler_id, update_id }, params); } /** * Create a new destination for a title update. * * @see https://api.glitch.fun/api/documentation#/Scheduler/createTitleUpdateDestination * * @param scheduler_id The ID of the promotion schedule. * @param update_id The ID of the title update. * @param data The data for the new destination. * @returns promise */ public static createDestination(scheduler_id: string, update_id: string, data: object, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.createDestination, data, { scheduler_id, update_id }, params); } /** * Get a specific title update destination. * * @see https://api.glitch.fun/api/documentation#/Scheduler/getTitleUpdateDestination * * @param scheduler_id The ID of the promotion schedule. * @param update_id The ID of the title update. * @param destination_id The ID of the destination. * @returns promise */ public static getDestination(scheduler_id: string, update_id: string, destination_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.getDestination, {}, { scheduler_id, update_id, destination_id }, params); } /** * Update a title update destination. * * @see https://api.glitch.fun/api/documentation#/Scheduler/updateTitleUpdateDestination * * @param scheduler_id The ID of the promotion schedule. * @param update_id The ID of the title update. * @param destination_id The ID of the destination. * @param data The data to update. * @returns promise */ public static updateDestination(scheduler_id: string, update_id: string, destination_id: string, data: object, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.updateDestination, data, { scheduler_id, update_id, destination_id }, params); } /** * Delete a title update destination. * * @see https://api.glitch.fun/api/documentation#/Scheduler/deleteTitleUpdateDestination * * @param scheduler_id The ID of the promotion schedule. * @param update_id The ID of the title update. * @param destination_id The ID of the destination. * @returns promise */ public static deleteDestination(scheduler_id: string, update_id: string, destination_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.deleteDestination, {}, { scheduler_id, update_id, destination_id }, params); } /** * Get subreddit recommendations for a scheduler. * * @see https://api.glitch.fun/api/documentation#/Scheduler/getSchedulerRedditRecommendations * * @param scheduler_id The ID of the promotion schedule. * @param data The context for the post (title, content, media type). * @returns promise */ public static getRedditRecommendations(scheduler_id: string, data: object, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.getRedditRecommendations, data, { scheduler_id }, params); } /** * Generate tailored content for a specific subreddit. * * @see https://api.glitch.fun/api/documentation#/Scheduler/generateRedditContentForSubreddit * * @param scheduler_id The ID of the promotion schedule. * @param data The target subreddit and post context. * @returns promise */ public static generateRedditContent(scheduler_id: string, data: object, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.generateRedditContent, data, { scheduler_id }, params); } /** * Match the scheduler title to indexed Reddit communities. * * @param scheduler_id The ID of the promotion schedule. * @param data Optional post context and filters. * @returns promise */ public static getRedditSubredditMatches(scheduler_id: string, data: object = {}, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.getRedditSubredditMatches, data, { scheduler_id }, params); } /** * Position a registered game for a subreddit and optionally prepare Reddit draft content. * * @param scheduler_id The ID of the promotion schedule. * @param data The target subreddit and optional post context. * @returns promise */ public static getRedditSubredditPositioning(scheduler_id: string, data: object, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.getRedditSubredditPositioning, data, { scheduler_id }, params); } /** * Get all posts and comments for a scheduler. * * @param scheduler_id The ID of the promotion schedule. * @param params Optional query parameters for filtering and sorting. * @returns promise */ public static getSchedulerPostsWithComments(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.getSchedulerPostsWithComments, {}, { scheduler_id }, params); } /** * Sync all comments for all posts in a scheduler. * * @param scheduler_id The ID of the promotion schedule. * @param params Optional query parameters (e.g., limit_per_post). * @returns promise */ public static syncAllSchedulerComments(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.syncAllSchedulerComments, {}, { scheduler_id }, params); } /** * Get ad conversion actions for a specific platform linked to the scheduler. * * @see https://api.glitch.fun/api/documentation#/Scheduler/getSchedulerConversionActions * * @param scheduler_id The ID of the promotion schedule. * @param params Query parameters, including 'platform' (required) and 'account_id' (optional). * * @returns promise */ public static getConversionActions(scheduler_id: string, params: { platform: string; account_id?: string }): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.getConversionActions, {}, { scheduler_id }, params); } /** * Send a platform test conversion event through the backend scheduler route. * * @param scheduler_id The ID of the promotion schedule. * @param platform Platform key, e.g. reddit, tiktok, facebook, google. * @param params Query parameters such as Reddit test_id or Meta test_event_code. */ public static sendTestConversionEvent(scheduler_id: string, platform: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.sendTestConversionEvent, {}, { scheduler_id, platform }, params); } /** * Trigger a historical sync for a specific platform on a scheduler. * * @see https://api.glitch.fun/api/documentation#/Scheduler/syncHistory * * @param scheduler_id The ID of the promotion schedule. * @param platform The platform to sync (e.g., 'twitter', 'youtube', 'bluesky'). * * @returns promise */ public static syncHistory(scheduler_id: string, platform: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.syncHistory, {}, { scheduler_id, platform }, params); } /** * Generate hashtags for content based on scheduler settings. * * @param scheduler_id The ID of the promotion schedule. * @param data { content: string, platform?: string } * * @returns promise */ public static generateHashtags(scheduler_id: string, data: object, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.generateHashtags, data, { scheduler_id }, params); } /** * Get TikTok hashtag suggestions based on a keyword. * * @param scheduler_id The ID of the promotion schedule. * @param params { keyword: string } */ public static getTikTokHashtags(scheduler_id: string, params: { keyword: string }): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.getTikTokHashtags, {}, { scheduler_id }, params); } /** * Get trending commercial music from TikTok's library. * * @param scheduler_id The ID of the promotion schedule. */ public static getTikTokMusic(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.getTikTokMusic, {}, { scheduler_id }, params); } /** * Get TikTok Music List with advanced filtering (Keyword, Recommendations, Liked). * @param params { music_scene: 'CREATIVE_ASSET'|'CAROUSEL_ADS', search_type: string, filtering: object } */ public static getTikTokMusicList(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.getTikTokMusicList, {}, { scheduler_id }, params); } /** * Get the top 200 trending hashtags on TikTok. * @param params { country_code: string, category_name: string, date_range: string } */ public static getTikTokTrendingHashtags(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.getTikTokTrendingHashtags, {}, { scheduler_id }, params); } /** * Get trending search keywords on TikTok. * @param params { is_personalized: boolean } */ public static getTikTokTrendingKeywords(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.getTikTokTrendingKeywords, {}, { scheduler_id }, params); } /** * Get recommended search keywords on TikTok. * @param params { is_personalized: boolean } */ public static getTikTokRecommendedKeywords(scheduler_id: string, params?: Record): AxiosPromise> { return Requests.processRoute(SchedulerRoute.routes.getTikTokRecommendedKeywords, {}, { scheduler_id }, params); } } export default Scheduler;