@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
@@ -1 +1 @@
1
- {"version":3,"file":"threathunting.d.ts","sourceRoot":"","sources":["../src/sdk/threathunting.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAG5D,qBAAa,aAAc,SAAQ,SAAS;IAC1C;;;;;OAKG;IACG,WAAW,CACf,OAAO,EAAE,UAAU,CAAC,iCAAiC,EACrD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,kCAAkC,CAAC;CAO1D"}
1
+ {"version":3,"file":"threathunting.d.ts","sourceRoot":"","sources":["../src/sdk/threathunting.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAG5D,qBAAa,aAAc,SAAQ,SAAS;IAC1C;;;;;;OAMG;IACG,cAAc,CAClB,OAAO,EAAE,UAAU,CAAC,2BAA2B,EAC/C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,4BAA4B,CAAC;IAQnD;;;;;OAKG;IACG,iBAAiB,CACrB,OAAO,EAAE,UAAU,CAAC,oCAAoC,EACxD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,qCAAqC,CAAC;IAQ5D;;;;;;OAMG;IACG,2BAA2B,CAC/B,OAAO,EAAE,UAAU,CAAC,8BAA8B,EAClD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,+BAA+B,CAAC;IAQtD;;;;;OAKG;IACG,WAAW,CACf,OAAO,EAAE,UAAU,CAAC,iCAAiC,EACrD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,kCAAkC,CAAC;CAO1D"}
@@ -4,10 +4,42 @@
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ThreatHunting = void 0;
7
+ const globalDataGetTrackedScan_js_1 = require("../funcs/globalDataGetTrackedScan.js");
8
+ const globalDataGetTrackedScanThreatHunting_js_1 = require("../funcs/globalDataGetTrackedScanThreatHunting.js");
9
+ const threatHuntingCreateTrackedScan_js_1 = require("../funcs/threatHuntingCreateTrackedScan.js");
7
10
  const threatHuntingValueCounts_js_1 = require("../funcs/threatHuntingValueCounts.js");
8
11
  const sdks_js_1 = require("../lib/sdks.js");
9
12
  const fp_js_1 = require("../types/fp.js");
10
13
  class ThreatHunting extends sdks_js_1.ClientSDK {
14
+ /**
15
+ * Get tracked scan details
16
+ *
17
+ * @remarks
18
+ * Retrieve the current status and results of a tracked scan by its ID.
19
+ * This endpoint works for both discovery scans and rescans.
20
+ */
21
+ async getTrackedScan(request, options) {
22
+ return (0, fp_js_1.unwrapAsync)((0, globalDataGetTrackedScan_js_1.globalDataGetTrackedScan)(this, request, options));
23
+ }
24
+ /**
25
+ * Create a tracked discovery scan
26
+ *
27
+ * @remarks
28
+ * 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.
29
+ */
30
+ async createTrackedScan(request, options) {
31
+ return (0, fp_js_1.unwrapAsync)((0, threatHuntingCreateTrackedScan_js_1.threatHuntingCreateTrackedScan)(this, request, options));
32
+ }
33
+ /**
34
+ * Get tracked scan details
35
+ *
36
+ * @remarks
37
+ * Retrieve the current status and results of a tracked scan by its ID.
38
+ * This endpoint works for both discovery scans and rescans.
39
+ */
40
+ async getTrackedScanThreatHunting(request, options) {
41
+ return (0, fp_js_1.unwrapAsync)((0, globalDataGetTrackedScanThreatHunting_js_1.globalDataGetTrackedScanThreatHunting)(this, request, options));
42
+ }
11
43
  /**
12
44
  * CensEye: Retrieve value counts to discover pivots
13
45
  *
@@ -1 +1 @@
1
- {"version":3,"file":"threathunting.js","sourceRoot":"","sources":["../src/sdk/threathunting.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,sFAAgF;AAChF,4CAA2D;AAE3D,0CAA6C;AAE7C,MAAa,aAAc,SAAQ,mBAAS;IAC1C;;;;;OAKG;IACH,KAAK,CAAC,WAAW,CACf,OAAqD,EACrD,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,sDAAwB,EACzC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF;AAjBD,sCAiBC"}
1
+ {"version":3,"file":"threathunting.js","sourceRoot":"","sources":["../src/sdk/threathunting.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,sFAAgF;AAChF,gHAA0G;AAC1G,kGAA4F;AAC5F,sFAAgF;AAChF,4CAA2D;AAE3D,0CAA6C;AAE7C,MAAa,aAAc,SAAQ,mBAAS;IAC1C;;;;;;OAMG;IACH,KAAK,CAAC,cAAc,CAClB,OAA+C,EAC/C,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,sDAAwB,EACzC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,iBAAiB,CACrB,OAAwD,EACxD,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,kEAA8B,EAC/C,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,2BAA2B,CAC/B,OAAkD,EAClD,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,gFAAqC,EACtD,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,WAAW,CACf,OAAqD,EACrD,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,sDAAwB,EACzC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF;AAtED,sCAsEC"}
@@ -0,0 +1,185 @@
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 rescan
30
+ *
31
+ * @remarks
32
+ * Create a new tracked rescan for a known service or web property. Rescans are used to update information for previously discovered targets. 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 all Enterprise customers.
33
+ */
34
+ export function globalDataCreateTrackedScan(
35
+ client: SDKCore,
36
+ request: operations.V3GlobaldataScansRescanRequest,
37
+ options?: RequestOptions,
38
+ ): APIPromise<
39
+ Result<
40
+ operations.V3GlobaldataScansRescanResponse,
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.V3GlobaldataScansRescanRequest,
62
+ options?: RequestOptions,
63
+ ): Promise<
64
+ [
65
+ Result<
66
+ operations.V3GlobaldataScansRescanResponse,
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.V3GlobaldataScansRescanRequest$outboundSchema.parse(value),
84
+ "Input validation failed",
85
+ );
86
+ if (!parsed.ok) {
87
+ return [parsed, { status: "invalid" }];
88
+ }
89
+ const payload = parsed.value;
90
+ const body = encodeJSON("body", payload.ScansRescanInputBody, {
91
+ explode: true,
92
+ });
93
+
94
+ const path = pathToFunc("/v3/global/scans/rescan")();
95
+
96
+ const query = encodeFormQuery({
97
+ "organization_id": payload.organization_id
98
+ ?? client._options.organizationId,
99
+ }, { explode: false });
100
+
101
+ const headers = new Headers(compactMap({
102
+ "Content-Type": "application/json",
103
+ Accept: "application/json",
104
+ }));
105
+
106
+ const secConfig = await extractSecurity(client._options.personalAccessToken);
107
+ const securityInput = secConfig == null
108
+ ? {}
109
+ : { personalAccessToken: secConfig };
110
+ const requestSecurity = resolveGlobalSecurity(securityInput);
111
+
112
+ const context = {
113
+ options: client._options,
114
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
115
+ operationID: "v3-globaldata-scans-rescan",
116
+ oAuth2Scopes: [],
117
+
118
+ resolvedSecurity: requestSecurity,
119
+
120
+ securitySource: client._options.personalAccessToken,
121
+ retryConfig: options?.retries
122
+ || client._options.retryConfig
123
+ || { strategy: "none" },
124
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
125
+ };
126
+
127
+ const requestRes = client._createRequest(context, {
128
+ security: requestSecurity,
129
+ method: "POST",
130
+ baseURL: options?.serverURL,
131
+ path: path,
132
+ headers: headers,
133
+ query: query,
134
+ body: body,
135
+ userAgent: client._options.userAgent,
136
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
137
+ }, options);
138
+ if (!requestRes.ok) {
139
+ return [requestRes, { status: "invalid" }];
140
+ }
141
+ const req = requestRes.value;
142
+
143
+ const doResult = await client._do(req, {
144
+ context,
145
+ errorCodes: ["401", "403", "4XX", "5XX"],
146
+ retryConfig: context.retryConfig,
147
+ retryCodes: context.retryCodes,
148
+ });
149
+ if (!doResult.ok) {
150
+ return [doResult, { status: "request-error", request: req }];
151
+ }
152
+ const response = doResult.value;
153
+
154
+ const responseFields = {
155
+ HttpMeta: { Response: response, Request: req },
156
+ };
157
+
158
+ const [result] = await M.match<
159
+ operations.V3GlobaldataScansRescanResponse,
160
+ | errors.ErrorModel
161
+ | SDKBaseError
162
+ | ResponseValidationError
163
+ | ConnectionError
164
+ | RequestAbortedError
165
+ | RequestTimeoutError
166
+ | InvalidRequestError
167
+ | UnexpectedClientError
168
+ | SDKValidationError
169
+ >(
170
+ M.json(200, operations.V3GlobaldataScansRescanResponse$inboundSchema, {
171
+ hdrs: true,
172
+ key: "Result",
173
+ }),
174
+ M.jsonErr([401, 403], errors.ErrorModel$inboundSchema, {
175
+ ctype: "application/problem+json",
176
+ }),
177
+ M.fail("4XX"),
178
+ M.fail("5XX"),
179
+ )(response, req, { extraFields: responseFields });
180
+ if (!result.ok) {
181
+ return [result, { status: "complete", request: req, response }];
182
+ }
183
+
184
+ return [result, { status: "complete", request: req, response }];
185
+ }
@@ -0,0 +1,201 @@
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 Host Observations With Certificate
30
+ *
31
+ * @remarks
32
+ * Retrieve historical observations of hosts associated with a certificate fingerprint. Useful for threat hunting, detection engineering, and timeline generation.
33
+ */
34
+ export function globalDataGetHostObservationsWithCertificate(
35
+ client: SDKCore,
36
+ request: operations.V3GlobaldataGetHostObservationsWithCertificateRequest,
37
+ options?: RequestOptions,
38
+ ): APIPromise<
39
+ Result<
40
+ operations.V3GlobaldataGetHostObservationsWithCertificateResponse,
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.V3GlobaldataGetHostObservationsWithCertificateRequest,
62
+ options?: RequestOptions,
63
+ ): Promise<
64
+ [
65
+ Result<
66
+ operations.V3GlobaldataGetHostObservationsWithCertificateResponse,
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
84
+ .V3GlobaldataGetHostObservationsWithCertificateRequest$outboundSchema
85
+ .parse(value),
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
+ certificate_id: encodeSimple("certificate_id", payload.certificate_id, {
96
+ explode: false,
97
+ charEncoding: "percent",
98
+ }),
99
+ };
100
+
101
+ const path = pathToFunc(
102
+ "/v3/global/asset/certificate/{certificate_id}/observations/hosts",
103
+ )(pathParams);
104
+
105
+ const query = encodeFormQuery({
106
+ "end_time": payload.end_time,
107
+ "organization_id": payload.organization_id
108
+ ?? client._options.organizationId,
109
+ "page_size": payload.page_size,
110
+ "page_token": payload.page_token,
111
+ "port": payload.port,
112
+ "protocol": payload.protocol,
113
+ "start_time": payload.start_time,
114
+ }, { explode: false });
115
+
116
+ const headers = new Headers(compactMap({
117
+ Accept: "application/json",
118
+ }));
119
+
120
+ const secConfig = await extractSecurity(client._options.personalAccessToken);
121
+ const securityInput = secConfig == null
122
+ ? {}
123
+ : { personalAccessToken: secConfig };
124
+ const requestSecurity = resolveGlobalSecurity(securityInput);
125
+
126
+ const context = {
127
+ options: client._options,
128
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
129
+ operationID: "v3-globaldata-get-host-observations-with-certificate",
130
+ oAuth2Scopes: [],
131
+
132
+ resolvedSecurity: requestSecurity,
133
+
134
+ securitySource: client._options.personalAccessToken,
135
+ retryConfig: options?.retries
136
+ || client._options.retryConfig
137
+ || { strategy: "none" },
138
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
139
+ };
140
+
141
+ const requestRes = client._createRequest(context, {
142
+ security: requestSecurity,
143
+ method: "GET",
144
+ baseURL: options?.serverURL,
145
+ path: path,
146
+ headers: headers,
147
+ query: query,
148
+ body: body,
149
+ userAgent: client._options.userAgent,
150
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
151
+ }, options);
152
+ if (!requestRes.ok) {
153
+ return [requestRes, { status: "invalid" }];
154
+ }
155
+ const req = requestRes.value;
156
+
157
+ const doResult = await client._do(req, {
158
+ context,
159
+ errorCodes: ["401", "403", "4XX", "5XX"],
160
+ retryConfig: context.retryConfig,
161
+ retryCodes: context.retryCodes,
162
+ });
163
+ if (!doResult.ok) {
164
+ return [doResult, { status: "request-error", request: req }];
165
+ }
166
+ const response = doResult.value;
167
+
168
+ const responseFields = {
169
+ HttpMeta: { Response: response, Request: req },
170
+ };
171
+
172
+ const [result] = await M.match<
173
+ operations.V3GlobaldataGetHostObservationsWithCertificateResponse,
174
+ | errors.ErrorModel
175
+ | SDKBaseError
176
+ | ResponseValidationError
177
+ | ConnectionError
178
+ | RequestAbortedError
179
+ | RequestTimeoutError
180
+ | InvalidRequestError
181
+ | UnexpectedClientError
182
+ | SDKValidationError
183
+ >(
184
+ M.json(
185
+ 200,
186
+ operations
187
+ .V3GlobaldataGetHostObservationsWithCertificateResponse$inboundSchema,
188
+ { hdrs: true, key: "Result" },
189
+ ),
190
+ M.jsonErr([401, 403], errors.ErrorModel$inboundSchema, {
191
+ ctype: "application/problem+json",
192
+ }),
193
+ M.fail("4XX"),
194
+ M.fail("5XX"),
195
+ )(response, req, { extraFields: responseFields });
196
+ if (!result.ok) {
197
+ return [result, { status: "complete", request: req, response }];
198
+ }
199
+
200
+ return [result, { status: "complete", request: req, response }];
201
+ }
@@ -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 globalDataGetTrackedScan(
36
+ client: SDKCore,
37
+ request: operations.V3GlobaldataScansGetRequest,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ operations.V3GlobaldataScansGetResponse,
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.V3GlobaldataScansGetRequest,
63
+ options?: RequestOptions,
64
+ ): Promise<
65
+ [
66
+ Result<
67
+ operations.V3GlobaldataScansGetResponse,
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.V3GlobaldataScansGetRequest$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/global/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-globaldata-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.V3GlobaldataScansGetResponse,
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.V3GlobaldataScansGetResponse$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
+ }