Defined the Service protocol in the Feed library.
This commit is contained in:
parent
f97025fdb8
commit
7beb36068b
21
Libraries/Feed/Kit/Sources/Protocols/Service.swift
Normal file
21
Libraries/Feed/Kit/Sources/Protocols/Service.swift
Normal file
@ -0,0 +1,21 @@
|
||||
//
|
||||
// Service.swift
|
||||
// ReviewsFeedKit
|
||||
//
|
||||
// Created by Javier Cicchelli on 17/03/2024.
|
||||
// Copyright © 2024 Röck+Cöde VoF. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public protocol Service {
|
||||
|
||||
// MARK: Properties
|
||||
var configuration: ServiceConfiguration { get }
|
||||
var decoder: JSONDecoder { get }
|
||||
var session: URLSession { get }
|
||||
|
||||
// MARK: Functions
|
||||
func getReviews(_ input: GetReviewsInput) async throws -> GetReviewsOutput
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
//
|
||||
// ServiceConfiguration.swift
|
||||
// ReviewsiTunesKit
|
||||
//
|
||||
// Created by Javier Cicchelli on 17/03/2024.
|
||||
// Copyright © 2024 Röck+Cöde VoF. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct ServiceConfiguration {
|
||||
|
||||
// MARK: Constants
|
||||
public let decoder: JSONDecoder
|
||||
public let host: URL
|
||||
public let session: URLSessionConfiguration
|
||||
|
||||
// MARK: Initialisers
|
||||
public init(
|
||||
host: URL,
|
||||
session: URLSessionConfiguration = .ephemeral,
|
||||
decoder: JSONDecoder? = nil
|
||||
) {
|
||||
self.decoder = decoder ?? .init()
|
||||
self.host = host
|
||||
self.session = session
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
//
|
||||
// String+Constants.swift
|
||||
// ReviewsFoundation
|
||||
// ReviewsFoundationKit
|
||||
//
|
||||
// Created by Javier Cicchelli on 16/03/2024.
|
||||
// Copyright © 2024 Röck+Cöde VoF. All rights reserved.
|
||||
|
Loading…
x
Reference in New Issue
Block a user