@censys/platform-sdk 0.4.3 → 0.5.0

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 (177) hide show
  1. package/FUNCTIONS.md +0 -1
  2. package/README.md +17 -2
  3. package/docs/sdks/collections/README.md +12 -6
  4. package/docs/sdks/globaldata/README.md +347 -6
  5. package/docs/sdks/threathunting/README.md +248 -0
  6. package/examples/globalDataSearch.example.ts +0 -1
  7. package/examples/package-lock.json +5 -6
  8. package/funcs/globalDataCreateTrackedScan.d.ts +18 -0
  9. package/funcs/globalDataCreateTrackedScan.d.ts.map +1 -0
  10. package/funcs/globalDataCreateTrackedScan.js +132 -0
  11. package/funcs/globalDataCreateTrackedScan.js.map +1 -0
  12. package/funcs/globalDataGetHostObservationsWithCertificate.d.ts +18 -0
  13. package/funcs/globalDataGetHostObservationsWithCertificate.d.ts.map +1 -0
  14. package/funcs/globalDataGetHostObservationsWithCertificate.js +141 -0
  15. package/funcs/globalDataGetHostObservationsWithCertificate.js.map +1 -0
  16. package/funcs/globalDataGetTrackedScan.d.ts +19 -0
  17. package/funcs/globalDataGetTrackedScan.d.ts.map +1 -0
  18. package/funcs/globalDataGetTrackedScan.js +137 -0
  19. package/funcs/globalDataGetTrackedScan.js.map +1 -0
  20. package/funcs/globalDataGetTrackedScanThreatHunting.d.ts +19 -0
  21. package/funcs/globalDataGetTrackedScanThreatHunting.d.ts.map +1 -0
  22. package/funcs/globalDataGetTrackedScanThreatHunting.js +137 -0
  23. package/funcs/globalDataGetTrackedScanThreatHunting.js.map +1 -0
  24. package/funcs/threatHuntingCreateTrackedScan.d.ts +18 -0
  25. package/funcs/threatHuntingCreateTrackedScan.d.ts.map +1 -0
  26. package/funcs/threatHuntingCreateTrackedScan.js +129 -0
  27. package/funcs/threatHuntingCreateTrackedScan.js.map +1 -0
  28. package/jsr.json +1 -1
  29. package/lib/config.d.ts +4 -4
  30. package/lib/config.js +4 -4
  31. package/models/components/elasticsearch.d.ts +3 -0
  32. package/models/components/elasticsearch.d.ts.map +1 -1
  33. package/models/components/elasticsearch.js +5 -0
  34. package/models/components/elasticsearch.js.map +1 -1
  35. package/models/components/elasticsearcherrormessage.d.ts +33 -0
  36. package/models/components/elasticsearcherrormessage.d.ts.map +1 -0
  37. package/models/components/elasticsearcherrormessage.js +73 -0
  38. package/models/components/elasticsearcherrormessage.js.map +1 -0
  39. package/models/components/hostobservationrange.d.ts +39 -0
  40. package/models/components/hostobservationrange.d.ts.map +1 -0
  41. package/models/components/hostobservationrange.js +92 -0
  42. package/models/components/hostobservationrange.js.map +1 -0
  43. package/models/components/hostobservationresponse.d.ts +34 -0
  44. package/models/components/hostobservationresponse.d.ts.map +1 -0
  45. package/models/components/hostobservationresponse.js +85 -0
  46. package/models/components/hostobservationresponse.js.map +1 -0
  47. package/models/components/httpfavicon.d.ts +5 -0
  48. package/models/components/httpfavicon.d.ts.map +1 -1
  49. package/models/components/httpfavicon.js +4 -0
  50. package/models/components/httpfavicon.js.map +1 -1
  51. package/models/components/index.d.ts +14 -0
  52. package/models/components/index.d.ts.map +1 -1
  53. package/models/components/index.js +14 -0
  54. package/models/components/index.js.map +1 -1
  55. package/models/components/responseenvelopehostobservationresponse.d.ts +30 -0
  56. package/models/components/responseenvelopehostobservationresponse.d.ts.map +1 -0
  57. package/models/components/responseenvelopehostobservationresponse.js +70 -0
  58. package/models/components/responseenvelopehostobservationresponse.js.map +1 -0
  59. package/models/components/responseenvelopetrackedscan.d.ts +30 -0
  60. package/models/components/responseenvelopetrackedscan.d.ts.map +1 -0
  61. package/models/components/responseenvelopetrackedscan.js +70 -0
  62. package/models/components/responseenvelopetrackedscan.js.map +1 -0
  63. package/models/components/scansdiscoveryinputbody.d.ts +172 -0
  64. package/models/components/scansdiscoveryinputbody.d.ts.map +1 -0
  65. package/models/components/scansdiscoveryinputbody.js +233 -0
  66. package/models/components/scansdiscoveryinputbody.js.map +1 -0
  67. package/models/components/scansrescaninputbody.d.ts +214 -0
  68. package/models/components/scansrescaninputbody.d.ts.map +1 -0
  69. package/models/components/scansrescaninputbody.js +268 -0
  70. package/models/components/scansrescaninputbody.js.map +1 -0
  71. package/models/components/screenshot.d.ts +2 -0
  72. package/models/components/screenshot.d.ts.map +1 -1
  73. package/models/components/screenshot.js +11 -0
  74. package/models/components/screenshot.js.map +1 -1
  75. package/models/components/searchaggregateinputbody.d.ts +5 -0
  76. package/models/components/searchaggregateinputbody.d.ts.map +1 -1
  77. package/models/components/searchaggregateinputbody.js +4 -0
  78. package/models/components/searchaggregateinputbody.js.map +1 -1
  79. package/models/components/searchvaluecountsinputbody.d.ts +5 -0
  80. package/models/components/searchvaluecountsinputbody.d.ts.map +1 -1
  81. package/models/components/searchvaluecountsinputbody.js +2 -0
  82. package/models/components/searchvaluecountsinputbody.js.map +1 -1
  83. package/models/components/serviceid.d.ts +70 -0
  84. package/models/components/serviceid.d.ts.map +1 -0
  85. package/models/components/serviceid.js +106 -0
  86. package/models/components/serviceid.js.map +1 -0
  87. package/models/components/trackedscan.d.ts +39 -0
  88. package/models/components/trackedscan.d.ts.map +1 -0
  89. package/models/components/trackedscan.js +90 -0
  90. package/models/components/trackedscan.js.map +1 -0
  91. package/models/components/trackedscanscantarget.d.ts +39 -0
  92. package/models/components/trackedscanscantarget.d.ts.map +1 -0
  93. package/models/components/trackedscanscantarget.js +94 -0
  94. package/models/components/trackedscanscantarget.js.map +1 -0
  95. package/models/components/trackedscanscantargethostnameport.d.ts +31 -0
  96. package/models/components/trackedscanscantargethostnameport.d.ts.map +1 -0
  97. package/models/components/trackedscanscantargethostnameport.js +71 -0
  98. package/models/components/trackedscanscantargethostnameport.js.map +1 -0
  99. package/models/components/trackedscanscantargethostport.d.ts +31 -0
  100. package/models/components/trackedscanscantargethostport.d.ts.map +1 -0
  101. package/models/components/trackedscanscantargethostport.js +71 -0
  102. package/models/components/trackedscanscantargethostport.js.map +1 -0
  103. package/models/components/trackedscantask.d.ts +74 -0
  104. package/models/components/trackedscantask.d.ts.map +1 -0
  105. package/models/components/trackedscantask.js +106 -0
  106. package/models/components/trackedscantask.js.map +1 -0
  107. package/models/components/weborigin.d.ts +31 -0
  108. package/models/components/weborigin.d.ts.map +1 -0
  109. package/models/components/weborigin.js +71 -0
  110. package/models/components/weborigin.js.map +1 -0
  111. package/models/operations/index.d.ts +5 -0
  112. package/models/operations/index.d.ts.map +1 -1
  113. package/models/operations/index.js +5 -0
  114. package/models/operations/index.js.map +1 -1
  115. package/models/operations/v3globaldatagethostobservationswithcertificate.d.ts +124 -0
  116. package/models/operations/v3globaldatagethostobservationswithcertificate.d.ts.map +1 -0
  117. package/models/operations/v3globaldatagethostobservationswithcertificate.js +178 -0
  118. package/models/operations/v3globaldatagethostobservationswithcertificate.js.map +1 -0
  119. package/models/operations/v3globaldatascansget.d.ts +94 -0
  120. package/models/operations/v3globaldatascansget.d.ts.map +1 -0
  121. package/models/operations/v3globaldatascansget.js +157 -0
  122. package/models/operations/v3globaldatascansget.js.map +1 -0
  123. package/models/operations/v3globaldatascansrescan.d.ts +91 -0
  124. package/models/operations/v3globaldatascansrescan.d.ts.map +1 -0
  125. package/models/operations/v3globaldatascansrescan.js +157 -0
  126. package/models/operations/v3globaldatascansrescan.js.map +1 -0
  127. package/models/operations/v3threathuntingscansdiscovery.d.ts +91 -0
  128. package/models/operations/v3threathuntingscansdiscovery.d.ts.map +1 -0
  129. package/models/operations/v3threathuntingscansdiscovery.js +157 -0
  130. package/models/operations/v3threathuntingscansdiscovery.js.map +1 -0
  131. package/models/operations/v3threathuntingscansget.d.ts +94 -0
  132. package/models/operations/v3threathuntingscansget.d.ts.map +1 -0
  133. package/models/operations/v3threathuntingscansget.js +157 -0
  134. package/models/operations/v3threathuntingscansget.js.map +1 -0
  135. package/package.json +4 -5
  136. package/sdk/globaldata.d.ts +30 -0
  137. package/sdk/globaldata.d.ts.map +1 -1
  138. package/sdk/globaldata.js +42 -0
  139. package/sdk/globaldata.js.map +1 -1
  140. package/sdk/threathunting.d.ts +23 -0
  141. package/sdk/threathunting.d.ts.map +1 -1
  142. package/sdk/threathunting.js +32 -0
  143. package/sdk/threathunting.js.map +1 -1
  144. package/src/funcs/globalDataCreateTrackedScan.ts +185 -0
  145. package/src/funcs/globalDataGetHostObservationsWithCertificate.ts +201 -0
  146. package/src/funcs/globalDataGetTrackedScan.ts +191 -0
  147. package/src/funcs/globalDataGetTrackedScanThreatHunting.ts +191 -0
  148. package/src/funcs/threatHuntingCreateTrackedScan.ts +188 -0
  149. package/src/lib/config.ts +4 -4
  150. package/src/models/components/elasticsearch.ts +12 -0
  151. package/src/models/components/elasticsearcherrormessage.ts +74 -0
  152. package/src/models/components/hostobservationrange.ts +99 -0
  153. package/src/models/components/hostobservationresponse.ts +91 -0
  154. package/src/models/components/httpfavicon.ts +9 -0
  155. package/src/models/components/index.ts +14 -0
  156. package/src/models/components/responseenvelopehostobservationresponse.ts +83 -0
  157. package/src/models/components/responseenvelopetrackedscan.ts +74 -0
  158. package/src/models/components/scansdiscoveryinputbody.ts +385 -0
  159. package/src/models/components/scansrescaninputbody.ts +428 -0
  160. package/src/models/components/screenshot.ts +13 -0
  161. package/src/models/components/searchaggregateinputbody.ts +9 -0
  162. package/src/models/components/searchvaluecountsinputbody.ts +7 -0
  163. package/src/models/components/serviceid.ts +116 -0
  164. package/src/models/components/trackedscan.ts +101 -0
  165. package/src/models/components/trackedscanscantarget.ts +117 -0
  166. package/src/models/components/trackedscanscantargethostnameport.ts +73 -0
  167. package/src/models/components/trackedscanscantargethostport.ts +72 -0
  168. package/src/models/components/trackedscantask.ts +114 -0
  169. package/src/models/components/weborigin.ts +66 -0
  170. package/src/models/operations/index.ts +5 -0
  171. package/src/models/operations/v3globaldatagethostobservationswithcertificate.ts +317 -0
  172. package/src/models/operations/v3globaldatascansget.ts +232 -0
  173. package/src/models/operations/v3globaldatascansrescan.ts +229 -0
  174. package/src/models/operations/v3threathuntingscansdiscovery.ts +238 -0
  175. package/src/models/operations/v3threathuntingscansget.ts +232 -0
  176. package/src/sdk/globaldata.ts +76 -0
  177. package/src/sdk/threathunting.ts +56 -0
