|
| 1 | +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | + |
| 3 | +import { APIResource } from '../../../resource'; |
| 4 | +import * as Core from '../../../core'; |
| 5 | + |
| 6 | +export class Downloads extends APIResource { |
| 7 | + /** |
| 8 | + * Requests one downloadable MP4 per recorded page of a session. Assembly runs |
| 9 | + * asynchronously and every page returns as `PENDING`. Re-posting re-enqueues all |
| 10 | + * pages and retries any that failed. Poll the GET endpoint for per-page status |
| 11 | + * and, on standard (non-BYOS) projects, download URLs. |
| 12 | + */ |
| 13 | + create(id: string, options?: Core.RequestOptions): Core.APIPromise<DownloadCreateResponse> { |
| 14 | + return this._client.post(`/v1/sessions/${id}/recording/downloads`, options); |
| 15 | + } |
| 16 | + |
| 17 | + /** |
| 18 | + * Returns the per-page download status for a session, with a short-lived signed |
| 19 | + * URL for each completed page on standard (non-BYOS) projects. |
| 20 | + */ |
| 21 | + list(id: string, options?: Core.RequestOptions): Core.APIPromise<DownloadListResponse> { |
| 22 | + return this._client.get(`/v1/sessions/${id}/recording/downloads`, options); |
| 23 | + } |
| 24 | +} |
| 25 | + |
| 26 | +export interface RecordingDownload { |
| 27 | + /** |
| 28 | + * Recorded page (tab) within the session, e.g. "0", "1". |
| 29 | + */ |
| 30 | + pageId: string; |
| 31 | + |
| 32 | + /** |
| 33 | + * Per-page MP4 assembly state. `NOT_REQUESTED`: no download has been requested for |
| 34 | + * the session yet. `PENDING`: assembly is enqueued or in progress. `COMPLETED`: |
| 35 | + * the MP4 is ready. `FAILED`: assembly failed; POST again to retry. |
| 36 | + */ |
| 37 | + status: 'NOT_REQUESTED' | 'PENDING' | 'COMPLETED' | 'FAILED'; |
| 38 | + |
| 39 | + /** |
| 40 | + * When the MP4 was created. Present only when COMPLETED on a standard (non-BYOS) |
| 41 | + * project. |
| 42 | + */ |
| 43 | + completedAt?: string; |
| 44 | + |
| 45 | + /** |
| 46 | + * Short-lived signed CDN URL, re-minted each GET. Present only when COMPLETED on a |
| 47 | + * standard (non-BYOS) project. |
| 48 | + */ |
| 49 | + downloadUrl?: string; |
| 50 | +} |
| 51 | + |
| 52 | +export interface DownloadCreateResponse { |
| 53 | + downloads: Array<RecordingDownload>; |
| 54 | +} |
| 55 | + |
| 56 | +export interface DownloadListResponse { |
| 57 | + downloads: Array<RecordingDownload>; |
| 58 | +} |
| 59 | + |
| 60 | +export declare namespace Downloads { |
| 61 | + export { |
| 62 | + type RecordingDownload as RecordingDownload, |
| 63 | + type DownloadCreateResponse as DownloadCreateResponse, |
| 64 | + type DownloadListResponse as DownloadListResponse, |
| 65 | + }; |
| 66 | +} |
0 commit comments