-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add protocol module with types (#122)
* add protocol module with types * update yarn.lock * maybe fix publishing of protocol module * add default values, make some fields nullable & rename ExtendedAudioTrack -> ExtendedTrackInfo * remove unused dependency & update readme * revert yarn.lock change
- Loading branch information
Showing
4 changed files
with
99 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
plugins { | ||
id "java-library" | ||
id "org.jetbrains.kotlin.multiplatform" | ||
id "org.jetbrains.kotlin.plugin.serialization" | ||
} | ||
|
||
archivesBaseName = "lavasrc-protocol" | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_11 | ||
} | ||
|
||
kotlin { | ||
jvm { | ||
compilations.all { | ||
kotlinOptions.jvmTarget = "11" | ||
} | ||
} | ||
js(IR) { | ||
nodejs() | ||
} | ||
|
||
publishing { | ||
publications { | ||
maven(MavenPublication) { | ||
artifactId archivesBaseName | ||
} | ||
} | ||
} | ||
|
||
sourceSets { | ||
commonMain { | ||
dependencies { | ||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1") | ||
} | ||
} | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
protocol/src/commonMain/kotlin/com/github/topi314/lavasrc/protocol/Protocol.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.github.topi314.lavasrc.protocol | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ExtendedPlaylistInfo( | ||
val type: Type = Type.PLAYLIST, | ||
val url: String? = null, | ||
val artworkUrl: String? = null, | ||
val author: String? = null, | ||
val totalTracks: Int? = null, | ||
) { | ||
/** | ||
* The type of the originating track list. | ||
*/ | ||
@Serializable | ||
enum class Type { | ||
/** | ||
* A playlist from a music service. | ||
*/ | ||
@SerialName("playlist") | ||
PLAYLIST, | ||
|
||
/** | ||
* An album listed on a music service. | ||
*/ | ||
@SerialName("album") | ||
ALBUM, | ||
|
||
/** | ||
* An auto-generated playlist about an author from a music service. | ||
*/ | ||
@SerialName("artist") | ||
ARTIST, | ||
|
||
/** | ||
* Recommendations from a music service (currently only Spotify). | ||
*/ | ||
@SerialName("recommendations") | ||
RECOMMENDATIONS | ||
} | ||
} | ||
|
||
@Serializable | ||
data class ExtendedTrackInfo( | ||
val albumName: String? = null, | ||
val albumUrl: String? = null, | ||
val artistUrl: String? = null, | ||
val artistArtworkUrl: String? = null, | ||
val previewUrl: String? = null, | ||
val isPreview: Boolean = false | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") | |
|
||
include(":main") | ||
include(":plugin") | ||
include(":protocol") |