| 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 { PlatformApplication } from "./PlatformApplication.ts"; |
| 5 | |
| 6 | export interface CreatePlatformEndpointRequest extends Omit< |
| 7 | sns.CreatePlatformEndpointInput, |
| 8 | "PlatformApplicationArn" |
| 9 | > {} |
| 10 | |
| 11 | /** |
| 12 | * Runtime binding for `sns:CreatePlatformEndpoint`. |
| 13 | * |
| 14 | * Bind this operation to a {@link PlatformApplication} to register device |
| 15 | * push tokens at runtime. The `PlatformApplicationArn` is injected |
| 16 | * automatically; the call is idempotent per token. |
| 17 | * Provide the `CreatePlatformEndpointHttp` layer on the Function to implement the binding. |
| 18 | * ### Mobile Push |
| 19 | * **Example:** Register a Device Token |
| 20 | * ```typescript |
| 21 | * const createEndpoint = yield* SNS.CreatePlatformEndpoint(app); |
| 22 | * const endpoint = yield* createEndpoint({ Token: deviceToken }); |
| 23 | * ``` |
| 24 | * |
| 25 | * @binding |
| 26 | */ |
| 27 | export interface CreatePlatformEndpoint extends Binding.Service< |
| 28 | CreatePlatformEndpoint, |
| 29 | "AWS.SNS.CreatePlatformEndpoint", |
| 30 | ( |
| 31 | application: PlatformApplication, |
| 32 | ) => Effect.Effect< |
| 33 | ( |
| 34 | request: CreatePlatformEndpointRequest, |
| 35 | ) => Effect.Effect< |
| 36 | sns.CreateEndpointResponse, |
| 37 | sns.CreatePlatformEndpointError |
| 38 | > |
| 39 | > |
| 40 | > {} |
| 41 | |
| 42 | export const CreatePlatformEndpoint = Binding.Service<CreatePlatformEndpoint>( |
| 43 | "AWS.SNS.CreatePlatformEndpoint", |
| 44 | ); |