Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
Merge pull request #5 from ngrok/staging
Browse files Browse the repository at this point in the history
cut new release of scala client
  • Loading branch information
krwenholz committed Apr 11, 2022
2 parents 738eec6 + d28f96f commit b99dc40
Show file tree
Hide file tree
Showing 321 changed files with 674 additions and 662 deletions.
42 changes: 27 additions & 15 deletions README.md
@@ -1,12 +1,21 @@
# Unstable

This library is currently unstable. We know of rough edges
and are working to bring it to parity with our other API client
libraries. Please feel free to try it out and let us know if you find
it useful!

# ngrok API client library for Scala

This library wraps the [ngrok HTTP API](https://ngrok.com/docs/api) to
make it easier to consume in Scala.

## Usage

This library is published on [Maven
Central](https://search.maven.org/artifact/com.ngrok/ngrok-api-scala).
This library is published on Maven Central for [2.12
](https://search.maven.org/artifact/com.ngrok/ngrok-api-scala_2.12)
and [2.13
](https://search.maven.org/artifact/com.ngrok/ngrok-api-scala_2.13).

If using sbt, add the following dependency:

Expand Down Expand Up @@ -34,7 +43,7 @@ Versions of this library are published for Scala 2.12 and Scala 2.13
## Documentation
All objects, methods and properties are documented with Scaladoc for
integration with an IDE like IntelliJ IDEA or Eclipse. You can also
integration with an IDE like IntelliJ IDEA or Eclipse. You can also
[view the documentation online](https://scala-api.docs.ngrok.com/).
Beyond that, this readme is the best source of documentation for the
Expand All @@ -44,17 +53,17 @@ library.
This class library is published to Maven Central using semantic
versioning. Breaking changes to the API will only be released with a
bump of the major version number. Each released commit is tagged in
bump of the major version number. Each released commit is tagged in
this repository.
No compatibility promises are made for versions < 1.0.0.
### Quickstart
First, use the ngrok dashboard to generate an API key. Store that in a
safe place. Inject it into your application using the environment
variable `NGROK_API_KEY`. The `Ngrok()` method will pull from that
environment variable. If you prefer, you can also pass the API key
First, use the ngrok dashboard to generate an API key. Store that in a
safe place. Inject it into your application using the environment
variable `NGROK_API_KEY`. The `Ngrok()` method will pull from that
environment variable. If you prefer, you can also pass the API key
explicitly.
#### Create an IP Policy that allows traffic from some subnets
Expand All @@ -71,7 +80,7 @@ class Example extends App {
val ngrok = Ngrok()
Await.result(
ngrok.ipPolicies.create("allow").flatMap(policy =>
ngrok.ipPolicies.create(Some("allow")).flatMap(policy =>
List("24.0.0.0/8", "12.0.0.0/8").traverse(
cidr => ngrok.ipPolicyRules.create(cidr, policy.id)
)
Expand All @@ -96,7 +105,10 @@ class Example extends App {
val ngrok = Ngrok()
println("Tunnels:")
ngrok.tunnels.list().map(printRecursively(ngrok, _))
Await.result(
ngrok.tunnels.list().map(printRecursively(ngrok, _)),
5.second
)
private def printRecursively(ngrok: Ngrok, currentPage: Page[TunnelList]): Future[Unit] = {
currentPage.page.tunnels.foreach(println)
Expand All @@ -118,7 +130,7 @@ your application code.
You can also customize low-level behavior by instantiating the
`DefaultNgrokApiClient` yourself, and then using it to construct the
`Ngrok` instance. If you'd like to use a different HTTP library
`Ngrok` instance. If you'd like to use a different HTTP library
entirely, you can even implement the `NgrokApiClient` interface
yourself.
Expand Down Expand Up @@ -157,7 +169,7 @@ class Example extends App {

All list responses from the ngrok API are paged. All list response
objects implement the `Pageable` trait, and are wrapped in a `Page`
class, which has a `next()` method. Calling `next()` will asyncronously
class, which has a `next()` method. Calling `next()` will asyncronously
request the next page. If no next page is available, an empty `Option`
will be returned inside the `Future`.

Expand Down Expand Up @@ -193,7 +205,7 @@ class Example extends App {
### Error Handling

All errors returned by the ngrok API are serialized as structured
payloads for easy error handling. If a structured error is returned by
payloads for easy error handling. If a structured error is returned by
the ngrok API, this library will return a failed `Future`
containing a `NgrokApiError`.

Expand Down Expand Up @@ -249,11 +261,11 @@ class Example extends App {

All datatype objects in the ngrok API library are case classes, which
properly override `equals()` and `hashCode()` so that the objects can be
compared. Similarly, they override `toString()` for more helpful pretty
compared. Similarly, they override `toString()` for more helpful pretty
printing of ngrok domain objects.

### Sync / Async Interfaces

Each API client operation returns a `Future[T]` and is asynchonous. If
Each API client operation returns a `Future[T]` and is asynchonous. If
you require a synchonous call, you can wrap the return value in
`Await.result()`.
4 changes: 2 additions & 2 deletions docs/com/index.html
@@ -1,2 +1,2 @@
<!DOCTYPE html ><html><head><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"/><title>ngrok API Documentation (0.5.0) - com</title><meta content="ngrok API Documentation 0.5.0 - com" name="description"/><meta content="ngrok API Documentation 0.5.0 com" name="keywords"/><meta http-equiv="content-type" content="text/html; charset=UTF-8"/><link href="../lib/index.css" media="screen" type="text/css" rel="stylesheet"/><link href="../lib/template.css" media="screen" type="text/css" rel="stylesheet"/><link href="../lib/print.css" media="print" type="text/css" rel="stylesheet"/><link href="../lib/diagrams.css" media="screen" type="text/css" rel="stylesheet" id="diagrams-css"/><script type="text/javascript" src="../lib/jquery.min.js"></script><script type="text/javascript" src="../lib/index.js"></script><script type="text/javascript" src="../index.js"></script><script type="text/javascript" src="../lib/scheduler.js"></script><script type="text/javascript" src="../lib/template.js"></script><script type="text/javascript">/* this variable can be used by the JS to determine the path to the root document */
var toRoot = '../';</script></head><body><div id="search"><span id="doc-title">ngrok API Documentation<span id="doc-version">(0.5.0)</span></span> <span class="close-results"><span class="left">&lt;</span> Back</span><div id="textfilter"><span class="input"><input autocapitalize="none" placeholder="Search" id="index-input" type="text" accesskey="/"/><i class="clear material-icons"></i><i id="search-icon" class="material-icons"></i></span></div></div><div id="search-results"><div id="search-progress"><div id="progress-fill"></div></div><div id="results-content"><div id="entity-results"></div><div id="member-results"></div></div></div><div id="content-scroll-container" style="-webkit-overflow-scrolling: touch;"><div id="content-container" style="-webkit-overflow-scrolling: touch;"><div id="subpackage-spacer"><div id="packages"><h1>Packages</h1><ul><li class="indented0 " name="_root_.root" group="Ungrouped" fullComment="yes" data-isabs="false" visbl="pub"><a id="_root_" class="anchorToMember"></a><a id="root:_root_" class="anchorToMember"></a> <span class="permalink"><a href="../index.html" title="Permalink"><i class="material-icons"></i></a></span> <span class="modifier_kind"><span class="modifier"></span> <span class="kind">package</span></span> <span class="symbol"><a href="../index.html" title=""><span class="name">root</span></a></span><div class="fullcomment"><dl class="attributes block"><dt>Definition Classes</dt><dd><a href="../index.html" name="_root_" id="_root_" class="extype">root</a></dd></dl></div></li><li class="indented1 current" name="_root_.com" group="Ungrouped" fullComment="yes" data-isabs="false" visbl="pub"><a id="com" class="anchorToMember"></a><a id="com:com" class="anchorToMember"></a> <span class="permalink"><a href="../com/index.html" title="Permalink"><i class="material-icons"></i></a></span> <span class="modifier_kind"><span class="modifier"></span> <span class="kind">package</span></span> <span class="symbol"><span class="name">com</span></span><div class="fullcomment"><dl class="attributes block"><dt>Definition Classes</dt><dd><a href="../index.html" name="_root_" id="_root_" class="extype">root</a></dd></dl></div></li><li class="indented2 " name="com.ngrok" group="Ungrouped" fullComment="no" data-isabs="false" visbl="pub"><a id="ngrok" class="anchorToMember"></a><a id="ngrok:ngrok" class="anchorToMember"></a> <span class="permalink"><a href="../com/ngrok/index.html" title="Permalink"><i class="material-icons"></i></a></span> <span class="modifier_kind"><span class="modifier"></span> <span class="kind">package</span></span> <span class="symbol"><a href="ngrok/index.html" title=""><span class="name">ngrok</span></a></span></li></ul></div></div><div id="content"><body class="package value"><div id="definition"><div class="big-circle package">p</div><h1>com<span class="permalink"><a href="../com/index.html" title="Permalink"><i class="material-icons"></i></a></span></h1></div><h4 id="signature" class="signature"><span class="modifier_kind"><span class="modifier"></span> <span class="kind">package</span></span> <span class="symbol"><span class="name">com</span></span></h4><div id="comment" class="fullcommenttop"></div><div id="template"><div id="allMembers"><div id="packages" class="package members"><h3>Package Members</h3><ol><li class="indented0 " name="com.ngrok" group="Ungrouped" fullComment="no" data-isabs="false" visbl="pub"><a id="ngrok" class="anchorToMember"></a><a id="ngrok:ngrok" class="anchorToMember"></a> <span class="permalink"><a href="../com/ngrok/index.html" title="Permalink"><i class="material-icons"></i></a></span> <span class="modifier_kind"><span class="modifier"></span> <span class="kind">package</span></span> <span class="symbol"><a href="ngrok/index.html" title=""><span class="name">ngrok</span></a></span></li></ol></div></div><div id="inheritedMembers"></div><div id="groupedMembers"><div name="Ungrouped" class="group"><h3>Ungrouped</h3></div></div></div><div id="tooltip"></div><div id="footer"></div></body></div></div></div></body></html>
<!DOCTYPE html ><html><head><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"/><title>ngrok API Documentation (0.6.0) - com</title><meta content="ngrok API Documentation 0.6.0 - com" name="description"/><meta content="ngrok API Documentation 0.6.0 com" name="keywords"/><meta http-equiv="content-type" content="text/html; charset=UTF-8"/><link href="../lib/index.css" media="screen" type="text/css" rel="stylesheet"/><link href="../lib/template.css" media="screen" type="text/css" rel="stylesheet"/><link href="../lib/print.css" media="print" type="text/css" rel="stylesheet"/><link href="../lib/diagrams.css" media="screen" type="text/css" rel="stylesheet" id="diagrams-css"/><script type="text/javascript" src="../lib/jquery.min.js"></script><script type="text/javascript" src="../lib/index.js"></script><script type="text/javascript" src="../index.js"></script><script type="text/javascript" src="../lib/scheduler.js"></script><script type="text/javascript" src="../lib/template.js"></script><script type="text/javascript">/* this variable can be used by the JS to determine the path to the root document */
var toRoot = '../';</script></head><body><div id="search"><span id="doc-title">ngrok API Documentation<span id="doc-version">(0.6.0)</span></span> <span class="close-results"><span class="left">&lt;</span> Back</span><div id="textfilter"><span class="input"><input autocapitalize="none" placeholder="Search" id="index-input" type="text" accesskey="/"/><i class="clear material-icons"></i><i id="search-icon" class="material-icons"></i></span></div></div><div id="search-results"><div id="search-progress"><div id="progress-fill"></div></div><div id="results-content"><div id="entity-results"></div><div id="member-results"></div></div></div><div id="content-scroll-container" style="-webkit-overflow-scrolling: touch;"><div id="content-container" style="-webkit-overflow-scrolling: touch;"><div id="subpackage-spacer"><div id="packages"><h1>Packages</h1><ul><li class="indented0 " name="_root_.root" group="Ungrouped" fullComment="yes" data-isabs="false" visbl="pub"><a id="_root_" class="anchorToMember"></a><a id="root:_root_" class="anchorToMember"></a> <span class="permalink"><a href="../index.html" title="Permalink"><i class="material-icons"></i></a></span> <span class="modifier_kind"><span class="modifier"></span> <span class="kind">package</span></span> <span class="symbol"><a href="../index.html" title=""><span class="name">root</span></a></span><div class="fullcomment"><dl class="attributes block"><dt>Definition Classes</dt><dd><a href="../index.html" name="_root_" id="_root_" class="extype">root</a></dd></dl></div></li><li class="indented1 current" name="_root_.com" group="Ungrouped" fullComment="yes" data-isabs="false" visbl="pub"><a id="com" class="anchorToMember"></a><a id="com:com" class="anchorToMember"></a> <span class="permalink"><a href="../com/index.html" title="Permalink"><i class="material-icons"></i></a></span> <span class="modifier_kind"><span class="modifier"></span> <span class="kind">package</span></span> <span class="symbol"><span class="name">com</span></span><div class="fullcomment"><dl class="attributes block"><dt>Definition Classes</dt><dd><a href="../index.html" name="_root_" id="_root_" class="extype">root</a></dd></dl></div></li><li class="indented2 " name="com.ngrok" group="Ungrouped" fullComment="no" data-isabs="false" visbl="pub"><a id="ngrok" class="anchorToMember"></a><a id="ngrok:ngrok" class="anchorToMember"></a> <span class="permalink"><a href="../com/ngrok/index.html" title="Permalink"><i class="material-icons"></i></a></span> <span class="modifier_kind"><span class="modifier"></span> <span class="kind">package</span></span> <span class="symbol"><a href="ngrok/index.html" title=""><span class="name">ngrok</span></a></span></li></ul></div></div><div id="content"><body class="package value"><div id="definition"><div class="big-circle package">p</div><h1>com<span class="permalink"><a href="../com/index.html" title="Permalink"><i class="material-icons"></i></a></span></h1></div><h4 id="signature" class="signature"><span class="modifier_kind"><span class="modifier"></span> <span class="kind">package</span></span> <span class="symbol"><span class="name">com</span></span></h4><div id="comment" class="fullcommenttop"></div><div id="template"><div id="allMembers"><div id="packages" class="package members"><h3>Package Members</h3><ol><li class="indented0 " name="com.ngrok" group="Ungrouped" fullComment="no" data-isabs="false" visbl="pub"><a id="ngrok" class="anchorToMember"></a><a id="ngrok:ngrok" class="anchorToMember"></a> <span class="permalink"><a href="../com/ngrok/index.html" title="Permalink"><i class="material-icons"></i></a></span> <span class="modifier_kind"><span class="modifier"></span> <span class="kind">package</span></span> <span class="symbol"><a href="ngrok/index.html" title=""><span class="name">ngrok</span></a></span></li></ol></div></div><div id="inheritedMembers"></div><div id="groupedMembers"><div name="Ungrouped" class="group"><h3>Ungrouped</h3></div></div></div><div id="tooltip"></div><div id="footer"></div></body></div></div></div></body></html>

0 comments on commit b99dc40

Please sign in to comment.