UNPKG

@solufy/evolution-sdk

Version:

Unofficial SDK for the Evolution Whatsapp API v2

192 lines (189 loc) 5.33 kB
import * as libphonenumber_js from 'libphonenumber-js'; import { z } from 'zod'; import { MessageId } from '../../../types/tags.js'; declare const PollMessageOptionsSchema: z.ZodObject<{ number: z.ZodUnion<[z.ZodEffects<z.ZodType<string, z.ZodTypeDef, string>, string, string>, z.ZodType<`${string}@s.whatsapp.net`, z.ZodTypeDef, `${string}@s.whatsapp.net`>, z.ZodType<`${string}@g.us`, z.ZodTypeDef, `${string}@g.us`>]>; delay: z.ZodOptional<z.ZodNumber>; } & { /** * Name of the poll */ name: z.ZodString; /** * Whether multiple options can be selected * @default false */ multiple: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; /** * Poll options */ options: z.ZodArray<z.ZodString, "many">; }, "strip", z.ZodTypeAny, { number: string; options: string[]; name: string; multiple: boolean; delay?: number | undefined; }, { number: string; options: string[]; name: string; delay?: number | undefined; multiple?: boolean | undefined; }>; declare const PollMessageBodySchema: z.ZodEffects<z.ZodObject<{ number: z.ZodUnion<[z.ZodEffects<z.ZodType<string, z.ZodTypeDef, string>, string, string>, z.ZodType<`${string}@s.whatsapp.net`, z.ZodTypeDef, `${string}@s.whatsapp.net`>, z.ZodType<`${string}@g.us`, z.ZodTypeDef, `${string}@g.us`>]>; delay: z.ZodOptional<z.ZodNumber>; } & { /** * Name of the poll */ name: z.ZodString; /** * Whether multiple options can be selected * @default false */ multiple: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; /** * Poll options */ options: z.ZodArray<z.ZodString, "many">; }, "strip", z.ZodTypeAny, { number: string; options: string[]; name: string; multiple: boolean; delay?: number | undefined; }, { number: string; options: string[]; name: string; delay?: number | undefined; multiple?: boolean | undefined; }>, { selectableCount: number; values: string[]; number: string; name: string; delay?: number | undefined; }, { number: string; options: string[]; name: string; delay?: number | undefined; multiple?: boolean | undefined; }>; declare const PollMessageResponseSchema: z.ZodEffects<z.ZodObject<{ key: z.ZodObject<{ remoteJid: z.ZodString; id: z.ZodString; }, "strip", z.ZodTypeAny, { id: string; remoteJid: string; }, { id: string; remoteJid: string; }>; message: z.ZodObject<{ pollCreationMessageV3: z.ZodObject<{ name: z.ZodString; options: z.ZodArray<z.ZodObject<{ optionName: z.ZodString; }, "strip", z.ZodTypeAny, { optionName: string; }, { optionName: string; }>, "many">; selectableOptionsCount: z.ZodNumber; }, "strip", z.ZodTypeAny, { options: { optionName: string; }[]; name: string; selectableOptionsCount: number; }, { options: { optionName: string; }[]; name: string; selectableOptionsCount: number; }>; }, "strip", z.ZodTypeAny, { pollCreationMessageV3: { options: { optionName: string; }[]; name: string; selectableOptionsCount: number; }; }, { pollCreationMessageV3: { options: { optionName: string; }[]; name: string; selectableOptionsCount: number; }; }>; messageTimestamp: z.ZodDate; }, "strip", z.ZodTypeAny, { message: { pollCreationMessageV3: { options: { optionName: string; }[]; name: string; selectableOptionsCount: number; }; }; key: { id: string; remoteJid: string; }; messageTimestamp: Date; }, { message: { pollCreationMessageV3: { options: { optionName: string; }[]; name: string; selectableOptionsCount: number; }; }; key: { id: string; remoteJid: string; }; messageTimestamp: Date; }>, { receiver: { phoneNumber: libphonenumber_js.E164Number; jid: `${string}@s.whatsapp.net`; }; poll: { name: string; options: string[]; multiple: boolean; }; id: MessageId; timestamp: Date; }, { message: { pollCreationMessageV3: { options: { optionName: string; }[]; name: string; selectableOptionsCount: number; }; }; key: { id: string; remoteJid: string; }; messageTimestamp: Date; }>; type PollMessageOptions = z.infer<typeof PollMessageOptionsSchema>; type PollMessageResponse = z.infer<typeof PollMessageResponseSchema>; export { PollMessageBodySchema as BodySchema, PollMessageOptionsSchema as OptionsSchema, PollMessageBodySchema, type PollMessageOptions, PollMessageOptionsSchema, type PollMessageResponse, PollMessageResponseSchema, PollMessageResponseSchema as ResponseSchema };