camstreamerlib
Version:
Helper library for CamStreamer ACAP applications.
250 lines (249 loc) • 6.71 kB
TypeScript
import { z } from 'zod';
declare const csEventsDataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
type: z.ZodLiteral<"authorization">;
state: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "authorization";
state: string;
}, {
type: "authorization";
state: string;
}>, z.ZodObject<{
type: z.ZodLiteral<"StreamState">;
streamID: z.ZodNumber;
enabled: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
active: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
automationState: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
isStreaming: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
}, "strip", z.ZodTypeAny, {
type: "StreamState";
enabled: 0 | 1;
active: 0 | 1;
streamID: number;
automationState: 0 | 1;
isStreaming: 0 | 1;
}, {
type: "StreamState";
enabled: 0 | 1;
active: 0 | 1;
streamID: number;
automationState: 0 | 1;
isStreaming: 0 | 1;
}>, z.ZodObject<{
type: z.ZodLiteral<"CS_API_SUCCESS">;
apiCall: z.ZodString;
message: z.ZodString;
streamID: z.ZodString;
}, "strip", z.ZodTypeAny, {
message: string;
type: "CS_API_SUCCESS";
streamID: string;
apiCall: string;
}, {
message: string;
type: "CS_API_SUCCESS";
streamID: string;
apiCall: string;
}>, z.ZodObject<{
type: z.ZodLiteral<"CS_API_ERROR">;
apiCall: z.ZodString;
message: z.ZodString;
streamID: z.ZodString;
code: z.ZodString;
}, "strip", z.ZodTypeAny, {
code: string;
message: string;
type: "CS_API_ERROR";
streamID: string;
apiCall: string;
}, {
code: string;
message: string;
type: "CS_API_ERROR";
streamID: string;
apiCall: string;
}>]>;
export declare const csEventsSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
type: z.ZodLiteral<"init">;
data: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
type: z.ZodLiteral<"authorization">;
state: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "authorization";
state: string;
}, {
type: "authorization";
state: string;
}>, z.ZodObject<{
type: z.ZodLiteral<"StreamState">;
streamID: z.ZodNumber;
enabled: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
active: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
automationState: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
isStreaming: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
}, "strip", z.ZodTypeAny, {
type: "StreamState";
enabled: 0 | 1;
active: 0 | 1;
streamID: number;
automationState: 0 | 1;
isStreaming: 0 | 1;
}, {
type: "StreamState";
enabled: 0 | 1;
active: 0 | 1;
streamID: number;
automationState: 0 | 1;
isStreaming: 0 | 1;
}>, z.ZodObject<{
type: z.ZodLiteral<"CS_API_SUCCESS">;
apiCall: z.ZodString;
message: z.ZodString;
streamID: z.ZodString;
}, "strip", z.ZodTypeAny, {
message: string;
type: "CS_API_SUCCESS";
streamID: string;
apiCall: string;
}, {
message: string;
type: "CS_API_SUCCESS";
streamID: string;
apiCall: string;
}>, z.ZodObject<{
type: z.ZodLiteral<"CS_API_ERROR">;
apiCall: z.ZodString;
message: z.ZodString;
streamID: z.ZodString;
code: z.ZodString;
}, "strip", z.ZodTypeAny, {
code: string;
message: string;
type: "CS_API_ERROR";
streamID: string;
apiCall: string;
}, {
code: string;
message: string;
type: "CS_API_ERROR";
streamID: string;
apiCall: string;
}>]>;
}, "strip", z.ZodTypeAny, {
type: "init";
data: {
type: "authorization";
state: string;
} | {
type: "StreamState";
enabled: 0 | 1;
active: 0 | 1;
streamID: number;
automationState: 0 | 1;
isStreaming: 0 | 1;
} | {
message: string;
type: "CS_API_SUCCESS";
streamID: string;
apiCall: string;
} | {
code: string;
message: string;
type: "CS_API_ERROR";
streamID: string;
apiCall: string;
};
}, {
type: "init";
data: {
type: "authorization";
state: string;
} | {
type: "StreamState";
enabled: 0 | 1;
active: 0 | 1;
streamID: number;
automationState: 0 | 1;
isStreaming: 0 | 1;
} | {
message: string;
type: "CS_API_SUCCESS";
streamID: string;
apiCall: string;
} | {
code: string;
message: string;
type: "CS_API_ERROR";
streamID: string;
apiCall: string;
};
}>, z.ZodObject<{
type: z.ZodLiteral<"authorization">;
state: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "authorization";
state: string;
}, {
type: "authorization";
state: string;
}>, z.ZodObject<{
type: z.ZodLiteral<"StreamState">;
streamID: z.ZodNumber;
enabled: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
active: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
automationState: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
isStreaming: z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<1>]>;
}, "strip", z.ZodTypeAny, {
type: "StreamState";
enabled: 0 | 1;
active: 0 | 1;
streamID: number;
automationState: 0 | 1;
isStreaming: 0 | 1;
}, {
type: "StreamState";
enabled: 0 | 1;
active: 0 | 1;
streamID: number;
automationState: 0 | 1;
isStreaming: 0 | 1;
}>, z.ZodObject<{
type: z.ZodLiteral<"CS_API_SUCCESS">;
apiCall: z.ZodString;
message: z.ZodString;
streamID: z.ZodString;
}, "strip", z.ZodTypeAny, {
message: string;
type: "CS_API_SUCCESS";
streamID: string;
apiCall: string;
}, {
message: string;
type: "CS_API_SUCCESS";
streamID: string;
apiCall: string;
}>, z.ZodObject<{
type: z.ZodLiteral<"CS_API_ERROR">;
apiCall: z.ZodString;
message: z.ZodString;
streamID: z.ZodString;
code: z.ZodString;
}, "strip", z.ZodTypeAny, {
code: string;
message: string;
type: "CS_API_ERROR";
streamID: string;
apiCall: string;
}, {
code: string;
message: string;
type: "CS_API_ERROR";
streamID: string;
apiCall: string;
}>]>;
export type TCamStreamerEvent = z.infer<typeof csEventsDataSchema>;
export type TCamStreamerEventType = TCamStreamerEvent['type'];
export type TCamStreamerEventOfType<T extends TCamStreamerEventType> = Extract<TCamStreamerEvent, {
type: T;
}>;
export {};