@datadog/datadog-api-client
Version:
OpenAPI client for Datadog APIs
212 lines (211 loc) • 8.97 kB
TypeScript
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 { CreateOrUpdateWidgetRequest } from "../models/CreateOrUpdateWidgetRequest";
import { WidgetExperienceType } from "../models/WidgetExperienceType";
import { WidgetListResponse } from "../models/WidgetListResponse";
import { WidgetResponse } from "../models/WidgetResponse";
import { WidgetType } from "../models/WidgetType";
export declare class WidgetsApiRequestFactory extends BaseAPIRequestFactory {
createWidget(experienceType: WidgetExperienceType, body: CreateOrUpdateWidgetRequest, _options?: Configuration): Promise<RequestContext>;
deleteWidget(experienceType: WidgetExperienceType, uuid: string, _options?: Configuration): Promise<RequestContext>;
getWidget(experienceType: WidgetExperienceType, uuid: string, _options?: Configuration): Promise<RequestContext>;
searchWidgets(experienceType: WidgetExperienceType, filterWidgetType?: WidgetType, filterCreatorHandle?: string, filterIsFavorited?: boolean, filterTitle?: string, filterTags?: string, sort?: string, pageNumber?: number, pageSize?: number, _options?: Configuration): Promise<RequestContext>;
updateWidget(experienceType: WidgetExperienceType, uuid: string, body: CreateOrUpdateWidgetRequest, _options?: Configuration): Promise<RequestContext>;
}
export declare class WidgetsApiResponseProcessor {
/**
* 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 createWidget
* @throws ApiException if the response code was not in [200, 299]
*/
createWidget(response: ResponseContext): Promise<WidgetResponse>;
/**
* 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 deleteWidget
* @throws ApiException if the response code was not in [200, 299]
*/
deleteWidget(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 getWidget
* @throws ApiException if the response code was not in [200, 299]
*/
getWidget(response: ResponseContext): Promise<WidgetResponse>;
/**
* 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 searchWidgets
* @throws ApiException if the response code was not in [200, 299]
*/
searchWidgets(response: ResponseContext): Promise<WidgetListResponse>;
/**
* 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 updateWidget
* @throws ApiException if the response code was not in [200, 299]
*/
updateWidget(response: ResponseContext): Promise<WidgetResponse>;
}
export interface WidgetsApiCreateWidgetRequest {
/**
* The experience type for the widget.
* @type WidgetExperienceType
*/
experienceType: WidgetExperienceType;
/**
* Widget request body. The `definition` object's required fields vary
* by `widget.definition.type`: every type requires `requests`, and
* some types require additional fields (e.g. `cloud_cost_summary`
* requires `graph_options`, `geomap` requires `style` and `view`).
* The example below shows a complete `cloud_cost_summary` payload
* for the `ccm_reports` experience type.
* @type CreateOrUpdateWidgetRequest
*/
body: CreateOrUpdateWidgetRequest;
}
export interface WidgetsApiDeleteWidgetRequest {
/**
* The experience type for the widget.
* @type WidgetExperienceType
*/
experienceType: WidgetExperienceType;
/**
* The UUID of the widget.
* @type string
*/
uuid: string;
}
export interface WidgetsApiGetWidgetRequest {
/**
* The experience type for the widget.
* @type WidgetExperienceType
*/
experienceType: WidgetExperienceType;
/**
* The UUID of the widget.
* @type string
*/
uuid: string;
}
export interface WidgetsApiSearchWidgetsRequest {
/**
* The experience type for the widget.
* @type WidgetExperienceType
*/
experienceType: WidgetExperienceType;
/**
* Filter widgets by widget type.
* @type WidgetType
*/
filterWidgetType?: WidgetType;
/**
* Filter widgets by the email handle of the creator.
* @type string
*/
filterCreatorHandle?: string;
/**
* Filter to only widgets favorited by the current user.
* @type boolean
*/
filterIsFavorited?: boolean;
/**
* Filter widgets by title (substring match).
* @type string
*/
filterTitle?: string;
/**
* Filter widgets by tags. Format as bracket-delimited CSV, e.g. `[tag1,tag2]`.
* @type string
*/
filterTags?: string;
/**
* Sort field for the results.
*
* **`title`, `created_at`, `modified_at`** — both ascending and descending are
* supported. Use the bare field name for ascending (e.g. `sort=title`) or prefix
* with `-` for descending (e.g. `sort=-modified_at`).
*
* **`is_favorited`** — returns favorites-first ordering (favorited widgets first,
* then the rest). Direction is fixed; the `-` prefix is ignored for this field.
* @type string
*/
sort?: string;
/**
* Page number for pagination (0-indexed).
* @type number
*/
pageNumber?: number;
/**
* Number of widgets per page.
* @type number
*/
pageSize?: number;
}
export interface WidgetsApiUpdateWidgetRequest {
/**
* The experience type for the widget.
* @type WidgetExperienceType
*/
experienceType: WidgetExperienceType;
/**
* The UUID of the widget.
* @type string
*/
uuid: string;
/**
* Widget request body. The `definition` object's required fields vary
* by `widget.definition.type`; see `CreateWidget` above for a complete
* worked payload. Update is a full replacement of the widget definition.
* @type CreateOrUpdateWidgetRequest
*/
body: CreateOrUpdateWidgetRequest;
}
export declare class WidgetsApi {
private requestFactory;
private responseProcessor;
private configuration;
constructor(configuration: Configuration, requestFactory?: WidgetsApiRequestFactory, responseProcessor?: WidgetsApiResponseProcessor);
/**
* Create a new widget for a given experience type.
* @param param The request object
*/
createWidget(param: WidgetsApiCreateWidgetRequest, options?: Configuration): Promise<WidgetResponse>;
/**
* Soft-delete a widget by its UUID for a given experience type.
* @param param The request object
*/
deleteWidget(param: WidgetsApiDeleteWidgetRequest, options?: Configuration): Promise<void>;
/**
* Retrieve a widget by its UUID for a given experience type.
* @param param The request object
*/
getWidget(param: WidgetsApiGetWidgetRequest, options?: Configuration): Promise<WidgetResponse>;
/**
* Search and list widgets for a given experience type, with filtering, sorting, and pagination.
*
* **Response meta** carries totals scoped to the current filter:
* - `filtered_total` — widgets matching the filter.
* - `created_by_you_total` — among the matches, how many the current user created.
* - `favorited_by_you_total` — among the matches, how many the current user has favorited.
* - `created_by_anyone_total` — total widgets in the experience type, ignoring filters.
*
* Each returned widget includes `is_favorited` reflecting the current user's favorite status.
* Favoriting itself is performed through the shared favorites API, not this endpoint.
* @param param The request object
*/
searchWidgets(param: WidgetsApiSearchWidgetsRequest, options?: Configuration): Promise<WidgetListResponse>;
/**
* Update a widget by its UUID for a given experience type. This performs a full replacement of the widget definition.
* @param param The request object
*/
updateWidget(param: WidgetsApiUpdateWidgetRequest, options?: Configuration): Promise<WidgetResponse>;
}