Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions cmd/lk/analytics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ func participantsAPI(t *testing.T, status int, body string) (*public.Client, *ur
t.Helper()
var query url.Values
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/v1/projects/p1/sessions/RM_1/participants" || r.Header.Get("Authorization") != "Bearer sekret" {
if r.URL.Path != "/v0/projects/p1/sessions/RM_1/participants" || r.Header.Get("Authorization") != "Bearer sekret" {
http.NotFound(w, r)
return
}
Expand Down Expand Up @@ -611,7 +611,7 @@ func recordingServers(t *testing.T, audio []byte, chatHistory string) (api *publ
t.Cleanup(store.Close)

apiSrv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/v1/projects/p1/sessions/RM_1/recording-url" || r.Header.Get("Authorization") != "Bearer sekret" {
if r.URL.Path != "/v0/projects/p1/sessions/RM_1/recording-url" || r.Header.Get("Authorization") != "Bearer sekret" {
http.NotFound(w, r)
return
}
Expand Down Expand Up @@ -931,10 +931,10 @@ func transcriptAPI(t *testing.T, transcriptStatus int, transcript, session strin
}
w.Header().Set("Content-Type", "application/json")
switch r.URL.Path {
case "/v1/projects/p1/sessions/RM_1/transcript":
case "/v0/projects/p1/sessions/RM_1/transcript":
w.WriteHeader(transcriptStatus)
_, _ = w.Write([]byte(transcript))
case "/v1/projects/p1/sessions/RM_1":
case "/v0/projects/p1/sessions/RM_1":
_, _ = fmt.Fprintf(w, `{"session":%s}`, session)
default:
http.NotFound(w, r)
Expand Down Expand Up @@ -970,21 +970,21 @@ func TestFetchSessionTranscript(t *testing.T) {
body: page,
wantOut: []string{"USER hi (end_of_turn 320ms)", "AGENT hello (e2e 820ms)"},
wantStatus: []string{"More items available — re-run with --cursor c2"},
wantPaths: []string{"/v1/projects/p1/sessions/RM_1/transcript"},
wantPaths: []string{"/v0/projects/p1/sessions/RM_1/transcript"},
},
{
name: "active session",
body: `{"items":[]}`,
session: `{"sessionId":"RM_1","status":"SESSION_STATUS_ACTIVE"}`,
wantStatus: []string{"Session RM_1 is still active", "appears after it ends"},
wantPaths: []string{"/v1/projects/p1/sessions/RM_1/transcript", "/v1/projects/p1/sessions/RM_1"},
wantPaths: []string{"/v0/projects/p1/sessions/RM_1/transcript", "/v0/projects/p1/sessions/RM_1"},
},
{
name: "closed session",
body: `{}`,
session: `{"sessionId":"RM_1","status":"SESSION_STATUS_CLOSED"}`,
wantStatus: []string{"Session RM_1 has no transcript to read", "a minute or two after the session ends"},
wantPaths: []string{"/v1/projects/p1/sessions/RM_1/transcript", "/v1/projects/p1/sessions/RM_1"},
wantPaths: []string{"/v0/projects/p1/sessions/RM_1/transcript", "/v0/projects/p1/sessions/RM_1"},
},
{
// A session that stopped reporting stays ACTIVE but has an end time.
Expand All @@ -993,22 +993,22 @@ func TestFetchSessionTranscript(t *testing.T) {
session: `{"sessionId":"RM_1","status":"SESSION_STATUS_ACTIVE","endedAt":"2026-10-07T11:05:00Z"}`,
wantStatus: []string{"Session RM_1 has no transcript to read"},
noStatus: []string{"still active"},
wantPaths: []string{"/v1/projects/p1/sessions/RM_1/transcript", "/v1/projects/p1/sessions/RM_1"},
wantPaths: []string{"/v0/projects/p1/sessions/RM_1/transcript", "/v0/projects/p1/sessions/RM_1"},
},
{
name: "last page",
body: `{"items":[]}`,
opts: public.PageOptions{Cursor: "c2"},
wantStatus: []string{"No more transcript items"},
wantPaths: []string{"/v1/projects/p1/sessions/RM_1/transcript"},
wantPaths: []string{"/v0/projects/p1/sessions/RM_1/transcript"},
},
{
name: "no items, more to read",
body: `{"items":[],"skippedRecords":2,"pageInfo":{"nextCursor":"c2","hasMore":true}}`,
session: `{"sessionId":"RM_1","status":"SESSION_STATUS_ACTIVE"}`,
wantStatus: []string{"2 records couldn't be read", "More items available — re-run with --cursor c2"},
noStatus: []string{"still active", "no transcript"},
wantPaths: []string{"/v1/projects/p1/sessions/RM_1/transcript"},
wantPaths: []string{"/v0/projects/p1/sessions/RM_1/transcript"},
},
}
for _, tt := range tests {
Expand Down Expand Up @@ -1181,7 +1181,7 @@ func logsAPI(t *testing.T, status int, body string) (*public.Client, *url.Values
t.Helper()
var query url.Values
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Header.Get("Authorization") != "Bearer sekret" || r.URL.Path != "/v1/projects/p1/sessions/RM_1/logs" {
if r.Header.Get("Authorization") != "Bearer sekret" || r.URL.Path != "/v0/projects/p1/sessions/RM_1/logs" {
http.NotFound(w, r)
return
}
Expand Down Expand Up @@ -1403,7 +1403,7 @@ func tracesAPI(t *testing.T, status int, pages map[string]string) (*public.Clien
t.Helper()
var queries []url.Values
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Header.Get("Authorization") != "Bearer sekret" || r.URL.Path != "/v1/projects/p1/sessions/RM_1/traces" {
if r.Header.Get("Authorization") != "Bearer sekret" || r.URL.Path != "/v0/projects/p1/sessions/RM_1/traces" {
http.NotFound(w, r)
return
}
Expand Down Expand Up @@ -1670,7 +1670,7 @@ func metricsAPI(t *testing.T, status int, body string) (*public.Client, *url.Val
t.Helper()
var query url.Values
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Header.Get("Authorization") != "Bearer sekret" || r.URL.Path != "/v1/projects/p1/sessions/RM_1/metrics" {
if r.Header.Get("Authorization") != "Bearer sekret" || r.URL.Path != "/v0/projects/p1/sessions/RM_1/metrics" {
http.NotFound(w, r)
return
}
Expand Down Expand Up @@ -1907,7 +1907,7 @@ func eventsAPI(t *testing.T, status int, body string) (*public.Client, *url.Valu
t.Helper()
var query url.Values
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Header.Get("Authorization") != "Bearer sekret" || r.URL.Path != "/v1/projects/p1/sessions/RM_1/events" {
if r.Header.Get("Authorization") != "Bearer sekret" || r.URL.Path != "/v0/projects/p1/sessions/RM_1/events" {
http.NotFound(w, r)
return
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/public/analytics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func TestListProjectSessionsQuery(t *testing.T) {
sessions, next, err := c.ListProjectSessions(context.Background(), "p1", tt.opts)
require.NoError(t, err)

assert.Equal(t, "/v1/projects/p1/sessions", gotPath)
assert.Equal(t, "/v0/projects/p1/sessions", gotPath)
assert.Equal(t, tt.want, gotQuery)
require.Len(t, sessions, 1)
assert.Equal(t, "RM_1", *sessions[0].SessionId)
Expand Down Expand Up @@ -158,7 +158,7 @@ func TestGetSessionReturnsDetail(t *testing.T) {
require.NoError(t, err)

assert.Equal(t, "Bearer sekret", gotAuth)
assert.Equal(t, "/v1/projects/p1/sessions/RM_1", gotPath)
assert.Equal(t, "/v0/projects/p1/sessions/RM_1", gotPath)
assert.Equal(t, "RM_1", *session.SessionId)
if !tt.wantDetail {
assert.Nil(t, detail)
Expand Down Expand Up @@ -216,7 +216,7 @@ func TestListSessionParticipantsQuery(t *testing.T) {
require.NoError(t, err)

assert.Equal(t, "Bearer sekret", gotAuth)
assert.Equal(t, "/v1/projects/p1/sessions/RM_1/participants", gotPath)
assert.Equal(t, "/v0/projects/p1/sessions/RM_1/participants", gotPath)
assert.Equal(t, tt.want, gotQuery)
require.Len(t, participants, 1)
assert.Equal(t, "alice", *participants[0].ParticipantIdentity)
Expand Down Expand Up @@ -324,7 +324,7 @@ func TestListSessionEvents(t *testing.T) {
require.NoError(t, err)

assert.Equal(t, "Bearer sekret", gotAuth)
assert.Equal(t, "/v1/projects/p1/sessions/RM_1/events", gotPath)
assert.Equal(t, "/v0/projects/p1/sessions/RM_1/events", gotPath)
assert.Equal(t, tt.want, gotQuery)

assert.Equal(t, "next", page.NextCursor)
Expand Down
2 changes: 1 addition & 1 deletion pkg/public/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (

// DefaultBaseURL is the base URL of the LiveKit Public API. Override it (e.g. to
// http://localhost:8000) for local development. The generated operation paths
// already include the /v1 prefix, so this is the host root.
// already include the /v0 prefix, so this is the host root.
const DefaultBaseURL = "https://beta-api.livekit.cloud"

// Client is the CLI's user-authenticated Public API client.
Expand Down
2 changes: 1 addition & 1 deletion pkg/public/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func TestGetProject(t *testing.T) {
require.NotNil(t, p)

assert.Equal(t, "Bearer sekret", gotAuth)
assert.Equal(t, "/v1/projects/p1", gotPath)
assert.Equal(t, "/v0/projects/p1", gotPath)
require.NotNil(t, p.Id)
assert.Equal(t, "p1", *p.Id)
require.NotNil(t, p.Name)
Expand Down
2 changes: 1 addition & 1 deletion pkg/public/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//
// # Source of truth
//
// The spec is served by the API itself at <base>/v1/openapi and fetched at
// The spec is served by the API itself at <base>/v0/openapi and fetched at
// generate time — no copy is kept in the repo. The base defaults to production
// (https://beta-api.livekit.cloud); override it for a local/staging server:
//
Expand Down
6 changes: 3 additions & 3 deletions pkg/public/keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestGenerateKey(t *testing.T) {

key, err := c.GenerateKey(context.Background(), "p_1", "ci", true)
require.NoError(t, err)
assert.Equal(t, "/v1/projects/p_1/keys", path)
assert.Equal(t, "/v0/projects/p_1/keys", path)
assert.Equal(t, "APIabc", *key.ApiKey)
assert.Equal(t, "s3cret", *key.Secret)
}
Expand All @@ -49,7 +49,7 @@ func TestListScopedKeys(t *testing.T) {

personal, other, err := c.ListScopedKeys(context.Background(), "p_1")
require.NoError(t, err)
assert.Equal(t, "/v1/projects/p_1/scoped-keys", path)
assert.Equal(t, "/v0/projects/p_1/scoped-keys", path)
require.Len(t, personal, 1)
assert.Equal(t, "APIme", *personal[0].ApiKey)
assert.Len(t, other, 2)
Expand All @@ -67,7 +67,7 @@ func TestDeleteKeyError(t *testing.T) {
func TestCreateToken(t *testing.T) {
var gotBody map[string]any
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, "/v1/projects/p_1/tokens", r.URL.Path)
assert.Equal(t, "/v0/projects/p_1/tokens", r.URL.Path)
require.NoError(t, json.NewDecoder(r.Body).Decode(&gotBody))
w.Header().Set("Content-Type", "application/json")
_, _ = w.Write([]byte(`{"token":"jwt","expiresAt":"2030-01-01T00:00:00Z"}`))
Expand Down
4 changes: 2 additions & 2 deletions pkg/public/oapi/generate.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
# Regenerates oapi.gen.go from the LiveKit Public API OpenAPI spec.
#
# The spec is served by the API itself at <base>/v1/openapi. The base defaults
# The spec is served by the API itself at <base>/v0/openapi. The base defaults
# to production; override it for a local/staging server with LK_PUBLIC_API_URL.
# The directive is gated behind the `oapigen` build tag, so regenerate
# deliberately with:
Expand All @@ -14,7 +14,7 @@
set -eu

BASE_URL="${LK_PUBLIC_API_URL:-https://beta-api.livekit.cloud}"
SPEC_URL="${BASE_URL}/v1/openapi"
SPEC_URL="${BASE_URL}/v0/openapi"
TMP="$(mktemp -d)"
trap 'rm -rf "$TMP"' EXIT

Expand Down
Loading
Loading