mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
AltStoreCore will contain all shared AltStore code between AltStore and any app extensions. Initially, it includes all AltStore model logic.
51 lines
1.0 KiB
Swift
51 lines
1.0 KiB
Swift
//
|
|
// Tier.swift
|
|
// AltStore
|
|
//
|
|
// Created by Riley Testut on 8/21/19.
|
|
// Copyright © 2019 Riley Testut. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
extension PatreonAPI
|
|
{
|
|
struct TierResponse: Decodable
|
|
{
|
|
struct Attributes: Decodable
|
|
{
|
|
var title: String
|
|
}
|
|
|
|
struct Relationships: Decodable
|
|
{
|
|
struct Benefits: Decodable
|
|
{
|
|
var data: [BenefitResponse]
|
|
}
|
|
|
|
var benefits: Benefits
|
|
}
|
|
|
|
var id: String
|
|
var attributes: Attributes
|
|
|
|
var relationships: Relationships
|
|
}
|
|
}
|
|
|
|
public struct Tier
|
|
{
|
|
public var name: String
|
|
public var identifier: String
|
|
|
|
public var benefits: [Benefit] = []
|
|
|
|
init(response: PatreonAPI.TierResponse)
|
|
{
|
|
self.name = response.attributes.title
|
|
self.identifier = response.id
|
|
self.benefits = response.relationships.benefits.data.map(Benefit.init(response:))
|
|
}
|
|
}
|