@ngrok/ngrok-api 0.0.9 → 0.3.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 (218) hide show
  1. package/.eslintrc.js +4 -1
  2. package/CHANGELOG.md +34 -0
  3. package/README.md +148 -2
  4. package/docs/CNAME +1 -0
  5. package/docs/assets/css/main.css +2660 -0
  6. package/docs/assets/images/icons.png +0 -0
  7. package/docs/assets/images/icons@2x.png +0 -0
  8. package/docs/assets/images/widgets.png +0 -0
  9. package/docs/assets/images/widgets@2x.png +0 -0
  10. package/docs/assets/js/main.js +248 -0
  11. package/docs/assets/js/search.js +1 -0
  12. package/docs/classes/client.Ngrok.html +681 -0
  13. package/docs/classes/services.APIKeys.html +453 -0
  14. package/docs/classes/services.AbuseReports.html +360 -0
  15. package/docs/classes/services.AgentIngresses.html +442 -0
  16. package/docs/classes/services.CertificateAuthorities.html +453 -0
  17. package/docs/classes/services.Credentials.html +452 -0
  18. package/docs/classes/services.EndpointCircuitBreakerModule.html +369 -0
  19. package/docs/classes/services.EndpointCompressionModule.html +369 -0
  20. package/docs/classes/services.EndpointConfigurations.html +451 -0
  21. package/docs/classes/services.EndpointIPPolicyModule.html +369 -0
  22. package/docs/classes/services.EndpointLoggingModule.html +369 -0
  23. package/docs/classes/services.EndpointMutualTLSModule.html +369 -0
  24. package/docs/classes/services.EndpointOAuthModule.html +369 -0
  25. package/docs/classes/services.EndpointOIDCModule.html +369 -0
  26. package/docs/classes/services.EndpointRequestHeadersModule.html +369 -0
  27. package/docs/classes/services.EndpointResponseHeadersModule.html +369 -0
  28. package/docs/classes/services.EndpointSAMLModule.html +369 -0
  29. package/docs/classes/services.EndpointTLSTerminationModule.html +369 -0
  30. package/docs/classes/services.EndpointWebhookValidationModule.html +369 -0
  31. package/docs/classes/services.EventDestinations.html +442 -0
  32. package/docs/classes/services.EventSources.html +448 -0
  33. package/docs/classes/services.EventStreams.html +442 -0
  34. package/docs/classes/services.EventSubscriptions.html +442 -0
  35. package/docs/classes/services.IPPolicies.html +452 -0
  36. package/docs/classes/services.IPPolicyRules.html +450 -0
  37. package/docs/classes/services.IPRestrictions.html +454 -0
  38. package/docs/classes/services.ReservedAddrs.html +483 -0
  39. package/docs/classes/services.ReservedDomains.html +580 -0
  40. package/docs/classes/services.SSHCertificateAuthorities.html +450 -0
  41. package/docs/classes/services.SSHCredentials.html +450 -0
  42. package/docs/classes/services.SSHHostCertificates.html +451 -0
  43. package/docs/classes/services.SSHUserCertificates.html +451 -0
  44. package/docs/classes/services.TLSCertificates.html +453 -0
  45. package/docs/classes/services.TunnelSessions.html +451 -0
  46. package/docs/classes/services.Tunnels.html +322 -0
  47. package/docs/index.html +239 -0
  48. package/docs/interfaces/client.NgrokConfig.html +179 -0
  49. package/docs/interfaces/datatypes.APIKey.html +262 -0
  50. package/docs/interfaces/datatypes.APIKeyCreate.html +186 -0
  51. package/docs/interfaces/datatypes.APIKeyList.html +205 -0
  52. package/docs/interfaces/datatypes.APIKeyUpdate.html +200 -0
  53. package/docs/interfaces/datatypes.AWSAuth.html +186 -0
  54. package/docs/interfaces/datatypes.AWSCredentials.html +186 -0
  55. package/docs/interfaces/datatypes.AWSRole.html +167 -0
  56. package/docs/interfaces/datatypes.AbuseReport.html +281 -0
  57. package/docs/interfaces/datatypes.AbuseReportCreate.html +186 -0
  58. package/docs/interfaces/datatypes.AbuseReportHostname.html +186 -0
  59. package/docs/interfaces/datatypes.AgentIngress.html +300 -0
  60. package/docs/interfaces/datatypes.AgentIngressCreate.html +205 -0
  61. package/docs/interfaces/datatypes.AgentIngressList.html +205 -0
  62. package/docs/interfaces/datatypes.AgentIngressUpdate.html +200 -0
  63. package/docs/interfaces/datatypes.CertificateAuthority.html +357 -0
  64. package/docs/interfaces/datatypes.CertificateAuthorityCreate.html +205 -0
  65. package/docs/interfaces/datatypes.CertificateAuthorityList.html +205 -0
  66. package/docs/interfaces/datatypes.CertificateAuthorityUpdate.html +200 -0
  67. package/docs/interfaces/datatypes.Credential.html +281 -0
  68. package/docs/interfaces/datatypes.CredentialCreate.html +205 -0
  69. package/docs/interfaces/datatypes.CredentialList.html +205 -0
  70. package/docs/interfaces/datatypes.CredentialUpdate.html +219 -0
  71. package/docs/interfaces/datatypes.Empty.html +130 -0
  72. package/docs/interfaces/datatypes.EndpointCircuitBreaker.html +262 -0
  73. package/docs/interfaces/datatypes.EndpointCircuitBreakerReplace.html +176 -0
  74. package/docs/interfaces/datatypes.EndpointCompression.html +167 -0
  75. package/docs/interfaces/datatypes.EndpointCompressionReplace.html +176 -0
  76. package/docs/interfaces/datatypes.EndpointConfiguration.html +490 -0
  77. package/docs/interfaces/datatypes.EndpointConfigurationCreate.html +433 -0
  78. package/docs/interfaces/datatypes.EndpointConfigurationList.html +205 -0
  79. package/docs/interfaces/datatypes.EndpointConfigurationUpdate.html +433 -0
  80. package/docs/interfaces/datatypes.EndpointIPPolicy.html +181 -0
  81. package/docs/interfaces/datatypes.EndpointIPPolicyMutate.html +186 -0
  82. package/docs/interfaces/datatypes.EndpointIPPolicyReplace.html +176 -0
  83. package/docs/interfaces/datatypes.EndpointLogging.html +186 -0
  84. package/docs/interfaces/datatypes.EndpointLoggingMutate.html +186 -0
  85. package/docs/interfaces/datatypes.EndpointLoggingReplace.html +176 -0
  86. package/docs/interfaces/datatypes.EndpointMutualTLS.html +186 -0
  87. package/docs/interfaces/datatypes.EndpointMutualTLSMutate.html +186 -0
  88. package/docs/interfaces/datatypes.EndpointMutualTLSReplace.html +176 -0
  89. package/docs/interfaces/datatypes.EndpointOAuth.html +281 -0
  90. package/docs/interfaces/datatypes.EndpointOAuthFacebook.html +243 -0
  91. package/docs/interfaces/datatypes.EndpointOAuthGitHub.html +281 -0
  92. package/docs/interfaces/datatypes.EndpointOAuthGoogle.html +243 -0
  93. package/docs/interfaces/datatypes.EndpointOAuthMicrosoft.html +243 -0
  94. package/docs/interfaces/datatypes.EndpointOAuthProvider.html +224 -0
  95. package/docs/interfaces/datatypes.EndpointOAuthReplace.html +176 -0
  96. package/docs/interfaces/datatypes.EndpointOIDC.html +319 -0
  97. package/docs/interfaces/datatypes.EndpointOIDCReplace.html +176 -0
  98. package/docs/interfaces/datatypes.EndpointRequestHeaders.html +205 -0
  99. package/docs/interfaces/datatypes.EndpointRequestHeadersReplace.html +176 -0
  100. package/docs/interfaces/datatypes.EndpointResponseHeaders.html +205 -0
  101. package/docs/interfaces/datatypes.EndpointResponseHeadersReplace.html +176 -0
  102. package/docs/interfaces/datatypes.EndpointSAML.html +433 -0
  103. package/docs/interfaces/datatypes.EndpointSAMLMutate.html +338 -0
  104. package/docs/interfaces/datatypes.EndpointSAMLReplace.html +176 -0
  105. package/docs/interfaces/datatypes.EndpointTLSTermination.html +205 -0
  106. package/docs/interfaces/datatypes.EndpointTLSTerminationReplace.html +176 -0
  107. package/docs/interfaces/datatypes.EndpointWebhookValidation.html +205 -0
  108. package/docs/interfaces/datatypes.EndpointWebhookValidationReplace.html +176 -0
  109. package/docs/interfaces/datatypes.Error.html +204 -0
  110. package/docs/interfaces/datatypes.EventDestination.html +281 -0
  111. package/docs/interfaces/datatypes.EventDestinationCreate.html +224 -0
  112. package/docs/interfaces/datatypes.EventDestinationList.html +205 -0
  113. package/docs/interfaces/datatypes.EventDestinationUpdate.html +243 -0
  114. package/docs/interfaces/datatypes.EventSource.html +186 -0
  115. package/docs/interfaces/datatypes.EventSourceCreate.html +186 -0
  116. package/docs/interfaces/datatypes.EventSourceItem.html +193 -0
  117. package/docs/interfaces/datatypes.EventSourceList.html +186 -0
  118. package/docs/interfaces/datatypes.EventSourcePaging.html +174 -0
  119. package/docs/interfaces/datatypes.EventSourceReplace.html +167 -0
  120. package/docs/interfaces/datatypes.EventSourceUpdate.html +186 -0
  121. package/docs/interfaces/datatypes.EventStream.html +319 -0
  122. package/docs/interfaces/datatypes.EventStreamCreate.html +262 -0
  123. package/docs/interfaces/datatypes.EventStreamList.html +205 -0
  124. package/docs/interfaces/datatypes.EventStreamUpdate.html +262 -0
  125. package/docs/interfaces/datatypes.EventSubscription.html +281 -0
  126. package/docs/interfaces/datatypes.EventSubscriptionCreate.html +224 -0
  127. package/docs/interfaces/datatypes.EventSubscriptionList.html +205 -0
  128. package/docs/interfaces/datatypes.EventSubscriptionUpdate.html +243 -0
  129. package/docs/interfaces/datatypes.EventTarget.html +205 -0
  130. package/docs/interfaces/datatypes.EventTargetCloudwatchLogs.html +186 -0
  131. package/docs/interfaces/datatypes.EventTargetFirehose.html +186 -0
  132. package/docs/interfaces/datatypes.EventTargetKinesis.html +186 -0
  133. package/docs/interfaces/datatypes.IPPolicy.html +262 -0
  134. package/docs/interfaces/datatypes.IPPolicyCreate.html +205 -0
  135. package/docs/interfaces/datatypes.IPPolicyList.html +205 -0
  136. package/docs/interfaces/datatypes.IPPolicyRule.html +281 -0
  137. package/docs/interfaces/datatypes.IPPolicyRuleCreate.html +224 -0
  138. package/docs/interfaces/datatypes.IPPolicyRuleList.html +205 -0
  139. package/docs/interfaces/datatypes.IPPolicyRuleUpdate.html +219 -0
  140. package/docs/interfaces/datatypes.IPPolicyUpdate.html +200 -0
  141. package/docs/interfaces/datatypes.IPRestriction.html +300 -0
  142. package/docs/interfaces/datatypes.IPRestrictionCreate.html +243 -0
  143. package/docs/interfaces/datatypes.IPRestrictionList.html +205 -0
  144. package/docs/interfaces/datatypes.IPRestrictionUpdate.html +238 -0
  145. package/docs/interfaces/datatypes.Item.html +167 -0
  146. package/docs/interfaces/datatypes.Paging.html +176 -0
  147. package/docs/interfaces/datatypes.Ref.html +186 -0
  148. package/docs/interfaces/datatypes.ReservedAddr.html +300 -0
  149. package/docs/interfaces/datatypes.ReservedAddrCreate.html +224 -0
  150. package/docs/interfaces/datatypes.ReservedAddrList.html +205 -0
  151. package/docs/interfaces/datatypes.ReservedAddrUpdate.html +219 -0
  152. package/docs/interfaces/datatypes.ReservedDomain.html +414 -0
  153. package/docs/interfaces/datatypes.ReservedDomainCertJob.html +224 -0
  154. package/docs/interfaces/datatypes.ReservedDomainCertPolicy.html +186 -0
  155. package/docs/interfaces/datatypes.ReservedDomainCertStatus.html +186 -0
  156. package/docs/interfaces/datatypes.ReservedDomainCreate.html +300 -0
  157. package/docs/interfaces/datatypes.ReservedDomainList.html +205 -0
  158. package/docs/interfaces/datatypes.ReservedDomainUpdate.html +276 -0
  159. package/docs/interfaces/datatypes.SSHCertificateAuthority.html +281 -0
  160. package/docs/interfaces/datatypes.SSHCertificateAuthorityCreate.html +243 -0
  161. package/docs/interfaces/datatypes.SSHCertificateAuthorityList.html +205 -0
  162. package/docs/interfaces/datatypes.SSHCertificateAuthorityUpdate.html +200 -0
  163. package/docs/interfaces/datatypes.SSHCredential.html +281 -0
  164. package/docs/interfaces/datatypes.SSHCredentialCreate.html +224 -0
  165. package/docs/interfaces/datatypes.SSHCredentialList.html +205 -0
  166. package/docs/interfaces/datatypes.SSHCredentialUpdate.html +219 -0
  167. package/docs/interfaces/datatypes.SSHHostCertificate.html +376 -0
  168. package/docs/interfaces/datatypes.SSHHostCertificateCreate.html +281 -0
  169. package/docs/interfaces/datatypes.SSHHostCertificateList.html +205 -0
  170. package/docs/interfaces/datatypes.SSHHostCertificateUpdate.html +200 -0
  171. package/docs/interfaces/datatypes.SSHUserCertificate.html +414 -0
  172. package/docs/interfaces/datatypes.SSHUserCertificateCreate.html +319 -0
  173. package/docs/interfaces/datatypes.SSHUserCertificateList.html +205 -0
  174. package/docs/interfaces/datatypes.SSHUserCertificateUpdate.html +200 -0
  175. package/docs/interfaces/datatypes.TLSCertificate.html +547 -0
  176. package/docs/interfaces/datatypes.TLSCertificateCreate.html +224 -0
  177. package/docs/interfaces/datatypes.TLSCertificateList.html +205 -0
  178. package/docs/interfaces/datatypes.TLSCertificateSANs.html +186 -0
  179. package/docs/interfaces/datatypes.TLSCertificateUpdate.html +200 -0
  180. package/docs/interfaces/datatypes.Tunnel.html +281 -0
  181. package/docs/interfaces/datatypes.TunnelList.html +205 -0
  182. package/docs/interfaces/datatypes.TunnelSession.html +338 -0
  183. package/docs/interfaces/datatypes.TunnelSessionList.html +205 -0
  184. package/docs/interfaces/datatypes.TunnelSessionsUpdate.html +162 -0
  185. package/docs/modules/client.html +137 -0
  186. package/docs/modules/datatypes.html +668 -0
  187. package/docs/modules/services.html +260 -0
  188. package/docs/modules.html +119 -0
  189. package/lib/client.d.ts +145 -0
  190. package/lib/client.d.ts.map +1 -0
  191. package/lib/client.js +102 -0
  192. package/lib/client.js.map +1 -0
  193. package/lib/{types.d.ts → datatypes.d.ts} +620 -816
  194. package/lib/datatypes.d.ts.map +1 -0
  195. package/lib/{types.js → datatypes.js} +1 -1
  196. package/lib/datatypes.js.map +1 -0
  197. package/lib/index.d.ts +3 -314
  198. package/lib/index.d.ts.map +1 -0
  199. package/lib/index.js +25 -887
  200. package/lib/index.js.map +1 -1
  201. package/lib/services.d.ts +773 -0
  202. package/lib/services.d.ts.map +1 -0
  203. package/lib/services.js +2761 -0
  204. package/lib/services.js.map +1 -0
  205. package/lib/util.d.ts +5 -0
  206. package/lib/util.d.ts.map +1 -0
  207. package/lib/util.js +53 -0
  208. package/lib/util.js.map +1 -0
  209. package/package.json +12 -3
  210. package/src/client.ts +265 -0
  211. package/src/{types.ts → datatypes.ts} +648 -869
  212. package/src/index.ts +2 -616
  213. package/src/services.ts +2560 -0
  214. package/src/util.ts +48 -0
  215. package/test/apikey.test.js +44 -30
  216. package/test/endpointConfigurations.test.js +38 -34
  217. package/tsconfig.json +17 -7
  218. package/lib/types.js.map +0 -1
