implements favorites/playlist deletion
This commit is contained in:
@@ -103,6 +103,13 @@ struct API
|
||||
.post()
|
||||
}
|
||||
|
||||
public func deleteFavorite(mediaURL: String) async throws {
|
||||
try await request()
|
||||
.pathString("/favorites/\(mediaURL.uriEncoded())")
|
||||
.method(.delete)
|
||||
.execute()
|
||||
}
|
||||
|
||||
public func delete(index: Int) async throws {
|
||||
try await request()
|
||||
.path("/playlist/\(index)")
|
||||
@@ -214,3 +221,10 @@ struct API
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension String
|
||||
{
|
||||
func uriEncoded() -> Self {
|
||||
return addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)!
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user