import { Payload, DeserializedPayload } from '../lib/transformers/PayloadSerializer.js';
export interface SerializablePayloadOptions {
    /**
     * The mime type of the payload, if any.
     * This is a helper information that **should** be put
     * while providing the payload. It is the value of the
     * `content-type` header to be used with the body if one is missing.
     *
     * Note, this is only used when the headers field does not
     * include the `content-type` value.
     */
    mime?: string;
}
export interface ISerializablePayload {
    /**
     * The serialized payload message.
     */
    payload?: Payload;
    /**
     * Optional meta of the payload
     */
    payloadOptions?: SerializablePayloadOptions;
}
export declare class SerializablePayload implements ISerializablePayload {
    payload?: Payload;
    payloadOptions?: SerializablePayloadOptions;
    /**
     * The payload in its original format.
     * May not be populated when the `getPayload()` was not yet read.
     */
    protected _sourcePayload: unknown;
    /**
     * Sets the payload on the request.
     * This transforms the source `message` to its serialized form using the `PayloadSerializer`.
     *
     * @param message The payload value
     * @param mime The payload mime type. This is optional and sets the `payloadOptions.mime` value when set.
     */
    writePayload(message: unknown, mime?: string): Promise<void>;
    /**
     * Reads the payload as its original format.
     * It uses the `PayloadSerializer` to process the data.
     */
    readPayload(as: 'buffer'): Promise<Buffer | undefined>;
    /**
     * Reads the payload as its original format.
     * It uses the `PayloadSerializer` to process the data.
     */
    readPayload(as?: string): Promise<DeserializedPayload>;
    /**
     * Reads the payload as string, when it is possible.
     * This method assumes that the payload is a string regardless on the format of the data
     * (Buffer, ArrayBuffer, ...) and returns a string representation of the payload.
     *
     * @returns The string value of the payload of undefined if unable to process.
     */
    readPayloadAsString(): Promise<string | undefined>;
    toJSON(): ISerializablePayload;
}
//# sourceMappingURL=SerializablePayload.d.ts.map