Skip to content

Commit 86e8756

Browse files
committed
feat: add desktop recordings API methods to PostHogAPIClient
Add API methods for desktop recordings CRUD operations: - createDesktopRecordingUpload(): Create upload token for new recording - getDesktopRecording(): Fetch recording metadata - getDesktopRecordingTranscript(): Fetch recording transcript - listDesktopRecordings(): List recordings with optional filters These methods are used by the Recall SDK integration to interact with the PostHog backend for desktop meeting recordings.
1 parent 69ee240 commit 86e8756

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

src/api/posthogClient.ts

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,4 +249,94 @@ export class PostHogAPIClient {
249249
});
250250
return data.results ?? [];
251251
}
252+
253+
// Desktop Recordings API
254+
async createDesktopRecordingUpload(platform: string = "desktop_audio") {
255+
const teamId = await this.getTeamId();
256+
const url = new URL(
257+
`${this.api.baseUrl}/api/environments/${teamId}/desktop_recordings/create_upload/`,
258+
);
259+
const response = await this.api.fetcher.fetch({
260+
method: "post",
261+
url,
262+
path: `/api/environments/${teamId}/desktop_recordings/create_upload/`,
263+
parameters: {
264+
body: { platform },
265+
},
266+
});
267+
268+
if (!response.ok) {
269+
throw new Error(
270+
`Failed to create recording upload: ${response.statusText}`,
271+
);
272+
}
273+
274+
return await response.json(); // { upload_token, recording_id }
275+
}
276+
277+
async getDesktopRecording(recordingId: string) {
278+
const teamId = await this.getTeamId();
279+
const url = new URL(
280+
`${this.api.baseUrl}/api/environments/${teamId}/desktop_recordings/${recordingId}/`,
281+
);
282+
const response = await this.api.fetcher.fetch({
283+
method: "get",
284+
url,
285+
path: `/api/environments/${teamId}/desktop_recordings/${recordingId}/`,
286+
});
287+
288+
if (!response.ok) {
289+
throw new Error(`Failed to fetch recording: ${response.statusText}`);
290+
}
291+
292+
return await response.json();
293+
}
294+
295+
async getDesktopRecordingTranscript(recordingId: string) {
296+
const teamId = await this.getTeamId();
297+
const url = new URL(
298+
`${this.api.baseUrl}/api/environments/${teamId}/desktop_recordings/${recordingId}/transcript/`,
299+
);
300+
const response = await this.api.fetcher.fetch({
301+
method: "get",
302+
url,
303+
path: `/api/environments/${teamId}/desktop_recordings/${recordingId}/transcript/`,
304+
});
305+
306+
if (!response.ok) {
307+
throw new Error(`Failed to fetch transcript: ${response.statusText}`);
308+
}
309+
310+
return await response.json();
311+
}
312+
313+
async listDesktopRecordings(filters?: {
314+
platform?: string;
315+
status?: string;
316+
search?: string;
317+
}) {
318+
const teamId = await this.getTeamId();
319+
const url = new URL(
320+
`${this.api.baseUrl}/api/environments/${teamId}/desktop_recordings/`,
321+
);
322+
323+
if (filters) {
324+
for (const [key, value] of Object.entries(filters)) {
325+
if (value) url.searchParams.set(key, value);
326+
}
327+
}
328+
329+
const response = await this.api.fetcher.fetch({
330+
method: "get",
331+
url,
332+
path: `/api/environments/${teamId}/desktop_recordings/`,
333+
});
334+
335+
if (!response.ok) {
336+
throw new Error(`Failed to list recordings: ${response.statusText}`);
337+
}
338+
339+
const data = await response.json();
340+
return data.results ?? data ?? [];
341+
}
252342
}

0 commit comments

Comments
 (0)