@ngrok/ngrok-api 0.1.0 → 0.7.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 (283) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +102 -31
  3. package/docs/CNAME +1 -0
  4. package/docs/assets/js/search.js +1 -1
  5. package/docs/classes/client.Ngrok.html +772 -0
  6. package/docs/classes/services.APIKeys.html +354 -0
  7. package/docs/classes/services.AbuseReports.html +261 -0
  8. package/docs/classes/services.AgentIngresses.html +343 -0
  9. package/docs/classes/services.CertificateAuthorities.html +354 -0
  10. package/docs/classes/services.Credentials.html +353 -0
  11. package/docs/classes/services.EdgeRouteBackendModule.html +270 -0
  12. package/docs/classes/services.EdgeRouteCircuitBreakerModule.html +270 -0
  13. package/docs/classes/services.EdgeRouteCompressionModule.html +270 -0
  14. package/docs/classes/services.EdgeRouteIPRestrictionModule.html +270 -0
  15. package/docs/classes/services.EdgeRouteOAuthModule.html +270 -0
  16. package/docs/classes/services.EdgeRouteOIDCModule.html +270 -0
  17. package/docs/classes/services.EdgeRouteRequestHeadersModule.html +270 -0
  18. package/docs/classes/services.EdgeRouteResponseHeadersModule.html +270 -0
  19. package/docs/classes/services.EdgeRouteSAMLModule.html +270 -0
  20. package/docs/classes/services.EdgeRouteWebhookVerificationModule.html +270 -0
  21. package/docs/classes/services.EdgeRouteWebsocketTCPConverterModule.html +270 -0
  22. package/docs/classes/services.EdgesHTTPS.html +343 -0
  23. package/docs/classes/services.EdgesHTTPSRoutes.html +317 -0
  24. package/docs/classes/services.EdgesTCP.html +343 -0
  25. package/docs/classes/services.EdgesTLS.html +343 -0
  26. package/docs/classes/services.Endpoints.html +256 -0
  27. package/docs/classes/services.EventDestinations.html +343 -0
  28. package/docs/classes/services.EventSources.html +349 -0
  29. package/docs/classes/services.EventSubscriptions.html +343 -0
  30. package/docs/classes/services.FailoverBackends.html +353 -0
  31. package/docs/classes/services.HTTPResponseBackends.html +318 -0
  32. package/docs/classes/services.HTTPSEdgeMutualTLSModule.html +270 -0
  33. package/docs/classes/services.HTTPSEdgeTLSTerminationModule.html +270 -0
  34. package/docs/classes/services.IPPolicies.html +353 -0
  35. package/docs/classes/services.IPPolicyRules.html +351 -0
  36. package/docs/classes/services.IPRestrictions.html +355 -0
  37. package/docs/classes/services.ReservedAddrs.html +352 -0
  38. package/docs/classes/services.ReservedDomains.html +417 -0
  39. package/docs/classes/services.SSHCertificateAuthorities.html +351 -0
  40. package/docs/classes/services.SSHCredentials.html +351 -0
  41. package/docs/classes/services.SSHHostCertificates.html +352 -0
  42. package/docs/classes/services.SSHUserCertificates.html +352 -0
  43. package/docs/classes/services.TCPEdgeBackendModule.html +270 -0
  44. package/docs/classes/services.TCPEdgeIPRestrictionModule.html +270 -0
  45. package/docs/classes/services.TLSCertificates.html +354 -0
  46. package/docs/classes/services.TLSEdgeBackendModule.html +270 -0
  47. package/docs/classes/services.TLSEdgeIPRestrictionModule.html +270 -0
  48. package/docs/classes/services.TLSEdgeMutualTLSModule.html +270 -0
  49. package/docs/classes/services.TLSEdgeTLSTerminationModule.html +270 -0
  50. package/docs/classes/services.TunnelGroupBackends.html +351 -0
  51. package/docs/classes/services.TunnelSessions.html +352 -0
  52. package/docs/classes/services.Tunnels.html +255 -0
  53. package/docs/classes/services.WeightedBackends.html +353 -0
  54. package/docs/index.html +103 -546
  55. package/docs/interfaces/client.NgrokConfig.html +179 -0
  56. package/docs/interfaces/{apikey.html → datatypes.APIKey.html} +41 -29
  57. package/docs/interfaces/{apikeycreate.html → datatypes.APIKeyCreate.html} +25 -13
  58. package/docs/interfaces/{apikeylist.html → datatypes.APIKeyList.html} +32 -20
  59. package/docs/interfaces/{apikeyupdate.html → datatypes.APIKeyUpdate.html} +28 -16
  60. package/docs/interfaces/{awsauth.html → datatypes.AWSAuth.html} +27 -15
  61. package/docs/interfaces/{awscredentials.html → datatypes.AWSCredentials.html} +31 -19
  62. package/docs/interfaces/{awsrole.html → datatypes.AWSRole.html} +25 -13
  63. package/docs/interfaces/{abusereport.html → datatypes.AbuseReport.html} +45 -33
  64. package/docs/interfaces/{abusereportcreate.html → datatypes.AbuseReportCreate.html} +25 -13
  65. package/docs/interfaces/{abusereporthostname.html → datatypes.AbuseReportHostname.html} +26 -14
  66. package/docs/interfaces/datatypes.AgentIngress.html +300 -0
  67. package/docs/interfaces/{ipwhitelistentrycreate.html → datatypes.AgentIngressCreate.html} +37 -25
  68. package/docs/interfaces/datatypes.AgentIngressList.html +205 -0
  69. package/docs/interfaces/{ipwhitelistentryupdate.html → datatypes.AgentIngressUpdate.html} +33 -21
  70. package/docs/interfaces/{certificateauthority.html → datatypes.CertificateAuthority.html} +73 -61
  71. package/docs/interfaces/{certificateauthoritycreate.html → datatypes.CertificateAuthorityCreate.html} +31 -19
  72. package/docs/interfaces/{certificateauthoritylist.html → datatypes.CertificateAuthorityList.html} +34 -22
  73. package/docs/interfaces/{certificateauthorityupdate.html → datatypes.CertificateAuthorityUpdate.html} +28 -16
  74. package/docs/interfaces/{credential.html → datatypes.Credential.html} +45 -33
  75. package/docs/interfaces/{credentialcreate.html → datatypes.CredentialCreate.html} +29 -17
  76. package/docs/interfaces/{credentiallist.html → datatypes.CredentialList.html} +32 -20
  77. package/docs/interfaces/{credentialupdate.html → datatypes.CredentialUpdate.html} +32 -20
  78. package/docs/interfaces/{endpointippolicyreplace.html → datatypes.EdgeBackendReplace.html} +29 -17
  79. package/docs/interfaces/{endpointbackendreplace.html → datatypes.EdgeIPRestrictionReplace.html} +29 -17
  80. package/docs/interfaces/{endpointresponseheadersreplace.html → datatypes.EdgeMutualTLSReplace.html} +29 -17
  81. package/docs/interfaces/datatypes.EdgeRouteBackendReplace.html +190 -0
  82. package/docs/interfaces/datatypes.EdgeRouteCircuitBreakerReplace.html +190 -0
  83. package/docs/interfaces/datatypes.EdgeRouteCompressionReplace.html +190 -0
  84. package/docs/interfaces/datatypes.EdgeRouteIPRestrictionReplace.html +190 -0
  85. package/docs/interfaces/{reserveddomaincertnstarget.html → datatypes.EdgeRouteItem.html} +36 -24
  86. package/docs/interfaces/datatypes.EdgeRouteOAuthReplace.html +190 -0
  87. package/docs/interfaces/datatypes.EdgeRouteOIDCReplace.html +190 -0
  88. package/docs/interfaces/datatypes.EdgeRouteRequestHeadersReplace.html +190 -0
  89. package/docs/interfaces/datatypes.EdgeRouteResponseHeadersReplace.html +190 -0
  90. package/docs/interfaces/datatypes.EdgeRouteSAMLReplace.html +190 -0
  91. package/docs/interfaces/datatypes.EdgeRouteWebhookVerificationReplace.html +190 -0
  92. package/docs/interfaces/datatypes.EdgeRouteWebsocketTCPConverterReplace.html +190 -0
  93. package/docs/interfaces/{endpointoauthreplace.html → datatypes.EdgeTLSTerminationAtEdgeReplace.html} +29 -17
  94. package/docs/interfaces/{endpointbasicauthreplace.html → datatypes.EdgeTLSTerminationReplace.html} +29 -17
  95. package/docs/interfaces/{empty.html → datatypes.Empty.html} +18 -7
  96. package/docs/interfaces/datatypes.Endpoint.html +395 -0
  97. package/docs/interfaces/{endpointbackend.html → datatypes.EndpointBackend.html} +27 -15
  98. package/docs/interfaces/{endpointlogging.html → datatypes.EndpointBackendMutate.html} +36 -24
  99. package/docs/interfaces/{endpointcircuitbreaker.html → datatypes.EndpointCircuitBreaker.html} +53 -41
  100. package/docs/interfaces/{endpointcompression.html → datatypes.EndpointCompression.html} +23 -11
  101. package/docs/interfaces/{endpointippolicy.html → datatypes.EndpointIPPolicy.html} +29 -17
  102. package/docs/interfaces/{endpointippolicymutate.html → datatypes.EndpointIPPolicyMutate.html} +29 -17
  103. package/docs/interfaces/datatypes.EndpointList.html +205 -0
  104. package/docs/interfaces/{endpointmutualtls.html → datatypes.EndpointMutualTLS.html} +29 -17
  105. package/docs/interfaces/{endpointmutualtlsmutate.html → datatypes.EndpointMutualTLSMutate.html} +29 -17
  106. package/docs/interfaces/{endpointoauth.html → datatypes.EndpointOAuth.html} +57 -45
  107. package/docs/interfaces/{endpointoauthfacebook.html → datatypes.EndpointOAuthFacebook.html} +48 -36
  108. package/docs/interfaces/{endpointoauthgithub.html → datatypes.EndpointOAuthGitHub.html} +55 -43
  109. package/docs/interfaces/{endpointoauthgoogle.html → datatypes.EndpointOAuthGoogle.html} +48 -36
  110. package/docs/interfaces/{endpointoauthmicrosoft.html → datatypes.EndpointOAuthMicrosoft.html} +48 -36
  111. package/docs/interfaces/{endpointoauthprovider.html → datatypes.EndpointOAuthProvider.html} +35 -23
  112. package/docs/interfaces/{endpointoidc.html → datatypes.EndpointOIDC.html} +65 -53
  113. package/docs/interfaces/{endpointrequestheaders.html → datatypes.EndpointRequestHeaders.html} +29 -17
  114. package/docs/interfaces/{endpointresponseheaders.html → datatypes.EndpointResponseHeaders.html} +29 -17
  115. package/docs/interfaces/{endpointsaml.html → datatypes.EndpointSAML.html} +121 -90
  116. package/docs/interfaces/{endpointsamlmutate.html → datatypes.EndpointSAMLMutate.html} +91 -60
  117. package/docs/interfaces/{endpointtlstermination.html → datatypes.EndpointTLSTermination.html} +37 -25
  118. package/docs/interfaces/{endpointloggingmutate.html → datatypes.EndpointTLSTerminationAtEdge.html} +33 -21
  119. package/docs/interfaces/{endpointwebhookvalidation.html → datatypes.EndpointWebhookValidation.html} +30 -18
  120. package/docs/interfaces/{staticbackendtls.html → datatypes.EndpointWebsocketTCPConverter.html} +27 -15
  121. package/docs/interfaces/{error.html → datatypes.Error.html} +37 -25
  122. package/docs/interfaces/{eventdestination.html → datatypes.EventDestination.html} +46 -34
  123. package/docs/interfaces/{eventdestinationcreate.html → datatypes.EventDestinationCreate.html} +34 -22
  124. package/docs/interfaces/{eventdestinationlist.html → datatypes.EventDestinationList.html} +34 -22
  125. package/docs/interfaces/{eventdestinationupdate.html → datatypes.EventDestinationUpdate.html} +37 -25
  126. package/docs/interfaces/{eventsource.html → datatypes.EventSource.html} +25 -13
  127. package/docs/interfaces/{eventsourcecreate.html → datatypes.EventSourceCreate.html} +28 -16
  128. package/docs/interfaces/{eventsourceitem.html → datatypes.EventSourceItem.html} +28 -16
  129. package/docs/interfaces/{eventsourcelist.html → datatypes.EventSourceList.html} +26 -14
  130. package/docs/interfaces/{eventsourcepaging.html → datatypes.EventSourcePaging.html} +25 -13
  131. package/docs/interfaces/{eventsourcereplace.html → datatypes.EventSourceReplace.html} +22 -10
  132. package/docs/interfaces/{eventsourceupdate.html → datatypes.EventSourceUpdate.html} +28 -16
  133. package/docs/interfaces/{eventsubscription.html → datatypes.EventSubscription.html} +45 -33
  134. package/docs/interfaces/{eventsubscriptioncreate.html → datatypes.EventSubscriptionCreate.html} +36 -24
  135. package/docs/interfaces/{eventsubscriptionlist.html → datatypes.EventSubscriptionList.html} +34 -22
  136. package/docs/interfaces/{eventsubscriptionupdate.html → datatypes.EventSubscriptionUpdate.html} +39 -27
  137. package/docs/interfaces/{eventtarget.html → datatypes.EventTarget.html} +33 -21
  138. package/docs/interfaces/{eventtargetcloudwatchlogs.html → datatypes.EventTargetCloudwatchLogs.html} +30 -18
  139. package/docs/interfaces/{eventtargetfirehose.html → datatypes.EventTargetFirehose.html} +30 -18
  140. package/docs/interfaces/{eventtargetkinesis.html → datatypes.EventTargetKinesis.html} +30 -18
  141. package/docs/interfaces/{staticbackend.html → datatypes.FailoverBackend.html} +52 -40
  142. package/docs/interfaces/{prioritybackendcreate.html → datatypes.FailoverBackendCreate.html} +31 -19
  143. package/docs/interfaces/{prioritybackendlist.html → datatypes.FailoverBackendList.html} +37 -25
  144. package/docs/interfaces/{prioritybackendupdate.html → datatypes.FailoverBackendUpdate.html} +34 -22
  145. package/docs/interfaces/datatypes.HTTPResponseBackend.html +295 -0
  146. package/docs/interfaces/{tunnelgroupbackend.html → datatypes.HTTPResponseBackendCreate.html} +53 -41
  147. package/docs/interfaces/{staticbackendlist.html → datatypes.HTTPResponseBackendList.html} +35 -38
  148. package/docs/interfaces/{tcpedge.html → datatypes.HTTPResponseBackendUpdate.html} +58 -65
  149. package/docs/interfaces/{eventstream.html → datatypes.HTTPSEdge.html} +78 -71
  150. package/docs/interfaces/{staticbackendupdate.html → datatypes.HTTPSEdgeCreate.html} +60 -48
  151. package/docs/interfaces/datatypes.HTTPSEdgeList.html +205 -0
  152. package/docs/interfaces/datatypes.HTTPSEdgeRoute.html +509 -0
  153. package/docs/interfaces/{endpointconfigurationcreate.html → datatypes.HTTPSEdgeRouteCreate.html} +141 -110
  154. package/docs/interfaces/{endpointconfiguration.html → datatypes.HTTPSEdgeRouteUpdate.html} +138 -145
  155. package/docs/interfaces/{tlsedgeupdate.html → datatypes.HTTPSEdgeUpdate.html} +65 -43
  156. package/docs/interfaces/{ippolicy.html → datatypes.IPPolicy.html} +37 -44
  157. package/docs/interfaces/{ippolicycreate.html → datatypes.IPPolicyCreate.html} +25 -32
  158. package/docs/interfaces/{ippolicylist.html → datatypes.IPPolicyList.html} +34 -22
  159. package/docs/interfaces/{ippolicyrule.html → datatypes.IPPolicyRule.html} +65 -34
  160. package/docs/interfaces/{ippolicyrulecreate.html → datatypes.IPPolicyRuleCreate.html} +53 -22
  161. package/docs/interfaces/{ippolicyrulelist.html → datatypes.IPPolicyRuleList.html} +34 -22
  162. package/docs/interfaces/{ippolicyruleupdate.html → datatypes.IPPolicyRuleUpdate.html} +31 -19
  163. package/docs/interfaces/{ippolicyupdate.html → datatypes.IPPolicyUpdate.html} +28 -16
  164. package/docs/interfaces/{iprestriction.html → datatypes.IPRestriction.html} +50 -38
  165. package/docs/interfaces/{iprestrictioncreate.html → datatypes.IPRestrictionCreate.html} +38 -26
  166. package/docs/interfaces/{iprestrictionlist.html → datatypes.IPRestrictionList.html} +34 -22
  167. package/docs/interfaces/{iprestrictionupdate.html → datatypes.IPRestrictionUpdate.html} +37 -25
  168. package/docs/interfaces/{item.html → datatypes.Item.html} +22 -10
  169. package/docs/interfaces/{paging.html → datatypes.Paging.html} +28 -16
  170. package/docs/interfaces/{ref.html → datatypes.Ref.html} +25 -13
  171. package/docs/interfaces/{reservedaddr.html → datatypes.ReservedAddr.html} +43 -50
  172. package/docs/interfaces/{reservedaddrcreate.html → datatypes.ReservedAddrCreate.html} +28 -35
  173. package/docs/interfaces/{reservedaddrlist.html → datatypes.ReservedAddrList.html} +34 -22
  174. package/docs/interfaces/datatypes.ReservedAddrUpdate.html +200 -0
  175. package/docs/interfaces/{reserveddomain.html → datatypes.ReservedDomain.html} +82 -89
  176. package/docs/interfaces/{reserveddomaincertjob.html → datatypes.ReservedDomainCertJob.html} +40 -47
  177. package/docs/interfaces/{reserveddomaincertpolicy.html → datatypes.ReservedDomainCertPolicy.html} +28 -16
  178. package/docs/interfaces/{reserveddomaincertstatus.html → datatypes.ReservedDomainCertStatus.html} +31 -19
  179. package/docs/interfaces/{reserveddomaincreate.html → datatypes.ReservedDomainCreate.html} +45 -71
  180. package/docs/interfaces/{reserveddomainlist.html → datatypes.ReservedDomainList.html} +34 -22
  181. package/docs/interfaces/datatypes.ReservedDomainUpdate.html +238 -0
  182. package/docs/interfaces/{sshcertificateauthority.html → datatypes.SSHCertificateAuthority.html} +49 -37
  183. package/docs/interfaces/{sshcertificateauthoritycreate.html → datatypes.SSHCertificateAuthorityCreate.html} +45 -33
  184. package/docs/interfaces/{sshcertificateauthoritylist.html → datatypes.SSHCertificateAuthorityList.html} +34 -22
  185. package/docs/interfaces/{sshcertificateauthorityupdate.html → datatypes.SSHCertificateAuthorityUpdate.html} +28 -16
  186. package/docs/interfaces/{sshcredential.html → datatypes.SSHCredential.html} +47 -35
  187. package/docs/interfaces/{sshcredentialcreate.html → datatypes.SSHCredentialCreate.html} +35 -23
  188. package/docs/interfaces/{sshcredentiallist.html → datatypes.SSHCredentialList.html} +34 -22
  189. package/docs/interfaces/{sshcredentialupdate.html → datatypes.SSHCredentialUpdate.html} +32 -20
  190. package/docs/interfaces/{sshhostcertificate.html → datatypes.SSHHostCertificate.html} +76 -64
  191. package/docs/interfaces/{sshhostcertificatecreate.html → datatypes.SSHHostCertificateCreate.html} +53 -41
  192. package/docs/interfaces/{sshhostcertificatelist.html → datatypes.SSHHostCertificateList.html} +34 -22
  193. package/docs/interfaces/{sshhostcertificateupdate.html → datatypes.SSHHostCertificateUpdate.html} +28 -16
  194. package/docs/interfaces/{sshusercertificate.html → datatypes.SSHUserCertificate.html} +87 -75
  195. package/docs/interfaces/{sshusercertificatecreate.html → datatypes.SSHUserCertificateCreate.html} +64 -52
  196. package/docs/interfaces/{sshusercertificatelist.html → datatypes.SSHUserCertificateList.html} +34 -22
  197. package/docs/interfaces/{sshusercertificateupdate.html → datatypes.SSHUserCertificateUpdate.html} +28 -16
  198. package/docs/interfaces/{tlsedge.html → datatypes.TCPEdge.html} +69 -66
  199. package/docs/interfaces/{tlsedgecreate.html → datatypes.TCPEdgeCreate.html} +64 -42
  200. package/docs/interfaces/{endpointconfigurationlist.html → datatypes.TCPEdgeList.html} +40 -28
  201. package/docs/interfaces/{eventstreamupdate.html → datatypes.TCPEdgeUpdate.html} +60 -53
  202. package/docs/interfaces/{tlscertificate.html → datatypes.TLSCertificate.html} +134 -122
  203. package/docs/interfaces/{tlscertificatecreate.html → datatypes.TLSCertificateCreate.html} +39 -27
  204. package/docs/interfaces/{tlscertificatelist.html → datatypes.TLSCertificateList.html} +34 -22
  205. package/docs/interfaces/{tlscertificatesans.html → datatypes.TLSCertificateSANs.html} +28 -16
  206. package/docs/interfaces/{tlscertificateupdate.html → datatypes.TLSCertificateUpdate.html} +28 -16
  207. package/docs/interfaces/datatypes.TLSEdge.html +323 -0
  208. package/docs/interfaces/datatypes.TLSEdgeCreate.html +266 -0
  209. package/docs/interfaces/datatypes.TLSEdgeList.html +205 -0
  210. package/docs/interfaces/{reserveddomainupdate.html → datatypes.TLSEdgeUpdate.html} +83 -62
  211. package/docs/interfaces/datatypes.Tunnel.html +357 -0
  212. package/docs/interfaces/datatypes.TunnelGroupBackend.html +281 -0
  213. package/docs/interfaces/{tunnelgroupbackendcreate.html → datatypes.TunnelGroupBackendCreate.html} +28 -16
  214. package/docs/interfaces/{tunnelgroupbackendlist.html → datatypes.TunnelGroupBackendList.html} +32 -20
  215. package/docs/interfaces/{tunnelgroupbackendupdate.html → datatypes.TunnelGroupBackendUpdate.html} +31 -19
  216. package/docs/interfaces/{tunnellist.html → datatypes.TunnelList.html} +32 -20
  217. package/docs/interfaces/{tunnelsession.html → datatypes.TunnelSession.html} +57 -45
  218. package/docs/interfaces/{tunnelsessionlist.html → datatypes.TunnelSessionList.html} +34 -22
  219. package/docs/interfaces/{tunnelsessionsupdate.html → datatypes.TunnelSessionsUpdate.html} +22 -10
  220. package/docs/interfaces/{weightedbackend.html → datatypes.WeightedBackend.html} +56 -25
  221. package/docs/interfaces/{weightedbackendcreate.html → datatypes.WeightedBackendCreate.html} +28 -16
  222. package/docs/interfaces/{weightedbackendlist.html → datatypes.WeightedBackendList.html} +32 -20
  223. package/docs/interfaces/{weightedbackendupdate.html → datatypes.WeightedBackendUpdate.html} +31 -19
  224. package/docs/{interfaces/endpointbasicauth.html → modules/client.html} +38 -20
  225. package/docs/modules/datatypes.html +796 -0
  226. package/docs/modules/services.html +316 -0
  227. package/docs/modules.html +16 -690
  228. package/lib/client.d.ts +179 -0
  229. package/lib/client.d.ts.map +1 -0
  230. package/lib/client.js +126 -0
  231. package/lib/client.js.map +1 -0
  232. package/lib/{types.d.ts → datatypes.d.ts} +729 -660
  233. package/lib/datatypes.d.ts.map +1 -0
  234. package/lib/{types.js → datatypes.js} +1 -1
  235. package/lib/datatypes.js.map +1 -0
  236. package/lib/index.d.ts +2 -378
  237. package/lib/index.d.ts.map +1 -1
  238. package/lib/index.js +2 -2148
  239. package/lib/index.js.map +1 -1
  240. package/lib/services.d.ts +993 -0
  241. package/lib/services.d.ts.map +1 -0
  242. package/lib/services.js +3600 -0
  243. package/lib/services.js.map +1 -0
  244. package/lib/util.d.ts +5 -0
  245. package/lib/util.d.ts.map +1 -0
  246. package/lib/util.js +53 -0
  247. package/lib/util.js.map +1 -0
  248. package/package.json +2 -2
  249. package/src/client.ts +322 -0
  250. package/src/{types.ts → datatypes.ts} +760 -689
  251. package/src/index.ts +2 -1775
  252. package/src/services.ts +3380 -0
  253. package/src/util.ts +48 -0
  254. package/test/apikey.test.js +41 -30
  255. package/docs/classes/ngrok.html +0 -5028
  256. package/docs/interfaces/endpointbackendmutate.html +0 -119
  257. package/docs/interfaces/endpointcircuitbreakerreplace.html +0 -164
  258. package/docs/interfaces/endpointcompressionreplace.html +0 -164
  259. package/docs/interfaces/endpointconfigurationupdate.html +0 -421
  260. package/docs/interfaces/endpointloggingreplace.html +0 -164
  261. package/docs/interfaces/endpointmutualtlsreplace.html +0 -164
  262. package/docs/interfaces/endpointoidcreplace.html +0 -164
  263. package/docs/interfaces/endpointrequestheadersreplace.html +0 -164
  264. package/docs/interfaces/endpointsamlreplace.html +0 -164
  265. package/docs/interfaces/endpointtlsterminationreplace.html +0 -164
  266. package/docs/interfaces/endpointwebhookvalidationreplace.html +0 -164
  267. package/docs/interfaces/eventstreamcreate.html +0 -250
  268. package/docs/interfaces/eventstreamlist.html +0 -193
  269. package/docs/interfaces/eventtargetdebug.html +0 -119
  270. package/docs/interfaces/eventtargets3.html +0 -250
  271. package/docs/interfaces/ipwhitelistentry.html +0 -250
  272. package/docs/interfaces/ipwhitelistentrylist.html +0 -193
  273. package/docs/interfaces/prioritybackend.html +0 -231
  274. package/docs/interfaces/reservedaddrupdate.html +0 -207
  275. package/docs/interfaces/rootresponse.html +0 -164
  276. package/docs/interfaces/sentevent.html +0 -150
  277. package/docs/interfaces/staticbackendcreate.html +0 -212
  278. package/docs/interfaces/tcpedgecreate.html +0 -188
  279. package/docs/interfaces/tcpedgeupdate.html +0 -207
  280. package/docs/interfaces/tunnel.html +0 -269
  281. package/lib/types.d.ts.map +0 -1
  282. package/lib/types.js.map +0 -1
  283. package/test/endpointConfigurations.test.js +0 -63
