|
| 1 | +package design |
| 2 | + |
| 3 | +import . "goa.design/goa/dsl" |
| 4 | + |
| 5 | +var _ = Service("indexes", func() { |
| 6 | + Description("The indexes service manages the package_index files") |
| 7 | + |
| 8 | + Method("list", func() { |
| 9 | + Result(ArrayOf(String)) |
| 10 | + HTTP(func() { |
| 11 | + GET("/pkgs/indexes") |
| 12 | + Response(StatusOK) |
| 13 | + }) |
| 14 | + }) |
| 15 | + |
| 16 | + Method("add", func() { |
| 17 | + HTTP(func() { |
| 18 | + PUT("/pkgs/indexes/:id") |
| 19 | + Response(StatusOK) |
| 20 | + }) |
| 21 | + }) |
| 22 | + |
| 23 | + Method("remove", func() { |
| 24 | + HTTP(func() { |
| 25 | + DELETE("/pkgs/indexes/:id") |
| 26 | + Response(StatusOK) |
| 27 | + }) |
| 28 | + }) |
| 29 | +}) |
| 30 | + |
| 31 | +var _ = Service("tools", func() { |
| 32 | + Description("The tools service manages the available and installed tools") |
| 33 | + |
| 34 | + Method("available", func() { |
| 35 | + Result(CollectionOf(Tool)) |
| 36 | + HTTP(func() { |
| 37 | + GET("/pkgs/tools/available") |
| 38 | + Response(StatusOK) |
| 39 | + }) |
| 40 | + }) |
| 41 | + |
| 42 | + Method("installed", func() { |
| 43 | + Result(CollectionOf(Tool)) |
| 44 | + HTTP(func() { |
| 45 | + GET("/pkgs/tools/installed") |
| 46 | + Response(StatusOK) |
| 47 | + }) |
| 48 | + }) |
| 49 | + |
| 50 | + Method("install", func() { |
| 51 | + Payload(ToolPayload) |
| 52 | + HTTP(func() { |
| 53 | + PUT("/pkgs/tools/installed") |
| 54 | + Response(StatusOK) |
| 55 | + }) |
| 56 | + }) |
| 57 | + |
| 58 | + Method("remove", func() { |
| 59 | + HTTP(func() { |
| 60 | + DELETE("/pkgs/tools/installed/:id") |
| 61 | + Response(StatusOK) |
| 62 | + }) |
| 63 | + }) |
| 64 | +}) |
| 65 | + |
| 66 | +var ToolPayload = Type("arduino.tool", func() { |
| 67 | + Description("A tool is an executable program that can upload sketches.") |
| 68 | + TypeName("ToolPayload") |
| 69 | + |
| 70 | + Attribute("name", String, "The name of the tool", func() { |
| 71 | + Example("avrdude") |
| 72 | + }) |
| 73 | + Attribute("version", String, "The version of the tool", func() { |
| 74 | + Example("6.3.0-arduino9") |
| 75 | + }) |
| 76 | + Attribute("packager", String, "The packager of the tool", func() { |
| 77 | + Example("arduino") |
| 78 | + }) |
| 79 | + |
| 80 | + Required("name", "version", "packager") |
| 81 | +}) |
| 82 | + |
| 83 | +var Tool = ResultType("application/vnd.arduino.tool", func() { |
| 84 | + Description("A tool is an executable program that can upload sketches.") |
| 85 | + TypeName("Tool") |
| 86 | + Reference(ToolPayload) |
| 87 | + |
| 88 | + Attribute("name") |
| 89 | + Attribute("version") |
| 90 | + Attribute("packager") |
| 91 | + |
| 92 | + Required("name", "version", "packager") |
| 93 | +}) |
0 commit comments