Skip to content

Commit

Permalink
Added description to types
Browse files Browse the repository at this point in the history
  • Loading branch information
matvp91 committed Oct 11, 2024
1 parent 269462c commit c9d69c6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
26 changes: 22 additions & 4 deletions packages/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,16 @@ export type App = typeof app;

const app = new Elysia()
.use(cors())
.use(swagger())
.use(
swagger({
documentation: {
info: {
title: "Mixwave API",
version: "1.0.0",
},
},
}),
)
.post(
"/transcode",
async ({ body }) => {
Expand All @@ -37,27 +46,36 @@ const app = new Elysia()
language: LangCodeEnum,
}),
]),
{
description:
"Source input types. Can refer to the same file, eg: when an mp4 contains " +
"both audio and video, the same source can be added for both video and audio as type.",
},
),
streams: t.Array(
t.Union([
t.Object({
type: t.Literal("video"),
codec: VideoCodecEnum,
height: t.Number(),
bitrate: t.Number(),
framerate: t.Number(),
bitrate: t.Number({ description: "Bitrate in bps" }),
framerate: t.Number({ description: "Frames per second" }),
}),
t.Object({
type: t.Literal("audio"),
codec: AudioCodecEnum,
bitrate: t.Number(),
bitrate: t.Number({ description: "Bitrate in bps" }),
language: LangCodeEnum,
}),
t.Object({
type: t.Literal("text"),
language: LangCodeEnum,
}),
]),
{
description:
"Output types, the transcoder will match any given input and figure out if a particular output can be generated.",
},
),
segmentSize: t.Optional(t.Number()),
assetId: t.Optional(t.String()),
Expand Down
2 changes: 2 additions & 0 deletions packages/shared/src/typebox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export const LangCodeEnum = StringLiteralUnion(
Object.keys(by639_2T) as (keyof typeof by639_2T)[],
);

LangCodeEnum.description = "ISO 639 (T2), 3 characters, language code.";

export type LangCode = Static<typeof LangCodeEnum>;

export const VideoCodecEnum = StringLiteralUnion(["h264", "vp9", "hevc"]);
Expand Down

0 comments on commit c9d69c6

Please sign in to comment.