@@ -0,0 +1,3380 @@
1
+ import { Wretcher } from 'wretch';
2
+
3
+ import * as datatypes from './datatypes';
4
+ import * as util from './util';
5
+
6
+ /**
7
+ * Abuse Reports allow you to submit take-down requests for URLs hosted by
8
+ ngrok that violate ngrok's terms of service.
9
+ */
10
+ export class AbuseReports {
11
+ private httpClient: Wretcher;
12
+
13
+ /** Do not construct this object directly, use the <code>abuseReports</code> property of an <code>Ngrok</code> client object instead. */
14
+ public constructor(httpClient: Wretcher) {
15
+ this.httpClient = httpClient;
16
+ }
17
+ /**
18
+ * Creates a new abuse report which will be reviewed by our system and abuse response team. This API is only available to authorized accounts. Contact abuse@ngrok.com to request access
19
+ */
20
+ public create(
21
+ arg: datatypes.AbuseReportCreate
22
+ ): Promise<datatypes.AbuseReport> {
23
+ return this.httpClient
24
+ .url(`/abuse_reports`)
25
+ .post(util.serializeArgument(arg))
26
+ .json(payload => util.deserializeResult(payload))
27
+ .then(f => f, util.onRejected);
28
+ }
29
+
30
+ /**
31
+ * Get the detailed status of abuse report by ID.
32
+ */
33
+ public get(arg: datatypes.Item): Promise<datatypes.AbuseReport> {
34
+ return this.httpClient
35
+ .url(`/abuse_reports/${arg.id}`)
36
+ .get()
37
+ .json(payload => util.deserializeResult(payload))
38
+ .then(f => f, util.onRejected);
39
+ }
40
+ }
41
+
42
+ export class AgentIngresses {
43
+ private httpClient: Wretcher;
44
+
45
+ /** Do not construct this object directly, use the <code>agentIngresses</code> property of an <code>Ngrok</code> client object instead. */
46
+ public constructor(httpClient: Wretcher) {
47
+ this.httpClient = httpClient;
48
+ }
49
+ /**
50
+ * Create a new Agent Ingress. The ngrok agent can be configured to connect to ngrok via the new set of addresses on the returned Agent Ingress.
51
+ */
52
+ public create(
53
+ arg: datatypes.AgentIngressCreate
54
+ ): Promise<datatypes.AgentIngress> {
55
+ return this.httpClient
56
+ .url(`/agent_ingresses`)
57
+ .post(util.serializeArgument(arg))
58
+ .json(payload => util.deserializeResult(payload))
59
+ .then(f => f, util.onRejected);
60
+ }
61
+
62
+ /**
63
+ * Delete an Agent Ingress by ID
64
+ */
65
+ public delete(arg: datatypes.Item): Promise<void> {
66
+ return this.httpClient
67
+ .url(`/agent_ingresses/${arg.id}`)
68
+ .delete()
69
+ .json(payload => util.deserializeResult(payload))
70
+ .then(f => f, util.onRejected);
71
+ }
72
+
73
+ /**
74
+ * Get the details of an Agent Ingress by ID.
75
+ */
76
+ public get(arg: datatypes.Item): Promise<datatypes.AgentIngress> {
77
+ return this.httpClient
78
+ .url(`/agent_ingresses/${arg.id}`)
79
+ .get()
80
+ .json(payload => util.deserializeResult(payload))
81
+ .then(f => f, util.onRejected);
82
+ }
83
+
84
+ /**
85
+ * List all Agent Ingresses owned by this account
86
+ */
87
+ public async list(): Promise<Array<datatypes.AgentIngress>> {
88
+ const array: Array<datatypes.AgentIngress> = [];
89
+ for await (const item of this._asyncList()) {
90
+ array.push(item);
91
+ }
92
+ return array;
93
+ }
94
+ private _pagedList(
95
+ arg: datatypes.Paging
96
+ ): Promise<datatypes.AgentIngressList> {
97
+ return this.httpClient
98
+ .url(`/agent_ingresses`)
99
+ .query(arg)
100
+ .get()
101
+ .json(payload => util.deserializeResult(payload))
102
+ .then(util.onFulfilled, util.onRejected);
103
+ }
104
+ private async *_asyncList() {
105
+ const limit = '100';
106
+ let nextPage = 'initial loop';
107
+ let page: datatypes.Paging = { limit: limit };
108
+
109
+ while (nextPage) {
110
+ const pagedList = await this._pagedList(page);
111
+ nextPage = pagedList.nextPageUri;
112
+ const items: datatypes.AgentIngress[] = pagedList.ingresses;
113
+
114
+ if (nextPage) {
115
+ page = {
116
+ beforeId: items[items.length - 1].id,
117
+ limit: limit,
118
+ };
119
+ }
120
+
121
+ for (const item of items) {
122
+ yield item;
123
+ }
124
+ }
125
+ }
126
+ /**
127
+ * Update attributes of an Agent Ingress by ID.
128
+ */
129
+ public update(
130
+ arg: datatypes.AgentIngressUpdate
131
+ ): Promise<datatypes.AgentIngress> {
132
+ return this.httpClient
133
+ .url(`/agent_ingresses/${arg.id}`)
134
+ .patch(util.serializeArgument(arg))
135
+ .json(payload => util.deserializeResult(payload))
136
+ .then(f => f, util.onRejected);
137
+ }
138
+ }
139
+
140
+ /**
141
+ * API Keys are used to authenticate to the [ngrok
142
+ API](https://ngrok.com/docs/api#authentication). You may use the API itself
143
+ to provision and manage API Keys but you'll need to provision your first API
144
+ key from the [API Keys page](https://dashboard.ngrok.com/api/keys) on your
145
+ ngrok.com dashboard.
146
+ */
147
+ export class APIKeys {
148
+ private httpClient: Wretcher;
149
+
150
+ /** Do not construct this object directly, use the <code>apiKeys</code> property of an <code>Ngrok</code> client object instead. */
151
+ public constructor(httpClient: Wretcher) {
152
+ this.httpClient = httpClient;
153
+ }
154
+ /**
155
+ * Create a new API key. The generated API key can be used to authenticate to the ngrok API.
156
+ */
157
+ public create(arg: datatypes.APIKeyCreate): Promise<datatypes.APIKey> {
158
+ return this.httpClient
159
+ .url(`/api_keys`)
160
+ .post(util.serializeArgument(arg))
161
+ .json(payload => util.deserializeResult(payload))
162
+ .then(f => f, util.onRejected);
163
+ }
164
+
165
+ /**
166
+ * Delete an API key by ID
167
+ */
168
+ public delete(arg: datatypes.Item): Promise<void> {
169
+ return this.httpClient
170
+ .url(`/api_keys/${arg.id}`)
171
+ .delete()
172
+ .json(payload => util.deserializeResult(payload))
173
+ .then(f => f, util.onRejected);
174
+ }
175
+
176
+ /**
177
+ * Get the details of an API key by ID.
178
+ */
179
+ public get(arg: datatypes.Item): Promise<datatypes.APIKey> {
180
+ return this.httpClient
181
+ .url(`/api_keys/${arg.id}`)
182
+ .get()
183
+ .json(payload => util.deserializeResult(payload))
184
+ .then(f => f, util.onRejected);
185
+ }
186
+
187
+ /**
188
+ * List all API keys owned by this account
189
+ */
190
+ public async list(): Promise<Array<datatypes.APIKey>> {
191
+ const array: Array<datatypes.APIKey> = [];
192
+ for await (const item of this._asyncList()) {
193
+ array.push(item);
194
+ }
195
+ return array;
196
+ }
197
+ private _pagedList(arg: datatypes.Paging): Promise<datatypes.APIKeyList> {
198
+ return this.httpClient
199
+ .url(`/api_keys`)
200
+ .query(arg)
201
+ .get()
202
+ .json(payload => util.deserializeResult(payload))
203
+ .then(util.onFulfilled, util.onRejected);
204
+ }
205
+ private async *_asyncList() {
206
+ const limit = '100';
207
+ let nextPage = 'initial loop';
208
+ let page: datatypes.Paging = { limit: limit };
209
+
210
+ while (nextPage) {
211
+ const pagedList = await this._pagedList(page);
212
+ nextPage = pagedList.nextPageUri;
213
+ const items: datatypes.APIKey[] = pagedList.keys;
214
+
215
+ if (nextPage) {
216
+ page = {
217
+ beforeId: items[items.length - 1].id,
218
+ limit: limit,
219
+ };
220
+ }
221
+
222
+ for (const item of items) {
223
+ yield item;
224
+ }
225
+ }
226
+ }
227
+ /**
228
+ * Update attributes of an API key by ID.
229
+ */
230
+ public update(arg: datatypes.APIKeyUpdate): Promise<datatypes.APIKey> {
231
+ return this.httpClient
232
+ .url(`/api_keys/${arg.id}`)
233
+ .patch(util.serializeArgument(arg))
234
+ .json(payload => util.deserializeResult(payload))
235
+ .then(f => f, util.onRejected);
236
+ }
237
+ }
238
+
239
+ /**
240
+ * A Failover backend defines failover behavior within a list of referenced
241
+ backends. Traffic is sent to the first backend in the list. If that backend
242
+ is offline or no connection can be established, ngrok attempts to connect to
243
+ the next backend in the list until one is successful.
244
+ */
245
+ export class FailoverBackends {
246
+ private httpClient: Wretcher;
247
+
248
+ /** Do not construct this object directly, use the <code>failoverBackends</code> property of an <code>Ngrok</code> client object instead. */
249
+ public constructor(httpClient: Wretcher) {
250
+ this.httpClient = httpClient;
251
+ }
252
+ /**
253
+ * Create a new Failover backend
254
+ */
255
+ public create(
256
+ arg: datatypes.FailoverBackendCreate
257
+ ): Promise<datatypes.FailoverBackend> {
258
+ return this.httpClient
259
+ .url(`/backends/failover`)
260
+ .post(util.serializeArgument(arg))
261
+ .json(payload => util.deserializeResult(payload))
262
+ .then(f => f, util.onRejected);
263
+ }
264
+
265
+ /**
266
+ * Delete a Failover backend by ID. TODO what if used?
267
+ */
268
+ public delete(arg: datatypes.Item): Promise<void> {
269
+ return this.httpClient
270
+ .url(`/backends/failover/${arg.id}`)
271
+ .delete()
272
+ .json(payload => util.deserializeResult(payload))
273
+ .then(f => f, util.onRejected);
274
+ }
275
+
276
+ /**
277
+ * Get detailed information about a Failover backend by ID
278
+ */
279
+ public get(arg: datatypes.Item): Promise<datatypes.FailoverBackend> {
280
+ return this.httpClient
281
+ .url(`/backends/failover/${arg.id}`)
282
+ .get()
283
+ .json(payload => util.deserializeResult(payload))
284
+ .then(f => f, util.onRejected);
285
+ }
286
+
287
+ /**
288
+ * List all Failover backends on this account
289
+ */
290
+ public async list(): Promise<Array<datatypes.FailoverBackend>> {
291
+ const array: Array<datatypes.FailoverBackend> = [];
292
+ for await (const item of this._asyncList()) {
293
+ array.push(item);
294
+ }
295
+ return array;
296
+ }
297
+ private _pagedList(
298
+ arg: datatypes.Paging
299
+ ): Promise<datatypes.FailoverBackendList> {
300
+ return this.httpClient
301
+ .url(`/backends/failover`)
302
+ .query(arg)
303
+ .get()
304
+ .json(payload => util.deserializeResult(payload))
305
+ .then(util.onFulfilled, util.onRejected);
306
+ }
307
+ private async *_asyncList() {
308
+ const limit = '100';
309
+ let nextPage = 'initial loop';
310
+ let page: datatypes.Paging = { limit: limit };
311
+
312
+ while (nextPage) {
313
+ const pagedList = await this._pagedList(page);
314
+ nextPage = pagedList.nextPageUri;
315
+ const items: datatypes.FailoverBackend[] = pagedList.backends;
316
+
317
+ if (nextPage) {
318
+ page = {
319
+ beforeId: items[items.length - 1].id,
320
+ limit: limit,
321
+ };
322
+ }
323
+
324
+ for (const item of items) {
325
+ yield item;
326
+ }
327
+ }
328
+ }
329
+ /**
330
+ * Update Failover backend by ID
331
+ */
332
+ public update(
333
+ arg: datatypes.FailoverBackendUpdate
334
+ ): Promise<datatypes.FailoverBackend> {
335
+ return this.httpClient
336
+ .url(`/backends/failover/${arg.id}`)
337
+ .patch(util.serializeArgument(arg))
338
+ .json(payload => util.deserializeResult(payload))
339
+ .then(f => f, util.onRejected);
340
+ }
341
+ }
342
+
343
+ export class HTTPResponseBackends {
344
+ private httpClient: Wretcher;
345
+
346
+ /** Do not construct this object directly, use the <code>httpResponseBackends</code> property of an <code>Ngrok</code> client object instead. */
347
+ public constructor(httpClient: Wretcher) {
348
+ this.httpClient = httpClient;
349
+ }
350
+ public create(
351
+ arg: datatypes.HTTPResponseBackendCreate
352
+ ): Promise<datatypes.HTTPResponseBackend> {
353
+ return this.httpClient
354
+ .url(`/backends/http_response`)
355
+ .post(util.serializeArgument(arg))
356
+ .json(payload => util.deserializeResult(payload))
357
+ .then(f => f, util.onRejected);
358
+ }
359
+
360
+ public delete(arg: datatypes.Item): Promise<void> {
361
+ return this.httpClient
362
+ .url(`/backends/http_response/${arg.id}`)
363
+ .delete()
364
+ .json(payload => util.deserializeResult(payload))
365
+ .then(f => f, util.onRejected);
366
+ }
367
+
368
+ public get(arg: datatypes.Item): Promise<datatypes.HTTPResponseBackend> {
369
+ return this.httpClient
370
+ .url(`/backends/http_response/${arg.id}`)
371
+ .get()
372
+ .json(payload => util.deserializeResult(payload))
373
+ .then(f => f, util.onRejected);
374
+ }
375
+
376
+ public async list(): Promise<Array<datatypes.HTTPResponseBackend>> {
377
+ const array: Array<datatypes.HTTPResponseBackend> = [];
378
+ for await (const item of this._asyncList()) {
379
+ array.push(item);
380
+ }
381
+ return array;
382
+ }
383
+ private _pagedList(
384
+ arg: datatypes.Paging
385
+ ): Promise<datatypes.HTTPResponseBackendList> {
386
+ return this.httpClient
387
+ .url(`/backends/http_response`)
388
+ .query(arg)
389
+ .get()
390
+ .json(payload => util.deserializeResult(payload))
391
+ .then(util.onFulfilled, util.onRejected);
392
+ }
393
+ private async *_asyncList() {
394
+ const limit = '100';
395
+ let nextPage = 'initial loop';
396
+ let page: datatypes.Paging = { limit: limit };
397
+
398
+ while (nextPage) {
399
+ const pagedList = await this._pagedList(page);
400
+ nextPage = pagedList.nextPageUri;
401
+ const items: datatypes.HTTPResponseBackend[] = pagedList.backends;
402
+
403
+ if (nextPage) {
404
+ page = {
405
+ beforeId: items[items.length - 1].id,
406
+ limit: limit,
407
+ };
408
+ }
409
+
410
+ for (const item of items) {
411
+ yield item;
412
+ }
413
+ }
414
+ }
415
+ public update(
416
+ arg: datatypes.HTTPResponseBackendUpdate
417
+ ): Promise<datatypes.HTTPResponseBackend> {
418
+ return this.httpClient
419
+ .url(`/backends/http_response/${arg.id}`)
420
+ .patch(util.serializeArgument(arg))
421
+ .json(payload => util.deserializeResult(payload))
422
+ .then(f => f, util.onRejected);
423
+ }
424
+ }
425
+
426
+ /**
427
+ * A Tunnel Group Backend balances traffic among all online tunnels that match
428
+ a label selector.
429
+ */
430
+ export class TunnelGroupBackends {
431
+ private httpClient: Wretcher;
432
+
433
+ /** Do not construct this object directly, use the <code>tunnelGroupBackends</code> property of an <code>Ngrok</code> client object instead. */
434
+ public constructor(httpClient: Wretcher) {
435
+ this.httpClient = httpClient;
436
+ }
437
+ /**
438
+ * Create a new TunnelGroup backend
439
+ */
440
+ public create(
441
+ arg: datatypes.TunnelGroupBackendCreate
442
+ ): Promise<datatypes.TunnelGroupBackend> {
443
+ return this.httpClient
444
+ .url(`/backends/tunnel_group`)
445
+ .post(util.serializeArgument(arg))
446
+ .json(payload => util.deserializeResult(payload))
447
+ .then(f => f, util.onRejected);
448
+ }
449
+
450
+ /**
451
+ * Delete a TunnelGroup backend by ID. TODO what if used?
452
+ */
453
+ public delete(arg: datatypes.Item): Promise<void> {
454
+ return this.httpClient
455
+ .url(`/backends/tunnel_group/${arg.id}`)
456
+ .delete()
457
+ .json(payload => util.deserializeResult(payload))
458
+ .then(f => f, util.onRejected);
459
+ }
460
+
461
+ /**
462
+ * Get detailed information about a TunnelGroup backend by ID
463
+ */
464
+ public get(arg: datatypes.Item): Promise<datatypes.TunnelGroupBackend> {
465
+ return this.httpClient
466
+ .url(`/backends/tunnel_group/${arg.id}`)
467
+ .get()
468
+ .json(payload => util.deserializeResult(payload))
469
+ .then(f => f, util.onRejected);
470
+ }
471
+
472
+ /**
473
+ * List all TunnelGroup backends on this account
474
+ */
475
+ public async list(): Promise<Array<datatypes.TunnelGroupBackend>> {
476
+ const array: Array<datatypes.TunnelGroupBackend> = [];
477
+ for await (const item of this._asyncList()) {
478
+ array.push(item);
479
+ }
480
+ return array;
481
+ }
482
+ private _pagedList(
483
+ arg: datatypes.Paging
484
+ ): Promise<datatypes.TunnelGroupBackendList> {
485
+ return this.httpClient
486
+ .url(`/backends/tunnel_group`)
487
+ .query(arg)
488
+ .get()
489
+ .json(payload => util.deserializeResult(payload))
490
+ .then(util.onFulfilled, util.onRejected);
491
+ }
492
+ private async *_asyncList() {
493
+ const limit = '100';
494
+ let nextPage = 'initial loop';
495
+ let page: datatypes.Paging = { limit: limit };
496
+
497
+ while (nextPage) {
498
+ const pagedList = await this._pagedList(page);
499
+ nextPage = pagedList.nextPageUri;
500
+ const items: datatypes.TunnelGroupBackend[] = pagedList.backends;
501
+
502
+ if (nextPage) {
503
+ page = {
504
+ beforeId: items[items.length - 1].id,
505
+ limit: limit,
506
+ };
507
+ }
508
+
509
+ for (const item of items) {
510
+ yield item;
511
+ }
512
+ }
513
+ }
514
+ /**
515
+ * Update TunnelGroup backend by ID
516
+ */
517
+ public update(
518
+ arg: datatypes.TunnelGroupBackendUpdate
519
+ ): Promise<datatypes.TunnelGroupBackend> {
520
+ return this.httpClient
521
+ .url(`/backends/tunnel_group/${arg.id}`)
522
+ .patch(util.serializeArgument(arg))
523
+ .json(payload => util.deserializeResult(payload))
524
+ .then(f => f, util.onRejected);
525
+ }
526
+ }
527
+
528
+ /**
529
+ * A Weighted Backend balances traffic among the referenced backends. Traffic
530
+ is assigned proportionally to each based on its weight. The percentage of
531
+ traffic is calculated by dividing a backend's weight by the sum of all
532
+ weights.
533
+ */
534
+ export class WeightedBackends {
535
+ private httpClient: Wretcher;
536
+
537
+ /** Do not construct this object directly, use the <code>weightedBackends</code> property of an <code>Ngrok</code> client object instead. */
538
+ public constructor(httpClient: Wretcher) {
539
+ this.httpClient = httpClient;
540
+ }
541
+ /**
542
+ * Create a new Weighted backend
543
+ */
544
+ public create(
545
+ arg: datatypes.WeightedBackendCreate
546
+ ): Promise<datatypes.WeightedBackend> {
547
+ return this.httpClient
548
+ .url(`/backends/weighted`)
549
+ .post(util.serializeArgument(arg))
550
+ .json(payload => util.deserializeResult(payload))
551
+ .then(f => f, util.onRejected);
552
+ }
553
+
554
+ /**
555
+ * Delete a Weighted backend by ID. TODO what if used?
556
+ */
557
+ public delete(arg: datatypes.Item): Promise<void> {
558
+ return this.httpClient
559
+ .url(`/backends/weighted/${arg.id}`)
560
+ .delete()
561
+ .json(payload => util.deserializeResult(payload))
562
+ .then(f => f, util.onRejected);
563
+ }
564
+
565
+ /**
566
+ * Get detailed information about a Weighted backend by ID
567
+ */
568
+ public get(arg: datatypes.Item): Promise<datatypes.WeightedBackend> {
569
+ return this.httpClient
570
+ .url(`/backends/weighted/${arg.id}`)
571
+ .get()
572
+ .json(payload => util.deserializeResult(payload))
573
+ .then(f => f, util.onRejected);
574
+ }
575
+
576
+ /**
577
+ * List all Weighted backends on this account
578
+ */
579
+ public async list(): Promise<Array<datatypes.WeightedBackend>> {
580
+ const array: Array<datatypes.WeightedBackend> = [];
581
+ for await (const item of this._asyncList()) {
582
+ array.push(item);
583
+ }
584
+ return array;
585
+ }
586
+ private _pagedList(
587
+ arg: datatypes.Paging
588
+ ): Promise<datatypes.WeightedBackendList> {
589
+ return this.httpClient
590
+ .url(`/backends/weighted`)
591
+ .query(arg)
592
+ .get()
593
+ .json(payload => util.deserializeResult(payload))
594
+ .then(util.onFulfilled, util.onRejected);
595
+ }
596
+ private async *_asyncList() {
597
+ const limit = '100';
598
+ let nextPage = 'initial loop';
599
+ let page: datatypes.Paging = { limit: limit };
600
+
601
+ while (nextPage) {
602
+ const pagedList = await this._pagedList(page);
603
+ nextPage = pagedList.nextPageUri;
604
+ const items: datatypes.WeightedBackend[] = pagedList.backends;
605
+
606
+ if (nextPage) {
607
+ page = {
608
+ beforeId: items[items.length - 1].id,
609
+ limit: limit,
610
+ };
611
+ }
612
+
613
+ for (const item of items) {
614
+ yield item;
615
+ }
616
+ }
617
+ }
618
+ /**
619
+ * Update Weighted backend by ID
620
+ */
621
+ public update(
622
+ arg: datatypes.WeightedBackendUpdate
623
+ ): Promise<datatypes.WeightedBackend> {
624
+ return this.httpClient
625
+ .url(`/backends/weighted/${arg.id}`)
626
+ .patch(util.serializeArgument(arg))
627
+ .json(payload => util.deserializeResult(payload))
628
+ .then(f => f, util.onRejected);
629
+ }
630
+ }
631
+
632
+ /**
633
+ * Certificate Authorities are x509 certificates that are used to sign other
634
+ x509 certificates. Attach a Certificate Authority to the Mutual TLS module
635
+ to verify that the TLS certificate presented by a client has been signed by
636
+ this CA. Certificate Authorities are used only for mTLS validation only and
637
+ thus a private key is not included in the resource.
638
+ */
639
+ export class CertificateAuthorities {
640
+ private httpClient: Wretcher;
641
+
642
+ /** Do not construct this object directly, use the <code>certificateAuthorities</code> property of an <code>Ngrok</code> client object instead. */
643
+ public constructor(httpClient: Wretcher) {
644
+ this.httpClient = httpClient;
645
+ }
646
+ /**
647
+ * Upload a new Certificate Authority
648
+ */
649
+ public create(
650
+ arg: datatypes.CertificateAuthorityCreate
651
+ ): Promise<datatypes.CertificateAuthority> {
652
+ return this.httpClient
653
+ .url(`/certificate_authorities`)
654
+ .post(util.serializeArgument(arg))
655
+ .json(payload => util.deserializeResult(payload))
656
+ .then(f => f, util.onRejected);
657
+ }
658
+
659
+ /**
660
+ * Delete a Certificate Authority
661
+ */
662
+ public delete(arg: datatypes.Item): Promise<void> {
663
+ return this.httpClient
664
+ .url(`/certificate_authorities/${arg.id}`)
665
+ .delete()
666
+ .json(payload => util.deserializeResult(payload))
667
+ .then(f => f, util.onRejected);
668
+ }
669
+
670
+ /**
671
+ * Get detailed information about a certficate authority
672
+ */
673
+ public get(arg: datatypes.Item): Promise<datatypes.CertificateAuthority> {
674
+ return this.httpClient
675
+ .url(`/certificate_authorities/${arg.id}`)
676
+ .get()
677
+ .json(payload => util.deserializeResult(payload))
678
+ .then(f => f, util.onRejected);
679
+ }
680
+
681
+ /**
682
+ * List all Certificate Authority on this account
683
+ */
684
+ public async list(): Promise<Array<datatypes.CertificateAuthority>> {
685
+ const array: Array<datatypes.CertificateAuthority> = [];
686
+ for await (const item of this._asyncList()) {
687
+ array.push(item);
688
+ }
689
+ return array;
690
+ }
691
+ private _pagedList(
692
+ arg: datatypes.Paging
693
+ ): Promise<datatypes.CertificateAuthorityList> {
694
+ return this.httpClient
695
+ .url(`/certificate_authorities`)
696
+ .query(arg)
697
+ .get()
698
+ .json(payload => util.deserializeResult(payload))
699
+ .then(util.onFulfilled, util.onRejected);
700
+ }
701
+ private async *_asyncList() {
702
+ const limit = '100';
703
+ let nextPage = 'initial loop';
704
+ let page: datatypes.Paging = { limit: limit };
705
+
706
+ while (nextPage) {
707
+ const pagedList = await this._pagedList(page);
708
+ nextPage = pagedList.nextPageUri;
709
+ const items: datatypes.CertificateAuthority[] =
710
+ pagedList.certificateAuthorities;
711
+
712
+ if (nextPage) {
713
+ page = {
714
+ beforeId: items[items.length - 1].id,
715
+ limit: limit,
716
+ };
717
+ }
718
+
719
+ for (const item of items) {
720
+ yield item;
721
+ }
722
+ }
723
+ }
724
+ /**
725
+ * Update attributes of a Certificate Authority by ID
726
+ */
727
+ public update(
728
+ arg: datatypes.CertificateAuthorityUpdate
729
+ ): Promise<datatypes.CertificateAuthority> {
730
+ return this.httpClient
731
+ .url(`/certificate_authorities/${arg.id}`)
732
+ .patch(util.serializeArgument(arg))
733
+ .json(payload => util.deserializeResult(payload))
734
+ .then(f => f, util.onRejected);
735
+ }
736
+ }
737
+
738
+ /**
739
+ * Tunnel Credentials are ngrok agent authtokens. They authorize the ngrok
740
+ agent to connect the ngrok service as your account. They are installed with
741
+ the `ngrok authtoken` command or by specifying it in the `ngrok.yml`
742
+ configuration file with the `authtoken` property.
743
+ */
744
+ export class Credentials {
745
+ private httpClient: Wretcher;
746
+
747
+ /** Do not construct this object directly, use the <code>credentials</code> property of an <code>Ngrok</code> client object instead. */
748
+ public constructor(httpClient: Wretcher) {
749
+ this.httpClient = httpClient;
750
+ }
751
+ /**
752
+ * Create a new tunnel authtoken credential. This authtoken credential can be used to start a new tunnel session. The response to this API call is the only time the generated token is available. If you need it for future use, you must save it securely yourself.
753
+ */
754
+ public create(
755
+ arg: datatypes.CredentialCreate
756
+ ): Promise<datatypes.Credential> {
757
+ return this.httpClient
758
+ .url(`/credentials`)
759
+ .post(util.serializeArgument(arg))
760
+ .json(payload => util.deserializeResult(payload))
761
+ .then(f => f, util.onRejected);
762
+ }
763
+
764
+ /**
765
+ * Delete a tunnel authtoken credential by ID
766
+ */
767
+ public delete(arg: datatypes.Item): Promise<void> {
768
+ return this.httpClient
769
+ .url(`/credentials/${arg.id}`)
770
+ .delete()
771
+ .json(payload => util.deserializeResult(payload))
772
+ .then(f => f, util.onRejected);
773
+ }
774
+
775
+ /**
776
+ * Get detailed information about a tunnel authtoken credential
777
+ */
778
+ public get(arg: datatypes.Item): Promise<datatypes.Credential> {
779
+ return this.httpClient
780
+ .url(`/credentials/${arg.id}`)
781
+ .get()
782
+ .json(payload => util.deserializeResult(payload))
783
+ .then(f => f, util.onRejected);
784
+ }
785
+
786
+ /**
787
+ * List all tunnel authtoken credentials on this account
788
+ */
789
+ public async list(): Promise<Array<datatypes.Credential>> {
790
+ const array: Array<datatypes.Credential> = [];
791
+ for await (const item of this._asyncList()) {
792
+ array.push(item);
793
+ }
794
+ return array;
795
+ }
796
+ private _pagedList(arg: datatypes.Paging): Promise<datatypes.CredentialList> {
797
+ return this.httpClient
798
+ .url(`/credentials`)
799
+ .query(arg)
800
+ .get()
801
+ .json(payload => util.deserializeResult(payload))
802
+ .then(util.onFulfilled, util.onRejected);
803
+ }
804
+ private async *_asyncList() {
805
+ const limit = '100';
806
+ let nextPage = 'initial loop';
807
+ let page: datatypes.Paging = { limit: limit };
808
+
809
+ while (nextPage) {
810
+ const pagedList = await this._pagedList(page);
811
+ nextPage = pagedList.nextPageUri;
812
+ const items: datatypes.Credential[] = pagedList.credentials;
813
+
814
+ if (nextPage) {
815
+ page = {
816
+ beforeId: items[items.length - 1].id,
817
+ limit: limit,
818
+ };
819
+ }
820
+
821
+ for (const item of items) {
822
+ yield item;
823
+ }
824
+ }
825
+ }
826
+ /**
827
+ * Update attributes of an tunnel authtoken credential by ID
828
+ */
829
+ public update(
830
+ arg: datatypes.CredentialUpdate
831
+ ): Promise<datatypes.Credential> {
832
+ return this.httpClient
833
+ .url(`/credentials/${arg.id}`)
834
+ .patch(util.serializeArgument(arg))
835
+ .json(payload => util.deserializeResult(payload))
836
+ .then(f => f, util.onRejected);
837
+ }
838
+ }
839
+
840
+ export class EdgesHTTPSRoutes {
841
+ private httpClient: Wretcher;
842
+
843
+ /** Do not construct this object directly, use the <code>edgesHttpsRoutes</code> property of an <code>Ngrok</code> client object instead. */
844
+ public constructor(httpClient: Wretcher) {
845
+ this.httpClient = httpClient;
846
+ }
847
+ /**
848
+ * Create an HTTPS Edge Route
849
+ */
850
+ public create(
851
+ arg: datatypes.HTTPSEdgeRouteCreate
852
+ ): Promise<datatypes.HTTPSEdgeRoute> {
853
+ return this.httpClient
854
+ .url(`/edges/https/${arg.edgeId}/routes`)
855
+ .post(util.serializeArgument(arg))
856
+ .json(payload => util.deserializeResult(payload))
857
+ .then(f => f, util.onRejected);
858
+ }
859
+
860
+ /**
861
+ * Get an HTTPS Edge Route by ID
862
+ */
863
+ public get(arg: datatypes.EdgeRouteItem): Promise<datatypes.HTTPSEdgeRoute> {
864
+ return this.httpClient
865
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}`)
866
+ .get()
867
+ .json(payload => util.deserializeResult(payload))
868
+ .then(f => f, util.onRejected);
869
+ }
870
+
871
+ /**
872
+ * Updates an HTTPS Edge Route by ID. If a module is not specified in the update, it will not be modified. However, each module configuration that is specified will completely replace the existing value. There is no way to delete an existing module via this API, instead use the delete module API.
873
+ */
874
+ public update(
875
+ arg: datatypes.HTTPSEdgeRouteUpdate
876
+ ): Promise<datatypes.HTTPSEdgeRoute> {
877
+ return this.httpClient
878
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}`)
879
+ .patch(util.serializeArgument(arg))
880
+ .json(payload => util.deserializeResult(payload))
881
+ .then(f => f, util.onRejected);
882
+ }
883
+
884
+ /**
885
+ * Delete an HTTPS Edge Route by ID
886
+ */
887
+ public delete(arg: datatypes.EdgeRouteItem): Promise<void> {
888
+ return this.httpClient
889
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}`)
890
+ .delete()
891
+ .json(payload => util.deserializeResult(payload))
892
+ .then(f => f, util.onRejected);
893
+ }
894
+ }
895
+
896
+ export class EdgesHTTPS {
897
+ private httpClient: Wretcher;
898
+
899
+ /** Do not construct this object directly, use the <code>edgesHttps</code> property of an <code>Ngrok</code> client object instead. */
900
+ public constructor(httpClient: Wretcher) {
901
+ this.httpClient = httpClient;
902
+ }
903
+ /**
904
+ * Create an HTTPS Edge
905
+ */
906
+ public create(arg: datatypes.HTTPSEdgeCreate): Promise<datatypes.HTTPSEdge> {
907
+ return this.httpClient
908
+ .url(`/edges/https`)
909
+ .post(util.serializeArgument(arg))
910
+ .json(payload => util.deserializeResult(payload))
911
+ .then(f => f, util.onRejected);
912
+ }
913
+
914
+ /**
915
+ * Get an HTTPS Edge by ID
916
+ */
917
+ public get(arg: datatypes.Item): Promise<datatypes.HTTPSEdge> {
918
+ return this.httpClient
919
+ .url(`/edges/https/${arg.id}`)
920
+ .get()
921
+ .json(payload => util.deserializeResult(payload))
922
+ .then(f => f, util.onRejected);
923
+ }
924
+
925
+ /**
926
+ * Returns a list of all HTTPS Edges on this account
927
+ */
928
+ public async list(): Promise<Array<datatypes.HTTPSEdge>> {
929
+ const array: Array<datatypes.HTTPSEdge> = [];
930
+ for await (const item of this._asyncList()) {
931
+ array.push(item);
932
+ }
933
+ return array;
934
+ }
935
+ private _pagedList(arg: datatypes.Paging): Promise<datatypes.HTTPSEdgeList> {
936
+ return this.httpClient
937
+ .url(`/edges/https`)
938
+ .query(arg)
939
+ .get()
940
+ .json(payload => util.deserializeResult(payload))
941
+ .then(util.onFulfilled, util.onRejected);
942
+ }
943
+ private async *_asyncList() {
944
+ const limit = '100';
945
+ let nextPage = 'initial loop';
946
+ let page: datatypes.Paging = { limit: limit };
947
+
948
+ while (nextPage) {
949
+ const pagedList = await this._pagedList(page);
950
+ nextPage = pagedList.nextPageUri;
951
+ const items: datatypes.HTTPSEdge[] = pagedList.httpsEdges;
952
+
953
+ if (nextPage) {
954
+ page = {
955
+ beforeId: items[items.length - 1].id,
956
+ limit: limit,
957
+ };
958
+ }
959
+
960
+ for (const item of items) {
961
+ yield item;
962
+ }
963
+ }
964
+ }
965
+ /**
966
+ * Updates an HTTPS Edge by ID. If a module is not specified in the update, it will not be modified. However, each module configuration that is specified will completely replace the existing value. There is no way to delete an existing module via this API, instead use the delete module API.
967
+ */
968
+ public update(arg: datatypes.HTTPSEdgeUpdate): Promise<datatypes.HTTPSEdge> {
969
+ return this.httpClient
970
+ .url(`/edges/https/${arg.id}`)
971
+ .patch(util.serializeArgument(arg))
972
+ .json(payload => util.deserializeResult(payload))
973
+ .then(f => f, util.onRejected);
974
+ }
975
+
976
+ /**
977
+ * Delete an HTTPS Edge by ID
978
+ */
979
+ public delete(arg: datatypes.Item): Promise<void> {
980
+ return this.httpClient
981
+ .url(`/edges/https/${arg.id}`)
982
+ .delete()
983
+ .json(payload => util.deserializeResult(payload))
984
+ .then(f => f, util.onRejected);
985
+ }
986
+ }
987
+
988
+ export class HTTPSEdgeMutualTLSModule {
989
+ private httpClient: Wretcher;
990
+
991
+ /** Do not construct this object directly, use the <code>httpsEdgeMutualTlsModule</code> property of an <code>Ngrok</code> client object instead. */
992
+ public constructor(httpClient: Wretcher) {
993
+ this.httpClient = httpClient;
994
+ }
995
+ public replace(
996
+ arg: datatypes.EdgeMutualTLSReplace
997
+ ): Promise<datatypes.EndpointMutualTLS> {
998
+ return this.httpClient
999
+ .url(`/edges/https/${arg.id}/mutual_tls`)
1000
+ .put(util.serializeArgument(arg))
1001
+ .json(payload => util.deserializeResult(payload))
1002
+ .then(f => f, util.onRejected);
1003
+ }
1004
+
1005
+ public get(arg: datatypes.Item): Promise<datatypes.EndpointMutualTLS> {
1006
+ return this.httpClient
1007
+ .url(`/edges/https/${arg.id}/mutual_tls`)
1008
+ .get()
1009
+ .json(payload => util.deserializeResult(payload))
1010
+ .then(f => f, util.onRejected);
1011
+ }
1012
+
1013
+ public delete(arg: datatypes.Item): Promise<void> {
1014
+ return this.httpClient
1015
+ .url(`/edges/https/${arg.id}/mutual_tls`)
1016
+ .delete()
1017
+ .json(payload => util.deserializeResult(payload))
1018
+ .then(f => f, util.onRejected);
1019
+ }
1020
+ }
1021
+
1022
+ export class HTTPSEdgeTLSTerminationModule {
1023
+ private httpClient: Wretcher;
1024
+
1025
+ /** Do not construct this object directly, use the <code>httpsEdgeTlsTerminationModule</code> property of an <code>Ngrok</code> client object instead. */
1026
+ public constructor(httpClient: Wretcher) {
1027
+ this.httpClient = httpClient;
1028
+ }
1029
+ public replace(
1030
+ arg: datatypes.EdgeTLSTerminationAtEdgeReplace
1031
+ ): Promise<datatypes.EndpointTLSTermination> {
1032
+ return this.httpClient
1033
+ .url(`/edges/https/${arg.id}/tls_termination`)
1034
+ .put(util.serializeArgument(arg))
1035
+ .json(payload => util.deserializeResult(payload))
1036
+ .then(f => f, util.onRejected);
1037
+ }
1038
+
1039
+ public get(arg: datatypes.Item): Promise<datatypes.EndpointTLSTermination> {
1040
+ return this.httpClient
1041
+ .url(`/edges/https/${arg.id}/tls_termination`)
1042
+ .get()
1043
+ .json(payload => util.deserializeResult(payload))
1044
+ .then(f => f, util.onRejected);
1045
+ }
1046
+
1047
+ public delete(arg: datatypes.Item): Promise<void> {
1048
+ return this.httpClient
1049
+ .url(`/edges/https/${arg.id}/tls_termination`)
1050
+ .delete()
1051
+ .json(payload => util.deserializeResult(payload))
1052
+ .then(f => f, util.onRejected);
1053
+ }
1054
+ }
1055
+
1056
+ export class EdgeRouteBackendModule {
1057
+ private httpClient: Wretcher;
1058
+
1059
+ /** Do not construct this object directly, use the <code>edgeRouteBackendModule</code> property of an <code>Ngrok</code> client object instead. */
1060
+ public constructor(httpClient: Wretcher) {
1061
+ this.httpClient = httpClient;
1062
+ }
1063
+ public replace(
1064
+ arg: datatypes.EdgeRouteBackendReplace
1065
+ ): Promise<datatypes.EndpointBackend> {
1066
+ return this.httpClient
1067
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/backend`)
1068
+ .put(util.serializeArgument(arg))
1069
+ .json(payload => util.deserializeResult(payload))
1070
+ .then(f => f, util.onRejected);
1071
+ }
1072
+
1073
+ public get(arg: datatypes.EdgeRouteItem): Promise<datatypes.EndpointBackend> {
1074
+ return this.httpClient
1075
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/backend`)
1076
+ .get()
1077
+ .json(payload => util.deserializeResult(payload))
1078
+ .then(f => f, util.onRejected);
1079
+ }
1080
+
1081
+ public delete(arg: datatypes.EdgeRouteItem): Promise<void> {
1082
+ return this.httpClient
1083
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/backend`)
1084
+ .delete()
1085
+ .json(payload => util.deserializeResult(payload))
1086
+ .then(f => f, util.onRejected);
1087
+ }
1088
+ }
1089
+
1090
+ export class EdgeRouteIPRestrictionModule {
1091
+ private httpClient: Wretcher;
1092
+
1093
+ /** Do not construct this object directly, use the <code>edgeRouteIpRestrictionModule</code> property of an <code>Ngrok</code> client object instead. */
1094
+ public constructor(httpClient: Wretcher) {
1095
+ this.httpClient = httpClient;
1096
+ }
1097
+ public replace(
1098
+ arg: datatypes.EdgeRouteIPRestrictionReplace
1099
+ ): Promise<datatypes.EndpointIPPolicy> {
1100
+ return this.httpClient
1101
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/ip_restriction`)
1102
+ .put(util.serializeArgument(arg))
1103
+ .json(payload => util.deserializeResult(payload))
1104
+ .then(f => f, util.onRejected);
1105
+ }
1106
+
1107
+ public get(
1108
+ arg: datatypes.EdgeRouteItem
1109
+ ): Promise<datatypes.EndpointIPPolicy> {
1110
+ return this.httpClient
1111
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/ip_restriction`)
1112
+ .get()
1113
+ .json(payload => util.deserializeResult(payload))
1114
+ .then(f => f, util.onRejected);
1115
+ }
1116
+
1117
+ public delete(arg: datatypes.EdgeRouteItem): Promise<void> {
1118
+ return this.httpClient
1119
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/ip_restriction`)
1120
+ .delete()
1121
+ .json(payload => util.deserializeResult(payload))
1122
+ .then(f => f, util.onRejected);
1123
+ }
1124
+ }
1125
+
1126
+ export class EdgeRouteRequestHeadersModule {
1127
+ private httpClient: Wretcher;
1128
+
1129
+ /** Do not construct this object directly, use the <code>edgeRouteRequestHeadersModule</code> property of an <code>Ngrok</code> client object instead. */
1130
+ public constructor(httpClient: Wretcher) {
1131
+ this.httpClient = httpClient;
1132
+ }
1133
+ public replace(
1134
+ arg: datatypes.EdgeRouteRequestHeadersReplace
1135
+ ): Promise<datatypes.EndpointRequestHeaders> {
1136
+ return this.httpClient
1137
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/request_headers`)
1138
+ .put(util.serializeArgument(arg))
1139
+ .json(payload => util.deserializeResult(payload))
1140
+ .then(f => f, util.onRejected);
1141
+ }
1142
+
1143
+ public get(
1144
+ arg: datatypes.EdgeRouteItem
1145
+ ): Promise<datatypes.EndpointRequestHeaders> {
1146
+ return this.httpClient
1147
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/request_headers`)
1148
+ .get()
1149
+ .json(payload => util.deserializeResult(payload))
1150
+ .then(f => f, util.onRejected);
1151
+ }
1152
+
1153
+ public delete(arg: datatypes.EdgeRouteItem): Promise<void> {
1154
+ return this.httpClient
1155
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/request_headers`)
1156
+ .delete()
1157
+ .json(payload => util.deserializeResult(payload))
1158
+ .then(f => f, util.onRejected);
1159
+ }
1160
+ }
1161
+
1162
+ export class EdgeRouteResponseHeadersModule {
1163
+ private httpClient: Wretcher;
1164
+
1165
+ /** Do not construct this object directly, use the <code>edgeRouteResponseHeadersModule</code> property of an <code>Ngrok</code> client object instead. */
1166
+ public constructor(httpClient: Wretcher) {
1167
+ this.httpClient = httpClient;
1168
+ }
1169
+ public replace(
1170
+ arg: datatypes.EdgeRouteResponseHeadersReplace
1171
+ ): Promise<datatypes.EndpointResponseHeaders> {
1172
+ return this.httpClient
1173
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/response_headers`)
1174
+ .put(util.serializeArgument(arg))
1175
+ .json(payload => util.deserializeResult(payload))
1176
+ .then(f => f, util.onRejected);
1177
+ }
1178
+
1179
+ public get(
1180
+ arg: datatypes.EdgeRouteItem
1181
+ ): Promise<datatypes.EndpointResponseHeaders> {
1182
+ return this.httpClient
1183
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/response_headers`)
1184
+ .get()
1185
+ .json(payload => util.deserializeResult(payload))
1186
+ .then(f => f, util.onRejected);
1187
+ }
1188
+
1189
+ public delete(arg: datatypes.EdgeRouteItem): Promise<void> {
1190
+ return this.httpClient
1191
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/response_headers`)
1192
+ .delete()
1193
+ .json(payload => util.deserializeResult(payload))
1194
+ .then(f => f, util.onRejected);
1195
+ }
1196
+ }
1197
+
1198
+ export class EdgeRouteCompressionModule {
1199
+ private httpClient: Wretcher;
1200
+
1201
+ /** Do not construct this object directly, use the <code>edgeRouteCompressionModule</code> property of an <code>Ngrok</code> client object instead. */
1202
+ public constructor(httpClient: Wretcher) {
1203
+ this.httpClient = httpClient;
1204
+ }
1205
+ public replace(
1206
+ arg: datatypes.EdgeRouteCompressionReplace
1207
+ ): Promise<datatypes.EndpointCompression> {
1208
+ return this.httpClient
1209
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/compression`)
1210
+ .put(util.serializeArgument(arg))
1211
+ .json(payload => util.deserializeResult(payload))
1212
+ .then(f => f, util.onRejected);
1213
+ }
1214
+
1215
+ public get(
1216
+ arg: datatypes.EdgeRouteItem
1217
+ ): Promise<datatypes.EndpointCompression> {
1218
+ return this.httpClient
1219
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/compression`)
1220
+ .get()
1221
+ .json(payload => util.deserializeResult(payload))
1222
+ .then(f => f, util.onRejected);
1223
+ }
1224
+
1225
+ public delete(arg: datatypes.EdgeRouteItem): Promise<void> {
1226
+ return this.httpClient
1227
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/compression`)
1228
+ .delete()
1229
+ .json(payload => util.deserializeResult(payload))
1230
+ .then(f => f, util.onRejected);
1231
+ }
1232
+ }
1233
+
1234
+ export class EdgeRouteCircuitBreakerModule {
1235
+ private httpClient: Wretcher;
1236
+
1237
+ /** Do not construct this object directly, use the <code>edgeRouteCircuitBreakerModule</code> property of an <code>Ngrok</code> client object instead. */
1238
+ public constructor(httpClient: Wretcher) {
1239
+ this.httpClient = httpClient;
1240
+ }
1241
+ public replace(
1242
+ arg: datatypes.EdgeRouteCircuitBreakerReplace
1243
+ ): Promise<datatypes.EndpointCircuitBreaker> {
1244
+ return this.httpClient
1245
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/circuit_breaker`)
1246
+ .put(util.serializeArgument(arg))
1247
+ .json(payload => util.deserializeResult(payload))
1248
+ .then(f => f, util.onRejected);
1249
+ }
1250
+
1251
+ public get(
1252
+ arg: datatypes.EdgeRouteItem
1253
+ ): Promise<datatypes.EndpointCircuitBreaker> {
1254
+ return this.httpClient
1255
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/circuit_breaker`)
1256
+ .get()
1257
+ .json(payload => util.deserializeResult(payload))
1258
+ .then(f => f, util.onRejected);
1259
+ }
1260
+
1261
+ public delete(arg: datatypes.EdgeRouteItem): Promise<void> {
1262
+ return this.httpClient
1263
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/circuit_breaker`)
1264
+ .delete()
1265
+ .json(payload => util.deserializeResult(payload))
1266
+ .then(f => f, util.onRejected);
1267
+ }
1268
+ }
1269
+
1270
+ export class EdgeRouteWebhookVerificationModule {
1271
+ private httpClient: Wretcher;
1272
+
1273
+ /** Do not construct this object directly, use the <code>edgeRouteWebhookVerificationModule</code> property of an <code>Ngrok</code> client object instead. */
1274
+ public constructor(httpClient: Wretcher) {
1275
+ this.httpClient = httpClient;
1276
+ }
1277
+ public replace(
1278
+ arg: datatypes.EdgeRouteWebhookVerificationReplace
1279
+ ): Promise<datatypes.EndpointWebhookValidation> {
1280
+ return this.httpClient
1281
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/webhook_verification`)
1282
+ .put(util.serializeArgument(arg))
1283
+ .json(payload => util.deserializeResult(payload))
1284
+ .then(f => f, util.onRejected);
1285
+ }
1286
+
1287
+ public get(
1288
+ arg: datatypes.EdgeRouteItem
1289
+ ): Promise<datatypes.EndpointWebhookValidation> {
1290
+ return this.httpClient
1291
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/webhook_verification`)
1292
+ .get()
1293
+ .json(payload => util.deserializeResult(payload))
1294
+ .then(f => f, util.onRejected);
1295
+ }
1296
+
1297
+ public delete(arg: datatypes.EdgeRouteItem): Promise<void> {
1298
+ return this.httpClient
1299
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/webhook_verification`)
1300
+ .delete()
1301
+ .json(payload => util.deserializeResult(payload))
1302
+ .then(f => f, util.onRejected);
1303
+ }
1304
+ }
1305
+
1306
+ export class EdgeRouteOAuthModule {
1307
+ private httpClient: Wretcher;
1308
+
1309
+ /** Do not construct this object directly, use the <code>edgeRouteOAuthModule</code> property of an <code>Ngrok</code> client object instead. */
1310
+ public constructor(httpClient: Wretcher) {
1311
+ this.httpClient = httpClient;
1312
+ }
1313
+ public replace(
1314
+ arg: datatypes.EdgeRouteOAuthReplace
1315
+ ): Promise<datatypes.EndpointOAuth> {
1316
+ return this.httpClient
1317
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/oauth`)
1318
+ .put(util.serializeArgument(arg))
1319
+ .json(payload => util.deserializeResult(payload))
1320
+ .then(f => f, util.onRejected);
1321
+ }
1322
+
1323
+ public get(arg: datatypes.EdgeRouteItem): Promise<datatypes.EndpointOAuth> {
1324
+ return this.httpClient
1325
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/oauth`)
1326
+ .get()
1327
+ .json(payload => util.deserializeResult(payload))
1328
+ .then(f => f, util.onRejected);
1329
+ }
1330
+
1331
+ public delete(arg: datatypes.EdgeRouteItem): Promise<void> {
1332
+ return this.httpClient
1333
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/oauth`)
1334
+ .delete()
1335
+ .json(payload => util.deserializeResult(payload))
1336
+ .then(f => f, util.onRejected);
1337
+ }
1338
+ }
1339
+
1340
+ export class EdgeRouteSAMLModule {
1341
+ private httpClient: Wretcher;
1342
+
1343
+ /** Do not construct this object directly, use the <code>edgeRouteSamlModule</code> property of an <code>Ngrok</code> client object instead. */
1344
+ public constructor(httpClient: Wretcher) {
1345
+ this.httpClient = httpClient;
1346
+ }
1347
+ public replace(
1348
+ arg: datatypes.EdgeRouteSAMLReplace
1349
+ ): Promise<datatypes.EndpointSAML> {
1350
+ return this.httpClient
1351
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/saml`)
1352
+ .put(util.serializeArgument(arg))
1353
+ .json(payload => util.deserializeResult(payload))
1354
+ .then(f => f, util.onRejected);
1355
+ }
1356
+
1357
+ public get(arg: datatypes.EdgeRouteItem): Promise<datatypes.EndpointSAML> {
1358
+ return this.httpClient
1359
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/saml`)
1360
+ .get()
1361
+ .json(payload => util.deserializeResult(payload))
1362
+ .then(f => f, util.onRejected);
1363
+ }
1364
+
1365
+ public delete(arg: datatypes.EdgeRouteItem): Promise<void> {
1366
+ return this.httpClient
1367
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/saml`)
1368
+ .delete()
1369
+ .json(payload => util.deserializeResult(payload))
1370
+ .then(f => f, util.onRejected);
1371
+ }
1372
+ }
1373
+
1374
+ export class EdgeRouteOIDCModule {
1375
+ private httpClient: Wretcher;
1376
+
1377
+ /** Do not construct this object directly, use the <code>edgeRouteOidcModule</code> property of an <code>Ngrok</code> client object instead. */
1378
+ public constructor(httpClient: Wretcher) {
1379
+ this.httpClient = httpClient;
1380
+ }
1381
+ public replace(
1382
+ arg: datatypes.EdgeRouteOIDCReplace
1383
+ ): Promise<datatypes.EndpointOIDC> {
1384
+ return this.httpClient
1385
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/oidc`)
1386
+ .put(util.serializeArgument(arg))
1387
+ .json(payload => util.deserializeResult(payload))
1388
+ .then(f => f, util.onRejected);
1389
+ }
1390
+
1391
+ public get(arg: datatypes.EdgeRouteItem): Promise<datatypes.EndpointOIDC> {
1392
+ return this.httpClient
1393
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/oidc`)
1394
+ .get()
1395
+ .json(payload => util.deserializeResult(payload))
1396
+ .then(f => f, util.onRejected);
1397
+ }
1398
+
1399
+ public delete(arg: datatypes.EdgeRouteItem): Promise<void> {
1400
+ return this.httpClient
1401
+ .url(`/edges/https/${arg.edgeId}/routes/${arg.id}/oidc`)
1402
+ .delete()
1403
+ .json(payload => util.deserializeResult(payload))
1404
+ .then(f => f, util.onRejected);
1405
+ }
1406
+ }
1407
+
1408
+ export class EdgeRouteWebsocketTCPConverterModule {
1409
+ private httpClient: Wretcher;
1410
+
1411
+ /** Do not construct this object directly, use the <code>edgeRouteWebsocketTcpConverterModule</code> property of an <code>Ngrok</code> client object instead. */
1412
+ public constructor(httpClient: Wretcher) {
1413
+ this.httpClient = httpClient;
1414
+ }
1415
+ public replace(
1416
+ arg: datatypes.EdgeRouteWebsocketTCPConverterReplace
1417
+ ): Promise<datatypes.EndpointWebsocketTCPConverter> {
1418
+ return this.httpClient
1419
+ .url(
1420
+ `/edges/https/${arg.edgeId}/routes/${arg.id}/websocket_tcp_converter`
1421
+ )
1422
+ .put(util.serializeArgument(arg))
1423
+ .json(payload => util.deserializeResult(payload))
1424
+ .then(f => f, util.onRejected);
1425
+ }
1426
+
1427
+ public get(
1428
+ arg: datatypes.EdgeRouteItem
1429
+ ): Promise<datatypes.EndpointWebsocketTCPConverter> {
1430
+ return this.httpClient
1431
+ .url(
1432
+ `/edges/https/${arg.edgeId}/routes/${arg.id}/websocket_tcp_converter`
1433
+ )
1434
+ .get()
1435
+ .json(payload => util.deserializeResult(payload))
1436
+ .then(f => f, util.onRejected);
1437
+ }
1438
+
1439
+ public delete(arg: datatypes.EdgeRouteItem): Promise<void> {
1440
+ return this.httpClient
1441
+ .url(
1442
+ `/edges/https/${arg.edgeId}/routes/${arg.id}/websocket_tcp_converter`
1443
+ )
1444
+ .delete()
1445
+ .json(payload => util.deserializeResult(payload))
1446
+ .then(f => f, util.onRejected);
1447
+ }
1448
+ }
1449
+
1450
+ export class EdgesTCP {
1451
+ private httpClient: Wretcher;
1452
+
1453
+ /** Do not construct this object directly, use the <code>edgesTcp</code> property of an <code>Ngrok</code> client object instead. */
1454
+ public constructor(httpClient: Wretcher) {
1455
+ this.httpClient = httpClient;
1456
+ }
1457
+ /**
1458
+ * Create a TCP Edge
1459
+ */
1460
+ public create(arg: datatypes.TCPEdgeCreate): Promise<datatypes.TCPEdge> {
1461
+ return this.httpClient
1462
+ .url(`/edges/tcp`)
1463
+ .post(util.serializeArgument(arg))
1464
+ .json(payload => util.deserializeResult(payload))
1465
+ .then(f => f, util.onRejected);
1466
+ }
1467
+
1468
+ /**
1469
+ * Get a TCP Edge by ID
1470
+ */
1471
+ public get(arg: datatypes.Item): Promise<datatypes.TCPEdge> {
1472
+ return this.httpClient
1473
+ .url(`/edges/tcp/${arg.id}`)
1474
+ .get()
1475
+ .json(payload => util.deserializeResult(payload))
1476
+ .then(f => f, util.onRejected);
1477
+ }
1478
+
1479
+ /**
1480
+ * Returns a list of all TCP Edges on this account
1481
+ */
1482
+ public async list(): Promise<Array<datatypes.TCPEdge>> {
1483
+ const array: Array<datatypes.TCPEdge> = [];
1484
+ for await (const item of this._asyncList()) {
1485
+ array.push(item);
1486
+ }
1487
+ return array;
1488
+ }
1489
+ private _pagedList(arg: datatypes.Paging): Promise<datatypes.TCPEdgeList> {
1490
+ return this.httpClient
1491
+ .url(`/edges/tcp`)
1492
+ .query(arg)
1493
+ .get()
1494
+ .json(payload => util.deserializeResult(payload))
1495
+ .then(util.onFulfilled, util.onRejected);
1496
+ }
1497
+ private async *_asyncList() {
1498
+ const limit = '100';
1499
+ let nextPage = 'initial loop';
1500
+ let page: datatypes.Paging = { limit: limit };
1501
+
1502
+ while (nextPage) {
1503
+ const pagedList = await this._pagedList(page);
1504
+ nextPage = pagedList.nextPageUri;
1505
+ const items: datatypes.TCPEdge[] = pagedList.tcpEdges;
1506
+
1507
+ if (nextPage) {
1508
+ page = {
1509
+ beforeId: items[items.length - 1].id,
1510
+ limit: limit,
1511
+ };
1512
+ }
1513
+
1514
+ for (const item of items) {
1515
+ yield item;
1516
+ }
1517
+ }
1518
+ }
1519
+ /**
1520
+ * Updates a TCP Edge by ID. If a module is not specified in the update, it will not be modified. However, each module configuration that is specified will completely replace the existing value. There is no way to delete an existing module via this API, instead use the delete module API.
1521
+ */
1522
+ public update(arg: datatypes.TCPEdgeUpdate): Promise<datatypes.TCPEdge> {
1523
+ return this.httpClient
1524
+ .url(`/edges/tcp/${arg.id}`)
1525
+ .patch(util.serializeArgument(arg))
1526
+ .json(payload => util.deserializeResult(payload))
1527
+ .then(f => f, util.onRejected);
1528
+ }
1529
+
1530
+ /**
1531
+ * Delete a TCP Edge by ID
1532
+ */
1533
+ public delete(arg: datatypes.Item): Promise<void> {
1534
+ return this.httpClient
1535
+ .url(`/edges/tcp/${arg.id}`)
1536
+ .delete()
1537
+ .json(payload => util.deserializeResult(payload))
1538
+ .then(f => f, util.onRejected);
1539
+ }
1540
+ }
1541
+
1542
+ export class TCPEdgeBackendModule {
1543
+ private httpClient: Wretcher;
1544
+
1545
+ /** Do not construct this object directly, use the <code>tcpEdgeBackendModule</code> property of an <code>Ngrok</code> client object instead. */
1546
+ public constructor(httpClient: Wretcher) {
1547
+ this.httpClient = httpClient;
1548
+ }
1549
+ public replace(
1550
+ arg: datatypes.EdgeBackendReplace
1551
+ ): Promise<datatypes.EndpointBackend> {
1552
+ return this.httpClient
1553
+ .url(`/edges/tcp/${arg.id}/backend`)
1554
+ .put(util.serializeArgument(arg))
1555
+ .json(payload => util.deserializeResult(payload))
1556
+ .then(f => f, util.onRejected);
1557
+ }
1558
+
1559
+ public get(arg: datatypes.Item): Promise<datatypes.EndpointBackend> {
1560
+ return this.httpClient
1561
+ .url(`/edges/tcp/${arg.id}/backend`)
1562
+ .get()
1563
+ .json(payload => util.deserializeResult(payload))
1564
+ .then(f => f, util.onRejected);
1565
+ }
1566
+
1567
+ public delete(arg: datatypes.Item): Promise<void> {
1568
+ return this.httpClient
1569
+ .url(`/edges/tcp/${arg.id}/backend`)
1570
+ .delete()
1571
+ .json(payload => util.deserializeResult(payload))
1572
+ .then(f => f, util.onRejected);
1573
+ }
1574
+ }
1575
+
1576
+ export class TCPEdgeIPRestrictionModule {
1577
+ private httpClient: Wretcher;
1578
+
1579
+ /** Do not construct this object directly, use the <code>tcpEdgeIpRestrictionModule</code> property of an <code>Ngrok</code> client object instead. */
1580
+ public constructor(httpClient: Wretcher) {
1581
+ this.httpClient = httpClient;
1582
+ }
1583
+ public replace(
1584
+ arg: datatypes.EdgeIPRestrictionReplace
1585
+ ): Promise<datatypes.EndpointIPPolicy> {
1586
+ return this.httpClient
1587
+ .url(`/edges/tcp/${arg.id}/ip_restriction`)
1588
+ .put(util.serializeArgument(arg))
1589
+ .json(payload => util.deserializeResult(payload))
1590
+ .then(f => f, util.onRejected);
1591
+ }
1592
+
1593
+ public get(arg: datatypes.Item): Promise<datatypes.EndpointIPPolicy> {
1594
+ return this.httpClient
1595
+ .url(`/edges/tcp/${arg.id}/ip_restriction`)
1596
+ .get()
1597
+ .json(payload => util.deserializeResult(payload))
1598
+ .then(f => f, util.onRejected);
1599
+ }
1600
+
1601
+ public delete(arg: datatypes.Item): Promise<void> {
1602
+ return this.httpClient
1603
+ .url(`/edges/tcp/${arg.id}/ip_restriction`)
1604
+ .delete()
1605
+ .json(payload => util.deserializeResult(payload))
1606
+ .then(f => f, util.onRejected);
1607
+ }
1608
+ }
1609
+
1610
+ export class EdgesTLS {
1611
+ private httpClient: Wretcher;
1612
+
1613
+ /** Do not construct this object directly, use the <code>edgesTls</code> property of an <code>Ngrok</code> client object instead. */
1614
+ public constructor(httpClient: Wretcher) {
1615
+ this.httpClient = httpClient;
1616
+ }
1617
+ /**
1618
+ * Create a TLS Edge
1619
+ */
1620
+ public create(arg: datatypes.TLSEdgeCreate): Promise<datatypes.TLSEdge> {
1621
+ return this.httpClient
1622
+ .url(`/edges/tls`)
1623
+ .post(util.serializeArgument(arg))
1624
+ .json(payload => util.deserializeResult(payload))
1625
+ .then(f => f, util.onRejected);
1626
+ }
1627
+
1628
+ /**
1629
+ * Get a TLS Edge by ID
1630
+ */
1631
+ public get(arg: datatypes.Item): Promise<datatypes.TLSEdge> {
1632
+ return this.httpClient
1633
+ .url(`/edges/tls/${arg.id}`)
1634
+ .get()
1635
+ .json(payload => util.deserializeResult(payload))
1636
+ .then(f => f, util.onRejected);
1637
+ }
1638
+
1639
+ /**
1640
+ * Returns a list of all TLS Edges on this account
1641
+ */
1642
+ public async list(): Promise<Array<datatypes.TLSEdge>> {
1643
+ const array: Array<datatypes.TLSEdge> = [];
1644
+ for await (const item of this._asyncList()) {
1645
+ array.push(item);
1646
+ }
1647
+ return array;
1648
+ }
1649
+ private _pagedList(arg: datatypes.Paging): Promise<datatypes.TLSEdgeList> {
1650
+ return this.httpClient
1651
+ .url(`/edges/tls`)
1652
+ .query(arg)
1653
+ .get()
1654
+ .json(payload => util.deserializeResult(payload))
1655
+ .then(util.onFulfilled, util.onRejected);
1656
+ }
1657
+ private async *_asyncList() {
1658
+ const limit = '100';
1659
+ let nextPage = 'initial loop';
1660
+ let page: datatypes.Paging = { limit: limit };
1661
+
1662
+ while (nextPage) {
1663
+ const pagedList = await this._pagedList(page);
1664
+ nextPage = pagedList.nextPageUri;
1665
+ const items: datatypes.TLSEdge[] = pagedList.tlsEdges;
1666
+
1667
+ if (nextPage) {
1668
+ page = {
1669
+ beforeId: items[items.length - 1].id,
1670
+ limit: limit,
1671
+ };
1672
+ }
1673
+
1674
+ for (const item of items) {
1675
+ yield item;
1676
+ }
1677
+ }
1678
+ }
1679
+ /**
1680
+ * Updates a TLS Edge by ID. If a module is not specified in the update, it will not be modified. However, each module configuration that is specified will completely replace the existing value. There is no way to delete an existing module via this API, instead use the delete module API.
1681
+ */
1682
+ public update(arg: datatypes.TLSEdgeUpdate): Promise<datatypes.TLSEdge> {
1683
+ return this.httpClient
1684
+ .url(`/edges/tls/${arg.id}`)
1685
+ .patch(util.serializeArgument(arg))
1686
+ .json(payload => util.deserializeResult(payload))
1687
+ .then(f => f, util.onRejected);
1688
+ }
1689
+
1690
+ /**
1691
+ * Delete a TLS Edge by ID
1692
+ */
1693
+ public delete(arg: datatypes.Item): Promise<void> {
1694
+ return this.httpClient
1695
+ .url(`/edges/tls/${arg.id}`)
1696
+ .delete()
1697
+ .json(payload => util.deserializeResult(payload))
1698
+ .then(f => f, util.onRejected);
1699
+ }
1700
+ }
1701
+
1702
+ export class TLSEdgeBackendModule {
1703
+ private httpClient: Wretcher;
1704
+
1705
+ /** Do not construct this object directly, use the <code>tlsEdgeBackendModule</code> property of an <code>Ngrok</code> client object instead. */
1706
+ public constructor(httpClient: Wretcher) {
1707
+ this.httpClient = httpClient;
1708
+ }
1709
+ public replace(
1710
+ arg: datatypes.EdgeBackendReplace
1711
+ ): Promise<datatypes.EndpointBackend> {
1712
+ return this.httpClient
1713
+ .url(`/edges/tls/${arg.id}/backend`)
1714
+ .put(util.serializeArgument(arg))
1715
+ .json(payload => util.deserializeResult(payload))
1716
+ .then(f => f, util.onRejected);
1717
+ }
1718
+
1719
+ public get(arg: datatypes.Item): Promise<datatypes.EndpointBackend> {
1720
+ return this.httpClient
1721
+ .url(`/edges/tls/${arg.id}/backend`)
1722
+ .get()
1723
+ .json(payload => util.deserializeResult(payload))
1724
+ .then(f => f, util.onRejected);
1725
+ }
1726
+
1727
+ public delete(arg: datatypes.Item): Promise<void> {
1728
+ return this.httpClient
1729
+ .url(`/edges/tls/${arg.id}/backend`)
1730
+ .delete()
1731
+ .json(payload => util.deserializeResult(payload))
1732
+ .then(f => f, util.onRejected);
1733
+ }
1734
+ }
1735
+
1736
+ export class TLSEdgeIPRestrictionModule {
1737
+ private httpClient: Wretcher;
1738
+
1739
+ /** Do not construct this object directly, use the <code>tlsEdgeIpRestrictionModule</code> property of an <code>Ngrok</code> client object instead. */
1740
+ public constructor(httpClient: Wretcher) {
1741
+ this.httpClient = httpClient;
1742
+ }
1743
+ public replace(
1744
+ arg: datatypes.EdgeIPRestrictionReplace
1745
+ ): Promise<datatypes.EndpointIPPolicy> {
1746
+ return this.httpClient
1747
+ .url(`/edges/tls/${arg.id}/ip_restriction`)
1748
+ .put(util.serializeArgument(arg))
1749
+ .json(payload => util.deserializeResult(payload))
1750
+ .then(f => f, util.onRejected);
1751
+ }
1752
+
1753
+ public get(arg: datatypes.Item): Promise<datatypes.EndpointIPPolicy> {
1754
+ return this.httpClient
1755
+ .url(`/edges/tls/${arg.id}/ip_restriction`)
1756
+ .get()
1757
+ .json(payload => util.deserializeResult(payload))
1758
+ .then(f => f, util.onRejected);
1759
+ }
1760
+
1761
+ public delete(arg: datatypes.Item): Promise<void> {
1762
+ return this.httpClient
1763
+ .url(`/edges/tls/${arg.id}/ip_restriction`)
1764
+ .delete()
1765
+ .json(payload => util.deserializeResult(payload))
1766
+ .then(f => f, util.onRejected);
1767
+ }
1768
+ }
1769
+
1770
+ export class TLSEdgeMutualTLSModule {
1771
+ private httpClient: Wretcher;
1772
+
1773
+ /** Do not construct this object directly, use the <code>tlsEdgeMutualTlsModule</code> property of an <code>Ngrok</code> client object instead. */
1774
+ public constructor(httpClient: Wretcher) {
1775
+ this.httpClient = httpClient;
1776
+ }
1777
+ public replace(
1778
+ arg: datatypes.EdgeMutualTLSReplace
1779
+ ): Promise<datatypes.EndpointMutualTLS> {
1780
+ return this.httpClient
1781
+ .url(`/edges/tls/${arg.id}/mutual_tls`)
1782
+ .put(util.serializeArgument(arg))
1783
+ .json(payload => util.deserializeResult(payload))
1784
+ .then(f => f, util.onRejected);
1785
+ }
1786
+
1787
+ public get(arg: datatypes.Item): Promise<datatypes.EndpointMutualTLS> {
1788
+ return this.httpClient
1789
+ .url(`/edges/tls/${arg.id}/mutual_tls`)
1790
+ .get()
1791
+ .json(payload => util.deserializeResult(payload))
1792
+ .then(f => f, util.onRejected);
1793
+ }
1794
+
1795
+ public delete(arg: datatypes.Item): Promise<void> {
1796
+ return this.httpClient
1797
+ .url(`/edges/tls/${arg.id}/mutual_tls`)
1798
+ .delete()
1799
+ .json(payload => util.deserializeResult(payload))
1800
+ .then(f => f, util.onRejected);
1801
+ }
1802
+ }
1803
+
1804
+ export class TLSEdgeTLSTerminationModule {
1805
+ private httpClient: Wretcher;
1806
+
1807
+ /** Do not construct this object directly, use the <code>tlsEdgeTlsTerminationModule</code> property of an <code>Ngrok</code> client object instead. */
1808
+ public constructor(httpClient: Wretcher) {
1809
+ this.httpClient = httpClient;
1810
+ }
1811
+ public replace(
1812
+ arg: datatypes.EdgeTLSTerminationReplace
1813
+ ): Promise<datatypes.EndpointTLSTermination> {
1814
+ return this.httpClient
1815
+ .url(`/edges/tls/${arg.id}/tls_termination`)
1816
+ .put(util.serializeArgument(arg))
1817
+ .json(payload => util.deserializeResult(payload))
1818
+ .then(f => f, util.onRejected);
1819
+ }
1820
+
1821
+ public get(arg: datatypes.Item): Promise<datatypes.EndpointTLSTermination> {
1822
+ return this.httpClient
1823
+ .url(`/edges/tls/${arg.id}/tls_termination`)
1824
+ .get()
1825
+ .json(payload => util.deserializeResult(payload))
1826
+ .then(f => f, util.onRejected);
1827
+ }
1828
+
1829
+ public delete(arg: datatypes.Item): Promise<void> {
1830
+ return this.httpClient
1831
+ .url(`/edges/tls/${arg.id}/tls_termination`)
1832
+ .delete()
1833
+ .json(payload => util.deserializeResult(payload))
1834
+ .then(f => f, util.onRejected);
1835
+ }
1836
+ }
1837
+
1838
+ /**
1839
+ * Endpoints provides an API for querying the endpoint objects
1840
+ which define what tunnel or edge is used to serve a hostport.
1841
+ Only active endpoints associated with a tunnel or backend are returned.
1842
+ */
1843
+ export class Endpoints {
1844
+ private httpClient: Wretcher;
1845
+
1846
+ /** Do not construct this object directly, use the <code>endpoints</code> property of an <code>Ngrok</code> client object instead. */
1847
+ public constructor(httpClient: Wretcher) {
1848
+ this.httpClient = httpClient;
1849
+ }
1850
+ /**
1851
+ * List all active endpoints on the account
1852
+ */
1853
+ public async list(): Promise<Array<datatypes.Endpoint>> {
1854
+ const array: Array<datatypes.Endpoint> = [];
1855
+ for await (const item of this._asyncList()) {
1856
+ array.push(item);
1857
+ }
1858
+ return array;
1859
+ }
1860
+ private _pagedList(arg: datatypes.Paging): Promise<datatypes.EndpointList> {
1861
+ return this.httpClient
1862
+ .url(`/endpoints`)
1863
+ .query(arg)
1864
+ .get()
1865
+ .json(payload => util.deserializeResult(payload))
1866
+ .then(util.onFulfilled, util.onRejected);
1867
+ }
1868
+ private async *_asyncList() {
1869
+ const limit = '100';
1870
+ let nextPage = 'initial loop';
1871
+ let page: datatypes.Paging = { limit: limit };
1872
+
1873
+ while (nextPage) {
1874
+ const pagedList = await this._pagedList(page);
1875
+ nextPage = pagedList.nextPageUri;
1876
+ const items: datatypes.Endpoint[] = pagedList.endpoints;
1877
+
1878
+ if (nextPage) {
1879
+ page = {
1880
+ beforeId: items[items.length - 1].id,
1881
+ limit: limit,
1882
+ };
1883
+ }
1884
+
1885
+ for (const item of items) {
1886
+ yield item;
1887
+ }
1888
+ }
1889
+ }
1890
+ /**
1891
+ * Get the status of an endpoint by ID
1892
+ */
1893
+ public get(arg: datatypes.Item): Promise<datatypes.Endpoint> {
1894
+ return this.httpClient
1895
+ .url(`/endpoints/${arg.id}`)
1896
+ .get()
1897
+ .json(payload => util.deserializeResult(payload))
1898
+ .then(f => f, util.onRejected);
1899
+ }
1900
+ }
1901
+
1902
+ export class EventDestinations {
1903
+ private httpClient: Wretcher;
1904
+
1905
+ /** Do not construct this object directly, use the <code>eventDestinations</code> property of an <code>Ngrok</code> client object instead. */
1906
+ public constructor(httpClient: Wretcher) {
1907
+ this.httpClient = httpClient;
1908
+ }
1909
+ /**
1910
+ * Create a new Event Destination. It will not apply to anything until it is associated with an Event Stream, and that Event Stream is associated with an Endpoint Config.
1911
+ */
1912
+ public create(
1913
+ arg: datatypes.EventDestinationCreate
1914
+ ): Promise<datatypes.EventDestination> {
1915
+ return this.httpClient
1916
+ .url(`/event_destinations`)
1917
+ .post(util.serializeArgument(arg))
1918
+ .json(payload => util.deserializeResult(payload))
1919
+ .then(f => f, util.onRejected);
1920
+ }
1921
+
1922
+ /**
1923
+ * Delete an Event Destination. If the Event Destination is still referenced by an Event Subscription.
1924
+ */
1925
+ public delete(arg: datatypes.Item): Promise<void> {
1926
+ return this.httpClient
1927
+ .url(`/event_destinations/${arg.id}`)
1928
+ .delete()
1929
+ .json(payload => util.deserializeResult(payload))
1930
+ .then(f => f, util.onRejected);
1931
+ }
1932
+
1933
+ /**
1934
+ * Get detailed information about an Event Destination by ID.
1935
+ */
1936
+ public get(arg: datatypes.Item): Promise<datatypes.EventDestination> {
1937
+ return this.httpClient
1938
+ .url(`/event_destinations/${arg.id}`)
1939
+ .get()
1940
+ .json(payload => util.deserializeResult(payload))
1941
+ .then(f => f, util.onRejected);
1942
+ }
1943
+
1944
+ /**
1945
+ * List all Event Destinations on this account.
1946
+ */
1947
+ public async list(): Promise<Array<datatypes.EventDestination>> {
1948
+ const array: Array<datatypes.EventDestination> = [];
1949
+ for await (const item of this._asyncList()) {
1950
+ array.push(item);
1951
+ }
1952
+ return array;
1953
+ }
1954
+ private _pagedList(
1955
+ arg: datatypes.Paging
1956
+ ): Promise<datatypes.EventDestinationList> {
1957
+ return this.httpClient
1958
+ .url(`/event_destinations`)
1959
+ .query(arg)
1960
+ .get()
1961
+ .json(payload => util.deserializeResult(payload))
1962
+ .then(util.onFulfilled, util.onRejected);
1963
+ }
1964
+ private async *_asyncList() {
1965
+ const limit = '100';
1966
+ let nextPage = 'initial loop';
1967
+ let page: datatypes.Paging = { limit: limit };
1968
+
1969
+ while (nextPage) {
1970
+ const pagedList = await this._pagedList(page);
1971
+ nextPage = pagedList.nextPageUri;
1972
+ const items: datatypes.EventDestination[] = pagedList.eventDestinations;
1973
+
1974
+ if (nextPage) {
1975
+ page = {
1976
+ beforeId: items[items.length - 1].id,
1977
+ limit: limit,
1978
+ };
1979
+ }
1980
+
1981
+ for (const item of items) {
1982
+ yield item;
1983
+ }
1984
+ }
1985
+ }
1986
+ /**
1987
+ * Update attributes of an Event Destination.
1988
+ */
1989
+ public update(
1990
+ arg: datatypes.EventDestinationUpdate
1991
+ ): Promise<datatypes.EventDestination> {
1992
+ return this.httpClient
1993
+ .url(`/event_destinations/${arg.id}`)
1994
+ .patch(util.serializeArgument(arg))
1995
+ .json(payload => util.deserializeResult(payload))
1996
+ .then(f => f, util.onRejected);
1997
+ }
1998
+ }
1999
+
2000
+ export class EventSubscriptions {
2001
+ private httpClient: Wretcher;
2002
+
2003
+ /** Do not construct this object directly, use the <code>eventSubscriptions</code> property of an <code>Ngrok</code> client object instead. */
2004
+ public constructor(httpClient: Wretcher) {
2005
+ this.httpClient = httpClient;
2006
+ }
2007
+ /**
2008
+ * Create an Event Subscription.
2009
+ */
2010
+ public create(
2011
+ arg: datatypes.EventSubscriptionCreate
2012
+ ): Promise<datatypes.EventSubscription> {
2013
+ return this.httpClient
2014
+ .url(`/event_subscriptions`)
2015
+ .post(util.serializeArgument(arg))
2016
+ .json(payload => util.deserializeResult(payload))
2017
+ .then(f => f, util.onRejected);
2018
+ }
2019
+
2020
+ /**
2021
+ * Delete an Event Subscription.
2022
+ */
2023
+ public delete(arg: datatypes.Item): Promise<void> {
2024
+ return this.httpClient
2025
+ .url(`/event_subscriptions/${arg.id}`)
2026
+ .delete()
2027
+ .json(payload => util.deserializeResult(payload))
2028
+ .then(f => f, util.onRejected);
2029
+ }
2030
+
2031
+ /**
2032
+ * Get an Event Subscription by ID.
2033
+ */
2034
+ public get(arg: datatypes.Item): Promise<datatypes.EventSubscription> {
2035
+ return this.httpClient
2036
+ .url(`/event_subscriptions/${arg.id}`)
2037
+ .get()
2038
+ .json(payload => util.deserializeResult(payload))
2039
+ .then(f => f, util.onRejected);
2040
+ }
2041
+
2042
+ /**
2043
+ * List this Account's Event Subscriptions.
2044
+ */
2045
+ public async list(): Promise<Array<datatypes.EventSubscription>> {
2046
+ const array: Array<datatypes.EventSubscription> = [];
2047
+ for await (const item of this._asyncList()) {
2048
+ array.push(item);
2049
+ }
2050
+ return array;
2051
+ }
2052
+ private _pagedList(
2053
+ arg: datatypes.Paging
2054
+ ): Promise<datatypes.EventSubscriptionList> {
2055
+ return this.httpClient
2056
+ .url(`/event_subscriptions`)
2057
+ .query(arg)
2058
+ .get()
2059
+ .json(payload => util.deserializeResult(payload))
2060
+ .then(util.onFulfilled, util.onRejected);
2061
+ }
2062
+ private async *_asyncList() {
2063
+ const limit = '100';
2064
+ let nextPage = 'initial loop';
2065
+ let page: datatypes.Paging = { limit: limit };
2066
+
2067
+ while (nextPage) {
2068
+ const pagedList = await this._pagedList(page);
2069
+ nextPage = pagedList.nextPageUri;
2070
+ const items: datatypes.EventSubscription[] = pagedList.eventSubscriptions;
2071
+
2072
+ if (nextPage) {
2073
+ page = {
2074
+ beforeId: items[items.length - 1].id,
2075
+ limit: limit,
2076
+ };
2077
+ }
2078
+
2079
+ for (const item of items) {
2080
+ yield item;
2081
+ }
2082
+ }
2083
+ }
2084
+ /**
2085
+ * Update an Event Subscription.
2086
+ */
2087
+ public update(
2088
+ arg: datatypes.EventSubscriptionUpdate
2089
+ ): Promise<datatypes.EventSubscription> {
2090
+ return this.httpClient
2091
+ .url(`/event_subscriptions/${arg.id}`)
2092
+ .patch(util.serializeArgument(arg))
2093
+ .json(payload => util.deserializeResult(payload))
2094
+ .then(f => f, util.onRejected);
2095
+ }
2096
+ }
2097
+
2098
+ export class EventSources {
2099
+ private httpClient: Wretcher;
2100
+
2101
+ /** Do not construct this object directly, use the <code>eventSources</code> property of an <code>Ngrok</code> client object instead. */
2102
+ public constructor(httpClient: Wretcher) {
2103
+ this.httpClient = httpClient;
2104
+ }
2105
+ /**
2106
+ * Add an additional type for which this event subscription will trigger
2107
+ */
2108
+ public create(
2109
+ arg: datatypes.EventSourceCreate
2110
+ ): Promise<datatypes.EventSource> {
2111
+ return this.httpClient
2112
+ .url(`/event_subscriptions/${arg.subscriptionId}/sources`)
2113
+ .post(util.serializeArgument(arg))
2114
+ .json(payload => util.deserializeResult(payload))
2115
+ .then(f => f, util.onRejected);
2116
+ }
2117
+
2118
+ /**
2119
+ * Remove a type for which this event subscription will trigger
2120
+ */
2121
+ public delete(arg: datatypes.EventSourceItem): Promise<void> {
2122
+ return this.httpClient
2123
+ .url(`/event_subscriptions/${arg.subscriptionId}/sources/${arg.type}`)
2124
+ .delete()
2125
+ .json(payload => util.deserializeResult(payload))
2126
+ .then(f => f, util.onRejected);
2127
+ }
2128
+
2129
+ /**
2130
+ * Get the details for a given type that triggers for the given event subscription
2131
+ */
2132
+ public get(arg: datatypes.EventSourceItem): Promise<datatypes.EventSource> {
2133
+ return this.httpClient
2134
+ .url(`/event_subscriptions/${arg.subscriptionId}/sources/${arg.type}`)
2135
+ .get()
2136
+ .json(payload => util.deserializeResult(payload))
2137
+ .then(f => f, util.onRejected);
2138
+ }
2139
+
2140
+ /**
2141
+ * List the types for which this event subscription will trigger
2142
+ */
2143
+ public list(
2144
+ arg: datatypes.EventSourcePaging
2145
+ ): Promise<datatypes.EventSourceList> {
2146
+ return this.httpClient
2147
+ .url(`/event_subscriptions/${arg.subscriptionId}/sources`)
2148
+ .get()
2149
+ .json(payload => util.deserializeResult(payload))
2150
+ .then(f => f, util.onRejected);
2151
+ }
2152
+
2153
+ /**
2154
+ * Update the type for which this event subscription will trigger
2155
+ */
2156
+ public update(
2157
+ arg: datatypes.EventSourceUpdate
2158
+ ): Promise<datatypes.EventSource> {
2159
+ return this.httpClient
2160
+ .url(`/event_subscriptions/${arg.subscriptionId}/sources/${arg.type}`)
2161
+ .patch(util.serializeArgument(arg))
2162
+ .json(payload => util.deserializeResult(payload))
2163
+ .then(f => f, util.onRejected);
2164
+ }
2165
+ }
2166
+
2167
+ /**
2168
+ * IP Policies are reusable groups of CIDR ranges with an `allow` or `deny`
2169
+ action. They can be attached to endpoints via the Endpoint Configuration IP
2170
+ Policy module. They can also be used with IP Restrictions to control source
2171
+ IP ranges that can start tunnel sessions and connect to the API and dashboard.
2172
+ */
2173
+ export class IPPolicies {
2174
+ private httpClient: Wretcher;
2175
+
2176
+ /** Do not construct this object directly, use the <code>ipPolicies</code> property of an <code>Ngrok</code> client object instead. */
2177
+ public constructor(httpClient: Wretcher) {
2178
+ this.httpClient = httpClient;
2179
+ }
2180
+ /**
2181
+ * Create a new IP policy. It will not apply to any traffic until you associate to a traffic source via an endpoint configuration or IP restriction.
2182
+ */
2183
+ public create(arg: datatypes.IPPolicyCreate): Promise<datatypes.IPPolicy> {
2184
+ return this.httpClient
2185
+ .url(`/ip_policies`)
2186
+ .post(util.serializeArgument(arg))
2187
+ .json(payload => util.deserializeResult(payload))
2188
+ .then(f => f, util.onRejected);
2189
+ }
2190
+
2191
+ /**
2192
+ * Delete an IP policy. If the IP policy is referenced by another object for the purposes of traffic restriction it will be treated as if the IP policy remains but has zero rules.
2193
+ */
2194
+ public delete(arg: datatypes.Item): Promise<void> {
2195
+ return this.httpClient
2196
+ .url(`/ip_policies/${arg.id}`)
2197
+ .delete()
2198
+ .json(payload => util.deserializeResult(payload))
2199
+ .then(f => f, util.onRejected);
2200
+ }
2201
+
2202
+ /**
2203
+ * Get detailed information about an IP policy by ID.
2204
+ */
2205
+ public get(arg: datatypes.Item): Promise<datatypes.IPPolicy> {
2206
+ return this.httpClient
2207
+ .url(`/ip_policies/${arg.id}`)
2208
+ .get()
2209
+ .json(payload => util.deserializeResult(payload))
2210
+ .then(f => f, util.onRejected);
2211
+ }
2212
+
2213
+ /**
2214
+ * List all IP policies on this account
2215
+ */
2216
+ public async list(): Promise<Array<datatypes.IPPolicy>> {
2217
+ const array: Array<datatypes.IPPolicy> = [];
2218
+ for await (const item of this._asyncList()) {
2219
+ array.push(item);
2220
+ }
2221
+ return array;
2222
+ }
2223
+ private _pagedList(arg: datatypes.Paging): Promise<datatypes.IPPolicyList> {
2224
+ return this.httpClient
2225
+ .url(`/ip_policies`)
2226
+ .query(arg)
2227
+ .get()
2228
+ .json(payload => util.deserializeResult(payload))
2229
+ .then(util.onFulfilled, util.onRejected);
2230
+ }
2231
+ private async *_asyncList() {
2232
+ const limit = '100';
2233
+ let nextPage = 'initial loop';
2234
+ let page: datatypes.Paging = { limit: limit };
2235
+
2236
+ while (nextPage) {
2237
+ const pagedList = await this._pagedList(page);
2238
+ nextPage = pagedList.nextPageUri;
2239
+ const items: datatypes.IPPolicy[] = pagedList.ipPolicies;
2240
+
2241
+ if (nextPage) {
2242
+ page = {
2243
+ beforeId: items[items.length - 1].id,
2244
+ limit: limit,
2245
+ };
2246
+ }
2247
+
2248
+ for (const item of items) {
2249
+ yield item;
2250
+ }
2251
+ }
2252
+ }
2253
+ /**
2254
+ * Update attributes of an IP policy by ID
2255
+ */
2256
+ public update(arg: datatypes.IPPolicyUpdate): Promise<datatypes.IPPolicy> {
2257
+ return this.httpClient
2258
+ .url(`/ip_policies/${arg.id}`)
2259
+ .patch(util.serializeArgument(arg))
2260
+ .json(payload => util.deserializeResult(payload))
2261
+ .then(f => f, util.onRejected);
2262
+ }
2263
+ }
2264
+
2265
+ /**
2266
+ * IP Policy Rules are the IPv4 or IPv6 CIDRs entries that
2267
+ make up an IP Policy.
2268
+ */
2269
+ export class IPPolicyRules {
2270
+ private httpClient: Wretcher;
2271
+
2272
+ /** Do not construct this object directly, use the <code>ipPolicyRules</code> property of an <code>Ngrok</code> client object instead. */
2273
+ public constructor(httpClient: Wretcher) {
2274
+ this.httpClient = httpClient;
2275
+ }
2276
+ /**
2277
+ * Create a new IP policy rule attached to an IP Policy.
2278
+ */
2279
+ public create(
2280
+ arg: datatypes.IPPolicyRuleCreate
2281
+ ): Promise<datatypes.IPPolicyRule> {
2282
+ return this.httpClient
2283
+ .url(`/ip_policy_rules`)
2284
+ .post(util.serializeArgument(arg))
2285
+ .json(payload => util.deserializeResult(payload))
2286
+ .then(f => f, util.onRejected);
2287
+ }
2288
+
2289
+ /**
2290
+ * Delete an IP policy rule.
2291
+ */
2292
+ public delete(arg: datatypes.Item): Promise<void> {
2293
+ return this.httpClient
2294
+ .url(`/ip_policy_rules/${arg.id}`)
2295
+ .delete()
2296
+ .json(payload => util.deserializeResult(payload))
2297
+ .then(f => f, util.onRejected);
2298
+ }
2299
+
2300
+ /**
2301
+ * Get detailed information about an IP policy rule by ID.
2302
+ */
2303
+ public get(arg: datatypes.Item): Promise<datatypes.IPPolicyRule> {
2304
+ return this.httpClient
2305
+ .url(`/ip_policy_rules/${arg.id}`)
2306
+ .get()
2307
+ .json(payload => util.deserializeResult(payload))
2308
+ .then(f => f, util.onRejected);
2309
+ }
2310
+
2311
+ /**
2312
+ * List all IP policy rules on this account
2313
+ */
2314
+ public async list(): Promise<Array<datatypes.IPPolicyRule>> {
2315
+ const array: Array<datatypes.IPPolicyRule> = [];
2316
+ for await (const item of this._asyncList()) {
2317
+ array.push(item);
2318
+ }
2319
+ return array;
2320
+ }
2321
+ private _pagedList(
2322
+ arg: datatypes.Paging
2323
+ ): Promise<datatypes.IPPolicyRuleList> {
2324
+ return this.httpClient
2325
+ .url(`/ip_policy_rules`)
2326
+ .query(arg)
2327
+ .get()
2328
+ .json(payload => util.deserializeResult(payload))
2329
+ .then(util.onFulfilled, util.onRejected);
2330
+ }
2331
+ private async *_asyncList() {
2332
+ const limit = '100';
2333
+ let nextPage = 'initial loop';
2334
+ let page: datatypes.Paging = { limit: limit };
2335
+
2336
+ while (nextPage) {
2337
+ const pagedList = await this._pagedList(page);
2338
+ nextPage = pagedList.nextPageUri;
2339
+ const items: datatypes.IPPolicyRule[] = pagedList.ipPolicyRules;
2340
+
2341
+ if (nextPage) {
2342
+ page = {
2343
+ beforeId: items[items.length - 1].id,
2344
+ limit: limit,
2345
+ };
2346
+ }
2347
+
2348
+ for (const item of items) {
2349
+ yield item;
2350
+ }
2351
+ }
2352
+ }
2353
+ /**
2354
+ * Update attributes of an IP policy rule by ID
2355
+ */
2356
+ public update(
2357
+ arg: datatypes.IPPolicyRuleUpdate
2358
+ ): Promise<datatypes.IPPolicyRule> {
2359
+ return this.httpClient
2360
+ .url(`/ip_policy_rules/${arg.id}`)
2361
+ .patch(util.serializeArgument(arg))
2362
+ .json(payload => util.deserializeResult(payload))
2363
+ .then(f => f, util.onRejected);
2364
+ }
2365
+ }
2366
+
2367
+ /**
2368
+ * An IP restriction is a restriction placed on the CIDRs that are allowed to
2369
+ initiate traffic to a specific aspect of your ngrok account. An IP
2370
+ restriction has a type which defines the ingress it applies to. IP
2371
+ restrictions can be used to enforce the source IPs that can make API
2372
+ requests, log in to the dashboard, start ngrok agents, and connect to your
2373
+ public-facing endpoints.
2374
+ */
2375
+ export class IPRestrictions {
2376
+ private httpClient: Wretcher;
2377
+
2378
+ /** Do not construct this object directly, use the <code>ipRestrictions</code> property of an <code>Ngrok</code> client object instead. */
2379
+ public constructor(httpClient: Wretcher) {
2380
+ this.httpClient = httpClient;
2381
+ }
2382
+ /**
2383
+ * Create a new IP restriction
2384
+ */
2385
+ public create(
2386
+ arg: datatypes.IPRestrictionCreate
2387
+ ): Promise<datatypes.IPRestriction> {
2388
+ return this.httpClient
2389
+ .url(`/ip_restrictions`)
2390
+ .post(util.serializeArgument(arg))
2391
+ .json(payload => util.deserializeResult(payload))
2392
+ .then(f => f, util.onRejected);
2393
+ }
2394
+
2395
+ /**
2396
+ * Delete an IP restriction
2397
+ */
2398
+ public delete(arg: datatypes.Item): Promise<void> {
2399
+ return this.httpClient
2400
+ .url(`/ip_restrictions/${arg.id}`)
2401
+ .delete()
2402
+ .json(payload => util.deserializeResult(payload))
2403
+ .then(f => f, util.onRejected);
2404
+ }
2405
+
2406
+ /**
2407
+ * Get detailed information about an IP restriction
2408
+ */
2409
+ public get(arg: datatypes.Item): Promise<datatypes.IPRestriction> {
2410
+ return this.httpClient
2411
+ .url(`/ip_restrictions/${arg.id}`)
2412
+ .get()
2413
+ .json(payload => util.deserializeResult(payload))
2414
+ .then(f => f, util.onRejected);
2415
+ }
2416
+
2417
+ /**
2418
+ * List all IP restrictions on this account
2419
+ */
2420
+ public async list(): Promise<Array<datatypes.IPRestriction>> {
2421
+ const array: Array<datatypes.IPRestriction> = [];
2422
+ for await (const item of this._asyncList()) {
2423
+ array.push(item);
2424
+ }
2425
+ return array;
2426
+ }
2427
+ private _pagedList(
2428
+ arg: datatypes.Paging
2429
+ ): Promise<datatypes.IPRestrictionList> {
2430
+ return this.httpClient
2431
+ .url(`/ip_restrictions`)
2432
+ .query(arg)
2433
+ .get()
2434
+ .json(payload => util.deserializeResult(payload))
2435
+ .then(util.onFulfilled, util.onRejected);
2436
+ }
2437
+ private async *_asyncList() {
2438
+ const limit = '100';
2439
+ let nextPage = 'initial loop';
2440
+ let page: datatypes.Paging = { limit: limit };
2441
+
2442
+ while (nextPage) {
2443
+ const pagedList = await this._pagedList(page);
2444
+ nextPage = pagedList.nextPageUri;
2445
+ const items: datatypes.IPRestriction[] = pagedList.ipRestrictions;
2446
+
2447
+ if (nextPage) {
2448
+ page = {
2449
+ beforeId: items[items.length - 1].id,
2450
+ limit: limit,
2451
+ };
2452
+ }
2453
+
2454
+ for (const item of items) {
2455
+ yield item;
2456
+ }
2457
+ }
2458
+ }
2459
+ /**
2460
+ * Update attributes of an IP restriction by ID
2461
+ */
2462
+ public update(
2463
+ arg: datatypes.IPRestrictionUpdate
2464
+ ): Promise<datatypes.IPRestriction> {
2465
+ return this.httpClient
2466
+ .url(`/ip_restrictions/${arg.id}`)
2467
+ .patch(util.serializeArgument(arg))
2468
+ .json(payload => util.deserializeResult(payload))
2469
+ .then(f => f, util.onRejected);
2470
+ }
2471
+ }
2472
+
2473
+ /**
2474
+ * Reserved Addresses are TCP addresses that can be used to listen for traffic.
2475
+ TCP address hostnames and ports are assigned by ngrok, they cannot be
2476
+ chosen.
2477
+ */
2478
+ export class ReservedAddrs {
2479
+ private httpClient: Wretcher;
2480
+
2481
+ /** Do not construct this object directly, use the <code>reservedAddrs</code> property of an <code>Ngrok</code> client object instead. */
2482
+ public constructor(httpClient: Wretcher) {
2483
+ this.httpClient = httpClient;
2484
+ }
2485
+ /**
2486
+ * Create a new reserved address.
2487
+ */
2488
+ public create(
2489
+ arg: datatypes.ReservedAddrCreate
2490
+ ): Promise<datatypes.ReservedAddr> {
2491
+ return this.httpClient
2492
+ .url(`/reserved_addrs`)
2493
+ .post(util.serializeArgument(arg))
2494
+ .json(payload => util.deserializeResult(payload))
2495
+ .then(f => f, util.onRejected);
2496
+ }
2497
+
2498
+ /**
2499
+ * Delete a reserved address.
2500
+ */
2501
+ public delete(arg: datatypes.Item): Promise<void> {
2502
+ return this.httpClient
2503
+ .url(`/reserved_addrs/${arg.id}`)
2504
+ .delete()
2505
+ .json(payload => util.deserializeResult(payload))
2506
+ .then(f => f, util.onRejected);
2507
+ }
2508
+
2509
+ /**
2510
+ * Get the details of a reserved address.
2511
+ */
2512
+ public get(arg: datatypes.Item): Promise<datatypes.ReservedAddr> {
2513
+ return this.httpClient
2514
+ .url(`/reserved_addrs/${arg.id}`)
2515
+ .get()
2516
+ .json(payload => util.deserializeResult(payload))
2517
+ .then(f => f, util.onRejected);
2518
+ }
2519
+
2520
+ /**
2521
+ * List all reserved addresses on this account.
2522
+ */
2523
+ public async list(): Promise<Array<datatypes.ReservedAddr>> {
2524
+ const array: Array<datatypes.ReservedAddr> = [];
2525
+ for await (const item of this._asyncList()) {
2526
+ array.push(item);
2527
+ }
2528
+ return array;
2529
+ }
2530
+ private _pagedList(
2531
+ arg: datatypes.Paging
2532
+ ): Promise<datatypes.ReservedAddrList> {
2533
+ return this.httpClient
2534
+ .url(`/reserved_addrs`)
2535
+ .query(arg)
2536
+ .get()
2537
+ .json(payload => util.deserializeResult(payload))
2538
+ .then(util.onFulfilled, util.onRejected);
2539
+ }
2540
+ private async *_asyncList() {
2541
+ const limit = '100';
2542
+ let nextPage = 'initial loop';
2543
+ let page: datatypes.Paging = { limit: limit };
2544
+
2545
+ while (nextPage) {
2546
+ const pagedList = await this._pagedList(page);
2547
+ nextPage = pagedList.nextPageUri;
2548
+ const items: datatypes.ReservedAddr[] = pagedList.reservedAddrs;
2549
+
2550
+ if (nextPage) {
2551
+ page = {
2552
+ beforeId: items[items.length - 1].id,
2553
+ limit: limit,
2554
+ };
2555
+ }
2556
+
2557
+ for (const item of items) {
2558
+ yield item;
2559
+ }
2560
+ }
2561
+ }
2562
+ /**
2563
+ * Update the attributes of a reserved address.
2564
+ */
2565
+ public update(
2566
+ arg: datatypes.ReservedAddrUpdate
2567
+ ): Promise<datatypes.ReservedAddr> {
2568
+ return this.httpClient
2569
+ .url(`/reserved_addrs/${arg.id}`)
2570
+ .patch(util.serializeArgument(arg))
2571
+ .json(payload => util.deserializeResult(payload))
2572
+ .then(f => f, util.onRejected);
2573
+ }
2574
+ }
2575
+
2576
+ /**
2577
+ * Reserved Domains are hostnames that you can listen for traffic on. Domains
2578
+ can be used to listen for http, https or tls traffic. You may use a domain
2579
+ that you own by creating a CNAME record specified in the returned resource.
2580
+ This CNAME record points traffic for that domain to ngrok's edge servers.
2581
+ */
2582
+ export class ReservedDomains {
2583
+ private httpClient: Wretcher;
2584
+
2585
+ /** Do not construct this object directly, use the <code>reservedDomains</code> property of an <code>Ngrok</code> client object instead. */
2586
+ public constructor(httpClient: Wretcher) {
2587
+ this.httpClient = httpClient;
2588
+ }
2589
+ /**
2590
+ * Create a new reserved domain.
2591
+ */
2592
+ public create(
2593
+ arg: datatypes.ReservedDomainCreate
2594
+ ): Promise<datatypes.ReservedDomain> {
2595
+ return this.httpClient
2596
+ .url(`/reserved_domains`)
2597
+ .post(util.serializeArgument(arg))
2598
+ .json(payload => util.deserializeResult(payload))
2599
+ .then(f => f, util.onRejected);
2600
+ }
2601
+
2602
+ /**
2603
+ * Delete a reserved domain.
2604
+ */
2605
+ public delete(arg: datatypes.Item): Promise<void> {
2606
+ return this.httpClient
2607
+ .url(`/reserved_domains/${arg.id}`)
2608
+ .delete()
2609
+ .json(payload => util.deserializeResult(payload))
2610
+ .then(f => f, util.onRejected);
2611
+ }
2612
+
2613
+ /**
2614
+ * Get the details of a reserved domain.
2615
+ */
2616
+ public get(arg: datatypes.Item): Promise<datatypes.ReservedDomain> {
2617
+ return this.httpClient
2618
+ .url(`/reserved_domains/${arg.id}`)
2619
+ .get()
2620
+ .json(payload => util.deserializeResult(payload))
2621
+ .then(f => f, util.onRejected);
2622
+ }
2623
+
2624
+ /**
2625
+ * List all reserved domains on this account.
2626
+ */
2627
+ public async list(): Promise<Array<datatypes.ReservedDomain>> {
2628
+ const array: Array<datatypes.ReservedDomain> = [];
2629
+ for await (const item of this._asyncList()) {
2630
+ array.push(item);
2631
+ }
2632
+ return array;
2633
+ }
2634
+ private _pagedList(
2635
+ arg: datatypes.Paging
2636
+ ): Promise<datatypes.ReservedDomainList> {
2637
+ return this.httpClient
2638
+ .url(`/reserved_domains`)
2639
+ .query(arg)
2640
+ .get()
2641
+ .json(payload => util.deserializeResult(payload))
2642
+ .then(util.onFulfilled, util.onRejected);
2643
+ }
2644
+ private async *_asyncList() {
2645
+ const limit = '100';
2646
+ let nextPage = 'initial loop';
2647
+ let page: datatypes.Paging = { limit: limit };
2648
+
2649
+ while (nextPage) {
2650
+ const pagedList = await this._pagedList(page);
2651
+ nextPage = pagedList.nextPageUri;
2652
+ const items: datatypes.ReservedDomain[] = pagedList.reservedDomains;
2653
+
2654
+ if (nextPage) {
2655
+ page = {
2656
+ beforeId: items[items.length - 1].id,
2657
+ limit: limit,
2658
+ };
2659
+ }
2660
+
2661
+ for (const item of items) {
2662
+ yield item;
2663
+ }
2664
+ }
2665
+ }
2666
+ /**
2667
+ * Update the attributes of a reserved domain.
2668
+ */
2669
+ public update(
2670
+ arg: datatypes.ReservedDomainUpdate
2671
+ ): Promise<datatypes.ReservedDomain> {
2672
+ return this.httpClient
2673
+ .url(`/reserved_domains/${arg.id}`)
2674
+ .patch(util.serializeArgument(arg))
2675
+ .json(payload => util.deserializeResult(payload))
2676
+ .then(f => f, util.onRejected);
2677
+ }
2678
+
2679
+ /**
2680
+ * Detach the certificate management policy attached to a reserved domain.
2681
+ */
2682
+ public deleteCertificateManagementPolicy(arg: datatypes.Item): Promise<void> {
2683
+ return this.httpClient
2684
+ .url(`/reserved_domains/${arg.id}/certificate_management_policy`)
2685
+ .delete()
2686
+ .json(payload => util.deserializeResult(payload))
2687
+ .then(f => f, util.onRejected);
2688
+ }
2689
+
2690
+ /**
2691
+ * Detach the certificate attached to a reserved domain.
2692
+ */
2693
+ public deleteCertificate(arg: datatypes.Item): Promise<void> {
2694
+ return this.httpClient
2695
+ .url(`/reserved_domains/${arg.id}/certificate`)
2696
+ .delete()
2697
+ .json(payload => util.deserializeResult(payload))
2698
+ .then(f => f, util.onRejected);
2699
+ }
2700
+ }
2701
+
2702
+ /**
2703
+ * An SSH Certificate Authority is a pair of an SSH Certificate and its private
2704
+ key that can be used to sign other SSH host and user certificates.
2705
+ */
2706
+ export class SSHCertificateAuthorities {
2707
+ private httpClient: Wretcher;
2708
+
2709
+ /** Do not construct this object directly, use the <code>sshCertificateAuthorities</code> property of an <code>Ngrok</code> client object instead. */
2710
+ public constructor(httpClient: Wretcher) {
2711
+ this.httpClient = httpClient;
2712
+ }
2713
+ /**
2714
+ * Create a new SSH Certificate Authority
2715
+ */
2716
+ public create(
2717
+ arg: datatypes.SSHCertificateAuthorityCreate
2718
+ ): Promise<datatypes.SSHCertificateAuthority> {
2719
+ return this.httpClient
2720
+ .url(`/ssh_certificate_authorities`)
2721
+ .post(util.serializeArgument(arg))
2722
+ .json(payload => util.deserializeResult(payload))
2723
+ .then(f => f, util.onRejected);
2724
+ }
2725
+
2726
+ /**
2727
+ * Delete an SSH Certificate Authority
2728
+ */
2729
+ public delete(arg: datatypes.Item): Promise<void> {
2730
+ return this.httpClient
2731
+ .url(`/ssh_certificate_authorities/${arg.id}`)
2732
+ .delete()
2733
+ .json(payload => util.deserializeResult(payload))
2734
+ .then(f => f, util.onRejected);
2735
+ }
2736
+
2737
+ /**
2738
+ * Get detailed information about an SSH Certficate Authority
2739
+ */
2740
+ public get(arg: datatypes.Item): Promise<datatypes.SSHCertificateAuthority> {
2741
+ return this.httpClient
2742
+ .url(`/ssh_certificate_authorities/${arg.id}`)
2743
+ .get()
2744
+ .json(payload => util.deserializeResult(payload))
2745
+ .then(f => f, util.onRejected);
2746
+ }
2747
+
2748
+ /**
2749
+ * List all SSH Certificate Authorities on this account
2750
+ */
2751
+ public async list(): Promise<Array<datatypes.SSHCertificateAuthority>> {
2752
+ const array: Array<datatypes.SSHCertificateAuthority> = [];
2753
+ for await (const item of this._asyncList()) {
2754
+ array.push(item);
2755
+ }
2756
+ return array;
2757
+ }
2758
+ private _pagedList(
2759
+ arg: datatypes.Paging
2760
+ ): Promise<datatypes.SSHCertificateAuthorityList> {
2761
+ return this.httpClient
2762
+ .url(`/ssh_certificate_authorities`)
2763
+ .query(arg)
2764
+ .get()
2765
+ .json(payload => util.deserializeResult(payload))
2766
+ .then(util.onFulfilled, util.onRejected);
2767
+ }
2768
+ private async *_asyncList() {
2769
+ const limit = '100';
2770
+ let nextPage = 'initial loop';
2771
+ let page: datatypes.Paging = { limit: limit };
2772
+
2773
+ while (nextPage) {
2774
+ const pagedList = await this._pagedList(page);
2775
+ nextPage = pagedList.nextPageUri;
2776
+ const items: datatypes.SSHCertificateAuthority[] =
2777
+ pagedList.sshCertificateAuthorities;
2778
+
2779
+ if (nextPage) {
2780
+ page = {
2781
+ beforeId: items[items.length - 1].id,
2782
+ limit: limit,
2783
+ };
2784
+ }
2785
+
2786
+ for (const item of items) {
2787
+ yield item;
2788
+ }
2789
+ }
2790
+ }
2791
+ /**
2792
+ * Update an SSH Certificate Authority
2793
+ */
2794
+ public update(
2795
+ arg: datatypes.SSHCertificateAuthorityUpdate
2796
+ ): Promise<datatypes.SSHCertificateAuthority> {
2797
+ return this.httpClient
2798
+ .url(`/ssh_certificate_authorities/${arg.id}`)
2799
+ .patch(util.serializeArgument(arg))
2800
+ .json(payload => util.deserializeResult(payload))
2801
+ .then(f => f, util.onRejected);
2802
+ }
2803
+ }
2804
+
2805
+ /**
2806
+ * SSH Credentials are SSH public keys that can be used to start SSH tunnels
2807
+ via the ngrok SSH tunnel gateway.
2808
+ */
2809
+ export class SSHCredentials {
2810
+ private httpClient: Wretcher;
2811
+
2812
+ /** Do not construct this object directly, use the <code>sshCredentials</code> property of an <code>Ngrok</code> client object instead. */
2813
+ public constructor(httpClient: Wretcher) {
2814
+ this.httpClient = httpClient;
2815
+ }
2816
+ /**
2817
+ * Create a new ssh_credential from an uploaded public SSH key. This ssh credential can be used to start new tunnels via ngrok's SSH gateway.
2818
+ */
2819
+ public create(
2820
+ arg: datatypes.SSHCredentialCreate
2821
+ ): Promise<datatypes.SSHCredential> {
2822
+ return this.httpClient
2823
+ .url(`/ssh_credentials`)
2824
+ .post(util.serializeArgument(arg))
2825
+ .json(payload => util.deserializeResult(payload))
2826
+ .then(f => f, util.onRejected);
2827
+ }
2828
+
2829
+ /**
2830
+ * Delete an ssh_credential by ID
2831
+ */
2832
+ public delete(arg: datatypes.Item): Promise<void> {
2833
+ return this.httpClient
2834
+ .url(`/ssh_credentials/${arg.id}`)
2835
+ .delete()
2836
+ .json(payload => util.deserializeResult(payload))
2837
+ .then(f => f, util.onRejected);
2838
+ }
2839
+
2840
+ /**
2841
+ * Get detailed information about an ssh_credential
2842
+ */
2843
+ public get(arg: datatypes.Item): Promise<datatypes.SSHCredential> {
2844
+ return this.httpClient
2845
+ .url(`/ssh_credentials/${arg.id}`)
2846
+ .get()
2847
+ .json(payload => util.deserializeResult(payload))
2848
+ .then(f => f, util.onRejected);
2849
+ }
2850
+
2851
+ /**
2852
+ * List all ssh credentials on this account
2853
+ */
2854
+ public async list(): Promise<Array<datatypes.SSHCredential>> {
2855
+ const array: Array<datatypes.SSHCredential> = [];
2856
+ for await (const item of this._asyncList()) {
2857
+ array.push(item);
2858
+ }
2859
+ return array;
2860
+ }
2861
+ private _pagedList(
2862
+ arg: datatypes.Paging
2863
+ ): Promise<datatypes.SSHCredentialList> {
2864
+ return this.httpClient
2865
+ .url(`/ssh_credentials`)
2866
+ .query(arg)
2867
+ .get()
2868
+ .json(payload => util.deserializeResult(payload))
2869
+ .then(util.onFulfilled, util.onRejected);
2870
+ }
2871
+ private async *_asyncList() {
2872
+ const limit = '100';
2873
+ let nextPage = 'initial loop';
2874
+ let page: datatypes.Paging = { limit: limit };
2875
+
2876
+ while (nextPage) {
2877
+ const pagedList = await this._pagedList(page);
2878
+ nextPage = pagedList.nextPageUri;
2879
+ const items: datatypes.SSHCredential[] = pagedList.sshCredentials;
2880
+
2881
+ if (nextPage) {
2882
+ page = {
2883
+ beforeId: items[items.length - 1].id,
2884
+ limit: limit,
2885
+ };
2886
+ }
2887
+
2888
+ for (const item of items) {
2889
+ yield item;
2890
+ }
2891
+ }
2892
+ }
2893
+ /**
2894
+ * Update attributes of an ssh_credential by ID
2895
+ */
2896
+ public update(
2897
+ arg: datatypes.SSHCredentialUpdate
2898
+ ): Promise<datatypes.SSHCredential> {
2899
+ return this.httpClient
2900
+ .url(`/ssh_credentials/${arg.id}`)
2901
+ .patch(util.serializeArgument(arg))
2902
+ .json(payload => util.deserializeResult(payload))
2903
+ .then(f => f, util.onRejected);
2904
+ }
2905
+ }
2906
+
2907
+ /**
2908
+ * SSH Host Certificates along with the corresponding private key allows an SSH
2909
+ server to assert its authenticity to connecting SSH clients who trust the
2910
+ SSH Certificate Authority that was used to sign the certificate.
2911
+ */
2912
+ export class SSHHostCertificates {
2913
+ private httpClient: Wretcher;
2914
+
2915
+ /** Do not construct this object directly, use the <code>sshHostCertificates</code> property of an <code>Ngrok</code> client object instead. */
2916
+ public constructor(httpClient: Wretcher) {
2917
+ this.httpClient = httpClient;
2918
+ }
2919
+ /**
2920
+ * Create a new SSH Host Certificate
2921
+ */
2922
+ public create(
2923
+ arg: datatypes.SSHHostCertificateCreate
2924
+ ): Promise<datatypes.SSHHostCertificate> {
2925
+ return this.httpClient
2926
+ .url(`/ssh_host_certificates`)
2927
+ .post(util.serializeArgument(arg))
2928
+ .json(payload => util.deserializeResult(payload))
2929
+ .then(f => f, util.onRejected);
2930
+ }
2931
+
2932
+ /**
2933
+ * Delete an SSH Host Certificate
2934
+ */
2935
+ public delete(arg: datatypes.Item): Promise<void> {
2936
+ return this.httpClient
2937
+ .url(`/ssh_host_certificates/${arg.id}`)
2938
+ .delete()
2939
+ .json(payload => util.deserializeResult(payload))
2940
+ .then(f => f, util.onRejected);
2941
+ }
2942
+
2943
+ /**
2944
+ * Get detailed information about an SSH Host Certficate
2945
+ */
2946
+ public get(arg: datatypes.Item): Promise<datatypes.SSHHostCertificate> {
2947
+ return this.httpClient
2948
+ .url(`/ssh_host_certificates/${arg.id}`)
2949
+ .get()
2950
+ .json(payload => util.deserializeResult(payload))
2951
+ .then(f => f, util.onRejected);
2952
+ }
2953
+
2954
+ /**
2955
+ * List all SSH Host Certificates issued on this account
2956
+ */
2957
+ public async list(): Promise<Array<datatypes.SSHHostCertificate>> {
2958
+ const array: Array<datatypes.SSHHostCertificate> = [];
2959
+ for await (const item of this._asyncList()) {
2960
+ array.push(item);
2961
+ }
2962
+ return array;
2963
+ }
2964
+ private _pagedList(
2965
+ arg: datatypes.Paging
2966
+ ): Promise<datatypes.SSHHostCertificateList> {
2967
+ return this.httpClient
2968
+ .url(`/ssh_host_certificates`)
2969
+ .query(arg)
2970
+ .get()
2971
+ .json(payload => util.deserializeResult(payload))
2972
+ .then(util.onFulfilled, util.onRejected);
2973
+ }
2974
+ private async *_asyncList() {
2975
+ const limit = '100';
2976
+ let nextPage = 'initial loop';
2977
+ let page: datatypes.Paging = { limit: limit };
2978
+
2979
+ while (nextPage) {
2980
+ const pagedList = await this._pagedList(page);
2981
+ nextPage = pagedList.nextPageUri;
2982
+ const items: datatypes.SSHHostCertificate[] =
2983
+ pagedList.sshHostCertificates;
2984
+
2985
+ if (nextPage) {
2986
+ page = {
2987
+ beforeId: items[items.length - 1].id,
2988
+ limit: limit,
2989
+ };
2990
+ }
2991
+
2992
+ for (const item of items) {
2993
+ yield item;
2994
+ }
2995
+ }
2996
+ }
2997
+ /**
2998
+ * Update an SSH Host Certificate
2999
+ */
3000
+ public update(
3001
+ arg: datatypes.SSHHostCertificateUpdate
3002
+ ): Promise<datatypes.SSHHostCertificate> {
3003
+ return this.httpClient
3004
+ .url(`/ssh_host_certificates/${arg.id}`)
3005
+ .patch(util.serializeArgument(arg))
3006
+ .json(payload => util.deserializeResult(payload))
3007
+ .then(f => f, util.onRejected);
3008
+ }
3009
+ }
3010
+
3011
+ /**
3012
+ * SSH User Certificates are presented by SSH clients when connecting to an SSH
3013
+ server to authenticate their connection. The SSH server must trust the SSH
3014
+ Certificate Authority used to sign the certificate.
3015
+ */
3016
+ export class SSHUserCertificates {
3017
+ private httpClient: Wretcher;
3018
+
3019
+ /** Do not construct this object directly, use the <code>sshUserCertificates</code> property of an <code>Ngrok</code> client object instead. */
3020
+ public constructor(httpClient: Wretcher) {
3021
+ this.httpClient = httpClient;
3022
+ }
3023
+ /**
3024
+ * Create a new SSH User Certificate
3025
+ */
3026
+ public create(
3027
+ arg: datatypes.SSHUserCertificateCreate
3028
+ ): Promise<datatypes.SSHUserCertificate> {
3029
+ return this.httpClient
3030
+ .url(`/ssh_user_certificates`)
3031
+ .post(util.serializeArgument(arg))
3032
+ .json(payload => util.deserializeResult(payload))
3033
+ .then(f => f, util.onRejected);
3034
+ }
3035
+
3036
+ /**
3037
+ * Delete an SSH User Certificate
3038
+ */
3039
+ public delete(arg: datatypes.Item): Promise<void> {
3040
+ return this.httpClient
3041
+ .url(`/ssh_user_certificates/${arg.id}`)
3042
+ .delete()
3043
+ .json(payload => util.deserializeResult(payload))
3044
+ .then(f => f, util.onRejected);
3045
+ }
3046
+
3047
+ /**
3048
+ * Get detailed information about an SSH User Certficate
3049
+ */
3050
+ public get(arg: datatypes.Item): Promise<datatypes.SSHUserCertificate> {
3051
+ return this.httpClient
3052
+ .url(`/ssh_user_certificates/${arg.id}`)
3053
+ .get()
3054
+ .json(payload => util.deserializeResult(payload))
3055
+ .then(f => f, util.onRejected);
3056
+ }
3057
+
3058
+ /**
3059
+ * List all SSH User Certificates issued on this account
3060
+ */
3061
+ public async list(): Promise<Array<datatypes.SSHUserCertificate>> {
3062
+ const array: Array<datatypes.SSHUserCertificate> = [];
3063
+ for await (const item of this._asyncList()) {
3064
+ array.push(item);
3065
+ }
3066
+ return array;
3067
+ }
3068
+ private _pagedList(
3069
+ arg: datatypes.Paging
3070
+ ): Promise<datatypes.SSHUserCertificateList> {
3071
+ return this.httpClient
3072
+ .url(`/ssh_user_certificates`)
3073
+ .query(arg)
3074
+ .get()
3075
+ .json(payload => util.deserializeResult(payload))
3076
+ .then(util.onFulfilled, util.onRejected);
3077
+ }
3078
+ private async *_asyncList() {
3079
+ const limit = '100';
3080
+ let nextPage = 'initial loop';
3081
+ let page: datatypes.Paging = { limit: limit };
3082
+
3083
+ while (nextPage) {
3084
+ const pagedList = await this._pagedList(page);
3085
+ nextPage = pagedList.nextPageUri;
3086
+ const items: datatypes.SSHUserCertificate[] =
3087
+ pagedList.sshUserCertificates;
3088
+
3089
+ if (nextPage) {
3090
+ page = {
3091
+ beforeId: items[items.length - 1].id,
3092
+ limit: limit,
3093
+ };
3094
+ }
3095
+
3096
+ for (const item of items) {
3097
+ yield item;
3098
+ }
3099
+ }
3100
+ }
3101
+ /**
3102
+ * Update an SSH User Certificate
3103
+ */
3104
+ public update(
3105
+ arg: datatypes.SSHUserCertificateUpdate
3106
+ ): Promise<datatypes.SSHUserCertificate> {
3107
+ return this.httpClient
3108
+ .url(`/ssh_user_certificates/${arg.id}`)
3109
+ .patch(util.serializeArgument(arg))
3110
+ .json(payload => util.deserializeResult(payload))
3111
+ .then(f => f, util.onRejected);
3112
+ }
3113
+ }
3114
+
3115
+ /**
3116
+ * TLS Certificates are pairs of x509 certificates and their matching private
3117
+ key that can be used to terminate TLS traffic. TLS certificates are unused
3118
+ until they are attached to a Domain. TLS Certificates may also be
3119
+ provisioned by ngrok automatically for domains on which you have enabled
3120
+ automated certificate provisioning.
3121
+ */
3122
+ export class TLSCertificates {
3123
+ private httpClient: Wretcher;
3124
+
3125
+ /** Do not construct this object directly, use the <code>tlsCertificates</code> property of an <code>Ngrok</code> client object instead. */
3126
+ public constructor(httpClient: Wretcher) {
3127
+ this.httpClient = httpClient;
3128
+ }
3129
+ /**
3130
+ * Upload a new TLS certificate
3131
+ */
3132
+ public create(
3133
+ arg: datatypes.TLSCertificateCreate
3134
+ ): Promise<datatypes.TLSCertificate> {
3135
+ return this.httpClient
3136
+ .url(`/tls_certificates`)
3137
+ .post(util.serializeArgument(arg))
3138
+ .json(payload => util.deserializeResult(payload))
3139
+ .then(f => f, util.onRejected);
3140
+ }
3141
+
3142
+ /**
3143
+ * Delete a TLS certificate
3144
+ */
3145
+ public delete(arg: datatypes.Item): Promise<void> {
3146
+ return this.httpClient
3147
+ .url(`/tls_certificates/${arg.id}`)
3148
+ .delete()
3149
+ .json(payload => util.deserializeResult(payload))
3150
+ .then(f => f, util.onRejected);
3151
+ }
3152
+
3153
+ /**
3154
+ * Get detailed information about a TLS certificate
3155
+ */
3156
+ public get(arg: datatypes.Item): Promise<datatypes.TLSCertificate> {
3157
+ return this.httpClient
3158
+ .url(`/tls_certificates/${arg.id}`)
3159
+ .get()
3160
+ .json(payload => util.deserializeResult(payload))
3161
+ .then(f => f, util.onRejected);
3162
+ }
3163
+
3164
+ /**
3165
+ * List all TLS certificates on this account
3166
+ */
3167
+ public async list(): Promise<Array<datatypes.TLSCertificate>> {
3168
+ const array: Array<datatypes.TLSCertificate> = [];
3169
+ for await (const item of this._asyncList()) {
3170
+ array.push(item);
3171
+ }
3172
+ return array;
3173
+ }
3174
+ private _pagedList(
3175
+ arg: datatypes.Paging
3176
+ ): Promise<datatypes.TLSCertificateList> {
3177
+ return this.httpClient
3178
+ .url(`/tls_certificates`)
3179
+ .query(arg)
3180
+ .get()
3181
+ .json(payload => util.deserializeResult(payload))
3182
+ .then(util.onFulfilled, util.onRejected);
3183
+ }
3184
+ private async *_asyncList() {
3185
+ const limit = '100';
3186
+ let nextPage = 'initial loop';
3187
+ let page: datatypes.Paging = { limit: limit };
3188
+
3189
+ while (nextPage) {
3190
+ const pagedList = await this._pagedList(page);
3191
+ nextPage = pagedList.nextPageUri;
3192
+ const items: datatypes.TLSCertificate[] = pagedList.tlsCertificates;
3193
+
3194
+ if (nextPage) {
3195
+ page = {
3196
+ beforeId: items[items.length - 1].id,
3197
+ limit: limit,
3198
+ };
3199
+ }
3200
+
3201
+ for (const item of items) {
3202
+ yield item;
3203
+ }
3204
+ }
3205
+ }
3206
+ /**
3207
+ * Update attributes of a TLS Certificate by ID
3208
+ */
3209
+ public update(
3210
+ arg: datatypes.TLSCertificateUpdate
3211
+ ): Promise<datatypes.TLSCertificate> {
3212
+ return this.httpClient
3213
+ .url(`/tls_certificates/${arg.id}`)
3214
+ .patch(util.serializeArgument(arg))
3215
+ .json(payload => util.deserializeResult(payload))
3216
+ .then(f => f, util.onRejected);
3217
+ }
3218
+ }
3219
+
3220
+ /**
3221
+ * Tunnel Sessions represent instances of ngrok agents or SSH reverse tunnel
3222
+ sessions that are running and connected to the ngrok service. Each tunnel
3223
+ session can include one or more Tunnels.
3224
+ */
3225
+ export class TunnelSessions {
3226
+ private httpClient: Wretcher;
3227
+
3228
+ /** Do not construct this object directly, use the <code>tunnelSessions</code> property of an <code>Ngrok</code> client object instead. */
3229
+ public constructor(httpClient: Wretcher) {
3230
+ this.httpClient = httpClient;
3231
+ }
3232
+ /**
3233
+ * List all online tunnel sessions running on this account.
3234
+ */
3235
+ public async list(): Promise<Array<datatypes.TunnelSession>> {
3236
+ const array: Array<datatypes.TunnelSession> = [];
3237
+ for await (const item of this._asyncList()) {
3238
+ array.push(item);
3239
+ }
3240
+ return array;
3241
+ }
3242
+ private _pagedList(
3243
+ arg: datatypes.Paging
3244
+ ): Promise<datatypes.TunnelSessionList> {
3245
+ return this.httpClient
3246
+ .url(`/tunnel_sessions`)
3247
+ .query(arg)
3248
+ .get()
3249
+ .json(payload => util.deserializeResult(payload))
3250
+ .then(util.onFulfilled, util.onRejected);
3251
+ }
3252
+ private async *_asyncList() {
3253
+ const limit = '100';
3254
+ let nextPage = 'initial loop';
3255
+ let page: datatypes.Paging = { limit: limit };
3256
+
3257
+ while (nextPage) {
3258
+ const pagedList = await this._pagedList(page);
3259
+ nextPage = pagedList.nextPageUri;
3260
+ const items: datatypes.TunnelSession[] = pagedList.tunnelSessions;
3261
+
3262
+ if (nextPage) {
3263
+ page = {
3264
+ beforeId: items[items.length - 1].id,
3265
+ limit: limit,
3266
+ };
3267
+ }
3268
+
3269
+ for (const item of items) {
3270
+ yield item;
3271
+ }
3272
+ }
3273
+ }
3274
+ /**
3275
+ * Get the detailed status of a tunnel session by ID
3276
+ */
3277
+ public get(arg: datatypes.Item): Promise<datatypes.TunnelSession> {
3278
+ return this.httpClient
3279
+ .url(`/tunnel_sessions/${arg.id}`)
3280
+ .get()
3281
+ .json(payload => util.deserializeResult(payload))
3282
+ .then(f => f, util.onRejected);
3283
+ }
3284
+
3285
+ /**
3286
+ * Issues a command instructing the ngrok agent to restart. The agent restarts itself by calling exec() on platforms that support it. This operation is notably not supported on Windows. When an agent restarts, it reconnects with a new tunnel session ID.
3287
+ */
3288
+ public restart(arg: datatypes.Item): Promise<void> {
3289
+ return this.httpClient
3290
+ .url(`/tunnel_sessions/${arg.id}/restart`)
3291
+ .post(util.serializeArgument(arg))
3292
+ .json(payload => util.deserializeResult(payload))
3293
+ .then(f => f, util.onRejected);
3294
+ }
3295
+
3296
+ /**
3297
+ * Issues a command instructing the ngrok agent that started this tunnel session to exit.
3298
+ */
3299
+ public stop(arg: datatypes.Item): Promise<void> {
3300
+ return this.httpClient
3301
+ .url(`/tunnel_sessions/${arg.id}/stop`)
3302
+ .post(util.serializeArgument(arg))
3303
+ .json(payload => util.deserializeResult(payload))
3304
+ .then(f => f, util.onRejected);
3305
+ }
3306
+
3307
+ /**
3308
+ * Issues a command instructing the ngrok agent to update itself to the latest version. After this call completes successfully, the ngrok agent will be in the update process. A caller should wait some amount of time to allow the update to complete (at least 10 seconds) before making a call to the Restart endpoint to request that the agent restart itself to start using the new code. This call will never update an ngrok agent to a new major version which could cause breaking compatibility issues. If you wish to update to a new major version, that must be done manually. Still, please be aware that updating your ngrok agent could break your integration. This call will fail in any of the following circumstances: there is no update available the ngrok agent's configuration disabled update checks the agent is currently in process of updating the agent has already successfully updated but has not yet been restarted
3309
+ */
3310
+ public update(arg: datatypes.TunnelSessionsUpdate): Promise<void> {
3311
+ return this.httpClient
3312
+ .url(`/tunnel_sessions/${arg.id}/update`)
3313
+ .post(util.serializeArgument(arg))
3314
+ .json(payload => util.deserializeResult(payload))
3315
+ .then(f => f, util.onRejected);
3316
+ }
3317
+ }
3318
+
3319
+ /**
3320
+ * Tunnels provide endpoints to access services exposed by a running ngrok
3321
+ agent tunnel session or an SSH reverse tunnel session.
3322
+ */
3323
+ export class Tunnels {
3324
+ private httpClient: Wretcher;
3325
+
3326
+ /** Do not construct this object directly, use the <code>tunnels</code> property of an <code>Ngrok</code> client object instead. */
3327
+ public constructor(httpClient: Wretcher) {
3328
+ this.httpClient = httpClient;
3329
+ }
3330
+ /**
3331
+ * List all online tunnels currently running on the account.
3332
+ */
3333
+ public async list(): Promise<Array<datatypes.Tunnel>> {
3334
+ const array: Array<datatypes.Tunnel> = [];
3335
+ for await (const item of this._asyncList()) {
3336
+ array.push(item);
3337
+ }
3338
+ return array;
3339
+ }
3340
+ private _pagedList(arg: datatypes.Paging): Promise<datatypes.TunnelList> {
3341
+ return this.httpClient
3342
+ .url(`/tunnels`)
3343
+ .query(arg)
3344
+ .get()
3345
+ .json(payload => util.deserializeResult(payload))
3346
+ .then(util.onFulfilled, util.onRejected);
3347
+ }
3348
+ private async *_asyncList() {
3349
+ const limit = '100';
3350
+ let nextPage = 'initial loop';
3351
+ let page: datatypes.Paging = { limit: limit };
3352
+
3353
+ while (nextPage) {
3354
+ const pagedList = await this._pagedList(page);
3355
+ nextPage = pagedList.nextPageUri;
3356
+ const items: datatypes.Tunnel[] = pagedList.tunnels;
3357
+
3358
+ if (nextPage) {
3359
+ page = {
3360
+ beforeId: items[items.length - 1].id,
3361
+ limit: limit,
3362
+ };
3363
+ }
3364
+
3365
+ for (const item of items) {
3366
+ yield item;
3367
+ }
3368
+ }
3369
+ }
3370
+ /**
3371
+ * Get the status of a tunnel by ID
3372
+ */
3373
+ public get(arg: datatypes.Item): Promise<datatypes.Tunnel> {
3374
+ return this.httpClient
3375
+ .url(`/tunnels/${arg.id}`)
3376
+ .get()
3377
+ .json(payload => util.deserializeResult(payload))
3378
+ .then(f => f, util.onRejected);
3379
+ }
3380
+ }