The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 06:00 UTC
| 1 | import * as sns from "@distilled.cloud/aws/sns"; |
| 2 | import * as Binding from "alchemy/Binding"; |
| 3 | import * as Effect from "effect/Effect"; |
| 4 | import type { Topic } from "./Topic.ts"; |
| 5 | |
| 6 | export interface PublishBatchRequest extends Omit<sns.PublishBatchInput, "TopicArn"> {} |
| 7 | |
| 8 | /** |
| 9 | * Runtime binding for `sns:PublishBatch`. |
| 10 | * |
| 11 | * Bind this operation to a {@link Topic} inside a function runtime to publish |
| 12 | * up to 10 messages per call with per-entry success/failure results. The |
| 13 | * binding grants the host function `sns:Publish` on the topic. Provide the |
| 14 | * `PublishBatchHttp` layer on the Function to implement the binding. |
| 15 | * |
| 16 | * For an unbounded stream of messages with automatic batching and bounded |
| 17 | * retry of transient per-entry failures, prefer {@link TopicSink}. |
| 18 | * ### Publishing Message Batches |
| 19 | * **Example:** Publish a Batch of Messages |
| 20 | * ```typescript |
| 21 | * // init (provide SNS.PublishBatchHttp on the Function) |
| 22 | * const publishBatch = yield* SNS.PublishBatch(topic); |
| 23 | * |
| 24 | * // runtime |
| 25 | * const response = yield* publishBatch({ |
| 26 | * PublishBatchRequestEntries: messages.map((message, index) => ({ |
| 27 | * Id: `${index}`, |
| 28 | * Message: message, |
| 29 | * })), |
| 30 | * }); |
| 31 | * // response.Successful / response.Failed |
| 32 | * ``` |
| 33 | * |
| 34 | * @binding |
| 35 | */ |
| 36 | export interface PublishBatch extends Binding.Service< |
| 37 | PublishBatch, |
| 38 | "AWS.SNS.PublishBatch", |
| 39 | ( |
| 40 | topic: Topic, |
| 41 | ) => Effect.Effect< |
| 42 | (request: PublishBatchRequest) => Effect.Effect<sns.PublishBatchResponse, sns.PublishBatchError> |
| 43 | > |
| 44 | > {} |
| 45 | |
| 46 | export const PublishBatch = Binding.Service<PublishBatch>("AWS.SNS.PublishBatch"); |