Implemented the DeleteItemUseCase use case for the Browse module.
This commit is contained in:
parent
d357c1a069
commit
228438454f
@ -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)
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user