UNPKG

@datadog/datadog-api-client

Version:
163 lines (162 loc) 7.38 kB
import { BaseAPIRequestFactory } from "../../datadog-api-client-common/baseapi"; import { Configuration } from "../../datadog-api-client-common/configuration"; import { RequestContext, ResponseContext } from "../../datadog-api-client-common/http/http"; import { AnnotationCreateRequest } from "../models/AnnotationCreateRequest"; import { AnnotationResponse } from "../models/AnnotationResponse"; import { AnnotationsResponse } from "../models/AnnotationsResponse"; import { AnnotationUpdateRequest } from "../models/AnnotationUpdateRequest"; import { PageAnnotationsResponse } from "../models/PageAnnotationsResponse"; export declare class AnnotationsApiRequestFactory extends BaseAPIRequestFactory { createAnnotation(body: AnnotationCreateRequest, _options?: Configuration): Promise<RequestContext>; deleteAnnotation(annotationId: string, _options?: Configuration): Promise<RequestContext>; getPageAnnotations(pageId: string, startTime: number, endTime: number, _options?: Configuration): Promise<RequestContext>; listAnnotations(pageId: string, startTime: number, endTime: number, widgetId?: string, _options?: Configuration): Promise<RequestContext>; updateAnnotation(annotationId: string, body: AnnotationUpdateRequest, _options?: Configuration): Promise<RequestContext>; } export declare class AnnotationsApiResponseProcessor { /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to createAnnotation * @throws ApiException if the response code was not in [200, 299] */ createAnnotation(response: ResponseContext): Promise<AnnotationResponse>; /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to deleteAnnotation * @throws ApiException if the response code was not in [200, 299] */ deleteAnnotation(response: ResponseContext): Promise<void>; /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to getPageAnnotations * @throws ApiException if the response code was not in [200, 299] */ getPageAnnotations(response: ResponseContext): Promise<PageAnnotationsResponse>; /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to listAnnotations * @throws ApiException if the response code was not in [200, 299] */ listAnnotations(response: ResponseContext): Promise<AnnotationsResponse>; /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to updateAnnotation * @throws ApiException if the response code was not in [200, 299] */ updateAnnotation(response: ResponseContext): Promise<AnnotationResponse>; } export interface AnnotationsApiCreateAnnotationRequest { /** * Annotation to create. * @type AnnotationCreateRequest */ body: AnnotationCreateRequest; } export interface AnnotationsApiDeleteAnnotationRequest { /** * The ID of the annotation. * @type string */ annotationId: string; } export interface AnnotationsApiGetPageAnnotationsRequest { /** * The ID of the page, prefixed with the page type and joined by a colon * (for example, `dashboard:abc-def-xyz` or `notebook:1234567890`). * @type string */ pageId: string; /** * Start of the time window in milliseconds since the Unix epoch. * @type number */ startTime: number; /** * End of the time window in milliseconds since the Unix epoch. * @type number */ endTime: number; } export interface AnnotationsApiListAnnotationsRequest { /** * ID of the page to list annotations for, prefixed with the page type and joined by a colon * (for example, `dashboard:abc-def-xyz` or `notebook:1234567890`). * @type string */ pageId: string; /** * Start of the time window in milliseconds since the Unix epoch. * @type number */ startTime: number; /** * End of the time window in milliseconds since the Unix epoch. * @type number */ endTime: number; /** * Optional widget ID to restrict results to annotations on a specific widget. * @type string */ widgetId?: string; } export interface AnnotationsApiUpdateAnnotationRequest { /** * The ID of the annotation. * @type string */ annotationId: string; /** * Updated annotation payload. * @type AnnotationUpdateRequest */ body: AnnotationUpdateRequest; } export declare class AnnotationsApi { private requestFactory; private responseProcessor; private configuration; constructor(configuration: Configuration, requestFactory?: AnnotationsApiRequestFactory, responseProcessor?: AnnotationsApiResponseProcessor); /** * Creates a new annotation on a dashboard or notebook page. * Valid `color` values: `gray`, `blue`, `purple`, `green`, `yellow`, `red`. * Valid `type` values: `pointInTime` (marks a single moment) or `timeRegion` (spans a range and requires `end_time`). * @param param The request object */ createAnnotation(param: AnnotationsApiCreateAnnotationRequest, options?: Configuration): Promise<AnnotationResponse>; /** * Deletes an existing annotation by ID. * Returns `204 No Content` if the annotation does not exist (idempotent). * @param param The request object */ deleteAnnotation(param: AnnotationsApiDeleteAnnotationRequest, options?: Configuration): Promise<void>; /** * Returns all annotations on a specific page for a given time window, grouped by widget. * Unlike `ListAnnotations`, this endpoint returns a single structured object with annotations * indexed by their ID and a widget-to-annotation mapping for easy UI rendering. * @param param The request object */ getPageAnnotations(param: AnnotationsApiGetPageAnnotationsRequest, options?: Configuration): Promise<PageAnnotationsResponse>; /** * Returns a flat list of annotations matching the given page, time window, and optional widget filter. * @param param The request object */ listAnnotations(param: AnnotationsApiListAnnotationsRequest, options?: Configuration): Promise<AnnotationsResponse>; /** * Updates an existing annotation. * Valid `color` values: `gray`, `blue`, `purple`, `green`, `yellow`, `red`. * Valid `type` values: `pointInTime` (marks a single moment) or `timeRegion` (spans a range and requires `end_time`). * @param param The request object */ updateAnnotation(param: AnnotationsApiUpdateAnnotationRequest, options?: Configuration): Promise<AnnotationResponse>; }