@greensecurity/javascript-sdk 0.44.0-beta.34 → 0.44.0-beta.36

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 (143) hide show
  1. package/README.md +3 -0
  2. package/dist/commonjs/__tests__/vendors.test.js +31 -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 +4 -23
  7. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  8. package/dist/commonjs/funcs/vendorsGetNextUnansweredScreeningQuestion.js +4 -2
  9. package/dist/commonjs/funcs/vendorsGetNextUnansweredScreeningQuestion.js.map +1 -1
  10. package/dist/commonjs/funcs/vendorsGetVendorTargetFacilities.d.ts +21 -0
  11. package/dist/commonjs/funcs/vendorsGetVendorTargetFacilities.d.ts.map +1 -0
  12. package/dist/commonjs/funcs/vendorsGetVendorTargetFacilities.js +168 -0
  13. package/dist/commonjs/funcs/vendorsGetVendorTargetFacilities.js.map +1 -0
  14. package/dist/commonjs/lib/config.d.ts +2 -2
  15. package/dist/commonjs/lib/config.js +2 -2
  16. package/dist/commonjs/models/components/expand.d.ts +1 -0
  17. package/dist/commonjs/models/components/expand.d.ts.map +1 -1
  18. package/dist/commonjs/models/components/expand.js +1 -0
  19. package/dist/commonjs/models/components/expand.js.map +1 -1
  20. package/dist/commonjs/models/components/index.d.ts +1 -0
  21. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  22. package/dist/commonjs/models/components/index.js +1 -0
  23. package/dist/commonjs/models/components/index.js.map +1 -1
  24. package/dist/commonjs/models/components/vendortargetfacility.d.ts +37 -0
  25. package/dist/commonjs/models/components/vendortargetfacility.d.ts.map +1 -0
  26. package/dist/commonjs/models/components/vendortargetfacility.js +69 -0
  27. package/dist/commonjs/models/components/vendortargetfacility.js.map +1 -0
  28. package/dist/commonjs/models/operations/getnextunansweredscreeningquestion.d.ts +9 -0
  29. package/dist/commonjs/models/operations/getnextunansweredscreeningquestion.d.ts.map +1 -1
  30. package/dist/commonjs/models/operations/getnextunansweredscreeningquestion.js +4 -0
  31. package/dist/commonjs/models/operations/getnextunansweredscreeningquestion.js.map +1 -1
  32. package/dist/commonjs/models/operations/getvendortargetfacilities.d.ts +86 -0
  33. package/dist/commonjs/models/operations/getvendortargetfacilities.d.ts.map +1 -0
  34. package/dist/commonjs/models/operations/getvendortargetfacilities.js +108 -0
  35. package/dist/commonjs/models/operations/getvendortargetfacilities.js.map +1 -0
  36. package/dist/commonjs/models/operations/index.d.ts +1 -0
  37. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  38. package/dist/commonjs/models/operations/index.js +1 -0
  39. package/dist/commonjs/models/operations/index.js.map +1 -1
  40. package/dist/commonjs/react-query/index.d.ts +1 -0
  41. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  42. package/dist/commonjs/react-query/index.js +1 -0
  43. package/dist/commonjs/react-query/index.js.map +1 -1
  44. package/dist/commonjs/react-query/vendorsGetNextUnansweredScreeningQuestion.core.d.ts +1 -0
  45. package/dist/commonjs/react-query/vendorsGetNextUnansweredScreeningQuestion.core.d.ts.map +1 -1
  46. package/dist/commonjs/react-query/vendorsGetNextUnansweredScreeningQuestion.core.js +1 -1
  47. package/dist/commonjs/react-query/vendorsGetNextUnansweredScreeningQuestion.core.js.map +1 -1
  48. package/dist/commonjs/react-query/vendorsGetNextUnansweredScreeningQuestion.d.ts +2 -0
  49. package/dist/commonjs/react-query/vendorsGetNextUnansweredScreeningQuestion.d.ts.map +1 -1
  50. package/dist/commonjs/react-query/vendorsGetNextUnansweredScreeningQuestion.js.map +1 -1
  51. package/dist/commonjs/react-query/vendorsGetVendorTargetFacilities.core.d.ts +46 -0
  52. package/dist/commonjs/react-query/vendorsGetVendorTargetFacilities.core.d.ts.map +1 -0
  53. package/dist/commonjs/react-query/vendorsGetVendorTargetFacilities.core.js +103 -0
  54. package/dist/commonjs/react-query/vendorsGetVendorTargetFacilities.core.js.map +1 -0
  55. package/dist/commonjs/react-query/vendorsGetVendorTargetFacilities.d.ts +70 -0
  56. package/dist/commonjs/react-query/vendorsGetVendorTargetFacilities.d.ts.map +1 -0
  57. package/dist/commonjs/react-query/vendorsGetVendorTargetFacilities.js +104 -0
  58. package/dist/commonjs/react-query/vendorsGetVendorTargetFacilities.js.map +1 -0
  59. package/dist/commonjs/sdk/vendors.d.ts +9 -0
  60. package/dist/commonjs/sdk/vendors.d.ts.map +1 -1
  61. package/dist/commonjs/sdk/vendors.js +10 -0
  62. package/dist/commonjs/sdk/vendors.js.map +1 -1
  63. package/dist/esm/__tests__/vendors.test.js +31 -0
  64. package/dist/esm/__tests__/vendors.test.js.map +1 -1
  65. package/dist/esm/__tests__/webhooks.test.js +1 -1
  66. package/dist/esm/__tests__/webhooks.test.js.map +1 -1
  67. package/dist/esm/__tests__/zones.test.js +4 -23
  68. package/dist/esm/__tests__/zones.test.js.map +1 -1
  69. package/dist/esm/funcs/vendorsGetNextUnansweredScreeningQuestion.js +5 -3
  70. package/dist/esm/funcs/vendorsGetNextUnansweredScreeningQuestion.js.map +1 -1
  71. package/dist/esm/funcs/vendorsGetVendorTargetFacilities.d.ts +21 -0
  72. package/dist/esm/funcs/vendorsGetVendorTargetFacilities.d.ts.map +1 -0
  73. package/dist/esm/funcs/vendorsGetVendorTargetFacilities.js +132 -0
  74. package/dist/esm/funcs/vendorsGetVendorTargetFacilities.js.map +1 -0
  75. package/dist/esm/lib/config.d.ts +2 -2
  76. package/dist/esm/lib/config.js +2 -2
  77. package/dist/esm/models/components/expand.d.ts +1 -0
  78. package/dist/esm/models/components/expand.d.ts.map +1 -1
  79. package/dist/esm/models/components/expand.js +1 -0
  80. package/dist/esm/models/components/expand.js.map +1 -1
  81. package/dist/esm/models/components/index.d.ts +1 -0
  82. package/dist/esm/models/components/index.d.ts.map +1 -1
  83. package/dist/esm/models/components/index.js +1 -0
  84. package/dist/esm/models/components/index.js.map +1 -1
  85. package/dist/esm/models/components/vendortargetfacility.d.ts +37 -0
  86. package/dist/esm/models/components/vendortargetfacility.d.ts.map +1 -0
  87. package/dist/esm/models/components/vendortargetfacility.js +31 -0
  88. package/dist/esm/models/components/vendortargetfacility.js.map +1 -0
  89. package/dist/esm/models/operations/getnextunansweredscreeningquestion.d.ts +9 -0
  90. package/dist/esm/models/operations/getnextunansweredscreeningquestion.d.ts.map +1 -1
  91. package/dist/esm/models/operations/getnextunansweredscreeningquestion.js +4 -0
  92. package/dist/esm/models/operations/getnextunansweredscreeningquestion.js.map +1 -1
  93. package/dist/esm/models/operations/getvendortargetfacilities.d.ts +86 -0
  94. package/dist/esm/models/operations/getvendortargetfacilities.d.ts.map +1 -0
  95. package/dist/esm/models/operations/getvendortargetfacilities.js +69 -0
  96. package/dist/esm/models/operations/getvendortargetfacilities.js.map +1 -0
  97. package/dist/esm/models/operations/index.d.ts +1 -0
  98. package/dist/esm/models/operations/index.d.ts.map +1 -1
  99. package/dist/esm/models/operations/index.js +1 -0
  100. package/dist/esm/models/operations/index.js.map +1 -1
  101. package/dist/esm/react-query/index.d.ts +1 -0
  102. package/dist/esm/react-query/index.d.ts.map +1 -1
  103. package/dist/esm/react-query/index.js +1 -0
  104. package/dist/esm/react-query/index.js.map +1 -1
  105. package/dist/esm/react-query/vendorsGetNextUnansweredScreeningQuestion.core.d.ts +1 -0
  106. package/dist/esm/react-query/vendorsGetNextUnansweredScreeningQuestion.core.d.ts.map +1 -1
  107. package/dist/esm/react-query/vendorsGetNextUnansweredScreeningQuestion.core.js +1 -1
  108. package/dist/esm/react-query/vendorsGetNextUnansweredScreeningQuestion.core.js.map +1 -1
  109. package/dist/esm/react-query/vendorsGetNextUnansweredScreeningQuestion.d.ts +2 -0
  110. package/dist/esm/react-query/vendorsGetNextUnansweredScreeningQuestion.d.ts.map +1 -1
  111. package/dist/esm/react-query/vendorsGetNextUnansweredScreeningQuestion.js.map +1 -1
  112. package/dist/esm/react-query/vendorsGetVendorTargetFacilities.core.d.ts +46 -0
  113. package/dist/esm/react-query/vendorsGetVendorTargetFacilities.core.d.ts.map +1 -0
  114. package/dist/esm/react-query/vendorsGetVendorTargetFacilities.core.js +95 -0
  115. package/dist/esm/react-query/vendorsGetVendorTargetFacilities.core.js.map +1 -0
  116. package/dist/esm/react-query/vendorsGetVendorTargetFacilities.d.ts +70 -0
  117. package/dist/esm/react-query/vendorsGetVendorTargetFacilities.d.ts.map +1 -0
  118. package/dist/esm/react-query/vendorsGetVendorTargetFacilities.js +89 -0
  119. package/dist/esm/react-query/vendorsGetVendorTargetFacilities.js.map +1 -0
  120. package/dist/esm/sdk/vendors.d.ts +9 -0
  121. package/dist/esm/sdk/vendors.d.ts.map +1 -1
  122. package/dist/esm/sdk/vendors.js +10 -0
  123. package/dist/esm/sdk/vendors.js.map +1 -1
  124. package/jsr.json +1 -1
  125. package/package.json +1 -1
  126. package/src/__tests__/vendors.test.ts +34 -0
  127. package/src/__tests__/webhooks.test.ts +1 -1
  128. package/src/__tests__/zones.test.ts +4 -23
  129. package/src/funcs/vendorsGetNextUnansweredScreeningQuestion.ts +9 -4
  130. package/src/funcs/vendorsGetVendorTargetFacilities.ts +265 -0
  131. package/src/lib/config.ts +2 -2
  132. package/src/models/components/expand.ts +1 -0
  133. package/src/models/components/index.ts +1 -0
  134. package/src/models/components/vendortargetfacility.ts +87 -0
  135. package/src/models/operations/getnextunansweredscreeningquestion.ts +13 -0
  136. package/src/models/operations/getvendortargetfacilities.ts +186 -0
  137. package/src/models/operations/index.ts +1 -0
  138. package/src/react-query/index.ts +1 -0
  139. package/src/react-query/vendorsGetNextUnansweredScreeningQuestion.core.ts +5 -2
  140. package/src/react-query/vendorsGetNextUnansweredScreeningQuestion.ts +8 -2
  141. package/src/react-query/vendorsGetVendorTargetFacilities.core.ts +218 -0
  142. package/src/react-query/vendorsGetVendorTargetFacilities.ts +281 -0
  143. package/src/sdk/vendors.ts +20 -0
