@typespec/http 0.47.0-dev.2 → 0.47.0-dev.3
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/lib/http-decorators.tsp +12 -12
- package/package.json +1 -1
package/lib/http-decorators.tsp
CHANGED
|
@@ -7,7 +7,7 @@ using TypeSpec.Reflection;
|
|
|
7
7
|
*/
|
|
8
8
|
model HeaderOptions {
|
|
9
9
|
/**
|
|
10
|
-
* Name of the header when sent over
|
|
10
|
+
* Name of the header when sent over HTTP.
|
|
11
11
|
*/
|
|
12
12
|
name?: string;
|
|
13
13
|
|
|
@@ -18,23 +18,23 @@ model HeaderOptions {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* Specify this property is to be sent or received as an
|
|
21
|
+
* Specify this property is to be sent or received as an HTTP header.
|
|
22
22
|
*
|
|
23
|
-
* @param headerNameOrOptions Optional name of the header when sent over
|
|
24
|
-
* By default the header name will be the property name converted from camelCase to
|
|
23
|
+
* @param headerNameOrOptions Optional name of the header when sent over HTTP or header options.
|
|
24
|
+
* By default the header name will be the property name converted from camelCase to kebab-case. (e.g. `contentType` -> `content-type`)
|
|
25
25
|
*
|
|
26
26
|
* @example
|
|
27
27
|
*
|
|
28
28
|
* ```typespec
|
|
29
|
-
* op read(@header accept: string): {@header("
|
|
29
|
+
* op read(@header accept: string): {@header("ETag") eTag: string};
|
|
30
30
|
* op create(@header({name: "X-Color", format: "csv"}) colors: string[]): void;
|
|
31
31
|
* ```
|
|
32
32
|
*
|
|
33
33
|
* @example Implicit header name
|
|
34
34
|
*
|
|
35
35
|
* ```typespec
|
|
36
|
-
* op read(): {@header eTag: string}; // headerName: e-tag
|
|
37
36
|
* op read(): {@header contentType: string}; // headerName: content-type
|
|
37
|
+
* op update(@header ifMatch: string): void; // headerName: if-match
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
40
|
extern dec header(target: ModelProperty, headerNameOrOptions?: string | HeaderOptions);
|
|
@@ -107,7 +107,7 @@ extern dec body(target: ModelProperty);
|
|
|
107
107
|
extern dec statusCode(target: ModelProperty);
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
|
-
* Specify the
|
|
110
|
+
* Specify the HTTP verb for the target operation to be `GET`.
|
|
111
111
|
*
|
|
112
112
|
* @example
|
|
113
113
|
*
|
|
@@ -118,7 +118,7 @@ extern dec statusCode(target: ModelProperty);
|
|
|
118
118
|
extern dec get(target: Operation);
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
|
-
* Specify the
|
|
121
|
+
* Specify the HTTP verb for the target operation to be `PUT`.
|
|
122
122
|
*
|
|
123
123
|
* @example
|
|
124
124
|
*
|
|
@@ -129,7 +129,7 @@ extern dec get(target: Operation);
|
|
|
129
129
|
extern dec put(target: Operation);
|
|
130
130
|
|
|
131
131
|
/**
|
|
132
|
-
* Specify the
|
|
132
|
+
* Specify the HTTP verb for the target operation to be `POST`.
|
|
133
133
|
*
|
|
134
134
|
* @example
|
|
135
135
|
*
|
|
@@ -140,7 +140,7 @@ extern dec put(target: Operation);
|
|
|
140
140
|
extern dec post(target: Operation);
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
|
-
* Specify the
|
|
143
|
+
* Specify the HTTP verb for the target operation to be `PATCH`.
|
|
144
144
|
*
|
|
145
145
|
* @example
|
|
146
146
|
*
|
|
@@ -151,7 +151,7 @@ extern dec post(target: Operation);
|
|
|
151
151
|
extern dec patch(target: Operation);
|
|
152
152
|
|
|
153
153
|
/**
|
|
154
|
-
* Specify the
|
|
154
|
+
* Specify the HTTP verb for the target operation to be `DELETE`.
|
|
155
155
|
*
|
|
156
156
|
* @example
|
|
157
157
|
*
|
|
@@ -162,7 +162,7 @@ extern dec patch(target: Operation);
|
|
|
162
162
|
extern dec delete(target: Operation);
|
|
163
163
|
|
|
164
164
|
/**
|
|
165
|
-
* Specify the
|
|
165
|
+
* Specify the HTTP verb for the target operation to be `HEAD`.
|
|
166
166
|
* @example
|
|
167
167
|
*
|
|
168
168
|
* ```typespec
|