♻️ Migrate encoding/json to encoding/json/v2 and jsontext
This commit is contained in:
1 parent
2d27a90036
commit
2d3ed8e0ba
70 files changed
+381
-275
No files matched your search
@@ -4,7 +4,7 @@
|
||||
package abuseReport
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
@@ -43,11 +43,11 @@ var insertInSchema = &jsonschema.Schema{
|
||||
"related_entity_id": {Type: "string", Description: relatedEntityUsage},
|
||||
"parts": {
|
||||
Type: "array", Description: "Parts to include in the response",
|
||||
Items: &jsonschema.Schema{Type: "string"}, Default: json.RawMessage(`["snippet"]`),
|
||||
Items: &jsonschema.Schema{Type: "string"}, Default: jsontext.Value(`["snippet"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package activity
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"io"
|
||||
|
||||
cobramcp "github.com/eat-pray-ai/cobra-mcp"
|
||||
@@ -40,7 +40,7 @@ var listInSchema = &jsonschema.Schema{
|
||||
},
|
||||
"max_results": {
|
||||
Type: "number", Description: pkg.MRUsage,
|
||||
Default: json.RawMessage("5"), Minimum: new(float64(0)),
|
||||
Default: jsontext.Value("5"), Minimum: new(float64(0)),
|
||||
},
|
||||
"published_after": {Type: "string", Description: paUsage},
|
||||
"published_before": {Type: "string", Description: pbUsage},
|
||||
@@ -48,11 +48,11 @@ var listInSchema = &jsonschema.Schema{
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["id","snippet","contentDetails"]`),
|
||||
Default: jsontext.Value(`["id","snippet","contentDetails"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "table"},
|
||||
Description: pkg.TableUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.TableUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package caption
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
@@ -38,7 +38,7 @@ var insertInSchema = &jsonschema.Schema{
|
||||
"audio_track_type": {
|
||||
Type: "string", Description: attUsage,
|
||||
Enum: []any{"unknown", "primary", "commentary", "descriptive"},
|
||||
Default: json.RawMessage(`"unknown"`),
|
||||
Default: jsontext.Value(`"unknown"`),
|
||||
},
|
||||
"is_auto_synced": {Type: "boolean", Description: iasUsage},
|
||||
"is_cc": {Type: "boolean", Description: iscUsage},
|
||||
@@ -50,7 +50,7 @@ var insertInSchema = &jsonschema.Schema{
|
||||
"track_kind": {
|
||||
Type: "string", Description: tkUsage,
|
||||
Enum: []any{"standard", "ASR", "forced"},
|
||||
Default: json.RawMessage(`"standard"`),
|
||||
Default: jsontext.Value(`"standard"`),
|
||||
},
|
||||
"video_id": {Type: "string", Description: vidUsage},
|
||||
"on_behalf_of": {Type: "string", Description: pkg.OBOUsage},
|
||||
@@ -58,7 +58,7 @@ var insertInSchema = &jsonschema.Schema{
|
||||
"output": {
|
||||
Type: "string", Description: pkg.SilentUsage,
|
||||
Enum: []any{"json", "yaml", "silent"},
|
||||
Default: json.RawMessage(`"yaml"`),
|
||||
Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
+3
-3
@@ -4,7 +4,7 @@
|
||||
package caption
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"io"
|
||||
|
||||
cobramcp "github.com/eat-pray-ai/cobra-mcp"
|
||||
@@ -44,12 +44,12 @@ var listInSchema = &jsonschema.Schema{
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["id","snippet"]`),
|
||||
Default: jsontext.Value(`["id","snippet"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Description: pkg.TableUsage,
|
||||
Enum: []any{"json", "yaml", "table"},
|
||||
Default: json.RawMessage(`"yaml"`),
|
||||
Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package caption
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
@@ -37,7 +37,7 @@ var updateInSchema = &jsonschema.Schema{
|
||||
"file": {Type: "string", Description: fileUsage},
|
||||
"audio_track_type": {
|
||||
Type: "string", Description: attUsage,
|
||||
Default: json.RawMessage(`"unknown"`),
|
||||
Default: jsontext.Value(`"unknown"`),
|
||||
},
|
||||
"is_auto_synced": {Type: "boolean", Description: iasUsage},
|
||||
"is_cc": {Type: "boolean", Description: iscUsage},
|
||||
@@ -49,7 +49,7 @@ var updateInSchema = &jsonschema.Schema{
|
||||
"track_kind": {
|
||||
Type: "string", Description: tkUsage,
|
||||
Enum: []any{"standard", "ASR", "forced"},
|
||||
Default: json.RawMessage(`"standard"`),
|
||||
Default: jsontext.Value(`"standard"`),
|
||||
},
|
||||
"video_id": {Type: "string", Description: vidUsage},
|
||||
"on_behalf_of": {Type: "string", Description: pkg.OBOUsage},
|
||||
@@ -57,7 +57,7 @@ var updateInSchema = &jsonschema.Schema{
|
||||
"output": {
|
||||
Type: "string", Description: pkg.SilentUsage,
|
||||
Enum: []any{"json", "yaml", "silent"},
|
||||
Default: json.RawMessage(`"yaml"`),
|
||||
Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
+5
-5
@@ -4,7 +4,7 @@
|
||||
package channel
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"io"
|
||||
|
||||
cobramcp "github.com/eat-pray-ai/cobra-mcp"
|
||||
@@ -43,7 +43,7 @@ var listInSchema = &jsonschema.Schema{
|
||||
"ids": {
|
||||
Type: "array", Items: &jsonschema.Schema{Type: "string"},
|
||||
Description: listIdsUsage,
|
||||
Default: json.RawMessage(`[]`),
|
||||
Default: jsontext.Value(`[]`),
|
||||
},
|
||||
"for": {
|
||||
Type: "string", Description: forUsage,
|
||||
@@ -51,18 +51,18 @@ var listInSchema = &jsonschema.Schema{
|
||||
},
|
||||
"max_results": {
|
||||
Type: "number", Description: pkg.MRUsage,
|
||||
Default: json.RawMessage("5"),
|
||||
Default: jsontext.Value("5"),
|
||||
Minimum: new(float64(0)),
|
||||
},
|
||||
"on_behalf_of_content_owner": {Type: "string", Description: pkg.OBOCOUsage},
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["id","snippet","status"]`),
|
||||
Default: jsontext.Value(`["id","snippet","status"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "table"},
|
||||
Description: pkg.TableUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.TableUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package channel
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
@@ -47,7 +47,7 @@ var updateInSchema = &jsonschema.Schema{
|
||||
"title": {Type: "string", Description: titleUsage},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package channelBanner
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
@@ -45,7 +45,7 @@ var insertInSchema = &jsonschema.Schema{
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package channelSection
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"io"
|
||||
|
||||
cobramcp "github.com/eat-pray-ai/cobra-mcp"
|
||||
@@ -45,11 +45,11 @@ var listInSchema = &jsonschema.Schema{
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["id","snippet"]`),
|
||||
Default: jsontext.Value(`["id","snippet"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "table"},
|
||||
Description: pkg.TableUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.TableUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package comment
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
@@ -43,7 +43,7 @@ var insertInSchema = &jsonschema.Schema{
|
||||
"video_id": {Type: "string", Description: vidUsage},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
+5
-5
@@ -4,7 +4,7 @@
|
||||
package comment
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"io"
|
||||
|
||||
cobramcp "github.com/eat-pray-ai/cobra-mcp"
|
||||
@@ -40,22 +40,22 @@ var listInSchema = &jsonschema.Schema{
|
||||
},
|
||||
"max_results": {
|
||||
Type: "number", Description: pkg.MRUsage,
|
||||
Default: json.RawMessage("5"),
|
||||
Default: jsontext.Value("5"),
|
||||
Minimum: new(float64(0)),
|
||||
},
|
||||
"parent_id": {Type: "string", Description: listPidUsage},
|
||||
"text_format": {
|
||||
Type: "string", Enum: []any{"textFormatUnspecified", "html", "plainText"},
|
||||
Description: tfUsage, Default: json.RawMessage(`"html"`),
|
||||
Description: tfUsage, Default: jsontext.Value(`"html"`),
|
||||
},
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["id","snippet"]`),
|
||||
Default: jsontext.Value(`["id","snippet"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "table"},
|
||||
Description: pkg.TableUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.TableUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package comment
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
@@ -39,7 +39,7 @@ var markAsSpamInSchema = &jsonschema.Schema{
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package comment
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
@@ -46,7 +46,7 @@ var setModerationStatusInSchema = &jsonschema.Schema{
|
||||
"ban_author": {Type: "boolean", Description: baUsage},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package comment
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
@@ -48,7 +48,7 @@ var updateInSchema = &jsonschema.Schema{
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package commentThread
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
@@ -41,7 +41,7 @@ var insertInSchema = &jsonschema.Schema{
|
||||
"video_id": {Type: "string", Description: insertVidUsage},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package commentThread
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"io"
|
||||
|
||||
cobramcp "github.com/eat-pray-ai/cobra-mcp"
|
||||
@@ -45,32 +45,32 @@ var listInSchema = &jsonschema.Schema{
|
||||
"channel_id": {Type: "string", Description: cidUsage},
|
||||
"max_results": {
|
||||
Type: "number", Description: pkg.MRUsage,
|
||||
Default: json.RawMessage("5"),
|
||||
Default: jsontext.Value("5"),
|
||||
Minimum: new(float64(0)),
|
||||
},
|
||||
"moderation_status": {
|
||||
Type: "string",
|
||||
Enum: []any{"published", "heldForReview", "likelySpam", "rejected"},
|
||||
Description: msUsage, Default: json.RawMessage(`"published"`),
|
||||
Description: msUsage, Default: jsontext.Value(`"published"`),
|
||||
},
|
||||
"order": {
|
||||
Type: "string", Enum: []any{"orderUnspecified", "time", "relevance"},
|
||||
Description: orderUsage, Default: json.RawMessage(`"time"`),
|
||||
Description: orderUsage, Default: jsontext.Value(`"time"`),
|
||||
},
|
||||
"search_terms": {Type: "string", Description: stUsage},
|
||||
"text_format": {
|
||||
Type: "string", Enum: []any{"textFormatUnspecified", "html"},
|
||||
Description: tfUsage, Default: json.RawMessage(`"html"`),
|
||||
Description: tfUsage, Default: jsontext.Value(`"html"`),
|
||||
},
|
||||
"video_id": {Type: "string", Description: listVidUsage},
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["id","snippet"]`),
|
||||
Default: jsontext.Value(`["id","snippet"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "table"},
|
||||
Description: pkg.TableUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.TableUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package liveBroadcast
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
@@ -45,11 +45,11 @@ var bindInSchema = &jsonschema.Schema{
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["id","snippet","contentDetails","status"]`),
|
||||
Default: jsontext.Value(`["id","snippet","contentDetails","status"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package liveBroadcast
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
@@ -47,11 +47,11 @@ var insertInSchema = &jsonschema.Schema{
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["snippet","status","contentDetails"]`),
|
||||
Default: jsontext.Value(`["snippet","status","contentDetails"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package liveBroadcast
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
@@ -50,7 +50,7 @@ var insertCuepointInSchema = &jsonschema.Schema{
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package liveBroadcast
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"io"
|
||||
|
||||
cobramcp "github.com/eat-pray-ai/cobra-mcp"
|
||||
@@ -43,7 +43,7 @@ var listInSchema = &jsonschema.Schema{
|
||||
"broadcast_type": {Type: "string", Enum: []any{"all", "event", "persistent"}, Description: btUsage},
|
||||
"max_results": {
|
||||
Type: "number", Description: pkg.MRUsage,
|
||||
Default: json.RawMessage("5"), Minimum: new(float64(0)),
|
||||
Default: jsontext.Value("5"), Minimum: new(float64(0)),
|
||||
},
|
||||
"on_behalf_of_content_owner": {Type: "string", Description: pkg.OBOCOUsage},
|
||||
"on_behalf_of_content_owner_channel": {
|
||||
@@ -52,11 +52,11 @@ var listInSchema = &jsonschema.Schema{
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["id","snippet","status"]`),
|
||||
Default: jsontext.Value(`["id","snippet","status"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "table"},
|
||||
Description: pkg.TableUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.TableUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package liveBroadcast
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
@@ -49,11 +49,11 @@ var transitionInSchema = &jsonschema.Schema{
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["id","snippet","status"]`),
|
||||
Default: jsontext.Value(`["id","snippet","status"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package liveBroadcast
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
@@ -52,7 +52,7 @@ var updateInSchema = &jsonschema.Schema{
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package liveChatBan
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
@@ -38,11 +38,11 @@ var insertInSchema = &jsonschema.Schema{
|
||||
"ban_duration_seconds": {Type: "number", Description: banDurationUsage},
|
||||
"parts": {
|
||||
Type: "array", Description: "Parts to include in the response",
|
||||
Items: &jsonschema.Schema{Type: "string"}, Default: json.RawMessage(`["snippet"]`),
|
||||
Items: &jsonschema.Schema{Type: "string"}, Default: jsontext.Value(`["snippet"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package liveChatMessage
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
@@ -34,11 +34,11 @@ var insertInSchema = &jsonschema.Schema{
|
||||
"message_text": {Type: "string", Description: msgUsage},
|
||||
"parts": {
|
||||
Type: "array", Description: "Parts to include in the response",
|
||||
Items: &jsonschema.Schema{Type: "string"}, Default: json.RawMessage(`["snippet"]`),
|
||||
Items: &jsonschema.Schema{Type: "string"}, Default: jsontext.Value(`["snippet"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package liveChatMessage
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"io"
|
||||
|
||||
cobramcp "github.com/eat-pray-ai/cobra-mcp"
|
||||
@@ -35,17 +35,17 @@ var listInSchema = &jsonschema.Schema{
|
||||
"hl": {Type: "string", Description: "Localization language for system messages"},
|
||||
"max_results": {
|
||||
Type: "number", Description: pkg.MRUsage,
|
||||
Default: json.RawMessage("5"),
|
||||
Default: jsontext.Value("5"),
|
||||
Minimum: new(float64(0)),
|
||||
},
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["snippet","authorDetails"]`),
|
||||
Default: jsontext.Value(`["snippet","authorDetails"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "table"},
|
||||
Description: pkg.TableUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.TableUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package liveChatMessage
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
@@ -41,7 +41,7 @@ var transitionInSchema = &jsonschema.Schema{
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package liveChatModerator
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
@@ -34,11 +34,11 @@ var insertInSchema = &jsonschema.Schema{
|
||||
"moderator_channel_id": {Type: "string", Description: mcidUsage},
|
||||
"parts": {
|
||||
Type: "array", Description: "Parts to include in the response",
|
||||
Items: &jsonschema.Schema{Type: "string"}, Default: json.RawMessage(`["snippet"]`),
|
||||
Items: &jsonschema.Schema{Type: "string"}, Default: jsontext.Value(`["snippet"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package liveChatModerator
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"io"
|
||||
|
||||
cobramcp "github.com/eat-pray-ai/cobra-mcp"
|
||||
@@ -34,17 +34,17 @@ var listInSchema = &jsonschema.Schema{
|
||||
"live_chat_id": {Type: "string", Description: lcidUsage},
|
||||
"max_results": {
|
||||
Type: "number", Description: pkg.MRUsage,
|
||||
Default: json.RawMessage("5"),
|
||||
Default: jsontext.Value("5"),
|
||||
Minimum: new(float64(0)),
|
||||
},
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["snippet"]`),
|
||||
Default: jsontext.Value(`["snippet"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "table"},
|
||||
Description: pkg.TableUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.TableUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package liveStream
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
@@ -53,11 +53,11 @@ var insertInSchema = &jsonschema.Schema{
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["snippet","cdn","status"]`),
|
||||
Default: jsontext.Value(`["snippet","cdn","status"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package liveStream
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"io"
|
||||
|
||||
cobramcp "github.com/eat-pray-ai/cobra-mcp"
|
||||
@@ -41,7 +41,7 @@ var listInSchema = &jsonschema.Schema{
|
||||
"mine": {Type: "boolean", Description: "List streams owned by the authenticated user"},
|
||||
"max_results": {
|
||||
Type: "number", Description: pkg.MRUsage,
|
||||
Default: json.RawMessage("5"), Minimum: new(float64(0)),
|
||||
Default: jsontext.Value("5"), Minimum: new(float64(0)),
|
||||
},
|
||||
"on_behalf_of_content_owner": {Type: "string", Description: pkg.OBOCOUsage},
|
||||
"on_behalf_of_content_owner_channel": {
|
||||
@@ -50,11 +50,11 @@ var listInSchema = &jsonschema.Schema{
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["id","snippet","cdn","status"]`),
|
||||
Default: jsontext.Value(`["id","snippet","cdn","status"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "table"},
|
||||
Description: pkg.TableUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.TableUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package liveStream
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
@@ -58,7 +58,7 @@ var updateInSchema = &jsonschema.Schema{
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
+5
-5
@@ -4,7 +4,7 @@
|
||||
package member
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"io"
|
||||
|
||||
cobramcp "github.com/eat-pray-ai/cobra-mcp"
|
||||
@@ -35,22 +35,22 @@ var listInSchema = &jsonschema.Schema{
|
||||
"has_access_to_level": {Type: "string", Description: hatlUsage},
|
||||
"max_results": {
|
||||
Type: "number", Description: pkg.MRUsage,
|
||||
Default: json.RawMessage("5"),
|
||||
Default: jsontext.Value("5"),
|
||||
Minimum: new(float64(0)),
|
||||
},
|
||||
"mode": {
|
||||
Type: "string", Description: mmUsage,
|
||||
Enum: []any{"listMembersModeUnknown", "updates", "all_current"},
|
||||
Default: json.RawMessage(`"all_current"`),
|
||||
Default: jsontext.Value(`"all_current"`),
|
||||
},
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["snippet"]`),
|
||||
Default: jsontext.Value(`["snippet"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "table"},
|
||||
Description: pkg.TableUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.TableUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package membershipsLevel
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"io"
|
||||
|
||||
cobramcp "github.com/eat-pray-ai/cobra-mcp"
|
||||
@@ -32,11 +32,11 @@ var listInSchema = &jsonschema.Schema{
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["id", "snippet"]`),
|
||||
Default: jsontext.Value(`["id", "snippet"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "table"},
|
||||
Description: pkg.TableUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.TableUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package playlist
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
@@ -49,7 +49,7 @@ var insertInSchema = &jsonschema.Schema{
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package playlist
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"io"
|
||||
|
||||
cobramcp "github.com/eat-pray-ai/cobra-mcp"
|
||||
@@ -43,7 +43,7 @@ var listInSchema = &jsonschema.Schema{
|
||||
"hl": {Type: "string", Description: hlUsage},
|
||||
"max_results": {
|
||||
Type: "number", Description: pkg.MRUsage,
|
||||
Default: json.RawMessage("5"),
|
||||
Default: jsontext.Value("5"),
|
||||
Minimum: new(float64(0)),
|
||||
},
|
||||
"mine": {
|
||||
@@ -60,11 +60,11 @@ var listInSchema = &jsonschema.Schema{
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["id","snippet","status"]`),
|
||||
Default: jsontext.Value(`["id","snippet","status"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "table"},
|
||||
Description: pkg.TableUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.TableUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package playlist
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
@@ -55,7 +55,7 @@ var updateInSchema = &jsonschema.Schema{
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package playlistImage
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
@@ -55,7 +55,7 @@ var insertInSchema = &jsonschema.Schema{
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package playlistImage
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"io"
|
||||
|
||||
cobramcp "github.com/eat-pray-ai/cobra-mcp"
|
||||
@@ -34,7 +34,7 @@ var listInSchema = &jsonschema.Schema{
|
||||
"parent": {Type: "string", Description: parentUsage},
|
||||
"max_results": {
|
||||
Type: "number", Description: pkg.MRUsage,
|
||||
Default: json.RawMessage("5"),
|
||||
Default: jsontext.Value("5"),
|
||||
Minimum: new(float64(0)),
|
||||
},
|
||||
"on_behalf_of_content_owner": {
|
||||
@@ -48,11 +48,11 @@ var listInSchema = &jsonschema.Schema{
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["id","kind","snippet"]`),
|
||||
Default: jsontext.Value(`["id","kind","snippet"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "table"},
|
||||
Description: pkg.TableUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.TableUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package playlistImage
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
@@ -50,7 +50,7 @@ var updateInSchema = &jsonschema.Schema{
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package playlistItem
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
@@ -51,7 +51,7 @@ var insertInSchema = &jsonschema.Schema{
|
||||
"on_behalf_of_content_owner": {Type: "string", Description: pkg.OBOCOUsage},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package playlistItem
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"io"
|
||||
|
||||
cobramcp "github.com/eat-pray-ai/cobra-mcp"
|
||||
@@ -42,7 +42,7 @@ var listInSchema = &jsonschema.Schema{
|
||||
"playlist_id": {Type: "string", Description: listPidUsage},
|
||||
"max_results": {
|
||||
Type: "number", Description: pkg.MRUsage,
|
||||
Default: json.RawMessage("5"),
|
||||
Default: jsontext.Value("5"),
|
||||
Minimum: new(float64(0)),
|
||||
},
|
||||
"video_id": {Type: "string", Description: vidUsage},
|
||||
@@ -50,11 +50,11 @@ var listInSchema = &jsonschema.Schema{
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["id","snippet","status"]`),
|
||||
Default: jsontext.Value(`["id","snippet","status"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "table"},
|
||||
Description: pkg.TableUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.TableUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package playlistItem
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
@@ -49,7 +49,7 @@ var updateInSchema = &jsonschema.Schema{
|
||||
"on_behalf_of_content_owner": {Type: "string", Description: pkg.OBOCOUsage},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
+11
-11
@@ -4,7 +4,7 @@
|
||||
package search
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"io"
|
||||
|
||||
cobramcp "github.com/eat-pray-ai/cobra-mcp"
|
||||
@@ -38,11 +38,11 @@ var listInSchema = &jsonschema.Schema{
|
||||
"channel_id": {Type: "string", Description: cidUsage},
|
||||
"channel_type": {
|
||||
Type: "string", Enum: []any{"channelTypeUnspecified", "any", "show"},
|
||||
Description: ctUsage, Default: json.RawMessage(`"channelTypeUnspecified"`),
|
||||
Description: ctUsage, Default: jsontext.Value(`"channelTypeUnspecified"`),
|
||||
},
|
||||
"event_type": {
|
||||
Type: "string", Enum: []any{"none", "upcoming", "live", "completed"},
|
||||
Description: etUsage, Default: json.RawMessage(`"none"`),
|
||||
Description: etUsage, Default: jsontext.Value(`"none"`),
|
||||
},
|
||||
"for": {
|
||||
Type: "string", Description: forUsage,
|
||||
@@ -52,13 +52,13 @@ var listInSchema = &jsonschema.Schema{
|
||||
"location_radius": {Type: "string", Description: lrUsage},
|
||||
"max_results": {
|
||||
Type: "number", Description: pkg.MRUsage,
|
||||
Default: json.RawMessage("5"),
|
||||
Default: jsontext.Value("5"),
|
||||
Minimum: new(float64(0)),
|
||||
},
|
||||
"on_behalf_of_content_owner": {Type: "string", Description: pkg.OBOCOUsage},
|
||||
"order": {
|
||||
Type: "string", Description: orderUsage,
|
||||
Default: json.RawMessage(`"relevance"`),
|
||||
Default: jsontext.Value(`"relevance"`),
|
||||
},
|
||||
"published_after": {Type: "string", Description: paUsage},
|
||||
"published_before": {Type: "string", Description: pbUsage},
|
||||
@@ -70,7 +70,7 @@ var listInSchema = &jsonschema.Schema{
|
||||
Enum: []any{
|
||||
"safeSearchSettingUnspecified", "none", "moderate", "strict",
|
||||
},
|
||||
Default: json.RawMessage(`"moderate"`),
|
||||
Default: jsontext.Value(`"moderate"`),
|
||||
},
|
||||
"topic_id": {Type: "string", Description: tidUsage},
|
||||
"types": {
|
||||
@@ -82,20 +82,20 @@ var listInSchema = &jsonschema.Schema{
|
||||
Enum: []any{
|
||||
"videoCaptionUnspecified", "any", "closedCaption", "none",
|
||||
},
|
||||
Default: json.RawMessage(`"any"`),
|
||||
Default: jsontext.Value(`"any"`),
|
||||
},
|
||||
"video_category_id": {Type: "string", Description: vcidUsage},
|
||||
"video_definition": {Type: "string", Description: vdeUsage},
|
||||
"video_dimension": {
|
||||
Type: "string", Enum: []any{"any", "2d", "3d"},
|
||||
Description: vdiUsage, Default: json.RawMessage(`"any"`),
|
||||
Description: vdiUsage, Default: jsontext.Value(`"any"`),
|
||||
},
|
||||
"video_duration": {
|
||||
Type: "string", Description: vduUsage,
|
||||
Enum: []any{
|
||||
"videoDurationUnspecified", "any", "short", "medium", "long",
|
||||
},
|
||||
Default: json.RawMessage(`"any"`),
|
||||
Default: jsontext.Value(`"any"`),
|
||||
},
|
||||
"video_embeddable": {
|
||||
Type: "string", Description: veUsage,
|
||||
@@ -122,11 +122,11 @@ var listInSchema = &jsonschema.Schema{
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["id","snippet"]`),
|
||||
Default: jsontext.Value(`["id","snippet"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "table"},
|
||||
Description: pkg.TableUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.TableUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package subscription
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
@@ -39,7 +39,7 @@ var insertInSchema = &jsonschema.Schema{
|
||||
"title": {Type: "string", Description: titleUsage},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package subscription
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"io"
|
||||
|
||||
cobramcp "github.com/eat-pray-ai/cobra-mcp"
|
||||
@@ -45,7 +45,7 @@ var listInSchema = &jsonschema.Schema{
|
||||
"for_channel_id": {Type: "string", Description: fcidUsage},
|
||||
"max_results": {
|
||||
Type: "number", Description: pkg.MRUsage,
|
||||
Default: json.RawMessage("5"),
|
||||
Default: jsontext.Value("5"),
|
||||
Minimum: new(float64(0)),
|
||||
},
|
||||
"for": {
|
||||
@@ -65,16 +65,16 @@ var listInSchema = &jsonschema.Schema{
|
||||
Enum: []any{
|
||||
"subscriptionOrderUnspecified", "relevance", "unread", "alphabetical",
|
||||
},
|
||||
Default: json.RawMessage(`"relevance"`),
|
||||
Default: jsontext.Value(`"relevance"`),
|
||||
},
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["id","snippet"]`),
|
||||
Default: jsontext.Value(`["id","snippet"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "table"},
|
||||
Description: pkg.TableUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.TableUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package superChatEvent
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"io"
|
||||
|
||||
cobramcp "github.com/eat-pray-ai/cobra-mcp"
|
||||
@@ -32,17 +32,17 @@ var listInSchema = &jsonschema.Schema{
|
||||
"hl": {Type: "string", Description: hlUsage},
|
||||
"max_results": {
|
||||
Type: "number", Description: pkg.MRUsage,
|
||||
Default: json.RawMessage("5"),
|
||||
Default: jsontext.Value("5"),
|
||||
Minimum: new(float64(0)),
|
||||
},
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["id","snippet"]`),
|
||||
Default: jsontext.Value(`["id","snippet"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "table"},
|
||||
Description: pkg.TableUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.TableUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package thirdPartyLink
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
@@ -37,11 +37,11 @@ var insertInSchema = &jsonschema.Schema{
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["snippet","status"]`),
|
||||
Default: jsontext.Value(`["snippet","status"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package thirdPartyLink
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"io"
|
||||
|
||||
cobramcp "github.com/eat-pray-ai/cobra-mcp"
|
||||
@@ -39,11 +39,11 @@ var listInSchema = &jsonschema.Schema{
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["snippet","status"]`),
|
||||
Default: jsontext.Value(`["snippet","status"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "table"},
|
||||
Description: pkg.TableUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.TableUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package thirdPartyLink
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
@@ -39,11 +39,11 @@ var updateInSchema = &jsonschema.Schema{
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["snippet","status"]`),
|
||||
Default: jsontext.Value(`["snippet","status"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package thumbnail
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
@@ -36,7 +36,7 @@ var setInSchema = &jsonschema.Schema{
|
||||
"video_id": {Type: "string", Description: vidUsage},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package video
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"io"
|
||||
|
||||
cobramcp "github.com/eat-pray-ai/cobra-mcp"
|
||||
@@ -39,7 +39,7 @@ var getRatingInSchema = &jsonschema.Schema{
|
||||
"on_behalf_of_content_owner": {Type: "string", Description: pkg.OBOCOUsage},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "table"},
|
||||
Description: pkg.TableUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.TableUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
+3
-3
@@ -4,7 +4,7 @@
|
||||
package video
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
@@ -46,7 +46,7 @@ var insertInSchema = &jsonschema.Schema{
|
||||
"language": {Type: "string", Description: insertLangUsage},
|
||||
"license": {
|
||||
Type: "string", Enum: []any{"youtube", "creativeCommon"},
|
||||
Description: licenseUsage, Default: json.RawMessage(`"youtube"`),
|
||||
Description: licenseUsage, Default: jsontext.Value(`"youtube"`),
|
||||
},
|
||||
"thumbnail": {Type: "string", Description: thumbnailUsage},
|
||||
"channel_id": {Type: "string", Description: chidUsage},
|
||||
@@ -76,7 +76,7 @@ var insertInSchema = &jsonschema.Schema{
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
+4
-4
@@ -4,7 +4,7 @@
|
||||
package video
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"io"
|
||||
|
||||
cobramcp "github.com/eat-pray-ai/cobra-mcp"
|
||||
@@ -57,18 +57,18 @@ var listInSchema = &jsonschema.Schema{
|
||||
},
|
||||
"max_results": {
|
||||
Type: "number", Description: pkg.MRUsage,
|
||||
Default: json.RawMessage("5"), Minimum: new(float64(0)),
|
||||
Default: jsontext.Value("5"), Minimum: new(float64(0)),
|
||||
},
|
||||
"on_behalf_of_content_owner": {Type: "string", Description: pkg.OBOCOUsage},
|
||||
"rating": {Type: "string", Description: listMrUsage},
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["id","snippet","status","statistics"]`),
|
||||
Default: jsontext.Value(`["id","snippet","status","statistics"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "table"},
|
||||
Description: pkg.TableUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.TableUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
+3
-3
@@ -4,7 +4,7 @@
|
||||
package video
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
@@ -52,7 +52,7 @@ var updateInSchema = &jsonschema.Schema{
|
||||
"language": {Type: "string", Description: updateLangUsage},
|
||||
"license": {
|
||||
Type: "string", Enum: []any{"youtube", "creativeCommon"},
|
||||
Description: licenseUsage, Default: json.RawMessage(`"youtube"`),
|
||||
Description: licenseUsage, Default: jsontext.Value(`"youtube"`),
|
||||
},
|
||||
"thumbnail": {Type: "string", Description: thumbnailUsage},
|
||||
"playlist_id": {Type: "string", Description: pidUsage},
|
||||
@@ -68,7 +68,7 @@ var updateInSchema = &jsonschema.Schema{
|
||||
"confirmed": {Type: "boolean", Description: pkg.ConfirmedUsage},
|
||||
"output": {
|
||||
Type: "string", Enum: []any{"json", "yaml", "silent"},
|
||||
Description: pkg.SilentUsage, Default: json.RawMessage(`"yaml"`),
|
||||
Description: pkg.SilentUsage, Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
package videoAbuseReportReason
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"io"
|
||||
|
||||
cobramcp "github.com/eat-pray-ai/cobra-mcp"
|
||||
@@ -33,12 +33,12 @@ var listInSchema = &jsonschema.Schema{
|
||||
"parts": {
|
||||
Type: "array", Description: pkg.PartsUsage,
|
||||
Items: &jsonschema.Schema{Type: "string"},
|
||||
Default: json.RawMessage(`["id","snippet"]`),
|
||||
Default: jsontext.Value(`["id","snippet"]`),
|
||||
},
|
||||
"output": {
|
||||
Type: "string", Description: pkg.TableUsage,
|
||||
Enum: []any{"json", "yaml", "table"},
|
||||
Default: json.RawMessage(`"yaml"`),
|
||||
Default: jsontext.Value(`"yaml"`),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ package abuseReport
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"encoding/json/v2"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"testing"
|
||||
@@ -139,7 +139,7 @@ func TestAbuseReport_Insert(t *testing.T) {
|
||||
TypeId string `json:"typeId"`
|
||||
} `json:"subject"`
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
|
||||
if err := json.UnmarshalRead(r.Body, &body); err != nil {
|
||||
t.Fatalf("failed to decode request body: %v", err)
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ func TestAbuseReport_Insert(t *testing.T) {
|
||||
} `json:"entity"`
|
||||
} `json:"relatedEntities"`
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
|
||||
if err := json.UnmarshalRead(r.Body, &body); err != nil {
|
||||
t.Fatalf("failed to decode request body: %v", err)
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ package auth
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"encoding/json/v2"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"net"
|
||||
@@ -264,7 +264,7 @@ func (s *svc) saveToken(token *oauth2.Token) error {
|
||||
defer func() {
|
||||
_ = f.Close()
|
||||
}()
|
||||
err = json.NewEncoder(f).Encode(token)
|
||||
err = json.MarshalWrite(f, token)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s: %w", cacheTokenFailed, err)
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ package auth
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"encoding/json/v2"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
@@ -357,11 +357,16 @@ func TestGetCodeFromPrompt_ReadError(t *testing.T) {
|
||||
|
||||
s := NewY2BService(WithIO(errReader, &out)).(*svc)
|
||||
|
||||
_, err := s.getCodeFromPrompt("http://example.com/auth", "http://localhost:8216")
|
||||
_, err := s.getCodeFromPrompt(
|
||||
"http://example.com/auth", "http://localhost:8216",
|
||||
)
|
||||
if err == nil {
|
||||
t.Fatalf("expected error from getCodeFromPrompt, got nil")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "failed to read prompt") {
|
||||
t.Errorf("expected error to contain %q, got %q", "failed to read prompt", err.Error())
|
||||
t.Errorf(
|
||||
"expected error to contain %q, got %q", "failed to read prompt",
|
||||
err.Error(),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ package auth
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"encoding/json/v2"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
@@ -48,7 +48,7 @@ func NewGoogleTokenVerifier(tokenInfoURL string) sdkauth.TokenVerifier {
|
||||
Sub string `json:"sub"`
|
||||
Error string `json:"error"`
|
||||
}
|
||||
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
|
||||
if err := json.UnmarshalRead(resp.Body, &result); err != nil {
|
||||
return nil, fmt.Errorf("%w: %w", sdkauth.ErrInvalidToken, err)
|
||||
}
|
||||
if result.Error != "" {
|
||||
|
||||
+35
-21
@@ -4,7 +4,7 @@
|
||||
package auth
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/json/v2"
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
@@ -14,19 +14,25 @@ import (
|
||||
)
|
||||
|
||||
func TestGoogleTokenVerifier_ValidToken(t *testing.T) {
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
token := r.URL.Query().Get("access_token")
|
||||
if token != "valid-google-token" {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
_ = json.NewEncoder(w).Encode(map[string]string{"error": "invalid_token"})
|
||||
return
|
||||
}
|
||||
_ = json.NewEncoder(w).Encode(map[string]any{
|
||||
"expires_in": "3600",
|
||||
"scope": "https://www.googleapis.com/auth/youtube https://www.googleapis.com/auth/youtube.force-ssl https://www.googleapis.com/auth/youtube.channel-memberships.creator",
|
||||
"sub": "user-123",
|
||||
})
|
||||
}))
|
||||
ts := httptest.NewServer(
|
||||
http.HandlerFunc(
|
||||
func(w http.ResponseWriter, r *http.Request) {
|
||||
token := r.URL.Query().Get("access_token")
|
||||
if token != "valid-google-token" {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
_ = json.MarshalWrite(w, map[string]string{"error": "invalid_token"})
|
||||
return
|
||||
}
|
||||
_ = json.MarshalWrite(
|
||||
w, map[string]any{
|
||||
"expires_in": "3600",
|
||||
"scope": "https://www.googleapis.com/auth/youtube https://www.googleapis.com/auth/youtube.force-ssl https://www.googleapis.com/auth/youtube.channel-memberships.creator",
|
||||
"sub": "user-123",
|
||||
},
|
||||
)
|
||||
},
|
||||
),
|
||||
)
|
||||
defer ts.Close()
|
||||
|
||||
verifier := NewGoogleTokenVerifier(ts.URL)
|
||||
@@ -50,10 +56,14 @@ func TestGoogleTokenVerifier_ValidToken(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGoogleTokenVerifier_InvalidToken(t *testing.T) {
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
_ = json.NewEncoder(w).Encode(map[string]string{"error": "invalid_token"})
|
||||
}))
|
||||
ts := httptest.NewServer(
|
||||
http.HandlerFunc(
|
||||
func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
_ = json.MarshalWrite(w, map[string]string{"error": "invalid_token"})
|
||||
},
|
||||
),
|
||||
)
|
||||
defer ts.Close()
|
||||
|
||||
verifier := NewGoogleTokenVerifier(ts.URL)
|
||||
@@ -67,9 +77,13 @@ func TestGoogleTokenVerifier_InvalidToken(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGoogleTokenVerifier_ServerError(t *testing.T) {
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
}))
|
||||
ts := httptest.NewServer(
|
||||
http.HandlerFunc(
|
||||
func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
},
|
||||
),
|
||||
)
|
||||
defer ts.Close()
|
||||
|
||||
verifier := NewGoogleTokenVerifier(ts.URL)
|
||||
|
||||
@@ -5,7 +5,7 @@ package liveBroadcast
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"encoding/json/v2"
|
||||
"io"
|
||||
"math"
|
||||
"net/http"
|
||||
@@ -364,7 +364,7 @@ func TestLiveBroadcast_Insert(t *testing.T) {
|
||||
PrivacyStatus string `json:"privacyStatus"`
|
||||
} `json:"status"`
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
|
||||
if err := json.UnmarshalRead(r.Body, &body); err != nil {
|
||||
t.Fatalf("failed to decode request body: %v", err)
|
||||
}
|
||||
|
||||
@@ -676,7 +676,7 @@ func TestLiveBroadcast_InsertCuepoint(t *testing.T) {
|
||||
CueType string `json:"cueType"`
|
||||
DurationSecs int64 `json:"durationSecs"`
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
|
||||
if err := json.UnmarshalRead(r.Body, &body); err != nil {
|
||||
t.Fatalf("failed to decode request body: %v", err)
|
||||
}
|
||||
if body.CueType != "cueTypeAd" {
|
||||
|
||||
@@ -5,7 +5,7 @@ package liveChatBan
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"encoding/json/v2"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"testing"
|
||||
@@ -151,7 +151,7 @@ func TestLiveChatBan_Insert(t *testing.T) {
|
||||
Type string `json:"type"`
|
||||
} `json:"snippet"`
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
|
||||
if err := json.UnmarshalRead(r.Body, &body); err != nil {
|
||||
t.Fatalf("failed to decode request body: %v", err)
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ func TestLiveChatBan_Insert(t *testing.T) {
|
||||
Type string `json:"type"`
|
||||
} `json:"snippet"`
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
|
||||
if err := json.UnmarshalRead(r.Body, &body); err != nil {
|
||||
t.Fatalf("failed to decode request body: %v", err)
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ package liveChatMessage
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"encoding/json/v2"
|
||||
"io"
|
||||
"math"
|
||||
"net/http"
|
||||
@@ -290,7 +290,7 @@ func TestLiveChatMessage_Insert(t *testing.T) {
|
||||
Type string `json:"type"`
|
||||
} `json:"snippet"`
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
|
||||
if err := json.UnmarshalRead(r.Body, &body); err != nil {
|
||||
t.Fatalf("failed to decode request body: %v", err)
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ package liveChatModerator
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"encoding/json/v2"
|
||||
"io"
|
||||
"math"
|
||||
"net/http"
|
||||
@@ -117,7 +117,9 @@ func TestNewLiveChatModerator(t *testing.T) {
|
||||
if got := NewLiveChatModerator(tt.args.opts...); !reflect.DeepEqual(
|
||||
got, tt.want,
|
||||
) {
|
||||
t.Errorf("%s\nNewLiveChatModerator() = %v\nwant %v", tt.name, got, tt.want)
|
||||
t.Errorf(
|
||||
"%s\nNewLiveChatModerator() = %v\nwant %v", tt.name, got, tt.want,
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
@@ -186,11 +188,16 @@ func TestLiveChatModerator_Get(t *testing.T) {
|
||||
m := NewLiveChatModerator(opts...)
|
||||
got, err := m.Get()
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("LiveChatModerator.Get() error = %v, wantErr %v", err, tt.wantErr)
|
||||
t.Errorf(
|
||||
"LiveChatModerator.Get() error = %v, wantErr %v", err, tt.wantErr,
|
||||
)
|
||||
return
|
||||
}
|
||||
if len(got) != tt.wantLen {
|
||||
t.Errorf("LiveChatModerator.Get() got length = %v, want %v", len(got), tt.wantLen)
|
||||
t.Errorf(
|
||||
"LiveChatModerator.Get() got length = %v, want %v", len(got),
|
||||
tt.wantLen,
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
@@ -272,7 +279,7 @@ func TestLiveChatModerator_Insert(t *testing.T) {
|
||||
} `json:"moderatorDetails"`
|
||||
} `json:"snippet"`
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
|
||||
if err := json.UnmarshalRead(r.Body, &body); err != nil {
|
||||
t.Fatalf("failed to decode request body: %v", err)
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ package liveStream
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"encoding/json/v2"
|
||||
"io"
|
||||
"math"
|
||||
"net/http"
|
||||
@@ -324,7 +324,7 @@ func TestLiveStream_Insert(t *testing.T) {
|
||||
Resolution string `json:"resolution"`
|
||||
} `json:"cdn"`
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
|
||||
if err := json.UnmarshalRead(r.Body, &body); err != nil {
|
||||
t.Fatalf("failed to decode request body: %v", err)
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ package playlist
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"encoding/json/v2"
|
||||
"io"
|
||||
"math"
|
||||
"net/http"
|
||||
@@ -332,7 +332,8 @@ func TestPlaylist_Get_Pagination(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPlaylist_List(t *testing.T) {
|
||||
common.RunListTest(t, `{
|
||||
common.RunListTest(
|
||||
t, `{
|
||||
"items": [
|
||||
{
|
||||
"id": "playlist-1",
|
||||
@@ -344,7 +345,9 @@ func TestPlaylist_List(t *testing.T) {
|
||||
]
|
||||
}`,
|
||||
func(svc *youtube.Service, output string) func(io.Writer) error {
|
||||
p := NewPlaylist(WithService(svc), WithOutput(output), WithIds([]string{"playlist-1"}))
|
||||
p := NewPlaylist(
|
||||
WithService(svc), WithOutput(output), WithIds([]string{"playlist-1"}),
|
||||
)
|
||||
return p.List
|
||||
},
|
||||
)
|
||||
@@ -459,7 +462,7 @@ func TestPlaylist_Update(t *testing.T) {
|
||||
}
|
||||
|
||||
var playlist youtube.Playlist
|
||||
if err := json.NewDecoder(r.Body).Decode(&playlist); err != nil {
|
||||
if err := json.UnmarshalRead(r.Body, &playlist); err != nil {
|
||||
t.Errorf("failed to decode body: %v", err)
|
||||
}
|
||||
if playlist.Snippet.Title != "Updated Title" {
|
||||
|
||||
@@ -5,7 +5,7 @@ package subscription
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"encoding/json/v2"
|
||||
"io"
|
||||
"math"
|
||||
"net/http"
|
||||
@@ -331,7 +331,8 @@ func TestSubscription_Get_Pagination(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSubscription_List(t *testing.T) {
|
||||
common.RunListTest(t, `{
|
||||
common.RunListTest(
|
||||
t, `{
|
||||
"items": [
|
||||
{
|
||||
"id": "sub-1",
|
||||
@@ -346,7 +347,9 @@ func TestSubscription_List(t *testing.T) {
|
||||
]
|
||||
}`,
|
||||
func(svc *youtube.Service, output string) func(io.Writer) error {
|
||||
s := NewSubscription(WithService(svc), WithOutput(output), WithIds([]string{"sub-1"}))
|
||||
s := NewSubscription(
|
||||
WithService(svc), WithOutput(output), WithIds([]string{"sub-1"}),
|
||||
)
|
||||
return s.List
|
||||
},
|
||||
)
|
||||
@@ -385,7 +388,7 @@ func TestSubscription_Insert(t *testing.T) {
|
||||
ChannelId string `json:"channelId"`
|
||||
} `json:"snippet"`
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
|
||||
if err := json.UnmarshalRead(r.Body, &body); err != nil {
|
||||
t.Fatalf("failed to decode request body: %v", err)
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ package thirdPartyLink
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"encoding/json/v2"
|
||||
"io"
|
||||
"net/http"
|
||||
"reflect"
|
||||
@@ -79,7 +79,9 @@ func TestNewThirdPartyLink(t *testing.T) {
|
||||
if got := NewThirdPartyLink(tt.args.opts...); !reflect.DeepEqual(
|
||||
got, tt.want,
|
||||
) {
|
||||
t.Errorf("%s\nNewThirdPartyLink() = %v\nwant %v", tt.name, got, tt.want)
|
||||
t.Errorf(
|
||||
"%s\nNewThirdPartyLink() = %v\nwant %v", tt.name, got, tt.want,
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
@@ -102,7 +104,10 @@ func TestThirdPartyLink_Get(t *testing.T) {
|
||||
},
|
||||
verify: func(r *http.Request) {
|
||||
if r.URL.Query().Get("linkingToken") != "token123" {
|
||||
t.Errorf("expected linkingToken=token123, got %s", r.URL.Query().Get("linkingToken"))
|
||||
t.Errorf(
|
||||
"expected linkingToken=token123, got %s",
|
||||
r.URL.Query().Get("linkingToken"),
|
||||
)
|
||||
}
|
||||
},
|
||||
wantLen: 1,
|
||||
@@ -116,7 +121,9 @@ func TestThirdPartyLink_Get(t *testing.T) {
|
||||
},
|
||||
verify: func(r *http.Request) {
|
||||
if r.URL.Query().Get("type") != "channelToStoreLink" {
|
||||
t.Errorf("expected type=channelToStoreLink, got %s", r.URL.Query().Get("type"))
|
||||
t.Errorf(
|
||||
"expected type=channelToStoreLink, got %s", r.URL.Query().Get("type"),
|
||||
)
|
||||
}
|
||||
},
|
||||
wantLen: 1,
|
||||
@@ -130,7 +137,10 @@ func TestThirdPartyLink_Get(t *testing.T) {
|
||||
},
|
||||
verify: func(r *http.Request) {
|
||||
if r.URL.Query().Get("externalChannelId") != "ext-channel-123" {
|
||||
t.Errorf("expected externalChannelId=ext-channel-123, got %s", r.URL.Query().Get("externalChannelId"))
|
||||
t.Errorf(
|
||||
"expected externalChannelId=ext-channel-123, got %s",
|
||||
r.URL.Query().Get("externalChannelId"),
|
||||
)
|
||||
}
|
||||
},
|
||||
wantLen: 1,
|
||||
@@ -163,11 +173,15 @@ func TestThirdPartyLink_Get(t *testing.T) {
|
||||
tpl := NewThirdPartyLink(opts...)
|
||||
got, err := tpl.Get()
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("ThirdPartyLink.Get() error = %v, wantErr %v", err, tt.wantErr)
|
||||
t.Errorf(
|
||||
"ThirdPartyLink.Get() error = %v, wantErr %v", err, tt.wantErr,
|
||||
)
|
||||
return
|
||||
}
|
||||
if len(got) != tt.wantLen {
|
||||
t.Errorf("ThirdPartyLink.Get() got length = %v, want %v", len(got), tt.wantLen)
|
||||
t.Errorf(
|
||||
"ThirdPartyLink.Get() got length = %v, want %v", len(got), tt.wantLen,
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
@@ -175,7 +189,8 @@ func TestThirdPartyLink_Get(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestThirdPartyLink_List(t *testing.T) {
|
||||
common.RunListTest(t, `{
|
||||
common.RunListTest(
|
||||
t, `{
|
||||
"items": [
|
||||
{
|
||||
"linkingToken": "token123",
|
||||
@@ -225,7 +240,7 @@ func TestThirdPartyLink_Insert(t *testing.T) {
|
||||
LinkStatus string `json:"linkStatus"`
|
||||
} `json:"status"`
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
|
||||
if err := json.UnmarshalRead(r.Body, &body); err != nil {
|
||||
t.Fatalf("failed to decode request body: %v", err)
|
||||
}
|
||||
|
||||
@@ -233,10 +248,14 @@ func TestThirdPartyLink_Insert(t *testing.T) {
|
||||
t.Errorf("expected linkingToken=token123, got %s", body.LinkingToken)
|
||||
}
|
||||
if body.Snippet.Type != "channelToStoreLink" {
|
||||
t.Errorf("expected snippet.type=channelToStoreLink, got %s", body.Snippet.Type)
|
||||
t.Errorf(
|
||||
"expected snippet.type=channelToStoreLink, got %s", body.Snippet.Type,
|
||||
)
|
||||
}
|
||||
if body.Status.LinkStatus != "pending" {
|
||||
t.Errorf("expected status.linkStatus=pending, got %s", body.Status.LinkStatus)
|
||||
t.Errorf(
|
||||
"expected status.linkStatus=pending, got %s", body.Status.LinkStatus,
|
||||
)
|
||||
}
|
||||
},
|
||||
wantErr: false,
|
||||
@@ -262,7 +281,9 @@ func TestThirdPartyLink_Insert(t *testing.T) {
|
||||
tpl := NewThirdPartyLink(opts...)
|
||||
var buf bytes.Buffer
|
||||
if err := tpl.Insert(&buf); (err != nil) != tt.wantErr {
|
||||
t.Errorf("ThirdPartyLink.Insert() error = %v, wantErr %v", err, tt.wantErr)
|
||||
t.Errorf(
|
||||
"ThirdPartyLink.Insert() error = %v, wantErr %v", err, tt.wantErr,
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
@@ -296,7 +317,7 @@ func TestThirdPartyLink_Update(t *testing.T) {
|
||||
LinkStatus string `json:"linkStatus"`
|
||||
} `json:"status"`
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
|
||||
if err := json.UnmarshalRead(r.Body, &body); err != nil {
|
||||
t.Fatalf("failed to decode request body: %v", err)
|
||||
}
|
||||
|
||||
@@ -304,7 +325,9 @@ func TestThirdPartyLink_Update(t *testing.T) {
|
||||
t.Errorf("expected linkingToken=token123, got %s", body.LinkingToken)
|
||||
}
|
||||
if body.Status.LinkStatus != "linked" {
|
||||
t.Errorf("expected status.linkStatus=linked, got %s", body.Status.LinkStatus)
|
||||
t.Errorf(
|
||||
"expected status.linkStatus=linked, got %s", body.Status.LinkStatus,
|
||||
)
|
||||
}
|
||||
},
|
||||
wantErr: false,
|
||||
@@ -319,11 +342,13 @@ func TestThirdPartyLink_Update(t *testing.T) {
|
||||
func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
if r.Method == "GET" {
|
||||
_, _ = w.Write([]byte(`{
|
||||
_, _ = w.Write(
|
||||
[]byte(`{
|
||||
"items": [
|
||||
{"linkingToken": "token123", "snippet": {"type": "channelToStoreLink"}, "status": {"linkStatus": "pending"}}
|
||||
]
|
||||
}`))
|
||||
}`),
|
||||
)
|
||||
return
|
||||
}
|
||||
if tt.verify != nil {
|
||||
@@ -338,7 +363,9 @@ func TestThirdPartyLink_Update(t *testing.T) {
|
||||
tpl := NewThirdPartyLink(opts...)
|
||||
var buf bytes.Buffer
|
||||
if err := tpl.Update(&buf); (err != nil) != tt.wantErr {
|
||||
t.Errorf("ThirdPartyLink.Update() error = %v, wantErr %v", err, tt.wantErr)
|
||||
t.Errorf(
|
||||
"ThirdPartyLink.Update() error = %v, wantErr %v", err, tt.wantErr,
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
@@ -363,10 +390,15 @@ func TestThirdPartyLink_Delete(t *testing.T) {
|
||||
t.Errorf("expected DELETE, got %s", r.Method)
|
||||
}
|
||||
if r.URL.Query().Get("linkingToken") != "token123" {
|
||||
t.Errorf("expected linkingToken=token123, got %s", r.URL.Query().Get("linkingToken"))
|
||||
t.Errorf(
|
||||
"expected linkingToken=token123, got %s",
|
||||
r.URL.Query().Get("linkingToken"),
|
||||
)
|
||||
}
|
||||
if r.URL.Query().Get("type") != "channelToStoreLink" {
|
||||
t.Errorf("expected type=channelToStoreLink, got %s", r.URL.Query().Get("type"))
|
||||
t.Errorf(
|
||||
"expected type=channelToStoreLink, got %s", r.URL.Query().Get("type"),
|
||||
)
|
||||
}
|
||||
},
|
||||
wantErr: false,
|
||||
@@ -391,7 +423,9 @@ func TestThirdPartyLink_Delete(t *testing.T) {
|
||||
tpl := NewThirdPartyLink(opts...)
|
||||
var buf bytes.Buffer
|
||||
if err := tpl.Delete(&buf); (err != nil) != tt.wantErr {
|
||||
t.Errorf("ThirdPartyLink.Delete() error = %v, wantErr %v", err, tt.wantErr)
|
||||
t.Errorf(
|
||||
"ThirdPartyLink.Delete() error = %v, wantErr %v", err, tt.wantErr,
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
+4
-3
@@ -7,7 +7,8 @@ import (
|
||||
"bufio"
|
||||
"crypto/rand"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"encoding/json/jsontext"
|
||||
"encoding/json/v2"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -39,7 +40,7 @@ var IsInteractive = func(v any) bool {
|
||||
func PrintJSON(data any, writer io.Writer) {
|
||||
var marshalled []byte
|
||||
if IsInteractive(writer) {
|
||||
marshalled, _ = json.MarshalIndent(data, "", " ")
|
||||
marshalled, _ = json.Marshal(data, jsontext.WithIndent(" "))
|
||||
} else {
|
||||
marshalled, _ = json.Marshal(data)
|
||||
}
|
||||
@@ -81,7 +82,7 @@ func GetFileName(file string) string {
|
||||
}
|
||||
|
||||
func IsJson(s string) bool {
|
||||
var js json.RawMessage
|
||||
var js jsontext.Value
|
||||
return json.Unmarshal([]byte(s), &js) == nil
|
||||
}
|
||||
|
||||
|
||||
+60
-21
@@ -5,7 +5,7 @@ package video
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"encoding/json/v2"
|
||||
"io"
|
||||
"math"
|
||||
"mime"
|
||||
@@ -546,7 +546,7 @@ func TestVideo_Insert(t *testing.T) {
|
||||
defer func() { _ = part.Close() }()
|
||||
|
||||
var body youtube.Video
|
||||
if err := json.NewDecoder(part).Decode(&body); err != nil {
|
||||
if err := json.UnmarshalRead(part, &body); err != nil {
|
||||
t.Fatalf("failed to decode video from request body: %v", err)
|
||||
}
|
||||
return &body
|
||||
@@ -650,11 +650,17 @@ func TestVideo_Insert(t *testing.T) {
|
||||
t.Errorf("expected POST, got %s", r.Method)
|
||||
}
|
||||
if !strings.Contains(r.URL.Query().Get("part"), "recordingDetails") {
|
||||
t.Errorf("expected part to contain recordingDetails, got %s", r.URL.Query().Get("part"))
|
||||
t.Errorf(
|
||||
"expected part to contain recordingDetails, got %s",
|
||||
r.URL.Query().Get("part"),
|
||||
)
|
||||
}
|
||||
body := decodeMultipartVideo(t, r)
|
||||
if body.RecordingDetails == nil || body.RecordingDetails.RecordingDate != "2024-06-15T10:00:00Z" {
|
||||
t.Errorf("expected recordingDetails.recordingDate=2024-06-15T10:00:00Z, got %+v", body.RecordingDetails)
|
||||
t.Errorf(
|
||||
"expected recordingDetails.recordingDate=2024-06-15T10:00:00Z, got %+v",
|
||||
body.RecordingDetails,
|
||||
)
|
||||
}
|
||||
if body.Status == nil || !body.Status.SelfDeclaredMadeForKids {
|
||||
t.Errorf("expected status.selfDeclaredMadeForKids=true")
|
||||
@@ -683,7 +689,10 @@ func TestVideo_Insert(t *testing.T) {
|
||||
}
|
||||
body := decodeMultipartVideo(t, r)
|
||||
if body.Snippet == nil || body.Snippet.Title != "test_video" {
|
||||
t.Errorf("expected snippet.title=test_video (from filename), got %+v", body.Snippet)
|
||||
t.Errorf(
|
||||
"expected snippet.title=test_video (from filename), got %+v",
|
||||
body.Snippet,
|
||||
)
|
||||
}
|
||||
},
|
||||
wantErr: false,
|
||||
@@ -708,7 +717,10 @@ func TestVideo_Insert(t *testing.T) {
|
||||
}
|
||||
}
|
||||
if count != 1 {
|
||||
t.Errorf("expected exactly 1 yutu🐰 tag, got %d in %v", count, body.Snippet.Tags)
|
||||
t.Errorf(
|
||||
"expected exactly 1 yutu🐰 tag, got %d in %v", count,
|
||||
body.Snippet.Tags,
|
||||
)
|
||||
}
|
||||
},
|
||||
wantErr: false,
|
||||
@@ -725,7 +737,9 @@ func TestVideo_Insert(t *testing.T) {
|
||||
defer func() { pkg.Root = oldRoot }()
|
||||
defer func() { _ = root.Close() }()
|
||||
|
||||
err = os.WriteFile(tmpDir+"/test_video.mp4", []byte("dummy video content"), 0644)
|
||||
err = os.WriteFile(
|
||||
tmpDir+"/test_video.mp4", []byte("dummy video content"), 0644,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create dummy file: %v", err)
|
||||
}
|
||||
@@ -814,7 +828,7 @@ func TestVideo_Update(t *testing.T) {
|
||||
}
|
||||
|
||||
var body youtube.Video
|
||||
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
|
||||
if err := json.UnmarshalRead(r.Body, &body); err != nil {
|
||||
t.Fatalf("failed to decode update body: %v", err)
|
||||
}
|
||||
if body.Id != "video-id" {
|
||||
@@ -871,20 +885,27 @@ func TestVideo_Update(t *testing.T) {
|
||||
verify: func(r *http.Request) {
|
||||
if r.Method == "PUT" {
|
||||
var body youtube.Video
|
||||
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
|
||||
if err := json.UnmarshalRead(r.Body, &body); err != nil {
|
||||
t.Fatalf("failed to decode update body: %v", err)
|
||||
}
|
||||
if body.Snippet.DefaultLanguage != "ja" {
|
||||
t.Errorf("expected defaultLanguage=ja, got %s", body.Snippet.DefaultLanguage)
|
||||
t.Errorf(
|
||||
"expected defaultLanguage=ja, got %s", body.Snippet.DefaultLanguage,
|
||||
)
|
||||
}
|
||||
if body.Status.License != "creativeCommon" {
|
||||
t.Errorf("expected license=creativeCommon, got %s", body.Status.License)
|
||||
t.Errorf(
|
||||
"expected license=creativeCommon, got %s", body.Status.License,
|
||||
)
|
||||
}
|
||||
if body.Snippet.CategoryId != "22" {
|
||||
t.Errorf("expected categoryId=22, got %s", body.Snippet.CategoryId)
|
||||
}
|
||||
if body.Status.PrivacyStatus != "unlisted" {
|
||||
t.Errorf("expected privacyStatus=unlisted, got %s", body.Status.PrivacyStatus)
|
||||
t.Errorf(
|
||||
"expected privacyStatus=unlisted, got %s",
|
||||
body.Status.PrivacyStatus,
|
||||
)
|
||||
}
|
||||
found := false
|
||||
for _, tag := range body.Snippet.Tags {
|
||||
@@ -910,14 +931,20 @@ func TestVideo_Update(t *testing.T) {
|
||||
verify: func(r *http.Request) {
|
||||
if r.Method == "PUT" {
|
||||
var body youtube.Video
|
||||
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
|
||||
if err := json.UnmarshalRead(r.Body, &body); err != nil {
|
||||
t.Fatalf("failed to decode update body: %v", err)
|
||||
}
|
||||
if body.Status.PublishAt != "2026-08-18T15:00:00Z" {
|
||||
t.Errorf("expected publishAt=2026-08-18T15:00:00Z, got %s", body.Status.PublishAt)
|
||||
t.Errorf(
|
||||
"expected publishAt=2026-08-18T15:00:00Z, got %s",
|
||||
body.Status.PublishAt,
|
||||
)
|
||||
}
|
||||
if body.Status.PrivacyStatus != "private" {
|
||||
t.Errorf("expected privacyStatus=private when scheduling, got %s", body.Status.PrivacyStatus)
|
||||
t.Errorf(
|
||||
"expected privacyStatus=private when scheduling, got %s",
|
||||
body.Status.PrivacyStatus,
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -935,14 +962,20 @@ func TestVideo_Update(t *testing.T) {
|
||||
verify: func(r *http.Request) {
|
||||
if r.Method == "PUT" {
|
||||
var body youtube.Video
|
||||
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
|
||||
if err := json.UnmarshalRead(r.Body, &body); err != nil {
|
||||
t.Fatalf("failed to decode update body: %v", err)
|
||||
}
|
||||
if body.Status.PublishAt != "2026-08-18T15:00:00Z" {
|
||||
t.Errorf("expected publishAt=2026-08-18T15:00:00Z, got %s", body.Status.PublishAt)
|
||||
t.Errorf(
|
||||
"expected publishAt=2026-08-18T15:00:00Z, got %s",
|
||||
body.Status.PublishAt,
|
||||
)
|
||||
}
|
||||
if body.Status.PrivacyStatus != "private" {
|
||||
t.Errorf("expected privacyStatus=private when scheduling, got %s", body.Status.PrivacyStatus)
|
||||
t.Errorf(
|
||||
"expected privacyStatus=private when scheduling, got %s",
|
||||
body.Status.PrivacyStatus,
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -991,10 +1024,13 @@ func TestVideo_Update(t *testing.T) {
|
||||
verify: func(r *http.Request) {
|
||||
if r.Method == "PUT" {
|
||||
if !strings.Contains(r.URL.Query().Get("part"), "recordingDetails") {
|
||||
t.Errorf("expected part to contain recordingDetails, got %s", r.URL.Query().Get("part"))
|
||||
t.Errorf(
|
||||
"expected part to contain recordingDetails, got %s",
|
||||
r.URL.Query().Get("part"),
|
||||
)
|
||||
}
|
||||
var body youtube.Video
|
||||
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
|
||||
if err := json.UnmarshalRead(r.Body, &body); err != nil {
|
||||
t.Fatalf("failed to decode update body: %v", err)
|
||||
}
|
||||
if !body.Status.Embeddable {
|
||||
@@ -1004,7 +1040,10 @@ func TestVideo_Update(t *testing.T) {
|
||||
t.Errorf("expected containsSyntheticMedia=true")
|
||||
}
|
||||
if body.RecordingDetails == nil || body.RecordingDetails.RecordingDate != "2024-01-01T00:00:00Z" {
|
||||
t.Errorf("expected recordingDate=2024-01-01T00:00:00Z, got %+v", body.RecordingDetails)
|
||||
t.Errorf(
|
||||
"expected recordingDate=2024-01-01T00:00:00Z, got %+v",
|
||||
body.RecordingDetails,
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user