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

import * as sns from "@distilled.cloud/aws/sns";
import * as Binding from "alchemy/Binding";
import * as Effect from "effect/Effect";
import type { PlatformApplication } from "./PlatformApplication.ts";

export interface CreatePlatformEndpointRequest extends Omit<
  sns.CreatePlatformEndpointInput,
  "PlatformApplicationArn"
> {}

/**
 * Runtime binding for `sns:CreatePlatformEndpoint`.
 *
 * Bind this operation to a {@link PlatformApplication} to register device
 * push tokens at runtime. The `PlatformApplicationArn` is injected
 * automatically; the call is idempotent per token.
 * Provide the `CreatePlatformEndpointHttp` layer on the Function to implement the binding.
 * ### Mobile Push
 * **Example:** Register a Device Token
 * ```typescript
 * const createEndpoint = yield* SNS.CreatePlatformEndpoint(app);
 * const endpoint = yield* createEndpoint({ Token: deviceToken });
 * ```
 *
 * @binding
 */
export interface CreatePlatformEndpoint extends Binding.Service<
  CreatePlatformEndpoint,
  "AWS.SNS.CreatePlatformEndpoint",
  (
    application: PlatformApplication,
  ) => Effect.Effect<
    (
      request: CreatePlatformEndpointRequest,
    ) => Effect.Effect<sns.CreateEndpointResponse, sns.CreatePlatformEndpointError>
  >
> {}

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