diff --git a/Modules/Sources/Browse/Logic/Use Cases/DeleteItemUseCase.swift b/Modules/Sources/Browse/Logic/Use Cases/DeleteItemUseCase.swift new file mode 100644 index 0000000..505353b --- /dev/null +++ b/Modules/Sources/Browse/Logic/Use Cases/DeleteItemUseCase.swift @@ -0,0 +1,45 @@ +// +// DeleteItemUseCase.swift +// Browse +// +// Created by Javier Cicchelli on 16/12/2022. +// Copyright © 2022 Röck+Cöde. All rights reserved. +// + +import APIService +import DependencyInjection +import Dependencies + +struct DeleteItemUseCase { + + // MARK: Properties + + let apiService: APIService + + // MARK: Functions + + func callAsFunction( + id: String, + username: String, + password: String + ) async throws { + try await apiService.deleteItem( + id: id, + credentials: .init( + username: username, + password: password + ) + ) + } + +} + +// MARK: - Initialisers + +extension DeleteItemUseCase { + init() { + @Dependency(\.apiService) var apiService + + self.init(apiService: apiService) + } +}