Skip to content

Commit 004094e

Browse files
committed
fix: Resolve #55 - Get the name of the board
1 parent 5a33829 commit 004094e

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

internal/api/api.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,19 @@ func NewHTTPRouter(
101101

102102
return mux
103103
}
104+
105+
106+
func GetBoardNameHandler() http.HandlerFunc {
107+
return func(w http.ResponseWriter, r *http.Request) {
108+
w.Header().Set("Content-Type", "application/json")
109+
// micro.GetBoardName() will be defined in internal/micro/micro.go as per plan
110+
name := micro.GetBoardName()
111+
response := map[string]string{"name": name}
112+
if err := json.NewEncoder(w).Encode(response); err != nil {
113+
http.Error(w, "Failed to encode response: "+err.Error(), http.StatusInternalServerError)
114+
return
115+
}
116+
}
117+
}
118+
119+
mux.Handle("GET /v1/system/name", GetBoardNameHandler())

internal/api/docs/openapi.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,3 +1669,24 @@ components:
16691669
version:
16701670
type: string
16711671
type: object
1672+
1673+
1674+
/v1/system/name:
1675+
get:
1676+
description: Returns the name of the board.
1677+
operationId: getBoardName
1678+
responses:
1679+
"200":
1680+
content:
1681+
application/json:
1682+
schema:
1683+
properties:
1684+
name:
1685+
type: string
1686+
type: object
1687+
description: Successful response
1688+
"500":
1689+
$ref: '#/components/responses/InternalServerError'
1690+
summary: Get the board's name
1691+
tags:
1692+
- System

0 commit comments

Comments
 (0)