func (s *Server) KillSession(sessionID, reason string) ([]byte, error) {
	return s.KillSessionWithContext(context.Background(), sessionID, reason)
}
KillSession kills a Plex session.
package plex
import (
	"context"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
)
type Sessions struct {
	Name     string     `json:"server"`
	HostID   string     `json:"hostId"`
	Sessions []*Session `json:"sessions"`
	Updated  structDur  `json:"updateTime,omitempty"`
}
var ErrBadStatus = fmt.Errorf("status code not 200")
func (s *Server) GetSessions() (*Sessions, error) {
	return s.GetSessionsWithContext(context.Background())
}
func (s *Server) GetSessionsWithContext(ctx context.Context) (*Sessions, error) {
	if !s.Configured() {
		return nil, ErrNoURLToken
	}
	var (
		v struct {
			MediaContainer struct {
				Sessions []*Session `json:"Metadata"`
			} `json:"MediaContainer"`
		}
		sessions = &Sessions{Name: s.Name}
	)
	ctx, cancel := context.WithTimeout(ctx, s.Timeout.Duration)
	defer cancel()
	body, err := s.getPlexURL(ctx, s.URL+"/status/sessions", nil)
	if err != nil {
		return sessions, fmt.Errorf("%w: %s", err, string(body))
	}
	if err = json.Unmarshal(body, &v); err != nil {
		return sessions, fmt.Errorf("parsing plex sessions (TRY UPGRADING PLEX): %w: %s", err, string(body))
	}
	sessions.Sessions = v.MediaContainer.Sessions
	return sessions, nil
}
func (s *Server) KillSessionWithContext(ctx context.Context, sessionID, reason string) ([]byte, error) {
	if !s.Configured() {
		return nil, ErrNoURLToken
	}
	ctx, cancel := context.WithTimeout(ctx, s.Timeout.Duration)
	defer cancel()
	req, err := http.NewRequestWithContext(ctx, http.MethodGet, s.URL+"/status/sessions/terminate", nil)
	if err != nil {
		return nil, fmt.Errorf("creating http request: %w", err)
	}
	req.Header.Set("X-Plex-Token", s.Token)
	q := req.URL.Query()
	q.Add("sessionId", sessionID)
	q.Add("reason", reason)
	req.URL.RawQuery = q.Encode()
	resp, err := s.getClient().Do(req)
	if err != nil {
		return nil, fmt.Errorf("making http request: %w", err)
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return body, fmt.Errorf("reading http response: %w", err)
	}
	if resp.StatusCode != http.StatusOK {
		return body, ErrBadStatus
	}
	return body, nil
}