cloudflare
Version:
The official TypeScript library for the Cloudflare API
90 lines • 2.73 kB
TypeScript
import * as Core from 'cloudflare/core';
import { APIResource } from 'cloudflare/resource';
import * as MessagesAPI from 'cloudflare/resources/queues/messages';
export declare class Messages extends APIResource {
/**
* Acknowledge + Retry messages from a Queue.
*/
ack(queueId: string, params: MessageAckParams, options?: Core.RequestOptions): Core.APIPromise<MessageAckResponse | null>;
/**
* Pull a batch of messages from a Queue.
*/
pull(queueId: string, params: MessagePullParams, options?: Core.RequestOptions): Core.APIPromise<MessagePullResponse | null>;
}
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 type MessagePullResponse = Array<MessagePullResponse.MessagePullResponseItem>;
export declare namespace MessagePullResponse {
interface MessagePullResponseItem {
id?: string;
attempts?: number;
body?: string;
lease_id?: string;
metadata?: unknown;
timestamp_ms?: number;
}
}
export interface MessageAckParams {
/**
* Path param: Identifier
*/
account_id: string;
/**
* Body param:
*/
acks?: Array<MessageAckParams.Ack>;
/**
* Body param:
*/
retries?: Array<MessageAckParams.Retry>;
}
export declare namespace MessageAckParams {
interface Ack {
/**
* Lease ID for a message to acknowledge.
*/
lease_id?: string;
}
interface Retry {
/**
* The number of seconds to delay before making the message available for another
* attempt.
*/
delay_seconds?: number;
/**
* Lease ID for a message to retry.
*/
lease_id?: string;
}
}
export interface MessagePullParams {
/**
* Path param: 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 import MessageAckResponse = MessagesAPI.MessageAckResponse;
export import MessagePullResponse = MessagesAPI.MessagePullResponse;
export import MessageAckParams = MessagesAPI.MessageAckParams;
export import MessagePullParams = MessagesAPI.MessagePullParams;
}
//# sourceMappingURL=messages.d.ts.map