UNPKG

cesr

Version:

[![NPM Version](https://img.shields.io/npm/v/cesr.svg?style=flat)](https://www.npmjs.com/package/cesr) [![NPM License](https://img.shields.io/npm/l/cesr.svg?style=flat)](https://github.com/lenkan/cesr-js/blob/main/LICENSE) [![CI](https://github.com/lenkan

20 lines (19 loc) 702 B
import { Attachments, type AttachmentsInit } from "./attachments.ts"; import { VersionString } from "./version-string.ts"; export interface MessageBody { v: string; [key: string]: unknown; } export declare class Message<T extends MessageBody = MessageBody> { #private; readonly body: T; constructor(body: T, attachments?: AttachmentsInit); text(): string; get raw(): Uint8Array; get version(): VersionString; get attachments(): Attachments; set attachments(value: AttachmentsInit); static parse(input: Uint8Array): Message | null; static encode(init: MessageBody): Uint8Array; static from<T extends MessageBody = MessageBody>(body: T): Message<T>; }