@greensecurity/javascript-sdk 0.40.8-beta.22 → 0.40.8-beta.23

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.
Files changed (114) hide show
  1. package/README.md +3 -0
  2. package/dist/commonjs/__tests__/vendors.test.js +25 -0
  3. package/dist/commonjs/__tests__/vendors.test.js.map +1 -1
  4. package/dist/commonjs/__tests__/webhooks.test.js +1 -1
  5. package/dist/commonjs/__tests__/webhooks.test.js.map +1 -1
  6. package/dist/commonjs/__tests__/zones.test.js +2 -3
  7. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  8. package/dist/commonjs/funcs/vendorsGetNextUnansweredScreeningQuestion.d.ts +18 -0
  9. package/dist/commonjs/funcs/vendorsGetNextUnansweredScreeningQuestion.d.ts.map +1 -0
  10. package/dist/commonjs/funcs/vendorsGetNextUnansweredScreeningQuestion.js +126 -0
  11. package/dist/commonjs/funcs/vendorsGetNextUnansweredScreeningQuestion.js.map +1 -0
  12. package/dist/commonjs/lib/config.d.ts +4 -4
  13. package/dist/commonjs/lib/config.js +4 -4
  14. package/dist/commonjs/models/components/expand.d.ts +3 -0
  15. package/dist/commonjs/models/components/expand.d.ts.map +1 -1
  16. package/dist/commonjs/models/components/expand.js +1 -0
  17. package/dist/commonjs/models/components/expand.js.map +1 -1
  18. package/dist/commonjs/models/components/index.d.ts +2 -0
  19. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  20. package/dist/commonjs/models/components/index.js +2 -0
  21. package/dist/commonjs/models/components/index.js.map +1 -1
  22. package/dist/commonjs/models/components/screeninganswer.d.ts +112 -0
  23. package/dist/commonjs/models/components/screeninganswer.d.ts.map +1 -0
  24. package/dist/commonjs/models/components/screeninganswer.js +138 -0
  25. package/dist/commonjs/models/components/screeninganswer.js.map +1 -0
  26. package/dist/commonjs/models/components/screeningquestion.d.ts +98 -0
  27. package/dist/commonjs/models/components/screeningquestion.d.ts.map +1 -0
  28. package/dist/commonjs/models/components/screeningquestion.js +125 -0
  29. package/dist/commonjs/models/components/screeningquestion.js.map +1 -0
  30. package/dist/commonjs/models/operations/getnextunansweredscreeningquestion.d.ts +70 -0
  31. package/dist/commonjs/models/operations/getnextunansweredscreeningquestion.d.ts.map +1 -0
  32. package/dist/commonjs/models/operations/getnextunansweredscreeningquestion.js +122 -0
  33. package/dist/commonjs/models/operations/getnextunansweredscreeningquestion.js.map +1 -0
  34. package/dist/commonjs/models/operations/index.d.ts +1 -0
  35. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  36. package/dist/commonjs/models/operations/index.js +1 -0
  37. package/dist/commonjs/models/operations/index.js.map +1 -1
  38. package/dist/commonjs/react-query/index.d.ts +1 -0
  39. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  40. package/dist/commonjs/react-query/index.js +1 -0
  41. package/dist/commonjs/react-query/index.js.map +1 -1
  42. package/dist/commonjs/react-query/vendorsGetNextUnansweredScreeningQuestion.d.ts +43 -0
  43. package/dist/commonjs/react-query/vendorsGetNextUnansweredScreeningQuestion.d.ts.map +1 -0
  44. package/dist/commonjs/react-query/vendorsGetNextUnansweredScreeningQuestion.js +97 -0
  45. package/dist/commonjs/react-query/vendorsGetNextUnansweredScreeningQuestion.js.map +1 -0
  46. package/dist/commonjs/sdk/vendors.d.ts +7 -0
  47. package/dist/commonjs/sdk/vendors.d.ts.map +1 -1
  48. package/dist/commonjs/sdk/vendors.js +10 -0
  49. package/dist/commonjs/sdk/vendors.js.map +1 -1
  50. package/dist/esm/__tests__/vendors.test.js +25 -0
  51. package/dist/esm/__tests__/vendors.test.js.map +1 -1
  52. package/dist/esm/__tests__/webhooks.test.js +1 -1
  53. package/dist/esm/__tests__/webhooks.test.js.map +1 -1
  54. package/dist/esm/__tests__/zones.test.js +2 -3
  55. package/dist/esm/__tests__/zones.test.js.map +1 -1
  56. package/dist/esm/funcs/vendorsGetNextUnansweredScreeningQuestion.d.ts +18 -0
  57. package/dist/esm/funcs/vendorsGetNextUnansweredScreeningQuestion.d.ts.map +1 -0
  58. package/dist/esm/funcs/vendorsGetNextUnansweredScreeningQuestion.js +90 -0
  59. package/dist/esm/funcs/vendorsGetNextUnansweredScreeningQuestion.js.map +1 -0
  60. package/dist/esm/lib/config.d.ts +4 -4
  61. package/dist/esm/lib/config.js +4 -4
  62. package/dist/esm/models/components/expand.d.ts +3 -0
  63. package/dist/esm/models/components/expand.d.ts.map +1 -1
  64. package/dist/esm/models/components/expand.js +1 -0
  65. package/dist/esm/models/components/expand.js.map +1 -1
  66. package/dist/esm/models/components/index.d.ts +2 -0
  67. package/dist/esm/models/components/index.d.ts.map +1 -1
  68. package/dist/esm/models/components/index.js +2 -0
  69. package/dist/esm/models/components/index.js.map +1 -1
  70. package/dist/esm/models/components/screeninganswer.d.ts +112 -0
  71. package/dist/esm/models/components/screeninganswer.d.ts.map +1 -0
  72. package/dist/esm/models/components/screeninganswer.js +100 -0
  73. package/dist/esm/models/components/screeninganswer.js.map +1 -0
  74. package/dist/esm/models/components/screeningquestion.d.ts +98 -0
  75. package/dist/esm/models/components/screeningquestion.d.ts.map +1 -0
  76. package/dist/esm/models/components/screeningquestion.js +87 -0
  77. package/dist/esm/models/components/screeningquestion.js.map +1 -0
  78. package/dist/esm/models/operations/getnextunansweredscreeningquestion.d.ts +70 -0
  79. package/dist/esm/models/operations/getnextunansweredscreeningquestion.d.ts.map +1 -0
  80. package/dist/esm/models/operations/getnextunansweredscreeningquestion.js +82 -0
  81. package/dist/esm/models/operations/getnextunansweredscreeningquestion.js.map +1 -0
  82. package/dist/esm/models/operations/index.d.ts +1 -0
  83. package/dist/esm/models/operations/index.d.ts.map +1 -1
  84. package/dist/esm/models/operations/index.js +1 -0
  85. package/dist/esm/models/operations/index.js.map +1 -1
  86. package/dist/esm/react-query/index.d.ts +1 -0
  87. package/dist/esm/react-query/index.d.ts.map +1 -1
  88. package/dist/esm/react-query/index.js +1 -0
  89. package/dist/esm/react-query/index.js.map +1 -1
  90. package/dist/esm/react-query/vendorsGetNextUnansweredScreeningQuestion.d.ts +43 -0
  91. package/dist/esm/react-query/vendorsGetNextUnansweredScreeningQuestion.d.ts.map +1 -0
  92. package/dist/esm/react-query/vendorsGetNextUnansweredScreeningQuestion.js +87 -0
  93. package/dist/esm/react-query/vendorsGetNextUnansweredScreeningQuestion.js.map +1 -0
  94. package/dist/esm/sdk/vendors.d.ts +7 -0
  95. package/dist/esm/sdk/vendors.d.ts.map +1 -1
  96. package/dist/esm/sdk/vendors.js +10 -0
  97. package/dist/esm/sdk/vendors.js.map +1 -1
  98. package/examples/package-lock.json +1 -1
  99. package/jsr.json +1 -1
  100. package/package.json +1 -1
  101. package/src/__tests__/vendors.test.ts +32 -0
  102. package/src/__tests__/webhooks.test.ts +1 -1
  103. package/src/__tests__/zones.test.ts +2 -3
  104. package/src/funcs/vendorsGetNextUnansweredScreeningQuestion.ts +188 -0
  105. package/src/lib/config.ts +4 -4
  106. package/src/models/components/expand.ts +1 -0
  107. package/src/models/components/index.ts +2 -0
  108. package/src/models/components/screeninganswer.ts +195 -0
  109. package/src/models/components/screeningquestion.ts +163 -0
  110. package/src/models/operations/getnextunansweredscreeningquestion.ts +191 -0
  111. package/src/models/operations/index.ts +1 -0
  112. package/src/react-query/index.ts +1 -0
  113. package/src/react-query/vendorsGetNextUnansweredScreeningQuestion.ts +190 -0
  114. package/src/sdk/vendors.ts +18 -0
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "..": {
20
20
  "name": "@greensecurity/javascript-sdk",
21
- "version": "0.40.8-beta.21",
21
+ "version": "0.40.8-beta.22",
22
22
  "dependencies": {
23
23
  "zod": "^3.20.0"
24
24
  },
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@greensecurity/javascript-sdk",
5
- "version": "0.40.8-beta.21",
5
+ "version": "0.40.8-beta.22",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greensecurity/javascript-sdk",
3
- "version": "0.40.8-beta.22",
3
+ "version": "0.40.8-beta.23",
4
4
  "author": "Green Security LLC",
5
5
  "type": "module",
6
6
  "tshy": {
@@ -954,3 +954,35 @@ test("Vendors Get Vendor Invoice Receipt", async () => {
954
954
  base64Pdf: "<value>",
955
955
  });
956
956
  });
