summaryrefslogtreecommitdiff
path: root/packages/core/src/code_assist/onboard.ts
diff options
context:
space:
mode:
authorTommaso Sciortino <[email protected]>2025-06-10 16:00:13 -0700
committerGitHub <[email protected]>2025-06-10 16:00:13 -0700
commitd79dafc57715a014e71884f3ba4e7d82b0bb228c (patch)
tree6b2a300380478bd709347a06c9b8371d861ccab5 /packages/core/src/code_assist/onboard.ts
parent4e84431df3e5737a0687af59853504a4e5b9ae51 (diff)
Basic code assist support (#910)
Diffstat (limited to 'packages/core/src/code_assist/onboard.ts')
-rw-r--r--packages/core/src/code_assist/onboard.ts90
1 files changed, 0 insertions, 90 deletions
diff --git a/packages/core/src/code_assist/onboard.ts b/packages/core/src/code_assist/onboard.ts
deleted file mode 100644
index fc04fe35..00000000
--- a/packages/core/src/code_assist/onboard.ts
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * @license
- * Copyright 2025 Google LLC
- * SPDX-License-Identifier: Apache-2.0
- */
-
-import { OAuth2Client } from 'google-auth-library';
-
-import { ClientMetadata } from './metadata.js';
-import { DEFAULT_ENDPOINT } from './constants.js';
-
-const ONBOARD_USER_ENDPOINT = '/v1internal:onboardUser';
-
-export async function doOnboardUser(
- req: OnboardUserRequest,
- oauth2Client: OAuth2Client,
-): Promise<LongrunningOperationResponse> {
- console.log('OnboardUser req: ', JSON.stringify(req));
- const authHeaders = await oauth2Client.getRequestHeaders();
- const headers = { 'Content-Type': 'application/json', ...authHeaders };
- const res: Response = await fetch(
- new URL(ONBOARD_USER_ENDPOINT, DEFAULT_ENDPOINT),
- {
- method: 'POST',
- headers,
- body: JSON.stringify(req),
- },
- );
- const data: LongrunningOperationResponse =
- (await res.json()) as LongrunningOperationResponse;
- console.log('OnboardUser res: ', JSON.stringify(data));
- return data;
-}
-
-/**
- * Proto signature of OnboardUserRequest as payload to OnboardUser call
- */
-export interface OnboardUserRequest {
- tierId: string | undefined;
- cloudaicompanionProject: string | undefined;
- metadata: ClientMetadata | undefined;
-}
-
-/**
- * Represents LongrunningOperation proto
- * http://google3/google/longrunning/operations.proto;rcl=698857719;l=107
- */
-export interface LongrunningOperationResponse {
- name: string;
- done?: boolean;
- response?: OnboardUserResponse;
-}
-
-/**
- * Represents OnboardUserResponse proto
- * http://google3/google/internal/cloud/code/v1internal/cloudcode.proto;l=215
- */
-export interface OnboardUserResponse {
- // tslint:disable-next-line:enforce-name-casing This is the name of the field in the proto.
- cloudaicompanionProject?: {
- id: string;
- name: string;
- };
-}
-
-/**
- * Status code of user license status
- * it does not stricly correspond to the proto
- * Error value is an additional value assigned to error responses from OnboardUser
- */
-export enum OnboardUserStatusCode {
- Default = 'DEFAULT',
- Notice = 'NOTICE',
- Warning = 'WARNING',
- Error = 'ERROR',
-}
-
-/**
- * Status of user onboarded to gemini
- */
-export interface OnboardUserStatus {
- statusCode: OnboardUserStatusCode;
- displayMessage: string;
- helpLink: HelpLinkUrl | undefined;
-}
-
-export interface HelpLinkUrl {
- description: string;
- url: string;
-}