diff --git a/Sources/VRCKit/Services/AuthenticationService.swift b/Sources/VRCKit/Services/AuthenticationService.swift index 93f94da..6d2a2c0 100644 --- a/Sources/VRCKit/Services/AuthenticationService.swift +++ b/Sources/VRCKit/Services/AuthenticationService.swift @@ -20,7 +20,7 @@ public final actor AuthenticationService: APIService, AuthenticationServiceProto let path = "\(authPath)/exists" let queryItems = [URLQueryItem(name: "username", value: userId.description)] let response = try await client.request(path: path, method: .get, queryItems: queryItems) - let result: ExistsResponse = try await Serializer.shared.decode(response.data) + let result: ExistsResponse = try Serializer.shared.decode(response.data) return result.userExists } @@ -30,10 +30,10 @@ public final actor AuthenticationService: APIService, AuthenticationServiceProto let path = "\(authPath)/user" let response = try await client.request(path: path, method: .get, basic: true) do { - let user: User = try await Serializer.shared.decode(response.data) + let user: User = try Serializer.shared.decode(response.data) return .left(user) } catch _ as DecodingError { - let result: RequiresTwoFactorAuthResponse = try await Serializer.shared.decode(response.data) + let result: RequiresTwoFactorAuthResponse = try Serializer.shared.decode(response.data) guard let requires = result.requires else { throw VRCKitError.unexpected } @@ -49,13 +49,13 @@ public final actor AuthenticationService: APIService, AuthenticationServiceProto public func verify2FA(verifyType: VerifyType, code: String) async throws -> Bool { guard code.count == 6 else { throw VRCKitError.invalidRequest("Code must be 6 digits") } let path = "\(authPath)/twofactorauth/\(verifyType.rawValue.lowercased())/verify" - let requestData = try await Serializer.shared.encode(VerifyRequest(code: code)) + let requestData = try Serializer.shared.encode(VerifyRequest(code: code)) let response = try await client.request( path: path, method: .post, body: requestData ) - let result: VerifyResponse = try await Serializer.shared.decode(response.data) + let result: VerifyResponse = try Serializer.shared.decode(response.data) return result.verified } @@ -63,7 +63,7 @@ public final actor AuthenticationService: APIService, AuthenticationServiceProto /// - Returns: A boolean indicating if the token is valid. public func verifyAuthToken() async throws -> Bool { let response = try await client.request(path: authPath, method: .get) - let result: VerifyAuthTokenResponse = try await Serializer.shared.decode(response.data) + let result: VerifyAuthTokenResponse = try Serializer.shared.decode(response.data) return result.ok } diff --git a/Sources/VRCKit/Services/FavoriteService.swift b/Sources/VRCKit/Services/FavoriteService.swift index 3818eed..13dbe5b 100644 --- a/Sources/VRCKit/Services/FavoriteService.swift +++ b/Sources/VRCKit/Services/FavoriteService.swift @@ -19,7 +19,7 @@ public final actor FavoriteService: APIService, FavoriteServiceProtocol { public func listFavoriteGroups() async throws -> [FavoriteGroup] { let path = "favorite/groups" let response = try await client.request(path: path, method: .get) - return try await Serializer.shared.decode(response.data) + return try Serializer.shared.decode(response.data) } /// Lists a user's all favorites with the specified parameters. @@ -63,7 +63,7 @@ public final actor FavoriteService: APIService, FavoriteServiceProtocol { queryItems.append(URLQueryItem(name: "tag", value: tag.description)) } let response = try await client.request(path: path, method: .get, queryItems: queryItems) - return try await Serializer.shared.decode(response.data) + return try Serializer.shared.decode(response.data) } /// Fetches details of favorite groups asynchronously. @@ -100,11 +100,11 @@ public final actor FavoriteService: APIService, FavoriteServiceProtocol { tag: String ) async throws -> Favorite { let path = "favorites" - let requestData = try await Serializer.shared.encode( + let requestData = try Serializer.shared.encode( RequestToAddFavorite(type: type, favoriteId: favoriteId, tags: [tag]) ) let response = try await client.request(path: path, method: .post, body: requestData) - return try await Serializer.shared.decode(response.data) + return try Serializer.shared.decode(response.data) } /// Updates a favorite group with the given parameters, display name, and visibility. @@ -123,7 +123,7 @@ public final actor FavoriteService: APIService, FavoriteServiceProtocol { let pathParams = ["favorite", "group", source.type.rawValue, source.name, source.ownerId] let path = pathParams.joined(separator: "/") let body = RequestToUpdateFavoriteGroup(displayName: displayName, visibility: visibility) - let requestData = try await Serializer.shared.encode(body) + let requestData = try Serializer.shared.encode(body) _ = try await client.request(path: path, method: .put, body: requestData) } @@ -133,6 +133,6 @@ public final actor FavoriteService: APIService, FavoriteServiceProtocol { public func removeFavorite(favoriteId: String) async throws -> SuccessResponse { let path = "favorites/\(favoriteId)" let response = try await client.request(path: path, method: .delete) - return try await Serializer.shared.decode(response.data) + return try Serializer.shared.decode(response.data) } } diff --git a/Sources/VRCKit/Services/FriendService.swift b/Sources/VRCKit/Services/FriendService.swift index 77444ce..12f0b9d 100644 --- a/Sources/VRCKit/Services/FriendService.swift +++ b/Sources/VRCKit/Services/FriendService.swift @@ -21,7 +21,7 @@ public final actor FriendService: APIService, FriendServiceProtocol { URLQueryItem(name: "offline", value: offline.description) ] let response = try await client.request(path: path, method: .get, queryItems: queryItems) - return try await Serializer.shared.decode(response.data) + return try Serializer.shared.decode(response.data) } /// A helper function that splits a large API request tasks to fetch friend data concurrently, diff --git a/Sources/VRCKit/Services/InstanceService.swift b/Sources/VRCKit/Services/InstanceService.swift index 8f07f6b..546db24 100644 --- a/Sources/VRCKit/Services/InstanceService.swift +++ b/Sources/VRCKit/Services/InstanceService.swift @@ -23,7 +23,7 @@ public final actor InstanceService: APIService, InstanceServiceProtocol { path: "\(path)/\(worldId):\(instanceId)", method: .get ) - return try await Serializer.shared.decode(response.data) + return try Serializer.shared.decode(response.data) } /// Fetches an instance using the specified location string. @@ -32,6 +32,6 @@ public final actor InstanceService: APIService, InstanceServiceProtocol { /// - Throws: An error if the request fails or the data cannot be decoded. public func fetchInstance(location: String) async throws -> Instance { let response = try await client.request(path: "\(path)/\(location)", method: .get) - return try await Serializer.shared.decode(response.data) + return try Serializer.shared.decode(response.data) } } diff --git a/Sources/VRCKit/Services/UserNoteService.swift b/Sources/VRCKit/Services/UserNoteService.swift index 5923767..2264051 100644 --- a/Sources/VRCKit/Services/UserNoteService.swift +++ b/Sources/VRCKit/Services/UserNoteService.swift @@ -24,7 +24,7 @@ public final actor UserNoteService: APIService, UserNoteServiceProtocol { let response = try await request( userNote: UserNoteRequest(targetUserId: targetUserId, note: note) ) - return try await Serializer.shared.decode(response.data) + return try Serializer.shared.decode(response.data) } /// Clears the note for a specific user by sending an empty note to the API. @@ -37,7 +37,7 @@ public final actor UserNoteService: APIService, UserNoteServiceProtocol { /// - Parameter userNote: The `UserNoteRequest` containing the user ID and note content. /// - Returns: The `HTTPResponse` received from the API. private func request(userNote: UserNoteRequest) async throws -> APIClient.HTTPResponse { - let requestData = try await Serializer.shared.encode(userNote) + let requestData = try Serializer.shared.encode(userNote) return try await client.request(path: path, method: .post, body: requestData) } } diff --git a/Sources/VRCKit/Services/UserService.swift b/Sources/VRCKit/Services/UserService.swift index 6b1c12a..285f442 100644 --- a/Sources/VRCKit/Services/UserService.swift +++ b/Sources/VRCKit/Services/UserService.swift @@ -15,12 +15,12 @@ public final actor UserService: APIService, UserServiceProtocol { /// Fetch a user public func fetchUser(userId: String) async throws -> UserDetail { let response = try await client.request(path: "\(path)/\(userId)", method: .get) - return try await Serializer.shared.decode(response.data) + return try Serializer.shared.decode(response.data) } /// Update user public func updateUser(id: String, editedInfo: EditableUserInfo) async throws { - let requestData = try await Serializer.shared.encode(editedInfo) + let requestData = try Serializer.shared.encode(editedInfo) _ = try await client.request( path: "\(path)/\(id)", method: .put, diff --git a/Sources/VRCKit/Services/WorldService.swift b/Sources/VRCKit/Services/WorldService.swift index ebf6bf9..0873078 100644 --- a/Sources/VRCKit/Services/WorldService.swift +++ b/Sources/VRCKit/Services/WorldService.swift @@ -18,7 +18,7 @@ public final actor WorldService: APIService, WorldServiceProtocol { public func fetchWorld(worldId: String) async throws -> World { let response = try await client.request(path: "\(path)/\(worldId)", method: .get) - return try await Serializer.shared.decode(response.data) + return try Serializer.shared.decode(response.data) } public func fetchFavoritedWorlds() async throws -> [FavoriteWorld] { @@ -44,7 +44,7 @@ public final actor WorldService: APIService, WorldServiceProtocol { URLQueryItem(name: "offset", value: offset.description) ] let response = try await client.request(path: "\(path)/favorites", method: .get, queryItems: queryItems) - let favoriteWorldWrapper: SafeDecodingArray = try await Serializer.shared.decode(response.data) + let favoriteWorldWrapper: SafeDecodingArray = try Serializer.shared.decode(response.data) return favoriteWorldWrapper.wrappedValue } }