UNPKG

@solufy/evolution-sdk

Version:

Unofficial SDK for the Evolution Whatsapp API v2

276 lines (273 loc) 8.28 kB
import * as libphonenumber_js from 'libphonenumber-js'; import { z } from 'zod'; import { MessageId } from '../../../types/tags.mjs'; declare const DocumentMessageOptionsSchema: 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>; } & { /** * Document URL or file in base64 */ document: z.ZodUnion<[z.ZodString, z.ZodString]>; /** * Caption to send with document */ caption: z.ZodOptional<z.ZodString>; /** * Document mimetype */ mimetype: z.ZodOptional<z.ZodString>; /** * Name of the file */ fileName: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { number: string; document: string; delay?: number | undefined; mimetype?: string | undefined; caption?: string | undefined; fileName?: string | undefined; }, { number: string; document: string; delay?: number | undefined; mimetype?: string | undefined; caption?: string | undefined; fileName?: string | undefined; }>, { number: string; document: string; delay?: number | undefined; mimetype?: string | undefined; caption?: string | undefined; fileName?: string | undefined; }, { number: string; document: string; delay?: number | undefined; mimetype?: string | undefined; caption?: string | undefined; fileName?: string | undefined; }>; declare const DocumentMessageBodySchema: z.ZodEffects<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>; } & { /** * Document URL or file in base64 */ document: z.ZodUnion<[z.ZodString, z.ZodString]>; /** * Caption to send with document */ caption: z.ZodOptional<z.ZodString>; /** * Document mimetype */ mimetype: z.ZodOptional<z.ZodString>; /** * Name of the file */ fileName: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { number: string; document: string; delay?: number | undefined; mimetype?: string | undefined; caption?: string | undefined; fileName?: string | undefined; }, { number: string; document: string; delay?: number | undefined; mimetype?: string | undefined; caption?: string | undefined; fileName?: string | undefined; }>, { number: string; document: string; delay?: number | undefined; mimetype?: string | undefined; caption?: string | undefined; fileName?: string | undefined; }, { number: string; document: string; delay?: number | undefined; mimetype?: string | undefined; caption?: string | undefined; fileName?: string | undefined; }>, { media: string; mediatype: string; number: string; delay?: number | undefined; mimetype?: string | undefined; caption?: string | undefined; fileName?: string | undefined; }, { number: string; document: string; delay?: number | undefined; mimetype?: string | undefined; caption?: string | undefined; fileName?: string | undefined; }>; declare const DocumentMessageResponseSchema: 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<{ documentMessage: z.ZodObject<{ url: z.ZodString; mimetype: z.ZodOptional<z.ZodString>; fileSha256: z.ZodString; fileLength: z.ZodNumber; mediaKey: z.ZodString; caption: z.ZodOptional<z.ZodString>; fileName: z.ZodString; fileEncSha256: z.ZodString; directPath: z.ZodString; mediaKeyTimestamp: z.ZodEffects<z.ZodNumber, Date, number>; }, "strip", z.ZodTypeAny, { url: string; fileSha256: string; fileLength: number; mediaKey: string; fileEncSha256: string; directPath: string; mediaKeyTimestamp: Date; fileName: string; mimetype?: string | undefined; caption?: string | undefined; }, { url: string; fileSha256: string; fileLength: number; mediaKey: string; fileEncSha256: string; directPath: string; mediaKeyTimestamp: number; fileName: string; mimetype?: string | undefined; caption?: string | undefined; }>; }, "strip", z.ZodTypeAny, { documentMessage: { url: string; fileSha256: string; fileLength: number; mediaKey: string; fileEncSha256: string; directPath: string; mediaKeyTimestamp: Date; fileName: string; mimetype?: string | undefined; caption?: string | undefined; }; }, { documentMessage: { url: string; fileSha256: string; fileLength: number; mediaKey: string; fileEncSha256: string; directPath: string; mediaKeyTimestamp: number; fileName: string; mimetype?: string | undefined; caption?: string | undefined; }; }>; messageTimestamp: z.ZodDate; }, "strip", z.ZodTypeAny, { message: { documentMessage: { url: string; fileSha256: string; fileLength: number; mediaKey: string; fileEncSha256: string; directPath: string; mediaKeyTimestamp: Date; fileName: string; mimetype?: string | undefined; caption?: string | undefined; }; }; key: { id: string; remoteJid: string; }; messageTimestamp: Date; }, { message: { documentMessage: { url: string; fileSha256: string; fileLength: number; mediaKey: string; fileEncSha256: string; directPath: string; mediaKeyTimestamp: number; fileName: string; mimetype?: string | undefined; caption?: string | undefined; }; }; key: { id: string; remoteJid: string; }; messageTimestamp: Date; }>, { receiver: { phoneNumber: libphonenumber_js.E164Number; jid: `${string}@s.whatsapp.net`; }; media: { url: string; caption: string | undefined; mimetype: string | undefined; length: number; sha256: string; fileName: string; encryptedSha256: string; directPath: string; key: string; keyTimestamp: Date; }; id: MessageId; timestamp: Date; }, { message: { documentMessage: { url: string; fileSha256: string; fileLength: number; mediaKey: string; fileEncSha256: string; directPath: string; mediaKeyTimestamp: number; fileName: string; mimetype?: string | undefined; caption?: string | undefined; }; }; key: { id: string; remoteJid: string; }; messageTimestamp: Date; }>; type DocumentMessageOptions = z.infer<typeof DocumentMessageOptionsSchema>; type DocumentMessageResponse = z.infer<typeof DocumentMessageResponseSchema>; export { DocumentMessageBodySchema as BodySchema, DocumentMessageBodySchema, type DocumentMessageOptions, DocumentMessageOptionsSchema, type DocumentMessageResponse, DocumentMessageResponseSchema, DocumentMessageOptionsSchema as OptionsSchema, DocumentMessageResponseSchema as ResponseSchema };