/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetAnalyticsWebinarsWebinarIdAudienceRequest = { /** * The hashed ID of the webinar. */ webinarId: string; /** * Number of results to return (max 100). */ perPage?: number | undefined; /** * Cursor for pagination. Use the value from the previous response's page_info.end_cursor. */ cursor?: string | undefined; }; export type Chat = { /** * The approximate position in the event when the chat was sent (in seconds). */ roundedPlayerPosition?: number | undefined; /** * The chat message content. */ chats?: Array | undefined; }; export type GetAnalyticsWebinarsWebinarIdAudienceData = { /** * The registrant's first name. */ firstName?: string | null | undefined; /** * The registrant's last name. */ lastName?: string | null | undefined; /** * The registrant's email address. */ email?: string | null | undefined; /** * The registrant's phone number. */ phoneNumber?: string | null | undefined; /** * The registrant's company name. */ company?: string | null | undefined; /** * The registrant's job title. */ jobTitle?: string | null | undefined; /** * The registrant's country. */ country?: string | null | undefined; /** * When the registrant registered in ISO 8601 format. */ registeredAt?: Date | null | undefined; /** * When the registrant joined the live event in ISO 8601 format. */ attendedAt?: Date | null | undefined; /** * Whether the registrant attended the event. */ attendanceStatus?: string | null | undefined; /** * The registrant's restriction status (e.g., approved, blocked). */ restrictionStatus?: string | null | undefined; /** * How the registrant was added (e.g., registration_form, import). */ originMethod?: string | null | undefined; /** * The UTM campaign that referred this registrant. */ utmCampaign?: string | null | undefined; /** * The UTM source that referred this registrant. */ utmSource?: string | null | undefined; /** * The UTM medium that referred this registrant. */ utmMedium?: string | null | undefined; /** * The referring domain for this registrant. */ referrerDomain?: string | null | undefined; /** * The registrant's country based on IP geolocation. */ ipCountry?: string | null | undefined; /** * The registrant's city based on IP geolocation. */ ipCity?: string | null | undefined; /** * The registrant's engagement rate during the event (between 0 and 1). */ engagementRate?: number | null | undefined; /** * The registrant's focused viewing rate during the event (between 0 and 1). */ focusedRate?: number | null | undefined; /** * Total time the registrant watched in seconds. */ playedTime?: number | null | undefined; /** * Total time the registrant watched with the tab focused in seconds. */ focusedPlayedTime?: number | null | undefined; /** * The number of chat messages sent by this registrant. */ chatCount?: number | null | undefined; /** * The number of annotation clicks by this registrant. */ annotationClickCount?: number | null | undefined; /** * The number of poll responses submitted by this registrant. */ pollResponsesCount?: number | null | undefined; /** * Per-bucket attendance data for this registrant. */ attendeeHistogram?: Array | null | undefined; /** * Per-bucket focused attendance data for this registrant. */ focusedAttendeeHistogram?: Array | null | undefined; /** * Chat messages sent by this registrant with timestamps. */ chats?: Array | undefined; }; export type GetAnalyticsWebinarsWebinarIdAudiencePageInfo = { /** * Whether there are more results after this page. */ hasNextPage?: boolean | undefined; /** * Whether there are results before this page. */ hasPreviousPage?: boolean | undefined; /** * Cursor to use for fetching the next page. */ endCursor?: string | null | undefined; /** * Cursor to use for fetching the previous page. */ startCursor?: string | null | undefined; }; /** * Success response with webinar audience data. */ export type GetAnalyticsWebinarsWebinarIdAudienceResponse = { data?: Array | undefined; pageInfo?: GetAnalyticsWebinarsWebinarIdAudiencePageInfo | undefined; }; /** @internal */ export type GetAnalyticsWebinarsWebinarIdAudienceRequest$Outbound = { webinarId: string; per_page: number; cursor?: string | undefined; }; /** @internal */ export const GetAnalyticsWebinarsWebinarIdAudienceRequest$outboundSchema: z.ZodType< GetAnalyticsWebinarsWebinarIdAudienceRequest$Outbound, z.ZodTypeDef, GetAnalyticsWebinarsWebinarIdAudienceRequest > = z.object({ webinarId: z.string(), perPage: z.number().int().default(25), cursor: z.string().optional(), }).transform((v) => { return remap$(v, { perPage: "per_page", }); }); export function getAnalyticsWebinarsWebinarIdAudienceRequestToJSON( getAnalyticsWebinarsWebinarIdAudienceRequest: GetAnalyticsWebinarsWebinarIdAudienceRequest, ): string { return JSON.stringify( GetAnalyticsWebinarsWebinarIdAudienceRequest$outboundSchema.parse( getAnalyticsWebinarsWebinarIdAudienceRequest, ), ); } /** @internal */ export const Chat$inboundSchema: z.ZodType = z .object({ rounded_player_position: z.number().int().optional(), chats: z.array(z.string()).optional(), }).transform((v) => { return remap$(v, { "rounded_player_position": "roundedPlayerPosition", }); }); export function chatFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Chat$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Chat' from JSON`, ); } /** @internal */ export const GetAnalyticsWebinarsWebinarIdAudienceData$inboundSchema: z.ZodType< GetAnalyticsWebinarsWebinarIdAudienceData, z.ZodTypeDef, unknown > = z.object({ first_name: z.nullable(z.string()).optional(), last_name: z.nullable(z.string()).optional(), email: z.nullable(z.string()).optional(), phone_number: z.nullable(z.string()).optional(), company: z.nullable(z.string()).optional(), job_title: z.nullable(z.string()).optional(), country: z.nullable(z.string()).optional(), registered_at: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), attended_at: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), attendance_status: z.nullable(z.string()).optional(), restriction_status: z.nullable(z.string()).optional(), origin_method: z.nullable(z.string()).optional(), utm_campaign: z.nullable(z.string()).optional(), utm_source: z.nullable(z.string()).optional(), utm_medium: z.nullable(z.string()).optional(), referrer_domain: z.nullable(z.string()).optional(), ip_country: z.nullable(z.string()).optional(), ip_city: z.nullable(z.string()).optional(), engagement_rate: z.nullable(z.number()).optional(), focused_rate: z.nullable(z.number()).optional(), played_time: z.nullable(z.number().int()).optional(), focused_played_time: z.nullable(z.number().int()).optional(), chat_count: z.nullable(z.number().int()).optional(), annotation_click_count: z.nullable(z.number().int()).optional(), poll_responses_count: z.nullable(z.number().int()).optional(), attendee_histogram: z.nullable(z.array(z.nullable(z.number().int()))) .optional(), focused_attendee_histogram: z.nullable(z.array(z.nullable(z.number().int()))) .optional(), chats: z.array(z.lazy(() => Chat$inboundSchema)).optional(), }).transform((v) => { return remap$(v, { "first_name": "firstName", "last_name": "lastName", "phone_number": "phoneNumber", "job_title": "jobTitle", "registered_at": "registeredAt", "attended_at": "attendedAt", "attendance_status": "attendanceStatus", "restriction_status": "restrictionStatus", "origin_method": "originMethod", "utm_campaign": "utmCampaign", "utm_source": "utmSource", "utm_medium": "utmMedium", "referrer_domain": "referrerDomain", "ip_country": "ipCountry", "ip_city": "ipCity", "engagement_rate": "engagementRate", "focused_rate": "focusedRate", "played_time": "playedTime", "focused_played_time": "focusedPlayedTime", "chat_count": "chatCount", "annotation_click_count": "annotationClickCount", "poll_responses_count": "pollResponsesCount", "attendee_histogram": "attendeeHistogram", "focused_attendee_histogram": "focusedAttendeeHistogram", }); }); export function getAnalyticsWebinarsWebinarIdAudienceDataFromJSON( jsonString: string, ): SafeParseResult< GetAnalyticsWebinarsWebinarIdAudienceData, SDKValidationError > { return safeParse( jsonString, (x) => GetAnalyticsWebinarsWebinarIdAudienceData$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'GetAnalyticsWebinarsWebinarIdAudienceData' from JSON`, ); } /** @internal */ export const GetAnalyticsWebinarsWebinarIdAudiencePageInfo$inboundSchema: z.ZodType< GetAnalyticsWebinarsWebinarIdAudiencePageInfo, z.ZodTypeDef, unknown > = z.object({ has_next_page: z.boolean().optional(), has_previous_page: z.boolean().optional(), end_cursor: z.nullable(z.string()).optional(), start_cursor: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "has_next_page": "hasNextPage", "has_previous_page": "hasPreviousPage", "end_cursor": "endCursor", "start_cursor": "startCursor", }); }); export function getAnalyticsWebinarsWebinarIdAudiencePageInfoFromJSON( jsonString: string, ): SafeParseResult< GetAnalyticsWebinarsWebinarIdAudiencePageInfo, SDKValidationError > { return safeParse( jsonString, (x) => GetAnalyticsWebinarsWebinarIdAudiencePageInfo$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'GetAnalyticsWebinarsWebinarIdAudiencePageInfo' from JSON`, ); } /** @internal */ export const GetAnalyticsWebinarsWebinarIdAudienceResponse$inboundSchema: z.ZodType< GetAnalyticsWebinarsWebinarIdAudienceResponse, z.ZodTypeDef, unknown > = z.object({ data: z.array( z.lazy(() => GetAnalyticsWebinarsWebinarIdAudienceData$inboundSchema), ).optional(), page_info: z.lazy(() => GetAnalyticsWebinarsWebinarIdAudiencePageInfo$inboundSchema ).optional(), }).transform((v) => { return remap$(v, { "page_info": "pageInfo", }); }); export function getAnalyticsWebinarsWebinarIdAudienceResponseFromJSON( jsonString: string, ): SafeParseResult< GetAnalyticsWebinarsWebinarIdAudienceResponse, SDKValidationError > { return safeParse( jsonString, (x) => GetAnalyticsWebinarsWebinarIdAudienceResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'GetAnalyticsWebinarsWebinarIdAudienceResponse' from JSON`, ); }