Skip to content

Commit 8f72e27

Browse files
committed
Add docs for indexes.add
1 parent 6f3fc8b commit 8f72e27

File tree

14 files changed

+265
-102
lines changed

14 files changed

+265
-102
lines changed

design/pkgs.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ var _ = Service("indexes", func() {
2121
Method("add", func() {
2222
Payload(IndexPayload)
2323
HTTP(func() {
24-
PUT("/pkgs/indexes/{url}")
24+
POST("/pkgs/indexes/add")
2525
Response(StatusOK)
2626
})
2727
})
2828

2929
Method("remove", func() {
3030
Payload(IndexPayload)
3131
HTTP(func() {
32-
DELETE("/pkgs/indexes/{url}")
32+
POST("/pkgs/indexes/delete")
3333
Response(StatusOK)
3434
})
3535
})

docs/pkgs.html

+19-4
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,32 @@
88
<body>
99
<p>pkgs api manage the indexes and tools installed on the system.</p>
1010

11+
<h1>Indexes</h1>
1112
<p>An index file contains the info about a core and its tools. You can see an example at <a href="" target="_blank">https://downloads.arduino.cc/packages/package_index.json</a></p>
1213

1314
<p>index files are saved (with an urlencoded filename) in the folder <code>~/.arduino-create/indexes</code></p>
1415

15-
<textarea cols="100" id="indexesGet">
16+
<h2>List Indexes</h2>
17+
<p>You can list the indexes installed in the system with this simple GET</p>
18+
<textarea cols="100" id="indexesList">
1619
fetch('http://localhost:8991/v2/pkgs/indexes')
1720
</textarea><br>
18-
<textarea cols="100" rows="10" id="indexesGetRes">
21+
<textarea cols="100" rows="10" id="indexesListRes"></textarea><br>
22+
<button onclick="tryCode('indexesList', 'indexesListRes');">Try</button>
23+
24+
<h2>Add Indexes</h2>
25+
<p>You can add a new index with a POST request</p>
26+
<textarea cols="100" rows="5" id="indexesCreate">
27+
fetch('http://localhost:8991/v2/pkgs/indexes/add', {
28+
method: "POST",
29+
body: '{"url": "https://downloads.arduino.cc/packages/package_index.json"}'
30+
})
31+
</textarea><br>
32+
<textarea cols="100" rows="10" id="indexesCreateRes">
1933

2034
</textarea><br>
21-
<button onclick="tryCode('indexesGet', 'indexesGetRes');">Try</button>
35+
<button onclick="tryCode('indexesCreate', 'indexesCreateRes');">Try</button>
36+
2237
</body>
2338

2439
<script>
@@ -38,7 +53,7 @@
3853

3954
console.log(err)
4055

41-
target.innerText = JSON.stringify(err);
56+
target.innerText = err;
4257
})
4358

4459
console.debug(code, target, result)

gen/http/cli/arduino_create_agent/cli.go

+16-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gen/http/indexes/client/cli.go

+29-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gen/http/indexes/client/client.go

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gen/http/indexes/client/encode_decode.go

+36-24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gen/http/indexes/client/paths.go

+4-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gen/http/indexes/client/types.go

+33
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)