fix: CLI client types mismatched server response format
- SessionResponse: use 'id' (int64) not 'session_id'/'client_id' - StateResponse: match actual server response shape - GetMembers: strip '#' from channel name for URL path - These bugs prevented the CLI from working correctly with the server
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -167,7 +168,9 @@ func (c *Client) ListChannels() ([]Channel, error) {
|
||||
|
||||
// GetMembers returns members of a channel.
|
||||
func (c *Client) GetMembers(channel string) ([]string, error) {
|
||||
data, err := c.do("GET", "/api/v1/channels/"+url.PathEscape(channel)+"/members", nil)
|
||||
// Server route is /channels/{channel}/members where channel is without '#'
|
||||
name := strings.TrimPrefix(channel, "#")
|
||||
data, err := c.do("GET", "/api/v1/channels/"+url.PathEscape(name)+"/members", nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user