cloudflare
Version:
The official TypeScript library for the Cloudflare API
92 lines • 3.09 kB
TypeScript
import { APIResource } from "../../resource.js";
import * as Core from "../../core.js";
import { SinglePage } from "../../pagination.js";
export declare class Messages extends APIResource {
/**
* Acknowledge + Retry messages from a Queue
*/
ack(queueId: string, params: MessageAckParams, options?: Core.RequestOptions): Core.APIPromise<MessageAckResponse>;
/**
* Pull a batch of messages from a Queue
*/
pull(queueId: string, params: MessagePullParams, options?: Core.RequestOptions): Core.PagePromise<MessagePullResponsesSinglePage, MessagePullResponse>;
}
export declare class MessagePullResponsesSinglePage extends SinglePage<MessagePullResponse> {
}
export interface MessageAckResponse {
/**
* The number of messages that were succesfully acknowledged.
*/
ackCount?: number;
/**
* The number of messages that were succesfully retried.
*/
retryCount?: number;
warnings?: Array<string>;
}
export interface MessagePullResponse {
id?: string;
attempts?: number;
body?: string;
/**
* An ID that represents an "in-flight" message that has been pulled from a Queue.
* You must hold on to this ID and use it to acknowledge this message.
*/
lease_id?: string;
metadata?: unknown;
timestamp_ms?: number;
}
export interface MessageAckParams {
/**
* Path param: A Resource identifier.
*/
account_id: string;
/**
* Body param:
*/
acks?: Array<MessageAckParams.Ack>;
/**
* Body param:
*/
retries?: Array<MessageAckParams.Retry>;
}
export declare namespace MessageAckParams {
interface Ack {
/**
* An ID that represents an "in-flight" message that has been pulled from a Queue.
* You must hold on to this ID and use it to acknowledge this message.
*/
lease_id?: string;
}
interface Retry {
/**
* The number of seconds to delay before making the message available for another
* attempt.
*/
delay_seconds?: number;
/**
* An ID that represents an "in-flight" message that has been pulled from a Queue.
* You must hold on to this ID and use it to acknowledge this message.
*/
lease_id?: string;
}
}
export interface MessagePullParams {
/**
* Path param: A Resource identifier.
*/
account_id: string;
/**
* Body param: The maximum number of messages to include in a batch.
*/
batch_size?: number;
/**
* Body param: The number of milliseconds that a message is exclusively leased.
* After the timeout, the message becomes available for another attempt.
*/
visibility_timeout_ms?: number;
}
export declare namespace Messages {
export { type MessageAckResponse as MessageAckResponse, type MessagePullResponse as MessagePullResponse, MessagePullResponsesSinglePage as MessagePullResponsesSinglePage, type MessageAckParams as MessageAckParams, type MessagePullParams as MessagePullParams, };
}
//# sourceMappingURL=messages.d.ts.map