Skip to content

Commit

Permalink
Added date parameter to scrobble method
Browse files Browse the repository at this point in the history
  • Loading branch information
tfmart committed Jun 28, 2024
1 parent 364bacb commit 93769b0
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import Foundation

extension SBKManager {

public func scrobble(track: String, artist: String, album: String?) async throws -> SBKScrobbleResponse {
public func scrobble(track: String, artist: String, album: String?, date: Date = Date()) async throws -> SBKScrobbleResponse {
guard let sessionKey else { throw SBKClientError.missingSessionKey }
let service = ScrobbleService(
artist: artist,
track: track,
album: album,
date: Date(),
date: date,
sessionKey: sessionKey,
apiKey: self.apiKey,
secretKey: self.secret
Expand All @@ -28,7 +28,7 @@ extension SBKManager {
}
}

public func scrobble(track: String, artist: String, album: String?, _ completion: ((SBKScrobbleResponse?, Error?) -> Void)? = nil) {
public func scrobble(track: String, artist: String, album: String?, date: Date = Date(), _ completion: ((SBKScrobbleResponse?, Error?) -> Void)? = nil) {
guard let sessionKey else {
completion?(nil, SBKClientError.missingSessionKey)
return
Expand All @@ -37,7 +37,7 @@ extension SBKManager {
artist: artist,
track: track,
album: album,
date: Date(),
date: date,
sessionKey: sessionKey,
apiKey: self.apiKey,
secretKey: self.secret
Expand Down

0 comments on commit 93769b0

Please sign in to comment.