Implemented the GetDataUseCase use case for the Browse module.
This commit is contained in:
parent
0cb5510539
commit
745ba87fb5
36
Modules/Sources/Browse/Logic/Use Cases/GetDataUseCase.swift
Normal file
36
Modules/Sources/Browse/Logic/Use Cases/GetDataUseCase.swift
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
//
|
||||||
|
// GetDataUseCase.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
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
struct GetDataUseCase {
|
||||||
|
|
||||||
|
// MARK: Dependencies
|
||||||
|
|
||||||
|
@Dependency(\.apiService) private var apiService
|
||||||
|
|
||||||
|
// MARK: Functions
|
||||||
|
|
||||||
|
func callAsFunction(
|
||||||
|
id: String,
|
||||||
|
username: String,
|
||||||
|
password: String
|
||||||
|
) async throws -> Data {
|
||||||
|
return try await apiService.getData(
|
||||||
|
id: id,
|
||||||
|
credentials: .init(
|
||||||
|
username: username,
|
||||||
|
password: password
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user