/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdk-validation-error.js"; export type GetQueueStatsRequest = { /** * The queue ID */ id: string; withinDays?: number | undefined; /** * The project to act on, when you call with an organization key. Optional when the organization has one project. A project key acts on its own project: naming another one is an error. */ projectId?: string | undefined; }; export type ReviewStats = { /** * Average time in milliseconds to review an item */ averageTimeToReview: number; /** * Total number of items reviewed */ totalReviewed: number; /** * Total number of items pending review */ totalPending: number; }; export type ActionStat = { /** * ID of the moderation action */ actionId: string; /** * Name of the moderation action */ actionName: string; /** * Number of times this action was taken */ count: number; /** * Percentage this action represents of all actions */ percentageOfTotal: number; }; export type TopAction = { /** * Most used action by this reviewer */ actionId: string; /** * Name of the most used action */ actionName: string; /** * Number of times this action was used */ count: number; }; export type TopReviewer = { /** * ID of the reviewer */ userId: string; /** * Name of the reviewer */ name: string; /** * Number of items reviewed */ reviewCount: number; /** * Average review time in milliseconds */ averageTimePerReview: number; /** * Optional accuracy score based on review quality metrics */ accuracyScore?: number | undefined; /** * Most common actions taken by this reviewer */ topActions: Array; }; export type DailyReviewCount = { /** * Date in YYYY-MM-DD format */ date: string; /** * Number of reviews on this date */ count: number; }; export type FlaggedContentTrend = { /** * Content flag/label */ label: string; /** * Trend indicator (-1 to 1) showing if this type of flagged content is increasing or decreasing */ trend: number; }; export type Trends = { dailyReviewCounts: Array; flaggedContentTrends: Array; }; /** * Successful response */ export type GetQueueStatsResponse = { reviewStats: ReviewStats; actionStats: Array; /** * List of top reviewers and their statistics */ topReviewers: Array; trends: Trends; }; /** @internal */ export type GetQueueStatsRequest$Outbound = { id: string; withinDays: number; projectId?: string | undefined; }; /** @internal */ export const GetQueueStatsRequest$outboundSchema: z.ZodMiniType< GetQueueStatsRequest$Outbound, GetQueueStatsRequest > = z.object({ id: z.string(), withinDays: z._default(z.int(), 30), projectId: z.optional(z.string()), }); export function getQueueStatsRequestToJSON( getQueueStatsRequest: GetQueueStatsRequest, ): string { return JSON.stringify( GetQueueStatsRequest$outboundSchema.parse(getQueueStatsRequest), ); } /** @internal */ export const ReviewStats$inboundSchema: z.ZodMiniType = z .object({ averageTimeToReview: types.number(), totalReviewed: types.number(), totalPending: types.number(), }); export function reviewStatsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ReviewStats$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ReviewStats' from JSON`, ); } /** @internal */ export const ActionStat$inboundSchema: z.ZodMiniType = z .object({ actionId: types.string(), actionName: types.string(), count: types.number(), percentageOfTotal: types.number(), }); export function actionStatFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ActionStat$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ActionStat' from JSON`, ); } /** @internal */ export const TopAction$inboundSchema: z.ZodMiniType = z .object({ actionId: types.string(), actionName: types.string(), count: types.number(), }); export function topActionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TopAction$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TopAction' from JSON`, ); } /** @internal */ export const TopReviewer$inboundSchema: z.ZodMiniType = z .object({ userId: types.string(), name: types.string(), reviewCount: types.number(), averageTimePerReview: types.number(), accuracyScore: types.optional(types.number()), topActions: z.array(z.lazy(() => TopAction$inboundSchema)), }); export function topReviewerFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TopReviewer$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TopReviewer' from JSON`, ); } /** @internal */ export const DailyReviewCount$inboundSchema: z.ZodMiniType< DailyReviewCount, unknown > = z.object({ date: types.string(), count: types.number(), }); export function dailyReviewCountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DailyReviewCount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DailyReviewCount' from JSON`, ); } /** @internal */ export const FlaggedContentTrend$inboundSchema: z.ZodMiniType< FlaggedContentTrend, unknown > = z.object({ label: types.string(), trend: types.number(), }); export function flaggedContentTrendFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FlaggedContentTrend$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FlaggedContentTrend' from JSON`, ); } /** @internal */ export const Trends$inboundSchema: z.ZodMiniType = z.object({ dailyReviewCounts: z.array(z.lazy(() => DailyReviewCount$inboundSchema)), flaggedContentTrends: z.array( z.lazy(() => FlaggedContentTrend$inboundSchema), ), }); export function trendsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Trends$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Trends' from JSON`, ); } /** @internal */ export const GetQueueStatsResponse$inboundSchema: z.ZodMiniType< GetQueueStatsResponse, unknown > = z.object({ reviewStats: z.lazy(() => ReviewStats$inboundSchema), actionStats: z.array(z.lazy(() => ActionStat$inboundSchema)), topReviewers: z.array(z.lazy(() => TopReviewer$inboundSchema)), trends: z.lazy(() => Trends$inboundSchema), }); export function getQueueStatsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetQueueStatsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetQueueStatsResponse' from JSON`, ); }