/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { ClosedEnum, OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdk-validation-error.js"; import * as models from "../index.js"; export const SortField = { CreatedAt: "createdAt", Severity: "severity", ReviewedAt: "reviewedAt", } as const; export type SortField = ClosedEnum; /** * Sort direction */ export const ListQueueItemsSortDirection = { Asc: "asc", Desc: "desc", } as const; /** * Sort direction */ export type ListQueueItemsSortDirection = ClosedEnum< typeof ListQueueItemsSortDirection >; export type ListQueueItemsRequest = { /** * The queue ID */ id: string; page?: number | undefined; pageSize?: number | undefined; sortField?: SortField | undefined; /** * Sort direction */ sortDirection?: ListQueueItemsSortDirection | undefined; conversationIds?: Array | undefined; labels?: Array | undefined; afterDate?: string | undefined; beforeDate?: string | undefined; includeResolved?: boolean | undefined; authorId?: string | undefined; filteredActionIds?: Array | 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 ListQueueItemsLabel = { /** * Label name */ label: string; /** * Confidence score of the label */ score: number; /** * Whether this label caused a flag */ flagged: boolean; }; export type ListQueueItemsAction = { /** * Action ID */ id: string; /** * Action name */ name: string; /** * Action comment */ comment?: string | undefined; /** * Unix timestamp of when the action was taken */ timestamp: number; /** * Moderator userID */ reviewer?: string | undefined; }; /** * Status of the item */ export const ListQueueItemsStatus = { Pending: "pending", Resolved: "resolved", } as const; /** * Status of the item */ export type ListQueueItemsStatus = OpenEnum; export type ListQueueItemsData = { /** * Content ID */ id: string; /** * The content to be moderated */ content: string; /** * Content language */ language?: string | undefined; labels: Array; /** * Conversation ID */ conversationId?: string | undefined; /** * Author ID */ authorId?: string | undefined; /** * Action IDs taken on this item */ actions?: Array | undefined; /** * Whether the item is flagged by any label */ flagged: boolean; /** * Status of the item */ status: ListQueueItemsStatus; /** * Unix timestamp of when the item was created */ timestamp: number; /** * Type of the content object */ contentType?: string | undefined; }; /** * Successful response */ export type ListQueueItemsResponseBody = { /** * The items on this page. */ data: Array; /** * Where this page is in the full list. */ pagination: models.Pagination; }; export type ListQueueItemsResponse = { result: ListQueueItemsResponseBody; }; /** @internal */ export const SortField$outboundSchema: z.ZodMiniEnum = z.enum( SortField, ); /** @internal */ export const ListQueueItemsSortDirection$outboundSchema: z.ZodMiniEnum< typeof ListQueueItemsSortDirection > = z.enum(ListQueueItemsSortDirection); /** @internal */ export type ListQueueItemsRequest$Outbound = { id: string; page: number; pageSize: number; sortField?: string | undefined; sortDirection: string; conversationIds?: Array | undefined; labels?: Array | undefined; afterDate?: string | undefined; beforeDate?: string | undefined; includeResolved?: boolean | undefined; authorId?: string | undefined; filteredActionIds?: Array | undefined; projectId?: string | undefined; }; /** @internal */ export const ListQueueItemsRequest$outboundSchema: z.ZodMiniType< ListQueueItemsRequest$Outbound, ListQueueItemsRequest > = z.object({ id: z.string(), page: z._default(z.int(), 1), pageSize: z._default(z.int(), 20), sortField: z.optional(SortField$outboundSchema), sortDirection: z._default(ListQueueItemsSortDirection$outboundSchema, "desc"), conversationIds: z.optional(z.array(z.string())), labels: z.optional(z.array(z.string())), afterDate: z.optional(z.string()), beforeDate: z.optional(z.string()), includeResolved: z.optional(z.boolean()), authorId: z.optional(z.string()), filteredActionIds: z.optional(z.array(z.string())), projectId: z.optional(z.string()), }); export function listQueueItemsRequestToJSON( listQueueItemsRequest: ListQueueItemsRequest, ): string { return JSON.stringify( ListQueueItemsRequest$outboundSchema.parse(listQueueItemsRequest), ); } /** @internal */ export const ListQueueItemsLabel$inboundSchema: z.ZodMiniType< ListQueueItemsLabel, unknown > = z.object({ label: types.string(), score: types.number(), flagged: types.boolean(), }); export function listQueueItemsLabelFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListQueueItemsLabel$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListQueueItemsLabel' from JSON`, ); } /** @internal */ export const ListQueueItemsAction$inboundSchema: z.ZodMiniType< ListQueueItemsAction, unknown > = z.object({ id: types.string(), name: types.string(), comment: types.optional(types.string()), timestamp: types.number(), reviewer: types.optional(types.string()), }); export function listQueueItemsActionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListQueueItemsAction$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListQueueItemsAction' from JSON`, ); } /** @internal */ export const ListQueueItemsStatus$inboundSchema: z.ZodMiniType< ListQueueItemsStatus, unknown > = openEnums.inboundSchema(ListQueueItemsStatus); /** @internal */ export const ListQueueItemsData$inboundSchema: z.ZodMiniType< ListQueueItemsData, unknown > = z.object({ id: types.string(), content: types.string(), language: types.optional(types.string()), labels: z.array(z.lazy(() => ListQueueItemsLabel$inboundSchema)), conversationId: types.optional(types.string()), authorId: types.optional(types.string()), actions: types.optional( z.array(z.lazy(() => ListQueueItemsAction$inboundSchema)), ), flagged: types.boolean(), status: ListQueueItemsStatus$inboundSchema, timestamp: types.number(), contentType: types.optional(types.string()), }); export function listQueueItemsDataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListQueueItemsData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListQueueItemsData' from JSON`, ); } /** @internal */ export const ListQueueItemsResponseBody$inboundSchema: z.ZodMiniType< ListQueueItemsResponseBody, unknown > = z.object({ data: z.array(z.lazy(() => ListQueueItemsData$inboundSchema)), pagination: models.Pagination$inboundSchema, }); export function listQueueItemsResponseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListQueueItemsResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListQueueItemsResponseBody' from JSON`, ); } /** @internal */ export const ListQueueItemsResponse$inboundSchema: z.ZodMiniType< ListQueueItemsResponse, unknown > = z.pipe( z.object({ Result: z.lazy(() => ListQueueItemsResponseBody$inboundSchema), }), z.transform((v) => { return remap$(v, { "Result": "result", }); }), ); export function listQueueItemsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListQueueItemsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListQueueItemsResponse' from JSON`, ); }