diff --git a/Sources/VRCKit/Protocols/AuthenticationServiceProtocol.swift b/Sources/VRCKit/Protocols/AuthenticationServiceProtocol.swift index 2809106..65e9c28 100644 --- a/Sources/VRCKit/Protocols/AuthenticationServiceProtocol.swift +++ b/Sources/VRCKit/Protocols/AuthenticationServiceProtocol.swift @@ -13,10 +13,7 @@ public protocol AuthenticationServiceProtocol: Sendable { func exists(userId: String) async throws -> Bool /// Fetches the authenticated user's information or determines if two-factor authentication (2FA) verification is required. - /// /// - Returns: An `Either` result, which is `.left(User)` if the user is successfully authenticated, - /// or `.right(VerifyType)` if two-factor authentication is needed. - /// /// - Throws: An error if the request fails or if the response cannot be decoded. If an unexpected decoding issue occurs, /// it throws `VRCKitError.unexpected`. func loginUserInfo() async throws -> Either diff --git a/Sources/VRCKit/Protocols/WorldServiceProtocol.swift b/Sources/VRCKit/Protocols/WorldServiceProtocol.swift index 3b7674c..ee7bd5a 100644 --- a/Sources/VRCKit/Protocols/WorldServiceProtocol.swift +++ b/Sources/VRCKit/Protocols/WorldServiceProtocol.swift @@ -6,6 +6,23 @@ // public protocol WorldServiceProtocol: Sendable { + /// Fetches detailed information about a specific world. + /// - Parameter worldId: The ID of the world to retrieve. + /// - Returns: A `World` object containing the details of the specified world. + /// - Throws: An error if the request fails or decoding is unsuccessful. func fetchWorld(worldId: String) async throws -> World + + /// Retrieves the list of favorited worlds. + /// - Returns: An array of `FavoriteWorld` objects representing the user's favorited worlds. + /// - Throws: An error if any request fails or decoding is unsuccessful. func fetchFavoritedWorlds() async throws -> [FavoriteWorld] + + /// Fetches a paginated list of favorited worlds. + /// This function retrieves a subset of favorited worlds based on the specified limit and offset. + /// - Parameters: + /// - n: The maximum number of worlds to retrieve in the current request. + /// - offset: The offset used to paginate the results. + /// - Returns: An array of `FavoriteWorld` objects representing a subset of favorited worlds. + /// - Throws: An error if the request fails or decoding is unsuccessful. + func fetchFavoritedWorlds(n: Int, offset: Int) async throws -> [FavoriteWorld] } diff --git a/Sources/VRCKit/Services/WorldService.swift b/Sources/VRCKit/Services/WorldService.swift index 0873078..715e7c7 100644 --- a/Sources/VRCKit/Services/WorldService.swift +++ b/Sources/VRCKit/Services/WorldService.swift @@ -38,7 +38,7 @@ public final actor WorldService: APIService, WorldServiceProtocol { } } - private func fetchFavoritedWorlds(n: Int, offset: Int) async throws -> [FavoriteWorld] { + public func fetchFavoritedWorlds(n: Int, offset: Int) async throws -> [FavoriteWorld] { let queryItems = [ URLQueryItem(name: "n", value: n.description), URLQueryItem(name: "offset", value: offset.description)