mirror of
https://github.com/yattee/yattee.git
synced 2025-08-06 10:44:06 +00:00
Editing playlists
This commit is contained in:
@@ -54,7 +54,7 @@ final class InvidiousAPI: Service {
|
||||
content.json.arrayValue.map(Playlist.init)
|
||||
}
|
||||
|
||||
configureTransformer("/auth/playlists", requestMethods: [.post]) { (content: Entity<Data>) -> Playlist in
|
||||
configureTransformer("/auth/playlists", requestMethods: [.post, .patch]) { (content: Entity<Data>) -> Playlist in
|
||||
// hacky, to verify if possible to get it in easier way
|
||||
Playlist(JSON(parseJSON: String(data: content.content, encoding: .utf8)!))
|
||||
}
|
||||
@@ -108,6 +108,10 @@ final class InvidiousAPI: Service {
|
||||
resource("/auth/playlists")
|
||||
}
|
||||
|
||||
func playlist(_ id: String) -> Resource {
|
||||
resource("/auth/playlists/\(id)")
|
||||
}
|
||||
|
||||
func search(_ query: SearchQuery) -> Resource {
|
||||
var resource = resource("/search")
|
||||
.withParam("q", searchQuery(query.query))
|
||||
|
@@ -4,19 +4,19 @@ import SwiftyJSON
|
||||
struct Playlist: Identifiable, Equatable, Hashable {
|
||||
let id: String
|
||||
var title: String
|
||||
var description: String
|
||||
var visibility: PlaylistVisibility
|
||||
|
||||
var videos = [Video]()
|
||||
|
||||
init(_ json: JSON) {
|
||||
id = json["playlistId"].stringValue
|
||||
title = json["title"].stringValue
|
||||
description = json["description"].stringValue
|
||||
visibility = json["isListed"].boolValue ? .public : .private
|
||||
videos = json["videos"].arrayValue.map { Video($0) }
|
||||
}
|
||||
|
||||
static func == (lhs: Playlist, rhs: Playlist) -> Bool {
|
||||
lhs.id == rhs.id
|
||||
lhs.id == rhs.id && lhs.title == rhs.title && lhs.visibility == rhs.visibility
|
||||
}
|
||||
|
||||
func hash(into hasher: inout Hasher) {
|
||||
|
Reference in New Issue
Block a user