@@ -0,0 +1,2560 @@
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
+ * Certificate Authorities are x509 certificates that are used to sign other
241
+ x509 certificates. Attach a Certificate Authority to the Mutual TLS module
242
+ to verify that the TLS certificate presented by a client has been signed by
243
+ this CA. Certificate Authorities are used only for mTLS validation only and
244
+ thus a private key is not included in the resource.
245
+ */
246
+ export class CertificateAuthorities {
247
+ private httpClient: Wretcher;
248
+
249
+ /** Do not construct this object directly, use the <code>certificateAuthorities</code> property of an <code>Ngrok</code> client object instead. */
250
+ public constructor(httpClient: Wretcher) {
251
+ this.httpClient = httpClient;
252
+ }
253
+ /**
254
+ * Upload a new Certificate Authority
255
+ */
256
+ public create(
257
+ arg: datatypes.CertificateAuthorityCreate
258
+ ): Promise<datatypes.CertificateAuthority> {
259
+ return this.httpClient
260
+ .url(`/certificate_authorities`)
261
+ .post(util.serializeArgument(arg))
262
+ .json(payload => util.deserializeResult(payload))
263
+ .then(f => f, util.onRejected);
264
+ }
265
+
266
+ /**
267
+ * Delete a Certificate Authority
268
+ */
269
+ public delete(arg: datatypes.Item): Promise<void> {
270
+ return this.httpClient
271
+ .url(`/certificate_authorities/${arg.id}`)
272
+ .delete()
273
+ .json(payload => util.deserializeResult(payload))
274
+ .then(f => f, util.onRejected);
275
+ }
276
+
277
+ /**
278
+ * Get detailed information about a certficate authority
279
+ */
280
+ public get(arg: datatypes.Item): Promise<datatypes.CertificateAuthority> {
281
+ return this.httpClient
282
+ .url(`/certificate_authorities/${arg.id}`)
283
+ .get()
284
+ .json(payload => util.deserializeResult(payload))
285
+ .then(f => f, util.onRejected);
286
+ }
287
+
288
+ /**
289
+ * List all Certificate Authority on this account
290
+ */
291
+ public async list(): Promise<Array<datatypes.CertificateAuthority>> {
292
+ const array: Array<datatypes.CertificateAuthority> = [];
293
+ for await (const item of this._asyncList()) {
294
+ array.push(item);
295
+ }
296
+ return array;
297
+ }
298
+ private _pagedList(
299
+ arg: datatypes.Paging
300
+ ): Promise<datatypes.CertificateAuthorityList> {
301
+ return this.httpClient
302
+ .url(`/certificate_authorities`)
303
+ .query(arg)
304
+ .get()
305
+ .json(payload => util.deserializeResult(payload))
306
+ .then(util.onFulfilled, util.onRejected);
307
+ }
308
+ private async *_asyncList() {
309
+ const limit = '100';
310
+ let nextPage = 'initial loop';
311
+ let page: datatypes.Paging = { limit: limit };
312
+
313
+ while (nextPage) {
314
+ const pagedList = await this._pagedList(page);
315
+ nextPage = pagedList.nextPageUri;
316
+ const items: datatypes.CertificateAuthority[] =
317
+ pagedList.certificateAuthorities;
318
+
319
+ if (nextPage) {
320
+ page = {
321
+ beforeId: items[items.length - 1].id,
322
+ limit: limit,
323
+ };
324
+ }
325
+
326
+ for (const item of items) {
327
+ yield item;
328
+ }
329
+ }
330
+ }
331
+ /**
332
+ * Update attributes of a Certificate Authority by ID
333
+ */
334
+ public update(
335
+ arg: datatypes.CertificateAuthorityUpdate
336
+ ): Promise<datatypes.CertificateAuthority> {
337
+ return this.httpClient
338
+ .url(`/certificate_authorities/${arg.id}`)
339
+ .patch(util.serializeArgument(arg))
340
+ .json(payload => util.deserializeResult(payload))
341
+ .then(f => f, util.onRejected);
342
+ }
343
+ }
344
+
345
+ /**
346
+ * Tunnel Credentials are ngrok agent authtokens. They authorize the ngrok
347
+ agent to connect the ngrok service as your account. They are installed with
348
+ the `ngrok authtoken` command or by specifying it in the `ngrok.yml`
349
+ configuration file with the `authtoken` property.
350
+ */
351
+ export class Credentials {
352
+ private httpClient: Wretcher;
353
+
354
+ /** Do not construct this object directly, use the <code>credentials</code> property of an <code>Ngrok</code> client object instead. */
355
+ public constructor(httpClient: Wretcher) {
356
+ this.httpClient = httpClient;
357
+ }
358
+ /**
359
+ * 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.
360
+ */
361
+ public create(
362
+ arg: datatypes.CredentialCreate
363
+ ): Promise<datatypes.Credential> {
364
+ return this.httpClient
365
+ .url(`/credentials`)
366
+ .post(util.serializeArgument(arg))
367
+ .json(payload => util.deserializeResult(payload))
368
+ .then(f => f, util.onRejected);
369
+ }
370
+
371
+ /**
372
+ * Delete a tunnel authtoken credential by ID
373
+ */
374
+ public delete(arg: datatypes.Item): Promise<void> {
375
+ return this.httpClient
376
+ .url(`/credentials/${arg.id}`)
377
+ .delete()
378
+ .json(payload => util.deserializeResult(payload))
379
+ .then(f => f, util.onRejected);
380
+ }
381
+
382
+ /**
383
+ * Get detailed information about a tunnel authtoken credential
384
+ */
385
+ public get(arg: datatypes.Item): Promise<datatypes.Credential> {
386
+ return this.httpClient
387
+ .url(`/credentials/${arg.id}`)
388
+ .get()
389
+ .json(payload => util.deserializeResult(payload))
390
+ .then(f => f, util.onRejected);
391
+ }
392
+
393
+ /**
394
+ * List all tunnel authtoken credentials on this account
395
+ */
396
+ public async list(): Promise<Array<datatypes.Credential>> {
397
+ const array: Array<datatypes.Credential> = [];
398
+ for await (const item of this._asyncList()) {
399
+ array.push(item);
400
+ }
401
+ return array;
402
+ }
403
+ private _pagedList(arg: datatypes.Paging): Promise<datatypes.CredentialList> {
404
+ return this.httpClient
405
+ .url(`/credentials`)
406
+ .query(arg)
407
+ .get()
408
+ .json(payload => util.deserializeResult(payload))
409
+ .then(util.onFulfilled, util.onRejected);
410
+ }
411
+ private async *_asyncList() {
412
+ const limit = '100';
413
+ let nextPage = 'initial loop';
414
+ let page: datatypes.Paging = { limit: limit };
415
+
416
+ while (nextPage) {
417
+ const pagedList = await this._pagedList(page);
418
+ nextPage = pagedList.nextPageUri;
419
+ const items: datatypes.Credential[] = pagedList.credentials;
420
+
421
+ if (nextPage) {
422
+ page = {
423
+ beforeId: items[items.length - 1].id,
424
+ limit: limit,
425
+ };
426
+ }
427
+
428
+ for (const item of items) {
429
+ yield item;
430
+ }
431
+ }
432
+ }
433
+ /**
434
+ * Update attributes of an tunnel authtoken credential by ID
435
+ */
436
+ public update(
437
+ arg: datatypes.CredentialUpdate
438
+ ): Promise<datatypes.Credential> {
439
+ return this.httpClient
440
+ .url(`/credentials/${arg.id}`)
441
+ .patch(util.serializeArgument(arg))
442
+ .json(payload => util.deserializeResult(payload))
443
+ .then(f => f, util.onRejected);
444
+ }
445
+ }
446
+
447
+ /**
448
+ * Endpoint Configurations are a reusable group of modules that encapsulate how
449
+ traffic to a domain or address is handled. Endpoint configurations are only
450
+ applied to Domains and TCP Addresses they have been attached to.
451
+ */
452
+ export class EndpointConfigurations {
453
+ private httpClient: Wretcher;
454
+
455
+ /** Do not construct this object directly, use the <code>endpointConfigurations</code> property of an <code>Ngrok</code> client object instead. */
456
+ public constructor(httpClient: Wretcher) {
457
+ this.httpClient = httpClient;
458
+ }
459
+ /**
460
+ * Create a new endpoint configuration
461
+ */
462
+ public create(
463
+ arg: datatypes.EndpointConfigurationCreate
464
+ ): Promise<datatypes.EndpointConfiguration> {
465
+ return this.httpClient
466
+ .url(`/endpoint_configurations`)
467
+ .post(util.serializeArgument(arg))
468
+ .json(payload => util.deserializeResult(payload))
469
+ .then(f => f, util.onRejected);
470
+ }
471
+
472
+ /**
473
+ * Delete an endpoint configuration. This operation will fail if the endpoint configuration is still referenced by any reserved domain or reserved address.
474
+ */
475
+ public delete(arg: datatypes.Item): Promise<void> {
476
+ return this.httpClient
477
+ .url(`/endpoint_configurations/${arg.id}`)
478
+ .delete()
479
+ .json(payload => util.deserializeResult(payload))
480
+ .then(f => f, util.onRejected);
481
+ }
482
+
483
+ /**
484
+ * Returns detailed information about an endpoint configuration
485
+ */
486
+ public get(arg: datatypes.Item): Promise<datatypes.EndpointConfiguration> {
487
+ return this.httpClient
488
+ .url(`/endpoint_configurations/${arg.id}`)
489
+ .get()
490
+ .json(payload => util.deserializeResult(payload))
491
+ .then(f => f, util.onRejected);
492
+ }
493
+
494
+ /**
495
+ * Returns a list of all endpoint configurations on this account
496
+ */
497
+ public async list(): Promise<Array<datatypes.EndpointConfiguration>> {
498
+ const array: Array<datatypes.EndpointConfiguration> = [];
499
+ for await (const item of this._asyncList()) {
500
+ array.push(item);
501
+ }
502
+ return array;
503
+ }
504
+ private _pagedList(
505
+ arg: datatypes.Paging
506
+ ): Promise<datatypes.EndpointConfigurationList> {
507
+ return this.httpClient
508
+ .url(`/endpoint_configurations`)
509
+ .query(arg)
510
+ .get()
511
+ .json(payload => util.deserializeResult(payload))
512
+ .then(util.onFulfilled, util.onRejected);
513
+ }
514
+ private async *_asyncList() {
515
+ const limit = '100';
516
+ let nextPage = 'initial loop';
517
+ let page: datatypes.Paging = { limit: limit };
518
+
519
+ while (nextPage) {
520
+ const pagedList = await this._pagedList(page);
521
+ nextPage = pagedList.nextPageUri;
522
+ const items: datatypes.EndpointConfiguration[] =
523
+ pagedList.endpointConfigurations;
524
+
525
+ if (nextPage) {
526
+ page = {
527
+ beforeId: items[items.length - 1].id,
528
+ limit: limit,
529
+ };
530
+ }
531
+
532
+ for (const item of items) {
533
+ yield item;
534
+ }
535
+ }
536
+ }
537
+ /**
538
+ * Updates an endpoint configuration. 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.
539
+ */
540
+ public update(
541
+ arg: datatypes.EndpointConfigurationUpdate
542
+ ): Promise<datatypes.EndpointConfiguration> {
543
+ return this.httpClient
544
+ .url(`/endpoint_configurations/${arg.id}`)
545
+ .patch(util.serializeArgument(arg))
546
+ .json(payload => util.deserializeResult(payload))
547
+ .then(f => f, util.onRejected);
548
+ }
549
+ }
550
+
551
+ export class EventStreams {
552
+ private httpClient: Wretcher;
553
+
554
+ /** Do not construct this object directly, use the <code>eventStreams</code> property of an <code>Ngrok</code> client object instead. */
555
+ public constructor(httpClient: Wretcher) {
556
+ this.httpClient = httpClient;
557
+ }
558
+ /**
559
+ * Create a new Event Stream. It will not apply to anything until you associate it with one or more Endpoint Configs.
560
+ */
561
+ public create(
562
+ arg: datatypes.EventStreamCreate
563
+ ): Promise<datatypes.EventStream> {
564
+ return this.httpClient
565
+ .url(`/event_streams`)
566
+ .post(util.serializeArgument(arg))
567
+ .json(payload => util.deserializeResult(payload))
568
+ .then(f => f, util.onRejected);
569
+ }
570
+
571
+ /**
572
+ * Delete an Event Stream. Associated Event Destinations will be preserved.
573
+ */
574
+ public delete(arg: datatypes.Item): Promise<void> {
575
+ return this.httpClient
576
+ .url(`/event_streams/${arg.id}`)
577
+ .delete()
578
+ .json(payload => util.deserializeResult(payload))
579
+ .then(f => f, util.onRejected);
580
+ }
581
+
582
+ /**
583
+ * Get detailed information about an Event Stream by ID.
584
+ */
585
+ public get(arg: datatypes.Item): Promise<datatypes.EventStream> {
586
+ return this.httpClient
587
+ .url(`/event_streams/${arg.id}`)
588
+ .get()
589
+ .json(payload => util.deserializeResult(payload))
590
+ .then(f => f, util.onRejected);
591
+ }
592
+
593
+ /**
594
+ * List all Event Streams available on this account.
595
+ */
596
+ public async list(): Promise<Array<datatypes.EventStream>> {
597
+ const array: Array<datatypes.EventStream> = [];
598
+ for await (const item of this._asyncList()) {
599
+ array.push(item);
600
+ }
601
+ return array;
602
+ }
603
+ private _pagedList(
604
+ arg: datatypes.Paging
605
+ ): Promise<datatypes.EventStreamList> {
606
+ return this.httpClient
607
+ .url(`/event_streams`)
608
+ .query(arg)
609
+ .get()
610
+ .json(payload => util.deserializeResult(payload))
611
+ .then(util.onFulfilled, util.onRejected);
612
+ }
613
+ private async *_asyncList() {
614
+ const limit = '100';
615
+ let nextPage = 'initial loop';
616
+ let page: datatypes.Paging = { limit: limit };
617
+
618
+ while (nextPage) {
619
+ const pagedList = await this._pagedList(page);
620
+ nextPage = pagedList.nextPageUri;
621
+ const items: datatypes.EventStream[] = pagedList.eventStreams;
622
+
623
+ if (nextPage) {
624
+ page = {
625
+ beforeId: items[items.length - 1].id,
626
+ limit: limit,
627
+ };
628
+ }
629
+
630
+ for (const item of items) {
631
+ yield item;
632
+ }
633
+ }
634
+ }
635
+ /**
636
+ * Update attributes of an Event Stream by ID.
637
+ */
638
+ public update(
639
+ arg: datatypes.EventStreamUpdate
640
+ ): Promise<datatypes.EventStream> {
641
+ return this.httpClient
642
+ .url(`/event_streams/${arg.id}`)
643
+ .patch(util.serializeArgument(arg))
644
+ .json(payload => util.deserializeResult(payload))
645
+ .then(f => f, util.onRejected);
646
+ }
647
+ }
648
+
649
+ export class EventDestinations {
650
+ private httpClient: Wretcher;
651
+
652
+ /** Do not construct this object directly, use the <code>eventDestinations</code> property of an <code>Ngrok</code> client object instead. */
653
+ public constructor(httpClient: Wretcher) {
654
+ this.httpClient = httpClient;
655
+ }
656
+ /**
657
+ * 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.
658
+ */
659
+ public create(
660
+ arg: datatypes.EventDestinationCreate
661
+ ): Promise<datatypes.EventDestination> {
662
+ return this.httpClient
663
+ .url(`/event_destinations`)
664
+ .post(util.serializeArgument(arg))
665
+ .json(payload => util.deserializeResult(payload))
666
+ .then(f => f, util.onRejected);
667
+ }
668
+
669
+ /**
670
+ * Delete an Event Destination. If the Event Destination is still referenced by an Event Stream, this will throw an error until that Event Stream has removed that reference.
671
+ */
672
+ public delete(arg: datatypes.Item): Promise<void> {
673
+ return this.httpClient
674
+ .url(`/event_destinations/${arg.id}`)
675
+ .delete()
676
+ .json(payload => util.deserializeResult(payload))
677
+ .then(f => f, util.onRejected);
678
+ }
679
+
680
+ /**
681
+ * Get detailed information about an Event Destination by ID.
682
+ */
683
+ public get(arg: datatypes.Item): Promise<datatypes.EventDestination> {
684
+ return this.httpClient
685
+ .url(`/event_destinations/${arg.id}`)
686
+ .get()
687
+ .json(payload => util.deserializeResult(payload))
688
+ .then(f => f, util.onRejected);
689
+ }
690
+
691
+ /**
692
+ * List all Event Destinations on this account.
693
+ */
694
+ public async list(): Promise<Array<datatypes.EventDestination>> {
695
+ const array: Array<datatypes.EventDestination> = [];
696
+ for await (const item of this._asyncList()) {
697
+ array.push(item);
698
+ }
699
+ return array;
700
+ }
701
+ private _pagedList(
702
+ arg: datatypes.Paging
703
+ ): Promise<datatypes.EventDestinationList> {
704
+ return this.httpClient
705
+ .url(`/event_destinations`)
706
+ .query(arg)
707
+ .get()
708
+ .json(payload => util.deserializeResult(payload))
709
+ .then(util.onFulfilled, util.onRejected);
710
+ }
711
+ private async *_asyncList() {
712
+ const limit = '100';
713
+ let nextPage = 'initial loop';
714
+ let page: datatypes.Paging = { limit: limit };
715
+
716
+ while (nextPage) {
717
+ const pagedList = await this._pagedList(page);
718
+ nextPage = pagedList.nextPageUri;
719
+ const items: datatypes.EventDestination[] = pagedList.eventDestinations;
720
+
721
+ if (nextPage) {
722
+ page = {
723
+ beforeId: items[items.length - 1].id,
724
+ limit: limit,
725
+ };
726
+ }
727
+
728
+ for (const item of items) {
729
+ yield item;
730
+ }
731
+ }
732
+ }
733
+ /**
734
+ * Update attributes of an Event Destination.
735
+ */
736
+ public update(
737
+ arg: datatypes.EventDestinationUpdate
738
+ ): Promise<datatypes.EventDestination> {
739
+ return this.httpClient
740
+ .url(`/event_destinations/${arg.id}`)
741
+ .patch(util.serializeArgument(arg))
742
+ .json(payload => util.deserializeResult(payload))
743
+ .then(f => f, util.onRejected);
744
+ }
745
+ }
746
+
747
+ export class EventSubscriptions {
748
+ private httpClient: Wretcher;
749
+
750
+ /** Do not construct this object directly, use the <code>eventSubscriptions</code> property of an <code>Ngrok</code> client object instead. */
751
+ public constructor(httpClient: Wretcher) {
752
+ this.httpClient = httpClient;
753
+ }
754
+ /**
755
+ * Create an Event Subscription.
756
+ */
757
+ public create(
758
+ arg: datatypes.EventSubscriptionCreate
759
+ ): Promise<datatypes.EventSubscription> {
760
+ return this.httpClient
761
+ .url(`/event_subscriptions`)
762
+ .post(util.serializeArgument(arg))
763
+ .json(payload => util.deserializeResult(payload))
764
+ .then(f => f, util.onRejected);
765
+ }
766
+
767
+ /**
768
+ * Delete an Event Subscription.
769
+ */
770
+ public delete(arg: datatypes.Item): Promise<void> {
771
+ return this.httpClient
772
+ .url(`/event_subscriptions/${arg.id}`)
773
+ .delete()
774
+ .json(payload => util.deserializeResult(payload))
775
+ .then(f => f, util.onRejected);
776
+ }
777
+
778
+ /**
779
+ * Get an Event Subscription by ID.
780
+ */
781
+ public get(arg: datatypes.Item): Promise<datatypes.EventSubscription> {
782
+ return this.httpClient
783
+ .url(`/event_subscriptions/${arg.id}`)
784
+ .get()
785
+ .json(payload => util.deserializeResult(payload))
786
+ .then(f => f, util.onRejected);
787
+ }
788
+
789
+ /**
790
+ * List this Account's Event Subscriptions.
791
+ */
792
+ public async list(): Promise<Array<datatypes.EventSubscription>> {
793
+ const array: Array<datatypes.EventSubscription> = [];
794
+ for await (const item of this._asyncList()) {
795
+ array.push(item);
796
+ }
797
+ return array;
798
+ }
799
+ private _pagedList(
800
+ arg: datatypes.Paging
801
+ ): Promise<datatypes.EventSubscriptionList> {
802
+ return this.httpClient
803
+ .url(`/event_subscriptions`)
804
+ .query(arg)
805
+ .get()
806
+ .json(payload => util.deserializeResult(payload))
807
+ .then(util.onFulfilled, util.onRejected);
808
+ }
809
+ private async *_asyncList() {
810
+ const limit = '100';
811
+ let nextPage = 'initial loop';
812
+ let page: datatypes.Paging = { limit: limit };
813
+
814
+ while (nextPage) {
815
+ const pagedList = await this._pagedList(page);
816
+ nextPage = pagedList.nextPageUri;
817
+ const items: datatypes.EventSubscription[] = pagedList.eventSubscriptions;
818
+
819
+ if (nextPage) {
820
+ page = {
821
+ beforeId: items[items.length - 1].id,
822
+ limit: limit,
823
+ };
824
+ }
825
+
826
+ for (const item of items) {
827
+ yield item;
828
+ }
829
+ }
830
+ }
831
+ /**
832
+ * Update an Event Subscription.
833
+ */
834
+ public update(
835
+ arg: datatypes.EventSubscriptionUpdate
836
+ ): Promise<datatypes.EventSubscription> {
837
+ return this.httpClient
838
+ .url(`/event_subscriptions/${arg.id}`)
839
+ .patch(util.serializeArgument(arg))
840
+ .json(payload => util.deserializeResult(payload))
841
+ .then(f => f, util.onRejected);
842
+ }
843
+ }
844
+
845
+ export class EventSources {
846
+ private httpClient: Wretcher;
847
+
848
+ /** Do not construct this object directly, use the <code>eventSources</code> property of an <code>Ngrok</code> client object instead. */
849
+ public constructor(httpClient: Wretcher) {
850
+ this.httpClient = httpClient;
851
+ }
852
+ /**
853
+ * Add an additional type for which this event subscription will trigger
854
+ */
855
+ public create(
856
+ arg: datatypes.EventSourceCreate
857
+ ): Promise<datatypes.EventSource> {
858
+ return this.httpClient
859
+ .url(`/event_subscriptions/${arg.subscriptionId}/sources`)
860
+ .post(util.serializeArgument(arg))
861
+ .json(payload => util.deserializeResult(payload))
862
+ .then(f => f, util.onRejected);
863
+ }
864
+
865
+ /**
866
+ * Remove a type for which this event subscription will trigger
867
+ */
868
+ public delete(arg: datatypes.EventSourceItem): Promise<void> {
869
+ return this.httpClient
870
+ .url(`/event_subscriptions/${arg.subscriptionId}/sources/${arg.type}`)
871
+ .delete()
872
+ .json(payload => util.deserializeResult(payload))
873
+ .then(f => f, util.onRejected);
874
+ }
875
+
876
+ /**
877
+ * Get the details for a given type that triggers for the given event subscription
878
+ */
879
+ public get(arg: datatypes.EventSourceItem): Promise<datatypes.EventSource> {
880
+ return this.httpClient
881
+ .url(`/event_subscriptions/${arg.subscriptionId}/sources/${arg.type}`)
882
+ .get()
883
+ .json(payload => util.deserializeResult(payload))
884
+ .then(f => f, util.onRejected);
885
+ }
886
+
887
+ /**
888
+ * List the types for which this event subscription will trigger
889
+ */
890
+ public list(
891
+ arg: datatypes.EventSourcePaging
892
+ ): Promise<datatypes.EventSourceList> {
893
+ return this.httpClient
894
+ .url(`/event_subscriptions/${arg.subscriptionId}/sources`)
895
+ .get()
896
+ .json(payload => util.deserializeResult(payload))
897
+ .then(f => f, util.onRejected);
898
+ }
899
+
900
+ /**
901
+ * Update the type for which this event subscription will trigger
902
+ */
903
+ public update(
904
+ arg: datatypes.EventSourceUpdate
905
+ ): Promise<datatypes.EventSource> {
906
+ return this.httpClient
907
+ .url(`/event_subscriptions/${arg.subscriptionId}/sources/${arg.type}`)
908
+ .patch(util.serializeArgument(arg))
909
+ .json(payload => util.deserializeResult(payload))
910
+ .then(f => f, util.onRejected);
911
+ }
912
+ }
913
+
914
+ /**
915
+ * IP Policies are reusable groups of CIDR ranges with an `allow` or `deny`
916
+ action. They can be attached to endpoints via the Endpoint Configuration IP
917
+ Policy module. They can also be used with IP Restrictions to control source
918
+ IP ranges that can start tunnel sessions and connect to the API and dashboard.
919
+ */
920
+ export class IPPolicies {
921
+ private httpClient: Wretcher;
922
+
923
+ /** Do not construct this object directly, use the <code>ipPolicies</code> property of an <code>Ngrok</code> client object instead. */
924
+ public constructor(httpClient: Wretcher) {
925
+ this.httpClient = httpClient;
926
+ }
927
+ /**
928
+ * 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.
929
+ */
930
+ public create(arg: datatypes.IPPolicyCreate): Promise<datatypes.IPPolicy> {
931
+ return this.httpClient
932
+ .url(`/ip_policies`)
933
+ .post(util.serializeArgument(arg))
934
+ .json(payload => util.deserializeResult(payload))
935
+ .then(f => f, util.onRejected);
936
+ }
937
+
938
+ /**
939
+ * 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.
940
+ */
941
+ public delete(arg: datatypes.Item): Promise<void> {
942
+ return this.httpClient
943
+ .url(`/ip_policies/${arg.id}`)
944
+ .delete()
945
+ .json(payload => util.deserializeResult(payload))
946
+ .then(f => f, util.onRejected);
947
+ }
948
+
949
+ /**
950
+ * Get detailed information about an IP policy by ID.
951
+ */
952
+ public get(arg: datatypes.Item): Promise<datatypes.IPPolicy> {
953
+ return this.httpClient
954
+ .url(`/ip_policies/${arg.id}`)
955
+ .get()
956
+ .json(payload => util.deserializeResult(payload))
957
+ .then(f => f, util.onRejected);
958
+ }
959
+
960
+ /**
961
+ * List all IP policies on this account
962
+ */
963
+ public async list(): Promise<Array<datatypes.IPPolicy>> {
964
+ const array: Array<datatypes.IPPolicy> = [];
965
+ for await (const item of this._asyncList()) {
966
+ array.push(item);
967
+ }
968
+ return array;
969
+ }
970
+ private _pagedList(arg: datatypes.Paging): Promise<datatypes.IPPolicyList> {
971
+ return this.httpClient
972
+ .url(`/ip_policies`)
973
+ .query(arg)
974
+ .get()
975
+ .json(payload => util.deserializeResult(payload))
976
+ .then(util.onFulfilled, util.onRejected);
977
+ }
978
+ private async *_asyncList() {
979
+ const limit = '100';
980
+ let nextPage = 'initial loop';
981
+ let page: datatypes.Paging = { limit: limit };
982
+
983
+ while (nextPage) {
984
+ const pagedList = await this._pagedList(page);
985
+ nextPage = pagedList.nextPageUri;
986
+ const items: datatypes.IPPolicy[] = pagedList.ipPolicies;
987
+
988
+ if (nextPage) {
989
+ page = {
990
+ beforeId: items[items.length - 1].id,
991
+ limit: limit,
992
+ };
993
+ }
994
+
995
+ for (const item of items) {
996
+ yield item;
997
+ }
998
+ }
999
+ }
1000
+ /**
1001
+ * Update attributes of an IP policy by ID
1002
+ */
1003
+ public update(arg: datatypes.IPPolicyUpdate): Promise<datatypes.IPPolicy> {
1004
+ return this.httpClient
1005
+ .url(`/ip_policies/${arg.id}`)
1006
+ .patch(util.serializeArgument(arg))
1007
+ .json(payload => util.deserializeResult(payload))
1008
+ .then(f => f, util.onRejected);
1009
+ }
1010
+ }
1011
+
1012
+ /**
1013
+ * IP Policy Rules are the IPv4 or IPv6 CIDRs entries that
1014
+ make up an IP Policy.
1015
+ */
1016
+ export class IPPolicyRules {
1017
+ private httpClient: Wretcher;
1018
+
1019
+ /** Do not construct this object directly, use the <code>ipPolicyRules</code> property of an <code>Ngrok</code> client object instead. */
1020
+ public constructor(httpClient: Wretcher) {
1021
+ this.httpClient = httpClient;
1022
+ }
1023
+ /**
1024
+ * Create a new IP policy rule attached to an IP Policy.
1025
+ */
1026
+ public create(
1027
+ arg: datatypes.IPPolicyRuleCreate
1028
+ ): Promise<datatypes.IPPolicyRule> {
1029
+ return this.httpClient
1030
+ .url(`/ip_policy_rules`)
1031
+ .post(util.serializeArgument(arg))
1032
+ .json(payload => util.deserializeResult(payload))
1033
+ .then(f => f, util.onRejected);
1034
+ }
1035
+
1036
+ /**
1037
+ * Delete an IP policy rule.
1038
+ */
1039
+ public delete(arg: datatypes.Item): Promise<void> {
1040
+ return this.httpClient
1041
+ .url(`/ip_policy_rules/${arg.id}`)
1042
+ .delete()
1043
+ .json(payload => util.deserializeResult(payload))
1044
+ .then(f => f, util.onRejected);
1045
+ }
1046
+
1047
+ /**
1048
+ * Get detailed information about an IP policy rule by ID.
1049
+ */
1050
+ public get(arg: datatypes.Item): Promise<datatypes.IPPolicyRule> {
1051
+ return this.httpClient
1052
+ .url(`/ip_policy_rules/${arg.id}`)
1053
+ .get()
1054
+ .json(payload => util.deserializeResult(payload))
1055
+ .then(f => f, util.onRejected);
1056
+ }
1057
+
1058
+ /**
1059
+ * List all IP policy rules on this account
1060
+ */
1061
+ public async list(): Promise<Array<datatypes.IPPolicyRule>> {
1062
+ const array: Array<datatypes.IPPolicyRule> = [];
1063
+ for await (const item of this._asyncList()) {
1064
+ array.push(item);
1065
+ }
1066
+ return array;
1067
+ }
1068
+ private _pagedList(
1069
+ arg: datatypes.Paging
1070
+ ): Promise<datatypes.IPPolicyRuleList> {
1071
+ return this.httpClient
1072
+ .url(`/ip_policy_rules`)
1073
+ .query(arg)
1074
+ .get()
1075
+ .json(payload => util.deserializeResult(payload))
1076
+ .then(util.onFulfilled, util.onRejected);
1077
+ }
1078
+ private async *_asyncList() {
1079
+ const limit = '100';
1080
+ let nextPage = 'initial loop';
1081
+ let page: datatypes.Paging = { limit: limit };
1082
+
1083
+ while (nextPage) {
1084
+ const pagedList = await this._pagedList(page);
1085
+ nextPage = pagedList.nextPageUri;
1086
+ const items: datatypes.IPPolicyRule[] = pagedList.ipPolicyRules;
1087
+
1088
+ if (nextPage) {
1089
+ page = {
1090
+ beforeId: items[items.length - 1].id,
1091
+ limit: limit,
1092
+ };
1093
+ }
1094
+
1095
+ for (const item of items) {
1096
+ yield item;
1097
+ }
1098
+ }
1099
+ }
1100
+ /**
1101
+ * Update attributes of an IP policy rule by ID
1102
+ */
1103
+ public update(
1104
+ arg: datatypes.IPPolicyRuleUpdate
1105
+ ): Promise<datatypes.IPPolicyRule> {
1106
+ return this.httpClient
1107
+ .url(`/ip_policy_rules/${arg.id}`)
1108
+ .patch(util.serializeArgument(arg))
1109
+ .json(payload => util.deserializeResult(payload))
1110
+ .then(f => f, util.onRejected);
1111
+ }
1112
+ }
1113
+
1114
+ /**
1115
+ * An IP restriction is a restriction placed on the CIDRs that are allowed to
1116
+ initate traffic to a specific aspect of your ngrok account. An IP
1117
+ restriction has a type which defines the ingress it applies to. IP
1118
+ restrictions can be used to enforce the source IPs that can make API
1119
+ requests, log in to the dashboard, start ngrok agents, and connect to your
1120
+ public-facing endpoints.
1121
+ */
1122
+ export class IPRestrictions {
1123
+ private httpClient: Wretcher;
1124
+
1125
+ /** Do not construct this object directly, use the <code>ipRestrictions</code> property of an <code>Ngrok</code> client object instead. */
1126
+ public constructor(httpClient: Wretcher) {
1127
+ this.httpClient = httpClient;
1128
+ }
1129
+ /**
1130
+ * Create a new IP restriction
1131
+ */
1132
+ public create(
1133
+ arg: datatypes.IPRestrictionCreate
1134
+ ): Promise<datatypes.IPRestriction> {
1135
+ return this.httpClient
1136
+ .url(`/ip_restrictions`)
1137
+ .post(util.serializeArgument(arg))
1138
+ .json(payload => util.deserializeResult(payload))
1139
+ .then(f => f, util.onRejected);
1140
+ }
1141
+
1142
+ /**
1143
+ * Delete an IP restriction
1144
+ */
1145
+ public delete(arg: datatypes.Item): Promise<void> {
1146
+ return this.httpClient
1147
+ .url(`/ip_restrictions/${arg.id}`)
1148
+ .delete()
1149
+ .json(payload => util.deserializeResult(payload))
1150
+ .then(f => f, util.onRejected);
1151
+ }
1152
+
1153
+ /**
1154
+ * Get detailed information about an IP restriction
1155
+ */
1156
+ public get(arg: datatypes.Item): Promise<datatypes.IPRestriction> {
1157
+ return this.httpClient
1158
+ .url(`/ip_restrictions/${arg.id}`)
1159
+ .get()
1160
+ .json(payload => util.deserializeResult(payload))
1161
+ .then(f => f, util.onRejected);
1162
+ }
1163
+
1164
+ /**
1165
+ * List all IP restrictions on this account
1166
+ */
1167
+ public async list(): Promise<Array<datatypes.IPRestriction>> {
1168
+ const array: Array<datatypes.IPRestriction> = [];
1169
+ for await (const item of this._asyncList()) {
1170
+ array.push(item);
1171
+ }
1172
+ return array;
1173
+ }
1174
+ private _pagedList(
1175
+ arg: datatypes.Paging
1176
+ ): Promise<datatypes.IPRestrictionList> {
1177
+ return this.httpClient
1178
+ .url(`/ip_restrictions`)
1179
+ .query(arg)
1180
+ .get()
1181
+ .json(payload => util.deserializeResult(payload))
1182
+ .then(util.onFulfilled, util.onRejected);
1183
+ }
1184
+ private async *_asyncList() {
1185
+ const limit = '100';
1186
+ let nextPage = 'initial loop';
1187
+ let page: datatypes.Paging = { limit: limit };
1188
+
1189
+ while (nextPage) {
1190
+ const pagedList = await this._pagedList(page);
1191
+ nextPage = pagedList.nextPageUri;
1192
+ const items: datatypes.IPRestriction[] = pagedList.ipRestrictions;
1193
+
1194
+ if (nextPage) {
1195
+ page = {
1196
+ beforeId: items[items.length - 1].id,
1197
+ limit: limit,
1198
+ };
1199
+ }
1200
+
1201
+ for (const item of items) {
1202
+ yield item;
1203
+ }
1204
+ }
1205
+ }
1206
+ /**
1207
+ * Update attributes of an IP restriction by ID
1208
+ */
1209
+ public update(
1210
+ arg: datatypes.IPRestrictionUpdate
1211
+ ): Promise<datatypes.IPRestriction> {
1212
+ return this.httpClient
1213
+ .url(`/ip_restrictions/${arg.id}`)
1214
+ .patch(util.serializeArgument(arg))
1215
+ .json(payload => util.deserializeResult(payload))
1216
+ .then(f => f, util.onRejected);
1217
+ }
1218
+ }
1219
+
1220
+ export class EndpointLoggingModule {
1221
+ private httpClient: Wretcher;
1222
+
1223
+ /** Do not construct this object directly, use the <code>endpointLoggingModule</code> property of an <code>Ngrok</code> client object instead. */
1224
+ public constructor(httpClient: Wretcher) {
1225
+ this.httpClient = httpClient;
1226
+ }
1227
+ public replace(
1228
+ arg: datatypes.EndpointLoggingReplace
1229
+ ): Promise<datatypes.EndpointLogging> {
1230
+ return this.httpClient
1231
+ .url(`/endpoint_configurations/${arg.id}/logging`)
1232
+ .put(util.serializeArgument(arg))
1233
+ .json(payload => util.deserializeResult(payload))
1234
+ .then(f => f, util.onRejected);
1235
+ }
1236
+
1237
+ public get(arg: datatypes.Item): Promise<datatypes.EndpointLogging> {
1238
+ return this.httpClient
1239
+ .url(`/endpoint_configurations/${arg.id}/logging`)
1240
+ .get()
1241
+ .json(payload => util.deserializeResult(payload))
1242
+ .then(f => f, util.onRejected);
1243
+ }
1244
+
1245
+ public delete(arg: datatypes.Item): Promise<void> {
1246
+ return this.httpClient
1247
+ .url(`/endpoint_configurations/${arg.id}/logging`)
1248
+ .delete()
1249
+ .json(payload => util.deserializeResult(payload))
1250
+ .then(f => f, util.onRejected);
1251
+ }
1252
+ }
1253
+
1254
+ export class EndpointCircuitBreakerModule {
1255
+ private httpClient: Wretcher;
1256
+
1257
+ /** Do not construct this object directly, use the <code>endpointCircuitBreakerModule</code> property of an <code>Ngrok</code> client object instead. */
1258
+ public constructor(httpClient: Wretcher) {
1259
+ this.httpClient = httpClient;
1260
+ }
1261
+ public replace(
1262
+ arg: datatypes.EndpointCircuitBreakerReplace
1263
+ ): Promise<datatypes.EndpointCircuitBreaker> {
1264
+ return this.httpClient
1265
+ .url(`/endpoint_configurations/${arg.id}/circuit_breaker`)
1266
+ .put(util.serializeArgument(arg))
1267
+ .json(payload => util.deserializeResult(payload))
1268
+ .then(f => f, util.onRejected);
1269
+ }
1270
+
1271
+ public get(arg: datatypes.Item): Promise<datatypes.EndpointCircuitBreaker> {
1272
+ return this.httpClient
1273
+ .url(`/endpoint_configurations/${arg.id}/circuit_breaker`)
1274
+ .get()
1275
+ .json(payload => util.deserializeResult(payload))
1276
+ .then(f => f, util.onRejected);
1277
+ }
1278
+
1279
+ public delete(arg: datatypes.Item): Promise<void> {
1280
+ return this.httpClient
1281
+ .url(`/endpoint_configurations/${arg.id}/circuit_breaker`)
1282
+ .delete()
1283
+ .json(payload => util.deserializeResult(payload))
1284
+ .then(f => f, util.onRejected);
1285
+ }
1286
+ }
1287
+
1288
+ export class EndpointCompressionModule {
1289
+ private httpClient: Wretcher;
1290
+
1291
+ /** Do not construct this object directly, use the <code>endpointCompressionModule</code> property of an <code>Ngrok</code> client object instead. */
1292
+ public constructor(httpClient: Wretcher) {
1293
+ this.httpClient = httpClient;
1294
+ }
1295
+ public replace(
1296
+ arg: datatypes.EndpointCompressionReplace
1297
+ ): Promise<datatypes.EndpointCompression> {
1298
+ return this.httpClient
1299
+ .url(`/endpoint_configurations/${arg.id}/compression`)
1300
+ .put(util.serializeArgument(arg))
1301
+ .json(payload => util.deserializeResult(payload))
1302
+ .then(f => f, util.onRejected);
1303
+ }
1304
+
1305
+ public get(arg: datatypes.Item): Promise<datatypes.EndpointCompression> {
1306
+ return this.httpClient
1307
+ .url(`/endpoint_configurations/${arg.id}/compression`)
1308
+ .get()
1309
+ .json(payload => util.deserializeResult(payload))
1310
+ .then(f => f, util.onRejected);
1311
+ }
1312
+
1313
+ public delete(arg: datatypes.Item): Promise<void> {
1314
+ return this.httpClient
1315
+ .url(`/endpoint_configurations/${arg.id}/compression`)
1316
+ .delete()
1317
+ .json(payload => util.deserializeResult(payload))
1318
+ .then(f => f, util.onRejected);
1319
+ }
1320
+ }
1321
+
1322
+ export class EndpointTLSTerminationModule {
1323
+ private httpClient: Wretcher;
1324
+
1325
+ /** Do not construct this object directly, use the <code>endpointTlsTerminationModule</code> property of an <code>Ngrok</code> client object instead. */
1326
+ public constructor(httpClient: Wretcher) {
1327
+ this.httpClient = httpClient;
1328
+ }
1329
+ public replace(
1330
+ arg: datatypes.EndpointTLSTerminationReplace
1331
+ ): Promise<datatypes.EndpointTLSTermination> {
1332
+ return this.httpClient
1333
+ .url(`/endpoint_configurations/${arg.id}/tls_termination`)
1334
+ .put(util.serializeArgument(arg))
1335
+ .json(payload => util.deserializeResult(payload))
1336
+ .then(f => f, util.onRejected);
1337
+ }
1338
+
1339
+ public get(arg: datatypes.Item): Promise<datatypes.EndpointTLSTermination> {
1340
+ return this.httpClient
1341
+ .url(`/endpoint_configurations/${arg.id}/tls_termination`)
1342
+ .get()
1343
+ .json(payload => util.deserializeResult(payload))
1344
+ .then(f => f, util.onRejected);
1345
+ }
1346
+
1347
+ public delete(arg: datatypes.Item): Promise<void> {
1348
+ return this.httpClient
1349
+ .url(`/endpoint_configurations/${arg.id}/tls_termination`)
1350
+ .delete()
1351
+ .json(payload => util.deserializeResult(payload))
1352
+ .then(f => f, util.onRejected);
1353
+ }
1354
+ }
1355
+
1356
+ export class EndpointIPPolicyModule {
1357
+ private httpClient: Wretcher;
1358
+
1359
+ /** Do not construct this object directly, use the <code>endpointIpPolicyModule</code> property of an <code>Ngrok</code> client object instead. */
1360
+ public constructor(httpClient: Wretcher) {
1361
+ this.httpClient = httpClient;
1362
+ }
1363
+ public replace(
1364
+ arg: datatypes.EndpointIPPolicyReplace
1365
+ ): Promise<datatypes.EndpointIPPolicy> {
1366
+ return this.httpClient
1367
+ .url(`/endpoint_configurations/${arg.id}/ip_policy`)
1368
+ .put(util.serializeArgument(arg))
1369
+ .json(payload => util.deserializeResult(payload))
1370
+ .then(f => f, util.onRejected);
1371
+ }
1372
+
1373
+ public get(arg: datatypes.Item): Promise<datatypes.EndpointIPPolicy> {
1374
+ return this.httpClient
1375
+ .url(`/endpoint_configurations/${arg.id}/ip_policy`)
1376
+ .get()
1377
+ .json(payload => util.deserializeResult(payload))
1378
+ .then(f => f, util.onRejected);
1379
+ }
1380
+
1381
+ public delete(arg: datatypes.Item): Promise<void> {
1382
+ return this.httpClient
1383
+ .url(`/endpoint_configurations/${arg.id}/ip_policy`)
1384
+ .delete()
1385
+ .json(payload => util.deserializeResult(payload))
1386
+ .then(f => f, util.onRejected);
1387
+ }
1388
+ }
1389
+
1390
+ export class EndpointMutualTLSModule {
1391
+ private httpClient: Wretcher;
1392
+
1393
+ /** Do not construct this object directly, use the <code>endpointMutualTlsModule</code> property of an <code>Ngrok</code> client object instead. */
1394
+ public constructor(httpClient: Wretcher) {
1395
+ this.httpClient = httpClient;
1396
+ }
1397
+ public replace(
1398
+ arg: datatypes.EndpointMutualTLSReplace
1399
+ ): Promise<datatypes.EndpointMutualTLS> {
1400
+ return this.httpClient
1401
+ .url(`/endpoint_configurations/${arg.id}/mutual_tls`)
1402
+ .put(util.serializeArgument(arg))
1403
+ .json(payload => util.deserializeResult(payload))
1404
+ .then(f => f, util.onRejected);
1405
+ }
1406
+
1407
+ public get(arg: datatypes.Item): Promise<datatypes.EndpointMutualTLS> {
1408
+ return this.httpClient
1409
+ .url(`/endpoint_configurations/${arg.id}/mutual_tls`)
1410
+ .get()
1411
+ .json(payload => util.deserializeResult(payload))
1412
+ .then(f => f, util.onRejected);
1413
+ }
1414
+
1415
+ public delete(arg: datatypes.Item): Promise<void> {
1416
+ return this.httpClient
1417
+ .url(`/endpoint_configurations/${arg.id}/mutual_tls`)
1418
+ .delete()
1419
+ .json(payload => util.deserializeResult(payload))
1420
+ .then(f => f, util.onRejected);
1421
+ }
1422
+ }
1423
+
1424
+ export class EndpointRequestHeadersModule {
1425
+ private httpClient: Wretcher;
1426
+
1427
+ /** Do not construct this object directly, use the <code>endpointRequestHeadersModule</code> property of an <code>Ngrok</code> client object instead. */
1428
+ public constructor(httpClient: Wretcher) {
1429
+ this.httpClient = httpClient;
1430
+ }
1431
+ public replace(
1432
+ arg: datatypes.EndpointRequestHeadersReplace
1433
+ ): Promise<datatypes.EndpointRequestHeaders> {
1434
+ return this.httpClient
1435
+ .url(`/endpoint_configurations/${arg.id}/request_headers`)
1436
+ .put(util.serializeArgument(arg))
1437
+ .json(payload => util.deserializeResult(payload))
1438
+ .then(f => f, util.onRejected);
1439
+ }
1440
+
1441
+ public get(arg: datatypes.Item): Promise<datatypes.EndpointRequestHeaders> {
1442
+ return this.httpClient
1443
+ .url(`/endpoint_configurations/${arg.id}/request_headers`)
1444
+ .get()
1445
+ .json(payload => util.deserializeResult(payload))
1446
+ .then(f => f, util.onRejected);
1447
+ }
1448
+
1449
+ public delete(arg: datatypes.Item): Promise<void> {
1450
+ return this.httpClient
1451
+ .url(`/endpoint_configurations/${arg.id}/request_headers`)
1452
+ .delete()
1453
+ .json(payload => util.deserializeResult(payload))
1454
+ .then(f => f, util.onRejected);
1455
+ }
1456
+ }
1457
+
1458
+ export class EndpointResponseHeadersModule {
1459
+ private httpClient: Wretcher;
1460
+
1461
+ /** Do not construct this object directly, use the <code>endpointResponseHeadersModule</code> property of an <code>Ngrok</code> client object instead. */
1462
+ public constructor(httpClient: Wretcher) {
1463
+ this.httpClient = httpClient;
1464
+ }
1465
+ public replace(
1466
+ arg: datatypes.EndpointResponseHeadersReplace
1467
+ ): Promise<datatypes.EndpointResponseHeaders> {
1468
+ return this.httpClient
1469
+ .url(`/endpoint_configurations/${arg.id}/response_headers`)
1470
+ .put(util.serializeArgument(arg))
1471
+ .json(payload => util.deserializeResult(payload))
1472
+ .then(f => f, util.onRejected);
1473
+ }
1474
+
1475
+ public get(arg: datatypes.Item): Promise<datatypes.EndpointResponseHeaders> {
1476
+ return this.httpClient
1477
+ .url(`/endpoint_configurations/${arg.id}/response_headers`)
1478
+ .get()
1479
+ .json(payload => util.deserializeResult(payload))
1480
+ .then(f => f, util.onRejected);
1481
+ }
1482
+
1483
+ public delete(arg: datatypes.Item): Promise<void> {
1484
+ return this.httpClient
1485
+ .url(`/endpoint_configurations/${arg.id}/response_headers`)
1486
+ .delete()
1487
+ .json(payload => util.deserializeResult(payload))
1488
+ .then(f => f, util.onRejected);
1489
+ }
1490
+ }
1491
+
1492
+ export class EndpointOAuthModule {
1493
+ private httpClient: Wretcher;
1494
+
1495
+ /** Do not construct this object directly, use the <code>endpointOAuthModule</code> property of an <code>Ngrok</code> client object instead. */
1496
+ public constructor(httpClient: Wretcher) {
1497
+ this.httpClient = httpClient;
1498
+ }
1499
+ public replace(
1500
+ arg: datatypes.EndpointOAuthReplace
1501
+ ): Promise<datatypes.EndpointOAuth> {
1502
+ return this.httpClient
1503
+ .url(`/endpoint_configurations/${arg.id}/oauth`)
1504
+ .put(util.serializeArgument(arg))
1505
+ .json(payload => util.deserializeResult(payload))
1506
+ .then(f => f, util.onRejected);
1507
+ }
1508
+
1509
+ public get(arg: datatypes.Item): Promise<datatypes.EndpointOAuth> {
1510
+ return this.httpClient
1511
+ .url(`/endpoint_configurations/${arg.id}/oauth`)
1512
+ .get()
1513
+ .json(payload => util.deserializeResult(payload))
1514
+ .then(f => f, util.onRejected);
1515
+ }
1516
+
1517
+ public delete(arg: datatypes.Item): Promise<void> {
1518
+ return this.httpClient
1519
+ .url(`/endpoint_configurations/${arg.id}/oauth`)
1520
+ .delete()
1521
+ .json(payload => util.deserializeResult(payload))
1522
+ .then(f => f, util.onRejected);
1523
+ }
1524
+ }
1525
+
1526
+ export class EndpointWebhookValidationModule {
1527
+ private httpClient: Wretcher;
1528
+
1529
+ /** Do not construct this object directly, use the <code>endpointWebhookValidationModule</code> property of an <code>Ngrok</code> client object instead. */
1530
+ public constructor(httpClient: Wretcher) {
1531
+ this.httpClient = httpClient;
1532
+ }
1533
+ public replace(
1534
+ arg: datatypes.EndpointWebhookValidationReplace
1535
+ ): Promise<datatypes.EndpointWebhookValidation> {
1536
+ return this.httpClient
1537
+ .url(`/endpoint_configurations/${arg.id}/webhook_validation`)
1538
+ .put(util.serializeArgument(arg))
1539
+ .json(payload => util.deserializeResult(payload))
1540
+ .then(f => f, util.onRejected);
1541
+ }
1542
+
1543
+ public get(
1544
+ arg: datatypes.Item
1545
+ ): Promise<datatypes.EndpointWebhookValidation> {
1546
+ return this.httpClient
1547
+ .url(`/endpoint_configurations/${arg.id}/webhook_validation`)
1548
+ .get()
1549
+ .json(payload => util.deserializeResult(payload))
1550
+ .then(f => f, util.onRejected);
1551
+ }
1552
+
1553
+ public delete(arg: datatypes.Item): Promise<void> {
1554
+ return this.httpClient
1555
+ .url(`/endpoint_configurations/${arg.id}/webhook_validation`)
1556
+ .delete()
1557
+ .json(payload => util.deserializeResult(payload))
1558
+ .then(f => f, util.onRejected);
1559
+ }
1560
+ }
1561
+
1562
+ export class EndpointSAMLModule {
1563
+ private httpClient: Wretcher;
1564
+
1565
+ /** Do not construct this object directly, use the <code>endpointSamlModule</code> property of an <code>Ngrok</code> client object instead. */
1566
+ public constructor(httpClient: Wretcher) {
1567
+ this.httpClient = httpClient;
1568
+ }
1569
+ public replace(
1570
+ arg: datatypes.EndpointSAMLReplace
1571
+ ): Promise<datatypes.EndpointSAML> {
1572
+ return this.httpClient
1573
+ .url(`/endpoint_configurations/${arg.id}/saml`)
1574
+ .put(util.serializeArgument(arg))
1575
+ .json(payload => util.deserializeResult(payload))
1576
+ .then(f => f, util.onRejected);
1577
+ }
1578
+
1579
+ public get(arg: datatypes.Item): Promise<datatypes.EndpointSAML> {
1580
+ return this.httpClient
1581
+ .url(`/endpoint_configurations/${arg.id}/saml`)
1582
+ .get()
1583
+ .json(payload => util.deserializeResult(payload))
1584
+ .then(f => f, util.onRejected);
1585
+ }
1586
+
1587
+ public delete(arg: datatypes.Item): Promise<void> {
1588
+ return this.httpClient
1589
+ .url(`/endpoint_configurations/${arg.id}/saml`)
1590
+ .delete()
1591
+ .json(payload => util.deserializeResult(payload))
1592
+ .then(f => f, util.onRejected);
1593
+ }
1594
+ }
1595
+
1596
+ export class EndpointOIDCModule {
1597
+ private httpClient: Wretcher;
1598
+
1599
+ /** Do not construct this object directly, use the <code>endpointOidcModule</code> property of an <code>Ngrok</code> client object instead. */
1600
+ public constructor(httpClient: Wretcher) {
1601
+ this.httpClient = httpClient;
1602
+ }
1603
+ public replace(
1604
+ arg: datatypes.EndpointOIDCReplace
1605
+ ): Promise<datatypes.EndpointOIDC> {
1606
+ return this.httpClient
1607
+ .url(`/endpoint_configurations/${arg.id}/oidc`)
1608
+ .put(util.serializeArgument(arg))
1609
+ .json(payload => util.deserializeResult(payload))
1610
+ .then(f => f, util.onRejected);
1611
+ }
1612
+
1613
+ public get(arg: datatypes.Item): Promise<datatypes.EndpointOIDC> {
1614
+ return this.httpClient
1615
+ .url(`/endpoint_configurations/${arg.id}/oidc`)
1616
+ .get()
1617
+ .json(payload => util.deserializeResult(payload))
1618
+ .then(f => f, util.onRejected);
1619
+ }
1620
+
1621
+ public delete(arg: datatypes.Item): Promise<void> {
1622
+ return this.httpClient
1623
+ .url(`/endpoint_configurations/${arg.id}/oidc`)
1624
+ .delete()
1625
+ .json(payload => util.deserializeResult(payload))
1626
+ .then(f => f, util.onRejected);
1627
+ }
1628
+ }
1629
+
1630
+ /**
1631
+ * Reserved Addresses are TCP addresses that can be used to listen for traffic.
1632
+ TCP address hostnames and ports are assigned by ngrok, they cannot be
1633
+ chosen.
1634
+ */
1635
+ export class ReservedAddrs {
1636
+ private httpClient: Wretcher;
1637
+
1638
+ /** Do not construct this object directly, use the <code>reservedAddrs</code> property of an <code>Ngrok</code> client object instead. */
1639
+ public constructor(httpClient: Wretcher) {
1640
+ this.httpClient = httpClient;
1641
+ }
1642
+ /**
1643
+ * Create a new reserved address.
1644
+ */
1645
+ public create(
1646
+ arg: datatypes.ReservedAddrCreate
1647
+ ): Promise<datatypes.ReservedAddr> {
1648
+ return this.httpClient
1649
+ .url(`/reserved_addrs`)
1650
+ .post(util.serializeArgument(arg))
1651
+ .json(payload => util.deserializeResult(payload))
1652
+ .then(f => f, util.onRejected);
1653
+ }
1654
+
1655
+ /**
1656
+ * Delete a reserved address.
1657
+ */
1658
+ public delete(arg: datatypes.Item): Promise<void> {
1659
+ return this.httpClient
1660
+ .url(`/reserved_addrs/${arg.id}`)
1661
+ .delete()
1662
+ .json(payload => util.deserializeResult(payload))
1663
+ .then(f => f, util.onRejected);
1664
+ }
1665
+
1666
+ /**
1667
+ * Get the details of a reserved address.
1668
+ */
1669
+ public get(arg: datatypes.Item): Promise<datatypes.ReservedAddr> {
1670
+ return this.httpClient
1671
+ .url(`/reserved_addrs/${arg.id}`)
1672
+ .get()
1673
+ .json(payload => util.deserializeResult(payload))
1674
+ .then(f => f, util.onRejected);
1675
+ }
1676
+
1677
+ /**
1678
+ * List all reserved addresses on this account.
1679
+ */
1680
+ public async list(): Promise<Array<datatypes.ReservedAddr>> {
1681
+ const array: Array<datatypes.ReservedAddr> = [];
1682
+ for await (const item of this._asyncList()) {
1683
+ array.push(item);
1684
+ }
1685
+ return array;
1686
+ }
1687
+ private _pagedList(
1688
+ arg: datatypes.Paging
1689
+ ): Promise<datatypes.ReservedAddrList> {
1690
+ return this.httpClient
1691
+ .url(`/reserved_addrs`)
1692
+ .query(arg)
1693
+ .get()
1694
+ .json(payload => util.deserializeResult(payload))
1695
+ .then(util.onFulfilled, util.onRejected);
1696
+ }
1697
+ private async *_asyncList() {
1698
+ const limit = '100';
1699
+ let nextPage = 'initial loop';
1700
+ let page: datatypes.Paging = { limit: limit };
1701
+
1702
+ while (nextPage) {
1703
+ const pagedList = await this._pagedList(page);
1704
+ nextPage = pagedList.nextPageUri;
1705
+ const items: datatypes.ReservedAddr[] = pagedList.reservedAddrs;
1706
+
1707
+ if (nextPage) {
1708
+ page = {
1709
+ beforeId: items[items.length - 1].id,
1710
+ limit: limit,
1711
+ };
1712
+ }
1713
+
1714
+ for (const item of items) {
1715
+ yield item;
1716
+ }
1717
+ }
1718
+ }
1719
+ /**
1720
+ * Update the attributes of a reserved address.
1721
+ */
1722
+ public update(
1723
+ arg: datatypes.ReservedAddrUpdate
1724
+ ): Promise<datatypes.ReservedAddr> {
1725
+ return this.httpClient
1726
+ .url(`/reserved_addrs/${arg.id}`)
1727
+ .patch(util.serializeArgument(arg))
1728
+ .json(payload => util.deserializeResult(payload))
1729
+ .then(f => f, util.onRejected);
1730
+ }
1731
+
1732
+ /**
1733
+ * Detach the endpoint configuration attached to a reserved address.
1734
+ */
1735
+ public deleteEndpointConfig(arg: datatypes.Item): Promise<void> {
1736
+ return this.httpClient
1737
+ .url(`/reserved_addrs/${arg.id}/endpoint_configuration`)
1738
+ .delete()
1739
+ .json(payload => util.deserializeResult(payload))
1740
+ .then(f => f, util.onRejected);
1741
+ }
1742
+ }
1743
+
1744
+ /**
1745
+ * Reserved Domains are hostnames that you can listen for traffic on. Domains
1746
+ can be used to listen for http, https or tls traffic. You may use a domain
1747
+ that you own by creating a CNAME record specified in the returned resource.
1748
+ This CNAME record points traffic for that domain to ngrok's edge servers.
1749
+ */
1750
+ export class ReservedDomains {
1751
+ private httpClient: Wretcher;
1752
+
1753
+ /** Do not construct this object directly, use the <code>reservedDomains</code> property of an <code>Ngrok</code> client object instead. */
1754
+ public constructor(httpClient: Wretcher) {
1755
+ this.httpClient = httpClient;
1756
+ }
1757
+ /**
1758
+ * Create a new reserved domain.
1759
+ */
1760
+ public create(
1761
+ arg: datatypes.ReservedDomainCreate
1762
+ ): Promise<datatypes.ReservedDomain> {
1763
+ return this.httpClient
1764
+ .url(`/reserved_domains`)
1765
+ .post(util.serializeArgument(arg))
1766
+ .json(payload => util.deserializeResult(payload))
1767
+ .then(f => f, util.onRejected);
1768
+ }
1769
+
1770
+ /**
1771
+ * Delete a reserved domain.
1772
+ */
1773
+ public delete(arg: datatypes.Item): Promise<void> {
1774
+ return this.httpClient
1775
+ .url(`/reserved_domains/${arg.id}`)
1776
+ .delete()
1777
+ .json(payload => util.deserializeResult(payload))
1778
+ .then(f => f, util.onRejected);
1779
+ }
1780
+
1781
+ /**
1782
+ * Get the details of a reserved domain.
1783
+ */
1784
+ public get(arg: datatypes.Item): Promise<datatypes.ReservedDomain> {
1785
+ return this.httpClient
1786
+ .url(`/reserved_domains/${arg.id}`)
1787
+ .get()
1788
+ .json(payload => util.deserializeResult(payload))
1789
+ .then(f => f, util.onRejected);
1790
+ }
1791
+
1792
+ /**
1793
+ * List all reserved domains on this account.
1794
+ */
1795
+ public async list(): Promise<Array<datatypes.ReservedDomain>> {
1796
+ const array: Array<datatypes.ReservedDomain> = [];
1797
+ for await (const item of this._asyncList()) {
1798
+ array.push(item);
1799
+ }
1800
+ return array;
1801
+ }
1802
+ private _pagedList(
1803
+ arg: datatypes.Paging
1804
+ ): Promise<datatypes.ReservedDomainList> {
1805
+ return this.httpClient
1806
+ .url(`/reserved_domains`)
1807
+ .query(arg)
1808
+ .get()
1809
+ .json(payload => util.deserializeResult(payload))
1810
+ .then(util.onFulfilled, util.onRejected);
1811
+ }
1812
+ private async *_asyncList() {
1813
+ const limit = '100';
1814
+ let nextPage = 'initial loop';
1815
+ let page: datatypes.Paging = { limit: limit };
1816
+
1817
+ while (nextPage) {
1818
+ const pagedList = await this._pagedList(page);
1819
+ nextPage = pagedList.nextPageUri;
1820
+ const items: datatypes.ReservedDomain[] = pagedList.reservedDomains;
1821
+
1822
+ if (nextPage) {
1823
+ page = {
1824
+ beforeId: items[items.length - 1].id,
1825
+ limit: limit,
1826
+ };
1827
+ }
1828
+
1829
+ for (const item of items) {
1830
+ yield item;
1831
+ }
1832
+ }
1833
+ }
1834
+ /**
1835
+ * Update the attributes of a reserved domain.
1836
+ */
1837
+ public update(
1838
+ arg: datatypes.ReservedDomainUpdate
1839
+ ): Promise<datatypes.ReservedDomain> {
1840
+ return this.httpClient
1841
+ .url(`/reserved_domains/${arg.id}`)
1842
+ .patch(util.serializeArgument(arg))
1843
+ .json(payload => util.deserializeResult(payload))
1844
+ .then(f => f, util.onRejected);
1845
+ }
1846
+
1847
+ /**
1848
+ * Detach the certificate management policy attached to a reserved domain.
1849
+ */
1850
+ public deleteCertificateManagementPolicy(arg: datatypes.Item): Promise<void> {
1851
+ return this.httpClient
1852
+ .url(`/reserved_domains/${arg.id}/certificate_management_policy`)
1853
+ .delete()
1854
+ .json(payload => util.deserializeResult(payload))
1855
+ .then(f => f, util.onRejected);
1856
+ }
1857
+
1858
+ /**
1859
+ * Detach the certificate attached to a reserved domain.
1860
+ */
1861
+ public deleteCertificate(arg: datatypes.Item): Promise<void> {
1862
+ return this.httpClient
1863
+ .url(`/reserved_domains/${arg.id}/certificate`)
1864
+ .delete()
1865
+ .json(payload => util.deserializeResult(payload))
1866
+ .then(f => f, util.onRejected);
1867
+ }
1868
+
1869
+ /**
1870
+ * Detach the http endpoint configuration attached to a reserved domain.
1871
+ */
1872
+ public deleteHttpEndpointConfig(arg: datatypes.Item): Promise<void> {
1873
+ return this.httpClient
1874
+ .url(`/reserved_domains/${arg.id}/http_endpoint_configuration`)
1875
+ .delete()
1876
+ .json(payload => util.deserializeResult(payload))
1877
+ .then(f => f, util.onRejected);
1878
+ }
1879
+
1880
+ /**
1881
+ * Detach the https endpoint configuration attached to a reserved domain.
1882
+ */
1883
+ public deleteHttpsEndpointConfig(arg: datatypes.Item): Promise<void> {
1884
+ return this.httpClient
1885
+ .url(`/reserved_domains/${arg.id}/https_endpoint_configuration`)
1886
+ .delete()
1887
+ .json(payload => util.deserializeResult(payload))
1888
+ .then(f => f, util.onRejected);
1889
+ }
1890
+ }
1891
+
1892
+ /**
1893
+ * An SSH Certificate Authority is a pair of an SSH Certificate and its private
1894
+ key that can be used to sign other SSH host and user certificates.
1895
+ */
1896
+ export class SSHCertificateAuthorities {
1897
+ private httpClient: Wretcher;
1898
+
1899
+ /** Do not construct this object directly, use the <code>sshCertificateAuthorities</code> property of an <code>Ngrok</code> client object instead. */
1900
+ public constructor(httpClient: Wretcher) {
1901
+ this.httpClient = httpClient;
1902
+ }
1903
+ /**
1904
+ * Create a new SSH Certificate Authority
1905
+ */
1906
+ public create(
1907
+ arg: datatypes.SSHCertificateAuthorityCreate
1908
+ ): Promise<datatypes.SSHCertificateAuthority> {
1909
+ return this.httpClient
1910
+ .url(`/ssh_certificate_authorities`)
1911
+ .post(util.serializeArgument(arg))
1912
+ .json(payload => util.deserializeResult(payload))
1913
+ .then(f => f, util.onRejected);
1914
+ }
1915
+
1916
+ /**
1917
+ * Delete an SSH Certificate Authority
1918
+ */
1919
+ public delete(arg: datatypes.Item): Promise<void> {
1920
+ return this.httpClient
1921
+ .url(`/ssh_certificate_authorities/${arg.id}`)
1922
+ .delete()
1923
+ .json(payload => util.deserializeResult(payload))
1924
+ .then(f => f, util.onRejected);
1925
+ }
1926
+
1927
+ /**
1928
+ * Get detailed information about an SSH Certficate Authority
1929
+ */
1930
+ public get(arg: datatypes.Item): Promise<datatypes.SSHCertificateAuthority> {
1931
+ return this.httpClient
1932
+ .url(`/ssh_certificate_authorities/${arg.id}`)
1933
+ .get()
1934
+ .json(payload => util.deserializeResult(payload))
1935
+ .then(f => f, util.onRejected);
1936
+ }
1937
+
1938
+ /**
1939
+ * List all SSH Certificate Authorities on this account
1940
+ */
1941
+ public async list(): Promise<Array<datatypes.SSHCertificateAuthority>> {
1942
+ const array: Array<datatypes.SSHCertificateAuthority> = [];
1943
+ for await (const item of this._asyncList()) {
1944
+ array.push(item);
1945
+ }
1946
+ return array;
1947
+ }
1948
+ private _pagedList(
1949
+ arg: datatypes.Paging
1950
+ ): Promise<datatypes.SSHCertificateAuthorityList> {
1951
+ return this.httpClient
1952
+ .url(`/ssh_certificate_authorities`)
1953
+ .query(arg)
1954
+ .get()
1955
+ .json(payload => util.deserializeResult(payload))
1956
+ .then(util.onFulfilled, util.onRejected);
1957
+ }
1958
+ private async *_asyncList() {
1959
+ const limit = '100';
1960
+ let nextPage = 'initial loop';
1961
+ let page: datatypes.Paging = { limit: limit };
1962
+
1963
+ while (nextPage) {
1964
+ const pagedList = await this._pagedList(page);
1965
+ nextPage = pagedList.nextPageUri;
1966
+ const items: datatypes.SSHCertificateAuthority[] =
1967
+ pagedList.sshCertificateAuthorities;
1968
+
1969
+ if (nextPage) {
1970
+ page = {
1971
+ beforeId: items[items.length - 1].id,
1972
+ limit: limit,
1973
+ };
1974
+ }
1975
+
1976
+ for (const item of items) {
1977
+ yield item;
1978
+ }
1979
+ }
1980
+ }
1981
+ /**
1982
+ * Update an SSH Certificate Authority
1983
+ */
1984
+ public update(
1985
+ arg: datatypes.SSHCertificateAuthorityUpdate
1986
+ ): Promise<datatypes.SSHCertificateAuthority> {
1987
+ return this.httpClient
1988
+ .url(`/ssh_certificate_authorities/${arg.id}`)
1989
+ .patch(util.serializeArgument(arg))
1990
+ .json(payload => util.deserializeResult(payload))
1991
+ .then(f => f, util.onRejected);
1992
+ }
1993
+ }
1994
+
1995
+ /**
1996
+ * SSH Credentials are SSH public keys that can be used to start SSH tunnels
1997
+ via the ngrok SSH tunnel gateway.
1998
+ */
1999
+ export class SSHCredentials {
2000
+ private httpClient: Wretcher;
2001
+
2002
+ /** Do not construct this object directly, use the <code>sshCredentials</code> property of an <code>Ngrok</code> client object instead. */
2003
+ public constructor(httpClient: Wretcher) {
2004
+ this.httpClient = httpClient;
2005
+ }
2006
+ /**
2007
+ * 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.
2008
+ */
2009
+ public create(
2010
+ arg: datatypes.SSHCredentialCreate
2011
+ ): Promise<datatypes.SSHCredential> {
2012
+ return this.httpClient
2013
+ .url(`/ssh_credentials`)
2014
+ .post(util.serializeArgument(arg))
2015
+ .json(payload => util.deserializeResult(payload))
2016
+ .then(f => f, util.onRejected);
2017
+ }
2018
+
2019
+ /**
2020
+ * Delete an ssh_credential by ID
2021
+ */
2022
+ public delete(arg: datatypes.Item): Promise<void> {
2023
+ return this.httpClient
2024
+ .url(`/ssh_credentials/${arg.id}`)
2025
+ .delete()
2026
+ .json(payload => util.deserializeResult(payload))
2027
+ .then(f => f, util.onRejected);
2028
+ }
2029
+
2030
+ /**
2031
+ * Get detailed information about an ssh_credential
2032
+ */
2033
+ public get(arg: datatypes.Item): Promise<datatypes.SSHCredential> {
2034
+ return this.httpClient
2035
+ .url(`/ssh_credentials/${arg.id}`)
2036
+ .get()
2037
+ .json(payload => util.deserializeResult(payload))
2038
+ .then(f => f, util.onRejected);
2039
+ }
2040
+
2041
+ /**
2042
+ * List all ssh credentials on this account
2043
+ */
2044
+ public async list(): Promise<Array<datatypes.SSHCredential>> {
2045
+ const array: Array<datatypes.SSHCredential> = [];
2046
+ for await (const item of this._asyncList()) {
2047
+ array.push(item);
2048
+ }
2049
+ return array;
2050
+ }
2051
+ private _pagedList(
2052
+ arg: datatypes.Paging
2053
+ ): Promise<datatypes.SSHCredentialList> {
2054
+ return this.httpClient
2055
+ .url(`/ssh_credentials`)
2056
+ .query(arg)
2057
+ .get()
2058
+ .json(payload => util.deserializeResult(payload))
2059
+ .then(util.onFulfilled, util.onRejected);
2060
+ }
2061
+ private async *_asyncList() {
2062
+ const limit = '100';
2063
+ let nextPage = 'initial loop';
2064
+ let page: datatypes.Paging = { limit: limit };
2065
+
2066
+ while (nextPage) {
2067
+ const pagedList = await this._pagedList(page);
2068
+ nextPage = pagedList.nextPageUri;
2069
+ const items: datatypes.SSHCredential[] = pagedList.sshCredentials;
2070
+
2071
+ if (nextPage) {
2072
+ page = {
2073
+ beforeId: items[items.length - 1].id,
2074
+ limit: limit,
2075
+ };
2076
+ }
2077
+
2078
+ for (const item of items) {
2079
+ yield item;
2080
+ }
2081
+ }
2082
+ }
2083
+ /**
2084
+ * Update attributes of an ssh_credential by ID
2085
+ */
2086
+ public update(
2087
+ arg: datatypes.SSHCredentialUpdate
2088
+ ): Promise<datatypes.SSHCredential> {
2089
+ return this.httpClient
2090
+ .url(`/ssh_credentials/${arg.id}`)
2091
+ .patch(util.serializeArgument(arg))
2092
+ .json(payload => util.deserializeResult(payload))
2093
+ .then(f => f, util.onRejected);
2094
+ }
2095
+ }
2096
+
2097
+ /**
2098
+ * SSH Host Certificates along with the corresponding private key allows an SSH
2099
+ server to assert its authenticity to connecting SSH clients who trust the
2100
+ SSH Certificate Authority that was used to sign the certificate.
2101
+ */
2102
+ export class SSHHostCertificates {
2103
+ private httpClient: Wretcher;
2104
+
2105
+ /** Do not construct this object directly, use the <code>sshHostCertificates</code> property of an <code>Ngrok</code> client object instead. */
2106
+ public constructor(httpClient: Wretcher) {
2107
+ this.httpClient = httpClient;
2108
+ }
2109
+ /**
2110
+ * Create a new SSH Host Certificate
2111
+ */
2112
+ public create(
2113
+ arg: datatypes.SSHHostCertificateCreate
2114
+ ): Promise<datatypes.SSHHostCertificate> {
2115
+ return this.httpClient
2116
+ .url(`/ssh_host_certificates`)
2117
+ .post(util.serializeArgument(arg))
2118
+ .json(payload => util.deserializeResult(payload))
2119
+ .then(f => f, util.onRejected);
2120
+ }
2121
+
2122
+ /**
2123
+ * Delete an SSH Host Certificate
2124
+ */
2125
+ public delete(arg: datatypes.Item): Promise<void> {
2126
+ return this.httpClient
2127
+ .url(`/ssh_host_certificates/${arg.id}`)
2128
+ .delete()
2129
+ .json(payload => util.deserializeResult(payload))
2130
+ .then(f => f, util.onRejected);
2131
+ }
2132
+
2133
+ /**
2134
+ * Get detailed information about an SSH Host Certficate
2135
+ */
2136
+ public get(arg: datatypes.Item): Promise<datatypes.SSHHostCertificate> {
2137
+ return this.httpClient
2138
+ .url(`/ssh_host_certificates/${arg.id}`)
2139
+ .get()
2140
+ .json(payload => util.deserializeResult(payload))
2141
+ .then(f => f, util.onRejected);
2142
+ }
2143
+
2144
+ /**
2145
+ * List all SSH Host Certificates issued on this account
2146
+ */
2147
+ public async list(): Promise<Array<datatypes.SSHHostCertificate>> {
2148
+ const array: Array<datatypes.SSHHostCertificate> = [];
2149
+ for await (const item of this._asyncList()) {
2150
+ array.push(item);
2151
+ }
2152
+ return array;
2153
+ }
2154
+ private _pagedList(
2155
+ arg: datatypes.Paging
2156
+ ): Promise<datatypes.SSHHostCertificateList> {
2157
+ return this.httpClient
2158
+ .url(`/ssh_host_certificates`)
2159
+ .query(arg)
2160
+ .get()
2161
+ .json(payload => util.deserializeResult(payload))
2162
+ .then(util.onFulfilled, util.onRejected);
2163
+ }
2164
+ private async *_asyncList() {
2165
+ const limit = '100';
2166
+ let nextPage = 'initial loop';
2167
+ let page: datatypes.Paging = { limit: limit };
2168
+
2169
+ while (nextPage) {
2170
+ const pagedList = await this._pagedList(page);
2171
+ nextPage = pagedList.nextPageUri;
2172
+ const items: datatypes.SSHHostCertificate[] =
2173
+ pagedList.sshHostCertificates;
2174
+
2175
+ if (nextPage) {
2176
+ page = {
2177
+ beforeId: items[items.length - 1].id,
2178
+ limit: limit,
2179
+ };
2180
+ }
2181
+
2182
+ for (const item of items) {
2183
+ yield item;
2184
+ }
2185
+ }
2186
+ }
2187
+ /**
2188
+ * Update an SSH Host Certificate
2189
+ */
2190
+ public update(
2191
+ arg: datatypes.SSHHostCertificateUpdate
2192
+ ): Promise<datatypes.SSHHostCertificate> {
2193
+ return this.httpClient
2194
+ .url(`/ssh_host_certificates/${arg.id}`)
2195
+ .patch(util.serializeArgument(arg))
2196
+ .json(payload => util.deserializeResult(payload))
2197
+ .then(f => f, util.onRejected);
2198
+ }
2199
+ }
2200
+
2201
+ /**
2202
+ * SSH User Certificates are presented by SSH clients when connecting to an SSH
2203
+ server to authenticate their connection. The SSH server must trust the SSH
2204
+ Certificate Authority used to sign the certificate.
2205
+ */
2206
+ export class SSHUserCertificates {
2207
+ private httpClient: Wretcher;
2208
+
2209
+ /** Do not construct this object directly, use the <code>sshUserCertificates</code> property of an <code>Ngrok</code> client object instead. */
2210
+ public constructor(httpClient: Wretcher) {
2211
+ this.httpClient = httpClient;
2212
+ }
2213
+ /**
2214
+ * Create a new SSH User Certificate
2215
+ */
2216
+ public create(
2217
+ arg: datatypes.SSHUserCertificateCreate
2218
+ ): Promise<datatypes.SSHUserCertificate> {
2219
+ return this.httpClient
2220
+ .url(`/ssh_user_certificates`)
2221
+ .post(util.serializeArgument(arg))
2222
+ .json(payload => util.deserializeResult(payload))
2223
+ .then(f => f, util.onRejected);
2224
+ }
2225
+
2226
+ /**
2227
+ * Delete an SSH User Certificate
2228
+ */
2229
+ public delete(arg: datatypes.Item): Promise<void> {
2230
+ return this.httpClient
2231
+ .url(`/ssh_user_certificates/${arg.id}`)
2232
+ .delete()
2233
+ .json(payload => util.deserializeResult(payload))
2234
+ .then(f => f, util.onRejected);
2235
+ }
2236
+
2237
+ /**
2238
+ * Get detailed information about an SSH User Certficate
2239
+ */
2240
+ public get(arg: datatypes.Item): Promise<datatypes.SSHUserCertificate> {
2241
+ return this.httpClient
2242
+ .url(`/ssh_user_certificates/${arg.id}`)
2243
+ .get()
2244
+ .json(payload => util.deserializeResult(payload))
2245
+ .then(f => f, util.onRejected);
2246
+ }
2247
+
2248
+ /**
2249
+ * List all SSH User Certificates issued on this account
2250
+ */
2251
+ public async list(): Promise<Array<datatypes.SSHUserCertificate>> {
2252
+ const array: Array<datatypes.SSHUserCertificate> = [];
2253
+ for await (const item of this._asyncList()) {
2254
+ array.push(item);
2255
+ }
2256
+ return array;
2257
+ }
2258
+ private _pagedList(
2259
+ arg: datatypes.Paging
2260
+ ): Promise<datatypes.SSHUserCertificateList> {
2261
+ return this.httpClient
2262
+ .url(`/ssh_user_certificates`)
2263
+ .query(arg)
2264
+ .get()
2265
+ .json(payload => util.deserializeResult(payload))
2266
+ .then(util.onFulfilled, util.onRejected);
2267
+ }
2268
+ private async *_asyncList() {
2269
+ const limit = '100';
2270
+ let nextPage = 'initial loop';
2271
+ let page: datatypes.Paging = { limit: limit };
2272
+
2273
+ while (nextPage) {
2274
+ const pagedList = await this._pagedList(page);
2275
+ nextPage = pagedList.nextPageUri;
2276
+ const items: datatypes.SSHUserCertificate[] =
2277
+ pagedList.sshUserCertificates;
2278
+
2279
+ if (nextPage) {
2280
+ page = {
2281
+ beforeId: items[items.length - 1].id,
2282
+ limit: limit,
2283
+ };
2284
+ }
2285
+
2286
+ for (const item of items) {
2287
+ yield item;
2288
+ }
2289
+ }
2290
+ }
2291
+ /**
2292
+ * Update an SSH User Certificate
2293
+ */
2294
+ public update(
2295
+ arg: datatypes.SSHUserCertificateUpdate
2296
+ ): Promise<datatypes.SSHUserCertificate> {
2297
+ return this.httpClient
2298
+ .url(`/ssh_user_certificates/${arg.id}`)
2299
+ .patch(util.serializeArgument(arg))
2300
+ .json(payload => util.deserializeResult(payload))
2301
+ .then(f => f, util.onRejected);
2302
+ }
2303
+ }
2304
+
2305
+ /**
2306
+ * TLS Certificates are pairs of x509 certificates and their matching private
2307
+ key that can be used to terminate TLS traffic. TLS certificates are unused
2308
+ until they are attached to a Domain. TLS Certificates may also be
2309
+ provisioned by ngrok automatically for domains on which you have enabled
2310
+ automated certificate provisioning.
2311
+ */
2312
+ export class TLSCertificates {
2313
+ private httpClient: Wretcher;
2314
+
2315
+ /** Do not construct this object directly, use the <code>tlsCertificates</code> property of an <code>Ngrok</code> client object instead. */
2316
+ public constructor(httpClient: Wretcher) {
2317
+ this.httpClient = httpClient;
2318
+ }
2319
+ /**
2320
+ * Upload a new TLS certificate
2321
+ */
2322
+ public create(
2323
+ arg: datatypes.TLSCertificateCreate
2324
+ ): Promise<datatypes.TLSCertificate> {
2325
+ return this.httpClient
2326
+ .url(`/tls_certificates`)
2327
+ .post(util.serializeArgument(arg))
2328
+ .json(payload => util.deserializeResult(payload))
2329
+ .then(f => f, util.onRejected);
2330
+ }
2331
+
2332
+ /**
2333
+ * Delete a TLS certificate
2334
+ */
2335
+ public delete(arg: datatypes.Item): Promise<void> {
2336
+ return this.httpClient
2337
+ .url(`/tls_certificates/${arg.id}`)
2338
+ .delete()
2339
+ .json(payload => util.deserializeResult(payload))
2340
+ .then(f => f, util.onRejected);
2341
+ }
2342
+
2343
+ /**
2344
+ * Get detailed information about a TLS certificate
2345
+ */
2346
+ public get(arg: datatypes.Item): Promise<datatypes.TLSCertificate> {
2347
+ return this.httpClient
2348
+ .url(`/tls_certificates/${arg.id}`)
2349
+ .get()
2350
+ .json(payload => util.deserializeResult(payload))
2351
+ .then(f => f, util.onRejected);
2352
+ }
2353
+
2354
+ /**
2355
+ * List all TLS certificates on this account
2356
+ */
2357
+ public async list(): Promise<Array<datatypes.TLSCertificate>> {
2358
+ const array: Array<datatypes.TLSCertificate> = [];
2359
+ for await (const item of this._asyncList()) {
2360
+ array.push(item);
2361
+ }
2362
+ return array;
2363
+ }
2364
+ private _pagedList(
2365
+ arg: datatypes.Paging
2366
+ ): Promise<datatypes.TLSCertificateList> {
2367
+ return this.httpClient
2368
+ .url(`/tls_certificates`)
2369
+ .query(arg)
2370
+ .get()
2371
+ .json(payload => util.deserializeResult(payload))
2372
+ .then(util.onFulfilled, util.onRejected);
2373
+ }
2374
+ private async *_asyncList() {
2375
+ const limit = '100';
2376
+ let nextPage = 'initial loop';
2377
+ let page: datatypes.Paging = { limit: limit };
2378
+
2379
+ while (nextPage) {
2380
+ const pagedList = await this._pagedList(page);
2381
+ nextPage = pagedList.nextPageUri;
2382
+ const items: datatypes.TLSCertificate[] = pagedList.tlsCertificates;
2383
+
2384
+ if (nextPage) {
2385
+ page = {
2386
+ beforeId: items[items.length - 1].id,
2387
+ limit: limit,
2388
+ };
2389
+ }
2390
+
2391
+ for (const item of items) {
2392
+ yield item;
2393
+ }
2394
+ }
2395
+ }
2396
+ /**
2397
+ * Update attributes of a TLS Certificate by ID
2398
+ */
2399
+ public update(
2400
+ arg: datatypes.TLSCertificateUpdate
2401
+ ): Promise<datatypes.TLSCertificate> {
2402
+ return this.httpClient
2403
+ .url(`/tls_certificates/${arg.id}`)
2404
+ .patch(util.serializeArgument(arg))
2405
+ .json(payload => util.deserializeResult(payload))
2406
+ .then(f => f, util.onRejected);
2407
+ }
2408
+ }
2409
+
2410
+ /**
2411
+ * Tunnel Sessions represent instances of ngrok agents or SSH reverse tunnel
2412
+ sessions that are running and connected to the ngrok service. Each tunnel
2413
+ session can include one or more Tunnels.
2414
+ */
2415
+ export class TunnelSessions {
2416
+ private httpClient: Wretcher;
2417
+
2418
+ /** Do not construct this object directly, use the <code>tunnelSessions</code> property of an <code>Ngrok</code> client object instead. */
2419
+ public constructor(httpClient: Wretcher) {
2420
+ this.httpClient = httpClient;
2421
+ }
2422
+ /**
2423
+ * List all online tunnel sessions running on this account.
2424
+ */
2425
+ public async list(): Promise<Array<datatypes.TunnelSession>> {
2426
+ const array: Array<datatypes.TunnelSession> = [];
2427
+ for await (const item of this._asyncList()) {
2428
+ array.push(item);
2429
+ }
2430
+ return array;
2431
+ }
2432
+ private _pagedList(
2433
+ arg: datatypes.Paging
2434
+ ): Promise<datatypes.TunnelSessionList> {
2435
+ return this.httpClient
2436
+ .url(`/tunnel_sessions`)
2437
+ .query(arg)
2438
+ .get()
2439
+ .json(payload => util.deserializeResult(payload))
2440
+ .then(util.onFulfilled, util.onRejected);
2441
+ }
2442
+ private async *_asyncList() {
2443
+ const limit = '100';
2444
+ let nextPage = 'initial loop';
2445
+ let page: datatypes.Paging = { limit: limit };
2446
+
2447
+ while (nextPage) {
2448
+ const pagedList = await this._pagedList(page);
2449
+ nextPage = pagedList.nextPageUri;
2450
+ const items: datatypes.TunnelSession[] = pagedList.tunnelSessions;
2451
+
2452
+ if (nextPage) {
2453
+ page = {
2454
+ beforeId: items[items.length - 1].id,
2455
+ limit: limit,
2456
+ };
2457
+ }
2458
+
2459
+ for (const item of items) {
2460
+ yield item;
2461
+ }
2462
+ }
2463
+ }
2464
+ /**
2465
+ * Get the detailed status of a tunnel session by ID
2466
+ */
2467
+ public get(arg: datatypes.Item): Promise<datatypes.TunnelSession> {
2468
+ return this.httpClient
2469
+ .url(`/tunnel_sessions/${arg.id}`)
2470
+ .get()
2471
+ .json(payload => util.deserializeResult(payload))
2472
+ .then(f => f, util.onRejected);
2473
+ }
2474
+
2475
+ /**
2476
+ * 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.
2477
+ */
2478
+ public restart(arg: datatypes.Item): Promise<void> {
2479
+ return this.httpClient
2480
+ .url(`/tunnel_sessions/${arg.id}/restart`)
2481
+ .post(util.serializeArgument(arg))
2482
+ .json(payload => util.deserializeResult(payload))
2483
+ .then(f => f, util.onRejected);
2484
+ }
2485
+
2486
+ /**
2487
+ * Issues a command instructing the ngrok agent that started this tunnel session to exit.
2488
+ */
2489
+ public stop(arg: datatypes.Item): Promise<void> {
2490
+ return this.httpClient
2491
+ .url(`/tunnel_sessions/${arg.id}/stop`)
2492
+ .post(util.serializeArgument(arg))
2493
+ .json(payload => util.deserializeResult(payload))
2494
+ .then(f => f, util.onRejected);
2495
+ }
2496
+
2497
+ /**
2498
+ * 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
2499
+ */
2500
+ public update(arg: datatypes.TunnelSessionsUpdate): Promise<void> {
2501
+ return this.httpClient
2502
+ .url(`/tunnel_sessions/${arg.id}/update`)
2503
+ .post(util.serializeArgument(arg))
2504
+ .json(payload => util.deserializeResult(payload))
2505
+ .then(f => f, util.onRejected);
2506
+ }
2507
+ }
2508
+
2509
+ /**
2510
+ * Tunnels provide endpoints to access services exposed by a running ngrok
2511
+ agent tunnel session or an SSH reverse tunnel session.
2512
+ */
2513
+ export class Tunnels {
2514
+ private httpClient: Wretcher;
2515
+
2516
+ /** Do not construct this object directly, use the <code>tunnels</code> property of an <code>Ngrok</code> client object instead. */
2517
+ public constructor(httpClient: Wretcher) {
2518
+ this.httpClient = httpClient;
2519
+ }
2520
+ /**
2521
+ * List all online tunnels currently running on the account.
2522
+ */
2523
+ public async list(): Promise<Array<datatypes.Tunnel>> {
2524
+ const array: Array<datatypes.Tunnel> = [];
2525
+ for await (const item of this._asyncList()) {
2526
+ array.push(item);
2527
+ }
2528
+ return array;
2529
+ }
2530
+ private _pagedList(arg: datatypes.Paging): Promise<datatypes.TunnelList> {
2531
+ return this.httpClient
2532
+ .url(`/tunnels`)
2533
+ .query(arg)
2534
+ .get()
2535
+ .json(payload => util.deserializeResult(payload))
2536
+ .then(util.onFulfilled, util.onRejected);
2537
+ }
2538
+ private async *_asyncList() {
2539
+ const limit = '100';
2540
+ let nextPage = 'initial loop';
2541
+ let page: datatypes.Paging = { limit: limit };
2542
+
2543
+ while (nextPage) {
2544
+ const pagedList = await this._pagedList(page);
2545
+ nextPage = pagedList.nextPageUri;
2546
+ const items: datatypes.Tunnel[] = pagedList.tunnels;
2547
+
2548
+ if (nextPage) {
2549
+ page = {
2550
+ beforeId: items[items.length - 1].id,
2551
+ limit: limit,
2552
+ };
2553
+ }
2554
+
2555
+ for (const item of items) {
2556
+ yield item;
2557
+ }
2558
+ }
2559
+ }
2560
+ }