docs(media): document phase5 stream media credential endpoints
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { OpenAPIRegistry, OpenApiGeneratorV3, extendZodWithOpenApi } from '@asteasolutions/zod-to-openapi';
|
||||
import { z } from 'zod';
|
||||
import { getBetterAuthBaseUrl } from '../utils/env';
|
||||
|
||||
extendZodWithOpenApi(z);
|
||||
|
||||
@@ -806,6 +807,10 @@ registry.registerPath({
|
||||
id: z.string().uuid(),
|
||||
status: z.string(),
|
||||
streamKey: z.string().nullable(),
|
||||
mediaProvider: z.string(),
|
||||
mediaSessionId: z.string().nullable(),
|
||||
publishEndpoint: z.string().nullable(),
|
||||
subscribeEndpoint: z.string().nullable(),
|
||||
startedAt: z.string().datetime().nullable(),
|
||||
}),
|
||||
}),
|
||||
@@ -852,6 +857,60 @@ registry.registerPath({
|
||||
},
|
||||
});
|
||||
|
||||
registry.registerPath({
|
||||
method: 'get',
|
||||
path: '/streams/{streamSessionId}/publish-credentials',
|
||||
summary: 'Get publish credentials for camera ingest to media provider',
|
||||
tags: ['Streams'],
|
||||
security: [{ bearerDeviceToken: [] }],
|
||||
request: {
|
||||
params: z.object({ streamSessionId: z.string().uuid() }),
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
description: 'Publish credentials',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: z.object({
|
||||
provider: z.string(),
|
||||
mediaSessionId: z.string(),
|
||||
publishToken: z.string(),
|
||||
publishUrl: z.string(),
|
||||
expiresInSeconds: z.number().int(),
|
||||
}),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
registry.registerPath({
|
||||
method: 'get',
|
||||
path: '/streams/{streamSessionId}/subscribe-credentials',
|
||||
summary: 'Get subscribe credentials for viewing stream from media provider',
|
||||
tags: ['Streams'],
|
||||
security: [{ bearerDeviceToken: [] }],
|
||||
request: {
|
||||
params: z.object({ streamSessionId: z.string().uuid() }),
|
||||
},
|
||||
responses: {
|
||||
200: {
|
||||
description: 'Subscribe credentials',
|
||||
content: {
|
||||
'application/json': {
|
||||
schema: z.object({
|
||||
provider: z.string(),
|
||||
mediaSessionId: z.string(),
|
||||
subscribeToken: z.string(),
|
||||
subscribeUrl: z.string(),
|
||||
expiresInSeconds: z.number().int(),
|
||||
}),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
registry.registerPath({
|
||||
method: 'get',
|
||||
path: '/streams/{streamSessionId}/playback-token',
|
||||
@@ -871,6 +930,8 @@ registry.registerPath({
|
||||
streamKey: z.string(),
|
||||
status: z.string(),
|
||||
playbackToken: z.string(),
|
||||
subscribeUrl: z.string(),
|
||||
mediaProvider: z.string(),
|
||||
expiresInSeconds: z.number().int(),
|
||||
}),
|
||||
},
|
||||
@@ -906,6 +967,8 @@ registry.registerPath({
|
||||
status: z.string(),
|
||||
reason: z.string(),
|
||||
streamKey: z.string().nullable(),
|
||||
mediaProvider: z.string(),
|
||||
mediaSessionId: z.string().nullable(),
|
||||
}),
|
||||
),
|
||||
}),
|
||||
@@ -924,7 +987,7 @@ export function buildOpenApiDocument() {
|
||||
version: '1.0.0',
|
||||
description: 'Auto-generated API documentation from Zod schemas.',
|
||||
},
|
||||
servers: [{ url: process.env.BETTER_AUTH_URL ?? 'http://localhost:3000' }],
|
||||
servers: [{ url: getBetterAuthBaseUrl() }],
|
||||
tags: [
|
||||
{ name: 'System', description: 'Service endpoints' },
|
||||
{ name: 'Videos', description: 'Authenticated video object operations' },
|
||||
|
||||
Reference in New Issue
Block a user