import { ContextResolution } from './advanced_context/context_resolvers/advanced_context_resolver'; /** * The response body is parsed as JSON and it's up to the client to ensure it * matches the TReturnType */ interface SupportedSinceInstanceVersion { version: string; resourceName: string; } interface BaseRestRequest<_TReturnType> { type: 'rest'; /** * The request path without `/api/v4` * If you want to make request to `https://gitlab.example/api/v4/projects` * set the path to `/projects` */ path: string; headers?: Record; supportedSinceInstanceVersion?: SupportedSinceInstanceVersion; } interface GraphQLRequest<_TReturnType> { type: 'graphql'; query: string; /** Options passed to the GraphQL query */ variables: Record; supportedSinceInstanceVersion?: SupportedSinceInstanceVersion; } interface PostRequest<_TReturnType> extends BaseRestRequest<_TReturnType> { method: 'POST'; body?: unknown; } /** * The response body is parsed as JSON and it's up to the client to ensure it * matches the TReturnType */ interface GetRequest<_TReturnType> extends BaseRestRequest<_TReturnType> { method: 'GET'; searchParams?: Record; supportedSinceInstanceVersion?: SupportedSinceInstanceVersion; } export type ApiRequest<_TReturnType> = GetRequest<_TReturnType> | PostRequest<_TReturnType> | GraphQLRequest<_TReturnType>; export type AdditionalContext = { /** * The type of the context element. Options: `file` or `snippet`. */ type: 'file' | 'snippet'; /** * The name of the context element. A name of the file or a code snippet. */ name: string; /** * The content of the context element. The body of the file or a function. */ content: string; /** * Where the context was derived from */ resolution_strategy: ContextResolution['strategy']; }; interface ISuggestionOptionModel { lang?: string; engine?: string; name?: string; } export interface SuggestionOption { index?: number; text: string; uniqueTrackingId: string; model?: ISuggestionOptionModel; } export interface TelemetryRequest { event: string; additional_properties: { unique_tracking_id: string; language?: string; suggestion_size?: number; timestamp: string; }; } export {};