@solufy/evolution-sdk
Version:
Unofficial SDK for the Evolution Whatsapp API v2
223 lines (220 loc) • 6.99 kB
TypeScript
import * as libphonenumber_js from 'libphonenumber-js';
import { z } from 'zod';
import { MessageId } from '../../../types/tags.js';
declare const VoiceMessageOptionsSchema: 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>;
} & {
/**
* Audio URL or file in base64
*/
audio: z.ZodUnion<[z.ZodString, z.ZodString]>;
/**
* Encode audio into WhatsApp default format (allows audio to be sped up)
* @default true
*/
encoding: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
}, "strip", z.ZodTypeAny, {
number: string;
audio: string;
encoding: boolean;
delay?: number | undefined;
}, {
number: string;
audio: string;
delay?: number | undefined;
encoding?: boolean | undefined;
}>;
declare const VoiceMessageBodySchema: 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>;
} & {
/**
* Audio URL or file in base64
*/
audio: z.ZodUnion<[z.ZodString, z.ZodString]>;
/**
* Encode audio into WhatsApp default format (allows audio to be sped up)
* @default true
*/
encoding: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
}, "strip", z.ZodTypeAny, {
number: string;
audio: string;
encoding: boolean;
delay?: number | undefined;
}, {
number: string;
audio: string;
delay?: number | undefined;
encoding?: boolean | undefined;
}>;
declare const VoiceMessageResponseSchema: 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<{
audioMessage: z.ZodObject<{
url: z.ZodString;
mimetype: z.ZodString;
fileSha256: z.ZodString;
fileLength: z.ZodNumber;
seconds: z.ZodNumber;
ptt: z.ZodOptional<z.ZodBoolean>;
mediaKey: z.ZodString;
fileEncSha256: z.ZodString;
directPath: z.ZodString;
mediaKeyTimestamp: z.ZodEffects<z.ZodNumber, Date, number>;
waveform: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
mimetype: string;
url: string;
fileSha256: string;
fileLength: number;
seconds: number;
mediaKey: string;
fileEncSha256: string;
directPath: string;
mediaKeyTimestamp: Date;
ptt?: boolean | undefined;
waveform?: string | null | undefined;
}, {
mimetype: string;
url: string;
fileSha256: string;
fileLength: number;
seconds: number;
mediaKey: string;
fileEncSha256: string;
directPath: string;
mediaKeyTimestamp: number;
ptt?: boolean | undefined;
waveform?: string | null | undefined;
}>;
}, "strip", z.ZodTypeAny, {
audioMessage: {
mimetype: string;
url: string;
fileSha256: string;
fileLength: number;
seconds: number;
mediaKey: string;
fileEncSha256: string;
directPath: string;
mediaKeyTimestamp: Date;
ptt?: boolean | undefined;
waveform?: string | null | undefined;
};
}, {
audioMessage: {
mimetype: string;
url: string;
fileSha256: string;
fileLength: number;
seconds: number;
mediaKey: string;
fileEncSha256: string;
directPath: string;
mediaKeyTimestamp: number;
ptt?: boolean | undefined;
waveform?: string | null | undefined;
};
}>;
messageTimestamp: z.ZodDate;
}, "strip", z.ZodTypeAny, {
message: {
audioMessage: {
mimetype: string;
url: string;
fileSha256: string;
fileLength: number;
seconds: number;
mediaKey: string;
fileEncSha256: string;
directPath: string;
mediaKeyTimestamp: Date;
ptt?: boolean | undefined;
waveform?: string | null | undefined;
};
};
key: {
id: string;
remoteJid: string;
};
messageTimestamp: Date;
}, {
message: {
audioMessage: {
mimetype: string;
url: string;
fileSha256: string;
fileLength: number;
seconds: number;
mediaKey: string;
fileEncSha256: string;
directPath: string;
mediaKeyTimestamp: number;
ptt?: boolean | undefined;
waveform?: string | null | undefined;
};
};
key: {
id: string;
remoteJid: string;
};
messageTimestamp: Date;
}>, {
receiver: {
phoneNumber: libphonenumber_js.E164Number;
jid: `${string}@s.whatsapp.net`;
};
media: {
url: string;
mimetype: string;
length: number;
durationInSeconds: number;
sha256: string;
encryptedSha256: string;
directPath: string;
/**
* Indicates whether the audio message is a push-to-talk (PTT) message
*/
isPtt: boolean | undefined;
key: string;
keyTimestamp: Date;
waveform: string | null | undefined;
};
messageId: MessageId;
timestamp: Date;
}, {
message: {
audioMessage: {
mimetype: string;
url: string;
fileSha256: string;
fileLength: number;
seconds: number;
mediaKey: string;
fileEncSha256: string;
directPath: string;
mediaKeyTimestamp: number;
ptt?: boolean | undefined;
waveform?: string | null | undefined;
};
};
key: {
id: string;
remoteJid: string;
};
messageTimestamp: Date;
}>;
type VoiceMessageOptions = z.infer<typeof VoiceMessageOptionsSchema>;
type VoiceMessageResponse = z.infer<typeof VoiceMessageResponseSchema>;
export { VoiceMessageBodySchema as BodySchema, VoiceMessageOptionsSchema as OptionsSchema, VoiceMessageResponseSchema as ResponseSchema, VoiceMessageBodySchema, type VoiceMessageOptions, VoiceMessageOptionsSchema, type VoiceMessageResponse, VoiceMessageResponseSchema };