Skip to content

Commit a69ed30

Browse files
committed
feat: add updateFavoriteGroup method to FavoriteServiceProtocol
1 parent af2df8a commit a69ed30

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

Sources/VRCKit/Protocols/FavoriteServiceProtocol.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,12 @@ public protocol FavoriteServiceProtocol: Sendable {
1010
func listFavorites(n: Int, type: FavoriteType, tag: String?) async throws -> [Favorite]
1111
func fetchFavoriteGroupDetails(favoriteGroups: [FavoriteGroup]) async throws -> [FavoriteDetail]
1212
func addFavorite(type: FavoriteType, favoriteId: String, tag: String) async throws -> Favorite
13+
func updateFavoriteGroup(
14+
type: FavoriteType,
15+
displayName: String,
16+
visibility: FavoriteGroup.Visibility,
17+
userId: String,
18+
tag: String
19+
) async throws -> SuccessResponse
1320
func removeFavorite(favoriteId: String) async throws -> SuccessResponse
1421
}

Sources/VRCKit/Services/FavoriteService.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,15 @@ public final actor FavoriteService: APIService, FavoriteServiceProtocol {
9494

9595
public func updateFavoriteGroup(
9696
type: FavoriteType,
97-
favoriteGroupType: FavoriteType,
98-
favoriteGroupName: String,
97+
displayName: String,
9998
visibility: FavoriteGroup.Visibility,
10099
userId: String,
101100
tag: String
102-
) async throws -> SuccessResponse {
103-
let paths = ["favorite", "groups", favoriteGroupType.rawValue, favoriteGroupName, userId]
101+
) async throws -> SuccessResponse {
102+
let paths = ["favorite", "groups", type.rawValue, displayName, userId]
104103
let path = paths.joined(separator: "/")
105104
let requestData = try await Serializer.shared.encode(
106-
RequestToUpdateFavoriteGroup(displayName: favoriteGroupName, visibility: visibility, tags: [tag])
105+
RequestToUpdateFavoriteGroup(displayName: displayName, visibility: visibility, tags: [tag])
107106
)
108107
let response = try await client.request(path: path, method: .put, body: requestData)
109108
return try await Serializer.shared.decode(response.data)

0 commit comments

Comments
 (0)