@@ -0,0 +1,265 @@
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 { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import { GreenSecurityError } from "../models/errors/greensecurityerror.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.js";
22
+ import * as errors from "../models/errors/index.js";
23
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+ import {
29
+ createPageIterator,
30
+ haltIterator,
31
+ PageIterator,
32
+ Paginator,
33
+ } from "../types/operations.js";
34
+
35
+ /**
36
+ * List a vendor's target facilities
37
+ *
38
+ * @remarks
39
+ * Returns a paginated list of target facility rows for the specified vendor, including per-row screening question status.
40
+ */
41
+ export function vendorsGetVendorTargetFacilities(
42
+ client: GreenSecurityCore,
43
+ request: operations.GetVendorTargetFacilitiesRequest,
44
+ options?: RequestOptions,
45
+ ): APIPromise<
46
+ PageIterator<
47
+ Result<
48
+ operations.GetVendorTargetFacilitiesResponse,
49
+ | errors.ApiErrorResponse
50
+ | GreenSecurityError
51
+ | ResponseValidationError
52
+ | ConnectionError
53
+ | RequestAbortedError
54
+ | RequestTimeoutError
55
+ | InvalidRequestError
56
+ | UnexpectedClientError
57
+ | SDKValidationError
58
+ >,
59
+ { page: number }
60
+ >
61
+ > {
62
+ return new APIPromise($do(
63
+ client,
64
+ request,
65
+ options,
66
+ ));
67
+ }
68
+
69
+ async function $do(
70
+ client: GreenSecurityCore,
71
+ request: operations.GetVendorTargetFacilitiesRequest,
72
+ options?: RequestOptions,
73
+ ): Promise<
74
+ [
75
+ PageIterator<
76
+ Result<
77
+ operations.GetVendorTargetFacilitiesResponse,
78
+ | errors.ApiErrorResponse
79
+ | GreenSecurityError
80
+ | ResponseValidationError
81
+ | ConnectionError
82
+ | RequestAbortedError
83
+ | RequestTimeoutError
84
+ | InvalidRequestError
85
+ | UnexpectedClientError
86
+ | SDKValidationError
87
+ >,
88
+ { page: number }
89
+ >,
90
+ APICall,
91
+ ]
92
+ > {
93
+ const parsed = safeParse(
94
+ request,
95
+ (value) =>
96
+ operations.GetVendorTargetFacilitiesRequest$outboundSchema.parse(value),
97
+ "Input validation failed",
98
+ );
99
+ if (!parsed.ok) {
100
+ return [haltIterator(parsed), { status: "invalid" }];
101
+ }
102
+ const payload = parsed.value;
103
+ const body = null;
104
+
105
+ const pathParams = {
106
+ vendor_id_or_me: encodeSimple("vendor_id_or_me", payload.vendor_id_or_me, {
107
+ explode: false,
108
+ charEncoding: "percent",
109
+ }),
110
+ };
111
+ const path = pathToFunc("/vendors/{vendor_id_or_me}/target-facilities")(
112
+ pathParams,
113
+ );
114
+
115
+ const query = queryJoin(
116
+ encodeFormQuery({
117
+ "expand": payload.expand,
118
+ }, { explode: false }),
119
+ encodeFormQuery({
120
+ "desc": payload.desc,
121
+ "facility_name_like": payload.facility_name_like,
122
+ "items_per_page": payload.items_per_page,
123
+ "page": payload.page,
124
+ "search_like": payload.search_like,
125
+ "sort": payload.sort,
126
+ "status": payload.status,
127
+ "system_name_like": payload.system_name_like,
128
+ }),
129
+ );
130
+
131
+ const headers = new Headers(compactMap({
132
+ Accept: "application/json",
133
+ }));
134
+
135
+ const securityInput = await extractSecurity(client._options.security);
136
+ const requestSecurity = resolveGlobalSecurity(securityInput);
137
+
138
+ const context = {
139
+ options: client._options,
140
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
141
+ operationID: "getVendorTargetFacilities",
142
+ oAuth2Scopes: null,
143
+
144
+ resolvedSecurity: requestSecurity,
145
+
146
+ securitySource: client._options.security,
147
+ retryConfig: options?.retries
148
+ || client._options.retryConfig
149
+ || { strategy: "none" },
150
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
151
+ };
152
+
153
+ const requestRes = client._createRequest(context, {
154
+ security: requestSecurity,
155
+ method: "GET",
156
+ baseURL: options?.serverURL,
157
+ path: path,
158
+ headers: headers,
159
+ query: query,
160
+ body: body,
161
+ userAgent: client._options.userAgent,
162
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
163
+ }, options);
164
+ if (!requestRes.ok) {
165
+ return [haltIterator(requestRes), { status: "invalid" }];
166
+ }
167
+ const req = requestRes.value;
168
+
169
+ const doResult = await client._do(req, {
170
+ context,
171
+ isErrorStatusCode: (statusCode: number) =>
172
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
173
+ retryConfig: context.retryConfig,
174
+ retryCodes: context.retryCodes,
175
+ });
176
+ if (!doResult.ok) {
177
+ return [haltIterator(doResult), { status: "request-error", request: req }];
178
+ }
179
+ const response = doResult.value;
180
+
181
+ const responseFields = {
182
+ HttpMeta: { Response: response, Request: req },
183
+ };
184
+
185
+ const [result, raw] = await M.match<
186
+ operations.GetVendorTargetFacilitiesResponse,
187
+ | errors.ApiErrorResponse
188
+ | GreenSecurityError
189
+ | ResponseValidationError
190
+ | ConnectionError
191
+ | RequestAbortedError
192
+ | RequestTimeoutError
193
+ | InvalidRequestError
194
+ | UnexpectedClientError
195
+ | SDKValidationError
196
+ >(
197
+ M.json(200, operations.GetVendorTargetFacilitiesResponse$inboundSchema, {
198
+ key: "Result",
199
+ }),
200
+ M.jsonErr([403, 404], errors.ApiErrorResponse$inboundSchema),
201
+ M.fail("4XX"),
202
+ M.fail([500, "5XX"]),
203
+ )(response, req, { extraFields: responseFields });
204
+ if (!result.ok) {
205
+ return [haltIterator(result), {
206
+ status: "complete",
207
+ request: req,
208
+ response,
209
+ }];
210
+ }
211
+
212
+ const nextFunc = (
213
+ responseData: unknown,
214
+ ): {
215
+ next: Paginator<
216
+ Result<
217
+ operations.GetVendorTargetFacilitiesResponse,
218
+ | errors.ApiErrorResponse
219
+ | GreenSecurityError
220
+ | ResponseValidationError
221
+ | ConnectionError
222
+ | RequestAbortedError
223
+ | RequestTimeoutError
224
+ | InvalidRequestError
225
+ | UnexpectedClientError
226
+ | SDKValidationError
227
+ >
228
+ >;
229
+ "~next"?: { page: number };
230
+ } => {
231
+ const page = request?.page ?? 1;
232
+ const nextPage = page + 1;
233
+
234
+ if (!responseData) {
235
+ return { next: () => null };
236
+ }
237
+ const results = (responseData as { items: unknown }).items;
238
+ if (!Array.isArray(results) || !results.length) {
239
+ return { next: () => null };
240
+ }
241
+ const limit = request?.itemsPerPage ?? 0;
242
+ if (results.length < limit) {
243
+ return { next: () => null };
244
+ }
245
+
246
+ const nextVal = () =>
247
+ vendorsGetVendorTargetFacilities(
248
+ client,
249
+ {
250
+ ...request,
251
+ page: nextPage,
252
+ },
253
+ options,
254
+ );
255
+
256
+ return { next: nextVal, "~next": { page: nextPage } };
257
+ };
258
+
259
+ const page = { ...result, ...nextFunc(raw) };
260
+ return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
261
+ status: "complete",
262
+ request: req,
263
+ response,
264
+ }];
265
+ }
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.43.5",
83
- sdkVersion: "0.44.0-beta.34",
83
+ sdkVersion: "0.44.0-beta.36",
84
84
  genVersion: "2.912.1",
