Skip to content

Commit 7d70557

Browse files
authored
Merge pull request #120 from gtardif/docs_update
Update docs generated from API
2 parents 2895bb2 + 863e987 commit 7d70557

File tree

11 files changed

+141
-43
lines changed

11 files changed

+141
-43
lines changed

docs/dev/api/reference/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- [Docker](interfaces/Docker.md)
1717
- [DockerCommand](interfaces/DockerCommand.md)
1818
- [Exec](interfaces/Exec.md)
19+
- [ExecStreamOptions](interfaces/ExecStreamOptions.md)
1920
- [ExecResult](interfaces/ExecResult.md)
2021
- [RawExecResult](interfaces/RawExecResult.md)
2122
- [Extension](interfaces/Extension.md)

docs/dev/api/reference/interfaces/Docker.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
You can also directly execute the docker binary.
2121

2222
```typescript
23-
const output = await window.ddClient.docker.cli.exec(
23+
const output = await ddClient.docker.cli.exec(
2424
"info",
2525
["--format", '"{{ json . }}"']
2626
);
@@ -41,11 +41,9 @@ Streams the output as a result of the execution of a docker command.
4141
Useful when the output of the command is too long or you need to get the output as a stream.
4242

4343
```typescript linenums="1"
44-
await window.ddClient.docker.cli.exec("logs", ["-f", "..."], {
44+
await ddClient.docker.cli.exec("logs", ["-f", "..."], {
4545
stream: {
46-
onOutput(
47-
data: { stdout: string } | { stderr: string }
48-
): void {
46+
onOutput(data): void {
4947
// As we can receive both `stdout` and `stderr`, we wrap them in a JSON object
5048
JSON.stringify(
5149
{
@@ -78,7 +76,7 @@ By default this will not list stopped containers.
7876
You can use the option `{"all": true}` to list all the running and stopped containers.
7977

8078
```typescript
81-
const containers = await window.ddClient.docker.listContainers();
79+
const containers = await ddClient.docker.listContainers();
8280
```
8381

8482
#### Parameters
@@ -100,7 +98,7 @@ ___
10098
Get the list of local container images
10199

102100
```typescript
103-
const images = await window.ddClient.docker.listImages();
101+
const images = await ddClient.docker.listImages();
104102
```
105103

106104
#### Parameters

docs/dev/api/reference/interfaces/DockerDesktopClient.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ ___
7171

7272
`Readonly` **extension**: [`Extension`](Extension.md)
7373

74-
The `window.ddClient.extension` object can be used to communicate with the backend defined in the vm section in the extensions metadata.
74+
The `ddClient.extension` object can be used to communicate with the backend defined in the vm section in the extensions metadata.
7575
The client is already connected to the backend.
7676

7777
#### Inherited from

docs/dev/api/reference/interfaces/Exec.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ Specify the `stream` if the output of your command is too long or if you need to
3636
| `cmd` | `string` | The command to execute. |
3737
| `args` | `string`[] | The arguments of the command to execute. |
3838
| `options` | `Object` | The list of options. |
39-
| `options.stream` | `Object` | Provides three functions: `onOutput` (invoked every time `stdout` or `stderr` is received), `onError` and `onClose` (invoked when the stream has ended). |
40-
| `options.stream.onOutput?` | (`data`: { `stdout`: `string` } \| { `stderr`: `string` }) => `void` | - |
41-
| `options.stream.onError?` | (`error`: `any`) => `void` | - |
42-
| `options.stream.onClose?` | (`exitCode`: `number`) => `void` | - |
39+
| `options.stream` | [`ExecStreamOptions`](ExecStreamOptions.md) | Provides three functions: `onOutput` (invoked every time `stdout` or `stderr` is received), `onError` and `onClose` (invoked when the stream has ended). |
4340

4441
#### Returns
4542

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Interface: ExecStreamOptions
2+
3+
## Table of contents
4+
5+
### Methods
6+
7+
- [onOutput](ExecStreamOptions.md#onoutput)
8+
- [onError](ExecStreamOptions.md#onerror)
9+
- [onClose](ExecStreamOptions.md#onclose)
10+
11+
### Properties
12+
13+
- [splitOutputLines](ExecStreamOptions.md#splitoutputlines)
14+
15+
## Methods
16+
17+
### onOutput
18+
19+
`Optional` **onOutput**(`data`): `void`
20+
21+
Invoked when receiving output from command execution.
22+
By default this is raw output, can be split at any position. If `splitOutputLines` is set to true, this method will be invoked once for each output line.
23+
24+
#### Parameters
25+
26+
| Name | Type | Description |
27+
| :------ | :------ | :------ |
28+
| `data` | { `stdout`: `string` ; `stderr?`: `undefined` } \| { `stdout?`: `undefined` ; `stderr`: `string` } | output content. Can include either stdout string, or stderr string, one at a time. |
29+
30+
#### Returns
31+
32+
`void`
33+
34+
___
35+
36+
### onError
37+
38+
`Optional` **onError**(`error`): `void`
39+
40+
Invoked to report error if the executed command errors.
41+
42+
#### Parameters
43+
44+
| Name | Type | Description |
45+
| :------ | :------ | :------ |
46+
| `error` | `any` | the error happening in the executed command |
47+
48+
#### Returns
49+
50+
`void`
51+
52+
___
53+
54+
### onClose
55+
56+
`Optional` **onClose**(`exitCode`): `void`
57+
58+
Invoked when process exits.
59+
60+
#### Parameters
61+
62+
| Name | Type | Description |
63+
| :------ | :------ | :------ |
64+
| `exitCode` | `number` | the process exit code |
65+
66+
#### Returns
67+
68+
`void`
69+
70+
## Properties
71+
72+
### splitOutputLines
73+
74+
`Optional` `Readonly` **splitOutputLines**: `boolean`
75+
76+
Specifies the behaviour invoking `onOutput(data)`. Raw output by default, splitting output at any position. If set to true, `onOutput` will be invoked once for each line.

docs/dev/api/reference/interfaces/ExtensionHost.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Executes a command in the the host.
1717
Example: Execute the shipped binary `kubectl -h` command in the **host**:
1818

1919
```typescript
20-
await window.ddClient.extension.host.cli.exec(
20+
await ddClient.extension.host.cli.exec(
2121
"kubectl",
2222
["-h"]
2323
);
@@ -30,11 +30,9 @@ Streams the output of the command executed in the backend container or in the ho
3030
Example: Provided the `kubectl` binary is shipped as part of your extension, you can spawn the `kubectl -h` command in the **host**:
3131

3232
```typescript linenums="1"
33-
await window.ddClient.extension.host.cli.exec("kubectl", ["-h"], {
33+
await ddClient.extension.host.cli.exec("kubectl", ["-h"], {
3434
stream: {
35-
onOutput(
36-
data: { stdout: string } | { stderr: string }
37-
): void {
35+
onOutput(data): void {
3836
// As we can receive both `stdout` and `stderr`, we wrap them in a JSON object
3937
JSON.stringify(
4038
{

docs/dev/api/reference/interfaces/ExtensionVM.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Executes a command in the backend container.
1818
Example: Execute the command `ls -l` inside the **backend container**:
1919

2020
```typescript
21-
await window.ddClient.extension.vm.cli.exec(
21+
await ddClient.extension.vm.cli.exec(
2222
"ls",
2323
["-l"]
2424
);
@@ -29,11 +29,9 @@ Streams the output of the command executed in the backend container.
2929
Example: Spawn the command `ls -l` inside the **backend container**:
3030

3131
```typescript linenums="1"
32-
await window.ddClient.extension.vm.cli.exec("ls", ["-l"], {
32+
await ddClient.extension.vm.cli.exec("ls", ["-l"], {
3333
stream: {
34-
onOutput(
35-
data: { stdout: string } | { stderr: string }
36-
): void {
34+
onOutput(data): void {
3735
// As we can receive both `stdout` and `stderr`, we wrap them in a JSON object
3836
JSON.stringify(
3937
{

docs/dev/api/reference/interfaces/Host.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66

77
- [openExternal](Host.md#openexternal)
88

9+
### Properties
10+
11+
- [platform](Host.md#platform)
12+
- [arch](Host.md#arch)
13+
- [hostname](Host.md#hostname)
14+
915
## Methods
1016

1117
### openExternal
@@ -15,7 +21,7 @@
1521
Opens an external URL with the system default browser.
1622

1723
```typescript
18-
window.ddClient.host.openExternal("https://docker.com");
24+
ddClient.host.openExternal("https://docker.com");
1925
```
2026

2127
#### Parameters
@@ -27,3 +33,27 @@ window.ddClient.host.openExternal("https://docker.com");
2733
#### Returns
2834

2935
`void`
36+
37+
## Properties
38+
39+
### platform
40+
41+
**platform**: `string`
42+
43+
Returns a string identifying the operating system platform. See https://nodejs.org/api/os.html#osplatform
44+
45+
___
46+
47+
### arch
48+
49+
**arch**: `string`
50+
51+
Returns the operating system CPU architecture. See https://nodejs.org/api/os.html#osarch
52+
53+
___
54+
55+
### hostname
56+
57+
**hostname**: `string`
58+
59+
Returns the host name of the operating system. See https://nodejs.org/api/os.html#oshostname

docs/dev/api/reference/interfaces/HttpService.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
Performs an HTTP GET request to a backend service.
2222

2323
```typescript
24-
window.ddClient.extension.vm.service
24+
ddClient.extension.vm.service
2525
.get("/some/service")
2626
.then((value: any) => console.log(value)
2727
```
@@ -45,7 +45,7 @@ ___
4545
Performs an HTTP POST request to a backend service.
4646
4747
```typescript
48-
window.ddClient.extension.vm.service
48+
ddClient.extension.vm.service
4949
.post("/some/service", { ... })
5050
.then((value: any) => console.log(value));
5151
```
@@ -70,7 +70,7 @@ ___
7070
Performs an HTTP PUT request to a backend service.
7171
7272
```typescript
73-
window.ddClient.extension.vm.service
73+
ddClient.extension.vm.service
7474
.put("/some/service", { ... })
7575
.then((value: any) => console.log(value));
7676
```
@@ -95,7 +95,7 @@ ___
9595
Performs an HTTP PATCH request to a backend service.
9696
9797
```typescript
98-
window.ddClient.extension.vm.service
98+
ddClient.extension.vm.service
9999
.patch("/some/service", { ... })
100100
.then((value: any) => console.log(value));
101101
```
@@ -120,7 +120,7 @@ ___
120120
Performs an HTTP DELETE request to a backend service.
121121
122122
```typescript
123-
window.ddClient.extension.vm.service
123+
ddClient.extension.vm.service
124124
.delete("/some/service")
125125
.then((value: any) => console.log(value));
126126
```
@@ -144,7 +144,7 @@ ___
144144
Performs an HTTP HEAD request to a backend service.
145145
146146
```typescript
147-
window.ddClient.extension.vm.service
147+
ddClient.extension.vm.service
148148
.head("/some/service")
149149
.then((value: any) => console.log(value));
150150
```
@@ -168,7 +168,7 @@ ___
168168
Performs an HTTP request to a backend service.
169169
170170
```typescript
171-
window.ddClient.extension.vm.service
171+
ddClient.extension.vm.service
172172
.request({ url: "/url", method: "GET", headers: { 'header-key': 'header-value' }, data: { ... }})
173173
.then((value: any) => console.log(value));
174174
```

docs/dev/api/reference/interfaces/NavigationIntents.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
Navigate to the containers window in the Dashboard.
3434

3535
```typescript
36-
window.ddClient.desktopUI.navigation.viewContainers()
36+
ddClient.desktopUI.navigation.viewContainers()
3737
```
3838

3939
#### Returns
@@ -49,7 +49,7 @@ ___
4949
Navigate to the container window in the Dashboard.
5050

5151
```typescript
52-
await window.ddClient.desktopUI.navigation.viewContainer(id)
52+
await ddClient.desktopUI.navigation.viewContainer(id)
5353
```
5454

5555
#### Parameters
@@ -73,7 +73,7 @@ ___
7373
Navigate to the container logs window in the Dashboard.
7474

7575
```typescript
76-
await window.ddClient.desktopUI.navigation.viewContainerLogs(id)
76+
await ddClient.desktopUI.navigation.viewContainerLogs(id)
7777
```
7878

7979
#### Parameters
@@ -97,7 +97,7 @@ ___
9797
Navigate to the container inspect window in the Dashboard.
9898

9999
```typescript
100-
await window.ddClient.desktopUI.navigation.viewContainerInspect(id)
100+
await ddClient.desktopUI.navigation.viewContainerInspect(id)
101101
```
102102

103103
#### Parameters
@@ -121,7 +121,7 @@ ___
121121
Navigate to the container stats to see the CPU, memory, disk read/write and network I/O usage.
122122

123123
```typescript
124-
await window.ddClient.desktopUI.navigation.viewContainerStats(id)
124+
await ddClient.desktopUI.navigation.viewContainerStats(id)
125125
```
126126

127127
#### Parameters
@@ -147,7 +147,7 @@ ___
147147
Navigate to the images window in the Dashboard.
148148

149149
```typescript
150-
await window.ddClient.desktopUI.navigation.viewImages()
150+
await ddClient.desktopUI.navigation.viewImages()
151151
```
152152

153153
#### Returns
@@ -164,7 +164,7 @@ Navigate to a specific image referenced by `id` and `tag` in the Dashboard.
164164
In this navigation route you can find the image layers, commands, created time and size.
165165

166166
```typescript
167-
await window.ddClient.desktopUI.navigation.viewImage(id, tag)
167+
await ddClient.desktopUI.navigation.viewImage(id, tag)
168168
```
169169

170170
#### Parameters
@@ -191,7 +191,7 @@ ___
191191
Navigate to the Dev Environments window in the Dashboard.
192192

193193
```typescript
194-
window.ddClient.desktopUI.navigation.viewDevEnvironments()
194+
ddClient.desktopUI.navigation.viewDevEnvironments()
195195
```
196196

197197
#### Returns
@@ -209,7 +209,7 @@ ___
209209
Navigate to the volumes window in the Dashboard.
210210

211211
```typescript
212-
window.ddClient.desktopUI.navigation.viewVolumes()
212+
ddClient.desktopUI.navigation.viewVolumes()
213213
```
214214

215215
#### Returns
@@ -225,7 +225,7 @@ ___
225225
Navigate to a specific volume in the Dashboard.
226226

227227
```typescript
228-
await window.ddClient.desktopUI.navigation.viewVolume(volume)
228+
await ddClient.desktopUI.navigation.viewVolume(volume)
229229
```
230230

231231
#### Parameters

0 commit comments

Comments
 (0)