Skip to content

Commit d89e403

Browse files
committed
document actual funcs
Signed-off-by: Adam Ratzman <[email protected]>
1 parent e4e6b61 commit d89e403

File tree

15 files changed

+45
-2
lines changed

15 files changed

+45
-2
lines changed

src/androidMain/kotlin/com/adamratzman/spotify/Pkce.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import android.os.Build.VERSION_CODES
66
import android.util.Base64
77
import java.security.MessageDigest
88

9+
/**
10+
* A utility to get the pkce code challenge for a corresponding code verifier. Only available on JVM/Android
11+
*/
912
public actual fun getSpotifyPkceCodeChallenge(codeVerifier: String): String {
1013
val sha256 = MessageDigest.getInstance("SHA-256").digest(codeVerifier.toByteArray())
1114
return if (VERSION.SDK_INT >= VERSION_CODES.O) {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
/* Spotify Web API, Kotlin Wrapper; MIT License, 2017-2021; Original author: Adam Ratzman */
22
package com.adamratzman.spotify.utils
33

4+
/**
5+
* Represents a unit of time
6+
*/
47
public actual typealias TimeUnit = java.util.concurrent.TimeUnit
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
/* Spotify Web API, Kotlin Wrapper; MIT License, 2017-2021; Original author: Adam Ratzman */
22
package com.adamratzman.spotify.utils
33

4+
/**
5+
* The current time in milliseconds since UNIX epoch.
6+
*/
47
public actual fun getCurrentTimeMs(): Long = System.currentTimeMillis()
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
/* Spotify Web API, Kotlin Wrapper; MIT License, 2017-2021; Original author: Adam Ratzman */
22
package com.adamratzman.spotify.utils
33

4+
/**
5+
* Actual platform that this program is run on.
6+
*/
47
public actual val platform: Platform = Platform.ANDROID

src/commonMain/kotlin/com.adamratzman.spotify/utils/Concurrency.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
/* Spotify Web API, Kotlin Wrapper; MIT License, 2017-2021; Original author: Adam Ratzman */
22
package com.adamratzman.spotify.utils
33

4+
/**
5+
* Represents a unit of time
6+
*/
47
public expect enum class TimeUnit {
58
MILLISECONDS, SECONDS;
69

src/commonMain/kotlin/com.adamratzman.spotify/utils/Utils.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import kotlinx.datetime.TimeZone
88
import kotlinx.datetime.toLocalDateTime
99
import kotlinx.serialization.json.JsonElement
1010

11+
/**
12+
* The current time in milliseconds since UNIX epoch.
13+
*/
1114
public expect fun getCurrentTimeMs(): Long
1215

1316
internal fun jsonMap(vararg pairs: Pair<String, JsonElement>) = pairs.toMap().toMutableMap()

src/desktopMain/kotlin/com/adamratzman/spotify/utils/Concurrency.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
/* Spotify Web API, Kotlin Wrapper; MIT License, 2017-2021; Original author: Adam Ratzman */
22
package com.adamratzman.spotify.utils
33

4-
@Suppress("unused")
4+
/**
5+
* Represents a unit of time
6+
*/
57
public actual enum class TimeUnit(public val multiplier: Int) {
68
MILLISECONDS(1), SECONDS(1000), MINUTES(60000);
79

src/desktopMain/kotlin/com/adamratzman/spotify/utils/Misc.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ package com.adamratzman.spotify.utils
33

44
import kotlin.system.getTimeMillis
55

6+
/**
7+
* The current time in milliseconds since UNIX epoch.
8+
*/
69
public actual fun getCurrentTimeMs(): Long {
710
return getTimeMillis()
811
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
/* Spotify Web API, Kotlin Wrapper; MIT License, 2017-2021; Original author: Adam Ratzman */
22
package com.adamratzman.spotify.utils
33

4+
/**
5+
* Actual platform that this program is run on.
6+
*/
47
public actual val platform: Platform = Platform.NATIVE

src/jsMain/kotlin/com/adamratzman/spotify/utils/Concurrency.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
/* Spotify Web API, Kotlin Wrapper; MIT License, 2017-2021; Original author: Adam Ratzman */
22
package com.adamratzman.spotify.utils
33

4-
@Suppress("unused")
4+
/**
5+
* Represents a unit of time
6+
*/
57
public actual enum class TimeUnit(public val multiplier: Int) {
68
MILLISECONDS(1), SECONDS(1000), MINUTES(60000);
79

0 commit comments

Comments
 (0)