glitch-javascript-sdk 3.8.0 → 3.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,154 @@
1
1
  import Response from "../util/Response";
2
2
  import { AxiosPromise } from "axios";
3
+ export type DiscordMediaType = 'all' | 'image' | 'video' | 'gif';
4
+ export type DiscordMediaAuthorType = 'all' | 'user' | 'bot' | 'webhook';
5
+ export interface DiscordMediaSearchParams {
6
+ cursor?: string;
7
+ channel_id?: string;
8
+ search?: string;
9
+ search_scope?: 'content' | 'filename';
10
+ media_type?: DiscordMediaType;
11
+ author_type?: DiscordMediaAuthorType;
12
+ date_from?: string;
13
+ date_to?: string;
14
+ sort_order?: 'asc' | 'desc';
15
+ include_imported?: boolean;
16
+ include_unsupported?: boolean;
17
+ include_nsfw?: boolean;
18
+ }
19
+ export interface DiscordMediaAttachment {
20
+ id: string;
21
+ filename: string;
22
+ title?: string | null;
23
+ description?: string | null;
24
+ mime_type: string;
25
+ media_type: 'image' | 'video';
26
+ size: number;
27
+ url?: string | null;
28
+ proxy_url?: string | null;
29
+ width?: number | null;
30
+ height?: number | null;
31
+ duration_secs?: number | null;
32
+ supported: boolean;
33
+ unsupported_reason?: string | null;
34
+ already_imported: boolean;
35
+ imported_title_update_id?: string | null;
36
+ imported_media_id?: string | null;
37
+ duplicate_import: boolean;
38
+ }
39
+ export interface DiscordMediaMessage {
40
+ id: string;
41
+ channel_id: string;
42
+ content: string;
43
+ timestamp?: string | null;
44
+ edited_timestamp?: string | null;
45
+ jump_url: string;
46
+ author: {
47
+ id?: string | null;
48
+ username: string;
49
+ avatar?: string | null;
50
+ bot: boolean;
51
+ };
52
+ webhook_id?: string | null;
53
+ attachments: DiscordMediaAttachment[];
54
+ }
55
+ export interface DiscordMediaSearchResponse {
56
+ items: DiscordMediaMessage[];
57
+ total_results: number;
58
+ next_cursor?: string | null;
59
+ indexing: boolean;
60
+ retry_after?: number | null;
61
+ }
62
+ export interface DiscordMediaImportGroup {
63
+ channel_id: string;
64
+ message_id: string;
65
+ attachment_ids: string[];
66
+ }
67
+ export interface DiscordMediaImportRequest {
68
+ groups: DiscordMediaImportGroup[];
69
+ }
70
+ export interface DiscordMediaImportAttachmentResult {
71
+ status: 'imported' | 'duplicate' | 'failed';
72
+ channel_id: string;
73
+ message_id: string;
74
+ attachment_id: string;
75
+ media_id?: string;
76
+ title_update_id?: string;
77
+ reason?: string;
78
+ }
79
+ export interface DiscordMediaImportResponse {
80
+ imported_count: number;
81
+ duplicate_count: number;
82
+ failed_count: number;
83
+ updates: Array<{
84
+ id: string;
85
+ title?: string | null;
86
+ scheduled_status: 'pending';
87
+ schedule_for_social: false;
88
+ media_count: number;
89
+ }>;
90
+ attachments: DiscordMediaImportAttachmentResult[];
91
+ }
92
+ export interface DiscordUserCommandStatus {
93
+ linked: boolean;
94
+ linked_to_this_scheduler: boolean;
95
+ discord_username?: string | null;
96
+ destination_scheduler_id?: string | null;
97
+ destination_scheduler_name?: string | null;
98
+ installed_at?: string | null;
99
+ pending_count: number;
100
+ command_name: string;
101
+ setup_path: string;
102
+ configured: boolean;
103
+ }
104
+ export type DiscordMediaCaptureStatus = 'processing' | 'ready' | 'complete' | 'failed' | 'expired';
105
+ export type DiscordMediaCaptureAttachmentStatus = 'processing' | 'ready' | 'duplicate' | 'unsupported' | 'failed' | 'imported';
106
+ export interface DiscordMediaCaptureAttachment {
107
+ id: string;
108
+ discord_attachment_id: string;
109
+ filename: string;
110
+ mime_type?: string | null;
111
+ media_type: 'image' | 'video';
112
+ size: number;
113
+ width?: number | null;
114
+ height?: number | null;
115
+ duration_secs?: number | null;
116
+ description?: string | null;
117
+ status: DiscordMediaCaptureAttachmentStatus;
118
+ failure_reason?: string | null;
119
+ preview_url?: string | null;
120
+ media_id?: string | null;
121
+ title_update_id?: string | null;
122
+ }
123
+ export interface DiscordMediaCapture {
124
+ id: string;
125
+ status: DiscordMediaCaptureStatus;
126
+ content?: string | null;
127
+ author?: {
128
+ id?: string | null;
129
+ username: string;
130
+ avatar?: string | null;
131
+ bot: boolean;
132
+ } | null;
133
+ timestamp?: string | null;
134
+ jump_url?: string | null;
135
+ expires_at: string;
136
+ failure_reason?: string | null;
137
+ attachments: DiscordMediaCaptureAttachment[];
138
+ }
139
+ export interface DiscordMediaCaptureListParams {
140
+ cursor?: string;
141
+ search?: string;
142
+ limit?: number;
143
+ }
144
+ export interface DiscordMediaCaptureListResponse {
145
+ items: DiscordMediaCapture[];
146
+ next_cursor?: string | null;
147
+ }
148
+ export interface DiscordMediaCaptureImportRequest {
149
+ capture_id: string;
150
+ attachment_ids: string[];
151
+ }
3
152
  declare class Scheduler {
4
153
  /**
5
154
  * List promotion schedules.
@@ -310,6 +459,27 @@ declare class Scheduler {
310
459
  * @returns promise
311
460
  */
312
461
  static getDiscordChannels<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
462
+ /**
463
+ * Search image and video attachments in the connected Discord server.
464
+ * This call only returns remote candidates; it does not copy files into the
465
+ * Library and does not create or schedule social posts.
466
+ */
467
+ static searchDiscordMedia<T = DiscordMediaSearchResponse>(scheduler_id: string, params?: DiscordMediaSearchParams): AxiosPromise<Response<T>>;
468
+ /**
469
+ * Import explicitly selected Discord attachments as pending, unscheduled
470
+ * Library updates. Attachments selected from one message stay grouped.
471
+ */
472
+ static importDiscordMedia<T = DiscordMediaImportResponse>(scheduler_id: string, data: DiscordMediaImportRequest, params?: Record<string, any>): AxiosPromise<Response<T>>;
473
+ /** Get the current user's personal Save to Glitch command setup state. */
474
+ static getDiscordUserCommandStatus<T = DiscordUserCommandStatus>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
475
+ /** Disconnect the current user's personal command from this Library. */
476
+ static disconnectDiscordUserCommand<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
477
+ /** List messages saved through the user-installed Discord command. */
478
+ static listDiscordMediaCaptures<T = DiscordMediaCaptureListResponse>(scheduler_id: string, params?: DiscordMediaCaptureListParams): AxiosPromise<Response<T>>;
479
+ /** Import selected staged attachments into pending Library content. */
480
+ static importDiscordMediaCapture<T = DiscordMediaImportResponse>(scheduler_id: string, data: DiscordMediaCaptureImportRequest, params?: Record<string, any>): AxiosPromise<Response<T>>;
481
+ /** Dismiss one saved Discord message and delete its temporary staged files. */
482
+ static dismissDiscordMediaCapture<T>(scheduler_id: string, capture_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
313
483
  /**
314
484
  * Clear Google Ads OAuth credentials from a promotion schedule.
315
485
  *
package/dist/esm/index.js CHANGED
@@ -16257,6 +16257,13 @@ var SchedulerRoute = /** @class */ (function () {
16257
16257
  getRedditSubredditFlairs: { url: '/schedulers/{scheduler_id}/reddit/subreddits/{subreddit}/flairs', method: HTTP_METHODS.GET },
16258
16258
  getRedditSubredditRules: { url: '/schedulers/{scheduler_id}/reddit/subreddits/{subreddit}/rules', method: HTTP_METHODS.GET },
16259
16259
  getDiscordChannels: { url: '/schedulers/{scheduler_id}/discord/channels', method: HTTP_METHODS.GET },
16260
+ searchDiscordMedia: { url: '/schedulers/{scheduler_id}/discord/media', method: HTTP_METHODS.GET },
16261
+ importDiscordMedia: { url: '/schedulers/{scheduler_id}/discord/media/import', method: HTTP_METHODS.POST },
16262
+ getDiscordUserCommandStatus: { url: '/schedulers/{scheduler_id}/discord/user-command', method: HTTP_METHODS.GET },
16263
+ disconnectDiscordUserCommand: { url: '/schedulers/{scheduler_id}/discord/user-command', method: HTTP_METHODS.DELETE },
16264
+ listDiscordMediaCaptures: { url: '/schedulers/{scheduler_id}/discord/captures', method: HTTP_METHODS.GET },
16265
+ importDiscordMediaCapture: { url: '/schedulers/{scheduler_id}/discord/captures/import', method: HTTP_METHODS.POST },
16266
+ dismissDiscordMediaCapture: { url: '/schedulers/{scheduler_id}/discord/captures/{capture_id}', method: HTTP_METHODS.DELETE },
16260
16267
  crossPromoteListRelationships: {
16261
16268
  url: '/schedulers/{scheduler_id}/crosspromote/relationships',
16262
16269
  method: HTTP_METHODS.GET
@@ -16753,6 +16760,41 @@ var Scheduler = /** @class */ (function () {
16753
16760
  Scheduler.getDiscordChannels = function (scheduler_id, params) {
16754
16761
  return Requests.processRoute(SchedulerRoute.routes.getDiscordChannels, {}, { scheduler_id: scheduler_id }, params);
16755
16762
  };
16763
+ /**
16764
+ * Search image and video attachments in the connected Discord server.
16765
+ * This call only returns remote candidates; it does not copy files into the
16766
+ * Library and does not create or schedule social posts.
16767
+ */
16768
+ Scheduler.searchDiscordMedia = function (scheduler_id, params) {
16769
+ return Requests.processRoute(SchedulerRoute.routes.searchDiscordMedia, {}, { scheduler_id: scheduler_id }, params);
16770
+ };
16771
+ /**
16772
+ * Import explicitly selected Discord attachments as pending, unscheduled
16773
+ * Library updates. Attachments selected from one message stay grouped.
16774
+ */
16775
+ Scheduler.importDiscordMedia = function (scheduler_id, data, params) {
16776
+ return Requests.processRoute(SchedulerRoute.routes.importDiscordMedia, data, { scheduler_id: scheduler_id }, params);
16777
+ };
16778
+ /** Get the current user's personal Save to Glitch command setup state. */
16779
+ Scheduler.getDiscordUserCommandStatus = function (scheduler_id, params) {
16780
+ return Requests.processRoute(SchedulerRoute.routes.getDiscordUserCommandStatus, {}, { scheduler_id: scheduler_id }, params);
16781
+ };
16782
+ /** Disconnect the current user's personal command from this Library. */
16783
+ Scheduler.disconnectDiscordUserCommand = function (scheduler_id, params) {
16784
+ return Requests.processRoute(SchedulerRoute.routes.disconnectDiscordUserCommand, {}, { scheduler_id: scheduler_id }, params);
16785
+ };
16786
+ /** List messages saved through the user-installed Discord command. */
16787
+ Scheduler.listDiscordMediaCaptures = function (scheduler_id, params) {
16788
+ return Requests.processRoute(SchedulerRoute.routes.listDiscordMediaCaptures, {}, { scheduler_id: scheduler_id }, params);
16789
+ };
16790
+ /** Import selected staged attachments into pending Library content. */
16791
+ Scheduler.importDiscordMediaCapture = function (scheduler_id, data, params) {
16792
+ return Requests.processRoute(SchedulerRoute.routes.importDiscordMediaCapture, data, { scheduler_id: scheduler_id }, params);
16793
+ };
16794
+ /** Dismiss one saved Discord message and delete its temporary staged files. */
16795
+ Scheduler.dismissDiscordMediaCapture = function (scheduler_id, capture_id, params) {
16796
+ return Requests.processRoute(SchedulerRoute.routes.dismissDiscordMediaCapture, {}, { scheduler_id: scheduler_id, capture_id: capture_id }, params);
16797
+ };
16756
16798
  /**
16757
16799
  * Clear Google Ads OAuth credentials from a promotion schedule.
16758
16800
  *