@typespec/http-client-js 0.2.0-dev.2 → 0.2.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/dist/src/components/client-context/client-context-declaration.d.ts.map +1 -1
- package/dist/src/components/client-context/client-context-declaration.js.map +1 -1
- package/dist/src/components/client-context/client-context-factory.d.ts.map +1 -1
- package/dist/src/components/client-context/client-context-factory.js +7 -4
- package/dist/src/components/client-context/client-context-factory.js.map +1 -1
- package/dist/src/components/client-context/client-context-options.d.ts.map +1 -1
- package/dist/src/components/client-context/client-context-options.js +13 -9
- package/dist/src/components/client-context/client-context-options.js.map +1 -1
- package/dist/src/components/client-context/client-context.d.ts.map +1 -1
- package/dist/src/components/client-context/client-context.js +7 -12
- package/dist/src/components/client-context/client-context.js.map +1 -1
- package/dist/src/components/client-context/parametrized-endpoint.d.ts +1 -1
- package/dist/src/components/client-context/parametrized-endpoint.d.ts.map +1 -1
- package/dist/src/components/client-context/parametrized-endpoint.js +22 -13
- package/dist/src/components/client-context/parametrized-endpoint.js.map +1 -1
- package/dist/src/components/client-directory.d.ts +2 -2
- package/dist/src/components/client-directory.d.ts.map +1 -1
- package/dist/src/components/client-directory.js +33 -21
- package/dist/src/components/client-directory.js.map +1 -1
- package/dist/src/components/client-operation.d.ts.map +1 -1
- package/dist/src/components/client-operation.js +6 -6
- package/dist/src/components/client-operation.js.map +1 -1
- package/dist/src/components/client.d.ts +1 -1
- package/dist/src/components/client.d.ts.map +1 -1
- package/dist/src/components/client.js +83 -64
- package/dist/src/components/client.js.map +1 -1
- package/dist/src/components/encoding-provider.d.ts.map +1 -1
- package/dist/src/components/encoding-provider.js +0 -1
- package/dist/src/components/encoding-provider.js.map +1 -1
- package/dist/src/components/http-request-options.d.ts.map +1 -1
- package/dist/src/components/http-request-options.js +3 -3
- package/dist/src/components/http-request-options.js.map +1 -1
- package/dist/src/components/http-request-parameters-expression.d.ts +1 -2
- package/dist/src/components/http-request-parameters-expression.d.ts.map +1 -1
- package/dist/src/components/http-request-parameters-expression.js +37 -33
- package/dist/src/components/http-request-parameters-expression.js.map +1 -1
- package/dist/src/components/http-request.d.ts.map +1 -1
- package/dist/src/components/http-request.js +24 -20
- package/dist/src/components/http-request.js.map +1 -1
- package/dist/src/components/http-response.d.ts +1 -1
- package/dist/src/components/http-response.d.ts.map +1 -1
- package/dist/src/components/http-response.js +36 -33
- package/dist/src/components/http-response.js.map +1 -1
- package/dist/src/components/models.d.ts.map +1 -1
- package/dist/src/components/models.js +21 -18
- package/dist/src/components/models.js.map +1 -1
- package/dist/src/components/operation-options.d.ts.map +1 -1
- package/dist/src/components/operation-options.js +17 -14
- package/dist/src/components/operation-options.js.map +1 -1
- package/dist/src/components/output.d.ts.map +1 -1
- package/dist/src/components/output.js +2 -1
- package/dist/src/components/output.js.map +1 -1
- package/dist/src/components/serializers.d.ts.map +1 -1
- package/dist/src/components/serializers.js +3 -3
- package/dist/src/components/serializers.js.map +1 -1
- package/dist/src/components/static-helpers/bytes-encoding.d.ts.map +1 -1
- package/dist/src/components/static-helpers/bytes-encoding.js +2 -2
- package/dist/src/components/static-helpers/bytes-encoding.js.map +1 -1
- package/dist/src/components/static-helpers/interfaces.d.ts.map +1 -1
- package/dist/src/components/static-helpers/interfaces.js.map +1 -1
- package/dist/src/components/static-helpers/multipart-helpers.d.ts.map +1 -1
- package/dist/src/components/static-helpers/multipart-helpers.js +4 -4
- package/dist/src/components/static-helpers/multipart-helpers.js.map +1 -1
- package/dist/src/components/static-helpers/rest-error.d.ts.map +1 -1
- package/dist/src/components/static-helpers/rest-error.js +66 -57
- package/dist/src/components/static-helpers/rest-error.js.map +1 -1
- package/dist/src/components/transforms/content-type-encoding-provider.d.ts.map +1 -1
- package/dist/src/components/transforms/content-type-encoding-provider.js +0 -1
- package/dist/src/components/transforms/content-type-encoding-provider.js.map +1 -1
- package/dist/src/components/transforms/json/json-array-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-array-transform.js.map +1 -1
- package/dist/src/components/transforms/json/json-model-additional-properties-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-model-additional-properties-transform.js +4 -4
- package/dist/src/components/transforms/json/json-model-additional-properties-transform.js.map +1 -1
- package/dist/src/components/transforms/json/json-model-base-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-model-base-transform.js.map +1 -1
- package/dist/src/components/transforms/json/json-model-property-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-model-property-transform.js.map +1 -1
- package/dist/src/components/transforms/json/json-model-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-model-transform.js +20 -17
- package/dist/src/components/transforms/json/json-model-transform.js.map +1 -1
- package/dist/src/components/transforms/json/json-record-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-record-transform.js.map +1 -1
- package/dist/src/components/transforms/json/json-transform-discriminator.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-transform-discriminator.js +3 -3
- package/dist/src/components/transforms/json/json-transform-discriminator.js.map +1 -1
- package/dist/src/components/transforms/json/json-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/json-transform.js.map +1 -1
- package/dist/src/components/transforms/json/union-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/json/union-transform.js +2 -2
- package/dist/src/components/transforms/json/union-transform.js.map +1 -1
- package/dist/src/components/transforms/multipart/array-part-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/multipart/array-part-transform.js.map +1 -1
- package/dist/src/components/transforms/multipart/file-part-transform.js +1 -1
- package/dist/src/components/transforms/multipart/file-part-transform.js.map +1 -1
- package/dist/src/components/transforms/multipart/multipart-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/multipart/multipart-transform.js +9 -6
- package/dist/src/components/transforms/multipart/multipart-transform.js.map +1 -1
- package/dist/src/components/transforms/multipart/simple-part-transform.d.ts.map +1 -1
- package/dist/src/components/transforms/multipart/simple-part-transform.js +1 -1
- package/dist/src/components/transforms/multipart/simple-part-transform.js.map +1 -1
- package/dist/src/components/transforms/operation-transform-declaration.d.ts.map +1 -1
- package/dist/src/components/transforms/operation-transform-declaration.js +2 -2
- package/dist/src/components/transforms/operation-transform-declaration.js.map +1 -1
- package/dist/src/components/transforms/operation-transform-expression.d.ts.map +1 -1
- package/dist/src/components/transforms/operation-transform-expression.js.map +1 -1
- package/dist/src/components/utils/url-template.d.ts.map +1 -1
- package/dist/src/components/utils/url-template.js.map +1 -1
- package/dist/src/emitter.d.ts.map +1 -1
- package/dist/src/emitter.js +6 -6
- package/dist/src/emitter.js.map +1 -1
- package/dist/src/utils/operations.d.ts +13 -1
- package/dist/src/utils/operations.d.ts.map +1 -1
- package/dist/src/utils/operations.js +71 -0
- package/dist/src/utils/operations.js.map +1 -1
- package/dist/src/utils/parameters.d.ts.map +1 -1
- package/dist/src/utils/parameters.js +1 -1
- package/dist/src/utils/parameters.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/components/client-context/client-context-declaration.tsx +8 -1
- package/src/components/client-context/client-context-factory.tsx +50 -30
- package/src/components/client-context/client-context-options.tsx +13 -6
- package/src/components/client-context/client-context.tsx +5 -3
- package/src/components/client-context/parametrized-endpoint.tsx +26 -15
- package/src/components/client-directory.tsx +26 -16
- package/src/components/client-operation.tsx +24 -12
- package/src/components/client.tsx +77 -39
- package/src/components/encoding-provider.tsx +1 -3
- package/src/components/http-request-options.tsx +24 -14
- package/src/components/http-request-parameters-expression.tsx +34 -37
- package/src/components/http-request.tsx +26 -16
- package/src/components/http-response.tsx +31 -26
- package/src/components/models.tsx +18 -14
- package/src/components/operation-options.tsx +18 -5
- package/src/components/output.tsx +10 -9
- package/src/components/serializers.tsx +9 -5
- package/src/components/static-helpers/bytes-encoding.tsx +26 -8
- package/src/components/static-helpers/interfaces.tsx +14 -9
- package/src/components/static-helpers/multipart-helpers.tsx +34 -13
- package/src/components/static-helpers/rest-error.tsx +56 -18
- package/src/components/transforms/content-type-encoding-provider.tsx +1 -3
- package/src/components/transforms/json/json-array-transform.tsx +6 -4
- package/src/components/transforms/json/json-model-additional-properties-transform.tsx +18 -13
- package/src/components/transforms/json/json-model-base-transform.tsx +6 -1
- package/src/components/transforms/json/json-model-property-transform.tsx +7 -9
- package/src/components/transforms/json/json-model-transform.tsx +44 -16
- package/src/components/transforms/json/json-record-transform.tsx +5 -3
- package/src/components/transforms/json/json-transform-discriminator.tsx +12 -11
- package/src/components/transforms/json/json-transform.tsx +5 -3
- package/src/components/transforms/json/union-transform.tsx +20 -8
- package/src/components/transforms/multipart/array-part-transform.tsx +6 -3
- package/src/components/transforms/multipart/file-part-transform.tsx +1 -1
- package/src/components/transforms/multipart/multipart-transform.tsx +4 -6
- package/src/components/transforms/multipart/part-transform.tsx +1 -1
- package/src/components/transforms/multipart/simple-part-transform.tsx +7 -10
- package/src/components/transforms/operation-transform-declaration.tsx +24 -7
- package/src/components/transforms/operation-transform-expression.tsx +12 -5
- package/src/components/utils/url-template.tsx +10 -6
- package/src/emitter.tsx +4 -3
- package/src/utils/operations.ts +96 -1
- package/src/utils/parameters.tsx +5 -1
- package/test/scenarios/additional-properties/extends.md +0 -4
- package/test/scenarios/additional-properties/is.md +0 -4
- package/test/scenarios/additional-properties/spread.md +0 -4
- package/test/scenarios/auth/basic_auth.md +0 -1
- package/test/scenarios/auth/bearer.md +0 -1
- package/test/scenarios/auth/client_parameters.md +0 -1
- package/test/scenarios/auth/key_credential.md +0 -1
- package/test/scenarios/auth/sub_client_override.md +0 -2
- package/test/scenarios/client/dotted_namespace.md +0 -1
- package/test/scenarios/client/global_namespace.md +0 -5
- package/test/scenarios/client/multiple_top_level_clients.md +0 -2
- package/test/scenarios/client/nested_client.md +0 -2
- package/test/scenarios/encoding/bytes_body.md +0 -4
- package/test/scenarios/encoding/bytes_json_property.md +0 -5
- package/test/scenarios/encoding/bytes_nullable.md +0 -14
- package/test/scenarios/encoding/header_bytes.md +0 -12
- package/test/scenarios/encoding/header_date.md +0 -20
- package/test/scenarios/encoding/model_with_bytes_property.md +0 -5
- package/test/scenarios/encoding/query_bytes.md +0 -4
- package/test/scenarios/encoding/query_date.md +0 -20
- package/test/scenarios/http-operations/basic-request.md +0 -12
- package/test/scenarios/http-operations/basic-response.md +0 -19
- package/test/scenarios/http-operations/basic.md +0 -6
- package/test/scenarios/http-operations/constant-header.md +0 -4
- package/test/scenarios/http-operations/create-operation.md +0 -4
- package/test/scenarios/http-operations/on_response.md +0 -4
- package/test/scenarios/http-operations/optional-request-body.md +0 -5
- package/test/scenarios/http-operations/path-parameter-in-model.md +0 -4
- package/test/scenarios/http-operations/path-parameter.md +0 -4
- package/test/scenarios/http-operations/scalar-payload.md +0 -4
- package/test/scenarios/http-operations/with-parameters.md +0 -5
- package/test/scenarios/models/inheritance_2_discriminators.md +0 -24
- package/test/scenarios/models/inheritance_discriminator.md +0 -4
- package/test/scenarios/models/inline-models.md +1 -4
- package/test/scenarios/models/model_additional_properties.md +0 -4
- package/test/scenarios/models/model_extends.md +0 -4
- package/test/scenarios/models/model_spread.md +0 -2
- package/test/scenarios/models/nested_property.md +0 -4
- package/test/scenarios/models/property_references_property.md +0 -6
- package/test/scenarios/multipart/anonymous_part.md +1 -10
- package/test/scenarios/multipart/file.md +0 -12
- package/test/scenarios/multipart/file_content_type.md +0 -5
- package/test/scenarios/multipart/simple_part.md +0 -4
- package/test/scenarios/operation-parameters/body_root_anonymous.md +2 -17
- package/test/scenarios/operation-parameters/constant_as_optional.md +0 -5
- package/test/scenarios/operation-parameters/default_value_as_optional.md +0 -5
- package/test/scenarios/operation-parameters/no_content_type.md +0 -5
- package/test/scenarios/operation-parameters/no_parameters.md +0 -5
- package/test/scenarios/operation-parameters/only_optional.md +0 -5
- package/test/scenarios/operation-parameters/only_required.md +0 -5
- package/test/scenarios/operation-parameters/reserved_names.md +0 -5
- package/test/scenarios/operation-parameters/spread_body.md +0 -5
- package/test/scenarios/operation-parameters/spread_with_nested.md +0 -5
- package/test/scenarios/operation-parameters/union_body.md +0 -6
- package/test/scenarios/operation-parameters/with_body_property.md +0 -5
- package/test/scenarios/operation-parameters/with_body_root.md +0 -5
- package/test/scenarios/serializers/arrays.md +0 -8
- package/test/scenarios/serializers/basic_model.md +0 -4
- package/test/scenarios/serializers/basic_model_wire_name.md +0 -2
- package/test/scenarios/serializers/discriminated_union_spread.md +0 -4
- package/test/scenarios/serializers/multipart.md +0 -4
- package/test/scenarios/serializers/polymorphic_single_level_inheritance.md +0 -5
- package/test/scenarios/serializers/record.md +0 -4
- package/test/scenarios/serializers/scalars.md +0 -5
- package/test/scenarios/serializers/spread.md +0 -4
- package/test/scenarios/serializers/string_union.md +0 -4
|
@@ -40,7 +40,6 @@ export function jsonDinosaurToTransportTransform(input_?: Dinosaur | null): any
|
|
|
40
40
|
if (!input_) {
|
|
41
41
|
return input_ as any;
|
|
42
42
|
}
|
|
43
|
-
|
|
44
43
|
return {
|
|
45
44
|
...jsonDinosaurToTransportDiscriminator(input_),
|
|
46
45
|
size: input_.size,
|
|
@@ -54,7 +53,6 @@ export function jsonTRexToTransportTransform(input_?: TRex | null): any {
|
|
|
54
53
|
if (!input_) {
|
|
55
54
|
return input_ as any;
|
|
56
55
|
}
|
|
57
|
-
|
|
58
56
|
return {
|
|
59
57
|
kind: input_.kind,
|
|
60
58
|
size: input_.size,
|
|
@@ -69,7 +67,6 @@ export function jsonDinosaurToApplicationTransform(input_?: any): Dinosaur {
|
|
|
69
67
|
if (!input_) {
|
|
70
68
|
return input_ as any;
|
|
71
69
|
}
|
|
72
|
-
|
|
73
70
|
return {
|
|
74
71
|
...jsonDinosaurToApplicationDiscriminator(input_),
|
|
75
72
|
size: input_.size,
|
|
@@ -83,7 +80,6 @@ export function jsonTRexToApplicationTransform(input_?: any): TRex {
|
|
|
83
80
|
if (!input_) {
|
|
84
81
|
return input_ as any;
|
|
85
82
|
}
|
|
86
|
-
|
|
87
83
|
return {
|
|
88
84
|
kind: input_.kind,
|
|
89
85
|
size: input_.size,
|
|
@@ -47,10 +47,8 @@ export function jsonDogToTransportTransform(input_?: Dog | null): any {
|
|
|
47
47
|
if (!input_) {
|
|
48
48
|
return input_ as any;
|
|
49
49
|
}
|
|
50
|
-
|
|
51
50
|
return {
|
|
52
51
|
...jsonRecordExtraFeatureToTransportTransform(input_.additionalProperties),
|
|
53
|
-
|
|
54
52
|
id: input_.id,
|
|
55
53
|
name: input_.name,
|
|
56
54
|
color: input_.color,
|
|
@@ -65,12 +63,10 @@ export function jsonDogToApplicationTransform(input_?: any): Dog {
|
|
|
65
63
|
if (!input_) {
|
|
66
64
|
return input_ as any;
|
|
67
65
|
}
|
|
68
|
-
|
|
69
66
|
return {
|
|
70
67
|
additionalProperties: jsonRecordExtraFeatureToApplicationTransform(
|
|
71
68
|
(({ id, name, color, ...rest }) => rest)(input_),
|
|
72
69
|
),
|
|
73
|
-
|
|
74
70
|
id: input_.id,
|
|
75
71
|
name: input_.name,
|
|
76
72
|
color: input_.color,
|
|
@@ -45,7 +45,6 @@ export function jsonPetToTransportTransform(input_?: Pet | null): any {
|
|
|
45
45
|
if (!input_) {
|
|
46
46
|
return input_ as any;
|
|
47
47
|
}
|
|
48
|
-
|
|
49
48
|
return {
|
|
50
49
|
id: input_.id,
|
|
51
50
|
name: input_.name,
|
|
@@ -60,7 +59,6 @@ export function jsonPetToApplicationTransform(input_?: any): Pet {
|
|
|
60
59
|
if (!input_) {
|
|
61
60
|
return input_ as any;
|
|
62
61
|
}
|
|
63
|
-
|
|
64
62
|
return {
|
|
65
63
|
id: input_.id,
|
|
66
64
|
name: input_.name,
|
|
@@ -75,7 +73,6 @@ export function jsonDogToTransportTransform(input_?: Dog | null): any {
|
|
|
75
73
|
if (!input_) {
|
|
76
74
|
return input_ as any;
|
|
77
75
|
}
|
|
78
|
-
|
|
79
76
|
return {
|
|
80
77
|
color: input_.color,
|
|
81
78
|
id: input_.id,
|
|
@@ -91,7 +88,6 @@ export function jsonDogToApplicationTransform(input_?: any): Dog {
|
|
|
91
88
|
if (!input_) {
|
|
92
89
|
return input_ as any;
|
|
93
90
|
}
|
|
94
|
-
|
|
95
91
|
return {
|
|
96
92
|
color: input_.color,
|
|
97
93
|
id: input_.id,
|
|
@@ -39,7 +39,6 @@ export function jsonDogToTransportTransform(input_?: Dog | null): any {
|
|
|
39
39
|
if (!input_) {
|
|
40
40
|
return input_ as any;
|
|
41
41
|
}
|
|
42
|
-
|
|
43
42
|
return {
|
|
44
43
|
id: input_.id,
|
|
45
44
|
name: input_.name,
|
|
@@ -55,7 +54,6 @@ export function jsonDogToApplicationTransform(input_?: any): Dog {
|
|
|
55
54
|
if (!input_) {
|
|
56
55
|
return input_ as any;
|
|
57
56
|
}
|
|
58
|
-
|
|
59
57
|
return {
|
|
60
58
|
id: input_.id,
|
|
61
59
|
name: input_.name,
|
|
@@ -22,24 +22,20 @@ export async function foo(
|
|
|
22
22
|
options?: FooOptions,
|
|
23
23
|
): Promise<void> {
|
|
24
24
|
const path = parse("/foo").expand({});
|
|
25
|
-
|
|
26
25
|
const httpRequestOptions = {
|
|
27
26
|
headers: {},
|
|
28
27
|
body: {
|
|
29
28
|
profileImage: encodeUint8Array(profileImage, "base64")!,
|
|
30
29
|
},
|
|
31
30
|
};
|
|
32
|
-
|
|
33
31
|
const response = await client.pathUnchecked(path).post(httpRequestOptions);
|
|
34
32
|
|
|
35
33
|
if (typeof options?.operationOptions?.onResponse === "function") {
|
|
36
34
|
options?.operationOptions?.onResponse(response);
|
|
37
35
|
}
|
|
38
|
-
|
|
39
36
|
if (+response.status === 204 && !response.body) {
|
|
40
37
|
return;
|
|
41
38
|
}
|
|
42
|
-
|
|
43
39
|
throw createRestError(response);
|
|
44
40
|
}
|
|
45
41
|
```
|
|
@@ -38,7 +38,6 @@ export function jsonBarToTransportTransform(input_?: Bar | null): any {
|
|
|
38
38
|
if (!input_) {
|
|
39
39
|
return input_ as any;
|
|
40
40
|
}
|
|
41
|
-
|
|
42
41
|
return {
|
|
43
42
|
address: input_.address,
|
|
44
43
|
parentId: input_.parentId,
|
|
@@ -114,23 +113,19 @@ export function dateUnixTimestampDeserializer(date?: number | null): Date {
|
|
|
114
113
|
|
|
115
114
|
return new Date(date * 1000);
|
|
116
115
|
}
|
|
117
|
-
|
|
118
116
|
export function jsonBarToTransportTransform(input_?: Bar | null): any {
|
|
119
117
|
if (!input_) {
|
|
120
118
|
return input_ as any;
|
|
121
119
|
}
|
|
122
|
-
|
|
123
120
|
return {
|
|
124
121
|
address: input_.address,
|
|
125
122
|
parentId: input_.parentId,
|
|
126
123
|
}!;
|
|
127
124
|
}
|
|
128
|
-
|
|
129
125
|
export function jsonBarToApplicationTransform(input_?: any): Bar {
|
|
130
126
|
if (!input_) {
|
|
131
127
|
return input_ as any;
|
|
132
128
|
}
|
|
133
|
-
|
|
134
129
|
return {
|
|
135
130
|
address: input_.address,
|
|
136
131
|
parentId: input_.parentId,
|
|
@@ -147,7 +142,6 @@ export function jsonBarToApplicationTransform(input_?: any): Bar {
|
|
|
147
142
|
if (!input_) {
|
|
148
143
|
return input_ as any;
|
|
149
144
|
}
|
|
150
|
-
|
|
151
145
|
return {
|
|
152
146
|
address: input_.address,
|
|
153
147
|
parentId: input_.parentId,
|
|
@@ -20,16 +20,10 @@ op foo(
|
|
|
20
20
|
```ts src/api/testClientOperations.ts function foo
|
|
21
21
|
export async function foo(
|
|
22
22
|
client: TestClientContext,
|
|
23
|
-
body: {
|
|
24
|
-
temperature: {
|
|
25
|
-
body: number;
|
|
26
|
-
contentType: "text/plain";
|
|
27
|
-
};
|
|
28
|
-
},
|
|
23
|
+
body: { temperature: { body: number; contentType: "text/plain" } },
|
|
29
24
|
options?: FooOptions,
|
|
30
25
|
): Promise<void> {
|
|
31
26
|
const path = parse("/").expand({});
|
|
32
|
-
|
|
33
27
|
const httpRequestOptions = {
|
|
34
28
|
headers: {
|
|
35
29
|
"content-type": options?.contentType ?? "multipart/form-data",
|
|
@@ -41,17 +35,14 @@ export async function foo(
|
|
|
41
35
|
},
|
|
42
36
|
],
|
|
43
37
|
};
|
|
44
|
-
|
|
45
38
|
const response = await client.pathUnchecked(path).post(httpRequestOptions);
|
|
46
39
|
|
|
47
40
|
if (typeof options?.operationOptions?.onResponse === "function") {
|
|
48
41
|
options?.operationOptions?.onResponse(response);
|
|
49
42
|
}
|
|
50
|
-
|
|
51
43
|
if (+response.status === 204 && !response.body) {
|
|
52
44
|
return;
|
|
53
45
|
}
|
|
54
|
-
|
|
55
46
|
throw createRestError(response);
|
|
56
47
|
}
|
|
57
48
|
```
|
|
@@ -29,24 +29,20 @@ export async function doThing(
|
|
|
29
29
|
options?: DoThingOptions,
|
|
30
30
|
): Promise<void> {
|
|
31
31
|
const path = parse("/").expand({});
|
|
32
|
-
|
|
33
32
|
const httpRequestOptions = {
|
|
34
33
|
headers: {
|
|
35
34
|
"content-type": options?.contentType ?? "multipart/form-data",
|
|
36
35
|
},
|
|
37
36
|
body: [createFilePartDescriptor("basicFile", bodyParam.basicFile)],
|
|
38
37
|
};
|
|
39
|
-
|
|
40
38
|
const response = await client.pathUnchecked(path).post(httpRequestOptions);
|
|
41
39
|
|
|
42
40
|
if (typeof options?.operationOptions?.onResponse === "function") {
|
|
43
41
|
options?.operationOptions?.onResponse(response);
|
|
44
42
|
}
|
|
45
|
-
|
|
46
43
|
if (+response.status === 204 && !response.body) {
|
|
47
44
|
return;
|
|
48
45
|
}
|
|
49
|
-
|
|
50
46
|
throw createRestError(response);
|
|
51
47
|
}
|
|
52
48
|
```
|
|
@@ -90,24 +86,20 @@ export async function doThing(
|
|
|
90
86
|
options?: DoThingOptions,
|
|
91
87
|
): Promise<void> {
|
|
92
88
|
const path = parse("/").expand({});
|
|
93
|
-
|
|
94
89
|
const httpRequestOptions = {
|
|
95
90
|
headers: {
|
|
96
91
|
"content-type": options?.contentType ?? "multipart/form-data",
|
|
97
92
|
},
|
|
98
93
|
body: [createFilePartDescriptor("image", bodyParam.image, "image/png")],
|
|
99
94
|
};
|
|
100
|
-
|
|
101
95
|
const response = await client.pathUnchecked(path).post(httpRequestOptions);
|
|
102
96
|
|
|
103
97
|
if (typeof options?.operationOptions?.onResponse === "function") {
|
|
104
98
|
options?.operationOptions?.onResponse(response);
|
|
105
99
|
}
|
|
106
|
-
|
|
107
100
|
if (+response.status === 204 && !response.body) {
|
|
108
101
|
return;
|
|
109
102
|
}
|
|
110
|
-
|
|
111
103
|
throw createRestError(response);
|
|
112
104
|
}
|
|
113
105
|
```
|
|
@@ -143,24 +135,20 @@ export async function doThing(
|
|
|
143
135
|
options?: DoThingOptions,
|
|
144
136
|
): Promise<void> {
|
|
145
137
|
const path = parse("/").expand({});
|
|
146
|
-
|
|
147
138
|
const httpRequestOptions = {
|
|
148
139
|
headers: {
|
|
149
140
|
"content-type": options?.contentType ?? "multipart/form-data",
|
|
150
141
|
},
|
|
151
142
|
body: [...bodyParam.files.map((files: any) => createFilePartDescriptor("files", files))],
|
|
152
143
|
};
|
|
153
|
-
|
|
154
144
|
const response = await client.pathUnchecked(path).post(httpRequestOptions);
|
|
155
145
|
|
|
156
146
|
if (typeof options?.operationOptions?.onResponse === "function") {
|
|
157
147
|
options?.operationOptions?.onResponse(response);
|
|
158
148
|
}
|
|
159
|
-
|
|
160
149
|
if (+response.status === 204 && !response.body) {
|
|
161
150
|
return;
|
|
162
151
|
}
|
|
163
|
-
|
|
164
152
|
throw createRestError(response);
|
|
165
153
|
}
|
|
166
154
|
```
|
|
@@ -28,24 +28,20 @@ export async function imageJpegContentType(
|
|
|
28
28
|
options?: ImageJpegContentTypeOptions,
|
|
29
29
|
): Promise<void> {
|
|
30
30
|
const path = parse("/check-filename-and-specific-content-type-with-httppart").expand({});
|
|
31
|
-
|
|
32
31
|
const httpRequestOptions = {
|
|
33
32
|
headers: {
|
|
34
33
|
"content-type": options?.contentType ?? "multipart/form-data",
|
|
35
34
|
},
|
|
36
35
|
body: [createFilePartDescriptor("profileImage", body.profileImage, "image/jpg")],
|
|
37
36
|
};
|
|
38
|
-
|
|
39
37
|
const response = await client.pathUnchecked(path).post(httpRequestOptions);
|
|
40
38
|
|
|
41
39
|
if (typeof options?.operationOptions?.onResponse === "function") {
|
|
42
40
|
options?.operationOptions?.onResponse(response);
|
|
43
41
|
}
|
|
44
|
-
|
|
45
42
|
if (+response.status === 204 && !response.body) {
|
|
46
43
|
return;
|
|
47
44
|
}
|
|
48
|
-
|
|
49
45
|
throw createRestError(response);
|
|
50
46
|
}
|
|
51
47
|
```
|
|
@@ -59,7 +55,6 @@ export function jsonFileWithHttpPartSpecificContentTypeRequestToApplicationTrans
|
|
|
59
55
|
if (!input_) {
|
|
60
56
|
return input_ as any;
|
|
61
57
|
}
|
|
62
|
-
|
|
63
58
|
return {
|
|
64
59
|
profileImage: jsonFileSpecificContentTypeToApplicationTransform(input_.profileImage),
|
|
65
60
|
}!;
|
|
@@ -33,7 +33,6 @@ export async function doThing(
|
|
|
33
33
|
options?: DoThingOptions,
|
|
34
34
|
): Promise<void> {
|
|
35
35
|
const path = parse("/").expand({});
|
|
36
|
-
|
|
37
36
|
const httpRequestOptions = {
|
|
38
37
|
headers: {
|
|
39
38
|
"content-type": options?.contentType ?? "multipart/form-data",
|
|
@@ -53,17 +52,14 @@ export async function doThing(
|
|
|
53
52
|
},
|
|
54
53
|
],
|
|
55
54
|
};
|
|
56
|
-
|
|
57
55
|
const response = await client.pathUnchecked(path).post(httpRequestOptions);
|
|
58
56
|
|
|
59
57
|
if (typeof options?.operationOptions?.onResponse === "function") {
|
|
60
58
|
options?.operationOptions?.onResponse(response);
|
|
61
59
|
}
|
|
62
|
-
|
|
63
60
|
if (+response.status === 204 && !response.body) {
|
|
64
61
|
return;
|
|
65
62
|
}
|
|
66
|
-
|
|
67
63
|
throw createRestError(response);
|
|
68
64
|
}
|
|
69
65
|
```
|
|
@@ -21,16 +21,10 @@ The operation has has no required parameters so options and client should be the
|
|
|
21
21
|
```ts src/api/testClientOperations.ts function create
|
|
22
22
|
export async function create(
|
|
23
23
|
client: TestClientContext,
|
|
24
|
-
widget: {
|
|
25
|
-
id: string;
|
|
26
|
-
name: string;
|
|
27
|
-
age?: string;
|
|
28
|
-
foo?: string;
|
|
29
|
-
},
|
|
24
|
+
widget: { id: string; name: string; age?: string; foo?: string },
|
|
30
25
|
options?: CreateOptions,
|
|
31
26
|
): Promise<void> {
|
|
32
27
|
const path = parse("/").expand({});
|
|
33
|
-
|
|
34
28
|
const httpRequestOptions = {
|
|
35
29
|
headers: {
|
|
36
30
|
...(options?.foo && { foo: options?.foo }),
|
|
@@ -42,17 +36,14 @@ export async function create(
|
|
|
42
36
|
foo: widget.options?.foo,
|
|
43
37
|
},
|
|
44
38
|
};
|
|
45
|
-
|
|
46
39
|
const response = await client.pathUnchecked(path).post(httpRequestOptions);
|
|
47
40
|
|
|
48
41
|
if (typeof options?.operationOptions?.onResponse === "function") {
|
|
49
42
|
options?.operationOptions?.onResponse(response);
|
|
50
43
|
}
|
|
51
|
-
|
|
52
44
|
if (+response.status === 204 && !response.body) {
|
|
53
45
|
return;
|
|
54
46
|
}
|
|
55
|
-
|
|
56
47
|
throw createRestError(response);
|
|
57
48
|
}
|
|
58
49
|
```
|
|
@@ -73,17 +64,11 @@ export interface CreateOptions extends OperationOptions {
|
|
|
73
64
|
```ts src/testClient.ts class TestClient
|
|
74
65
|
export class TestClient {
|
|
75
66
|
#context: TestClientContext;
|
|
76
|
-
|
|
77
67
|
constructor(endpoint: string, options?: TestClientOptions) {
|
|
78
68
|
this.#context = createTestClientContext(endpoint, options);
|
|
79
69
|
}
|
|
80
70
|
async create(
|
|
81
|
-
widget: {
|
|
82
|
-
id: string;
|
|
83
|
-
name: string;
|
|
84
|
-
age?: string;
|
|
85
|
-
foo?: string;
|
|
86
|
-
},
|
|
71
|
+
widget: { id: string; name: string; age?: string; foo?: string },
|
|
87
72
|
options?: CreateOptions,
|
|
88
73
|
) {
|
|
89
74
|
return create(this.#context, widget, options);
|
|
@@ -14,23 +14,19 @@ Even when there are no parameters defined in the spec, it will have an optional
|
|
|
14
14
|
```ts src/api/testClientOperations.ts function get
|
|
15
15
|
export async function get(client: TestClientContext, options?: GetOptions): Promise<number> {
|
|
16
16
|
const path = parse("/").expand({});
|
|
17
|
-
|
|
18
17
|
const httpRequestOptions = {
|
|
19
18
|
headers: {
|
|
20
19
|
"content-type": options?.contentType ?? "application/json",
|
|
21
20
|
},
|
|
22
21
|
};
|
|
23
|
-
|
|
24
22
|
const response = await client.pathUnchecked(path).get(httpRequestOptions);
|
|
25
23
|
|
|
26
24
|
if (typeof options?.operationOptions?.onResponse === "function") {
|
|
27
25
|
options?.operationOptions?.onResponse(response);
|
|
28
26
|
}
|
|
29
|
-
|
|
30
27
|
if (+response.status === 200 && response.headers["content-type"]?.includes("application/json")) {
|
|
31
28
|
return response.body!;
|
|
32
29
|
}
|
|
33
|
-
|
|
34
30
|
throw createRestError(response);
|
|
35
31
|
}
|
|
36
32
|
```
|
|
@@ -48,7 +44,6 @@ export interface GetOptions extends OperationOptions {
|
|
|
48
44
|
```ts src/testClient.ts class TestClient
|
|
49
45
|
export class TestClient {
|
|
50
46
|
#context: TestClientContext;
|
|
51
|
-
|
|
52
47
|
constructor(endpoint: string, options?: TestClientOptions) {
|
|
53
48
|
this.#context = createTestClientContext(endpoint, options);
|
|
54
49
|
}
|
|
@@ -14,23 +14,19 @@ Even when there are no parameters defined in the spec, it will have an optional
|
|
|
14
14
|
```ts src/api/testClientOperations.ts function get
|
|
15
15
|
export async function get(client: TestClientContext, options?: GetOptions): Promise<number> {
|
|
16
16
|
const path = parse("/").expand({});
|
|
17
|
-
|
|
18
17
|
const httpRequestOptions = {
|
|
19
18
|
headers: {
|
|
20
19
|
"content-type": options?.contentType ?? "application/json",
|
|
21
20
|
},
|
|
22
21
|
};
|
|
23
|
-
|
|
24
22
|
const response = await client.pathUnchecked(path).get(httpRequestOptions);
|
|
25
23
|
|
|
26
24
|
if (typeof options?.operationOptions?.onResponse === "function") {
|
|
27
25
|
options?.operationOptions?.onResponse(response);
|
|
28
26
|
}
|
|
29
|
-
|
|
30
27
|
if (+response.status === 200 && response.headers["content-type"]?.includes("application/json")) {
|
|
31
28
|
return response.body!;
|
|
32
29
|
}
|
|
33
|
-
|
|
34
30
|
throw createRestError(response);
|
|
35
31
|
}
|
|
36
32
|
```
|
|
@@ -48,7 +44,6 @@ export interface GetOptions extends OperationOptions {
|
|
|
48
44
|
```ts src/testClient.ts class TestClient
|
|
49
45
|
export class TestClient {
|
|
50
46
|
#context: TestClientContext;
|
|
51
|
-
|
|
52
47
|
constructor(endpoint: string, options?: TestClientOptions) {
|
|
53
48
|
this.#context = createTestClientContext(endpoint, options);
|
|
54
49
|
}
|
|
@@ -22,7 +22,6 @@ export async function get(
|
|
|
22
22
|
options?: GetOptions,
|
|
23
23
|
): Promise<void> {
|
|
24
24
|
const path = parse("/").expand({});
|
|
25
|
-
|
|
26
25
|
const httpRequestOptions = {
|
|
27
26
|
headers: {},
|
|
28
27
|
body: {
|
|
@@ -30,17 +29,14 @@ export async function get(
|
|
|
30
29
|
name: name,
|
|
31
30
|
},
|
|
32
31
|
};
|
|
33
|
-
|
|
34
32
|
const response = await client.pathUnchecked(path).post(httpRequestOptions);
|
|
35
33
|
|
|
36
34
|
if (typeof options?.operationOptions?.onResponse === "function") {
|
|
37
35
|
options?.operationOptions?.onResponse(response);
|
|
38
36
|
}
|
|
39
|
-
|
|
40
37
|
if (+response.status === 204 && !response.body) {
|
|
41
38
|
return;
|
|
42
39
|
}
|
|
43
|
-
|
|
44
40
|
throw createRestError(response);
|
|
45
41
|
}
|
|
46
42
|
```
|
|
@@ -56,7 +52,6 @@ export interface GetOptions extends OperationOptions {}
|
|
|
56
52
|
```ts src/testClient.ts class TestClient
|
|
57
53
|
export class TestClient {
|
|
58
54
|
#context: TestClientContext;
|
|
59
|
-
|
|
60
55
|
constructor(endpoint: string, options?: TestClientOptions) {
|
|
61
56
|
this.#context = createTestClientContext(endpoint, options);
|
|
62
57
|
}
|
|
@@ -14,21 +14,17 @@ Even when there are no parameters defined in the spec, it will have an optional
|
|
|
14
14
|
```ts src/api/testClientOperations.ts function get
|
|
15
15
|
export async function get(client: TestClientContext, options?: GetOptions): Promise<number> {
|
|
16
16
|
const path = parse("/").expand({});
|
|
17
|
-
|
|
18
17
|
const httpRequestOptions = {
|
|
19
18
|
headers: {},
|
|
20
19
|
};
|
|
21
|
-
|
|
22
20
|
const response = await client.pathUnchecked(path).get(httpRequestOptions);
|
|
23
21
|
|
|
24
22
|
if (typeof options?.operationOptions?.onResponse === "function") {
|
|
25
23
|
options?.operationOptions?.onResponse(response);
|
|
26
24
|
}
|
|
27
|
-
|
|
28
25
|
if (+response.status === 200 && response.headers["content-type"]?.includes("application/json")) {
|
|
29
26
|
return response.body!;
|
|
30
27
|
}
|
|
31
|
-
|
|
32
28
|
throw createRestError(response);
|
|
33
29
|
}
|
|
34
30
|
```
|
|
@@ -44,7 +40,6 @@ export interface GetOptions extends OperationOptions {}
|
|
|
44
40
|
```ts src/testClient.ts class TestClient
|
|
45
41
|
export class TestClient {
|
|
46
42
|
#context: TestClientContext;
|
|
47
|
-
|
|
48
43
|
constructor(endpoint: string, options?: TestClientOptions) {
|
|
49
44
|
this.#context = createTestClientContext(endpoint, options);
|
|
50
45
|
}
|
|
@@ -17,7 +17,6 @@ export async function getWithParams(
|
|
|
17
17
|
options?: GetWithParamsOptions,
|
|
18
18
|
): Promise<number> {
|
|
19
19
|
const path = parse("/").expand({});
|
|
20
|
-
|
|
21
20
|
const httpRequestOptions = {
|
|
22
21
|
headers: {},
|
|
23
22
|
body: {
|
|
@@ -25,17 +24,14 @@ export async function getWithParams(
|
|
|
25
24
|
age: options?.age,
|
|
26
25
|
},
|
|
27
26
|
};
|
|
28
|
-
|
|
29
27
|
const response = await client.pathUnchecked(path).get(httpRequestOptions);
|
|
30
28
|
|
|
31
29
|
if (typeof options?.operationOptions?.onResponse === "function") {
|
|
32
30
|
options?.operationOptions?.onResponse(response);
|
|
33
31
|
}
|
|
34
|
-
|
|
35
32
|
if (+response.status === 200 && response.headers["content-type"]?.includes("application/json")) {
|
|
36
33
|
return response.body!;
|
|
37
34
|
}
|
|
38
|
-
|
|
39
35
|
throw createRestError(response);
|
|
40
36
|
}
|
|
41
37
|
```
|
|
@@ -56,7 +52,6 @@ export interface GetWithParamsOptions extends OperationOptions {
|
|
|
56
52
|
```ts src/testClient.ts class TestClient
|
|
57
53
|
export class TestClient {
|
|
58
54
|
#context: TestClientContext;
|
|
59
|
-
|
|
60
55
|
constructor(endpoint: string, options?: TestClientOptions) {
|
|
61
56
|
this.#context = createTestClientContext(endpoint, options);
|
|
62
57
|
}
|
|
@@ -22,21 +22,17 @@ export async function getWithParams(
|
|
|
22
22
|
name: name,
|
|
23
23
|
age: age,
|
|
24
24
|
});
|
|
25
|
-
|
|
26
25
|
const httpRequestOptions = {
|
|
27
26
|
headers: {},
|
|
28
27
|
};
|
|
29
|
-
|
|
30
28
|
const response = await client.pathUnchecked(path).get(httpRequestOptions);
|
|
31
29
|
|
|
32
30
|
if (typeof options?.operationOptions?.onResponse === "function") {
|
|
33
31
|
options?.operationOptions?.onResponse(response);
|
|
34
32
|
}
|
|
35
|
-
|
|
36
33
|
if (+response.status === 200 && response.headers["content-type"]?.includes("application/json")) {
|
|
37
34
|
return response.body!;
|
|
38
35
|
}
|
|
39
|
-
|
|
40
36
|
throw createRestError(response);
|
|
41
37
|
}
|
|
42
38
|
```
|
|
@@ -52,7 +48,6 @@ export interface GetWithParamsOptions extends OperationOptions {}
|
|
|
52
48
|
```ts src/testClient.ts class TestClient
|
|
53
49
|
export class TestClient {
|
|
54
50
|
#context: TestClientContext;
|
|
55
|
-
|
|
56
51
|
constructor(endpoint: string, options?: TestClientOptions) {
|
|
57
52
|
this.#context = createTestClientContext(endpoint, options);
|
|
58
53
|
}
|
|
@@ -18,7 +18,6 @@ export async function get(
|
|
|
18
18
|
options?: GetOptions,
|
|
19
19
|
): Promise<void> {
|
|
20
20
|
const path = parse("/").expand({});
|
|
21
|
-
|
|
22
21
|
const httpRequestOptions = {
|
|
23
22
|
headers: {},
|
|
24
23
|
body: {
|
|
@@ -26,17 +25,14 @@ export async function get(
|
|
|
26
25
|
break: options?.break_,
|
|
27
26
|
},
|
|
28
27
|
};
|
|
29
|
-
|
|
30
28
|
const response = await client.pathUnchecked(path).get(httpRequestOptions);
|
|
31
29
|
|
|
32
30
|
if (typeof options?.operationOptions?.onResponse === "function") {
|
|
33
31
|
options?.operationOptions?.onResponse(response);
|
|
34
32
|
}
|
|
35
|
-
|
|
36
33
|
if (+response.status === 204 && !response.body) {
|
|
37
34
|
return;
|
|
38
35
|
}
|
|
39
|
-
|
|
40
36
|
throw createRestError(response);
|
|
41
37
|
}
|
|
42
38
|
```
|
|
@@ -54,7 +50,6 @@ export interface GetOptions extends OperationOptions {
|
|
|
54
50
|
```ts src/testClient.ts class TestClient
|
|
55
51
|
export class TestClient {
|
|
56
52
|
#context: TestClientContext;
|
|
57
|
-
|
|
58
53
|
constructor(endpoint: string, options?: TestClientOptions) {
|
|
59
54
|
this.#context = createTestClientContext(endpoint, options);
|
|
60
55
|
}
|
|
@@ -25,7 +25,6 @@ export async function create(
|
|
|
25
25
|
options?: CreateOptions,
|
|
26
26
|
): Promise<void> {
|
|
27
27
|
const path = parse("/").expand({});
|
|
28
|
-
|
|
29
28
|
const httpRequestOptions = {
|
|
30
29
|
headers: {},
|
|
31
30
|
body: {
|
|
@@ -34,17 +33,14 @@ export async function create(
|
|
|
34
33
|
age: options?.age,
|
|
35
34
|
},
|
|
36
35
|
};
|
|
37
|
-
|
|
38
36
|
const response = await client.pathUnchecked(path).post(httpRequestOptions);
|
|
39
37
|
|
|
40
38
|
if (typeof options?.operationOptions?.onResponse === "function") {
|
|
41
39
|
options?.operationOptions?.onResponse(response);
|
|
42
40
|
}
|
|
43
|
-
|
|
44
41
|
if (+response.status === 204 && !response.body) {
|
|
45
42
|
return;
|
|
46
43
|
}
|
|
47
|
-
|
|
48
44
|
throw createRestError(response);
|
|
49
45
|
}
|
|
50
46
|
```
|
|
@@ -64,7 +60,6 @@ export interface CreateOptions extends OperationOptions {
|
|
|
64
60
|
```ts src/testClient.ts class TestClient
|
|
65
61
|
export class TestClient {
|
|
66
62
|
#context: TestClientContext;
|
|
67
|
-
|
|
68
63
|
constructor(endpoint: string, options?: TestClientOptions) {
|
|
69
64
|
this.#context = createTestClientContext(endpoint, options);
|
|
70
65
|
}
|