@wave-av/sdk 2.0.0 → 2.0.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.
Files changed (162) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/README.md +27 -23
  3. package/dist/audience.js +93 -0
  4. package/dist/audience.mjs +9 -0
  5. package/dist/camera-control.js +95 -0
  6. package/dist/camera-control.mjs +71 -0
  7. package/dist/captions-types.js +18 -0
  8. package/dist/captions-types.mjs +0 -0
  9. package/dist/captions.js +266 -0
  10. package/dist/captions.mjs +9 -0
  11. package/dist/chapters-types.js +18 -0
  12. package/dist/chapters-types.mjs +0 -0
  13. package/dist/chapters.js +280 -0
  14. package/dist/chapters.mjs +9 -0
  15. package/dist/chunk-362MRITF.mjs +46 -0
  16. package/dist/chunk-3ZLK4J3V.mjs +69 -0
  17. package/dist/chunk-4DG4OBRD.mjs +52 -0
  18. package/dist/chunk-4G7FMCMJ.mjs +68 -0
  19. package/dist/chunk-4KD5F6E3.mjs +0 -0
  20. package/dist/chunk-7M6XVUUK.mjs +241 -0
  21. package/dist/chunk-A344OOT7.mjs +243 -0
  22. package/dist/chunk-AI64YR5W.mjs +173 -0
  23. package/dist/chunk-C2GQ756E.mjs +57 -0
  24. package/dist/chunk-CO2VB72Z.mjs +255 -0
  25. package/dist/chunk-DWXWAILB.mjs +44 -0
  26. package/dist/chunk-FLEFYLDM.mjs +71 -0
  27. package/dist/chunk-H2YYTNUH.mjs +266 -0
  28. package/dist/chunk-IGDBED5P.mjs +246 -0
  29. package/dist/chunk-IL2SGWBC.mjs +0 -0
  30. package/dist/chunk-IVFZ5X4W.mjs +68 -0
  31. package/dist/chunk-JC32PG3T.mjs +114 -0
  32. package/dist/chunk-K5X42NLD.mjs +54 -0
  33. package/dist/chunk-KCEPNS2U.mjs +276 -0
  34. package/dist/chunk-LVOVF6XC.mjs +54 -0
  35. package/dist/chunk-M4Z33V3N.mjs +247 -0
  36. package/dist/chunk-M6FKIX75.mjs +0 -0
  37. package/dist/chunk-M744Z327.mjs +244 -0
  38. package/dist/chunk-MRFDPPFK.mjs +61 -0
  39. package/dist/chunk-MXU3Q23F.mjs +68 -0
  40. package/dist/chunk-NCVUZ746.mjs +60 -0
  41. package/dist/chunk-NLQVD2LF.mjs +210 -0
  42. package/dist/chunk-O6DOGYP5.mjs +238 -0
  43. package/dist/chunk-S25NY5GE.mjs +124 -0
  44. package/dist/chunk-TFHXBICQ.mjs +305 -0
  45. package/dist/chunk-TXWOA2VR.mjs +57 -0
  46. package/dist/chunk-UCDSNV22.mjs +63 -0
  47. package/dist/chunk-V5DWA5P4.mjs +279 -0
  48. package/dist/chunk-VLQQDYGP.mjs +173 -0
  49. package/dist/chunk-VPKZUXZW.mjs +53 -0
  50. package/dist/chunk-WS3PEFYJ.mjs +60 -0
  51. package/dist/chunk-XGAYMWRH.mjs +74 -0
  52. package/dist/chunk-XMM5J57W.mjs +0 -0
  53. package/dist/chunk-XWABBOSX.mjs +278 -0
  54. package/dist/chunk-Y6FXYEAI.mjs +10 -0
  55. package/dist/chunk-YBLXHI3M.mjs +257 -0
  56. package/dist/chunk-YEK26SSO.mjs +100 -0
  57. package/dist/chunk-YLCQKCZL.mjs +0 -0
  58. package/dist/chunk-YRKO4XI7.mjs +0 -0
  59. package/dist/chunk-ZJO7AP4Q.mjs +0 -0
  60. package/dist/client-types.js +18 -0
  61. package/dist/client-types.mjs +0 -0
  62. package/dist/client.js +311 -0
  63. package/dist/client.mjs +14 -0
  64. package/dist/clips-types.js +18 -0
  65. package/dist/clips-types.mjs +0 -0
  66. package/dist/clips.js +198 -0
  67. package/dist/clips.mjs +9 -0
  68. package/dist/cloud-switcher.js +80 -0
  69. package/dist/cloud-switcher.mjs +56 -0
  70. package/dist/collab-types.js +18 -0
  71. package/dist/collab-types.mjs +1 -0
  72. package/dist/collab.js +304 -0
  73. package/dist/collab.mjs +10 -0
  74. package/dist/connect.js +85 -0
  75. package/dist/connect.mjs +9 -0
  76. package/dist/creator.js +79 -0
  77. package/dist/creator.mjs +9 -0
  78. package/dist/desktop.js +77 -0
  79. package/dist/desktop.mjs +9 -0
  80. package/dist/distribution.js +88 -0
  81. package/dist/distribution.mjs +9 -0
  82. package/dist/drm.js +85 -0
  83. package/dist/drm.mjs +9 -0
  84. package/dist/edge.js +93 -0
  85. package/dist/edge.mjs +9 -0
  86. package/dist/editor-types.js +18 -0
  87. package/dist/editor-types.mjs +1 -0
  88. package/dist/editor.js +330 -0
  89. package/dist/editor.mjs +10 -0
  90. package/dist/fleet.js +149 -0
  91. package/dist/fleet.mjs +9 -0
  92. package/dist/ghost.js +139 -0
  93. package/dist/ghost.mjs +9 -0
  94. package/dist/index.js +0 -250
  95. package/dist/index.mjs +161 -5445
  96. package/dist/marketplace.js +82 -0
  97. package/dist/marketplace.mjs +9 -0
  98. package/dist/mesh.js +198 -0
  99. package/dist/mesh.mjs +9 -0
  100. package/dist/notifications.js +79 -0
  101. package/dist/notifications.mjs +9 -0
  102. package/dist/phone-types.js +18 -0
  103. package/dist/phone-types.mjs +0 -0
  104. package/dist/phone.js +269 -0
  105. package/dist/phone.mjs +9 -0
  106. package/dist/pipeline-types.js +18 -0
  107. package/dist/pipeline-types.mjs +0 -0
  108. package/dist/pipeline.js +263 -0
  109. package/dist/pipeline.mjs +9 -0
  110. package/dist/podcast.js +94 -0
  111. package/dist/podcast.mjs +9 -0
  112. package/dist/prism.js +82 -0
  113. package/dist/prism.mjs +9 -0
  114. package/dist/prompter.js +99 -0
  115. package/dist/prompter.mjs +76 -0
  116. package/dist/pulse.js +99 -0
  117. package/dist/pulse.mjs +9 -0
  118. package/dist/qr.js +71 -0
  119. package/dist/qr.mjs +9 -0
  120. package/dist/replay.js +62 -0
  121. package/dist/replay.mjs +38 -0
  122. package/dist/scene-types.js +18 -0
  123. package/dist/scene-types.mjs +1 -0
  124. package/dist/scene.js +271 -0
  125. package/dist/scene.mjs +10 -0
  126. package/dist/search-types.js +18 -0
  127. package/dist/search-types.mjs +1 -0
  128. package/dist/search.js +268 -0
  129. package/dist/search.mjs +10 -0
  130. package/dist/sentiment-types.js +18 -0
  131. package/dist/sentiment-types.mjs +0 -0
  132. package/dist/sentiment.js +235 -0
  133. package/dist/sentiment.mjs +9 -0
  134. package/dist/signage.js +93 -0
  135. package/dist/signage.mjs +9 -0
  136. package/dist/slides.js +78 -0
  137. package/dist/slides.mjs +9 -0
  138. package/dist/studio-ai-types.js +18 -0
  139. package/dist/studio-ai-types.mjs +1 -0
  140. package/dist/studio-ai.js +301 -0
  141. package/dist/studio-ai.mjs +10 -0
  142. package/dist/studio-types.js +18 -0
  143. package/dist/studio-types.mjs +1 -0
  144. package/dist/studio.js +303 -0
  145. package/dist/studio.mjs +10 -0
  146. package/dist/telemetry.js +124 -0
  147. package/dist/telemetry.mjs +15 -0
  148. package/dist/transcribe-types.js +18 -0
  149. package/dist/transcribe-types.mjs +1 -0
  150. package/dist/transcribe.js +282 -0
  151. package/dist/transcribe.mjs +10 -0
  152. package/dist/usb.js +69 -0
  153. package/dist/usb.mjs +9 -0
  154. package/dist/vault.js +96 -0
  155. package/dist/vault.mjs +9 -0
  156. package/dist/voice-types.js +18 -0
  157. package/dist/voice-types.mjs +0 -0
  158. package/dist/voice.js +272 -0
  159. package/dist/voice.mjs +9 -0
  160. package/dist/zoom.js +86 -0
  161. package/dist/zoom.mjs +9 -0
  162. package/package.json +3 -3