85
85
  userAgent:
86
- "speakeasy-sdk/typescript 0.44.0-beta.34 2.912.1 0.43.5 @greensecurity/javascript-sdk",
86
+ "speakeasy-sdk/typescript 0.44.0-beta.36 2.912.1 0.43.5 @greensecurity/javascript-sdk",
87
87
  } as const;
@@ -16,6 +16,7 @@ export const Expand = {
16
16
  CompanyVendorFields: "company.vendor_fields",
17
17
  CompanyVendorTypeRestrictions: "company.vendor_type_restrictions",
18
18
  CompanyTargetFacilityFacility: "company_target_facility.facility",
19
+ VendorTargetFacilityFacility: "vendor_target_facility.facility",
19
20
  ContactFacility: "contact.facility",
20
21
  ContactSystem: "contact.system",
21
22
  ContactDepartment: "contact.department",
@@ -96,6 +96,7 @@ export * from "./vendorscanscreeningquestion.js";
96
96
  export * from "./vendorscanscreeningresponse.js";
97
97
  export * from "./vendorscrubdetails.js";
98
98
  export * from "./vendorscrubpurchase.js";
99
+ export * from "./vendortargetfacility.js";
99
100
  export * from "./vendortype.js";
100
101
  export * from "./webhookendpoint.js";
101
102
  export * from "./zone.js";
@@ -0,0 +1,87 @@
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 { smartUnion } from "../../types/smartUnion.js";
11
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
12
+ import { Facility, Facility$inboundSchema } from "./facility.js";
13
+
14
+ /**
15
+ * The linked facility. Returns the facility ID by default; pass `vendor_target_facility.facility` to `expand` to receive the full facility object.
16
+ */
17
+ export type VendorTargetFacilityFacility = Facility | number;
18
+
19
+ /**
20
+ * A target facility row belonging to an individual vendor.
21
+ */
22
+ export type VendorTargetFacility = {
23
+ /**
24
+ * VendorTargetFacility row ID.
25
+ */
26
+ id: number;
27
+ /**
28
+ * The linked facility. Returns the facility ID by default; pass `vendor_target_facility.facility` to `expand` to receive the full facility object.
29
+ */
30
+ facility: Facility | number | null;
31
+ /**
32
+ * Link status (Approved, Pending, or Denied).
33
+ */
34
+ status: string | null;
35
+ /**
36
+ * Whether all TIP 1 screening questions for this facility have been answered by the vendor.
37
+ */
38
+ questionsAnswered: boolean | null;
39
+ dateCreated?: Date | null | undefined;
40
+ };
41
+
42
+ /** @internal */
43
+ export const VendorTargetFacilityFacility$inboundSchema: z.ZodType<
44
+ VendorTargetFacilityFacility,
45
+ z.ZodTypeDef,
46
+ unknown
47
+ > = smartUnion([Facility$inboundSchema, types.number()]);
48
+
49
+ export function vendorTargetFacilityFacilityFromJSON(
50
+ jsonString: string,
51
+ ): SafeParseResult<VendorTargetFacilityFacility, SDKValidationError> {
52
+ return safeParse(
53
+ jsonString,
54
+ (x) => VendorTargetFacilityFacility$inboundSchema.parse(JSON.parse(x)),
55
+ `Failed to parse 'VendorTargetFacilityFacility' from JSON`,
56
+ );
57
+ }
58
+
59
+ /** @internal */
60
+ export const VendorTargetFacility$inboundSchema: z.ZodType<
61
+ VendorTargetFacility,
62
+ z.ZodTypeDef,
63
+ unknown
64
+ > = z.object({
65
+ id: types.number(),
66
+ facility: types.nullable(
67
+ smartUnion([Facility$inboundSchema, types.number()]),
68
+ ),
69
+ status: types.nullable(types.string()),
70
+ questions_answered: types.nullable(types.boolean()),
71
+ date_created: z.nullable(types.date()).optional(),
72
+ }).transform((v) => {
73
+ return remap$(v, {
74
+ "questions_answered": "questionsAnswered",
75
+ "date_created": "dateCreated",
76
+ });
77
+ });
78
+
79
+ export function vendorTargetFacilityFromJSON(
80
+ jsonString: string,
81
+ ): SafeParseResult<VendorTargetFacility, SDKValidationError> {
82
+ return safeParse(
83
+ jsonString,
84
+ (x) => VendorTargetFacility$inboundSchema.parse(JSON.parse(x)),
85
+ `Failed to parse 'VendorTargetFacility' from JSON`,
86
+ );
87
+ }
@@ -21,6 +21,10 @@ export type GetNextUnansweredScreeningQuestionRequest = {
21
21
  * supported only on endpoints that explicitly document QR-code lookup
22
22
  */
23
23
  vendorIdOrMe: string;
24
+ /**
25
+ * When provided, filters questions to those belonging to the specified facility. The facility must be targeted by the vendor.
26
+ */
27
+ facilityId?: number | undefined;
24
28
  /**
25
29
  * An array-style parameter to identify which sections of an object to expand. See documentation for the endpoint for a list of valid expansion values.
26
30
  */
@@ -34,12 +38,17 @@ export type GetNextUnansweredScreeningQuestionGetNextUnansweredScreeningQuestion
34
38
  {
35
39
  screeningQuestion: components.ScreeningQuestion | null;
36
40
  screeningResponse: components.ScreeningResponse | null;
41
+ /**
42
+ * Name of the facility the questions are scoped to. Null when facility_id query param is omitted.
43
+ */
44
+ facilityName: string | null;
37
45
  success: boolean;
38
46
  };
39
47
 
40
48
  /** @internal */
41
49
  export type GetNextUnansweredScreeningQuestionRequest$Outbound = {
42
50
  vendor_id_or_me: string;
51
+ facility_id?: number | undefined;
43
52
  expand?: Array<string> | undefined;
44
53
  };
45
54
 
@@ -51,10 +60,12 @@ export const GetNextUnansweredScreeningQuestionRequest$outboundSchema:
51
60
  GetNextUnansweredScreeningQuestionRequest
52
61
  > = z.object({
53
62
  vendorIdOrMe: z.string(),
63
+ facilityId: z.number().int().optional(),
54
64
  expand: z.array(components.Expand$outboundSchema).optional(),
55
65
  }).transform((v) => {
56
66
  return remap$(v, {
57
67
  vendorIdOrMe: "vendor_id_or_me",
68
+ facilityId: "facility_id",
58
69
  });
59
70
  });
60
71
 
@@ -82,11 +93,13 @@ export const GetNextUnansweredScreeningQuestionGetNextUnansweredScreeningQuestio
82
93
  screening_response: types.nullable(
83
94
  components.ScreeningResponse$inboundSchema,
84
95
  ),
96
+ facility_name: types.nullable(types.string()),
85
97
  success: types.boolean(),
86
98
  }).transform((v) => {
87
99
  return remap$(v, {
88
100
  "screening_question": "screeningQuestion",
89
101
  "screening_response": "screeningResponse",
102
+ "facility_name": "facilityName",
90
103
  });
91
104
  });
