@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.
- package/.eslintrc.js +4 -1
- package/CHANGELOG.md +34 -0
- package/README.md +148 -2
- package/docs/CNAME +1 -0
- package/docs/assets/css/main.css +2660 -0
- package/docs/assets/images/icons.png +0 -0
- package/docs/assets/images/icons@2x.png +0 -0
- package/docs/assets/images/widgets.png +0 -0
- package/docs/assets/images/widgets@2x.png +0 -0
- package/docs/assets/js/main.js +248 -0
- package/docs/assets/js/search.js +1 -0
- package/docs/classes/client.Ngrok.html +681 -0
- package/docs/classes/services.APIKeys.html +453 -0
- package/docs/classes/services.AbuseReports.html +360 -0
- package/docs/classes/services.AgentIngresses.html +442 -0
- package/docs/classes/services.CertificateAuthorities.html +453 -0
- package/docs/classes/services.Credentials.html +452 -0
- package/docs/classes/services.EndpointCircuitBreakerModule.html +369 -0
- package/docs/classes/services.EndpointCompressionModule.html +369 -0
- package/docs/classes/services.EndpointConfigurations.html +451 -0
- package/docs/classes/services.EndpointIPPolicyModule.html +369 -0
- package/docs/classes/services.EndpointLoggingModule.html +369 -0
- package/docs/classes/services.EndpointMutualTLSModule.html +369 -0
- package/docs/classes/services.EndpointOAuthModule.html +369 -0
- package/docs/classes/services.EndpointOIDCModule.html +369 -0
- package/docs/classes/services.EndpointRequestHeadersModule.html +369 -0
- package/docs/classes/services.EndpointResponseHeadersModule.html +369 -0
- package/docs/classes/services.EndpointSAMLModule.html +369 -0
- package/docs/classes/services.EndpointTLSTerminationModule.html +369 -0
- package/docs/classes/services.EndpointWebhookValidationModule.html +369 -0
- package/docs/classes/services.EventDestinations.html +442 -0
- package/docs/classes/services.EventSources.html +448 -0
- package/docs/classes/services.EventStreams.html +442 -0
- package/docs/classes/services.EventSubscriptions.html +442 -0
- package/docs/classes/services.IPPolicies.html +452 -0
- package/docs/classes/services.IPPolicyRules.html +450 -0
- package/docs/classes/services.IPRestrictions.html +454 -0
- package/docs/classes/services.ReservedAddrs.html +483 -0
- package/docs/classes/services.ReservedDomains.html +580 -0
- package/docs/classes/services.SSHCertificateAuthorities.html +450 -0
- package/docs/classes/services.SSHCredentials.html +450 -0
- package/docs/classes/services.SSHHostCertificates.html +451 -0
- package/docs/classes/services.SSHUserCertificates.html +451 -0
- package/docs/classes/services.TLSCertificates.html +453 -0
- package/docs/classes/services.TunnelSessions.html +451 -0
- package/docs/classes/services.Tunnels.html +322 -0
- package/docs/index.html +239 -0
- package/docs/interfaces/client.NgrokConfig.html +179 -0
- package/docs/interfaces/datatypes.APIKey.html +262 -0
- package/docs/interfaces/datatypes.APIKeyCreate.html +186 -0
- package/docs/interfaces/datatypes.APIKeyList.html +205 -0
- package/docs/interfaces/datatypes.APIKeyUpdate.html +200 -0
- package/docs/interfaces/datatypes.AWSAuth.html +186 -0
- package/docs/interfaces/datatypes.AWSCredentials.html +186 -0
- package/docs/interfaces/datatypes.AWSRole.html +167 -0
- package/docs/interfaces/datatypes.AbuseReport.html +281 -0
- package/docs/interfaces/datatypes.AbuseReportCreate.html +186 -0
- package/docs/interfaces/datatypes.AbuseReportHostname.html +186 -0
- package/docs/interfaces/datatypes.AgentIngress.html +300 -0
- package/docs/interfaces/datatypes.AgentIngressCreate.html +205 -0
- package/docs/interfaces/datatypes.AgentIngressList.html +205 -0
- package/docs/interfaces/datatypes.AgentIngressUpdate.html +200 -0
- package/docs/interfaces/datatypes.CertificateAuthority.html +357 -0
- package/docs/interfaces/datatypes.CertificateAuthorityCreate.html +205 -0
- package/docs/interfaces/datatypes.CertificateAuthorityList.html +205 -0
- package/docs/interfaces/datatypes.CertificateAuthorityUpdate.html +200 -0
- package/docs/interfaces/datatypes.Credential.html +281 -0
- package/docs/interfaces/datatypes.CredentialCreate.html +205 -0
- package/docs/interfaces/datatypes.CredentialList.html +205 -0
- package/docs/interfaces/datatypes.CredentialUpdate.html +219 -0
- package/docs/interfaces/datatypes.Empty.html +130 -0
- package/docs/interfaces/datatypes.EndpointCircuitBreaker.html +262 -0
- package/docs/interfaces/datatypes.EndpointCircuitBreakerReplace.html +176 -0
- package/docs/interfaces/datatypes.EndpointCompression.html +167 -0
- package/docs/interfaces/datatypes.EndpointCompressionReplace.html +176 -0
- package/docs/interfaces/datatypes.EndpointConfiguration.html +490 -0
- package/docs/interfaces/datatypes.EndpointConfigurationCreate.html +433 -0
- package/docs/interfaces/datatypes.EndpointConfigurationList.html +205 -0
- package/docs/interfaces/datatypes.EndpointConfigurationUpdate.html +433 -0
- package/docs/interfaces/datatypes.EndpointIPPolicy.html +181 -0
- package/docs/interfaces/datatypes.EndpointIPPolicyMutate.html +186 -0
- package/docs/interfaces/datatypes.EndpointIPPolicyReplace.html +176 -0
- package/docs/interfaces/datatypes.EndpointLogging.html +186 -0
- package/docs/interfaces/datatypes.EndpointLoggingMutate.html +186 -0
- package/docs/interfaces/datatypes.EndpointLoggingReplace.html +176 -0
- package/docs/interfaces/datatypes.EndpointMutualTLS.html +186 -0
- package/docs/interfaces/datatypes.EndpointMutualTLSMutate.html +186 -0
- package/docs/interfaces/datatypes.EndpointMutualTLSReplace.html +176 -0
- package/docs/interfaces/datatypes.EndpointOAuth.html +281 -0
- package/docs/interfaces/datatypes.EndpointOAuthFacebook.html +243 -0
- package/docs/interfaces/datatypes.EndpointOAuthGitHub.html +281 -0
- package/docs/interfaces/datatypes.EndpointOAuthGoogle.html +243 -0
- package/docs/interfaces/datatypes.EndpointOAuthMicrosoft.html +243 -0
- package/docs/interfaces/datatypes.EndpointOAuthProvider.html +224 -0
- package/docs/interfaces/datatypes.EndpointOAuthReplace.html +176 -0
- package/docs/interfaces/datatypes.EndpointOIDC.html +319 -0
- package/docs/interfaces/datatypes.EndpointOIDCReplace.html +176 -0
- package/docs/interfaces/datatypes.EndpointRequestHeaders.html +205 -0
- package/docs/interfaces/datatypes.EndpointRequestHeadersReplace.html +176 -0
- package/docs/interfaces/datatypes.EndpointResponseHeaders.html +205 -0
- package/docs/interfaces/datatypes.EndpointResponseHeadersReplace.html +176 -0
- package/docs/interfaces/datatypes.EndpointSAML.html +433 -0
- package/docs/interfaces/datatypes.EndpointSAMLMutate.html +338 -0
- package/docs/interfaces/datatypes.EndpointSAMLReplace.html +176 -0
- package/docs/interfaces/datatypes.EndpointTLSTermination.html +205 -0
- package/docs/interfaces/datatypes.EndpointTLSTerminationReplace.html +176 -0
- package/docs/interfaces/datatypes.EndpointWebhookValidation.html +205 -0
- package/docs/interfaces/datatypes.EndpointWebhookValidationReplace.html +176 -0
- package/docs/interfaces/datatypes.Error.html +204 -0
- package/docs/interfaces/datatypes.EventDestination.html +281 -0
- package/docs/interfaces/datatypes.EventDestinationCreate.html +224 -0
- package/docs/interfaces/datatypes.EventDestinationList.html +205 -0
- package/docs/interfaces/datatypes.EventDestinationUpdate.html +243 -0
- package/docs/interfaces/datatypes.EventSource.html +186 -0
- package/docs/interfaces/datatypes.EventSourceCreate.html +186 -0
- package/docs/interfaces/datatypes.EventSourceItem.html +193 -0
- package/docs/interfaces/datatypes.EventSourceList.html +186 -0
- package/docs/interfaces/datatypes.EventSourcePaging.html +174 -0
- package/docs/interfaces/datatypes.EventSourceReplace.html +167 -0
- package/docs/interfaces/datatypes.EventSourceUpdate.html +186 -0
- package/docs/interfaces/datatypes.EventStream.html +319 -0
- package/docs/interfaces/datatypes.EventStreamCreate.html +262 -0
- package/docs/interfaces/datatypes.EventStreamList.html +205 -0
- package/docs/interfaces/datatypes.EventStreamUpdate.html +262 -0
- package/docs/interfaces/datatypes.EventSubscription.html +281 -0
- package/docs/interfaces/datatypes.EventSubscriptionCreate.html +224 -0
- package/docs/interfaces/datatypes.EventSubscriptionList.html +205 -0
- package/docs/interfaces/datatypes.EventSubscriptionUpdate.html +243 -0
- package/docs/interfaces/datatypes.EventTarget.html +205 -0
- package/docs/interfaces/datatypes.EventTargetCloudwatchLogs.html +186 -0
- package/docs/interfaces/datatypes.EventTargetFirehose.html +186 -0
- package/docs/interfaces/datatypes.EventTargetKinesis.html +186 -0
- package/docs/interfaces/datatypes.IPPolicy.html +262 -0
- package/docs/interfaces/datatypes.IPPolicyCreate.html +205 -0
- package/docs/interfaces/datatypes.IPPolicyList.html +205 -0
- package/docs/interfaces/datatypes.IPPolicyRule.html +281 -0
- package/docs/interfaces/datatypes.IPPolicyRuleCreate.html +224 -0
- package/docs/interfaces/datatypes.IPPolicyRuleList.html +205 -0
- package/docs/interfaces/datatypes.IPPolicyRuleUpdate.html +219 -0
- package/docs/interfaces/datatypes.IPPolicyUpdate.html +200 -0
- package/docs/interfaces/datatypes.IPRestriction.html +300 -0
- package/docs/interfaces/datatypes.IPRestrictionCreate.html +243 -0
- package/docs/interfaces/datatypes.IPRestrictionList.html +205 -0
- package/docs/interfaces/datatypes.IPRestrictionUpdate.html +238 -0
- package/docs/interfaces/datatypes.Item.html +167 -0
- package/docs/interfaces/datatypes.Paging.html +176 -0
- package/docs/interfaces/datatypes.Ref.html +186 -0
- package/docs/interfaces/datatypes.ReservedAddr.html +300 -0
- package/docs/interfaces/datatypes.ReservedAddrCreate.html +224 -0
- package/docs/interfaces/datatypes.ReservedAddrList.html +205 -0
- package/docs/interfaces/datatypes.ReservedAddrUpdate.html +219 -0
- package/docs/interfaces/datatypes.ReservedDomain.html +414 -0
- package/docs/interfaces/datatypes.ReservedDomainCertJob.html +224 -0
- package/docs/interfaces/datatypes.ReservedDomainCertPolicy.html +186 -0
- package/docs/interfaces/datatypes.ReservedDomainCertStatus.html +186 -0
- package/docs/interfaces/datatypes.ReservedDomainCreate.html +300 -0
- package/docs/interfaces/datatypes.ReservedDomainList.html +205 -0
- package/docs/interfaces/datatypes.ReservedDomainUpdate.html +276 -0
- package/docs/interfaces/datatypes.SSHCertificateAuthority.html +281 -0
- package/docs/interfaces/datatypes.SSHCertificateAuthorityCreate.html +243 -0
- package/docs/interfaces/datatypes.SSHCertificateAuthorityList.html +205 -0
- package/docs/interfaces/datatypes.SSHCertificateAuthorityUpdate.html +200 -0
- package/docs/interfaces/datatypes.SSHCredential.html +281 -0
- package/docs/interfaces/datatypes.SSHCredentialCreate.html +224 -0
- package/docs/interfaces/datatypes.SSHCredentialList.html +205 -0
- package/docs/interfaces/datatypes.SSHCredentialUpdate.html +219 -0
- package/docs/interfaces/datatypes.SSHHostCertificate.html +376 -0
- package/docs/interfaces/datatypes.SSHHostCertificateCreate.html +281 -0
- package/docs/interfaces/datatypes.SSHHostCertificateList.html +205 -0
- package/docs/interfaces/datatypes.SSHHostCertificateUpdate.html +200 -0
- package/docs/interfaces/datatypes.SSHUserCertificate.html +414 -0
- package/docs/interfaces/datatypes.SSHUserCertificateCreate.html +319 -0
- package/docs/interfaces/datatypes.SSHUserCertificateList.html +205 -0
- package/docs/interfaces/datatypes.SSHUserCertificateUpdate.html +200 -0
- package/docs/interfaces/datatypes.TLSCertificate.html +547 -0
- package/docs/interfaces/datatypes.TLSCertificateCreate.html +224 -0
- package/docs/interfaces/datatypes.TLSCertificateList.html +205 -0
- package/docs/interfaces/datatypes.TLSCertificateSANs.html +186 -0
- package/docs/interfaces/datatypes.TLSCertificateUpdate.html +200 -0
- package/docs/interfaces/datatypes.Tunnel.html +281 -0
- package/docs/interfaces/datatypes.TunnelList.html +205 -0
- package/docs/interfaces/datatypes.TunnelSession.html +338 -0
- package/docs/interfaces/datatypes.TunnelSessionList.html +205 -0
- package/docs/interfaces/datatypes.TunnelSessionsUpdate.html +162 -0
- package/docs/modules/client.html +137 -0
- package/docs/modules/datatypes.html +668 -0
- package/docs/modules/services.html +260 -0
- package/docs/modules.html +119 -0
- package/lib/client.d.ts +145 -0
- package/lib/client.d.ts.map +1 -0
- package/lib/client.js +102 -0
- package/lib/client.js.map +1 -0
- package/lib/{types.d.ts → datatypes.d.ts} +620 -816
- package/lib/datatypes.d.ts.map +1 -0
- package/lib/{types.js → datatypes.js} +1 -1
- package/lib/datatypes.js.map +1 -0
- package/lib/index.d.ts +3 -314
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +25 -887
- package/lib/index.js.map +1 -1
- package/lib/services.d.ts +773 -0
- package/lib/services.d.ts.map +1 -0
- package/lib/services.js +2761 -0
- package/lib/services.js.map +1 -0
- package/lib/util.d.ts +5 -0
- package/lib/util.d.ts.map +1 -0
- package/lib/util.js +53 -0
- package/lib/util.js.map +1 -0
- package/package.json +12 -3
- package/src/client.ts +265 -0
- package/src/{types.ts → datatypes.ts} +648 -869
- package/src/index.ts +2 -616
- package/src/services.ts +2560 -0
- package/src/util.ts +48 -0
- package/test/apikey.test.js +44 -30
- package/test/endpointConfigurations.test.js +38 -34
- package/tsconfig.json +17 -7
- package/lib/types.js.map +0 -1
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html class="default no-js">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
+
<title>Tunnels | @ngrok/ngrok-api</title>
|
|
7
|
+
<meta name="description" content="Documentation for @ngrok/ngrok-api">
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
9
|
+
<link rel="stylesheet" href="../assets/css/main.css">
|
|
10
|
+
<script async src="../assets/js/search.js" id="search-script"></script>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<header>
|
|
14
|
+
<div class="tsd-page-toolbar">
|
|
15
|
+
<div class="container">
|
|
16
|
+
<div class="table-wrap">
|
|
17
|
+
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
|
|
18
|
+
<div class="field">
|
|
19
|
+
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
|
|
20
|
+
<input id="tsd-search-field" type="text" />
|
|
21
|
+
</div>
|
|
22
|
+
<ul class="results">
|
|
23
|
+
<li class="state loading">Preparing search index...</li>
|
|
24
|
+
<li class="state failure">The search index is not available</li>
|
|
25
|
+
</ul>
|
|
26
|
+
<a href="../index.html" class="title">@ngrok/ngrok-api</a>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="table-cell" id="tsd-widgets">
|
|
29
|
+
<div id="tsd-filter">
|
|
30
|
+
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
|
|
31
|
+
<div class="tsd-filter-group">
|
|
32
|
+
<div class="tsd-select" id="tsd-filter-visibility">
|
|
33
|
+
<span class="tsd-select-label">All</span>
|
|
34
|
+
<ul class="tsd-select-list">
|
|
35
|
+
<li data-value="public">Public</li>
|
|
36
|
+
<li data-value="protected">Public/Protected</li>
|
|
37
|
+
<li data-value="private" class="selected">All</li>
|
|
38
|
+
</ul>
|
|
39
|
+
</div>
|
|
40
|
+
<input type="checkbox" id="tsd-filter-inherited" checked />
|
|
41
|
+
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
|
|
42
|
+
<input type="checkbox" id="tsd-filter-externals" checked />
|
|
43
|
+
<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
<div class="tsd-page-title">
|
|
52
|
+
<div class="container">
|
|
53
|
+
<ul class="tsd-breadcrumb">
|
|
54
|
+
<li>
|
|
55
|
+
<a href="../modules.html">@ngrok/ngrok-api</a>
|
|
56
|
+
</li>
|
|
57
|
+
<li>
|
|
58
|
+
<a href="../modules/services.html">services</a>
|
|
59
|
+
</li>
|
|
60
|
+
<li>
|
|
61
|
+
<a href="services.Tunnels.html">Tunnels</a>
|
|
62
|
+
</li>
|
|
63
|
+
</ul>
|
|
64
|
+
<h1>Class Tunnels</h1>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</header>
|
|
68
|
+
<div class="container container-main">
|
|
69
|
+
<div class="row">
|
|
70
|
+
<div class="col-8 col-content">
|
|
71
|
+
<section class="tsd-panel tsd-comment">
|
|
72
|
+
<div class="tsd-comment tsd-typography">
|
|
73
|
+
<div class="lead">
|
|
74
|
+
<p>Tunnels provide endpoints to access services exposed by a running ngrok
|
|
75
|
+
agent tunnel session or an SSH reverse tunnel session.</p>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
</section>
|
|
79
|
+
<section class="tsd-panel tsd-hierarchy">
|
|
80
|
+
<h3>Hierarchy</h3>
|
|
81
|
+
<ul class="tsd-hierarchy">
|
|
82
|
+
<li>
|
|
83
|
+
<span class="target">Tunnels</span>
|
|
84
|
+
</li>
|
|
85
|
+
</ul>
|
|
86
|
+
</section>
|
|
87
|
+
<section class="tsd-panel-group tsd-index-group">
|
|
88
|
+
<h2>Index</h2>
|
|
89
|
+
<section class="tsd-panel tsd-index-panel">
|
|
90
|
+
<div class="tsd-index-content">
|
|
91
|
+
<section class="tsd-index-section ">
|
|
92
|
+
<h3>Constructors</h3>
|
|
93
|
+
<ul class="tsd-index-list">
|
|
94
|
+
<li class="tsd-kind-constructor tsd-parent-kind-class"><a href="services.Tunnels.html#constructor" class="tsd-kind-icon">constructor</a></li>
|
|
95
|
+
</ul>
|
|
96
|
+
</section>
|
|
97
|
+
<section class="tsd-index-section ">
|
|
98
|
+
<h3>Methods</h3>
|
|
99
|
+
<ul class="tsd-index-list">
|
|
100
|
+
<li class="tsd-kind-method tsd-parent-kind-class"><a href="services.Tunnels.html#list" class="tsd-kind-icon">list</a></li>
|
|
101
|
+
</ul>
|
|
102
|
+
</section>
|
|
103
|
+
</div>
|
|
104
|
+
</section>
|
|
105
|
+
</section>
|
|
106
|
+
<section class="tsd-panel-group tsd-member-group ">
|
|
107
|
+
<h2>Constructors</h2>
|
|
108
|
+
<section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class">
|
|
109
|
+
<a name="constructor" class="tsd-anchor"></a>
|
|
110
|
+
<h3>constructor</h3>
|
|
111
|
+
<ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class">
|
|
112
|
+
<li class="tsd-signature tsd-kind-icon">new <wbr>Tunnels<span class="tsd-signature-symbol">(</span>httpClient<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Wretcher</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="services.Tunnels.html" class="tsd-signature-type" data-tsd-kind="Class">Tunnels</a></li>
|
|
113
|
+
</ul>
|
|
114
|
+
<ul class="tsd-descriptions">
|
|
115
|
+
<li class="tsd-description">
|
|
116
|
+
<aside class="tsd-sources">
|
|
117
|
+
<ul>
|
|
118
|
+
<li>Defined in <a href="https://github.com/ngrok/ngrok-api-typescript/blob/1a198cb/src/services.ts#L2517">services.ts:2517</a></li>
|
|
119
|
+
</ul>
|
|
120
|
+
</aside>
|
|
121
|
+
<div class="tsd-comment tsd-typography">
|
|
122
|
+
<div class="lead">
|
|
123
|
+
<p>Do not construct this object directly, use the <code>tunnels</code> property of an <code>Ngrok</code> client object instead.</p>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
127
|
+
<ul class="tsd-parameters">
|
|
128
|
+
<li>
|
|
129
|
+
<h5>httpClient: <span class="tsd-signature-type">Wretcher</span></h5>
|
|
130
|
+
</li>
|
|
131
|
+
</ul>
|
|
132
|
+
<h4 class="tsd-returns-title">Returns <a href="services.Tunnels.html" class="tsd-signature-type" data-tsd-kind="Class">Tunnels</a></h4>
|
|
133
|
+
</li>
|
|
134
|
+
</ul>
|
|
135
|
+
</section>
|
|
136
|
+
</section>
|
|
137
|
+
<section class="tsd-panel-group tsd-member-group ">
|
|
138
|
+
<h2>Methods</h2>
|
|
139
|
+
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class">
|
|
140
|
+
<a name="list" class="tsd-anchor"></a>
|
|
141
|
+
<h3>list</h3>
|
|
142
|
+
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
143
|
+
<li class="tsd-signature tsd-kind-icon">list<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/datatypes.Tunnel.html" class="tsd-signature-type" data-tsd-kind="Interface">Tunnel</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></li>
|
|
144
|
+
</ul>
|
|
145
|
+
<ul class="tsd-descriptions">
|
|
146
|
+
<li class="tsd-description">
|
|
147
|
+
<aside class="tsd-sources">
|
|
148
|
+
<ul>
|
|
149
|
+
<li>Defined in <a href="https://github.com/ngrok/ngrok-api-typescript/blob/1a198cb/src/services.ts#L2523">services.ts:2523</a></li>
|
|
150
|
+
</ul>
|
|
151
|
+
</aside>
|
|
152
|
+
<div class="tsd-comment tsd-typography">
|
|
153
|
+
<div class="lead">
|
|
154
|
+
<p>List all online tunnels currently running on the account.</p>
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="../interfaces/datatypes.Tunnel.html" class="tsd-signature-type" data-tsd-kind="Interface">Tunnel</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">></span></h4>
|
|
158
|
+
</li>
|
|
159
|
+
</ul>
|
|
160
|
+
</section>
|
|
161
|
+
</section>
|
|
162
|
+
</div>
|
|
163
|
+
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
164
|
+
<nav class="tsd-navigation primary">
|
|
165
|
+
<ul>
|
|
166
|
+
<li class=" ">
|
|
167
|
+
<a href="../modules.html">Modules</a>
|
|
168
|
+
</li>
|
|
169
|
+
<li class=" tsd-kind-module">
|
|
170
|
+
<a href="../modules/client.html">client</a>
|
|
171
|
+
</li>
|
|
172
|
+
<li class=" tsd-kind-module">
|
|
173
|
+
<a href="../modules/datatypes.html">datatypes</a>
|
|
174
|
+
</li>
|
|
175
|
+
<li class="current tsd-kind-module">
|
|
176
|
+
<a href="../modules/services.html">services</a>
|
|
177
|
+
</li>
|
|
178
|
+
</ul>
|
|
179
|
+
</nav>
|
|
180
|
+
<nav class="tsd-navigation secondary menu-sticky">
|
|
181
|
+
<ul class="before-current">
|
|
182
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
183
|
+
<a href="services.APIKeys.html" class="tsd-kind-icon">APIKeys</a>
|
|
184
|
+
</li>
|
|
185
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
186
|
+
<a href="services.AbuseReports.html" class="tsd-kind-icon">Abuse<wbr>Reports</a>
|
|
187
|
+
</li>
|
|
188
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
189
|
+
<a href="services.AgentIngresses.html" class="tsd-kind-icon">Agent<wbr>Ingresses</a>
|
|
190
|
+
</li>
|
|
191
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
192
|
+
<a href="services.CertificateAuthorities.html" class="tsd-kind-icon">Certificate<wbr>Authorities</a>
|
|
193
|
+
</li>
|
|
194
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
195
|
+
<a href="services.Credentials.html" class="tsd-kind-icon">Credentials</a>
|
|
196
|
+
</li>
|
|
197
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
198
|
+
<a href="services.EndpointCircuitBreakerModule.html" class="tsd-kind-icon">Endpoint<wbr>Circuit<wbr>Breaker<wbr>Module</a>
|
|
199
|
+
</li>
|
|
200
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
201
|
+
<a href="services.EndpointCompressionModule.html" class="tsd-kind-icon">Endpoint<wbr>Compression<wbr>Module</a>
|
|
202
|
+
</li>
|
|
203
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
204
|
+
<a href="services.EndpointConfigurations.html" class="tsd-kind-icon">Endpoint<wbr>Configurations</a>
|
|
205
|
+
</li>
|
|
206
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
207
|
+
<a href="services.EndpointIPPolicyModule.html" class="tsd-kind-icon">EndpointIPPolicy<wbr>Module</a>
|
|
208
|
+
</li>
|
|
209
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
210
|
+
<a href="services.EndpointLoggingModule.html" class="tsd-kind-icon">Endpoint<wbr>Logging<wbr>Module</a>
|
|
211
|
+
</li>
|
|
212
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
213
|
+
<a href="services.EndpointMutualTLSModule.html" class="tsd-kind-icon">Endpoint<wbr>MutualTLSModule</a>
|
|
214
|
+
</li>
|
|
215
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
216
|
+
<a href="services.EndpointOAuthModule.html" class="tsd-kind-icon">EndpointOAuth<wbr>Module</a>
|
|
217
|
+
</li>
|
|
218
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
219
|
+
<a href="services.EndpointOIDCModule.html" class="tsd-kind-icon">EndpointOIDCModule</a>
|
|
220
|
+
</li>
|
|
221
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
222
|
+
<a href="services.EndpointRequestHeadersModule.html" class="tsd-kind-icon">Endpoint<wbr>Request<wbr>Headers<wbr>Module</a>
|
|
223
|
+
</li>
|
|
224
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
225
|
+
<a href="services.EndpointResponseHeadersModule.html" class="tsd-kind-icon">Endpoint<wbr>Response<wbr>Headers<wbr>Module</a>
|
|
226
|
+
</li>
|
|
227
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
228
|
+
<a href="services.EndpointSAMLModule.html" class="tsd-kind-icon">EndpointSAMLModule</a>
|
|
229
|
+
</li>
|
|
230
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
231
|
+
<a href="services.EndpointTLSTerminationModule.html" class="tsd-kind-icon">EndpointTLSTermination<wbr>Module</a>
|
|
232
|
+
</li>
|
|
233
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
234
|
+
<a href="services.EndpointWebhookValidationModule.html" class="tsd-kind-icon">Endpoint<wbr>Webhook<wbr>Validation<wbr>Module</a>
|
|
235
|
+
</li>
|
|
236
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
237
|
+
<a href="services.EventDestinations.html" class="tsd-kind-icon">Event<wbr>Destinations</a>
|
|
238
|
+
</li>
|
|
239
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
240
|
+
<a href="services.EventSources.html" class="tsd-kind-icon">Event<wbr>Sources</a>
|
|
241
|
+
</li>
|
|
242
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
243
|
+
<a href="services.EventStreams.html" class="tsd-kind-icon">Event<wbr>Streams</a>
|
|
244
|
+
</li>
|
|
245
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
246
|
+
<a href="services.EventSubscriptions.html" class="tsd-kind-icon">Event<wbr>Subscriptions</a>
|
|
247
|
+
</li>
|
|
248
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
249
|
+
<a href="services.IPPolicies.html" class="tsd-kind-icon">IPPolicies</a>
|
|
250
|
+
</li>
|
|
251
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
252
|
+
<a href="services.IPPolicyRules.html" class="tsd-kind-icon">IPPolicy<wbr>Rules</a>
|
|
253
|
+
</li>
|
|
254
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
255
|
+
<a href="services.IPRestrictions.html" class="tsd-kind-icon">IPRestrictions</a>
|
|
256
|
+
</li>
|
|
257
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
258
|
+
<a href="services.ReservedAddrs.html" class="tsd-kind-icon">Reserved<wbr>Addrs</a>
|
|
259
|
+
</li>
|
|
260
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
261
|
+
<a href="services.ReservedDomains.html" class="tsd-kind-icon">Reserved<wbr>Domains</a>
|
|
262
|
+
</li>
|
|
263
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
264
|
+
<a href="services.SSHCertificateAuthorities.html" class="tsd-kind-icon">SSHCertificate<wbr>Authorities</a>
|
|
265
|
+
</li>
|
|
266
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
267
|
+
<a href="services.SSHCredentials.html" class="tsd-kind-icon">SSHCredentials</a>
|
|
268
|
+
</li>
|
|
269
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
270
|
+
<a href="services.SSHHostCertificates.html" class="tsd-kind-icon">SSHHost<wbr>Certificates</a>
|
|
271
|
+
</li>
|
|
272
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
273
|
+
<a href="services.SSHUserCertificates.html" class="tsd-kind-icon">SSHUser<wbr>Certificates</a>
|
|
274
|
+
</li>
|
|
275
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
276
|
+
<a href="services.TLSCertificates.html" class="tsd-kind-icon">TLSCertificates</a>
|
|
277
|
+
</li>
|
|
278
|
+
<li class=" tsd-kind-class tsd-parent-kind-module">
|
|
279
|
+
<a href="services.TunnelSessions.html" class="tsd-kind-icon">Tunnel<wbr>Sessions</a>
|
|
280
|
+
</li>
|
|
281
|
+
</ul>
|
|
282
|
+
<ul class="current">
|
|
283
|
+
<li class="current tsd-kind-class tsd-parent-kind-module">
|
|
284
|
+
<a href="services.Tunnels.html" class="tsd-kind-icon">Tunnels</a>
|
|
285
|
+
<ul>
|
|
286
|
+
<li class=" tsd-kind-constructor tsd-parent-kind-class">
|
|
287
|
+
<a href="services.Tunnels.html#constructor" class="tsd-kind-icon">constructor</a>
|
|
288
|
+
</li>
|
|
289
|
+
<li class=" tsd-kind-method tsd-parent-kind-class">
|
|
290
|
+
<a href="services.Tunnels.html#list" class="tsd-kind-icon">list</a>
|
|
291
|
+
</li>
|
|
292
|
+
</ul>
|
|
293
|
+
</li>
|
|
294
|
+
</ul>
|
|
295
|
+
<ul class="after-current">
|
|
296
|
+
</ul>
|
|
297
|
+
</nav>
|
|
298
|
+
</div>
|
|
299
|
+
</div>
|
|
300
|
+
</div>
|
|
301
|
+
<footer class="with-border-bottom">
|
|
302
|
+
<div class="container">
|
|
303
|
+
<h2>Legend</h2>
|
|
304
|
+
<div class="tsd-legend-group">
|
|
305
|
+
<ul class="tsd-legend">
|
|
306
|
+
<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
|
|
307
|
+
<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
|
|
308
|
+
<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
|
|
309
|
+
</ul>
|
|
310
|
+
<ul class="tsd-legend">
|
|
311
|
+
<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
|
|
312
|
+
</ul>
|
|
313
|
+
</div>
|
|
314
|
+
</div>
|
|
315
|
+
</footer>
|
|
316
|
+
<div class="container tsd-generator">
|
|
317
|
+
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
|
|
318
|
+
</div>
|
|
319
|
+
<div class="overlay"></div>
|
|
320
|
+
<script src="../assets/js/main.js"></script>
|
|
321
|
+
</body>
|
|
322
|
+
</html>
|
package/docs/index.html
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html class="default no-js">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
+
<title>@ngrok/ngrok-api</title>
|
|
7
|
+
<meta name="description" content="Documentation for @ngrok/ngrok-api">
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
9
|
+
<link rel="stylesheet" href="assets/css/main.css">
|
|
10
|
+
<script async src="assets/js/search.js" id="search-script"></script>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<header>
|
|
14
|
+
<div class="tsd-page-toolbar">
|
|
15
|
+
<div class="container">
|
|
16
|
+
<div class="table-wrap">
|
|
17
|
+
<div class="table-cell" id="tsd-search" data-index="assets/js/search.json" data-base=".">
|
|
18
|
+
<div class="field">
|
|
19
|
+
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
|
|
20
|
+
<input id="tsd-search-field" type="text" />
|
|
21
|
+
</div>
|
|
22
|
+
<ul class="results">
|
|
23
|
+
<li class="state loading">Preparing search index...</li>
|
|
24
|
+
<li class="state failure">The search index is not available</li>
|
|
25
|
+
</ul>
|
|
26
|
+
<a href="index.html" class="title">@ngrok/ngrok-api</a>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="table-cell" id="tsd-widgets">
|
|
29
|
+
<div id="tsd-filter">
|
|
30
|
+
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
|
|
31
|
+
<div class="tsd-filter-group">
|
|
32
|
+
<div class="tsd-select" id="tsd-filter-visibility">
|
|
33
|
+
<span class="tsd-select-label">All</span>
|
|
34
|
+
<ul class="tsd-select-list">
|
|
35
|
+
<li data-value="public">Public</li>
|
|
36
|
+
<li data-value="protected">Public/Protected</li>
|
|
37
|
+
<li data-value="private" class="selected">All</li>
|
|
38
|
+
</ul>
|
|
39
|
+
</div>
|
|
40
|
+
<input type="checkbox" id="tsd-filter-inherited" checked />
|
|
41
|
+
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
|
|
42
|
+
<input type="checkbox" id="tsd-filter-externals" checked />
|
|
43
|
+
<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
<div class="tsd-page-title">
|
|
52
|
+
<div class="container">
|
|
53
|
+
<h1>@ngrok/ngrok-api</h1>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</header>
|
|
57
|
+
<div class="container container-main">
|
|
58
|
+
<div class="row">
|
|
59
|
+
<div class="col-8 col-content">
|
|
60
|
+
<div class="tsd-panel tsd-typography">
|
|
61
|
+
<a href="#ngrok-api-client-library-for-javascript-and-typescript" id="ngrok-api-client-library-for-javascript-and-typescript" style="color: inherit; text-decoration: none;">
|
|
62
|
+
<h2>ngrok API client library for JavaScript and TypeScript</h2>
|
|
63
|
+
</a>
|
|
64
|
+
<p>This library wraps the <a href="https://ngrok.com/docs/api">ngrok HTTP API</a> to make it
|
|
65
|
+
easier to consume in JavaScript or TypeScript.</p>
|
|
66
|
+
<a href="#installation" id="installation" style="color: inherit; text-decoration: none;">
|
|
67
|
+
<h3>Installation</h3>
|
|
68
|
+
</a>
|
|
69
|
+
<p>The published library is available on
|
|
70
|
+
<a href="https://www.npmjs.com/package/@ngrok/ngrok-api">npm</a>.</p>
|
|
71
|
+
<pre><code class="language-shell"><span style="color: #000000">npm install @ngrok/ngrok-api</span>
|
|
72
|
+
</code></pre>
|
|
73
|
+
<a href="#documentation" id="documentation" style="color: inherit; text-decoration: none;">
|
|
74
|
+
<h3>Documentation</h3>
|
|
75
|
+
</a>
|
|
76
|
+
<p>A quickstart guide and a full API reference are included in the <a href="https://typescript-api.docs.ngrok.com">ngrok
|
|
77
|
+
TypeScript API documentation</a></p>
|
|
78
|
+
<a href="#quickstart" id="quickstart" style="color: inherit; text-decoration: none;">
|
|
79
|
+
<h3>Quickstart</h3>
|
|
80
|
+
</a>
|
|
81
|
+
<p>After you've installed the package, you'll need an API Key. Create one on the
|
|
82
|
+
<a href="https://dashboard.ngrok.com/api/keys">API Keys page of your ngrok dashboard</a>.</p>
|
|
83
|
+
<p>In your application's code, initialize an <code>Ngrok</code> client object with an API
|
|
84
|
+
key. API resources can be accessed as properties of the <code>Ngrok</code> object.</p>
|
|
85
|
+
<pre><code class="language-typescript"><span style="color: #AF00DB">import</span><span style="color: #000000"> { </span><span style="color: #001080">Ngrok</span><span style="color: #000000"> } </span><span style="color: #AF00DB">from</span><span style="color: #000000"> </span><span style="color: #A31515">'@ngrok/ngrok-api'</span><span style="color: #000000">;</span>
|
|
86
|
+
|
|
87
|
+
<span style="color: #0000FF">const</span><span style="color: #000000"> </span><span style="color: #0070C1">ngrok</span><span style="color: #000000"> = </span><span style="color: #0000FF">new</span><span style="color: #000000"> </span><span style="color: #795E26">Ngrok</span><span style="color: #000000">({</span>
|
|
88
|
+
<span style="color: #000000"> </span><span style="color: #001080">apiToken:</span><span style="color: #000000"> </span><span style="color: #A31515">'<API KEY>'</span><span style="color: #000000">,</span>
|
|
89
|
+
<span style="color: #000000">});</span>
|
|
90
|
+
|
|
91
|
+
<span style="color: #0000FF">const</span><span style="color: #000000"> </span><span style="color: #0070C1">domain</span><span style="color: #000000"> = </span><span style="color: #AF00DB">await</span><span style="color: #000000"> </span><span style="color: #001080">ngrok</span><span style="color: #000000">.</span><span style="color: #001080">domains</span><span style="color: #000000">.</span><span style="color: #795E26">create</span><span style="color: #000000">({</span>
|
|
92
|
+
<span style="color: #000000"> </span><span style="color: #001080">name:</span><span style="color: #000000"> </span><span style="color: #A31515">'your-name.ngrok.io'</span>
|
|
93
|
+
<span style="color: #000000">})</span>
|
|
94
|
+
<span style="color: #001080">console</span><span style="color: #000000">.</span><span style="color: #795E26">log</span><span style="color: #000000">(</span><span style="color: #001080">domain</span><span style="color: #000000">);</span>
|
|
95
|
+
</code></pre>
|
|
96
|
+
<a href="#automatic-paging" id="automatic-paging" style="color: inherit; text-decoration: none;">
|
|
97
|
+
<h3>Automatic Paging</h3>
|
|
98
|
+
</a>
|
|
99
|
+
<p>The ngrok API pages all list resources but this library abstracts that
|
|
100
|
+
implementation detail away from you. <code>list()</code> methods will return collections
|
|
101
|
+
that can be iterated over and the implementation will fetch the pages from the
|
|
102
|
+
API for you behind the scenes.</p>
|
|
103
|
+
<pre><code class="language-typescript"><span style="color: #AF00DB">import</span><span style="color: #000000"> { </span><span style="color: #001080">Ngrok</span><span style="color: #000000"> } </span><span style="color: #AF00DB">from</span><span style="color: #000000"> </span><span style="color: #A31515">'@ngrok/ngrok-api'</span><span style="color: #000000">;</span>
|
|
104
|
+
|
|
105
|
+
<span style="color: #0000FF">const</span><span style="color: #000000"> </span><span style="color: #0070C1">ngrok</span><span style="color: #000000"> = </span><span style="color: #0000FF">new</span><span style="color: #000000"> </span><span style="color: #795E26">Ngrok</span><span style="color: #000000">({</span>
|
|
106
|
+
<span style="color: #000000"> </span><span style="color: #001080">apiToken:</span><span style="color: #000000"> </span><span style="color: #A31515">'<API KEY>'</span><span style="color: #000000">,</span>
|
|
107
|
+
<span style="color: #000000">});</span>
|
|
108
|
+
|
|
109
|
+
<span style="color: #000000">(</span><span style="color: #AF00DB">await</span><span style="color: #000000"> </span><span style="color: #001080">ngrok</span><span style="color: #000000">.</span><span style="color: #001080">tunnels</span><span style="color: #000000">.</span><span style="color: #795E26">list</span><span style="color: #000000">()).</span><span style="color: #795E26">forEach</span><span style="color: #000000">(</span><span style="color: #001080">t</span><span style="color: #000000"> </span><span style="color: #0000FF">=></span><span style="color: #000000"> </span><span style="color: #001080">console</span><span style="color: #000000">.</span><span style="color: #795E26">log</span><span style="color: #000000">(</span><span style="color: #001080">t</span><span style="color: #000000">));</span>
|
|
110
|
+
</code></pre>
|
|
111
|
+
<a href="#async-programming" id="async-programming" style="color: inherit; text-decoration: none;">
|
|
112
|
+
<h3>Async Programming</h3>
|
|
113
|
+
</a>
|
|
114
|
+
<p>All API methods return a <code>Promise</code> and are suitable for use in asynchronous
|
|
115
|
+
programming. You can use callback chaining with <code>.then()</code> and <code>.catch()</code> syntax
|
|
116
|
+
or the <code>await</code> keyword to wait for completion of an API call.</p>
|
|
117
|
+
<pre><code class="language-typescript"><span style="color: #008000">// await style</span>
|
|
118
|
+
<span style="color: #0000FF">const</span><span style="color: #000000"> </span><span style="color: #0070C1">cred</span><span style="color: #000000"> = </span><span style="color: #AF00DB">await</span><span style="color: #000000"> </span><span style="color: #001080">ngrok</span><span style="color: #000000">.</span><span style="color: #001080">credentials</span><span style="color: #000000">.</span><span style="color: #795E26">create</span><span style="color: #000000">({</span><span style="color: #001080">description:</span><span style="color: #000000"> </span><span style="color: #A31515">"example"</span><span style="color: #000000">});</span>
|
|
119
|
+
<span style="color: #001080">console</span><span style="color: #000000">.</span><span style="color: #795E26">log</span><span style="color: #000000">(</span><span style="color: #001080">cred</span><span style="color: #000000">);</span>
|
|
120
|
+
|
|
121
|
+
<span style="color: #008000">// callback chaining</span>
|
|
122
|
+
<span style="color: #001080">ngrok</span><span style="color: #000000">.</span><span style="color: #001080">credentials</span><span style="color: #000000">.</span><span style="color: #795E26">create</span><span style="color: #000000">({</span><span style="color: #001080">description:</span><span style="color: #000000"> </span><span style="color: #A31515">"example"</span><span style="color: #000000">}).</span><span style="color: #795E26">then</span><span style="color: #000000">((</span><span style="color: #001080">cred</span><span style="color: #000000"> </span><span style="color: #0000FF">=></span><span style="color: #000000"> {</span>
|
|
123
|
+
<span style="color: #000000"> </span><span style="color: #001080">console</span><span style="color: #000000">.</span><span style="color: #795E26">log</span><span style="color: #000000">(</span><span style="color: #001080">cred</span><span style="color: #000000">)</span>
|
|
124
|
+
<span style="color: #000000">}));</span>
|
|
125
|
+
</code></pre>
|
|
126
|
+
<a href="#error-handling" id="error-handling" style="color: inherit; text-decoration: none;">
|
|
127
|
+
<h3>Error Handling</h3>
|
|
128
|
+
</a>
|
|
129
|
+
<p>The ngrok API returns detailed information when an API call fails. If an error
|
|
130
|
+
is encountered, API methods throw the rich <code>Error</code> type on resolution of a
|
|
131
|
+
returned <code>Promise</code>. This allows your code to gracefully handle different error
|
|
132
|
+
conditions.</p>
|
|
133
|
+
<p>The <code>Error</code> type includes a <code>statusCode</code> property which can be used to
|
|
134
|
+
distinguish not found errors when a resource does not exist:</p>
|
|
135
|
+
<pre><code class="language-typescript">
|
|
136
|
+
<span style="color: #AF00DB">import</span><span style="color: #000000"> { </span><span style="color: #001080">Error</span><span style="color: #000000"> } </span><span style="color: #AF00DB">from</span><span style="color: #000000"> </span><span style="color: #A31515">'@ngrok/ngrok-api'</span><span style="color: #000000">;</span>
|
|
137
|
+
|
|
138
|
+
<span style="color: #AF00DB">try</span><span style="color: #000000"> {</span>
|
|
139
|
+
<span style="color: #000000"> </span><span style="color: #AF00DB">await</span><span style="color: #000000"> </span><span style="color: #001080">ngrok</span><span style="color: #000000">.</span><span style="color: #001080">ipPolicies</span><span style="color: #000000">.</span><span style="color: #795E26">update</span><span style="color: #000000">({</span>
|
|
140
|
+
<span style="color: #000000"> </span><span style="color: #001080">id:</span><span style="color: #000000"> </span><span style="color: #A31515">'someInvalidId'</span><span style="color: #000000">,</span>
|
|
141
|
+
<span style="color: #000000"> </span><span style="color: #001080">description:</span><span style="color: #000000"> </span><span style="color: #A31515">'updated description'</span><span style="color: #000000">,</span>
|
|
142
|
+
<span style="color: #000000"> })</span>
|
|
143
|
+
<span style="color: #000000">} </span><span style="color: #AF00DB">catch</span><span style="color: #000000"> (</span><span style="color: #001080">err</span><span style="color: #000000">: </span><span style="color: #267F99">Error</span><span style="color: #000000">) {</span>
|
|
144
|
+
<span style="color: #000000"> </span><span style="color: #AF00DB">if</span><span style="color: #000000"> (</span><span style="color: #001080">err</span><span style="color: #000000">.</span><span style="color: #001080">statusCode</span><span style="color: #000000"> == </span><span style="color: #098658">404</span><span style="color: #000000">) {</span>
|
|
145
|
+
<span style="color: #000000"> </span><span style="color: #001080">console</span><span style="color: #000000">.</span><span style="color: #795E26">log</span><span style="color: #000000">(</span><span style="color: #A31515">'no ip policy with that id to update'</span><span style="color: #000000">)</span>
|
|
146
|
+
<span style="color: #000000"> }</span>
|
|
147
|
+
<span style="color: #000000">}</span>
|
|
148
|
+
</code></pre>
|
|
149
|
+
<p>Every error returned by the ngrok API includes a <a href="https://ngrok.com/docs/errors">unique, documented error
|
|
150
|
+
code</a> that you can use to distinguish unique
|
|
151
|
+
error conditions. Use the <code>errorCode</code> property in your application code to
|
|
152
|
+
handle handle different error conditions.</p>
|
|
153
|
+
<pre><code class="language-typescript"><span style="color: #AF00DB">import</span><span style="color: #000000"> { </span><span style="color: #001080">Error</span><span style="color: #000000"> } </span><span style="color: #AF00DB">from</span><span style="color: #000000"> </span><span style="color: #A31515">'@ngrok/ngrok-api'</span><span style="color: #000000">;</span>
|
|
154
|
+
|
|
155
|
+
<span style="color: #AF00DB">try</span><span style="color: #000000"> {</span>
|
|
156
|
+
<span style="color: #000000"> </span><span style="color: #AF00DB">await</span><span style="color: #000000"> </span><span style="color: #001080">ngrok</span><span style="color: #000000">.</span><span style="color: #001080">ipPolicies</span><span style="color: #000000">.</span><span style="color: #795E26">create</span><span style="color: #000000">({</span>
|
|
157
|
+
<span style="color: #000000"> </span><span style="color: #001080">action:</span><span style="color: #000000"> </span><span style="color: #A31515">'something invalid'</span><span style="color: #000000">,</span>
|
|
158
|
+
<span style="color: #000000"> })</span>
|
|
159
|
+
<span style="color: #000000">} </span><span style="color: #AF00DB">catch</span><span style="color: #000000"> (</span><span style="color: #001080">err</span><span style="color: #000000">: </span><span style="color: #267F99">Error</span><span style="color: #000000">) {</span>
|
|
160
|
+
<span style="color: #000000"> </span><span style="color: #AF00DB">if</span><span style="color: #000000"> (</span><span style="color: #001080">err</span><span style="color: #000000">.</span><span style="color: #001080">errorCode</span><span style="color: #000000"> == </span><span style="color: #A31515">"ERR_NGROK_1410"</span><span style="color: #000000">) {</span>
|
|
161
|
+
<span style="color: #000000"> </span><span style="color: #001080">console</span><span style="color: #000000">.</span><span style="color: #795E26">log</span><span style="color: #000000">(</span><span style="color: #A31515">'not a valid ip policy action'</span><span style="color: #000000">)</span>
|
|
162
|
+
<span style="color: #000000"> } </span><span style="color: #AF00DB">else</span><span style="color: #000000"> {</span>
|
|
163
|
+
<span style="color: #000000"> </span><span style="color: #001080">console</span><span style="color: #000000">.</span><span style="color: #795E26">log</span><span style="color: #000000">(</span><span style="color: #A31515">'some other error'</span><span style="color: #000000">, </span><span style="color: #001080">err</span><span style="color: #000000">)</span>
|
|
164
|
+
<span style="color: #000000"> }</span>
|
|
165
|
+
<span style="color: #000000">}</span>
|
|
166
|
+
</code></pre>
|
|
167
|
+
<a href="#additional-examples" id="additional-examples" style="color: inherit; text-decoration: none;">
|
|
168
|
+
<h3>Additional Examples</h3>
|
|
169
|
+
</a>
|
|
170
|
+
<pre><code class="language-typescript"><span style="color: #AF00DB">import</span><span style="color: #000000"> { </span><span style="color: #001080">EndpointConfiguration</span><span style="color: #000000">, </span><span style="color: #001080">Error</span><span style="color: #000000">, </span><span style="color: #001080">Ngrok</span><span style="color: #000000"> } </span><span style="color: #AF00DB">from</span><span style="color: #000000"> </span><span style="color: #A31515">'@ngrok/ngrok-api'</span><span style="color: #000000">;</span>
|
|
171
|
+
|
|
172
|
+
<span style="color: #0000FF">const</span><span style="color: #000000"> </span><span style="color: #0070C1">ngrok</span><span style="color: #000000"> = </span><span style="color: #0000FF">new</span><span style="color: #000000"> </span><span style="color: #795E26">Ngrok</span><span style="color: #000000">({</span>
|
|
173
|
+
<span style="color: #000000"> </span><span style="color: #001080">apiToken:</span><span style="color: #000000"> </span><span style="color: #A31515">'an api token'</span><span style="color: #000000">,</span>
|
|
174
|
+
<span style="color: #000000">});</span>
|
|
175
|
+
|
|
176
|
+
<span style="color: #001080">ngrok</span><span style="color: #000000">.</span><span style="color: #001080">endpointConfigurations</span><span style="color: #000000">.</span><span style="color: #795E26">create</span><span style="color: #000000">({</span>
|
|
177
|
+
<span style="color: #000000"> </span><span style="color: #001080">type:</span><span style="color: #000000"> </span><span style="color: #A31515">'https'</span><span style="color: #000000">,</span>
|
|
178
|
+
<span style="color: #000000"> </span><span style="color: #001080">description:</span><span style="color: #000000"> </span><span style="color: #A31515">'some endpoint configuration description'</span><span style="color: #000000">,</span>
|
|
179
|
+
<span style="color: #000000"> </span><span style="color: #001080">metadata:</span><span style="color: #000000"> </span><span style="color: #A31515">'some endpoint configuration metadata'</span><span style="color: #000000">,</span>
|
|
180
|
+
<span style="color: #000000"> </span><span style="color: #001080">requestHeaders:</span><span style="color: #000000"> {</span>
|
|
181
|
+
<span style="color: #000000"> </span><span style="color: #001080">add:</span><span style="color: #000000"> </span><span style="color: #0000FF">new</span><span style="color: #000000"> </span><span style="color: #267F99">Map</span><span style="color: #000000">([</span>
|
|
182
|
+
<span style="color: #000000"> [</span><span style="color: #A31515">'x-frontend'</span><span style="color: #000000">, </span><span style="color: #A31515">'ngrok'</span><span style="color: #000000">]</span>
|
|
183
|
+
<span style="color: #000000"> ]),</span>
|
|
184
|
+
<span style="color: #000000"> </span><span style="color: #001080">remove:</span><span style="color: #000000"> [</span><span style="color: #A31515">'cache-control'</span><span style="color: #000000">],</span>
|
|
185
|
+
<span style="color: #000000"> },</span>
|
|
186
|
+
<span style="color: #000000">})</span>
|
|
187
|
+
<span style="color: #000000"> .</span><span style="color: #795E26">then</span><span style="color: #000000">((</span><span style="color: #001080">epc</span><span style="color: #000000">: </span><span style="color: #267F99">EndpointConfiguration</span><span style="color: #000000">) </span><span style="color: #0000FF">=></span><span style="color: #000000"> {</span>
|
|
188
|
+
<span style="color: #000000"> </span><span style="color: #001080">console</span><span style="color: #000000">.</span><span style="color: #795E26">log</span><span style="color: #000000">(</span><span style="color: #001080">epc</span><span style="color: #000000">);</span>
|
|
189
|
+
<span style="color: #000000"> })</span>
|
|
190
|
+
<span style="color: #000000"> .</span><span style="color: #795E26">catch</span><span style="color: #000000">((</span><span style="color: #001080">err</span><span style="color: #000000">: </span><span style="color: #267F99">Error</span><span style="color: #000000">) </span><span style="color: #0000FF">=></span><span style="color: #000000"> {</span>
|
|
191
|
+
<span style="color: #000000"> </span><span style="color: #001080">console</span><span style="color: #000000">.</span><span style="color: #795E26">log</span><span style="color: #000000">(</span><span style="color: #001080">err</span><span style="color: #000000">);</span>
|
|
192
|
+
<span style="color: #000000"> });</span>
|
|
193
|
+
</code></pre>
|
|
194
|
+
</div>
|
|
195
|
+
</div>
|
|
196
|
+
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
197
|
+
<nav class="tsd-navigation primary">
|
|
198
|
+
<ul>
|
|
199
|
+
<li class=" ">
|
|
200
|
+
<a href="modules.html">Modules</a>
|
|
201
|
+
</li>
|
|
202
|
+
<li class=" tsd-kind-module">
|
|
203
|
+
<a href="modules/client.html">client</a>
|
|
204
|
+
</li>
|
|
205
|
+
<li class=" tsd-kind-module">
|
|
206
|
+
<a href="modules/datatypes.html">datatypes</a>
|
|
207
|
+
</li>
|
|
208
|
+
<li class=" tsd-kind-module">
|
|
209
|
+
<a href="modules/services.html">services</a>
|
|
210
|
+
</li>
|
|
211
|
+
</ul>
|
|
212
|
+
</nav>
|
|
213
|
+
<nav class="tsd-navigation secondary menu-sticky">
|
|
214
|
+
<ul class="before-current">
|
|
215
|
+
</ul>
|
|
216
|
+
</nav>
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
</div>
|
|
220
|
+
<footer class="with-border-bottom">
|
|
221
|
+
<div class="container">
|
|
222
|
+
<h2>Legend</h2>
|
|
223
|
+
<div class="tsd-legend-group">
|
|
224
|
+
<ul class="tsd-legend">
|
|
225
|
+
<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
|
|
226
|
+
</ul>
|
|
227
|
+
<ul class="tsd-legend">
|
|
228
|
+
<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
|
|
229
|
+
</ul>
|
|
230
|
+
</div>
|
|
231
|
+
</div>
|
|
232
|
+
</footer>
|
|
233
|
+
<div class="container tsd-generator">
|
|
234
|
+
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
|
|
235
|
+
</div>
|
|
236
|
+
<div class="overlay"></div>
|
|
237
|
+
<script src="assets/js/main.js"></script>
|
|
238
|
+
</body>
|
|
239
|
+
</html>
|