Skip to content

Commit

Permalink
Add activity/history and media/playlist schemas (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
tahpot authored Nov 25, 2024
2 parents 5876010 + a8e96c3 commit f3495f6
Show file tree
Hide file tree
Showing 2 changed files with 205 additions and 0 deletions.
76 changes: 76 additions & 0 deletions activity/history/v0.1.0/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://common.schemas.verida.io/activity/history/v0.1.0/schema.json",
"title": "History",
"titlePlural": "Histories",
"description": "General history of activities such as listening, watching, browsing, etc.",
"type": "object",
"appearance": {
"style": {
"color": "#4A90E2",
"icon": "./icon.svg"
}
},
"database": {
"name": "activity_history",
"indexes": {
"name": ["name", "activityType", "timestamp"],
"insertedAt": ["insertedAt"],
"timestamp": ["timestamp"],
"source": ["sourceApplication", "sourceId"]
}
},
"layouts": {
"create": [
"name",
"timestamp",
"activityType"
],
"view": [
"name",
"timestamp",
"activityType",
"duration",
"summary",
"url",
"sourceApplication",
"sourceId"
]
},
"allOf": [
{
"$ref": "https://core.schemas.verida.io/base/v0.1.0/schema.json"
},
{
"properties": {
"timestamp": {
"title": "Timestamp",
"description": "When the activity occurred",
"type": "string",
"format": "date-time"
},
"activityType": {
"title": "Activity Type",
"description": "Type of activity (e.g., listening, watching, browsing)",
"type": "string",
"enum": ["listening", "watching", "browsing", "reading"]
},
"url": {
"title": "URL",
"description": "The link of source information"
},
"duration": {
"title": "Duration",
"description": "Duration of the activity in seconds",
"type": "integer",
"minimum": 0
}
},
"required": [
"name",
"timestamp",
"activityType"
]
}
]
}
129 changes: 129 additions & 0 deletions media/playlist/v0.1.0/schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://common.schemas.verida.io/media/playlist/v0.1.0/schema.json",
"title": "Playlist",
"titlePlural": "Playlists",
"description": "A generic schema for playlists from platforms like Spotify, YouTube, etc.",
"type": "object",
"appearance": {
"style": {
"color": "#1DB954",
"icon": "./icon.svg"
}
},
"database": {
"name": "media_playlist",
"indexes": {
"name": ["name"],
"source": ["sourceApplication", "sourceId"]
}
},
"layouts": {
"create": [
"name",
"type"
],
"view": [
"name",
"type",
"tracks"
]
},
"$defs": {
"type": {
"type": "string",
"enum": ["audio", "video"],
"title": "Type",
"description": "Type of the playlist or track, either audio or video"
},
"person": {
"type": "object",
"title": "Person",
"description": "Schema representing a person",
"properties": {
"email": {
"type": "string",
"format": "email",
"description": "Email address of the person"
},
"displayName": {
"type": "string",
"description": "Display name of the person"
}
},
"required": ["displayName"]
},
"track": {
"type": "object",
"title": "Track",
"description": "Schema representing a track or video in the playlist",
"properties": {
"id": {
"title": "Track ID",
"description": "Unique identifier for the track/video",
"type": "string"
},
"title": {
"title": "Title",
"description": "Title of the track/video",
"type": "string"
},
"artist": {
"title": "Artist/Creator",
"description": "Name of the artist or content creator",
"type": "string"
},
"album": {
"title": "Album",
"description": "Album name (if applicable, e.g., for Spotify)",
"type": "string"
},
"thumbnail": {
"title": "Thumbnail",
"description": "URL of the thumbnail image",
"type": "string",
"format": "uri"
},
"duration": {
"title": "Duration",
"description": "Duration of the track/video in milliseconds",
"type": "integer"
},
"url": {
"title": "URL",
"description": "Direct URL to the track/video",
"type": "string",
"format": "uri"
},
"type": {
"$ref": "#/$defs/type"
}
},
"required": ["id", "title"]
}
},
"allOf": [
{
"$ref": "https://core.schemas.verida.io/base/v0.1.0/schema.json"
},
{
"properties": {
"type": {
"$ref": "#/$defs/type"
},
"owner": {
"$ref": "#/$defs/person"
},
"tracks": {
"type": "array",
"title": "Tracks",
"description": "Array of track or video items in the playlist",
"items": {
"$ref": "#/$defs/track"
}
}
},
"required": ["name", "type"]
}
]
}

0 comments on commit f3495f6

Please sign in to comment.