sailfork / t3code-github / .repos/ alchemy-effect/ packages/ aws/ src/ SNS/ ListTopics.ts

import * as sns from "@distilled.cloud/aws/sns";
import * as Binding from "alchemy/Binding";
import * as Effect from "effect/Effect";

export interface ListTopicsRequest extends sns.ListTopicsInput {}

/**
 * Runtime binding for `sns:ListTopics`.
 *
 * An account-scoped operation — bind it with no arguments to page through
 * all topic ARNs in the account/region. The binding grants the host function
 * `sns:ListTopics`. Provide the `ListTopicsHttp` layer on the Function to
 * implement the binding.
 * ### Listing Topics
 * **Example:** List Topic ARNs
 * ```typescript
 * // init (provide SNS.ListTopicsHttp on the Function)
 * const listTopics = yield* SNS.ListTopics();
 *
 * // runtime: pass NextToken to page through large accounts
 * const response = yield* listTopics();
 * const arns = (response.Topics ?? []).map((topic) => topic.TopicArn);
 * ```
 *
 * @binding
 */
export interface ListTopics extends Binding.Service<
  ListTopics,
  "AWS.SNS.ListTopics",
  () => Effect.Effect<
    (request?: ListTopicsRequest) => Effect.Effect<sns.ListTopicsResponse, sns.ListTopicsError>
  >
> {}

export const ListTopics = Binding.Service<ListTopics>("AWS.SNS.ListTopics");