@azure/template-dpg 1.0.0-alpha.20241112.5 → 1.0.0-alpha.20241114.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/template-dpg",
3
- "version": "1.0.0-alpha.20241112.5",
3
+ "version": "1.0.0-alpha.20241114.1",
4
4
  "description": "Widget Service",
5
5
  "sdk-type": "client",
6
6
  "main": "dist/index.js",
@@ -1,51 +1,39 @@
1
+ import type { Client } from '@azure-rest/core-client';
1
2
  import type { ClientOptions } from '@azure-rest/core-client';
2
- import type { RawHttpHeadersInput } from '@azure/core-rest-pipeline';
3
+ import type { HttpResponse } from '@azure-rest/core-client';
4
+ import type { RequestParameters } from '@azure-rest/core-client';
5
+ import type { StreamableMethod } from '@azure-rest/core-client';
3
6
  import type { TokenCredential } from '@azure/core-auth';
4
7
 
5
- /** */
6
- export declare interface AnalyzeResult {
7
- /** */
8
+ export declare interface AnalyzeResultOutput {
8
9
  summary: string;
9
10
  }
10
11
 
11
- export declare interface AnalyzeWidgetOptions extends RequestOptions {
12
- }
13
-
14
- /** Type of ColorType */
15
- /** */
16
- export declare type ColorType = "red" | "blue";
17
-
18
- export declare interface CreateWidgetOptions extends RequestOptions {
12
+ export declare interface AnalyzeWidget {
13
+ /** Analyze a widget. The only guarantee is that this method will return a string containing the results of the analysis. */
14
+ post(options?: AnalyzeWidgetParameters): StreamableMethod<AnalyzeWidget200Response | AnalyzeWidgetDefaultResponse>;
19
15
  }
20
16
 
21
- export declare interface DeleteWidgetOptions extends RequestOptions {
17
+ /** The request has succeeded. */
18
+ export declare interface AnalyzeWidget200Response extends HttpResponse {
19
+ status: "200";
20
+ body: AnalyzeResultOutput;
22
21
  }
23
22
 
24
- export declare interface GetWidgetOptions extends RequestOptions {
23
+ export declare interface AnalyzeWidgetDefaultResponse extends HttpResponse {
24
+ status: string;
25
+ body: WidgetErrorOutput;
25
26
  }
26
27
 
27
- export declare interface ListWidgetsOptions extends RequestOptions {
28
- }
28
+ export declare type AnalyzeWidgetParameters = RequestParameters;
29
29
 
30
- export declare interface RequestOptions {
31
- requestOptions?: {
32
- /**
33
- * Headers to send along with the request
34
- */
35
- headers?: RawHttpHeadersInput;
36
- /** Set to true if the request is sent over HTTP instead of HTTPS */
37
- allowInsecureConnection?: boolean;
38
- /** Set to true if you want to skip encoding the path parameters */
39
- skipUrlEncoding?: boolean;
40
- };
41
- }
30
+ /**
31
+ * This customization adds credential support to the client. And overloads for when it is optional
32
+ */
33
+ declare function createClient(endpoint: string, credential: TokenCredential, options?: ClientOptions): WidgetServiceContext;
42
34
 
43
- export declare interface UpdateWidgetOptions extends RequestOptions {
44
- /** The weight of the widget. This is an int32, but must be greater than zero. */
45
- weight?: number;
46
- /** The color of the widget. */
47
- color?: ColorType;
48
- }
35
+ declare function createClient(endpoint: string, options?: ClientOptions): WidgetServiceContext;
36
+ export default createClient;
49
37
 
50
38
  /**
51
39
  * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!
@@ -54,48 +42,166 @@ export declare interface UpdateWidgetOptions extends RequestOptions {
54
42
  *
55
43
  * If you need to make changes, please do so in the original source file, \{project-root\}/sources/custom
56
44
  */
57
- /** */
58
- export declare interface Widget {
59
- /** The UUID of this widget. This is generated automatically by the service. */
60
- id: string;
45
+ export declare interface CreateWidget {
61
46
  /** The weight of the widget. This is an int32, but must be greater than zero. */
62
47
  weight: number;
63
48
  /** The color of the widget. */
64
- color: ColorType;
49
+ color: "red" | "blue";
65
50
  }
66
51
 
67
- export declare class WidgetServiceClient {
68
- private _client;
69
- /** */
70
- constructor(endpoint: string, options?: WidgetServiceClientOptions);
71
- constructor(endpoint: string, credential: TokenCredential, options?: WidgetServiceClientOptions);
52
+ /** The request has succeeded and a new resource has been created as a result. */
53
+ export declare interface CreateWidget201Response extends HttpResponse {
54
+ status: "201";
55
+ body: WidgetOutput;
56
+ }
57
+
58
+ export declare interface CreateWidgetBodyParam {
59
+ body?: CreateWidget;
60
+ }
61
+
62
+ export declare interface CreateWidgetDefaultResponse extends HttpResponse {
63
+ status: string;
64
+ body: WidgetErrorOutput;
65
+ }
66
+
67
+ export declare type CreateWidgetParameters = CreateWidgetBodyParam & RequestParameters;
68
+
69
+ /** There is no content to send for this request, but the headers may be useful. */
70
+ export declare interface DeleteWidget204Response extends HttpResponse {
71
+ status: "204";
72
+ }
73
+
74
+ export declare interface DeleteWidgetDefaultResponse extends HttpResponse {
75
+ status: string;
76
+ body: WidgetErrorOutput;
77
+ }
78
+
79
+ export declare type DeleteWidgetParameters = RequestParameters;
80
+
81
+ export declare interface GetWidget {
82
+ /** Get a widget by ID. */
83
+ get(options?: GetWidgetParameters): StreamableMethod<GetWidget200Response | GetWidgetDefaultResponse>;
84
+ /**
85
+ * Update the contents of the widget. The widget ID is required in the input, but cannot be changed. All other fields
86
+ * are optional and will be updated within the widget if provided.
87
+ */
88
+ patch(options?: UpdateWidgetParameters): StreamableMethod<UpdateWidget200Response | UpdateWidgetDefaultResponse>;
89
+ /** Delete a widget by ID. */
90
+ delete(options?: DeleteWidgetParameters): StreamableMethod<DeleteWidget204Response | DeleteWidgetDefaultResponse>;
91
+ }
92
+
93
+ /** The request has succeeded. */
94
+ export declare interface GetWidget200Response extends HttpResponse {
95
+ status: "200";
96
+ body: WidgetOutput;
97
+ }
98
+
99
+ export declare interface GetWidgetDefaultResponse extends HttpResponse {
100
+ status: string;
101
+ body: WidgetErrorOutput;
102
+ }
103
+
104
+ export declare type GetWidgetParameters = RequestParameters;
105
+
106
+ export declare function isUnexpected(response: ListWidgets200Response | ListWidgetsDefaultResponse): response is ListWidgetsDefaultResponse;
107
+
108
+ export declare function isUnexpected(response: CreateWidget201Response | CreateWidgetDefaultResponse): response is CreateWidgetDefaultResponse;
109
+
110
+ export declare function isUnexpected(response: GetWidget200Response | GetWidgetDefaultResponse): response is GetWidgetDefaultResponse;
111
+
112
+ export declare function isUnexpected(response: UpdateWidget200Response | UpdateWidgetDefaultResponse): response is UpdateWidgetDefaultResponse;
113
+
114
+ export declare function isUnexpected(response: DeleteWidget204Response | DeleteWidgetDefaultResponse): response is DeleteWidgetDefaultResponse;
115
+
116
+ export declare function isUnexpected(response: AnalyzeWidget200Response | AnalyzeWidgetDefaultResponse): response is AnalyzeWidgetDefaultResponse;
117
+
118
+ export declare interface ListWidgets {
72
119
  /**
73
120
  * List all widgets in the system. This operation is not paginated, and returns a simple array of widgets.
74
121
  *
75
122
  * It does not accept any options or parameters.
76
123
  */
77
- listWidgets(options?: ListWidgetsOptions): Promise<Widget[]>;
78
- /** Get a widget by ID. */
79
- getWidget(id: string, options?: GetWidgetOptions): Promise<Widget>;
124
+ get(options?: ListWidgetsParameters): StreamableMethod<ListWidgets200Response | ListWidgetsDefaultResponse>;
80
125
  /**
81
126
  * Create a new widget.
82
127
  *
83
128
  * The widget ID is not required during creation, as it is automatically set by the server. Providing an ID will
84
129
  * result in an error.
85
130
  */
86
- createWidget(weight: number, color: ColorType, options?: CreateWidgetOptions): Promise<Widget>;
87
- /**
88
- * Update the contents of the widget. The widget ID is required in the input, but cannot be changed. All other fields
89
- * are optional and will be updated within the widget if provided.
90
- */
91
- updateWidget(id: string, options?: UpdateWidgetOptions): Promise<Widget>;
92
- /** Delete a widget by ID. */
93
- deleteWidget(id: string, options?: DeleteWidgetOptions): Promise<void>;
94
- /** Analyze a widget. The only guarantee is that this method will return a string containing the results of the analysis. */
95
- analyzeWidget(id: string, options?: AnalyzeWidgetOptions): Promise<AnalyzeResult>;
131
+ post(options?: CreateWidgetParameters): StreamableMethod<CreateWidget201Response | CreateWidgetDefaultResponse>;
132
+ }
133
+
134
+ /** The request has succeeded. */
135
+ export declare interface ListWidgets200Response extends HttpResponse {
136
+ status: "200";
137
+ body: Array<WidgetOutput>;
96
138
  }
97
139
 
98
- export declare interface WidgetServiceClientOptions extends ClientOptions {
140
+ export declare interface ListWidgetsDefaultResponse extends HttpResponse {
141
+ status: string;
142
+ body: WidgetErrorOutput;
99
143
  }
100
144
 
145
+ export declare type ListWidgetsParameters = RequestParameters;
146
+
147
+ export declare interface Routes {
148
+ /** Resource for '/widgets' has methods for the following verbs: get, post */
149
+ (path: "/widgets"): ListWidgets;
150
+ /** Resource for '/widgets/\{id\}' has methods for the following verbs: get, patch, delete */
151
+ (path: "/widgets/{id}", id: string): GetWidget;
152
+ /** Resource for '/widgets/\{id\}/analyze' has methods for the following verbs: post */
153
+ (path: "/widgets/{id}/analyze", id: string): AnalyzeWidget;
154
+ }
155
+
156
+ export declare interface UpdateWidget {
157
+ /** The weight of the widget. This is an int32, but must be greater than zero. */
158
+ weight?: number;
159
+ /** The color of the widget. */
160
+ color?: "red" | "blue";
161
+ }
162
+
163
+ /** The request has succeeded. */
164
+ export declare interface UpdateWidget200Response extends HttpResponse {
165
+ status: "200";
166
+ body: WidgetOutput;
167
+ }
168
+
169
+ export declare interface UpdateWidgetBodyParam {
170
+ body?: UpdateWidget;
171
+ }
172
+
173
+ export declare interface UpdateWidgetDefaultResponse extends HttpResponse {
174
+ status: string;
175
+ body: WidgetErrorOutput;
176
+ }
177
+
178
+ export declare type UpdateWidgetParameters = UpdateWidgetBodyParam & RequestParameters;
179
+
180
+ export declare interface WidgetErrorOutput {
181
+ /** The HTTP error code. */
182
+ code: number;
183
+ /** A human-readable message describing the error. */
184
+ message: string;
185
+ }
186
+
187
+ /**
188
+ * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!
189
+ *
190
+ * Any changes you make here may be lost.
191
+ *
192
+ * If you need to make changes, please do so in the original source file, \{project-root\}/sources/custom
193
+ */
194
+ export declare interface WidgetOutput {
195
+ /** The UUID of this widget. This is generated automatically by the service. */
196
+ id: string;
197
+ /** The weight of the widget. This is an int32, but must be greater than zero. */
198
+ weight: number;
199
+ /** The color of the widget. */
200
+ color: "red" | "blue";
201
+ }
202
+
203
+ export declare type WidgetServiceContext = Client & {
204
+ path: Routes;
205
+ };
206
+
101
207
  export { }
@@ -1,293 +0,0 @@
1
- import type { Client } from '@azure-rest/core-client';
2
- import type { ClientOptions } from '@azure-rest/core-client';
3
- import type { HttpResponse } from '@azure-rest/core-client';
4
- import type { RawHttpHeadersInput } from '@azure/core-rest-pipeline';
5
- import type { RequestParameters } from '@azure-rest/core-client';
6
- import type { StreamableMethod } from '@azure-rest/core-client';
7
- import type { TokenCredential } from '@azure/core-auth';
8
-
9
- /** */
10
- export declare interface AnalyzeResult {
11
- /** */
12
- summary: string;
13
- }
14
-
15
- declare interface AnalyzeResultOutput {
16
- summary: string;
17
- }
18
-
19
- declare interface AnalyzeWidget {
20
- /** Analyze a widget. The only guarantee is that this method will return a string containing the results of the analysis. */
21
- post(options?: AnalyzeWidgetParameters): StreamableMethod<AnalyzeWidget200Response | AnalyzeWidgetDefaultResponse>;
22
- }
23
-
24
- /**
25
- * In this customization we will perform the following tasks in addition to the generated:
26
- * - We are going to add special error handling for demonstration purposes
27
- */
28
- export declare function analyzeWidget(context: WidgetServiceContext, id: string, options?: AnalyzeWidgetOptions): Promise<AnalyzeResult>;
29
-
30
- /** The request has succeeded. */
31
- declare interface AnalyzeWidget200Response extends HttpResponse {
32
- status: "200";
33
- body: AnalyzeResultOutput;
34
- }
35
-
36
- declare interface AnalyzeWidgetDefaultResponse extends HttpResponse {
37
- status: string;
38
- body: WidgetErrorOutput;
39
- }
40
-
41
- export declare interface AnalyzeWidgetOptions extends RequestOptions {
42
- }
43
-
44
- declare type AnalyzeWidgetParameters = RequestParameters;
45
-
46
- /** Type of ColorType */
47
- /** */
48
- export declare type ColorType = "red" | "blue";
49
-
50
- /**
51
- * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!
52
- *
53
- * Any changes you make here may be lost.
54
- *
55
- * If you need to make changes, please do so in the original source file, \{project-root\}/sources/custom
56
- */
57
- declare interface CreateWidget {
58
- /** The weight of the widget. This is an int32, but must be greater than zero. */
59
- weight: number;
60
- /** The color of the widget. */
61
- color: "red" | "blue";
62
- }
63
-
64
- /**
65
- * Create a new widget.
66
- *
67
- * The widget ID is not required during creation, as it is automatically set by the server. Providing an ID will
68
- * result in an error.
69
- */
70
- export declare function createWidget(context: WidgetServiceContext, weight: number, color: ColorType, options?: CreateWidgetOptions): Promise<Widget>;
71
-
72
- /** The request has succeeded and a new resource has been created as a result. */
73
- declare interface CreateWidget201Response extends HttpResponse {
74
- status: "201";
75
- body: WidgetOutput;
76
- }
77
-
78
- declare interface CreateWidgetBodyParam {
79
- body?: CreateWidget;
80
- }
81
-
82
- declare interface CreateWidgetDefaultResponse extends HttpResponse {
83
- status: string;
84
- body: WidgetErrorOutput;
85
- }
86
-
87
- export declare interface CreateWidgetOptions extends RequestOptions {
88
- }
89
-
90
- declare type CreateWidgetParameters = CreateWidgetBodyParam & RequestParameters;
91
-
92
- /**
93
- * This customization adds authentication to the client.
94
- */
95
- export declare function createWidgetService(endpoint: string, options?: ClientOptions): WidgetServiceContext;
96
-
97
- export declare function createWidgetService(endpoint: string, credential: TokenCredential, options?: ClientOptions): WidgetServiceContext;
98
-
99
- /** Delete a widget by ID. */
100
- export declare function deleteWidget(context: WidgetServiceContext, id: string, options?: DeleteWidgetOptions): Promise<void>;
101
-
102
- /** There is no content to send for this request, but the headers may be useful. */
103
- declare interface DeleteWidget204Response extends HttpResponse {
104
- status: "204";
105
- }
106
-
107
- declare interface DeleteWidgetDefaultResponse extends HttpResponse {
108
- status: string;
109
- body: WidgetErrorOutput;
110
- }
111
-
112
- export declare interface DeleteWidgetOptions extends RequestOptions {
113
- }
114
-
115
- declare type DeleteWidgetParameters = RequestParameters;
116
-
117
- declare interface GetWidget {
118
- /** Get a widget by ID. */
119
- get(options?: GetWidgetParameters): StreamableMethod<GetWidget200Response | GetWidgetDefaultResponse>;
120
- /**
121
- * Update the contents of the widget. The widget ID is required in the input, but cannot be changed. All other fields
122
- * are optional and will be updated within the widget if provided.
123
- */
124
- patch(options?: UpdateWidgetParameters): StreamableMethod<UpdateWidget200Response | UpdateWidgetDefaultResponse>;
125
- /** Delete a widget by ID. */
126
- delete(options?: DeleteWidgetParameters): StreamableMethod<DeleteWidget204Response | DeleteWidgetDefaultResponse>;
127
- }
128
-
129
- /** Get a widget by ID. */
130
- export declare function getWidget(context: WidgetServiceContext, id: string, options?: GetWidgetOptions): Promise<Widget>;
131
-
132
- /** The request has succeeded. */
133
- declare interface GetWidget200Response extends HttpResponse {
134
- status: "200";
135
- body: WidgetOutput;
136
- }
137
-
138
- declare interface GetWidgetDefaultResponse extends HttpResponse {
139
- status: string;
140
- body: WidgetErrorOutput;
141
- }
142
-
143
- export declare interface GetWidgetOptions extends RequestOptions {
144
- }
145
-
146
- declare type GetWidgetParameters = RequestParameters;
147
-
148
- declare interface ListWidgets {
149
- /**
150
- * List all widgets in the system. This operation is not paginated, and returns a simple array of widgets.
151
- *
152
- * It does not accept any options or parameters.
153
- */
154
- get(options?: ListWidgetsParameters): StreamableMethod<ListWidgets200Response | ListWidgetsDefaultResponse>;
155
- /**
156
- * Create a new widget.
157
- *
158
- * The widget ID is not required during creation, as it is automatically set by the server. Providing an ID will
159
- * result in an error.
160
- */
161
- post(options?: CreateWidgetParameters): StreamableMethod<CreateWidget201Response | CreateWidgetDefaultResponse>;
162
- }
163
-
164
- /**
165
- * List all widgets in the system. This operation is not paginated, and returns a simple array of widgets.
166
- *
167
- * It does not accept any options or parameters.
168
- */
169
- export declare function listWidgets(context: WidgetServiceContext, options?: ListWidgetsOptions): Promise<Widget[]>;
170
-
171
- /** The request has succeeded. */
172
- declare interface ListWidgets200Response extends HttpResponse {
173
- status: "200";
174
- body: Array<WidgetOutput>;
175
- }
176
-
177
- declare interface ListWidgetsDefaultResponse extends HttpResponse {
178
- status: string;
179
- body: WidgetErrorOutput;
180
- }
181
-
182
- export declare interface ListWidgetsOptions extends RequestOptions {
183
- }
184
-
185
- declare type ListWidgetsParameters = RequestParameters;
186
-
187
- declare interface RequestOptions {
188
- requestOptions?: {
189
- /**
190
- * Headers to send along with the request
191
- */
192
- headers?: RawHttpHeadersInput;
193
- /** Set to true if the request is sent over HTTP instead of HTTPS */
194
- allowInsecureConnection?: boolean;
195
- /** Set to true if you want to skip encoding the path parameters */
196
- skipUrlEncoding?: boolean;
197
- };
198
- }
199
-
200
- declare interface Routes {
201
- /** Resource for '/widgets' has methods for the following verbs: get, post */
202
- (path: "/widgets"): ListWidgets;
203
- /** Resource for '/widgets/\{id\}' has methods for the following verbs: get, patch, delete */
204
- (path: "/widgets/{id}", id: string): GetWidget;
205
- /** Resource for '/widgets/\{id\}/analyze' has methods for the following verbs: post */
206
- (path: "/widgets/{id}/analyze", id: string): AnalyzeWidget;
207
- }
208
-
209
- declare interface UpdateWidget {
210
- /** The weight of the widget. This is an int32, but must be greater than zero. */
211
- weight?: number;
212
- /** The color of the widget. */
213
- color?: "red" | "blue";
214
- }
215
-
216
- /**
217
- * Update the contents of the widget. The widget ID is required in the input, but cannot be changed. All other fields
218
- * are optional and will be updated within the widget if provided.
219
- */
220
- export declare function updateWidget(context: WidgetServiceContext, id: string, options?: UpdateWidgetOptions): Promise<Widget>;
221
-
222
- /** The request has succeeded. */
223
- declare interface UpdateWidget200Response extends HttpResponse {
224
- status: "200";
225
- body: WidgetOutput;
226
- }
227
-
228
- declare interface UpdateWidgetBodyParam {
229
- body?: UpdateWidget;
230
- }
231
-
232
- declare interface UpdateWidgetDefaultResponse extends HttpResponse {
233
- status: string;
234
- body: WidgetErrorOutput;
235
- }
236
-
237
- export declare interface UpdateWidgetOptions extends RequestOptions {
238
- /** The weight of the widget. This is an int32, but must be greater than zero. */
239
- weight?: number;
240
- /** The color of the widget. */
241
- color?: ColorType;
242
- }
243
-
244
- declare type UpdateWidgetParameters = UpdateWidgetBodyParam & RequestParameters;
245
-
246
- /**
247
- * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!
248
- *
249
- * Any changes you make here may be lost.
250
- *
251
- * If you need to make changes, please do so in the original source file, \{project-root\}/sources/custom
252
- */
253
- /** */
254
- export declare interface Widget {
255
- /** The UUID of this widget. This is generated automatically by the service. */
256
- id: string;
257
- /** The weight of the widget. This is an int32, but must be greater than zero. */
258
- weight: number;
259
- /** The color of the widget. */
260
- color: ColorType;
261
- }
262
-
263
- declare interface WidgetErrorOutput {
264
- /** The HTTP error code. */
265
- code: number;
266
- /** A human-readable message describing the error. */
267
- message: string;
268
- }
269
-
270
- /**
271
- * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!
272
- *
273
- * Any changes you make here may be lost.
274
- *
275
- * If you need to make changes, please do so in the original source file, \{project-root\}/sources/custom
276
- */
277
- declare interface WidgetOutput {
278
- /** The UUID of this widget. This is generated automatically by the service. */
279
- id: string;
280
- /** The weight of the widget. This is an int32, but must be greater than zero. */
281
- weight: number;
282
- /** The color of the widget. */
283
- color: "red" | "blue";
284
- }
285
-
286
- export declare interface WidgetServiceClientOptions extends ClientOptions {
287
- }
288
-
289
- export declare type WidgetServiceContext = Client & {
290
- path: Routes;
291
- };
292
-
293
- export { }
@@ -1,207 +0,0 @@
1
- import type { Client } from '@azure-rest/core-client';
2
- import type { ClientOptions } from '@azure-rest/core-client';
3
- import type { HttpResponse } from '@azure-rest/core-client';
4
- import type { RequestParameters } from '@azure-rest/core-client';
5
- import type { StreamableMethod } from '@azure-rest/core-client';
6
- import type { TokenCredential } from '@azure/core-auth';
7
-
8
- export declare interface AnalyzeResultOutput {
9
- summary: string;
10
- }
11
-
12
- export declare interface AnalyzeWidget {
13
- /** Analyze a widget. The only guarantee is that this method will return a string containing the results of the analysis. */
14
- post(options?: AnalyzeWidgetParameters): StreamableMethod<AnalyzeWidget200Response | AnalyzeWidgetDefaultResponse>;
15
- }
16
-
17
- /** The request has succeeded. */
18
- export declare interface AnalyzeWidget200Response extends HttpResponse {
19
- status: "200";
20
- body: AnalyzeResultOutput;
21
- }
22
-
23
- export declare interface AnalyzeWidgetDefaultResponse extends HttpResponse {
24
- status: string;
25
- body: WidgetErrorOutput;
26
- }
27
-
28
- export declare type AnalyzeWidgetParameters = RequestParameters;
29
-
30
- /**
31
- * This customization adds credential support to the client. And overloads for when it is optional
32
- */
33
- declare function createClient(endpoint: string, credential: TokenCredential, options?: ClientOptions): WidgetServiceContext;
34
-
35
- declare function createClient(endpoint: string, options?: ClientOptions): WidgetServiceContext;
36
- export default createClient;
37
-
38
- /**
39
- * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!
40
- *
41
- * Any changes you make here may be lost.
42
- *
43
- * If you need to make changes, please do so in the original source file, \{project-root\}/sources/custom
44
- */
45
- export declare interface CreateWidget {
46
- /** The weight of the widget. This is an int32, but must be greater than zero. */
47
- weight: number;
48
- /** The color of the widget. */
49
- color: "red" | "blue";
50
- }
51
-
52
- /** The request has succeeded and a new resource has been created as a result. */
53
- export declare interface CreateWidget201Response extends HttpResponse {
54
- status: "201";
55
- body: WidgetOutput;
56
- }
57
-
58
- export declare interface CreateWidgetBodyParam {
59
- body?: CreateWidget;
60
- }
61
-
62
- export declare interface CreateWidgetDefaultResponse extends HttpResponse {
63
- status: string;
64
- body: WidgetErrorOutput;
65
- }
66
-
67
- export declare type CreateWidgetParameters = CreateWidgetBodyParam & RequestParameters;
68
-
69
- /** There is no content to send for this request, but the headers may be useful. */
70
- export declare interface DeleteWidget204Response extends HttpResponse {
71
- status: "204";
72
- }
73
-
74
- export declare interface DeleteWidgetDefaultResponse extends HttpResponse {
75
- status: string;
76
- body: WidgetErrorOutput;
77
- }
78
-
79
- export declare type DeleteWidgetParameters = RequestParameters;
80
-
81
- export declare interface GetWidget {
82
- /** Get a widget by ID. */
83
- get(options?: GetWidgetParameters): StreamableMethod<GetWidget200Response | GetWidgetDefaultResponse>;
84
- /**
85
- * Update the contents of the widget. The widget ID is required in the input, but cannot be changed. All other fields
86
- * are optional and will be updated within the widget if provided.
87
- */
88
- patch(options?: UpdateWidgetParameters): StreamableMethod<UpdateWidget200Response | UpdateWidgetDefaultResponse>;
89
- /** Delete a widget by ID. */
90
- delete(options?: DeleteWidgetParameters): StreamableMethod<DeleteWidget204Response | DeleteWidgetDefaultResponse>;
91
- }
92
-
93
- /** The request has succeeded. */
94
- export declare interface GetWidget200Response extends HttpResponse {
95
- status: "200";
96
- body: WidgetOutput;
97
- }
98
-
99
- export declare interface GetWidgetDefaultResponse extends HttpResponse {
100
- status: string;
101
- body: WidgetErrorOutput;
102
- }
103
-
104
- export declare type GetWidgetParameters = RequestParameters;
105
-
106
- export declare function isUnexpected(response: ListWidgets200Response | ListWidgetsDefaultResponse): response is ListWidgetsDefaultResponse;
107
-
108
- export declare function isUnexpected(response: CreateWidget201Response | CreateWidgetDefaultResponse): response is CreateWidgetDefaultResponse;
109
-
110
- export declare function isUnexpected(response: GetWidget200Response | GetWidgetDefaultResponse): response is GetWidgetDefaultResponse;
111
-
112
- export declare function isUnexpected(response: UpdateWidget200Response | UpdateWidgetDefaultResponse): response is UpdateWidgetDefaultResponse;
113
-
114
- export declare function isUnexpected(response: DeleteWidget204Response | DeleteWidgetDefaultResponse): response is DeleteWidgetDefaultResponse;
115
-
116
- export declare function isUnexpected(response: AnalyzeWidget200Response | AnalyzeWidgetDefaultResponse): response is AnalyzeWidgetDefaultResponse;
117
-
118
- export declare interface ListWidgets {
119
- /**
120
- * List all widgets in the system. This operation is not paginated, and returns a simple array of widgets.
121
- *
122
- * It does not accept any options or parameters.
123
- */
124
- get(options?: ListWidgetsParameters): StreamableMethod<ListWidgets200Response | ListWidgetsDefaultResponse>;
125
- /**
126
- * Create a new widget.
127
- *
128
- * The widget ID is not required during creation, as it is automatically set by the server. Providing an ID will
129
- * result in an error.
130
- */
131
- post(options?: CreateWidgetParameters): StreamableMethod<CreateWidget201Response | CreateWidgetDefaultResponse>;
132
- }
133
-
134
- /** The request has succeeded. */
135
- export declare interface ListWidgets200Response extends HttpResponse {
136
- status: "200";
137
- body: Array<WidgetOutput>;
138
- }
139
-
140
- export declare interface ListWidgetsDefaultResponse extends HttpResponse {
141
- status: string;
142
- body: WidgetErrorOutput;
143
- }
144
-
145
- export declare type ListWidgetsParameters = RequestParameters;
146
-
147
- export declare interface Routes {
148
- /** Resource for '/widgets' has methods for the following verbs: get, post */
149
- (path: "/widgets"): ListWidgets;
150
- /** Resource for '/widgets/\{id\}' has methods for the following verbs: get, patch, delete */
151
- (path: "/widgets/{id}", id: string): GetWidget;
152
- /** Resource for '/widgets/\{id\}/analyze' has methods for the following verbs: post */
153
- (path: "/widgets/{id}/analyze", id: string): AnalyzeWidget;
154
- }
155
-
156
- export declare interface UpdateWidget {
157
- /** The weight of the widget. This is an int32, but must be greater than zero. */
158
- weight?: number;
159
- /** The color of the widget. */
160
- color?: "red" | "blue";
161
- }
162
-
163
- /** The request has succeeded. */
164
- export declare interface UpdateWidget200Response extends HttpResponse {
165
- status: "200";
166
- body: WidgetOutput;
167
- }
168
-
169
- export declare interface UpdateWidgetBodyParam {
170
- body?: UpdateWidget;
171
- }
172
-
173
- export declare interface UpdateWidgetDefaultResponse extends HttpResponse {
174
- status: string;
175
- body: WidgetErrorOutput;
176
- }
177
-
178
- export declare type UpdateWidgetParameters = UpdateWidgetBodyParam & RequestParameters;
179
-
180
- export declare interface WidgetErrorOutput {
181
- /** The HTTP error code. */
182
- code: number;
183
- /** A human-readable message describing the error. */
184
- message: string;
185
- }
186
-
187
- /**
188
- * THIS IS AN AUTO-GENERATED FILE - DO NOT EDIT!
189
- *
190
- * Any changes you make here may be lost.
191
- *
192
- * If you need to make changes, please do so in the original source file, \{project-root\}/sources/custom
193
- */
194
- export declare interface WidgetOutput {
195
- /** The UUID of this widget. This is generated automatically by the service. */
196
- id: string;
197
- /** The weight of the widget. This is an int32, but must be greater than zero. */
198
- weight: number;
199
- /** The color of the widget. */
200
- color: "red" | "blue";
201
- }
202
-
203
- export declare type WidgetServiceContext = Client & {
204
- path: Routes;
205
- };
206
-
207
- export { }