@@ -0,0 +1,52 @@
1
+ // src/desktop.ts
2
+ var DesktopAPI = class {
3
+ client;
4
+ basePath = "/v1/desktop";
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ async getInfo(nodeId) {
9
+ return this.client.get(`${this.basePath}/nodes/${nodeId}`);
10
+ }
11
+ async getStatus(nodeId) {
12
+ return this.client.get(
13
+ `${this.basePath}/nodes/${nodeId}/status`
14
+ );
15
+ }
16
+ async listDevices(nodeId) {
17
+ return this.client.get(`${this.basePath}/nodes/${nodeId}/devices`);
18
+ }
19
+ async configure(nodeId, config) {
20
+ return this.client.patch(`${this.basePath}/nodes/${nodeId}/config`, config);
21
+ }
22
+ async getConfig(nodeId) {
23
+ return this.client.get(`${this.basePath}/nodes/${nodeId}/config`);
24
+ }
25
+ async getLogs(nodeId, params) {
26
+ return this.client.get(`${this.basePath}/nodes/${nodeId}/logs`, {
27
+ params
28
+ });
29
+ }
30
+ async getPerformance(nodeId) {
31
+ return this.client.get(`${this.basePath}/nodes/${nodeId}/performance`);
32
+ }
33
+ async checkForUpdate(nodeId) {
34
+ return this.client.get(
35
+ `${this.basePath}/nodes/${nodeId}/updates`
36
+ );
37
+ }
38
+ async installUpdate(nodeId) {
39
+ return this.client.post(`${this.basePath}/nodes/${nodeId}/updates/install`);
40
+ }
41
+ async restart(nodeId) {
42
+ return this.client.post(`${this.basePath}/nodes/${nodeId}/restart`);
43
+ }
44
+ };
45
+ function createDesktopAPI(client) {
46
+ return new DesktopAPI(client);
47
+ }
48
+
49
+ export {
50
+ DesktopAPI,
51
+ createDesktopAPI
52
+ };
@@ -0,0 +1,68 @@
1
+ // src/audience.ts
2
+ var AudienceAPI = class {
3
+ client;
4
+ basePath = "/v1/audience";
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ async createPoll(request) {
9
+ return this.client.post(`${this.basePath}/polls`, request);
10
+ }
11
+ async getPoll(pollId) {
12
+ return this.client.get(`${this.basePath}/polls/${pollId}`);
13
+ }
14
+ async closePoll(pollId) {
15
+ return this.client.post(`${this.basePath}/polls/${pollId}/close`);
16
+ }
17
+ async getPollResults(pollId) {
18
+ return this.client.get(`${this.basePath}/polls/${pollId}/results`);
19
+ }
20
+ async vote(pollId, optionIds) {
21
+ await this.client.post(`${this.basePath}/polls/${pollId}/vote`, { option_ids: optionIds });
22
+ }
23
+ async createQA(request) {
24
+ return this.client.post(`${this.basePath}/qa`, request);
25
+ }
26
+ async getQA(sessionId) {
27
+ return this.client.get(`${this.basePath}/qa/${sessionId}`);
28
+ }
29
+ async closeQA(sessionId) {
30
+ return this.client.post(`${this.basePath}/qa/${sessionId}/close`);
31
+ }
32
+ async submitQuestion(sessionId, text) {
33
+ return this.client.post(`${this.basePath}/qa/${sessionId}/questions`, { text });
34
+ }
35
+ async answerQuestion(sessionId, questionId, answer) {
36
+ return this.client.post(
37
+ `${this.basePath}/qa/${sessionId}/questions/${questionId}/answer`,
38
+ { answer }
39
+ );
40
+ }
41
+ async upvoteQuestion(sessionId, questionId) {
42
+ return this.client.post(
43
+ `${this.basePath}/qa/${sessionId}/questions/${questionId}/upvote`
44
+ );
45
+ }
46
+ async pinQuestion(sessionId, questionId) {
47
+ return this.client.post(
48
+ `${this.basePath}/qa/${sessionId}/questions/${questionId}/pin`
49
+ );
50
+ }
51
+ async sendReaction(streamId, type) {
52
+ await this.client.post(`${this.basePath}/reactions`, { stream_id: streamId, type });
53
+ }
54
+ async getReactionMetrics(streamId) {
55
+ return this.client.get(`${this.basePath}/reactions/${streamId}`);
56
+ }
57
+ async getEngagementMetrics(streamId) {
58
+ return this.client.get(`${this.basePath}/engagement/${streamId}`);
59
+ }
60
+ };
61
+ function createAudienceAPI(client) {
62
+ return new AudienceAPI(client);
63
+ }
64
+
65
+ export {
66
+ AudienceAPI,
67
+ createAudienceAPI
68
+ };
File without changes
@@ -0,0 +1,241 @@
1
+ // src/captions.ts
2
+ var CaptionsAPI = class {
3
+ client;
4
+ basePath = "/v1/captions";
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ /**
9
+ * Generate captions using AI
10
+ *
11
+ * Requires: captions:generate permission
12
+ */
13
+ async generate(request) {
14
+ return this.client.post(`${this.basePath}/generate`, request);
15
+ }
16
+ /**
17
+ * Upload existing captions
18
+ *
19
+ * Requires: captions:create permission
20
+ */
21
+ async upload(request) {
22
+ return this.client.post(`${this.basePath}/upload`, request);
23
+ }
24
+ /**
25
+ * Get a caption track by ID
26
+ *
27
+ * Requires: captions:read permission
28
+ */
29
+ async get(trackId) {
30
+ return this.client.get(`${this.basePath}/${trackId}`);
31
+ }
32
+ /**
33
+ * Update a caption track
34
+ *
35
+ * Requires: captions:update permission
36
+ */
37
+ async update(trackId, request) {
38
+ return this.client.patch(`${this.basePath}/${trackId}`, request);
39
+ }
40
+ /**
41
+ * Remove a caption track
42
+ *
43
+ * Requires: captions:remove permission (server-side RBAC enforced)
44
+ */
45
+ async remove(trackId) {
46
+ await this.client.delete(
47
+ `${this.basePath}/${trackId}`,
48
+ { method: "DELETE" }
49
+ );
50
+ }
51
+ /**
52
+ * List caption tracks
53
+ *
54
+ * Requires: captions:read permission
55
+ */
56
+ async list(params) {
57
+ return this.client.get(this.basePath, {
58
+ params
59
+ });
60
+ }
61
+ /**
62
+ * Get caption tracks for a specific media
63
+ *
64
+ * Requires: captions:read permission
65
+ */
66
+ async getForMedia(mediaId, mediaType) {
67
+ const result = await this.list({ media_id: mediaId, media_type: mediaType });
68
+ return result.data;
69
+ }
70
+ /**
71
+ * Get caption cues (segments)
72
+ *
73
+ * Requires: captions:read permission
74
+ */
75
+ async getCues(trackId, params) {
76
+ return this.client.get(
77
+ `${this.basePath}/${trackId}/cues`,
78
+ { params }
79
+ );
80
+ }
81
+ /**
82
+ * Update a caption cue
83
+ *
84
+ * Requires: captions:update permission
85
+ */
86
+ async updateCue(trackId, cueId, updates) {
87
+ return this.client.patch(
88
+ `${this.basePath}/${trackId}/cues/${cueId}`,
89
+ updates
90
+ );
91
+ }
92
+ /**
93
+ * Add a new caption cue
94
+ *
95
+ * Requires: captions:update permission
96
+ */
97
+ async addCue(trackId, cue) {
98
+ return this.client.post(
99
+ `${this.basePath}/${trackId}/cues`,
100
+ cue
101
+ );
102
+ }
103
+ /**
104
+ * Remove a caption cue
105
+ *
106
+ * Requires: captions:update permission (server-side RBAC enforced)
107
+ */
108
+ async removeCue(trackId, cueId) {
109
+ await this.client.delete(
110
+ `${this.basePath}/${trackId}/cues/${cueId}`,
111
+ { method: "DELETE" }
112
+ );
113
+ }
114
+ /**
115
+ * Bulk update cues
116
+ *
117
+ * Requires: captions:update permission
118
+ */
119
+ async bulkUpdateCues(trackId, updates) {
120
+ return this.client.post(`${this.basePath}/${trackId}/cues/bulk`, { updates });
121
+ }
122
+ /**
123
+ * Translate a caption track to another language
124
+ *
125
+ * Requires: captions:translate permission
126
+ */
127
+ async translate(trackId, request) {
128
+ return this.client.post(
129
+ `${this.basePath}/${trackId}/translate`,
130
+ request
131
+ );
132
+ }
133
+ /**
134
+ * Export captions in a specific format
135
+ *
136
+ * Requires: captions:read permission
137
+ */
138
+ async exportFormat(trackId, format) {
139
+ return this.client.get(`${this.basePath}/${trackId}/export`, {
140
+ params: { format }
141
+ });
142
+ }
143
+ /**
144
+ * Get captions as plain text
145
+ *
146
+ * Requires: captions:read permission
147
+ */
148
+ async getText(trackId) {
149
+ const result = await this.client.get(
150
+ `${this.basePath}/${trackId}/text`
151
+ );
152
+ return result.text;
153
+ }
154
+ /**
155
+ * Burn captions into video
156
+ *
157
+ * Requires: captions:burnin permission
158
+ */
159
+ async burnIn(request) {
160
+ return this.client.post(`${this.basePath}/burn-in`, request);
161
+ }
162
+ /**
163
+ * Get burn-in job status
164
+ *
165
+ * Requires: captions:read permission
166
+ */
167
+ async getBurnInJob(jobId) {
168
+ return this.client.get(`${this.basePath}/burn-in/${jobId}`);
169
+ }
170
+ /**
171
+ * Wait for burn-in to complete
172
+ */
173
+ async waitForBurnIn(jobId, options) {
174
+ const pollInterval = options?.pollInterval || 3e3;
175
+ const timeout = options?.timeout || 18e5;
176
+ const startTime = Date.now();
177
+ while (Date.now() - startTime < timeout) {
178
+ const job = await this.getBurnInJob(jobId);
179
+ if (options?.onProgress) {
180
+ options.onProgress(job);
181
+ }
182
+ if (job.status === "ready") {
183
+ return job;
184
+ }
185
+ if (job.status === "failed") {
186
+ throw new Error(`Burn-in failed: ${job.error || "Unknown error"}`);
187
+ }
188
+ await new Promise((resolve) => setTimeout(resolve, pollInterval));
189
+ }
190
+ throw new Error(`Burn-in timed out after ${timeout}ms`);
191
+ }
192
+ /**
193
+ * Wait for caption generation to complete
194
+ */
195
+ async waitForReady(trackId, options) {
196
+ const pollInterval = options?.pollInterval || 2e3;
197
+ const timeout = options?.timeout || 6e5;
198
+ const startTime = Date.now();
199
+ while (Date.now() - startTime < timeout) {
200
+ const track = await this.get(trackId);
201
+ if (options?.onProgress) {
202
+ options.onProgress(track);
203
+ }
204
+ if (track.status === "ready") {
205
+ return track;
206
+ }
207
+ if (track.status === "failed") {
208
+ throw new Error(`Caption generation failed: ${track.error || "Unknown error"}`);
209
+ }
210
+ await new Promise((resolve) => setTimeout(resolve, pollInterval));
211
+ }
212
+ throw new Error(`Caption generation timed out after ${timeout}ms`);
213
+ }
214
+ /**
215
+ * Get supported languages
216
+ *
217
+ * Requires: captions:read permission
218
+ */
219
+ async getSupportedLanguages() {
220
+ return this.client.get(`${this.basePath}/languages`);
221
+ }
222
+ /**
223
+ * Detect language from audio
224
+ *
225
+ * Requires: captions:generate permission
226
+ */
227
+ async detectLanguage(mediaId, mediaType) {
228
+ return this.client.post(`${this.basePath}/detect-language`, {
229
+ media_id: mediaId,
230
+ media_type: mediaType
231
+ });
232
+ }
233
+ };
234
+ function createCaptionsAPI(client) {
235
+ return new CaptionsAPI(client);
236
+ }
237
+
238
+ export {
239
+ CaptionsAPI,
240
+ createCaptionsAPI
241
+ };
@@ -0,0 +1,243 @@
1
+ // src/search.ts
2
+ var SearchAPI = class {
3
+ client;
4
+ basePath = "/v1/search";
5
+ constructor(client) {
6
+ this.client = client;
7
+ }
8
+ /**
9
+ * Search content
10
+ *
11
+ * Requires: search:query permission
12
+ */
13
+ async search(request) {
14
+ return this.client.post(this.basePath, request);
15
+ }
16
+ /**
17
+ * Quick search (simplified API)
18
+ *
19
+ * Requires: search:query permission
20
+ */
21
+ async quickSearch(query, options) {
22
+ const response = await this.search({
23
+ query,
24
+ mode: "semantic",
25
+ types: options?.types,
26
+ filters: options?.filters,
27
+ limit: options?.limit || 10
28
+ });
29
+ return response.results;
30
+ }
31
+ /**
32
+ * Search within a specific media
33
+ *
34
+ * Requires: search:query permission
35
+ */
36
+ async searchInMedia(mediaId, mediaType, query, options) {
37
+ return this.client.post(`${this.basePath}/media`, {
38
+ media_id: mediaId,
39
+ media_type: mediaType,
40
+ query,
41
+ ...options
42
+ });
43
+ }
44
+ /**
45
+ * Visual search (search by image)
46
+ *
47
+ * Requires: search:visual permission
48
+ */
49
+ async visualSearch(request) {
50
+ return this.client.post(`${this.basePath}/visual`, request);
51
+ }
52
+ /**
53
+ * Find similar frames
54
+ *
55
+ * Requires: search:visual permission
56
+ */
57
+ async findSimilarFrames(mediaId, timestamp, options) {
58
+ return this.client.post(`${this.basePath}/visual/similar`, {
59
+ media_id: mediaId,
60
+ timestamp,
61
+ ...options
62
+ });
63
+ }
64
+ /**
65
+ * Detect objects in media
66
+ *
67
+ * Requires: search:visual permission
68
+ */
69
+ async detectObjects(mediaId, options) {
70
+ return this.client.post(`${this.basePath}/visual/objects`, {
71
+ media_id: mediaId,
72
+ ...options
73
+ });
74
+ }
75
+ /**
76
+ * Audio search (search by audio)
77
+ *
78
+ * Requires: search:audio permission
79
+ */
80
+ async audioSearch(request) {
81
+ return this.client.post(`${this.basePath}/audio`, request);
82
+ }
83
+ /**
84
+ * Find similar audio segments
85
+ *
86
+ * Requires: search:audio permission
87
+ */
88
+ async findSimilarAudio(mediaId, startTime, endTime, options) {
89
+ return this.client.post(`${this.basePath}/audio/similar`, {
90
+ media_id: mediaId,
91
+ start_time: startTime,
92
+ end_time: endTime,
93
+ ...options
94
+ });
95
+ }
96
+ /**
97
+ * Detect music in media
98
+ *
99
+ * Requires: search:audio permission
100
+ */
101
+ async detectMusic(mediaId) {
102
+ return this.client.get(`${this.basePath}/audio/music/${mediaId}`);
103
+ }
104
+ /**
105
+ * Get search suggestions
106
+ *
107
+ * Requires: search:query permission
108
+ */
109
+ async getSuggestions(prefix, options) {
110
+ return this.client.get(`${this.basePath}/suggest`, {
111
+ params: { prefix, ...options }
112
+ });
113
+ }
114
+ /**
115
+ * Get trending searches
116
+ *
117
+ * Requires: search:query permission
118
+ */
119
+ async getTrending(options) {
120
+ return this.client.get(`${this.basePath}/trending`, { params: options });
121
+ }
122
+ /**
123
+ * Index media for search
124
+ *
125
+ * Requires: search:index permission
126
+ */
127
+ async indexMedia(mediaId, mediaType, options) {
128
+ return this.client.post(`${this.basePath}/index`, {
129
+ media_id: mediaId,
130
+ media_type: mediaType,
131
+ ...options
132
+ });
133
+ }
134
+ /**
135
+ * Get index status
136
+ *
137
+ * Requires: search:read permission
138
+ */
139
+ async getIndexStatus(mediaId) {
140
+ return this.client.get(`${this.basePath}/index/${mediaId}`);
141
+ }
142
+ /**
143
+ * Reindex media
144
+ *
145
+ * Requires: search:index permission
146
+ */
147
+ async reindexMedia(mediaId, options) {
148
+ return this.client.post(
149
+ `${this.basePath}/index/${mediaId}/reindex`,
150
+ options
151
+ );
152
+ }
153
+ /**
154
+ * Remove media from index
155
+ *
156
+ * Requires: search:index permission (server-side RBAC enforced)
157
+ */
158
+ async removeFromIndex(mediaId) {
159
+ await this.client.delete(
160
+ `${this.basePath}/index/${mediaId}`,
161
+ { method: "DELETE" }
162
+ );
163
+ }
164
+ /**
165
+ * Save a search
166
+ *
167
+ * Requires: search:save permission
168
+ */
169
+ async saveSearch(name, request, options) {
170
+ return this.client.post(`${this.basePath}/saved`, {
171
+ name,
172
+ query: request,
173
+ ...options
174
+ });
175
+ }
176
+ /**
177
+ * List saved searches
178
+ *
179
+ * Requires: search:read permission
180
+ */
181
+ async listSavedSearches(params) {
182
+ return this.client.get(`${this.basePath}/saved`, { params });
183
+ }
184
+ /**
185
+ * Run a saved search
186
+ *
187
+ * Requires: search:query permission
188
+ */
189
+ async runSavedSearch(savedSearchId) {
190
+ return this.client.post(
191
+ `${this.basePath}/saved/${savedSearchId}/run`
192
+ );
193
+ }
194
+ /**
195
+ * Remove a saved search
196
+ *
197
+ * Requires: search:save permission (server-side RBAC enforced)
198
+ */
199
+ async removeSavedSearch(savedSearchId) {
200
+ await this.client.delete(
201
+ `${this.basePath}/saved/${savedSearchId}`,
202
+ { method: "DELETE" }
203
+ );
204
+ }
205
+ /**
206
+ * Get search analytics
207
+ *
208
+ * Requires: search:analytics permission
209
+ */
210
+ async getAnalytics(options) {
211
+ return this.client.get(`${this.basePath}/analytics`, { params: options });
212
+ }
213
+ /**
214
+ * Wait for indexing to complete
215
+ */
216
+ async waitForIndex(mediaId, options) {
217
+ const pollInterval = options?.pollInterval || 2e3;
218
+ const timeout = options?.timeout || 6e5;
219
+ const startTime = Date.now();
220
+ while (Date.now() - startTime < timeout) {
221
+ const status = await this.getIndexStatus(mediaId);
222
+ if (options?.onProgress) {
223
+ options.onProgress(status);
224
+ }
225
+ if (status.status === "ready") {
226
+ return status;
227
+ }
228
+ if (status.status === "failed") {
229
+ throw new Error(`Indexing failed: ${status.error || "Unknown error"}`);
230
+ }
231
+ await new Promise((resolve) => setTimeout(resolve, pollInterval));
232
+ }
233
+ throw new Error(`Indexing timed out after ${timeout}ms`);
234
+ }
235
+ };
236
+ function createSearchAPI(client) {
237
+ return new SearchAPI(client);
238
+ }
239
+
240
+ export {
241
+ SearchAPI,
242
+ createSearchAPI
243
+ };