| 1 | import * as sns from "@distilled.cloud/aws/sns"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { Topic } from "./Topic.ts"; |
| 5 | |
| 6 | export interface ListSubscriptionsByTopicRequest extends Omit< |
| 7 | sns.ListSubscriptionsByTopicInput, |
| 8 | "TopicArn" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `sns:ListSubscriptionsByTopic`. |
| 13 | * |
| 14 | * Bind this operation to a {@link Topic} inside a function runtime to page |
| 15 | * through that topic's subscriptions; the `TopicArn` is injected |
| 16 | * automatically. The binding grants the host function |
| 17 | * `sns:ListSubscriptionsByTopic` on the topic. Provide the |
| 18 | * `ListSubscriptionsByTopicHttp` layer on the Function to implement the |
| 19 | * binding. |
| 20 | * ### Listing a Topic's Subscriptions |
| 21 | * **Example:** List Subscriptions of a Topic |
| 22 | * ```typescript |
| 23 | * // init (provide SNS.ListSubscriptionsByTopicHttp on the Function) |
| 24 | * const listSubscriptionsByTopic = yield* SNS.ListSubscriptionsByTopic(topic); |
| 25 | * |
| 26 | * // runtime |
| 27 | * const response = yield* listSubscriptionsByTopic(); |
| 28 | * const endpoints = (response.Subscriptions ?? []).map((s) => s.Endpoint); |
| 29 | * ``` |
| 30 | * |
| 31 | * @binding |
| 32 | */ |
| 33 | export interface ListSubscriptionsByTopic extends Binding.Service< |
| 34 | ListSubscriptionsByTopic, |
| 35 | "AWS.SNS.ListSubscriptionsByTopic", |
| 36 | ( |
| 37 | topic: Topic, |
| 38 | ) => Effect.Effect< |
| 39 | ( |
| 40 | request?: ListSubscriptionsByTopicRequest, |
| 41 | ) => Effect.Effect< |
| 42 | sns.ListSubscriptionsByTopicResponse, |
| 43 | sns.ListSubscriptionsByTopicError |
| 44 | > |
| 45 | > |
| 46 | > {} |
| 47 | export const ListSubscriptionsByTopic = |
| 48 | Binding.Service<ListSubscriptionsByTopic>("AWS.SNS.ListSubscriptionsByTopic"); |