Skip to content

Commit 42e5557

Browse files
committed
feat: update for user-provided identifiers, update deps, etc
1 parent 8d6735e commit 42e5557

18 files changed

+4370
-5474
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ This command generates static content into the `build` directory and can be serv
2727
## Deployment
2828

2929
```console
30-
GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
30+
GIT_USER=<Your GitHub username> USE_SSH=true DEPLOYMENT_BRANCH=main yarn deploy
3131
```
3232

3333
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

docs/cli.mdx

Lines changed: 89 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,29 @@ sidebar_label: Download CLI
66

77
import Tabs from "@theme/Tabs";
88
import TabItem from "@theme/TabItem";
9+
import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment";
910

10-
iStreamPlanet's APIs implement OpenAPI 3 descriptions which are publicly linked via [RFC 8631](https://tools.ietf.org/html/rfc8631) `service-desc` link relation headers and auto-discovery for [CLI configuration](https://rest.sh/#/openapi?id=autoconfiguration) via `x-cli-config` extension. This means you can use any client which understands these features to interact with our APIs.
11-
12-
Since the client is generated from API-provided descriptions rather than hard-coded, you will always have access to the latest API features.
11+
iStreamPlanet's APIs implement OpenAPI 3 descriptions which are publicly linked via [RFC 8631](https://tools.ietf.org/html/rfc8631) `service-desc` link relation headers and provide auto-discovery for [CLI configuration](https://rest.sh/#/openapi?id=autoconfiguration) via the `x-cli-config` extension. This means you can use any client which understands these features to interact with our APIs.
1312

1413
## Installation
1514