92
105
 
@@ -0,0 +1,186 @@
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 { ClosedEnum } from "../../types/enums.js";
9
+ import { Result as SafeParseResult } from "../../types/fp.js";
10
+ import * as components from "../components/index.js";
11
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
12
+
13
+ export const GetVendorTargetFacilitiesQueryParamStatus = {
14
+ Pending: "pending",
15
+ Approved: "approved",
16
+ Denied: "denied",
17
+ } as const;
18
+ export type GetVendorTargetFacilitiesQueryParamStatus = ClosedEnum<
19
+ typeof GetVendorTargetFacilitiesQueryParamStatus
20
+ >;
21
+
22
+ export const GetVendorTargetFacilitiesQueryParamSort = {
23
+ FacilityName: "facility_name",
24
+ SystemName: "system_name",
25
+ Status: "status",
26
+ QuestionsAnswered: "questions_answered",
27
+ DateCreated: "date_created",
28
+ } as const;
29
+ export type GetVendorTargetFacilitiesQueryParamSort = ClosedEnum<
30
+ typeof GetVendorTargetFacilitiesQueryParamSort
31
+ >;
32
+
33
+ export type GetVendorTargetFacilitiesRequest = {
34
+ /**
35
+ * Vendor identifier. Depending on the endpoint, accepts one or more of:
36
+ *
37
+ * @remarks
38
+ * - A numeric vendor ID (positive integer, e.g. `42`)
39
+ * - The keyword `me` to represent the authenticated vendor
40
+ * - An active QR code (alphanumeric, hyphen-separated, e.g. `ABC-123-DEF`) —
41
+ * supported only on endpoints that explicitly document QR-code lookup
42
+ */
43
+ vendorIdOrMe: string;
44
+ facilityNameLike?: string | undefined;
45
+ systemNameLike?: string | undefined;
46
+ /**
47
+ * Search across facility name and system name.
48
+ */
49
+ searchLike?: string | undefined;
50
+ status?: GetVendorTargetFacilitiesQueryParamStatus | undefined;
51
+ page?: number | undefined;
52
+ itemsPerPage?: number | undefined;
53
+ sort?: GetVendorTargetFacilitiesQueryParamSort | undefined;
54
+ desc?: boolean | undefined;
55
+ /**
56
+ * An array-style parameter to identify which sections of an object to expand. See documentation for the endpoint for a list of valid expansion values.
57
+ */
58
+ expand?: Array<components.Expand> | undefined;
59
+ };
60
+
61
+ /**
62
+ * The request was successful, and the server has returned the requested resource in the response body.
63
+ */
64
+ export type GetVendorTargetFacilitiesGetVendorTargetFacilitiesOk = {
65
+ /**
66
+ * Pagination information for a pageable list
67
+ */
68
+ pager: components.Pager;
69
+ items: Array<components.VendorTargetFacility>;
70
+ };
71
+
72
+ export type GetVendorTargetFacilitiesResponse = {
73
+ result: GetVendorTargetFacilitiesGetVendorTargetFacilitiesOk;
74
+ };
75
+
76
+ /** @internal */
77
+ export const GetVendorTargetFacilitiesQueryParamStatus$outboundSchema:
78
+ z.ZodNativeEnum<typeof GetVendorTargetFacilitiesQueryParamStatus> = z
79
+ .nativeEnum(GetVendorTargetFacilitiesQueryParamStatus);
80
+
81
+ /** @internal */
82
+ export const GetVendorTargetFacilitiesQueryParamSort$outboundSchema:
83
+ z.ZodNativeEnum<typeof GetVendorTargetFacilitiesQueryParamSort> = z
84
+ .nativeEnum(GetVendorTargetFacilitiesQueryParamSort);
85
+
86
+ /** @internal */
87
+ export type GetVendorTargetFacilitiesRequest$Outbound = {
88
+ vendor_id_or_me: string;
89
+ facility_name_like?: string | undefined;
90
+ system_name_like?: string | undefined;
91
+ search_like?: string | undefined;
92
+ status?: string | undefined;
93
+ page?: number | undefined;
94
+ items_per_page?: number | undefined;
95
+ sort?: string | undefined;
96
+ desc?: boolean | undefined;
97
+ expand?: Array<string> | undefined;
98
+ };
99
+
100
+ /** @internal */
101
+ export const GetVendorTargetFacilitiesRequest$outboundSchema: z.ZodType<
102
+ GetVendorTargetFacilitiesRequest$Outbound,
103
+ z.ZodTypeDef,
104
+ GetVendorTargetFacilitiesRequest
105
+ > = z.object({
106
+ vendorIdOrMe: z.string(),
107
+ facilityNameLike: z.string().optional(),
108
+ systemNameLike: z.string().optional(),
109
+ searchLike: z.string().optional(),
110
+ status: GetVendorTargetFacilitiesQueryParamStatus$outboundSchema.optional(),
111
+ page: z.number().int().optional(),
112
+ itemsPerPage: z.number().int().optional(),
113
+ sort: GetVendorTargetFacilitiesQueryParamSort$outboundSchema.optional(),
114
+ desc: z.boolean().optional(),
115
+ expand: z.array(components.Expand$outboundSchema).optional(),
116
+ }).transform((v) => {
117
+ return remap$(v, {
118
+ vendorIdOrMe: "vendor_id_or_me",
119
+ facilityNameLike: "facility_name_like",
120
+ systemNameLike: "system_name_like",
121
+ searchLike: "search_like",
122
+ itemsPerPage: "items_per_page",
123
+ });
124
+ });
125
+
126
+ export function getVendorTargetFacilitiesRequestToJSON(
127
+ getVendorTargetFacilitiesRequest: GetVendorTargetFacilitiesRequest,
128
+ ): string {
129
+ return JSON.stringify(
130
+ GetVendorTargetFacilitiesRequest$outboundSchema.parse(
131
+ getVendorTargetFacilitiesRequest,
132
+ ),
133
+ );
134
+ }
135
+
136
+ /** @internal */
137
+ export const GetVendorTargetFacilitiesGetVendorTargetFacilitiesOk$inboundSchema:
138
+ z.ZodType<
139
+ GetVendorTargetFacilitiesGetVendorTargetFacilitiesOk,
140
+ z.ZodTypeDef,
141
+ unknown
142
+ > = z.object({
143
+ pager: components.Pager$inboundSchema,
144
+ items: z.array(components.VendorTargetFacility$inboundSchema),
145
+ });
146
+
147
+ export function getVendorTargetFacilitiesGetVendorTargetFacilitiesOkFromJSON(
148
+ jsonString: string,
149
+ ): SafeParseResult<
150
+ GetVendorTargetFacilitiesGetVendorTargetFacilitiesOk,
151
+ SDKValidationError
152
+ > {
153
+ return safeParse(
154
+ jsonString,
155
+ (x) =>
156
+ GetVendorTargetFacilitiesGetVendorTargetFacilitiesOk$inboundSchema.parse(
157
+ JSON.parse(x),
158
+ ),
159
+ `Failed to parse 'GetVendorTargetFacilitiesGetVendorTargetFacilitiesOk' from JSON`,
160
+ );
161
+ }
162
+
163
+ /** @internal */
164
+ export const GetVendorTargetFacilitiesResponse$inboundSchema: z.ZodType<
165
+ GetVendorTargetFacilitiesResponse,
166
+ z.ZodTypeDef,
167
+ unknown
168
+ > = z.object({
169
+ Result: z.lazy(() =>
170
+ GetVendorTargetFacilitiesGetVendorTargetFacilitiesOk$inboundSchema
171
+ ),
172
+ }).transform((v) => {
173
+ return remap$(v, {
174
+ "Result": "result",
175
+ });
176
+ });
177
+
178
+ export function getVendorTargetFacilitiesResponseFromJSON(
179
+ jsonString: string,
180
+ ): SafeParseResult<GetVendorTargetFacilitiesResponse, SDKValidationError> {
181
+ return safeParse(
182
+ jsonString,
183
+ (x) => GetVendorTargetFacilitiesResponse$inboundSchema.parse(JSON.parse(x)),
184
+ `Failed to parse 'GetVendorTargetFacilitiesResponse' from JSON`,
185
+ );
186
+ }
@@ -68,6 +68,7 @@ export * from "./getvendorscan.js";
68
68
  export * from "./getvendorscansexportstatus.js";
