| 1 | import type * as recaptchaenterprise from "@distilled.cloud/gcp/recaptchaenterprise_v1"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | import type { RuntimeContext } from "../../RuntimeContext.ts"; |
| 5 | import type { Key } from "./Key.ts"; |
| 6 | |
| 7 | export interface CreateAssessmentRequest extends Omit< |
| 8 | recaptchaenterprise.CreateProjectsAssessmentsRequest, |
| 9 | "parent" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for reCAPTCHA Enterprise `assessments.create`. |
| 14 | * |
| 15 | * Bind this operation to a {@link Key} in a Function/Action init phase. |
| 16 | * Provide {@link CreateAssessmentHttp}. The key's site key is filled in |
| 17 | * on `event.siteKey` when omitted. |
| 18 | * |
| 19 | * ### Creating an Assessment |
| 20 | * **Example:** Assess a login event |
| 21 | * ```typescript |
| 22 | * const createAssessment = yield* GCP.RecaptchaEnterprise.CreateAssessment( |
| 23 | * key, |
| 24 | * ); |
| 25 | * const assessment = yield* createAssessment({ |
| 26 | * body: { |
| 27 | * event: { |
| 28 | * token: recaptchaToken, |
| 29 | * expectedAction: "login", |
| 30 | * }, |
| 31 | * }, |
| 32 | * }); |
| 33 | * ``` |
| 34 | * |
| 35 | * @binding |
| 36 | * @category RecaptchaEnterprise |
| 37 | */ |
| 38 | export interface CreateAssessment extends Binding.Service< |
| 39 | CreateAssessment, |
| 40 | "GCP.RecaptchaEnterprise.CreateAssessment", |
| 41 | ( |
| 42 | key: Key, |
| 43 | ) => Effect.Effect< |
| 44 | ( |
| 45 | request?: CreateAssessmentRequest, |
| 46 | ) => Effect.Effect< |
| 47 | recaptchaenterprise.GoogleCloudRecaptchaenterpriseV1Assessment, |
| 48 | recaptchaenterprise.CreateProjectsAssessmentsError, |
| 49 | RuntimeContext |
| 50 | > |
| 51 | > |
| 52 | > {} |
| 53 | |
| 54 | export const CreateAssessment = Binding.Service<CreateAssessment>( |
| 55 | "GCP.RecaptchaEnterprise.CreateAssessment", |
| 56 | ); |