16-
We recommend getting started with [Restish](https://rest.sh/), a simple cURL-like commandline client for REST-ish APIs. Getting started is easy:
15+
We recommend getting started with [Restish](https://rest.sh/), a simple cURL-like commandline client for REST-ish APIs. Commands are generated at runtime based on our latest published OpenAPI, so you always have access to the latest API features automatically.
16+
17+
Getting started is easy:
1718

1819
<Tabs
19-
defaultValue="mac"
20+
defaultValue={function() {
21+
if (ExecutionEnvironment.canUseDOM) {
22+
// Try to guess the user's OS from their browser!
23+
const platform = navigator.platform.toLowerCase();
24+
if (platform.includes("linux")) {
25+
return "linux";
26+
} else if (platform.includes("win")) {
27+
return "win";
28+
}
29+
}
30+
return "mac";
31+
}()}
2032
values={[
2133
{ label: "macOS", value: "mac" },
2234
{ label: "Windows", value: "win" },
@@ -25,29 +37,37 @@ We recommend getting started with [Restish](https://rest.sh/), a simple cURL-lik
2537
>
2638
<TabItem value="mac">
2739

28-
First, make sure you have [Homebrew](https://brew.sh/) installed. After that, installing Restish is a breeze:
40+
First, make sure you have [Homebrew](https://brew.sh/) installed. After that, installing or upgrading Restish is a breeze:
2941

3042
```bash
43+
# Install Restish
3144
$ brew tap danielgtaylor/restish && brew install restish
45+
46+
# Upgrade Restish to latest release
47+
$ brew upgrade restish
3248
```
3349

34-
Prefer not to use Homebrew? Then [manually download a release](https://github.com/danielgtaylor/restish/releases).
50+
Prefer not to use Homebrew? Then [manually download a release](https://github.com/danielgtaylor/restish/releases/latest).
3551

3652
</TabItem>
3753
<TabItem value="win">
3854

39-
Head over and [manually download a release](https://github.com/danielgtaylor/restish/releases). Unzip the executable somewhere and you are good to go!
55+
Head over and [manually download a release](https://github.com/danielgtaylor/restish/releases/latest). Unzip the executable somewhere and you are good to go!
4056

4157
</TabItem>
4258
<TabItem value="linux">
4359

44-
First, make sure you have [Homebrew](https://brew.sh/) installed. After that, installing Restish is a breeze:
60+
If you have [Homebrew](https://brew.sh/) then installing or upgrading Restish is a breeze:
4561

4662
```bash
63+
# Install Restish
4764
$ brew tap danielgtaylor/restish && brew install restish
65+
66+
# Upgrade Restish to latest release
67+
$ brew upgrade restish
4868
```
4969

50-
Prefer not to use Homebrew? Then [manually download a release](https://github.com/danielgtaylor/restish/releases) or use `go get` if you have the Go compiler installed:
70+
Prefer not to use Homebrew? Then [manually download a release](https://github.com/danielgtaylor/restish/releases/latest) or use `go get` if you have the Go compiler installed:
5171

5272
```bash
5373
// Download, build & install.
@@ -63,7 +83,7 @@ Once installed you need to configure Restish to talk to the iStreamPlanet API. W
6383

6484
```bash
6585
# Configure Restish to talk to iStreamPlanet.
66-
$ restish api config isp https://api.istreamplanet.com
86+
$ restish api configure isp https://api.istreamplanet.com
6787

6888
? Organization ID [? for help] YOUR_VALUE_HERE
6989
? Select option [Use arrows to move, type to filter]
@@ -73,6 +93,8 @@ $ restish api config isp https://api.istreamplanet.com
7393
> Save and exit
7494
```
7595

96+
Restish supports multiple profiles, which can be set up via the interactive configuration prompt above or by copying & editing in `~/.restish/apis.json`. Once configured, you can use `-p` to reference the profile, for example `restish isp -p PROFILE_NAME list-channels`.
97+
7698
## Example Usage
7799

78100
Commands and help are generated on the fly from the server-provided OpenAPI document. Help commands let you see what is available and how to use it.
@@ -81,8 +103,8 @@ Commands and help are generated on the fly from the server-provided OpenAPI docu
81103
# Get a list of all available commands.
82104
$ restish isp --help
83105

84-
# See help for creating a channel.
85-
$ restish isp create-channel --help
106+
# See help for creating/updating a channel.
107+
$ restish isp put-channel --help
86108
```
87109

88110
### Getting Information
@@ -97,23 +119,74 @@ $ restish isp list-sources
97119
$ restish isp list-channels
98120
```
99121

122+
Lists of items like sources and channels are generally paginated. By default, Restish will make as many requests as needed to get all pages of data before returning. This behavior can be disabled to get a single page, for example:
123+
124+
```bash
125+
# Disable auto-pagination, and return up to 5 items from the first page.
126+
$ restish isp list-channels --rsh-no-paginate --page-size=5
127+
```
128+
100129
Restish is smart about which URIs require authentication by matching them to pre-configured API base URIs, so you can also directly access links you find in responses. For example, you might see something like this returned when listing channels and want to get additional details:
101130

102131
```bash
103132
# Get details from a channel by link.
104-
$ restish https://api.istreamplanet.com/v2/channels/ch-abc123
133+
$ restish https://api.istreamplanet.com/v2/channels/my-channel-id
105134
```
106135

136+
#### Filtering Data
137+
138+
Restish supports client-side [filtering & projection](https://rest.sh/#/output?id=filtering-amp-projection) of response data, making it easier to get just the information you need from the API. Filtering uses the `-f` shorthand function which accepts a JMESPath expression to run against an [object that looks like](https://rest.sh/#/output?id=response-structure):
139+
140+
```json
141+
{
142+
"proto": "HTTP/2.0",
143+
"status": 200,
144+
"headers": {
145+
"Header-Name": "header value"
146+
},
147+
"links": {
148+
"link-name": [
149+
{
150+
"rel": "link-name",
151+
"uri": "https://link.url/..."
152+
}
153+
]
154+
},
155+
"body": {
156+
// Body is here
157+
}
158+
}
159+
```
160+
161+
Some examples:
162+
163+
```bash
164+
# Get just the channel ID and name for all channels:
165+
$ restish isp list-channels -f 'body[].{id, name}'
166+
167+
# Get a raw list of channel IDs that start with "test":
168+
$ restish isp list-channels -f 'body[?starts_with(@.id, `"test"`)]'.id -r
169+
170+
# Get the ETag (content version) of a channel:
171+
$ restish isp get-channel my-channel -f `headers.Etag` -r
172+
173+
# Get all HD encodings for a channel:
174+
$ restish isp get-channel my-channel -f 'body.transcode.video_encoders[?height >= `720`].{id, width, height, bit_rate}'
175+
```
176+
177+
Note that enabling filtering will also enable JSON output mode.
178+
107179
### Writing Data
108180

109181
Write calls take input in one of two ways: JSON passed in via stdin or a custom [CLI shorthand syntax](https://rest.sh/#/shorthand) on the commandline.
110182

111183
```bash
112184
# Pass JSON via stdin.
113-
$ restish isp create-channel <input.json
185+
$ echo '{"name": "My Test Channel", "ingest": {"source": {"id": "s-abc123"}}}' >input.json
186+
$ restish isp put-channel my-channel-id <input.json
114187

115188
# Pass data on the commandline via shorthand.
116-
$ restish isp create-channel name: My Test Channel, source: s-abc123, ...
189+
$ restish isp put-channel my-channel-id name: My Test Channel, ingest.source.id: s-abc123, ...
117190
```
118191

119192
Read the [Restish documentation](https://rest.sh/) for more in-depth CLI info and check out our [Guide](/docs/guide/) and API reference for examples that show you how to use the iStreamPlanet APIs.

docs/guide/auditing.mdx

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
title: Auditing Channels
3+
---
4+
5+
import Tabs from "@theme/Tabs";
6+
import TabItem from "@theme/TabItem";
7+
8+
It is possible to audit all actions taken on a channel, even one that has been deleted.
9+
10+
<Tabs
11+
groupId="client"
12+
defaultValue="cli"
13+
values={[
14+
{ label: "CLI", value: "cli" },
15+
{ label: "Javascript", value: "js" },
16+
{ label: "Go", value: "go" },
17+
]}
18+
>
19+
<TabItem value="cli">
20+
21+
```bash
22+
# Get a channel timeline
23+
$ restish isp get-channel-timeline $CHANNEL_ID
24+
```
25+
26+
</TabItem>
27+
<TabItem value="js">
28+
29+
```js
30+
// TODO
31+
```
32+
33+
</TabItem>
34+
<TabItem value="go">
35+
36+
```go
37+
request := client.AuditOperationsApi.GetChannelTimeline(context.Background(), "CHANNEL_ID")
38+
entries, resp, err := request.Execute()
39+
40+
if err.Error() != "" {
41+
panic(err)
42+
}
43+
44+
// Print out each action name
45+
for _, entry := range entries {
46+
fmt.Println(entry.Action)
47+
}
48+
```
49+
50+
</TabItem>
51+
</Tabs>
52+
53+
Individual audit entries look something like these below:
54+
55+
```json
56+
{
57+
"action": "put-channel",
58+
"agent": "UNIQUE_USER_IDENTIFIER",
59+
"request_body": "{...data as JSON string...}",
60+
"status_code": 200,
61+
"timestamp": "2021-01-01T12:00:00Z",
62+
"trace_id": "484821178360672118"
63+
},
64+
{
65+
"action": "program-start",
66+
"agent": "UNIQUE_USER_IDENTIFIER",
67+
"request_body": "{\"event_id\":0}",
68+
"status_code": 204,
69+
"timestamp": "2021-01-01T12:00:00Z",
70+
"trace_id": "5179266826846428609",
71+
}
72+
```

0 commit comments

Comments
 (0)