Share via


WidgetServiceClient class

Constructors

WidgetServiceClient(string, TokenCredential, WidgetServiceClientOptions)
WidgetServiceClient(string, WidgetServiceClientOptions)

Methods

analyzeWidget(string, AnalyzeWidgetOptions)

Analyze a widget. The only guarantee is that this method will return a string containing the results of the analysis.

createWidget(number, ColorType, CreateWidgetOptions)

Create a new widget.

The widget ID is not required during creation, as it is automatically set by the server. Providing an ID will result in an error.

deleteWidget(string, DeleteWidgetOptions)

Delete a widget by ID.

getWidget(string, GetWidgetOptions)

Get a widget by ID.

listWidgets(ListWidgetsOptions)

List all widgets in the system. This operation is not paginated, and returns a simple array of widgets.

It does not accept any options or parameters.

updateWidget(string, UpdateWidgetOptions)

Update the contents of the widget. The widget ID is required in the input, but cannot be changed. All other fields are optional and will be updated within the widget if provided.

Constructor Details

WidgetServiceClient(string, TokenCredential, WidgetServiceClientOptions)

new WidgetServiceClient(endpoint: string, credential: TokenCredential, options?: WidgetServiceClientOptions)

Parameters

endpoint

string

credential
TokenCredential

WidgetServiceClient(string, WidgetServiceClientOptions)

new WidgetServiceClient(endpoint: string, options?: WidgetServiceClientOptions)

Parameters

endpoint

string

Method Details

analyzeWidget(string, AnalyzeWidgetOptions)

Analyze a widget. The only guarantee is that this method will return a string containing the results of the analysis.

function analyzeWidget(id: string, options?: AnalyzeWidgetOptions): Promise<AnalyzeResult>

Parameters

id

string

Returns

Promise<AnalyzeResult>

createWidget(number, ColorType, CreateWidgetOptions)

Create a new widget.

The widget ID is not required during creation, as it is automatically set by the server. Providing an ID will result in an error.

function createWidget(weight: number, color: ColorType, options?: CreateWidgetOptions): Promise<Widget>

Parameters

weight

number

color
ColorType

Returns

Promise<Widget>

deleteWidget(string, DeleteWidgetOptions)

Delete a widget by ID.

function deleteWidget(id: string, options?: DeleteWidgetOptions): Promise<void>

Parameters

id

string

Returns

Promise<void>

getWidget(string, GetWidgetOptions)

Get a widget by ID.

function getWidget(id: string, options?: GetWidgetOptions): Promise<Widget>

Parameters

id

string

Returns

Promise<Widget>

listWidgets(ListWidgetsOptions)

List all widgets in the system. This operation is not paginated, and returns a simple array of widgets.

It does not accept any options or parameters.

function listWidgets(options?: ListWidgetsOptions): Promise<Widget[]>

Parameters

Returns

Promise<Widget[]>

updateWidget(string, UpdateWidgetOptions)

Update the contents of the widget. The widget ID is required in the input, but cannot be changed. All other fields are optional and will be updated within the widget if provided.

function updateWidget(id: string, options?: UpdateWidgetOptions): Promise<Widget>

Parameters

id

string

Returns

Promise<Widget>