/* * 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 { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdk-validation-error.js"; import * as models from "../index.js"; export const SortBy = { TrustLevel: "trustLevel", ViolationCount: "violationCount", ReportCount: "reportCount", MemberSince: "memberSince", LastActive: "lastActive", ContentCount: "contentCount", FlaggedContentRatio: "flaggedContentRatio", AverageSentiment: "averageSentiment", } as const; export type SortBy = ClosedEnum; /** * Sort direction */ export const ListAuthorsSortDirection = { Asc: "asc", Desc: "desc", } as const; /** * Sort direction */ export type ListAuthorsSortDirection = ClosedEnum< typeof ListAuthorsSortDirection >; export type ListAuthorsRequest = { page?: number | undefined; pageSize?: number | undefined; sortBy?: SortBy | undefined; /** * Sort direction */ sortDirection?: ListAuthorsSortDirection | undefined; memberSinceDate?: string | undefined; lastActiveDate?: string | undefined; contentTypes?: 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; }; /** * Successful response */ export type ListAuthorsResponseBody = { /** * The items on this page. */ data: Array; /** * Where this page is in the full list. */ pagination: models.Pagination; }; export type ListAuthorsResponse = { result: ListAuthorsResponseBody; }; /** @internal */ export const SortBy$outboundSchema: z.ZodMiniEnum = z.enum( SortBy, ); /** @internal */ export const ListAuthorsSortDirection$outboundSchema: z.ZodMiniEnum< typeof ListAuthorsSortDirection > = z.enum(ListAuthorsSortDirection); /** @internal */ export type ListAuthorsRequest$Outbound = { page: number; pageSize: number; sortBy?: string | undefined; sortDirection: string; memberSinceDate?: string | undefined; lastActiveDate?: string | undefined; contentTypes?: Array | undefined; projectId?: string | undefined; }; /** @internal */ export const ListAuthorsRequest$outboundSchema: z.ZodMiniType< ListAuthorsRequest$Outbound, ListAuthorsRequest > = z.object({ page: z._default(z.int(), 1), pageSize: z._default(z.int(), 20), sortBy: z.optional(SortBy$outboundSchema), sortDirection: z._default(ListAuthorsSortDirection$outboundSchema, "desc"), memberSinceDate: z.optional(z.string()), lastActiveDate: z.optional(z.string()), contentTypes: z.optional(z.array(z.string())), projectId: z.optional(z.string()), }); export function listAuthorsRequestToJSON( listAuthorsRequest: ListAuthorsRequest, ): string { return JSON.stringify( ListAuthorsRequest$outboundSchema.parse(listAuthorsRequest), ); } /** @internal */ export const ListAuthorsResponseBody$inboundSchema: z.ZodMiniType< ListAuthorsResponseBody, unknown > = z.object({ data: z.array(models.PublicAuthor$inboundSchema), pagination: models.Pagination$inboundSchema, }); export function listAuthorsResponseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListAuthorsResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListAuthorsResponseBody' from JSON`, ); } /** @internal */ export const ListAuthorsResponse$inboundSchema: z.ZodMiniType< ListAuthorsResponse, unknown > = z.pipe( z.object({ Result: z.lazy(() => ListAuthorsResponseBody$inboundSchema), }), z.transform((v) => { return remap$(v, { "Result": "result", }); }), ); export function listAuthorsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListAuthorsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListAuthorsResponse' from JSON`, ); }