mirror of
https://github.com/navidrome/navidrome.git
synced 2026-08-31 07:30:32 +00:00
refactor(plugins): update JSON field names to camelCase for consistency
Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
parent
7afe906d11
commit
1b589f292f
@ -193,28 +193,28 @@ Integrates with external scrobbling services. Export one or more of these functi
|
||||
|
||||
| Function | Input | Output | Description |
|
||||
|------------------------------|-----------------------|-------------------------|-----------------------------|
|
||||
| `nd_scrobbler_is_authorized` | `{user_id, username}` | `{authorized}` | Check if user is authorized |
|
||||
| `nd_scrobbler_now_playing` | See below | `{error?, error_type?}` | Send now playing |
|
||||
| `nd_scrobbler_scrobble` | See below | `{error?, error_type?}` | Submit a scrobble |
|
||||
| `nd_scrobbler_is_authorized` | `{userId, username}` | `{authorized}` | Check if user is authorized |
|
||||
| `nd_scrobbler_now_playing` | See below | `{error?, errorType?}` | Send now playing |
|
||||
| `nd_scrobbler_scrobble` | See below | `{error?, errorType?}` | Submit a scrobble |
|
||||
|
||||
**NowPlaying/Scrobble Input:**
|
||||
|
||||
```json
|
||||
{
|
||||
"user_id": "abc123",
|
||||
"userId": "abc123",
|
||||
"username": "john",
|
||||
"track": {
|
||||
"id": "track-id",
|
||||
"title": "Song Title",
|
||||
"album": "Album Name",
|
||||
"artist": "Artist Name",
|
||||
"album_artist": "Album Artist",
|
||||
"albumArtist": "Album Artist",
|
||||
"duration": 180.5,
|
||||
"track_number": 1,
|
||||
"disc_number": 1,
|
||||
"mbz_recording_id": "...",
|
||||
"mbz_album_id": "...",
|
||||
"mbz_artist_id": "..."
|
||||
"trackNumber": 1,
|
||||
"discNumber": 1,
|
||||
"mbzRecordingId": "...",
|
||||
"mbzAlbumId": "...",
|
||||
"mbzArtistId": "..."
|
||||
},
|
||||
"timestamp": 1703270400
|
||||
}
|
||||
@ -225,12 +225,12 @@ Integrates with external scrobbling services. Export one or more of these functi
|
||||
```json
|
||||
{
|
||||
"error": "error message",
|
||||
"error_type": "not_authorized|retry_later|unrecoverable"
|
||||
"errorType": "notAuthorized|retryLater|unrecoverable"
|
||||
}
|
||||
```
|
||||
|
||||
- `not_authorized` – User needs to re-authorize
|
||||
- `retry_later` – Temporary failure, Navidrome will retry
|
||||
- `notAuthorized` – User needs to re-authorize
|
||||
- `retryLater` – Temporary failure, Navidrome will retry
|
||||
- `unrecoverable` – Permanent failure, scrobble discarded
|
||||
|
||||
On success, return empty JSON `{}` or omit output entirely.
|
||||
@ -301,17 +301,17 @@ Schedule one-time or recurring tasks. Your plugin must export `nd_scheduler_call
|
||||
|
||||
| Function | Parameters | Description |
|
||||
|-------------------------------|------------------------------------------|-----------------------------|
|
||||
| `scheduler_scheduleonetime` | `delay_seconds, payload, schedule_id?` | Schedule one-time callback |
|
||||
| `scheduler_schedulerecurring` | `cron_expression, payload, schedule_id?` | Schedule recurring callback |
|
||||
| `scheduler_cancelschedule` | `schedule_id` | Cancel a scheduled task |
|
||||
| `scheduler_scheduleonetime` | `delaySeconds, payload, scheduleId?` | Schedule one-time callback |
|
||||
| `scheduler_schedulerecurring` | `cronExpression, payload, scheduleId?` | Schedule recurring callback |
|
||||
| `scheduler_cancelschedule` | `scheduleId` | Cancel a scheduled task |
|
||||
|
||||
**Callback function:**
|
||||
|
||||
```go
|
||||
type SchedulerCallbackInput struct {
|
||||
ScheduleID string `json:"schedule_id"`
|
||||
ScheduleID string `json:"scheduleId"`
|
||||
Payload string `json:"payload"`
|
||||
IsRecurring bool `json:"is_recurring"`
|
||||
IsRecurring bool `json:"isRecurring"`
|
||||
}
|
||||
|
||||
//go:wasmexport nd_scheduler_callback
|
||||
@ -478,19 +478,19 @@ Establish persistent WebSocket connections to external services.
|
||||
|
||||
| Function | Parameters | Description |
|
||||
|------------------------|---------------------------------|-------------------|
|
||||
| `websocket_connect` | `url, headers?, connection_id?` | Open a connection |
|
||||
| `websocket_sendtext` | `connection_id, message` | Send text message |
|
||||
| `websocket_sendbinary` | `connection_id, data` | Send binary data |
|
||||
| `websocket_close` | `connection_id, code?, reason?` | Close connection |
|
||||
| `websocket_connect` | `url, headers?, connectionId?` | Open a connection |
|
||||
| `websocket_sendtext` | `connectionId, message` | Send text message |
|
||||
| `websocket_sendbinary` | `connectionId, data` | Send binary data |
|
||||
| `websocket_close` | `connectionId, code?, reason?` | Close connection |
|
||||
|
||||
**Callback functions (export these to receive events):**
|
||||
|
||||
| Function | Input | Description |
|
||||
|----------------------------------|---------------------------------|----------------------------------|
|
||||
| `nd_websocket_on_text_message` | `{connection_id, message}` | Text message received |
|
||||
| `nd_websocket_on_binary_message` | `{connection_id, data}` | Binary message received (base64) |
|
||||
| `nd_websocket_on_error` | `{connection_id, error}` | Connection error |
|
||||
| `nd_websocket_on_close` | `{connection_id, code, reason}` | Connection closed |
|
||||
| `nd_websocket_on_text_message` | `{connectionId, message}` | Text message received |
|
||||
| `nd_websocket_on_binary_message` | `{connectionId, data}` | Binary message received (base64) |
|
||||
| `nd_websocket_on_error` | `{connectionId, error}` | Connection error |
|
||||
| `nd_websocket_on_close` | `{connectionId, code, reason}` | Connection closed |
|
||||
|
||||
### Library
|
||||
|
||||
|
||||
@ -216,9 +216,9 @@ func NdWebsocketOnClose(input OnCloseInput) (OnCloseOutput, error) {
|
||||
|
||||
// Scheduler callback input/output types
|
||||
type SchedulerCallbackInput struct {
|
||||
ScheduleId string `json:"schedule_id"`
|
||||
ScheduleId string `json:"scheduleId"`
|
||||
Payload string `json:"payload"`
|
||||
IsRecurring bool `json:"is_recurring"`
|
||||
IsRecurring bool `json:"isRecurring"`
|
||||
}
|
||||
|
||||
type SchedulerCallbackOutput struct {
|
||||
|
||||
@ -128,7 +128,7 @@ func _NdWebsocketOnTextMessage() int32 {
|
||||
// Input provided when a binary message is received
|
||||
type OnBinaryMessageInput struct {
|
||||
// The unique identifier for the WebSocket connection that received the message.
|
||||
ConnectionId string `json:"connection_id"`
|
||||
ConnectionId string `json:"connectionId"`
|
||||
// The binary data received from the WebSocket, encoded as base64.
|
||||
Data string `json:"data"`
|
||||
}
|
||||
@ -145,7 +145,7 @@ type OnCloseInput struct {
|
||||
// 1001 for going away, 1006 for abnormal closure).
|
||||
Code int32 `json:"code"`
|
||||
// The unique identifier for the WebSocket connection that was closed.
|
||||
ConnectionId string `json:"connection_id"`
|
||||
ConnectionId string `json:"connectionId"`
|
||||
// The human-readable reason for the connection closure, if provided.
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
@ -159,7 +159,7 @@ type OnCloseOutput struct {
|
||||
// Input provided when an error occurs on a WebSocket connection
|
||||
type OnErrorInput struct {
|
||||
// The unique identifier for the WebSocket connection where the error occurred.
|
||||
ConnectionId string `json:"connection_id"`
|
||||
ConnectionId string `json:"connectionId"`
|
||||
// The error message describing what went wrong.
|
||||
Error string `json:"error"`
|
||||
}
|
||||
@ -173,7 +173,7 @@ type OnErrorOutput struct {
|
||||
// Input provided when a text message is received
|
||||
type OnTextMessageInput struct {
|
||||
// The unique identifier for the WebSocket connection that received the message.
|
||||
ConnectionId string `json:"connection_id"`
|
||||
ConnectionId string `json:"connectionId"`
|
||||
// The text message content received from the WebSocket.
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
@ -77,6 +77,7 @@ fn get_image_url(track_id: &str) -> String {
|
||||
// ============================================================================
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct AuthInput {
|
||||
#[allow(dead_code)]
|
||||
user_id: String,
|
||||
@ -89,6 +90,7 @@ struct AuthOutput {
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[allow(dead_code)]
|
||||
struct TrackInfo {
|
||||
id: String,
|
||||
@ -108,6 +110,7 @@ struct TrackInfo {
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[allow(dead_code)]
|
||||
struct NowPlayingInput {
|
||||
user_id: String,
|
||||
@ -117,6 +120,7 @@ struct NowPlayingInput {
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[allow(dead_code)]
|
||||
struct ScrobbleInput {
|
||||
user_id: String,
|
||||
@ -126,6 +130,7 @@ struct ScrobbleInput {
|
||||
}
|
||||
|
||||
#[derive(Serialize, Default)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct ScrobblerOutput {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
error: Option<String>,
|
||||
@ -141,6 +146,7 @@ const ERROR_TYPE_RETRY_LATER: &str = "retry_later";
|
||||
// ============================================================================
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[allow(dead_code)]
|
||||
struct SchedulerCallbackInput {
|
||||
schedule_id: String,
|
||||
@ -159,6 +165,7 @@ struct SchedulerCallbackOutput {
|
||||
// ============================================================================
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[allow(dead_code)]
|
||||
struct OnTextMessageInput {
|
||||
connection_id: String,
|
||||
@ -172,6 +179,7 @@ struct OnTextMessageOutput {
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[allow(dead_code)]
|
||||
struct OnBinaryMessageInput {
|
||||
connection_id: String,
|
||||
@ -185,6 +193,7 @@ struct OnBinaryMessageOutput {
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[allow(dead_code)]
|
||||
struct OnErrorInput {
|
||||
connection_id: String,
|
||||
@ -198,6 +207,7 @@ struct OnErrorOutput {
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[allow(dead_code)]
|
||||
struct OnCloseInput {
|
||||
connection_id: String,
|
||||
|
||||
@ -86,6 +86,7 @@ struct HelloMessage {
|
||||
struct GatewayResponse {
|
||||
op: i32,
|
||||
#[serde(default)]
|
||||
#[allow(dead_code)]
|
||||
d: Option<serde_json::Value>,
|
||||
#[serde(default)]
|
||||
s: Option<i64>,
|
||||
|
||||
@ -195,7 +195,7 @@ func _NdWebsocketOnClose() int32 {
|
||||
// AuthInput is the input for authorization check
|
||||
type AuthInput struct {
|
||||
// The internal Navidrome user ID
|
||||
UserId string `json:"user_id"`
|
||||
UserId string `json:"userId"`
|
||||
// The username of the user
|
||||
Username string `json:"username"`
|
||||
}
|
||||
@ -213,7 +213,7 @@ type NowPlayingInput struct {
|
||||
// The track currently playing
|
||||
Track TrackInfo `json:"track"`
|
||||
// The internal Navidrome user ID
|
||||
UserId string `json:"user_id"`
|
||||
UserId string `json:"userId"`
|
||||
// The username of the user
|
||||
Username string `json:"username"`
|
||||
}
|
||||
@ -225,7 +225,7 @@ type ScrobbleInput struct {
|
||||
// The track that was played
|
||||
Track TrackInfo `json:"track"`
|
||||
// The internal Navidrome user ID
|
||||
UserId string `json:"user_id"`
|
||||
UserId string `json:"userId"`
|
||||
// The username of the user
|
||||
Username string `json:"username"`
|
||||
}
|
||||
@ -275,7 +275,7 @@ type ScrobblerOutput struct {
|
||||
// Error message if the operation failed
|
||||
Error *string `json:"error,omitempty"`
|
||||
// Type of error for handling
|
||||
ErrorType ScrobblerErrorType `json:"error_type,omitempty"`
|
||||
ErrorType ScrobblerErrorType `json:"errorType,omitempty"`
|
||||
}
|
||||
|
||||
// TrackInfo contains track metadata for scrobbling
|
||||
@ -283,31 +283,31 @@ type TrackInfo struct {
|
||||
// Album name
|
||||
Album string `json:"album"`
|
||||
// Album artist
|
||||
AlbumArtist string `json:"album_artist"`
|
||||
AlbumArtist string `json:"albumArtist"`
|
||||
// Track artist
|
||||
Artist string `json:"artist"`
|
||||
// Disc number
|
||||
DiscNumber int32 `json:"disc_number"`
|
||||
DiscNumber int32 `json:"discNumber"`
|
||||
// Track duration in seconds
|
||||
Duration float32 `json:"duration"`
|
||||
// The internal Navidrome track ID
|
||||
Id string `json:"id"`
|
||||
// MusicBrainz album artist ID
|
||||
MbzAlbumArtistId *string `json:"mbz_album_artist_id,omitempty"`
|
||||
MbzAlbumArtistId *string `json:"mbzAlbumArtistId,omitempty"`
|
||||
// MusicBrainz album/release ID
|
||||
MbzAlbumId *string `json:"mbz_album_id,omitempty"`
|
||||
MbzAlbumId *string `json:"mbzAlbumId,omitempty"`
|
||||
// MusicBrainz artist ID
|
||||
MbzArtistId *string `json:"mbz_artist_id,omitempty"`
|
||||
MbzArtistId *string `json:"mbzArtistId,omitempty"`
|
||||
// MusicBrainz recording ID
|
||||
MbzRecordingId *string `json:"mbz_recording_id,omitempty"`
|
||||
MbzRecordingId *string `json:"mbzRecordingId,omitempty"`
|
||||
// MusicBrainz release group ID
|
||||
MbzReleaseGroupId *string `json:"mbz_release_group_id,omitempty"`
|
||||
MbzReleaseGroupId *string `json:"mbzReleaseGroupId,omitempty"`
|
||||
// MusicBrainz release track ID
|
||||
MbzReleaseTrackId *string `json:"mbz_release_track_id,omitempty"`
|
||||
MbzReleaseTrackId *string `json:"mbzReleaseTrackId,omitempty"`
|
||||
// Track title
|
||||
Title string `json:"title"`
|
||||
// Track number on the album
|
||||
TrackNumber int32 `json:"track_number"`
|
||||
TrackNumber int32 `json:"trackNumber"`
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@ -318,13 +318,13 @@ type TrackInfo struct {
|
||||
type SchedulerCallbackInput struct {
|
||||
// True if this is a recurring schedule (created via ScheduleRecurring),
|
||||
// false if it's a one-time schedule (created via ScheduleOneTime).
|
||||
IsRecurring bool `json:"is_recurring"`
|
||||
IsRecurring bool `json:"isRecurring"`
|
||||
// The payload data that was provided when the task was scheduled.
|
||||
// Can be used to pass context or parameters to the callback handler.
|
||||
Payload string `json:"payload"`
|
||||
// The unique identifier for this scheduled task. This is either the ID
|
||||
// provided when scheduling, or an auto-generated UUID if none was specified.
|
||||
ScheduleId string `json:"schedule_id"`
|
||||
ScheduleId string `json:"scheduleId"`
|
||||
}
|
||||
|
||||
// SchedulerCallbackOutput is the output from the scheduler callback
|
||||
@ -342,7 +342,7 @@ type SchedulerCallbackOutput struct {
|
||||
// OnTextMessageInput is provided when a text message is received
|
||||
type OnTextMessageInput struct {
|
||||
// The unique identifier for the WebSocket connection that received the message.
|
||||
ConnectionId string `json:"connection_id"`
|
||||
ConnectionId string `json:"connectionId"`
|
||||
// The text message content received from the WebSocket.
|
||||
Message string `json:"message"`
|
||||
}
|
||||
@ -356,7 +356,7 @@ type OnTextMessageOutput struct {
|
||||
// OnBinaryMessageInput is provided when a binary message is received
|
||||
type OnBinaryMessageInput struct {
|
||||
// The unique identifier for the WebSocket connection that received the message.
|
||||
ConnectionId string `json:"connection_id"`
|
||||
ConnectionId string `json:"connectionId"`
|
||||
// The binary data received from the WebSocket, encoded as base64.
|
||||
Data string `json:"data"`
|
||||
}
|
||||
@ -370,7 +370,7 @@ type OnBinaryMessageOutput struct {
|
||||
// OnErrorInput is provided when an error occurs on a WebSocket connection
|
||||
type OnErrorInput struct {
|
||||
// The unique identifier for the WebSocket connection where the error occurred.
|
||||
ConnectionId string `json:"connection_id"`
|
||||
ConnectionId string `json:"connectionId"`
|
||||
// The error message describing what went wrong.
|
||||
Error string `json:"error"`
|
||||
}
|
||||
@ -387,7 +387,7 @@ type OnCloseInput struct {
|
||||
// 1001 for going away, 1006 for abnormal closure).
|
||||
Code int32 `json:"code"`
|
||||
// The unique identifier for the WebSocket connection that was closed.
|
||||
ConnectionId string `json:"connection_id"`
|
||||
ConnectionId string `json:"connectionId"`
|
||||
// The human-readable reason for the connection closure, if provided.
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
@ -38,18 +38,6 @@ struct Library {
|
||||
total_duration: f64,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct LibraryGetLibraryRequest {
|
||||
id: i32,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct LibraryGetLibraryResponse {
|
||||
result: Option<Library>,
|
||||
#[serde(default)]
|
||||
error: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct LibraryGetAllLibrariesResponse {
|
||||
result: Option<Vec<Library>>,
|
||||
@ -79,6 +67,7 @@ struct SchedulerScheduleRecurringResponse {
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct SchedulerCallbackInput {
|
||||
schedule_id: String,
|
||||
payload: String,
|
||||
|
||||
@ -126,7 +126,7 @@ def nd_on_init():
|
||||
def nd_scheduler_callback():
|
||||
"""Handle scheduler callback - check and log now playing tracks."""
|
||||
input_data = extism.input_json()
|
||||
schedule_id = input_data.get("schedule_id", "")
|
||||
schedule_id = input_data.get("scheduleId", "")
|
||||
|
||||
# Only handle our schedule
|
||||
if schedule_id != SCHEDULE_ID:
|
||||
|
||||
@ -20,6 +20,7 @@ use serde::{Deserialize, Serialize};
|
||||
// ============================================================================
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct AuthInput {
|
||||
user_id: String,
|
||||
username: String,
|
||||
@ -31,6 +32,7 @@ struct AuthOutput {
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[allow(dead_code)] // Fields are deserialized from JSON but not all are used
|
||||
struct TrackInfo {
|
||||
id: String,
|
||||
@ -50,6 +52,7 @@ struct TrackInfo {
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[allow(dead_code)] // Fields are deserialized from JSON but not all are used
|
||||
struct NowPlayingInput {
|
||||
user_id: String,
|
||||
@ -59,6 +62,7 @@ struct NowPlayingInput {
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[allow(dead_code)] // Fields are deserialized from JSON but not all are used
|
||||
struct ScrobbleInput {
|
||||
user_id: String,
|
||||
@ -68,6 +72,7 @@ struct ScrobbleInput {
|
||||
}
|
||||
|
||||
#[derive(Serialize, Default)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct ScrobblerOutput {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
error: Option<String>,
|
||||
|
||||
@ -164,9 +164,9 @@ func (s *schedulerServiceImpl) Close() error {
|
||||
|
||||
// schedulerCallbackInput is the input format for the nd_scheduler_callback function.
|
||||
type schedulerCallbackInput struct {
|
||||
ScheduleID string `json:"schedule_id"`
|
||||
ScheduleID string `json:"scheduleId"`
|
||||
Payload string `json:"payload"`
|
||||
IsRecurring bool `json:"is_recurring"`
|
||||
IsRecurring bool `json:"isRecurring"`
|
||||
}
|
||||
|
||||
// schedulerCallbackOutput is the output format for the nd_scheduler_callback function.
|
||||
|
||||
@ -320,22 +320,22 @@ func (s *webSocketServiceImpl) readLoop(ctx context.Context, connectionID string
|
||||
// Callback input/output types
|
||||
|
||||
type onTextMessageInput struct {
|
||||
ConnectionID string `json:"connection_id"`
|
||||
ConnectionID string `json:"connectionId"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
type onBinaryMessageInput struct {
|
||||
ConnectionID string `json:"connection_id"`
|
||||
ConnectionID string `json:"connectionId"`
|
||||
Data string `json:"data"` // base64 encoded
|
||||
}
|
||||
|
||||
type onErrorInput struct {
|
||||
ConnectionID string `json:"connection_id"`
|
||||
ConnectionID string `json:"connectionId"`
|
||||
Error string `json:"error"`
|
||||
}
|
||||
|
||||
type onCloseInput struct {
|
||||
ConnectionID string `json:"connection_id"`
|
||||
ConnectionID string `json:"connectionId"`
|
||||
Code int32 `json:"code"`
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ components:
|
||||
SchedulerCallbackInput:
|
||||
description: Input provided to the scheduler callback when a scheduled task fires
|
||||
properties:
|
||||
schedule_id:
|
||||
scheduleId:
|
||||
type: string
|
||||
description: |
|
||||
The unique identifier for this scheduled task. This is either the ID
|
||||
@ -27,15 +27,15 @@ components:
|
||||
description: |
|
||||
The payload data that was provided when the task was scheduled.
|
||||
Can be used to pass context or parameters to the callback handler.
|
||||
is_recurring:
|
||||
isRecurring:
|
||||
type: boolean
|
||||
description: |
|
||||
True if this is a recurring schedule (created via ScheduleRecurring),
|
||||
false if it's a one-time schedule (created via ScheduleOneTime).
|
||||
required:
|
||||
- schedule_id
|
||||
- scheduleId
|
||||
- payload
|
||||
- is_recurring
|
||||
- isRecurring
|
||||
|
||||
SchedulerCallbackOutput:
|
||||
description: Output from the scheduler callback
|
||||
|
||||
@ -33,14 +33,14 @@ components:
|
||||
AuthInput:
|
||||
description: Input for authorization check
|
||||
properties:
|
||||
user_id:
|
||||
userId:
|
||||
type: string
|
||||
description: The internal Navidrome user ID
|
||||
username:
|
||||
type: string
|
||||
description: The username of the user
|
||||
required:
|
||||
- user_id
|
||||
- userId
|
||||
- username
|
||||
|
||||
AuthOutput:
|
||||
@ -67,42 +67,42 @@ components:
|
||||
artist:
|
||||
type: string
|
||||
description: Track artist
|
||||
album_artist:
|
||||
albumArtist:
|
||||
type: string
|
||||
description: Album artist
|
||||
duration:
|
||||
type: number
|
||||
format: float
|
||||
description: Track duration in seconds
|
||||
track_number:
|
||||
trackNumber:
|
||||
type: integer
|
||||
format: int32
|
||||
description: Track number on the album
|
||||
disc_number:
|
||||
discNumber:
|
||||
type: integer
|
||||
format: int32
|
||||
description: Disc number
|
||||
mbz_recording_id:
|
||||
mbzRecordingId:
|
||||
type: string
|
||||
nullable: true
|
||||
description: MusicBrainz recording ID
|
||||
mbz_album_id:
|
||||
mbzAlbumId:
|
||||
type: string
|
||||
nullable: true
|
||||
description: MusicBrainz album/release ID
|
||||
mbz_artist_id:
|
||||
mbzArtistId:
|
||||
type: string
|
||||
nullable: true
|
||||
description: MusicBrainz artist ID
|
||||
mbz_release_group_id:
|
||||
mbzReleaseGroupId:
|
||||
type: string
|
||||
nullable: true
|
||||
description: MusicBrainz release group ID
|
||||
mbz_album_artist_id:
|
||||
mbzAlbumArtistId:
|
||||
type: string
|
||||
nullable: true
|
||||
description: MusicBrainz album artist ID
|
||||
mbz_release_track_id:
|
||||
mbzReleaseTrackId:
|
||||
type: string
|
||||
nullable: true
|
||||
description: MusicBrainz release track ID
|
||||
@ -111,15 +111,15 @@ components:
|
||||
- title
|
||||
- album
|
||||
- artist
|
||||
- album_artist
|
||||
- albumArtist
|
||||
- duration
|
||||
- track_number
|
||||
- disc_number
|
||||
- trackNumber
|
||||
- discNumber
|
||||
|
||||
NowPlayingInput:
|
||||
description: Input for now playing notification
|
||||
properties:
|
||||
user_id:
|
||||
userId:
|
||||
type: string
|
||||
description: The internal Navidrome user ID
|
||||
username:
|
||||
@ -133,7 +133,7 @@ components:
|
||||
format: int32
|
||||
description: Current playback position in seconds
|
||||
required:
|
||||
- user_id
|
||||
- userId
|
||||
- username
|
||||
- track
|
||||
- position
|
||||
@ -141,7 +141,7 @@ components:
|
||||
ScrobbleInput:
|
||||
description: Input for submitting a scrobble
|
||||
properties:
|
||||
user_id:
|
||||
userId:
|
||||
type: string
|
||||
description: The internal Navidrome user ID
|
||||
username:
|
||||
@ -155,7 +155,7 @@ components:
|
||||
format: int64
|
||||
description: Unix timestamp when the track started playing
|
||||
required:
|
||||
- user_id
|
||||
- userId
|
||||
- username
|
||||
- track
|
||||
- timestamp
|
||||
@ -167,7 +167,7 @@ components:
|
||||
type: string
|
||||
nullable: true
|
||||
description: Error message if the operation failed
|
||||
error_type:
|
||||
errorType:
|
||||
$ref: "#/components/schemas/ScrobblerErrorType"
|
||||
nullable: true
|
||||
description: Type of error for handling
|
||||
|
||||
@ -54,7 +54,7 @@ components:
|
||||
OnTextMessageInput:
|
||||
description: Input provided when a text message is received
|
||||
properties:
|
||||
connection_id:
|
||||
connectionId:
|
||||
type: string
|
||||
description: |
|
||||
The unique identifier for the WebSocket connection that received the message.
|
||||
@ -63,7 +63,7 @@ components:
|
||||
description: |
|
||||
The text message content received from the WebSocket.
|
||||
required:
|
||||
- connection_id
|
||||
- connectionId
|
||||
- message
|
||||
|
||||
OnTextMessageOutput:
|
||||
@ -79,7 +79,7 @@ components:
|
||||
OnBinaryMessageInput:
|
||||
description: Input provided when a binary message is received
|
||||
properties:
|
||||
connection_id:
|
||||
connectionId:
|
||||
type: string
|
||||
description: |
|
||||
The unique identifier for the WebSocket connection that received the message.
|
||||
@ -89,7 +89,7 @@ components:
|
||||
description: |
|
||||
The binary data received from the WebSocket, encoded as base64.
|
||||
required:
|
||||
- connection_id
|
||||
- connectionId
|
||||
- data
|
||||
|
||||
OnBinaryMessageOutput:
|
||||
@ -105,7 +105,7 @@ components:
|
||||
OnErrorInput:
|
||||
description: Input provided when an error occurs on a WebSocket connection
|
||||
properties:
|
||||
connection_id:
|
||||
connectionId:
|
||||
type: string
|
||||
description: |
|
||||
The unique identifier for the WebSocket connection where the error occurred.
|
||||
@ -114,7 +114,7 @@ components:
|
||||
description: |
|
||||
The error message describing what went wrong.
|
||||
required:
|
||||
- connection_id
|
||||
- connectionId
|
||||
- error
|
||||
|
||||
OnErrorOutput:
|
||||
@ -130,7 +130,7 @@ components:
|
||||
OnCloseInput:
|
||||
description: Input provided when a WebSocket connection is closed
|
||||
properties:
|
||||
connection_id:
|
||||
connectionId:
|
||||
type: string
|
||||
description: |
|
||||
The unique identifier for the WebSocket connection that was closed.
|
||||
@ -145,7 +145,7 @@ components:
|
||||
description: |
|
||||
The human-readable reason for the connection closure, if provided.
|
||||
required:
|
||||
- connection_id
|
||||
- connectionId
|
||||
- code
|
||||
- reason
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ package plugins
|
||||
|
||||
// scrobblerAuthInput is the input for IsAuthorized
|
||||
type scrobblerAuthInput struct {
|
||||
UserID string `json:"user_id"`
|
||||
UserID string `json:"userId"`
|
||||
Username string `json:"username"`
|
||||
}
|
||||
|
||||
@ -19,21 +19,21 @@ type scrobblerTrackInfo struct {
|
||||
Title string `json:"title"`
|
||||
Album string `json:"album"`
|
||||
Artist string `json:"artist"`
|
||||
AlbumArtist string `json:"album_artist"`
|
||||
AlbumArtist string `json:"albumArtist"`
|
||||
Duration float32 `json:"duration"`
|
||||
TrackNumber int `json:"track_number"`
|
||||
DiscNumber int `json:"disc_number"`
|
||||
MbzRecordingID string `json:"mbz_recording_id,omitempty"`
|
||||
MbzAlbumID string `json:"mbz_album_id,omitempty"`
|
||||
MbzArtistID string `json:"mbz_artist_id,omitempty"`
|
||||
MbzReleaseGroupID string `json:"mbz_release_group_id,omitempty"`
|
||||
MbzAlbumArtistID string `json:"mbz_album_artist_id,omitempty"`
|
||||
MbzReleaseTrackID string `json:"mbz_release_track_id,omitempty"`
|
||||
TrackNumber int `json:"trackNumber"`
|
||||
DiscNumber int `json:"discNumber"`
|
||||
MbzRecordingID string `json:"mbzRecordingId,omitempty"`
|
||||
MbzAlbumID string `json:"mbzAlbumId,omitempty"`
|
||||
MbzArtistID string `json:"mbzArtistId,omitempty"`
|
||||
MbzReleaseGroupID string `json:"mbzReleaseGroupId,omitempty"`
|
||||
MbzAlbumArtistID string `json:"mbzAlbumArtistId,omitempty"`
|
||||
MbzReleaseTrackID string `json:"mbzReleaseTrackId,omitempty"`
|
||||
}
|
||||
|
||||
// scrobblerNowPlayingInput is the input for NowPlaying
|
||||
type scrobblerNowPlayingInput struct {
|
||||
UserID string `json:"user_id"`
|
||||
UserID string `json:"userId"`
|
||||
Username string `json:"username"`
|
||||
Track scrobblerTrackInfo `json:"track"`
|
||||
Position int `json:"position"`
|
||||
@ -41,7 +41,7 @@ type scrobblerNowPlayingInput struct {
|
||||
|
||||
// scrobblerScrobbleInput is the input for Scrobble
|
||||
type scrobblerScrobbleInput struct {
|
||||
UserID string `json:"user_id"`
|
||||
UserID string `json:"userId"`
|
||||
Username string `json:"username"`
|
||||
Track scrobblerTrackInfo `json:"track"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
@ -50,7 +50,7 @@ type scrobblerScrobbleInput struct {
|
||||
// scrobblerOutput is the output for NowPlaying and Scrobble
|
||||
type scrobblerOutput struct {
|
||||
Error string `json:"error,omitempty"`
|
||||
ErrorType string `json:"error_type,omitempty"` // "none", "not_authorized", "retry_later", "unrecoverable"
|
||||
ErrorType string `json:"errorType,omitempty"` // "none", "notAuthorized", "retryLater", "unrecoverable"
|
||||
}
|
||||
|
||||
// scrobbler error type constants
|
||||
|
||||
4
plugins/testdata/test-scheduler/pdk.gen.go
vendored
4
plugins/testdata/test-scheduler/pdk.gen.go
vendored
@ -39,13 +39,13 @@ func _NdSchedulerCallback() int32 {
|
||||
type SchedulerCallbackInput struct {
|
||||
// True if this is a recurring schedule (created via ScheduleRecurring),
|
||||
// false if it's a one-time schedule (created via ScheduleOneTime).
|
||||
IsRecurring bool `json:"is_recurring"`
|
||||
IsRecurring bool `json:"isRecurring"`
|
||||
// The payload data that was provided when the task was scheduled.
|
||||
// Can be used to pass context or parameters to the callback handler.
|
||||
Payload string `json:"payload"`
|
||||
// The unique identifier for this scheduled task. This is either the ID
|
||||
// provided when scheduling, or an auto-generated UUID if none was specified.
|
||||
ScheduleId string `json:"schedule_id"`
|
||||
ScheduleId string `json:"scheduleId"`
|
||||
}
|
||||
|
||||
// Output from the scheduler callback
|
||||
|
||||
22
plugins/testdata/test-scrobbler/main.go
vendored
22
plugins/testdata/test-scrobbler/main.go
vendored
@ -11,7 +11,7 @@ import (
|
||||
// Scrobbler input/output types
|
||||
|
||||
type AuthInput struct {
|
||||
UserID string `json:"user_id"`
|
||||
UserID string `json:"userId"`
|
||||
Username string `json:"username"`
|
||||
}
|
||||
|
||||
@ -24,25 +24,25 @@ type TrackInfo struct {
|
||||
Title string `json:"title"`
|
||||
Album string `json:"album"`
|
||||
Artist string `json:"artist"`
|
||||
AlbumArtist string `json:"album_artist"`
|
||||
AlbumArtist string `json:"albumArtist"`
|
||||
Duration float32 `json:"duration"`
|
||||
TrackNumber int `json:"track_number"`
|
||||
DiscNumber int `json:"disc_number"`
|
||||
MbzRecordingID string `json:"mbz_recording_id,omitempty"`
|
||||
MbzAlbumID string `json:"mbz_album_id,omitempty"`
|
||||
MbzArtistID string `json:"mbz_artist_id,omitempty"`
|
||||
MbzReleaseGroupID string `json:"mbz_release_group_id,omitempty"`
|
||||
TrackNumber int `json:"trackNumber"`
|
||||
DiscNumber int `json:"discNumber"`
|
||||
MbzRecordingID string `json:"mbzRecordingId,omitempty"`
|
||||
MbzAlbumID string `json:"mbzAlbumId,omitempty"`
|
||||
MbzArtistID string `json:"mbzArtistId,omitempty"`
|
||||
MbzReleaseGroupID string `json:"mbzReleaseGroupId,omitempty"`
|
||||
}
|
||||
|
||||
type NowPlayingInput struct {
|
||||
UserID string `json:"user_id"`
|
||||
UserID string `json:"userId"`
|
||||
Username string `json:"username"`
|
||||
Track TrackInfo `json:"track"`
|
||||
Position int `json:"position"`
|
||||
}
|
||||
|
||||
type ScrobbleInput struct {
|
||||
UserID string `json:"user_id"`
|
||||
UserID string `json:"userId"`
|
||||
Username string `json:"username"`
|
||||
Track TrackInfo `json:"track"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
@ -50,7 +50,7 @@ type ScrobbleInput struct {
|
||||
|
||||
type ScrobblerOutput struct {
|
||||
Error string `json:"error,omitempty"`
|
||||
ErrorType string `json:"error_type,omitempty"`
|
||||
ErrorType string `json:"errorType,omitempty"`
|
||||
}
|
||||
|
||||
// checkConfigError checks if the plugin is configured to return an error.
|
||||
|
||||
8
plugins/testdata/test-websocket/main.go
vendored
8
plugins/testdata/test-websocket/main.go
vendored
@ -8,7 +8,7 @@ import (
|
||||
|
||||
// OnTextMessageInput is the input for nd_websocket_on_text_message callback.
|
||||
type OnTextMessageInput struct {
|
||||
ConnectionID string `json:"connection_id"`
|
||||
ConnectionID string `json:"connectionId"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ func ndWebSocketOnTextMessage() int32 {
|
||||
|
||||
// OnBinaryMessageInput is the input for nd_websocket_on_binary_message callback.
|
||||
type OnBinaryMessageInput struct {
|
||||
ConnectionID string `json:"connection_id"`
|
||||
ConnectionID string `json:"connectionId"`
|
||||
Data string `json:"data"` // Base64 encoded
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ func ndWebSocketOnBinaryMessage() int32 {
|
||||
|
||||
// OnErrorInput is the input for nd_websocket_on_error callback.
|
||||
type OnErrorInput struct {
|
||||
ConnectionID string `json:"connection_id"`
|
||||
ConnectionID string `json:"connectionId"`
|
||||
Error string `json:"error"`
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ func ndWebSocketOnError() int32 {
|
||||
|
||||
// OnCloseInput is the input for nd_websocket_on_close callback.
|
||||
type OnCloseInput struct {
|
||||
ConnectionID string `json:"connection_id"`
|
||||
ConnectionID string `json:"connectionId"`
|
||||
Code int `json:"code"`
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user