47 lines
859 B
Swift
Raw Normal View History

//
// 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: Properties
let apiService: 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
)
)
}
}
// MARK: - Initialisers
extension GetDataUseCase {
init() {
@Dependency(\.apiService) var apiService
self.init(apiService: apiService)
}
}