@tim-smart/openapi-gen 0.1.1 → 0.1.2
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/main.js +11 -6
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -29203,12 +29203,17 @@ var operationToMethod = (operation) => {
|
|
|
29203
29203
|
return `readonly "${operation.id}": (${args.join(", ")}) => Effect.Effect<${success}, ${errors.join(" | ")}>`;
|
|
29204
29204
|
};
|
|
29205
29205
|
var operationsToImpl = (name, operations) => `export const make = (httpClient: HttpClient.HttpClient.Service): ${name} => {
|
|
29206
|
-
const unexpectedStatus = (request: HttpClientRequest.HttpClientRequest, response: HttpClientResponse.HttpClientResponse) =>
|
|
29207
|
-
|
|
29208
|
-
|
|
29209
|
-
|
|
29210
|
-
|
|
29211
|
-
|
|
29206
|
+
const unexpectedStatus = (request: HttpClientRequest.HttpClientRequest, response: HttpClientResponse.HttpClientResponse) =>
|
|
29207
|
+
Effect.flatMap(
|
|
29208
|
+
Effect.orElseSucceed(response.text, () => "Unexpected status code"),
|
|
29209
|
+
(description) =>
|
|
29210
|
+
Effect.fail(new HttpClientError.ResponseError({
|
|
29211
|
+
request,
|
|
29212
|
+
response,
|
|
29213
|
+
reason: "StatusCode",
|
|
29214
|
+
description
|
|
29215
|
+
}))
|
|
29216
|
+
)
|
|
29212
29217
|
const decodeError = <A, I, R>(response: HttpClientResponse.HttpClientResponse, schema: S.Schema<A, I, R>) => Effect.flatMap(HttpClientResponse.schemaBodyJson(schema)(response), Effect.fail)
|
|
29213
29218
|
return {
|
|
29214
29219
|
${operations.map(operationToImpl).join(",\n ")}
|