69
69
  export * from "./getvendorsdetails.js";
70
70
  export * from "./getvendorsexportstatus.js";
71
+ export * from "./getvendortargetfacilities.js";
71
72
  export * from "./getvendoruploadhistory.js";
72
73
  export * from "./getwebhookendpoint.js";
73
74
  export * from "./invoicesexport.js";
@@ -112,6 +112,7 @@ export * from "./vendorsGetVendorLegalName.js";
112
112
  export * from "./vendorsGetVendorPaymentResponsibility.js";
113
113
  export * from "./vendorsGetVendorsDetails.js";
114
114
  export * from "./vendorsGetVendorsExportStatus.js";
115
+ export * from "./vendorsGetVendorTargetFacilities.js";
115
116
  export * from "./vendorsGetVendorUploadHistory.js";
116
117
  export * from "./vendorsListVendorAdditionalFacilityFields.js";
117
118
  export * from "./vendorsListVendorCredentialDataRequests.js";
@@ -45,7 +45,7 @@ export function buildVendorsGetNextUnansweredScreeningQuestionQuery(
45
45
  return {
46
46
  queryKey: queryKeyVendorsGetNextUnansweredScreeningQuestion(
47
47
  request.vendorIdOrMe,
48
- { expand: request.expand },
48
+ { facilityId: request.facilityId, expand: request.expand },
49
49
  ),
50
50
  queryFn: async function vendorsGetNextUnansweredScreeningQuestionQueryFn(
51
51
  ctx,
@@ -72,7 +72,10 @@ export function buildVendorsGetNextUnansweredScreeningQuestionQuery(
72
72
 
73
73
  export function queryKeyVendorsGetNextUnansweredScreeningQuestion(
74
74
  vendorIdOrMe: string,
75
- parameters: { expand?: Array<components.Expand> | undefined },
75
+ parameters: {
76
+ facilityId?: number | undefined;
77
+ expand?: Array<components.Expand> | undefined;
78
+ },
76
79
  ): QueryKey {
77
80
  return [
78
81
  "@greensecurity/javascript-sdk",
@@ -111,7 +111,10 @@ export function setVendorsGetNextUnansweredScreeningQuestionData(
111
111
  client: QueryClient,
112
112
  queryKeyBase: [
113
113
  vendorIdOrMe: string,
114
- parameters: { expand?: Array<components.Expand> | undefined },
114
+ parameters: {
115
+ facilityId?: number | undefined;
116
+ expand?: Array<components.Expand> | undefined;
117
+ },
115
118
  ],
116
119
  data: VendorsGetNextUnansweredScreeningQuestionQueryData,
117
120
  ): VendorsGetNextUnansweredScreeningQuestionQueryData | undefined {
@@ -129,7 +132,10 @@ export function invalidateVendorsGetNextUnansweredScreeningQuestion(
129
132
  queryKeyBase: TupleToPrefixes<
130
133
  [
131
134
  vendorIdOrMe: string,
132
- parameters: { expand?: Array<components.Expand> | undefined },
135
+ parameters: {
136
+ facilityId?: number | undefined;
137
+ expand?: Array<components.Expand> | undefined;
138
+ },
133
139
  ]
134
140
  >,
135
141
  filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,