Skip to content

Commit e699c5a

Browse files
make endpoint name consistent (#223)
1 parent 0532dd1 commit e699c5a

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,17 @@ $ go-chromecast --with-ui load /path/to/file.flac
259259
There is a HTTP API server provided that has the following api:
260260

261261
```
262-
GET /devices?interface=<network_interface>&wait=<seconds>
263-
POST /connect?uuid=<device_uuid>&addr=<device_addr>&port=<device_port>&interface=<network_interface>&wait=<seconds>
264-
POST /disconnect?uuid=<device_uuid>&stop=<bool>
265-
POST /disconnect-all?stop=<bool>
266-
POST /status?uuid=<device_uuid>
262+
GET /devices?wait=...&iface=...
263+
POST /connect?uuid=<device_uuid>&addr=<device_addr>&port=<device_port>
264+
POST /connect-all?wait=...&iface=...
265+
POST /disconnect?uuid=<device_uuid>
266+
POST /disconnect-all
267+
GET /status?uuid=<device_uuid>
268+
GET /statuses (Deprecated use status-all)
269+
GET /status-all
267270
POST /pause?uuid=<device_uuid>
268271
POST /unpause?uuid=<device_uuid>
272+
POST /skipad?uuid=<device_uuid>
269273
POST /mute?uuid=<device_uuid>
270274
POST /unmute?uuid=<device_uuid>
271275
POST /stop?uuid=<device_uuid>
@@ -274,7 +278,7 @@ POST /volume?uuid=<device_uuid>&volume=<float>
274278
POST /rewind?uuid=<device_uuid>&seconds=<int>
275279
POST /seek?uuid=<device_uuid>&seconds=<int>
276280
POST /seek-to?uuid=<device_uuid>&seconds=<float>
277-
POST /load?uuid=<device_uuid>&path=<filepath_or_url>&content_type=<string>
281+
POST /load?uuid=<device_uuid>&path=<filepath_or_url>&content_type=<string>&start_time=<int>
278282
```
279283

280284
```

http/handlers.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ import (
44
"context"
55
"encoding/json"
66
"fmt"
7-
"golang.org/x/sync/errgroup"
87
"net"
98
"net/http"
109
"strconv"
1110
"strings"
1211
"sync"
1312
"time"
1413

14+
"golang.org/x/sync/errgroup"
15+
1516
log "github.com/sirupsen/logrus"
1617
"github.com/vishen/go-chromecast/application"
1718
"github.com/vishen/go-chromecast/dns"
@@ -108,7 +109,8 @@ func (h *Handler) registerHandlers() {
108109
POST /disconnect?uuid=<device_uuid>
109110
POST /disconnect-all
110111
GET /status?uuid=<device_uuid>
111-
GET /statuses
112+
GET /statuses (Deprecated use status-all)
113+
GET /status-all
112114
POST /pause?uuid=<device_uuid>
113115
POST /unpause?uuid=<device_uuid>
114116
POST /skipad?uuid=<device_uuid>
@@ -129,6 +131,7 @@ func (h *Handler) registerHandlers() {
129131
h.mux.HandleFunc("/disconnect", h.disconnect)
130132
h.mux.HandleFunc("/disconnect-all", h.disconnectAll)
131133
h.mux.HandleFunc("/status", h.status)
134+
h.mux.HandleFunc("/status-all", h.statusAll)
132135
h.mux.HandleFunc("/statuses", h.statuses)
133136
h.mux.HandleFunc("/pause", h.pause)
134137
h.mux.HandleFunc("/unpause", h.unpause)
@@ -463,7 +466,17 @@ func (h *Handler) UpdateAll() error {
463466
return g.Wait()
464467
}
465468

469+
// Deprecated: Use statusAll instead
466470
func (h *Handler) statuses(w http.ResponseWriter, r *http.Request) {
471+
dep_message := "/statuses is deprecated, use /status-all instead"
472+
log.Warn(dep_message)
473+
474+
w.Header().Add("Deprecated", dep_message)
475+
476+
h.statusAll(w, r)
477+
}
478+
479+
func (h *Handler) statusAll(w http.ResponseWriter, r *http.Request) {
467480
h.log("statuses for devices")
468481
syncUpdate := r.URL.Query().Get("syncUpdate") == "true"
469482
uuids := h.ConnectedDeviceUUIDs()

0 commit comments

Comments
 (0)