[AltStoreCore] Refactors PatreonAPI to reduce duplicate logic

This commit is contained in:
Riley Testut
2023-11-15 14:13:58 -06:00
parent 417837049f
commit 7ed2dc8291
15 changed files with 389 additions and 222 deletions

View File

@@ -10,18 +10,25 @@ import Foundation
extension PatreonAPI
{
struct CampaignResponse: Decodable
typealias CampaignResponse = DataResponse<CampaignAttributes, AnyRelationships>
struct CampaignAttributes: Decodable
{
var id: String
var url: URL
}
}
public struct Campaign
extension PatreonAPI
{
public var identifier: String
init(response: PatreonAPI.CampaignResponse)
public struct Campaign
{
self.identifier = response.id
public var identifier: String
public var url: URL
internal init(response: PatreonAPI.CampaignResponse)
{
self.identifier = response.id
self.url = response.attributes.url
}
}
}