@greensecurity/javascript-sdk 0.43.1-beta.28 → 0.43.1-beta.30
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/README.md +6 -0
- package/dist/commonjs/__tests__/vendorscans.test.js +36 -0
- package/dist/commonjs/__tests__/vendorscans.test.js.map +1 -1
- package/dist/commonjs/__tests__/zones.test.js +28 -6
- package/dist/commonjs/__tests__/zones.test.js.map +1 -1
- package/dist/commonjs/funcs/vendorScansGetNextScreeningQuestion.d.ts +23 -0
- package/dist/commonjs/funcs/vendorScansGetNextScreeningQuestion.d.ts.map +1 -0
- package/dist/commonjs/funcs/vendorScansGetNextScreeningQuestion.js +133 -0
- package/dist/commonjs/funcs/vendorScansGetNextScreeningQuestion.js.map +1 -0
- package/dist/commonjs/funcs/vendorScansSubmitScreeningResponse.d.ts +22 -0
- package/dist/commonjs/funcs/vendorScansSubmitScreeningResponse.d.ts.map +1 -0
- package/dist/commonjs/funcs/vendorScansSubmitScreeningResponse.js +127 -0
- package/dist/commonjs/funcs/vendorScansSubmitScreeningResponse.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/components/index.d.ts +3 -1
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +3 -1
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/screeninganswer.d.ts +4 -4
- package/dist/commonjs/models/components/screeninganswer.d.ts.map +1 -1
- package/dist/commonjs/models/components/screeninganswer.js +4 -4
- package/dist/commonjs/models/components/screeninganswer.js.map +1 -1
- package/dist/commonjs/models/components/screeningansweractionsummary.d.ts +30 -0
- package/dist/commonjs/models/components/screeningansweractionsummary.d.ts.map +1 -0
- package/dist/commonjs/models/components/{handoff.js → screeningansweractionsummary.js} +11 -20
- package/dist/commonjs/models/components/screeningansweractionsummary.js.map +1 -0
- package/dist/commonjs/models/components/screeningquestion.d.ts +4 -4
- package/dist/commonjs/models/components/screeningquestion.d.ts.map +1 -1
- package/dist/commonjs/models/components/screeningquestion.js +5 -4
- package/dist/commonjs/models/components/screeningquestion.js.map +1 -1
- package/dist/commonjs/models/components/vendorscan.d.ts +3 -0
- package/dist/commonjs/models/components/vendorscan.d.ts.map +1 -1
- package/dist/commonjs/models/components/vendorscan.js +5 -0
- package/dist/commonjs/models/components/vendorscan.js.map +1 -1
- package/dist/commonjs/models/components/vendorscanscreeninganswer.d.ts +33 -0
- package/dist/commonjs/models/components/vendorscanscreeninganswer.d.ts.map +1 -0
- package/dist/commonjs/models/components/vendorscanscreeninganswer.js +78 -0
- package/dist/commonjs/models/components/vendorscanscreeninganswer.js.map +1 -0
- package/dist/commonjs/models/components/vendorscanscreeningquestion.d.ts +55 -0
- package/dist/commonjs/models/components/vendorscanscreeningquestion.d.ts.map +1 -0
- package/dist/commonjs/models/components/vendorscanscreeningquestion.js +77 -0
- package/dist/commonjs/models/components/vendorscanscreeningquestion.js.map +1 -0
- package/dist/commonjs/models/operations/getnextscreeningquestion.d.ts +41 -0
- package/dist/commonjs/models/operations/getnextscreeningquestion.d.ts.map +1 -0
- package/dist/commonjs/models/operations/getnextscreeningquestion.js +69 -0
- package/dist/commonjs/models/operations/getnextscreeningquestion.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +2 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +2 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/securityzonecheckin.d.ts +24 -4
- package/dist/commonjs/models/operations/securityzonecheckin.d.ts.map +1 -1
- package/dist/commonjs/models/operations/securityzonecheckin.js +31 -2
- package/dist/commonjs/models/operations/securityzonecheckin.js.map +1 -1
- package/dist/commonjs/models/operations/submitscreeningresponse.d.ts +80 -0
- package/dist/commonjs/models/operations/submitscreeningresponse.d.ts.map +1 -0
- package/dist/commonjs/models/operations/submitscreeningresponse.js +93 -0
- package/dist/commonjs/models/operations/submitscreeningresponse.js.map +1 -0
- package/dist/commonjs/react-query/index.d.ts +2 -0
- package/dist/commonjs/react-query/index.d.ts.map +1 -1
- package/dist/commonjs/react-query/index.js +2 -0
- package/dist/commonjs/react-query/index.js.map +1 -1
- package/dist/commonjs/react-query/vendorScansGetNextScreeningQuestion.core.d.ts +16 -0
- package/dist/commonjs/react-query/vendorScansGetNextScreeningQuestion.core.d.ts.map +1 -0
- package/dist/commonjs/react-query/vendorScansGetNextScreeningQuestion.core.js +43 -0
- package/dist/commonjs/react-query/vendorScansGetNextScreeningQuestion.core.js.map +1 -0
- package/dist/commonjs/react-query/vendorScansGetNextScreeningQuestion.d.ts +46 -0
- package/dist/commonjs/react-query/vendorScansGetNextScreeningQuestion.d.ts.map +1 -0
- package/dist/commonjs/react-query/vendorScansGetNextScreeningQuestion.js +79 -0
- package/dist/commonjs/react-query/vendorScansGetNextScreeningQuestion.js.map +1 -0
- package/dist/commonjs/react-query/vendorScansSubmitScreeningResponse.d.ts +27 -0
- package/dist/commonjs/react-query/vendorScansSubmitScreeningResponse.d.ts.map +1 -0
- package/dist/commonjs/react-query/vendorScansSubmitScreeningResponse.js +55 -0
- package/dist/commonjs/react-query/vendorScansSubmitScreeningResponse.js.map +1 -0
- package/dist/commonjs/sdk/vendorscans.d.ts +23 -0
- package/dist/commonjs/sdk/vendorscans.d.ts.map +1 -1
- package/dist/commonjs/sdk/vendorscans.js +29 -0
- package/dist/commonjs/sdk/vendorscans.js.map +1 -1
- package/dist/esm/__tests__/vendorscans.test.js +36 -0
- package/dist/esm/__tests__/vendorscans.test.js.map +1 -1
- package/dist/esm/__tests__/zones.test.js +28 -6
- package/dist/esm/__tests__/zones.test.js.map +1 -1
- package/dist/esm/funcs/vendorScansGetNextScreeningQuestion.d.ts +23 -0
- package/dist/esm/funcs/vendorScansGetNextScreeningQuestion.d.ts.map +1 -0
- package/dist/esm/funcs/vendorScansGetNextScreeningQuestion.js +97 -0
- package/dist/esm/funcs/vendorScansGetNextScreeningQuestion.js.map +1 -0
- package/dist/esm/funcs/vendorScansSubmitScreeningResponse.d.ts +22 -0
- package/dist/esm/funcs/vendorScansSubmitScreeningResponse.d.ts.map +1 -0
- package/dist/esm/funcs/vendorScansSubmitScreeningResponse.js +91 -0
- package/dist/esm/funcs/vendorScansSubmitScreeningResponse.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/components/index.d.ts +3 -1
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +3 -1
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/screeninganswer.d.ts +4 -4
- package/dist/esm/models/components/screeninganswer.d.ts.map +1 -1
- package/dist/esm/models/components/screeninganswer.js +3 -3
- package/dist/esm/models/components/screeninganswer.js.map +1 -1
- package/dist/esm/models/components/screeningansweractionsummary.d.ts +30 -0
- package/dist/esm/models/components/screeningansweractionsummary.d.ts.map +1 -0
- package/dist/esm/models/components/screeningansweractionsummary.js +22 -0
- package/dist/esm/models/components/screeningansweractionsummary.js.map +1 -0
- package/dist/esm/models/components/screeningquestion.d.ts +4 -4
- package/dist/esm/models/components/screeningquestion.d.ts.map +1 -1
- package/dist/esm/models/components/screeningquestion.js +4 -3
- package/dist/esm/models/components/screeningquestion.js.map +1 -1
- package/dist/esm/models/components/vendorscan.d.ts +3 -0
- package/dist/esm/models/components/vendorscan.d.ts.map +1 -1
- package/dist/esm/models/components/vendorscan.js +5 -0
- package/dist/esm/models/components/vendorscan.js.map +1 -1
- package/dist/esm/models/components/vendorscanscreeninganswer.d.ts +33 -0
- package/dist/esm/models/components/vendorscanscreeninganswer.d.ts.map +1 -0
- package/dist/esm/models/components/vendorscanscreeninganswer.js +41 -0
- package/dist/esm/models/components/vendorscanscreeninganswer.js.map +1 -0
- package/dist/esm/models/components/vendorscanscreeningquestion.d.ts +55 -0
- package/dist/esm/models/components/vendorscanscreeningquestion.d.ts.map +1 -0
- package/dist/esm/models/components/vendorscanscreeningquestion.js +40 -0
- package/dist/esm/models/components/vendorscanscreeningquestion.js.map +1 -0
- package/dist/esm/models/operations/getnextscreeningquestion.d.ts +41 -0
- package/dist/esm/models/operations/getnextscreeningquestion.d.ts.map +1 -0
- package/dist/esm/models/operations/getnextscreeningquestion.js +31 -0
- package/dist/esm/models/operations/getnextscreeningquestion.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +2 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +2 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/securityzonecheckin.d.ts +24 -4
- package/dist/esm/models/operations/securityzonecheckin.d.ts.map +1 -1
- package/dist/esm/models/operations/securityzonecheckin.js +28 -1
- package/dist/esm/models/operations/securityzonecheckin.js.map +1 -1
- package/dist/esm/models/operations/submitscreeningresponse.d.ts +80 -0
- package/dist/esm/models/operations/submitscreeningresponse.d.ts.map +1 -0
- package/dist/esm/models/operations/submitscreeningresponse.js +54 -0
- package/dist/esm/models/operations/submitscreeningresponse.js.map +1 -0
- package/dist/esm/react-query/index.d.ts +2 -0
- package/dist/esm/react-query/index.d.ts.map +1 -1
- package/dist/esm/react-query/index.js +2 -0
- package/dist/esm/react-query/index.js.map +1 -1
- package/dist/esm/react-query/vendorScansGetNextScreeningQuestion.core.d.ts +16 -0
- package/dist/esm/react-query/vendorScansGetNextScreeningQuestion.core.d.ts.map +1 -0
- package/dist/esm/react-query/vendorScansGetNextScreeningQuestion.core.js +38 -0
- package/dist/esm/react-query/vendorScansGetNextScreeningQuestion.core.js.map +1 -0
- package/dist/esm/react-query/vendorScansGetNextScreeningQuestion.d.ts +46 -0
- package/dist/esm/react-query/vendorScansGetNextScreeningQuestion.d.ts.map +1 -0
- package/dist/esm/react-query/vendorScansGetNextScreeningQuestion.js +69 -0
- package/dist/esm/react-query/vendorScansGetNextScreeningQuestion.js.map +1 -0
- package/dist/esm/react-query/vendorScansSubmitScreeningResponse.d.ts +27 -0
- package/dist/esm/react-query/vendorScansSubmitScreeningResponse.d.ts.map +1 -0
- package/dist/esm/react-query/vendorScansSubmitScreeningResponse.js +50 -0
- package/dist/esm/react-query/vendorScansSubmitScreeningResponse.js.map +1 -0
- package/dist/esm/sdk/vendorscans.d.ts +23 -0
- package/dist/esm/sdk/vendorscans.d.ts.map +1 -1
- package/dist/esm/sdk/vendorscans.js +29 -0
- package/dist/esm/sdk/vendorscans.js.map +1 -1
- package/examples/package-lock.json +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/__tests__/vendorscans.test.ts +42 -0
- package/src/__tests__/zones.test.ts +28 -6
- package/src/funcs/vendorScansGetNextScreeningQuestion.ts +192 -0
- package/src/funcs/vendorScansSubmitScreeningResponse.ts +180 -0
- package/src/lib/config.ts +2 -2
- package/src/models/components/index.ts +3 -1
- package/src/models/components/screeninganswer.ts +9 -7
- package/src/models/components/screeningansweractionsummary.ts +60 -0
- package/src/models/components/screeningquestion.ts +10 -7
- package/src/models/components/vendorscan.ts +8 -0
- package/src/models/components/vendorscanscreeninganswer.ts +80 -0
- package/src/models/components/vendorscanscreeningquestion.ts +100 -0
- package/src/models/operations/getnextscreeningquestion.ts +91 -0
- package/src/models/operations/index.ts +2 -0
- package/src/models/operations/securityzonecheckin.ts +71 -5
- package/src/models/operations/submitscreeningresponse.ts +169 -0
- package/src/react-query/index.ts +2 -0
- package/src/react-query/vendorScansGetNextScreeningQuestion.core.ts +87 -0
- package/src/react-query/vendorScansGetNextScreeningQuestion.ts +143 -0
- package/src/react-query/vendorScansSubmitScreeningResponse.ts +97 -0
- package/src/sdk/vendorscans.ts +45 -0
- package/dist/commonjs/models/components/handoff.d.ts +0 -24
- package/dist/commonjs/models/components/handoff.d.ts.map +0 -1
- package/dist/commonjs/models/components/handoff.js.map +0 -1
- package/dist/esm/models/components/handoff.d.ts +0 -24
- package/dist/esm/models/components/handoff.d.ts.map +0 -1
- package/dist/esm/models/components/handoff.js +0 -31
- package/dist/esm/models/components/handoff.js.map +0 -1
- package/src/models/components/handoff.ts +0 -59
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { GreenSecurityCore } from "../core.js";
|
|
6
|
+
import { encodeFormQuery, encodeSimple, queryJoin } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import { GreenSecurityError } from "../models/errors/greensecurityerror.js";
|
|
14
|
+
import {
|
|
15
|
+
ConnectionError,
|
|
16
|
+
InvalidRequestError,
|
|
17
|
+
RequestAbortedError,
|
|
18
|
+
RequestTimeoutError,
|
|
19
|
+
UnexpectedClientError,
|
|
20
|
+
} from "../models/errors/httpclienterrors.js";
|
|
21
|
+
import * as errors from "../models/errors/index.js";
|
|
22
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
23
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
+
import * as operations from "../models/operations/index.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
26
|
+
import { Result } from "../types/fp.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Get the next unanswered screening questions for a vendor scan
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Retrieve the next unanswered screening question for the specified vendor scan.
|
|
33
|
+
* If a question exists, the endpoint returns the question and its available answers.
|
|
34
|
+
*
|
|
35
|
+
* Available `expand` scopes are:
|
|
36
|
+
*
|
|
37
|
+
* screening_question.screening_answers
|
|
38
|
+
*/
|
|
39
|
+
export function vendorScansGetNextScreeningQuestion(
|
|
40
|
+
client: GreenSecurityCore,
|
|
41
|
+
request: operations.GetNextScreeningQuestionRequest,
|
|
42
|
+
options?: RequestOptions,
|
|
43
|
+
): APIPromise<
|
|
44
|
+
Result<
|
|
45
|
+
operations.GetNextScreeningQuestionResponseBody,
|
|
46
|
+
| errors.ApiErrorResponse
|
|
47
|
+
| GreenSecurityError
|
|
48
|
+
| ResponseValidationError
|
|
49
|
+
| ConnectionError
|
|
50
|
+
| RequestAbortedError
|
|
51
|
+
| RequestTimeoutError
|
|
52
|
+
| InvalidRequestError
|
|
53
|
+
| UnexpectedClientError
|
|
54
|
+
| SDKValidationError
|
|
55
|
+
>
|
|
56
|
+
> {
|
|
57
|
+
return new APIPromise($do(
|
|
58
|
+
client,
|
|
59
|
+
request,
|
|
60
|
+
options,
|
|
61
|
+
));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async function $do(
|
|
65
|
+
client: GreenSecurityCore,
|
|
66
|
+
request: operations.GetNextScreeningQuestionRequest,
|
|
67
|
+
options?: RequestOptions,
|
|
68
|
+
): Promise<
|
|
69
|
+
[
|
|
70
|
+
Result<
|
|
71
|
+
operations.GetNextScreeningQuestionResponseBody,
|
|
72
|
+
| errors.ApiErrorResponse
|
|
73
|
+
| GreenSecurityError
|
|
74
|
+
| ResponseValidationError
|
|
75
|
+
| ConnectionError
|
|
76
|
+
| RequestAbortedError
|
|
77
|
+
| RequestTimeoutError
|
|
78
|
+
| InvalidRequestError
|
|
79
|
+
| UnexpectedClientError
|
|
80
|
+
| SDKValidationError
|
|
81
|
+
>,
|
|
82
|
+
APICall,
|
|
83
|
+
]
|
|
84
|
+
> {
|
|
85
|
+
const parsed = safeParse(
|
|
86
|
+
request,
|
|
87
|
+
(value) =>
|
|
88
|
+
operations.GetNextScreeningQuestionRequest$outboundSchema.parse(value),
|
|
89
|
+
"Input validation failed",
|
|
90
|
+
);
|
|
91
|
+
if (!parsed.ok) {
|
|
92
|
+
return [parsed, { status: "invalid" }];
|
|
93
|
+
}
|
|
94
|
+
const payload = parsed.value;
|
|
95
|
+
const body = null;
|
|
96
|
+
|
|
97
|
+
const pathParams = {
|
|
98
|
+
id: encodeSimple("id", payload.id, {
|
|
99
|
+
explode: false,
|
|
100
|
+
charEncoding: "percent",
|
|
101
|
+
}),
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const path = pathToFunc(
|
|
105
|
+
"/vendor-scans/{id}/screening-questions/next-question",
|
|
106
|
+
)(pathParams);
|
|
107
|
+
|
|
108
|
+
const query = queryJoin(
|
|
109
|
+
encodeFormQuery({
|
|
110
|
+
"expand": payload.expand,
|
|
111
|
+
}, { explode: false }),
|
|
112
|
+
encodeFormQuery({
|
|
113
|
+
"vendor_id": payload.vendor_id,
|
|
114
|
+
}),
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
const headers = new Headers(compactMap({
|
|
118
|
+
Accept: "application/json",
|
|
119
|
+
}));
|
|
120
|
+
|
|
121
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
122
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
123
|
+
|
|
124
|
+
const context = {
|
|
125
|
+
options: client._options,
|
|
126
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
127
|
+
operationID: "getNextScreeningQuestion",
|
|
128
|
+
oAuth2Scopes: null,
|
|
129
|
+
|
|
130
|
+
resolvedSecurity: requestSecurity,
|
|
131
|
+
|
|
132
|
+
securitySource: client._options.security,
|
|
133
|
+
retryConfig: options?.retries
|
|
134
|
+
|| client._options.retryConfig
|
|
135
|
+
|| { strategy: "none" },
|
|
136
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const requestRes = client._createRequest(context, {
|
|
140
|
+
security: requestSecurity,
|
|
141
|
+
method: "GET",
|
|
142
|
+
baseURL: options?.serverURL,
|
|
143
|
+
path: path,
|
|
144
|
+
headers: headers,
|
|
145
|
+
query: query,
|
|
146
|
+
body: body,
|
|
147
|
+
userAgent: client._options.userAgent,
|
|
148
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
149
|
+
}, options);
|
|
150
|
+
if (!requestRes.ok) {
|
|
151
|
+
return [requestRes, { status: "invalid" }];
|
|
152
|
+
}
|
|
153
|
+
const req = requestRes.value;
|
|
154
|
+
|
|
155
|
+
const doResult = await client._do(req, {
|
|
156
|
+
context,
|
|
157
|
+
errorCodes: ["400", "401", "403", "404", "4XX", "500", "5XX"],
|
|
158
|
+
retryConfig: context.retryConfig,
|
|
159
|
+
retryCodes: context.retryCodes,
|
|
160
|
+
});
|
|
161
|
+
if (!doResult.ok) {
|
|
162
|
+
return [doResult, { status: "request-error", request: req }];
|
|
163
|
+
}
|
|
164
|
+
const response = doResult.value;
|
|
165
|
+
|
|
166
|
+
const responseFields = {
|
|
167
|
+
HttpMeta: { Response: response, Request: req },
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const [result] = await M.match<
|
|
171
|
+
operations.GetNextScreeningQuestionResponseBody,
|
|
172
|
+
| errors.ApiErrorResponse
|
|
173
|
+
| GreenSecurityError
|
|
174
|
+
| ResponseValidationError
|
|
175
|
+
| ConnectionError
|
|
176
|
+
| RequestAbortedError
|
|
177
|
+
| RequestTimeoutError
|
|
178
|
+
| InvalidRequestError
|
|
179
|
+
| UnexpectedClientError
|
|
180
|
+
| SDKValidationError
|
|
181
|
+
>(
|
|
182
|
+
M.json(200, operations.GetNextScreeningQuestionResponseBody$inboundSchema),
|
|
183
|
+
M.jsonErr([400, 401, 403, 404], errors.ApiErrorResponse$inboundSchema),
|
|
184
|
+
M.fail("4XX"),
|
|
185
|
+
M.fail([500, "5XX"]),
|
|
186
|
+
)(response, req, { extraFields: responseFields });
|
|
187
|
+
if (!result.ok) {
|
|
188
|
+
return [result, { status: "complete", request: req, response }];
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return [result, { status: "complete", request: req, response }];
|
|
192
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { GreenSecurityCore } from "../core.js";
|
|
6
|
+
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import { GreenSecurityError } from "../models/errors/greensecurityerror.js";
|
|
14
|
+
import {
|
|
15
|
+
ConnectionError,
|
|
16
|
+
InvalidRequestError,
|
|
17
|
+
RequestAbortedError,
|
|
18
|
+
RequestTimeoutError,
|
|
19
|
+
UnexpectedClientError,
|
|
20
|
+
} from "../models/errors/httpclienterrors.js";
|
|
21
|
+
import * as errors from "../models/errors/index.js";
|
|
22
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
23
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
+
import * as operations from "../models/operations/index.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
26
|
+
import { Result } from "../types/fp.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Create a screening response for a vendor scan
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Submits a response to a screening question for the specified vendor scan.
|
|
33
|
+
* The response may contain a single selected answer, multiple answer IDs
|
|
34
|
+
* (for multi-select questions), or a custom free-text answer. The endpoint
|
|
35
|
+
* also executes any triggered actions associated with the response and
|
|
36
|
+
* indicates whether there is a next screening question.
|
|
37
|
+
*/
|
|
38
|
+
export function vendorScansSubmitScreeningResponse(
|
|
39
|
+
client: GreenSecurityCore,
|
|
40
|
+
request: operations.SubmitScreeningResponseRequest,
|
|
41
|
+
options?: RequestOptions,
|
|
42
|
+
): APIPromise<
|
|
43
|
+
Result<
|
|
44
|
+
operations.SubmitScreeningResponseResponseBody,
|
|
45
|
+
| errors.ApiErrorResponse
|
|
46
|
+
| GreenSecurityError
|
|
47
|
+
| ResponseValidationError
|
|
48
|
+
| ConnectionError
|
|
49
|
+
| RequestAbortedError
|
|
50
|
+
| RequestTimeoutError
|
|
51
|
+
| InvalidRequestError
|
|
52
|
+
| UnexpectedClientError
|
|
53
|
+
| SDKValidationError
|
|
54
|
+
>
|
|
55
|
+
> {
|
|
56
|
+
return new APIPromise($do(
|
|
57
|
+
client,
|
|
58
|
+
request,
|
|
59
|
+
options,
|
|
60
|
+
));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function $do(
|
|
64
|
+
client: GreenSecurityCore,
|
|
65
|
+
request: operations.SubmitScreeningResponseRequest,
|
|
66
|
+
options?: RequestOptions,
|
|
67
|
+
): Promise<
|
|
68
|
+
[
|
|
69
|
+
Result<
|
|
70
|
+
operations.SubmitScreeningResponseResponseBody,
|
|
71
|
+
| errors.ApiErrorResponse
|
|
72
|
+
| GreenSecurityError
|
|
73
|
+
| ResponseValidationError
|
|
74
|
+
| ConnectionError
|
|
75
|
+
| RequestAbortedError
|
|
76
|
+
| RequestTimeoutError
|
|
77
|
+
| InvalidRequestError
|
|
78
|
+
| UnexpectedClientError
|
|
79
|
+
| SDKValidationError
|
|
80
|
+
>,
|
|
81
|
+
APICall,
|
|
82
|
+
]
|
|
83
|
+
> {
|
|
84
|
+
const parsed = safeParse(
|
|
85
|
+
request,
|
|
86
|
+
(value) =>
|
|
87
|
+
operations.SubmitScreeningResponseRequest$outboundSchema.parse(value),
|
|
88
|
+
"Input validation failed",
|
|
89
|
+
);
|
|
90
|
+
if (!parsed.ok) {
|
|
91
|
+
return [parsed, { status: "invalid" }];
|
|
92
|
+
}
|
|
93
|
+
const payload = parsed.value;
|
|
94
|
+
const body = encodeJSON("body", payload.RequestBody, { explode: true });
|
|
95
|
+
|
|
96
|
+
const pathParams = {
|
|
97
|
+
id: encodeSimple("id", payload.id, {
|
|
98
|
+
explode: false,
|
|
99
|
+
charEncoding: "percent",
|
|
100
|
+
}),
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const path = pathToFunc("/vendor-scans/{id}/screening-response")(pathParams);
|
|
104
|
+
|
|
105
|
+
const headers = new Headers(compactMap({
|
|
106
|
+
"Content-Type": "application/json",
|
|
107
|
+
Accept: "application/json",
|
|
108
|
+
}));
|
|
109
|
+
|
|
110
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
111
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
112
|
+
|
|
113
|
+
const context = {
|
|
114
|
+
options: client._options,
|
|
115
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
116
|
+
operationID: "submitScreeningResponse",
|
|
117
|
+
oAuth2Scopes: null,
|
|
118
|
+
|
|
119
|
+
resolvedSecurity: requestSecurity,
|
|
120
|
+
|
|
121
|
+
securitySource: client._options.security,
|
|
122
|
+
retryConfig: options?.retries
|
|
123
|
+
|| client._options.retryConfig
|
|
124
|
+
|| { strategy: "none" },
|
|
125
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const requestRes = client._createRequest(context, {
|
|
129
|
+
security: requestSecurity,
|
|
130
|
+
method: "POST",
|
|
131
|
+
baseURL: options?.serverURL,
|
|
132
|
+
path: path,
|
|
133
|
+
headers: headers,
|
|
134
|
+
body: body,
|
|
135
|
+
userAgent: client._options.userAgent,
|
|
136
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
137
|
+
}, options);
|
|
138
|
+
if (!requestRes.ok) {
|
|
139
|
+
return [requestRes, { status: "invalid" }];
|
|
140
|
+
}
|
|
141
|
+
const req = requestRes.value;
|
|
142
|
+
|
|
143
|
+
const doResult = await client._do(req, {
|
|
144
|
+
context,
|
|
145
|
+
errorCodes: ["400", "401", "403", "404", "4XX", "500", "5XX"],
|
|
146
|
+
retryConfig: context.retryConfig,
|
|
147
|
+
retryCodes: context.retryCodes,
|
|
148
|
+
});
|
|
149
|
+
if (!doResult.ok) {
|
|
150
|
+
return [doResult, { status: "request-error", request: req }];
|
|
151
|
+
}
|
|
152
|
+
const response = doResult.value;
|
|
153
|
+
|
|
154
|
+
const responseFields = {
|
|
155
|
+
HttpMeta: { Response: response, Request: req },
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const [result] = await M.match<
|
|
159
|
+
operations.SubmitScreeningResponseResponseBody,
|
|
160
|
+
| errors.ApiErrorResponse
|
|
161
|
+
| GreenSecurityError
|
|
162
|
+
| ResponseValidationError
|
|
163
|
+
| ConnectionError
|
|
164
|
+
| RequestAbortedError
|
|
165
|
+
| RequestTimeoutError
|
|
166
|
+
| InvalidRequestError
|
|
167
|
+
| UnexpectedClientError
|
|
168
|
+
| SDKValidationError
|
|
169
|
+
>(
|
|
170
|
+
M.json(200, operations.SubmitScreeningResponseResponseBody$inboundSchema),
|
|
171
|
+
M.jsonErr([400, 401, 403, 404], errors.ApiErrorResponse$inboundSchema),
|
|
172
|
+
M.fail("4XX"),
|
|
173
|
+
M.fail([500, "5XX"]),
|
|
174
|
+
)(response, req, { extraFields: responseFields });
|
|
175
|
+
if (!result.ok) {
|
|
176
|
+
return [result, { status: "complete", request: req, response }];
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return [result, { status: "complete", request: req, response }];
|
|
180
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -80,8 +80,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
80
80
|
export const SDK_METADATA = {
|
|
81
81
|
language: "typescript",
|
|
82
82
|
openapiDocVersion: "0.0.11",
|
|
83
|
-
sdkVersion: "0.43.1-beta.
|
|
83
|
+
sdkVersion: "0.43.1-beta.28",
|
|
84
84
|
genVersion: "2.794.1",
|
|
85
85
|
userAgent:
|
|
86
|
-
"speakeasy-sdk/typescript 0.43.1-beta.
|
|
86
|
+
"speakeasy-sdk/typescript 0.43.1-beta.28 2.794.1 0.0.11 @greensecurity/javascript-sdk",
|
|
87
87
|
} as const;
|
|
@@ -31,7 +31,6 @@ export * from "./fhirconfigcreate.js";
|
|
|
31
31
|
export * from "./fhirconfigpartialupdate.js";
|
|
32
32
|
export * from "./fhirextraentities.js";
|
|
33
33
|
export * from "./financialstatus.js";
|
|
34
|
-
export * from "./handoff.js";
|
|
35
34
|
export * from "./imageset.js";
|
|
36
35
|
export * from "./invitee.js";
|
|
37
36
|
export * from "./invoice.js";
|
|
@@ -49,6 +48,7 @@ export * from "./productvariant.js";
|
|
|
49
48
|
export * from "./samlloginrequiredresponse.js";
|
|
50
49
|
export * from "./scantype.js";
|
|
51
50
|
export * from "./screeninganswer.js";
|
|
51
|
+
export * from "./screeningansweractionsummary.js";
|
|
52
52
|
export * from "./screeningquestion.js";
|
|
53
53
|
export * from "./screeningresponse.js";
|
|
54
54
|
export * from "./security.js";
|
|
@@ -73,6 +73,8 @@ export * from "./vendorjobtitle.js";
|
|
|
73
73
|
export * from "./vendormanagedbycompany.js";
|
|
74
74
|
export * from "./vendorrequiredcredential.js";
|
|
75
75
|
export * from "./vendorscan.js";
|
|
76
|
+
export * from "./vendorscanscreeninganswer.js";
|
|
77
|
+
export * from "./vendorscanscreeningquestion.js";
|
|
76
78
|
export * from "./vendorscrubdetails.js";
|
|
77
79
|
export * from "./vendorscrubpurchase.js";
|
|
78
80
|
export * from "./vendortype.js";
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
/**
|
|
19
19
|
* The type of answer option.
|
|
20
20
|
*/
|
|
21
|
-
export const
|
|
21
|
+
export const ScreeningAnswerAnswerType = {
|
|
22
22
|
Preset: "preset",
|
|
23
23
|
Date: "date",
|
|
24
24
|
ShortAnswer: "short answer",
|
|
@@ -27,7 +27,9 @@ export const AnswerType = {
|
|
|
27
27
|
/**
|
|
28
28
|
* The type of answer option.
|
|
29
29
|
*/
|
|
30
|
-
export type
|
|
30
|
+
export type ScreeningAnswerAnswerType = OpenEnum<
|
|
31
|
+
typeof ScreeningAnswerAnswerType
|
|
32
|
+
>;
|
|
31
33
|
|
|
32
34
|
/**
|
|
33
35
|
* Reduced list of attributes of ScreeningAnswer records
|
|
@@ -42,7 +44,7 @@ export type ScreeningAnswer = {
|
|
|
42
44
|
/**
|
|
43
45
|
* The type of answer option.
|
|
44
46
|
*/
|
|
45
|
-
answerType?:
|
|
47
|
+
answerType?: ScreeningAnswerAnswerType | null | undefined;
|
|
46
48
|
/**
|
|
47
49
|
* The title or label for the answer input field.
|
|
48
50
|
*/
|
|
@@ -68,11 +70,11 @@ export type ScreeningAnswer = {
|
|
|
68
70
|
};
|
|
69
71
|
|
|
70
72
|
/** @internal */
|
|
71
|
-
export const
|
|
72
|
-
|
|
73
|
+
export const ScreeningAnswerAnswerType$inboundSchema: z.ZodType<
|
|
74
|
+
ScreeningAnswerAnswerType,
|
|
73
75
|
z.ZodTypeDef,
|
|
74
76
|
unknown
|
|
75
|
-
> = openEnums.inboundSchema(
|
|
77
|
+
> = openEnums.inboundSchema(ScreeningAnswerAnswerType);
|
|
76
78
|
|
|
77
79
|
/** @internal */
|
|
78
80
|
export const ScreeningAnswer$inboundSchema: z.ZodType<
|
|
@@ -83,7 +85,7 @@ export const ScreeningAnswer$inboundSchema: z.ZodType<
|
|
|
83
85
|
id: types.number(),
|
|
84
86
|
screening_question_id: z.nullable(types.number()).optional(),
|
|
85
87
|
answer: z.nullable(types.string()).optional(),
|
|
86
|
-
answer_type: z.nullable(
|
|
88
|
+
answer_type: z.nullable(ScreeningAnswerAnswerType$inboundSchema).optional(),
|
|
87
89
|
answer_title: z.nullable(types.string()).optional(),
|
|
88
90
|
allow_empty_answer: types.boolean(),
|
|
89
91
|
empty_answer_error_message: z.nullable(types.string()).optional(),
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import * as types from "../../types/primitives.js";
|
|
10
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Reduced representation of a triggered action returned when the screening flow finishes for a vendor scan.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
*/
|
|
17
|
+
export type ScreeningAnswerActionSummary = {
|
|
18
|
+
/**
|
|
19
|
+
* Human-readable explanation of the triggered action.
|
|
20
|
+
*/
|
|
21
|
+
explanation?: string | null | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Indicates whether further screening questions should be stopped as a result of this action.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
*/
|
|
27
|
+
stopQuestions?: boolean | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Indicates whether further check-ins should be stopped as a result of this action.
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
*/
|
|
33
|
+
stopCheckin?: boolean | undefined;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** @internal */
|
|
37
|
+
export const ScreeningAnswerActionSummary$inboundSchema: z.ZodType<
|
|
38
|
+
ScreeningAnswerActionSummary,
|
|
39
|
+
z.ZodTypeDef,
|
|
40
|
+
unknown
|
|
41
|
+
> = z.object({
|
|
42
|
+
explanation: z.nullable(types.string()).optional(),
|
|
43
|
+
stop_questions: types.optional(types.boolean()),
|
|
44
|
+
stop_checkin: types.optional(types.boolean()),
|
|
45
|
+
}).transform((v) => {
|
|
46
|
+
return remap$(v, {
|
|
47
|
+
"stop_questions": "stopQuestions",
|
|
48
|
+
"stop_checkin": "stopCheckin",
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export function screeningAnswerActionSummaryFromJSON(
|
|
53
|
+
jsonString: string,
|
|
54
|
+
): SafeParseResult<ScreeningAnswerActionSummary, SDKValidationError> {
|
|
55
|
+
return safeParse(
|
|
56
|
+
jsonString,
|
|
57
|
+
(x) => ScreeningAnswerActionSummary$inboundSchema.parse(JSON.parse(x)),
|
|
58
|
+
`Failed to parse 'ScreeningAnswerActionSummary' from JSON`,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
/**
|
|
19
19
|
* The display format for the question.
|
|
20
20
|
*/
|
|
21
|
-
export const
|
|
21
|
+
export const ScreeningQuestionPresetDisplayAs = {
|
|
22
22
|
FloatingButtons: "floating buttons",
|
|
23
23
|
LineButtons: "line buttons",
|
|
24
24
|
Radio: "radio",
|
|
@@ -29,7 +29,9 @@ export const PresetDisplayAs = {
|
|
|
29
29
|
/**
|
|
30
30
|
* The display format for the question.
|
|
31
31
|
*/
|
|
32
|
-
export type
|
|
32
|
+
export type ScreeningQuestionPresetDisplayAs = OpenEnum<
|
|
33
|
+
typeof ScreeningQuestionPresetDisplayAs
|
|
34
|
+
>;
|
|
33
35
|
|
|
34
36
|
/**
|
|
35
37
|
* Reduced list of attributes of ScreeningQuestion record
|
|
@@ -49,16 +51,16 @@ export type ScreeningQuestion = {
|
|
|
49
51
|
/**
|
|
50
52
|
* The display format for the question.
|
|
51
53
|
*/
|
|
52
|
-
presetDisplayAs?:
|
|
54
|
+
presetDisplayAs?: ScreeningQuestionPresetDisplayAs | null | undefined;
|
|
53
55
|
screeningAnswers?: Array<ScreeningAnswer> | undefined;
|
|
54
56
|
};
|
|
55
57
|
|
|
56
58
|
/** @internal */
|
|
57
|
-
export const
|
|
58
|
-
|
|
59
|
+
export const ScreeningQuestionPresetDisplayAs$inboundSchema: z.ZodType<
|
|
60
|
+
ScreeningQuestionPresetDisplayAs,
|
|
59
61
|
z.ZodTypeDef,
|
|
60
62
|
unknown
|
|
61
|
-
> = openEnums.inboundSchema(
|
|
63
|
+
> = openEnums.inboundSchema(ScreeningQuestionPresetDisplayAs);
|
|
62
64
|
|
|
63
65
|
/** @internal */
|
|
64
66
|
export const ScreeningQuestion$inboundSchema: z.ZodType<
|
|
@@ -71,7 +73,8 @@ export const ScreeningQuestion$inboundSchema: z.ZodType<
|
|
|
71
73
|
screening_answer_id: z.nullable(types.number()).optional(),
|
|
72
74
|
priority: z.nullable(types.number()).optional(),
|
|
73
75
|
question: z.nullable(types.string()).optional(),
|
|
74
|
-
preset_display_as: z.nullable(
|
|
76
|
+
preset_display_as: z.nullable(ScreeningQuestionPresetDisplayAs$inboundSchema)
|
|
77
|
+
.optional(),
|
|
75
78
|
screening_answers: types.optional(
|
|
76
79
|
z.array(z.lazy(() => ScreeningAnswer$inboundSchema)),
|
|
77
80
|
),
|
|
@@ -31,6 +31,9 @@ export type VendorScan = {
|
|
|
31
31
|
scanInVendorScanId?: number | null | undefined;
|
|
32
32
|
scanOutVendorScanId?: number | null | undefined;
|
|
33
33
|
autoScanOut?: boolean | undefined;
|
|
34
|
+
finishedScreeningQuestions?: boolean | undefined;
|
|
35
|
+
requiresScreeningQuestions?: boolean | undefined;
|
|
36
|
+
recheck?: boolean | undefined;
|
|
34
37
|
};
|
|
35
38
|
|
|
36
39
|
/** @internal */
|
|
@@ -71,6 +74,9 @@ export const VendorScan$inboundSchema: z.ZodType<
|
|
|
71
74
|
scan_in_vendor_scan_id: z.nullable(types.number()).optional(),
|
|
72
75
|
scan_out_vendor_scan_id: z.nullable(types.number()).optional(),
|
|
73
76
|
auto_scan_out: types.optional(types.boolean()),
|
|
77
|
+
finished_screening_questions: types.optional(types.boolean()),
|
|
78
|
+
requires_screening_questions: types.optional(types.boolean()),
|
|
79
|
+
recheck: types.optional(types.boolean()),
|
|
74
80
|
}).transform((v) => {
|
|
75
81
|
return remap$(v, {
|
|
76
82
|
"qr_code": "qrCode",
|
|
@@ -81,6 +87,8 @@ export const VendorScan$inboundSchema: z.ZodType<
|
|
|
81
87
|
"scan_in_vendor_scan_id": "scanInVendorScanId",
|
|
82
88
|
"scan_out_vendor_scan_id": "scanOutVendorScanId",
|
|
83
89
|
"auto_scan_out": "autoScanOut",
|
|
90
|
+
"finished_screening_questions": "finishedScreeningQuestions",
|
|
91
|
+
"requires_screening_questions": "requiresScreeningQuestions",
|
|
84
92
|
});
|
|
85
93
|
});
|
|
86
94
|
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import * as openEnums from "../../types/enums.js";
|
|
9
|
+
import { OpenEnum } from "../../types/enums.js";
|
|
10
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
11
|
+
import * as types from "../../types/primitives.js";
|
|
12
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
13
|
+
|
|
14
|
+
export const AnswerType = {
|
|
15
|
+
Preset: "preset",
|
|
16
|
+
Date: "date",
|
|
17
|
+
ShortAnswer: "short answer",
|
|
18
|
+
LongAnswer: "long answer",
|
|
19
|
+
} as const;
|
|
20
|
+
export type AnswerType = OpenEnum<typeof AnswerType>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Reduced set of attributes for a screening answer, used in vendor_scan context. Matches the fields returned by ScreeningAnswer#api_json when context: :vendor_scan is applied.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
*/
|
|
27
|
+
export type VendorScanScreeningAnswer = {
|
|
28
|
+
id: number;
|
|
29
|
+
answer?: string | null | undefined;
|
|
30
|
+
answerType?: AnswerType | null | undefined;
|
|
31
|
+
priority?: number | null | undefined;
|
|
32
|
+
showConfirmation?: boolean | undefined;
|
|
33
|
+
confirmationText?: string | null | undefined;
|
|
34
|
+
answerTitle?: string | null | undefined;
|
|
35
|
+
allowEmptyAnswer?: boolean | undefined;
|
|
36
|
+
emptyAnswerErrorMessage?: string | null | undefined;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** @internal */
|
|
40
|
+
export const AnswerType$inboundSchema: z.ZodType<
|
|
41
|
+
AnswerType,
|
|
42
|
+
z.ZodTypeDef,
|
|
43
|
+
unknown
|
|
44
|
+
> = openEnums.inboundSchema(AnswerType);
|
|
45
|
+
|
|
46
|
+
/** @internal */
|
|
47
|
+
export const VendorScanScreeningAnswer$inboundSchema: z.ZodType<
|
|
48
|
+
VendorScanScreeningAnswer,
|
|
49
|
+
z.ZodTypeDef,
|
|
50
|
+
unknown
|
|
51
|
+
> = z.object({
|
|
52
|
+
id: types.number(),
|
|
53
|
+
answer: z.nullable(types.string()).optional(),
|
|
54
|
+
answer_type: z.nullable(AnswerType$inboundSchema).optional(),
|
|
55
|
+
priority: z.nullable(types.number()).optional(),
|
|
56
|
+
show_confirmation: types.optional(types.boolean()),
|
|
57
|
+
confirmation_text: z.nullable(types.string()).optional(),
|
|
58
|
+
answer_title: z.nullable(types.string()).optional(),
|
|
59
|
+
allow_empty_answer: types.optional(types.boolean()),
|
|
60
|
+
empty_answer_error_message: z.nullable(types.string()).optional(),
|
|
61
|
+
}).transform((v) => {
|
|
62
|
+
return remap$(v, {
|
|
63
|
+
"answer_type": "answerType",
|
|
64
|
+
"show_confirmation": "showConfirmation",
|
|
65
|
+
"confirmation_text": "confirmationText",
|
|
66
|
+
"answer_title": "answerTitle",
|
|
67
|
+
"allow_empty_answer": "allowEmptyAnswer",
|
|
68
|
+
"empty_answer_error_message": "emptyAnswerErrorMessage",
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export function vendorScanScreeningAnswerFromJSON(
|
|
73
|
+
jsonString: string,
|
|
74
|
+
): SafeParseResult<VendorScanScreeningAnswer, SDKValidationError> {
|
|
75
|
+
return safeParse(
|
|
76
|
+
jsonString,
|
|
77
|
+
(x) => VendorScanScreeningAnswer$inboundSchema.parse(JSON.parse(x)),
|
|
78
|
+
`Failed to parse 'VendorScanScreeningAnswer' from JSON`,
|
|
79
|
+
);
|
|
80
|
+
}
|