@@ -0,0 +1,191 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { SDKCore } 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 {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../models/errors/httpclienterrors.js";
20
+ import * as errors from "../models/errors/index.js";
21
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
22
+ import { SDKBaseError } from "../models/errors/sdkbaseerror.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 tracked scan details
30
+ *
31
+ * @remarks
32
+ * Retrieve the current status and results of a tracked scan by its ID.
33
+ * This endpoint works for both discovery scans and rescans.
34
+ */
35
+ export function globalDataGetTrackedScanThreatHunting(
36
+ client: SDKCore,
37
+ request: operations.V3ThreathuntingScansGetRequest,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ operations.V3ThreathuntingScansGetResponse,
42
+ | errors.ErrorModel
43
+ | SDKBaseError
44
+ | ResponseValidationError
45
+ | ConnectionError
46
+ | RequestAbortedError
47
+ | RequestTimeoutError
48
+ | InvalidRequestError
49
+ | UnexpectedClientError
50
+ | SDKValidationError
51
+ >
52
+ > {
53
+ return new APIPromise($do(
54
+ client,
55
+ request,
56
+ options,
57
+ ));
58
+ }
59
+
60
+ async function $do(
61
+ client: SDKCore,
62
+ request: operations.V3ThreathuntingScansGetRequest,
63
+ options?: RequestOptions,
64
+ ): Promise<
65
+ [
66
+ Result<
67
+ operations.V3ThreathuntingScansGetResponse,
68
+ | errors.ErrorModel
69
+ | SDKBaseError
70
+ | ResponseValidationError
71
+ | ConnectionError
72
+ | RequestAbortedError
73
+ | RequestTimeoutError
74
+ | InvalidRequestError
75
+ | UnexpectedClientError
76
+ | SDKValidationError
77
+ >,
78
+ APICall,
79
+ ]
80
+ > {
81
+ const parsed = safeParse(
82
+ request,
83
+ (value) =>
84
+ operations.V3ThreathuntingScansGetRequest$outboundSchema.parse(value),
85
+ "Input validation failed",
86
+ );
87
+ if (!parsed.ok) {
88
+ return [parsed, { status: "invalid" }];
89
+ }
90
+ const payload = parsed.value;
91
+ const body = null;
92
+
93
+ const pathParams = {
94
+ scan_id: encodeSimple("scan_id", payload.scan_id, {
95
+ explode: false,
96
+ charEncoding: "percent",
97
+ }),
98
+ };
99
+
100
+ const path = pathToFunc("/v3/threat-hunting/scans/{scan_id}")(pathParams);
101
+
102
+ const query = encodeFormQuery({
103
+ "organization_id": payload.organization_id
104
+ ?? client._options.organizationId,
105
+ }, { explode: false });
106
+
107
+ const headers = new Headers(compactMap({
108
+ Accept: "application/vnd.censys.api.v3.trackedscan.v1+json",
109
+ }));
110
+
111
+ const secConfig = await extractSecurity(client._options.personalAccessToken);
112
+ const securityInput = secConfig == null
113
+ ? {}
114
+ : { personalAccessToken: secConfig };
115
+ const requestSecurity = resolveGlobalSecurity(securityInput);
116
+
117
+ const context = {
118
+ options: client._options,
119
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
120
+ operationID: "v3-threathunting-scans-get",
121
+ oAuth2Scopes: [],
122
+
123
+ resolvedSecurity: requestSecurity,
124
+
125
+ securitySource: client._options.personalAccessToken,
126
+ retryConfig: options?.retries
127
+ || client._options.retryConfig
128
+ || { strategy: "none" },
129
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
130
+ };
131
+
132
+ const requestRes = client._createRequest(context, {
133
+ security: requestSecurity,
134
+ method: "GET",
135
+ baseURL: options?.serverURL,
136
+ path: path,
137
+ headers: headers,
138
+ query: query,
139
+ body: body,
140
+ userAgent: client._options.userAgent,
141
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
142
+ }, options);
143
+ if (!requestRes.ok) {
144
+ return [requestRes, { status: "invalid" }];
145
+ }
146
+ const req = requestRes.value;
147
+
148
+ const doResult = await client._do(req, {
149
+ context,
150
+ errorCodes: ["401", "403", "4XX", "5XX"],
151
+ retryConfig: context.retryConfig,
152
+ retryCodes: context.retryCodes,
153
+ });
154
+ if (!doResult.ok) {
155
+ return [doResult, { status: "request-error", request: req }];
156
+ }
157
+ const response = doResult.value;
158
+
159
+ const responseFields = {
160
+ HttpMeta: { Response: response, Request: req },
161
+ };
162
+
163
+ const [result] = await M.match<
164
+ operations.V3ThreathuntingScansGetResponse,
165
+ | errors.ErrorModel
166
+ | SDKBaseError
167
+ | ResponseValidationError
168
+ | ConnectionError
169
+ | RequestAbortedError
170
+ | RequestTimeoutError
171
+ | InvalidRequestError
172
+ | UnexpectedClientError
173
+ | SDKValidationError
174
+ >(
175
+ M.json(200, operations.V3ThreathuntingScansGetResponse$inboundSchema, {
176
+ ctype: "application/vnd.censys.api.v3.trackedscan.v1+json",
177
+ hdrs: true,
178
+ key: "Result",
179
+ }),
180
+ M.jsonErr([401, 403], errors.ErrorModel$inboundSchema, {
181
+ ctype: "application/problem+json",
182
+ }),
183
+ M.fail("4XX"),
184
+ M.fail("5XX"),
185
+ )(response, req, { extraFields: responseFields });
186
+ if (!result.ok) {
187
+ return [result, { status: "complete", request: req, response }];
188
+ }
189
+
190
+ return [result, { status: "complete", request: req, response }];
191
+ }
@@ -0,0 +1,188 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { SDKCore } from "../core.js";
6
+ import { encodeFormQuery, encodeJSON } 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 {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../models/errors/httpclienterrors.js";
20
+ import * as errors from "../models/errors/index.js";
21
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
22
+ import { SDKBaseError } from "../models/errors/sdkbaseerror.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 tracked discovery scan
30
+ *
31
+ * @remarks
32
+ * Create a new tracked discovery scan for a specified target. Discovery scans are used to scan new targets that have not been previously identified. The scan will be queued. The response will contain a scan ID that you can use with the [get tracked scan details endpoint](https://docs.censys.com/reference/v3-globaldata-scans-get#/) to monitor its status and results.<br><br>This endpoint is available to organizations that have access to the Threat Hunting module.
33
+ */
34
+ export function threatHuntingCreateTrackedScan(
35
+ client: SDKCore,
36
+ request: operations.V3ThreathuntingScansDiscoveryRequest,
37
+ options?: RequestOptions,
38
+ ): APIPromise<
39
+ Result<
40
+ operations.V3ThreathuntingScansDiscoveryResponse,
41
+ | errors.ErrorModel
42
+ | SDKBaseError
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: SDKCore,
61
+ request: operations.V3ThreathuntingScansDiscoveryRequest,
62
+ options?: RequestOptions,
63
+ ): Promise<
64
+ [
65
+ Result<
66
+ operations.V3ThreathuntingScansDiscoveryResponse,
67
+ | errors.ErrorModel
68
+ | SDKBaseError
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.V3ThreathuntingScansDiscoveryRequest$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 = encodeJSON("body", payload.ScansDiscoveryInputBody, {
93
+ explode: true,
94
+ });
95
+
96
+ const path = pathToFunc("/v3/threat-hunting/scans/discovery")();
97
+
98
+ const query = encodeFormQuery({
99
+ "organization_id": payload.organization_id
100
+ ?? client._options.organizationId,
101
+ }, { explode: false });
102
+
103
+ const headers = new Headers(compactMap({
104
+ "Content-Type": "application/json",
105
+ Accept: "application/json",
106
+ }));
107
+
108
+ const secConfig = await extractSecurity(client._options.personalAccessToken);
109
+ const securityInput = secConfig == null
110
+ ? {}
111
+ : { personalAccessToken: secConfig };
112
+ const requestSecurity = resolveGlobalSecurity(securityInput);
113
+
114
+ const context = {
115
+ options: client._options,
116
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
117
+ operationID: "v3-threathunting-scans-discovery",
118
+ oAuth2Scopes: [],
119
+
120
+ resolvedSecurity: requestSecurity,
121
+
122
+ securitySource: client._options.personalAccessToken,
123
+ retryConfig: options?.retries
124
+ || client._options.retryConfig
125
+ || { strategy: "none" },
126
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
127
+ };
128
+
129
+ const requestRes = client._createRequest(context, {
130
+ security: requestSecurity,
131
+ method: "POST",
132
+ baseURL: options?.serverURL,
133
+ path: path,
134
+ headers: headers,
135
+ query: query,
136
+ body: body,
137
+ userAgent: client._options.userAgent,
138
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
139
+ }, options);
140
+ if (!requestRes.ok) {
141
+ return [requestRes, { status: "invalid" }];
142
+ }
143
+ const req = requestRes.value;
144
+
145
+ const doResult = await client._do(req, {
146
+ context,
147
+ errorCodes: ["401", "403", "4XX", "5XX"],
148
+ retryConfig: context.retryConfig,
149
+ retryCodes: context.retryCodes,
150
+ });
151
+ if (!doResult.ok) {
152
+ return [doResult, { status: "request-error", request: req }];
153
+ }
154
+ const response = doResult.value;
155
+
156
+ const responseFields = {
157
+ HttpMeta: { Response: response, Request: req },
158
+ };
159
+
160
+ const [result] = await M.match<
161
+ operations.V3ThreathuntingScansDiscoveryResponse,
162
+ | errors.ErrorModel
163
+ | SDKBaseError
164
+ | ResponseValidationError
165
+ | ConnectionError
166
+ | RequestAbortedError
167
+ | RequestTimeoutError
168
+ | InvalidRequestError
169
+ | UnexpectedClientError
170
+ | SDKValidationError
171
+ >(
172
+ M.json(
173
+ 200,
174
+ operations.V3ThreathuntingScansDiscoveryResponse$inboundSchema,
175
+ { hdrs: true, key: "Result" },
176
+ ),
177
+ M.jsonErr([401, 403], errors.ErrorModel$inboundSchema, {
178
+ ctype: "application/problem+json",
179
+ }),
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
@@ -65,9 +65,9 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
65
65
 
66
66
  export const SDK_METADATA = {
67
67
  language: "typescript",
68
- openapiDocVersion: "1.0.16",
69
- sdkVersion: "0.4.3",
70
- genVersion: "2.661.4",
68
+ openapiDocVersion: "1.0.24",
69
+ sdkVersion: "0.5.0",
70
+ genVersion: "2.671.2",
71
71
  userAgent:
72
- "speakeasy-sdk/typescript 0.4.3 2.661.4 1.0.16 @censys/platform-sdk",
72
+ "speakeasy-sdk/typescript 0.5.0 2.671.2 1.0.24 @censys/platform-sdk",
73
73
  } as const;
@@ -7,6 +7,12 @@ import { remap as remap$ } from "../../lib/primitives.js";
7
7
  import { safeParse } from "../../lib/schemas.js";
8
8
  import { Result as SafeParseResult } from "../../types/fp.js";
9
9
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+ import {
11
+ ElasticSearchErrorMessage,
12
+ ElasticSearchErrorMessage$inboundSchema,
13
+ ElasticSearchErrorMessage$Outbound,
14
+ ElasticSearchErrorMessage$outboundSchema,
15
+ } from "./elasticsearcherrormessage.js";
10
16
  import {
11
17
  ElasticSearchResultsNodeInfo,
12
18
  ElasticSearchResultsNodeInfo$inboundSchema,
@@ -21,6 +27,7 @@ import {
21
27
  } from "./elasticsearchsysteminfo.js";
22
28
 
23
29
  export type ElasticSearch = {
30
+ errorMessage?: ElasticSearchErrorMessage | undefined;
24
31
  resultsNodeInfo?: ElasticSearchResultsNodeInfo | undefined;
25
32
  systemInfo?: ElasticSearchSystemInfo | undefined;
26
33
  };
@@ -31,10 +38,12 @@ export const ElasticSearch$inboundSchema: z.ZodType<
31
38
  z.ZodTypeDef,
32
39
  unknown
33
40
  > = z.object({
41
+ error_message: ElasticSearchErrorMessage$inboundSchema.optional(),
34
42
  results_node_info: ElasticSearchResultsNodeInfo$inboundSchema.optional(),
35
43
  system_info: ElasticSearchSystemInfo$inboundSchema.optional(),
36
44
  }).transform((v) => {
37
45
  return remap$(v, {
46
+ "error_message": "errorMessage",
38
47
  "results_node_info": "resultsNodeInfo",
39
48
  "system_info": "systemInfo",
40
49
  });
@@ -42,6 +51,7 @@ export const ElasticSearch$inboundSchema: z.ZodType<
42
51
 
43
52
  /** @internal */
44
53
  export type ElasticSearch$Outbound = {
54
+ error_message?: ElasticSearchErrorMessage$Outbound | undefined;
45
55
  results_node_info?: ElasticSearchResultsNodeInfo$Outbound | undefined;
46
56
  system_info?: ElasticSearchSystemInfo$Outbound | undefined;
47
57
  };
@@ -52,10 +62,12 @@ export const ElasticSearch$outboundSchema: z.ZodType<
52
62
  z.ZodTypeDef,
53
63
  ElasticSearch
54
64
  > = z.object({
65
+ errorMessage: ElasticSearchErrorMessage$outboundSchema.optional(),
55
66
  resultsNodeInfo: ElasticSearchResultsNodeInfo$outboundSchema.optional(),
56
67
  systemInfo: ElasticSearchSystemInfo$outboundSchema.optional(),
57
68
  }).transform((v) => {
58
69
  return remap$(v, {
70
+ errorMessage: "error_message",
59
71
  resultsNodeInfo: "results_node_info",
60
72
  systemInfo: "system_info",
61
73
  });
@@ -0,0 +1,74 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../../types/fp.js";
8
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
9
+
10
+ export type ElasticSearchErrorMessage = {
11
+ header?: string | undefined;
12
+ reason?: string | undefined;
13
+ type?: string | undefined;
14
+ };
15
+
16
+ /** @internal */
17
+ export const ElasticSearchErrorMessage$inboundSchema: z.ZodType<
18
+ ElasticSearchErrorMessage,
19
+ z.ZodTypeDef,
20
+ unknown
21
+ > = z.object({
22
+ header: z.string().optional(),
23
+ reason: z.string().optional(),
24
+ type: z.string().optional(),
25
+ });
26
+
27
+ /** @internal */
28
+ export type ElasticSearchErrorMessage$Outbound = {
29
+ header?: string | undefined;
30
+ reason?: string | undefined;
31
+ type?: string | undefined;
32
+ };
33
+
34
+ /** @internal */
35
+ export const ElasticSearchErrorMessage$outboundSchema: z.ZodType<
36
+ ElasticSearchErrorMessage$Outbound,
37
+ z.ZodTypeDef,
38
+ ElasticSearchErrorMessage
39
+ > = z.object({
40
+ header: z.string().optional(),
41
+ reason: z.string().optional(),
42
+ type: z.string().optional(),
43
+ });
44
+
45
+ /**
46
+ * @internal
47
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
48
+ */
49
+ export namespace ElasticSearchErrorMessage$ {
50
+ /** @deprecated use `ElasticSearchErrorMessage$inboundSchema` instead. */
51
+ export const inboundSchema = ElasticSearchErrorMessage$inboundSchema;
52
+ /** @deprecated use `ElasticSearchErrorMessage$outboundSchema` instead. */
53
+ export const outboundSchema = ElasticSearchErrorMessage$outboundSchema;
54
+ /** @deprecated use `ElasticSearchErrorMessage$Outbound` instead. */
55
+ export type Outbound = ElasticSearchErrorMessage$Outbound;
56
+ }
57
+
58
+ export function elasticSearchErrorMessageToJSON(
59
+ elasticSearchErrorMessage: ElasticSearchErrorMessage,
60
+ ): string {
61
+ return JSON.stringify(
62
+ ElasticSearchErrorMessage$outboundSchema.parse(elasticSearchErrorMessage),
63
+ );
64
+ }
65
+
66
+ export function elasticSearchErrorMessageFromJSON(
67
+ jsonString: string,
68
+ ): SafeParseResult<ElasticSearchErrorMessage, SDKValidationError> {
69
+ return safeParse(
70
+ jsonString,
71
+ (x) => ElasticSearchErrorMessage$inboundSchema.parse(JSON.parse(x)),
72
+ `Failed to parse 'ElasticSearchErrorMessage' from JSON`,
73
+ );
74
+ }
@@ -0,0 +1,99 @@
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 { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+
11
+ export type HostObservationRange = {
12
+ endTime: Date;
13
+ ip: string;
14
+ port: number;
15
+ protocols: Array<string> | null;
16
+ startTime: Date;
17
+ transportProtocol: string;
18
+ };
19
+
20
+ /** @internal */
21
+ export const HostObservationRange$inboundSchema: z.ZodType<
22
+ HostObservationRange,
23
+ z.ZodTypeDef,
24
+ unknown
25
+ > = z.object({
26
+ end_time: z.string().datetime({ offset: true }).transform(v => new Date(v)),
27
+ ip: z.string(),
28
+ port: z.number().int(),
29
+ protocols: z.nullable(z.array(z.string())),
30
+ start_time: z.string().datetime({ offset: true }).transform(v => new Date(v)),
31
+ transport_protocol: z.string(),
32
+ }).transform((v) => {
33
+ return remap$(v, {
34
+ "end_time": "endTime",
35
+ "start_time": "startTime",
36
+ "transport_protocol": "transportProtocol",
37
+ });
38
+ });
39
+
40
+ /** @internal */
41
+ export type HostObservationRange$Outbound = {
42
+ end_time: string;
43
+ ip: string;
44
+ port: number;
45
+ protocols: Array<string> | null;
46
+ start_time: string;
47
+ transport_protocol: string;
48
+ };
49
+
50
+ /** @internal */
51
+ export const HostObservationRange$outboundSchema: z.ZodType<
52
+ HostObservationRange$Outbound,
53
+ z.ZodTypeDef,
54
+ HostObservationRange
55
+ > = z.object({
56
+ endTime: z.date().transform(v => v.toISOString()),
57
+ ip: z.string(),
58
+ port: z.number().int(),
59
+ protocols: z.nullable(z.array(z.string())),
60
+ startTime: z.date().transform(v => v.toISOString()),
61
+ transportProtocol: z.string(),
62
+ }).transform((v) => {
63
+ return remap$(v, {
64
+ endTime: "end_time",
65
+ startTime: "start_time",
66
+ transportProtocol: "transport_protocol",
67
+ });
68
+ });
69
+
70
+ /**
71
+ * @internal
72
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
73
+ */
74
+ export namespace HostObservationRange$ {
75
+ /** @deprecated use `HostObservationRange$inboundSchema` instead. */
76
+ export const inboundSchema = HostObservationRange$inboundSchema;
77
+ /** @deprecated use `HostObservationRange$outboundSchema` instead. */
78
+ export const outboundSchema = HostObservationRange$outboundSchema;
79
+ /** @deprecated use `HostObservationRange$Outbound` instead. */
80
+ export type Outbound = HostObservationRange$Outbound;
81
+ }
82
+
83
+ export function hostObservationRangeToJSON(
84
+ hostObservationRange: HostObservationRange,
85
+ ): string {
86
+ return JSON.stringify(
87
+ HostObservationRange$outboundSchema.parse(hostObservationRange),
88
+ );
89
+ }
90
+
91
+ export function hostObservationRangeFromJSON(
92
+ jsonString: string,
93
+ ): SafeParseResult<HostObservationRange, SDKValidationError> {
94
+ return safeParse(
95
+ jsonString,
96
+ (x) => HostObservationRange$inboundSchema.parse(JSON.parse(x)),
97
+ `Failed to parse 'HostObservationRange' from JSON`,
98
+ );
99
+ }