957
+
958
+ test("Vendors Get Next Unanswered Screening Question", async () => {
959
+ const testHttpClient = createTestHTTPClient(
960
+ "getNextUnansweredScreeningQuestion",
961
+ );
962
+
963
+ const greenSecurity = new GreenSecurity({
964
+ serverURL: process.env["TEST_SERVER_URL"] ?? "https://localhost:3000/api",
965
+ httpClient: testHttpClient,
966
+ security: {
967
+ token: process.env["GREEN_SECURITY_TOKEN"] ?? "value",
968
+ },
969
+ });
970
+
971
+ const result = await greenSecurity.vendors.getNextUnansweredScreeningQuestion(
972
+ {
973
+ vendorIdOrMe: "<value>",
974
+ expand: [
975
+ "facility.system",
976
+ ],
977
+ },
978
+ );
979
+ expect(result).toBeDefined();
980
+ expect(result).toEqual({
981
+ screeningQuestion: {
982
+ id: 395343,
983
+ screeningQuestionSeriesId: 238185,
984
+ },
985
+ screeningResponse: {},
986
+ success: false,
987
+ });
988
+ });
@@ -20,7 +20,7 @@ test("Webhooks List All Webhook Endpoints", async () => {
20
20
  const testWebhookListForVendorUserResult = await greenSecurity.webhooks
21
21
  .listAllWebhookEndpoints({
22
22
  itemsPerPage: 25,
23
- desc: true,
23
+ desc: 0,
24
24
  sort: "",
25
25
  });
26
26
  expect(testWebhookListForVendorUserResult).toBeDefined();
@@ -57,9 +57,8 @@ test("Zones Security Zone Checkin", async () => {
57
57
  });
58
58
 
59
59
  const result = await greenSecurity.zones.securityZoneCheckin({
60
- longitude: "89.6981",
61
- latitude: "68.5943",
62
- zoneId: 456404,
60
+ qrCode: "<value>",
61
+ zoneId: 544883,
63
62
  });
64
63
  expect(result).toBeDefined();
65
64
  expect(result).toEqual({});
@@ -0,0 +1,188 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { GreenSecurityCore } from "../core.js";
6
+ import { encodeFormQuery, 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
+ * Get the next unanswered screening question
30
+ *
31
+ * @remarks
32
+ * Returns the next unanswered screening question for the vendor specified by the vendor_id_or_me path parameter.
33
+ */
34
+ export function vendorsGetNextUnansweredScreeningQuestion(
35
+ client: GreenSecurityCore,
36
+ request: operations.GetNextUnansweredScreeningQuestionRequest,
37
+ options?: RequestOptions,
38
+ ): APIPromise<
39
+ Result<
40
+ operations.GetNextUnansweredScreeningQuestionResponseBody,
41
+ | errors.ApiErrorResponse
42
+ | GreenSecurityError
43
+ | ResponseValidationError
44
+ | ConnectionError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | InvalidRequestError
48
+ | UnexpectedClientError
49
+ | SDKValidationError
50
+ >
51
+ > {
52
+ return new APIPromise($do(
53
+ client,
54
+ request,
55
+ options,
56
+ ));
57
+ }
58
+
59
+ async function $do(
60
+ client: GreenSecurityCore,
61
+ request: operations.GetNextUnansweredScreeningQuestionRequest,
62
+ options?: RequestOptions,
63
+ ): Promise<
64
+ [
65
+ Result<
66
+ operations.GetNextUnansweredScreeningQuestionResponseBody,
67
+ | errors.ApiErrorResponse
68
+ | GreenSecurityError
69
+ | ResponseValidationError
70
+ | ConnectionError
71
+ | RequestAbortedError
72
+ | RequestTimeoutError
73
+ | InvalidRequestError
74
+ | UnexpectedClientError
75
+ | SDKValidationError
76
+ >,
77
+ APICall,
78
+ ]
79
+ > {
80
+ const parsed = safeParse(
81
+ request,
82
+ (value) =>
83
+ operations.GetNextUnansweredScreeningQuestionRequest$outboundSchema.parse(
84
+ value,
85
+ ),
86
+ "Input validation failed",
87
+ );
88
+ if (!parsed.ok) {
89
+ return [parsed, { status: "invalid" }];
90
+ }
91
+ const payload = parsed.value;
92
+ const body = null;
93
+
94
+ const pathParams = {
95
+ vendor_id_or_me: encodeSimple("vendor_id_or_me", payload.vendor_id_or_me, {
96
+ explode: false,
97
+ charEncoding: "percent",
98
+ }),
99
+ };
100
+
101
+ const path = pathToFunc(
102
+ "/vendors/{vendor_id_or_me}/screening-questions/next-unanswered-question",
103
+ )(pathParams);
104
+
105
+ const query = encodeFormQuery({
106
+ "expand": payload.expand,
107
+ }, { explode: false });
108
+
109
+ const headers = new Headers(compactMap({
110
+ Accept: "application/json",
111
+ }));
112
+
113
+ const securityInput = await extractSecurity(client._options.security);
114
+ const requestSecurity = resolveGlobalSecurity(securityInput);
115
+
116
+ const context = {
117
+ options: client._options,
118
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
119
+ operationID: "getNextUnansweredScreeningQuestion",
120
+ oAuth2Scopes: [],
121
+
122
+ resolvedSecurity: requestSecurity,
123
+
124
+ securitySource: client._options.security,
125
+ retryConfig: options?.retries
126
+ || client._options.retryConfig
127
+ || { strategy: "none" },
128
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
129
+ };
130
+
131
+ const requestRes = client._createRequest(context, {
132
+ security: requestSecurity,
133
+ method: "GET",
134
+ baseURL: options?.serverURL,
135
+ path: path,
136
+ headers: headers,
137
+ query: query,
138
+ body: body,
139
+ userAgent: client._options.userAgent,
140
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
141
+ }, options);
142
+ if (!requestRes.ok) {
143
+ return [requestRes, { status: "invalid" }];
144
+ }
145
+ const req = requestRes.value;
146
+
147
+ const doResult = await client._do(req, {
148
+ context,
149
+ errorCodes: ["403", "404", "4XX", "500", "5XX"],
150
+ retryConfig: context.retryConfig,
151
+ retryCodes: context.retryCodes,
152
+ });
153
+ if (!doResult.ok) {
154
+ return [doResult, { status: "request-error", request: req }];
155
+ }
156
+ const response = doResult.value;
157
+
158
+ const responseFields = {
159
+ HttpMeta: { Response: response, Request: req },
160
+ };
161
+
162
+ const [result] = await M.match<
163
+ operations.GetNextUnansweredScreeningQuestionResponseBody,
164
+ | errors.ApiErrorResponse
165
+ | GreenSecurityError
166
+ | ResponseValidationError
167
+ | ConnectionError
168
+ | RequestAbortedError
169
+ | RequestTimeoutError
170
+ | InvalidRequestError
171
+ | UnexpectedClientError
172
+ | SDKValidationError
173
+ >(
174
+ M.json(
175
+ 200,
176
+ operations.GetNextUnansweredScreeningQuestionResponseBody$inboundSchema,
177
+ ),
178
+ M.jsonErr([403, 404], errors.ApiErrorResponse$inboundSchema),
179
+ M.jsonErr(500, errors.ApiErrorResponse$inboundSchema),
180
+ M.fail("4XX"),
181
+ M.fail("5XX"),
182
+ )(response, req, { extraFields: responseFields });
183
+ if (!result.ok) {
184
+ return [result, { status: "complete", request: req, response }];
185
+ }
186
+
187
+ return [result, { status: "complete", request: req, response }];
188
+ }
package/src/lib/config.ts CHANGED
@@ -79,9 +79,9 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
79
79
 
80
80
  export const SDK_METADATA = {
81
81
  language: "typescript",
82
- openapiDocVersion: "0.0.4",
83
- sdkVersion: "0.40.8-beta.21",
84
- genVersion: "2.701.8",
82
+ openapiDocVersion: "0.0.5",
83
+ sdkVersion: "0.40.8-beta.22",
84
+ genVersion: "2.702.0",
85
85
  userAgent:
86
- "speakeasy-sdk/typescript 0.40.8-beta.21 2.701.8 0.0.4 @greensecurity/javascript-sdk",
86
+ "speakeasy-sdk/typescript 0.40.8-beta.22 2.702.0 0.0.5 @greensecurity/javascript-sdk",
87
87
  } as const;
@@ -89,6 +89,7 @@ export const Expand = {
89
89
  SubscriptionExpeditedOffer: "subscription.expedited_offer",
90
90
  DepartmentMembershipContact: "department_membership.contact",
91
91
  DepartmentMembershipDepartment: "department_membership.department",
92
+ ScreeningQuestionScreeningAnswers: "screening_question.screening_answers",
92
93
  } as const;
93
94
  /**
94
95
  * An expansion scope that is valid for the object being requested.
@@ -47,6 +47,8 @@ export * from "./product.js";
47
47
  export * from "./productvariant.js";
48
48
  export * from "./samlloginrequiredresponse.js";
49
49
  export * from "./scantype.js";
50
+ export * from "./screeninganswer.js";
51
+ export * from "./screeningquestion.js";
50
52
  export * from "./screeningresponse.js";
51
53
  export * from "./security.js";
52
54
  export * from "./standingappointment.js";
@@ -0,0 +1,195 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { ClosedEnum } from "../../types/enums.js";
9
+ import { Result as SafeParseResult } from "../../types/fp.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+ import {
12
+ ScreeningQuestion,
13
+ ScreeningQuestion$inboundSchema,
14
+ ScreeningQuestion$Outbound,
15
+ ScreeningQuestion$outboundSchema,
16
+ } from "./screeningquestion.js";
17
+
18
+ /**
19
+ * The type of answer option.
20
+ */
21
+ export const AnswerType = {
22
+ Preset: "preset",
23
+ Date: "date",
24
+ ShortAnswer: "short answer",
25
+ LongAnswer: "long answer",
26
+ } as const;
27
+ /**
28
+ * The type of answer option.
29
+ */
30
+ export type AnswerType = ClosedEnum<typeof AnswerType>;
31
+
32
+ /**
33
+ * Reduced list of attributes of ScreeningAnswer records
34
+ */
35
+ export type ScreeningAnswer = {
36
+ id: number;
37
+ screeningQuestionId?: number | null | undefined;
38
+ /**
39
+ * The content of the screening answer option.
40
+ */
41
+ answer?: string | null | undefined;
42
+ /**
43
+ * The type of answer option.
44
+ */
45
+ answerType?: AnswerType | null | undefined;
46
+ /**
47
+ * The title or label for the answer input field.
48
+ */
49
+ answerTitle?: string | null | undefined;
50
+ /**
51
+ * Whether or not to allow an empty answer for this option.
52
+ */
53
+ allowEmptyAnswer: boolean;
54
+ /**
55
+ * The error message to display if an empty answer is submitted when not allowed.
56
+ */
57
+ emptyAnswerErrorMessage?: string | null | undefined;
58
+ /**
59
+ * Whether or not to show a confirmation prompt when this answer is selected.
60
+ */
61
+ showConfirmation: boolean;
62
+ /**
63
+ * The text to display in the confirmation prompt.
64
+ */
65
+ confirmationText?: string | null | undefined;
66
+ priority?: number | null | undefined;
67
+ screeningQuestions?: Array<ScreeningQuestion> | null | undefined;
68
+ };
69
+
70
+ /** @internal */
71
+ export const AnswerType$inboundSchema: z.ZodNativeEnum<typeof AnswerType> = z
72
+ .nativeEnum(AnswerType);
73
+
74
+ /** @internal */
75
+ export const AnswerType$outboundSchema: z.ZodNativeEnum<typeof AnswerType> =
76
+ AnswerType$inboundSchema;
77
+
78
+ /**
79
+ * @internal
80
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
81
+ */
82
+ export namespace AnswerType$ {
83
+ /** @deprecated use `AnswerType$inboundSchema` instead. */
84
+ export const inboundSchema = AnswerType$inboundSchema;
85
+ /** @deprecated use `AnswerType$outboundSchema` instead. */
86
+ export const outboundSchema = AnswerType$outboundSchema;
87
+ }
88
+
89
+ /** @internal */
90
+ export const ScreeningAnswer$inboundSchema: z.ZodType<
91
+ ScreeningAnswer,
92
+ z.ZodTypeDef,
93
+ unknown
94
+ > = z.object({
95
+ id: z.number().int(),
96
+ screening_question_id: z.nullable(z.number().int()).optional(),
97
+ answer: z.nullable(z.string()).optional(),
98
+ answer_type: z.nullable(AnswerType$inboundSchema).optional(),
99
+ answer_title: z.nullable(z.string()).optional(),
100
+ allow_empty_answer: z.boolean(),
101
+ empty_answer_error_message: z.nullable(z.string()).optional(),
102
+ show_confirmation: z.boolean(),
103
+ confirmation_text: z.nullable(z.string()).optional(),
104
+ priority: z.nullable(z.number().int()).optional(),
105
+ screening_questions: z.nullable(
106
+ z.array(z.lazy(() => ScreeningQuestion$inboundSchema)),
107
+ ).optional(),
108
+ }).transform((v) => {
109
+ return remap$(v, {
110
+ "screening_question_id": "screeningQuestionId",
111
+ "answer_type": "answerType",
112
+ "answer_title": "answerTitle",
113
+ "allow_empty_answer": "allowEmptyAnswer",
114
+ "empty_answer_error_message": "emptyAnswerErrorMessage",
115
+ "show_confirmation": "showConfirmation",
116
+ "confirmation_text": "confirmationText",
117
+ "screening_questions": "screeningQuestions",
118
+ });
119
+ });
120
+
121
+ /** @internal */
122
+ export type ScreeningAnswer$Outbound = {
123
+ id: number;
124
+ screening_question_id?: number | null | undefined;
125
+ answer?: string | null | undefined;
126
+ answer_type?: string | null | undefined;
127
+ answer_title?: string | null | undefined;
128
+ allow_empty_answer: boolean;
129
+ empty_answer_error_message?: string | null | undefined;
130
+ show_confirmation: boolean;
131
+ confirmation_text?: string | null | undefined;
132
+ priority?: number | null | undefined;
133
+ screening_questions?: Array<ScreeningQuestion$Outbound> | null | undefined;
134
+ };
135
+
136
+ /** @internal */
137
+ export const ScreeningAnswer$outboundSchema: z.ZodType<
138
+ ScreeningAnswer$Outbound,
139
+ z.ZodTypeDef,
140
+ ScreeningAnswer
141
+ > = z.object({
142
+ id: z.number().int(),
143
+ screeningQuestionId: z.nullable(z.number().int()).optional(),
144
+ answer: z.nullable(z.string()).optional(),
145
+ answerType: z.nullable(AnswerType$outboundSchema).optional(),
146
+ answerTitle: z.nullable(z.string()).optional(),
147
+ allowEmptyAnswer: z.boolean(),
148
+ emptyAnswerErrorMessage: z.nullable(z.string()).optional(),
149
+ showConfirmation: z.boolean(),
150
+ confirmationText: z.nullable(z.string()).optional(),
151
+ priority: z.nullable(z.number().int()).optional(),
152
+ screeningQuestions: z.nullable(
153
+ z.array(z.lazy(() => ScreeningQuestion$outboundSchema)),
154
+ ).optional(),
155
+ }).transform((v) => {
156
+ return remap$(v, {
157
+ screeningQuestionId: "screening_question_id",
158
+ answerType: "answer_type",
159
+ answerTitle: "answer_title",
160
+ allowEmptyAnswer: "allow_empty_answer",
161
+ emptyAnswerErrorMessage: "empty_answer_error_message",
162
+ showConfirmation: "show_confirmation",
163
+ confirmationText: "confirmation_text",
164
+ screeningQuestions: "screening_questions",
165
+ });
166
+ });
167
+
168
+ /**
169
+ * @internal
170
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
171
+ */
172
+ export namespace ScreeningAnswer$ {
173
+ /** @deprecated use `ScreeningAnswer$inboundSchema` instead. */
174
+ export const inboundSchema = ScreeningAnswer$inboundSchema;
175
+ /** @deprecated use `ScreeningAnswer$outboundSchema` instead. */
176
+ export const outboundSchema = ScreeningAnswer$outboundSchema;
177
+ /** @deprecated use `ScreeningAnswer$Outbound` instead. */
178
+ export type Outbound = ScreeningAnswer$Outbound;
179
+ }
180
+
181
+ export function screeningAnswerToJSON(
182
+ screeningAnswer: ScreeningAnswer,
183
+ ): string {
184
+ return JSON.stringify(ScreeningAnswer$outboundSchema.parse(screeningAnswer));
185
+ }
186
+
187
+ export function screeningAnswerFromJSON(
188
+ jsonString: string,
189
+ ): SafeParseResult<ScreeningAnswer, SDKValidationError> {
190
+ return safeParse(
191
+ jsonString,
192
+ (x) => ScreeningAnswer$inboundSchema.parse(JSON.parse(x)),
193
+ `Failed to parse 'ScreeningAnswer' from JSON`,
194
+ );
195
+ }
@@ -0,0 +1,163 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { ClosedEnum } from "../../types/enums.js";
9
+ import { Result as SafeParseResult } from "../../types/fp.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+ import {
12
+ ScreeningAnswer,
13
+ ScreeningAnswer$inboundSchema,
14
+ ScreeningAnswer$Outbound,
15
+ ScreeningAnswer$outboundSchema,
16
+ } from "./screeninganswer.js";
17
+
18
+ /**
19
+ * The display format for the question.
20
+ */
21
+ export const PresetDisplayAs = {
22
+ FloatingButtons: "floating buttons",
23
+ LineButtons: "line buttons",
24
+ Radio: "radio",
25
+ Select: "select",
26
+ Checkbox: "checkbox",
27
+ Checkbox2Column: "checkbox (2-column)",
28
+ } as const;
29
+ /**
30
+ * The display format for the question.
31
+ */
32
+ export type PresetDisplayAs = ClosedEnum<typeof PresetDisplayAs>;
33
+
34
+ /**
35
+ * Reduced list of attributes of ScreeningQuestion record
36
+ */
37
+ export type ScreeningQuestion = {
38
+ id: number;
39
+ screeningQuestionSeriesId: number;
40
+ screeningAnswerId?: number | null | undefined;
41
+ /**
42
+ * The order for displaying the question relative to other questions in the same series. Questions with lower priority values should be shown first.
43
+ */
44
+ priority?: number | null | undefined;
45
+ /**
46
+ * The content of the screening question to be presented.
47
+ */
48
+ question?: string | null | undefined;
49
+ /**
50
+ * The display format for the question.
51
+ */
52
+ presetDisplayAs?: PresetDisplayAs | null | undefined;
53
+ screeningAnswers?: Array<ScreeningAnswer> | undefined;
54
+ };
55
+
56
+ /** @internal */
57
+ export const PresetDisplayAs$inboundSchema: z.ZodNativeEnum<
58
+ typeof PresetDisplayAs
59
+ > = z.nativeEnum(PresetDisplayAs);
60
+
61
+ /** @internal */
62
+ export const PresetDisplayAs$outboundSchema: z.ZodNativeEnum<
63
+ typeof PresetDisplayAs
64
+ > = PresetDisplayAs$inboundSchema;
65
+
66
+ /**
67
+ * @internal
68
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
69
+ */
70
+ export namespace PresetDisplayAs$ {
71
+ /** @deprecated use `PresetDisplayAs$inboundSchema` instead. */
72
+ export const inboundSchema = PresetDisplayAs$inboundSchema;
73
+ /** @deprecated use `PresetDisplayAs$outboundSchema` instead. */
74
+ export const outboundSchema = PresetDisplayAs$outboundSchema;
75
+ }
76
+
77
+ /** @internal */
78
+ export const ScreeningQuestion$inboundSchema: z.ZodType<
79
+ ScreeningQuestion,
80
+ z.ZodTypeDef,
81
+ unknown
82
+ > = z.object({
83
+ id: z.number().int(),
84
+ screening_question_series_id: z.number().int(),
85
+ screening_answer_id: z.nullable(z.number().int()).optional(),
86
+ priority: z.nullable(z.number().int()).optional(),
87
+ question: z.nullable(z.string()).optional(),
88
+ preset_display_as: z.nullable(PresetDisplayAs$inboundSchema).optional(),
89
+ screening_answers: z.array(z.lazy(() => ScreeningAnswer$inboundSchema))
90
+ .optional(),
91
+ }).transform((v) => {
92
+ return remap$(v, {
93
+ "screening_question_series_id": "screeningQuestionSeriesId",
94
+ "screening_answer_id": "screeningAnswerId",
95
+ "preset_display_as": "presetDisplayAs",
96
+ "screening_answers": "screeningAnswers",
97
+ });
98
+ });
99
+
100
+ /** @internal */
101
+ export type ScreeningQuestion$Outbound = {
102
+ id: number;
103
+ screening_question_series_id: number;
104
+ screening_answer_id?: number | null | undefined;
105
+ priority?: number | null | undefined;
106
+ question?: string | null | undefined;
107
+ preset_display_as?: string | null | undefined;
108
+ screening_answers?: Array<ScreeningAnswer$Outbound> | undefined;
109
+ };
110
+
111
+ /** @internal */
112
+ export const ScreeningQuestion$outboundSchema: z.ZodType<
113
+ ScreeningQuestion$Outbound,
114
+ z.ZodTypeDef,
115
+ ScreeningQuestion
116
+ > = z.object({
117
+ id: z.number().int(),
118
+ screeningQuestionSeriesId: z.number().int(),
119
+ screeningAnswerId: z.nullable(z.number().int()).optional(),
120
+ priority: z.nullable(z.number().int()).optional(),
121
+ question: z.nullable(z.string()).optional(),
122
+ presetDisplayAs: z.nullable(PresetDisplayAs$outboundSchema).optional(),
123
+ screeningAnswers: z.array(z.lazy(() => ScreeningAnswer$outboundSchema))
124
+ .optional(),
125
+ }).transform((v) => {
126
+ return remap$(v, {
127
+ screeningQuestionSeriesId: "screening_question_series_id",
128
+ screeningAnswerId: "screening_answer_id",
129
+ presetDisplayAs: "preset_display_as",
130
+ screeningAnswers: "screening_answers",
131
+ });
132
+ });
133
+
134
+ /**
135
+ * @internal
136
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
137
+ */
138
+ export namespace ScreeningQuestion$ {
139
+ /** @deprecated use `ScreeningQuestion$inboundSchema` instead. */
140
+ export const inboundSchema = ScreeningQuestion$inboundSchema;
141
+ /** @deprecated use `ScreeningQuestion$outboundSchema` instead. */
142
+ export const outboundSchema = ScreeningQuestion$outboundSchema;
143
+ /** @deprecated use `ScreeningQuestion$Outbound` instead. */
144
+ export type Outbound = ScreeningQuestion$Outbound;
145
+ }
146
+
147
+ export function screeningQuestionToJSON(
148
+ screeningQuestion: ScreeningQuestion,
149
+ ): string {
150
+ return JSON.stringify(
151
+ ScreeningQuestion$outboundSchema.parse(screeningQuestion),
152
+ );
153
+ }
154
+
155
+ export function screeningQuestionFromJSON(
156
+ jsonString: string,
157
+ ): SafeParseResult<ScreeningQuestion, SDKValidationError> {
158
+ return safeParse(
159
+ jsonString,
160
+ (x) => ScreeningQuestion$inboundSchema.parse(JSON.parse(x)),
161
+ `Failed to parse 'ScreeningQuestion' from JSON`,
162
+ );
163
+ }