1import * as sns from "@distilled.cloud/aws/sns";
2import * as Effect from "effect/Effect";
3import * as Binding from "../../Binding.ts";
4import type { PlatformApplication } from "./PlatformApplication.ts";
5
6export interface PublishToEndpointRequest extends Omit<
7 sns.PublishInput,
8 "TopicArn" | "PhoneNumber"
9> {}
10
11/**
12 * Runtime binding for `sns:Publish`.
13 *
14 * Runtime binding for `sns:Publish` targeting a mobile-push endpoint of a
15 * {@link PlatformApplication}: pass the device `TargetArn` returned by
16 * `CreatePlatformEndpoint`.
17 * Provide the `PublishToEndpointHttp` layer on the Function to implement the binding.
18 * ### Mobile Push
19 * **Example:** Push to a Device
20 * ```typescript
21 * const publishToEndpoint = yield* SNS.PublishToEndpoint(app);
22 * yield* publishToEndpoint({
23 * TargetArn: endpointArn,
24 * Message: "hello",
25 * });
26 * ```
27 *
28 * @binding
29 */
30export interface PublishToEndpoint extends Binding.Service<
31 PublishToEndpoint,
32 "AWS.SNS.PublishToEndpoint",
33 (
34 application: PlatformApplication,
35 ) => Effect.Effect<
36 (
37 request: PublishToEndpointRequest,
38 ) => Effect.Effect<sns.PublishResponse, sns.PublishError>
39 >
40> {}
41
42export const PublishToEndpoint = Binding.Service<PublishToEndpoint>(
43 "AWS.SNS.PublishToEndpoint",
44);