| 1 | import * as translate from "@distilled.cloud/gcp/translate_v3"; |
| 2 | import * as Layer from "effect/Layer"; |
| 3 | import { locationParentOf, makeTranslateTextBinding } from "./BindingHttp.ts"; |
| 4 | import { TranslateText } from "./TranslateText.ts"; |
| 5 | |
| 6 | /** |
| 7 | * HTTP implementation of {@link TranslateText}. |
| 8 | * |
| 9 | * @layer |
| 10 | * @provides GCP.Translate.TranslateText |
| 11 | */ |
| 12 | export const TranslateTextHttp = Layer.effect( |
| 13 | TranslateText, |
| 14 | makeTranslateTextBinding({ |
| 15 | tag: "GCP.Translate.TranslateText", |
| 16 | operation: translate.translateTextProjectsLocations, |
| 17 | iam: { role: "roles/cloudtranslate.user" }, |
| 18 | withBody: (name, request) => ({ |
| 19 | parent: locationParentOf(name), |
| 20 | body: { |
| 21 | ...(request?.body ?? {}), |
| 22 | model: name, |
| 23 | }, |
| 24 | }), |
| 25 | }), |
| 26 | ); |