| 1 | import type * as developerconnect from "@distilled.cloud/gcp/developerconnect_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 { ConnectionsGitRepositoryLink } from "./ConnectionsGitRepositoryLink.ts"; |
| 6 | |
| 7 | export interface FetchReadWriteTokenRequest extends Omit< |
| 8 | developerconnect.FetchReadWriteTokenProjectsLocationsConnectionsGitRepositoryLinksRequest, |
| 9 | "gitRepositoryLink" |
| 10 | > {} |
| 11 | |
| 12 | /** |
| 13 | * Runtime binding for Developer Connect |
| 14 | * `gitRepositoryLinks.fetchReadWriteToken`. |
| 15 | * |
| 16 | * Bind this operation to a {@link ConnectionsGitRepositoryLink} in a |
| 17 | * Function/Action init phase. Provide {@link FetchReadWriteTokenHttp}. |
| 18 | * Returns a short-lived token that can clone and push to the remote |
| 19 | * Git repository. |
| 20 | * |
| 21 | * ### Fetching a Read/Write Token |
| 22 | * **Example:** Push with a read/write token |
| 23 | * ```typescript |
| 24 | * const fetchReadWriteToken = yield* GCP.DeveloperConnect.FetchReadWriteToken( |
| 25 | * source, |
| 26 | * ); |
| 27 | * const { token, expirationTime } = yield* fetchReadWriteToken(); |
| 28 | * ``` |
| 29 | * |
| 30 | * @binding |
| 31 | * @category DeveloperConnect |
| 32 | */ |
| 33 | export interface FetchReadWriteToken extends Binding.Service< |
| 34 | FetchReadWriteToken, |
| 35 | "GCP.DeveloperConnect.FetchReadWriteToken", |
| 36 | ( |
| 37 | link: ConnectionsGitRepositoryLink, |
| 38 | ) => Effect.Effect< |
| 39 | ( |
| 40 | request?: FetchReadWriteTokenRequest, |
| 41 | ) => Effect.Effect< |
| 42 | developerconnect.FetchReadWriteTokenResponse, |
| 43 | developerconnect.FetchReadWriteTokenProjectsLocationsConnectionsGitRepositoryLinksError, |
| 44 | RuntimeContext |
| 45 | > |
| 46 | > |
| 47 | > {} |
| 48 | |
| 49 | export const FetchReadWriteToken = Binding.Service<FetchReadWriteToken>( |
| 50 | "GCP.DeveloperConnect.FetchReadWriteToken", |
| 51 | ); |