| 1 | import * as sns from "@distilled.cloud/aws/sns"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | export interface ListTopicsRequest extends sns.ListTopicsInput {} |
| 6 | |
| 7 | /** |
| 8 | * Runtime binding for `sns:ListTopics`. |
| 9 | * |
| 10 | * An account-scoped operation — bind it with no arguments to page through |
| 11 | * all topic ARNs in the account/region. The binding grants the host function |
| 12 | * `sns:ListTopics`. Provide the `ListTopicsHttp` layer on the Function to |
| 13 | * implement the binding. |
| 14 | * ### Listing Topics |
| 15 | * **Example:** List Topic ARNs |
| 16 | * ```typescript |
| 17 | * // init (provide SNS.ListTopicsHttp on the Function) |
| 18 | * const listTopics = yield* SNS.ListTopics(); |
| 19 | * |
| 20 | * // runtime: pass NextToken to page through large accounts |
| 21 | * const response = yield* listTopics(); |
| 22 | * const arns = (response.Topics ?? []).map((topic) => topic.TopicArn); |
| 23 | * ``` |
| 24 | * |
| 25 | * @binding |
| 26 | */ |
| 27 | export interface ListTopics extends Binding.Service< |
| 28 | ListTopics, |
| 29 | "AWS.SNS.ListTopics", |
| 30 | () => Effect.Effect< |
| 31 | ( |
| 32 | request?: ListTopicsRequest, |
| 33 | ) => Effect.Effect<sns.ListTopicsResponse, sns.ListTopicsError> |
| 34 | > |
| 35 | > {} |
| 36 | |
| 37 | export const ListTopics = Binding.Service<ListTopics>("AWS.SNS.ListTopics"); |