Skip to content

Commit 22df861

Browse files
Merge pull request #26 from alexanderjordanbaker/PublicConstructors
Add public constructors to all models
2 parents 849021d + 2abfd96 commit 22df861

27 files changed

+130
-27
lines changed

Sources/AppStoreServerLibrary/Models/AppTransaction.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Foundation
88
///[AppTransaction](https://developer.apple.com/documentation/storekit/apptransaction)
99
public struct AppTransaction: DecodedSignedData, Decodable, Encodable, Hashable {
1010

11-
init(receiptType: Environment? = nil, appAppleId: Int64? = nil, bundleId: String? = nil, applicationVersion: String? = nil, versionExternalIdentifier: Int64? = nil, receiptCreationDate: Date? = nil, originalPurchaseDate: Date? = nil, originalApplicationVersion: String? = nil, deviceVerification: String? = nil, deviceVerificationNonce: UUID? = nil, preorderDate: Date? = nil) {
11+
public init(receiptType: Environment? = nil, appAppleId: Int64? = nil, bundleId: String? = nil, applicationVersion: String? = nil, versionExternalIdentifier: Int64? = nil, receiptCreationDate: Date? = nil, originalPurchaseDate: Date? = nil, originalApplicationVersion: String? = nil, deviceVerification: String? = nil, deviceVerificationNonce: UUID? = nil, preorderDate: Date? = nil) {
1212
self.receiptType = receiptType
1313
self.appAppleId = appAppleId
1414
self.bundleId = bundleId
@@ -22,7 +22,7 @@ public struct AppTransaction: DecodedSignedData, Decodable, Encodable, Hashable
2222
self.preorderDate = preorderDate
2323
}
2424

25-
init(rawReceiptType: String? = nil, appAppleId: Int64? = nil, bundleId: String? = nil, applicationVersion: String? = nil, versionExternalIdentifier: Int64? = nil, receiptCreationDate: Date? = nil, originalPurchaseDate: Date? = nil, originalApplicationVersion: String? = nil, deviceVerification: String? = nil, deviceVerificationNonce: UUID? = nil, preorderDate: Date? = nil) {
25+
public init(rawReceiptType: String? = nil, appAppleId: Int64? = nil, bundleId: String? = nil, applicationVersion: String? = nil, versionExternalIdentifier: Int64? = nil, receiptCreationDate: Date? = nil, originalPurchaseDate: Date? = nil, originalApplicationVersion: String? = nil, deviceVerification: String? = nil, deviceVerificationNonce: UUID? = nil, preorderDate: Date? = nil) {
2626
self.rawReceiptType = rawReceiptType
2727
self.appAppleId = appAppleId
2828
self.bundleId = bundleId

Sources/AppStoreServerLibrary/Models/CheckTestNotificationResponse.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
///
55
///[CheckTestNotificationResponse](https://developer.apple.com/documentation/appstoreserverapi/checktestnotificationresponse)
66
public struct CheckTestNotificationResponse: Decodable, Encodable, Hashable {
7-
7+
8+
public init(signedPayload: String? = nil, sendAttempts: [SendAttemptItem]? = nil) {
9+
self.signedPayload = signedPayload
10+
self.sendAttempts = sendAttempts
11+
}
12+
813
///A cryptographically signed payload, in JSON Web Signature (JWS) format, containing the response body for a version 2 notification.
914
///
1015
///[signedPayload](https://developer.apple.com/documentation/appstoreservernotifications/signedpayload)

Sources/AppStoreServerLibrary/Models/ConsumptionRequest.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import Foundation
77
///[ConsumptionRequest](https://developer.apple.com/documentation/appstoreserverapi/consumptionrequest)
88
public struct ConsumptionRequest: Decodable, Encodable, Hashable {
99

10-
init(customerConsented: Bool? = nil, consumptionStatus: ConsumptionStatus? = nil, platform: Platform? = nil, sampleContentProvided: Bool? = nil, deliveryStatus: DeliveryStatus? = nil, appAccountToken: UUID? = nil, accountTenure: AccountTenure? = nil, playTime: PlayTime? = nil, lifetimeDollarsRefunded: LifetimeDollarsRefunded? = nil, lifetimeDollarsPurchased: LifetimeDollarsPurchased? = nil, userStatus: UserStatus? = nil) {
10+
public init(customerConsented: Bool? = nil, consumptionStatus: ConsumptionStatus? = nil, platform: Platform? = nil, sampleContentProvided: Bool? = nil, deliveryStatus: DeliveryStatus? = nil, appAccountToken: UUID? = nil, accountTenure: AccountTenure? = nil, playTime: PlayTime? = nil, lifetimeDollarsRefunded: LifetimeDollarsRefunded? = nil, lifetimeDollarsPurchased: LifetimeDollarsPurchased? = nil, userStatus: UserStatus? = nil) {
1111
self.customerConsented = customerConsented
1212
self.consumptionStatus = consumptionStatus
1313
self.platform = platform
@@ -21,7 +21,7 @@ public struct ConsumptionRequest: Decodable, Encodable, Hashable {
2121
self.userStatus = userStatus
2222
}
2323

24-
init(customerConsented: Bool? = nil, rawConsumptionStatus: Int32? = nil, rawPlatform: Int32? = nil, sampleContentProvided: Bool? = nil, rawDeliveryStatus: Int32? = nil, appAccountToken: UUID? = nil, rawAccountTenure: Int32? = nil, rawPlayTime: Int32? = nil, rawLifetimeDollarsRefunded: Int32? = nil, rawLifetimeDollarsPurchased: Int32? = nil, rawUserStatus: Int32? = nil) {
24+
public init(customerConsented: Bool? = nil, rawConsumptionStatus: Int32? = nil, rawPlatform: Int32? = nil, sampleContentProvided: Bool? = nil, rawDeliveryStatus: Int32? = nil, appAccountToken: UUID? = nil, rawAccountTenure: Int32? = nil, rawPlayTime: Int32? = nil, rawLifetimeDollarsRefunded: Int32? = nil, rawLifetimeDollarsPurchased: Int32? = nil, rawUserStatus: Int32? = nil) {
2525
self.customerConsented = customerConsented
2626
self.rawConsumptionStatus = rawConsumptionStatus
2727
self.rawPlatform = rawPlatform

Sources/AppStoreServerLibrary/Models/Data.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
///[data](https://developer.apple.com/documentation/appstoreservernotifications/data)
66
public struct Data: Decodable, Encodable, Hashable {
77

8-
init(environment: Environment? = nil, appAppleId: Int64? = nil, bundleId: String? = nil, bundleVersion: String? = nil, signedTransactionInfo: String? = nil, signedRenewalInfo: String? = nil, status: Status? = nil) {
8+
public init(environment: Environment? = nil, appAppleId: Int64? = nil, bundleId: String? = nil, bundleVersion: String? = nil, signedTransactionInfo: String? = nil, signedRenewalInfo: String? = nil, status: Status? = nil) {
99
self.environment = environment
1010
self.appAppleId = appAppleId
1111
self.bundleId = bundleId
@@ -15,7 +15,7 @@ public struct Data: Decodable, Encodable, Hashable {
1515
self.status = status
1616
}
1717

18-
init(rawEnvironment: String? = nil, appAppleId: Int64? = nil, bundleId: String? = nil, bundleVersion: String? = nil, signedTransactionInfo: String? = nil, signedRenewalInfo: String? = nil, rawStatus: Int32? = nil) {
18+
public init(rawEnvironment: String? = nil, appAppleId: Int64? = nil, bundleId: String? = nil, bundleVersion: String? = nil, signedTransactionInfo: String? = nil, signedRenewalInfo: String? = nil, rawStatus: Int32? = nil) {
1919
self.rawEnvironment = rawEnvironment
2020
self.appAppleId = appAppleId
2121
self.bundleId = bundleId

Sources/AppStoreServerLibrary/Models/ExtendRenewalDateRequest.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
///[ExtendRenewalDateRequest](https://developer.apple.com/documentation/appstoreserverapi/extendrenewaldaterequest)
66
public struct ExtendRenewalDateRequest: Decodable, Encodable, Hashable {
77

8+
public init(extendByDays: Int32? = nil, extendReasonCode: ExtendReasonCode? = nil, requestIdentifier: String? = nil) {
9+
self.extendByDays = extendByDays
10+
self.extendReasonCode = extendReasonCode
11+
self.requestIdentifier = requestIdentifier
12+
}
13+
814
///The number of days to extend the subscription renewal date.
915
///
1016
///[extendByDays](https://developer.apple.com/documentation/appstoreserverapi/extendbydays)

Sources/AppStoreServerLibrary/Models/ExtendRenewalDateResponse.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ import Foundation
55
///
66
///[ExtendRenewalDateResponse](https://developer.apple.com/documentation/appstoreserverapi/extendrenewaldateresponse)
77
public struct ExtendRenewalDateResponse: Decodable, Encodable, Hashable {
8-
8+
9+
public init(originalTransactionId: String? = nil, webOrderLineItemId: String? = nil, success: Bool? = nil, effectiveDate: Date? = nil) {
10+
self.originalTransactionId = originalTransactionId
11+
self.webOrderLineItemId = webOrderLineItemId
12+
self.success = success
13+
self.effectiveDate = effectiveDate
14+
}
15+
916
///The original transaction identifier of a purchase.
1017
///
1118
///[originalTransactionId](https://developer.apple.com/documentation/appstoreserverapi/originaltransactionid)

Sources/AppStoreServerLibrary/Models/HistoryResponse.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
///[HistoryResponse](https://developer.apple.com/documentation/appstoreserverapi/historyresponse)
66
public struct HistoryResponse: Decodable, Encodable, Hashable {
77

8-
init(revision: String? = nil, hasMore: Bool? = nil, bundleId: String? = nil, appAppleId: Int64? = nil, environment: Environment? = nil, signedTransactions: [String]? = nil) {
8+
public init(revision: String? = nil, hasMore: Bool? = nil, bundleId: String? = nil, appAppleId: Int64? = nil, environment: Environment? = nil, signedTransactions: [String]? = nil) {
99
self.revision = revision
1010
self.hasMore = hasMore
1111
self.bundleId = bundleId
@@ -14,7 +14,7 @@ public struct HistoryResponse: Decodable, Encodable, Hashable {
1414
self.signedTransactions = signedTransactions
1515
}
1616

17-
init(revision: String? = nil, hasMore: Bool? = nil, bundleId: String? = nil, appAppleId: Int64? = nil, rawEnvironment: String? = nil, signedTransactions: [String]? = nil) {
17+
public init(revision: String? = nil, hasMore: Bool? = nil, bundleId: String? = nil, appAppleId: Int64? = nil, rawEnvironment: String? = nil, signedTransactions: [String]? = nil) {
1818
self.revision = revision
1919
self.hasMore = hasMore
2020
self.bundleId = bundleId

Sources/AppStoreServerLibrary/Models/JWSRenewalInfoDecodedPayload.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Foundation
66
///[JWSRenewalInfoDecodedPayload](https://developer.apple.com/documentation/appstoreserverapi/jwsrenewalinfodecodedpayload)
77
public struct JWSRenewalInfoDecodedPayload: DecodedSignedData, Decodable, Encodable, Hashable {
88

9-
init(expirationIntent: ExpirationIntent? = nil, originalTransactionId: String? = nil, autoRenewProductId: String? = nil, productId: String? = nil, autoRenewStatus: AutoRenewStatus? = nil, isInBillingRetryPeriod: Bool? = nil, priceIncreaseStatus: PriceIncreaseStatus? = nil, gracePeriodExpiresDate: Date? = nil, offerType: OfferType? = nil, offerIdentifier: String? = nil, signedDate: Date? = nil, environment: Environment? = nil, recentSubscriptionStartDate: Date? = nil, renewalDate: Date? = nil) {
9+
public init(expirationIntent: ExpirationIntent? = nil, originalTransactionId: String? = nil, autoRenewProductId: String? = nil, productId: String? = nil, autoRenewStatus: AutoRenewStatus? = nil, isInBillingRetryPeriod: Bool? = nil, priceIncreaseStatus: PriceIncreaseStatus? = nil, gracePeriodExpiresDate: Date? = nil, offerType: OfferType? = nil, offerIdentifier: String? = nil, signedDate: Date? = nil, environment: Environment? = nil, recentSubscriptionStartDate: Date? = nil, renewalDate: Date? = nil) {
1010
self.expirationIntent = expirationIntent
1111
self.originalTransactionId = originalTransactionId
1212
self.autoRenewProductId = autoRenewProductId
@@ -23,7 +23,7 @@ public struct JWSRenewalInfoDecodedPayload: DecodedSignedData, Decodable, Encoda
2323
self.renewalDate = renewalDate
2424
}
2525

26-
init(rawExpirationIntent: Int32? = nil, originalTransactionId: String? = nil, autoRenewProductId: String? = nil, productId: String? = nil, rawAutoRenewStatus: Int32? = nil, isInBillingRetryPeriod: Bool? = nil, rawPriceIncreaseStatus: Int32? = nil, gracePeriodExpiresDate: Date? = nil, rawOfferType: Int32? = nil, offerIdentifier: String? = nil, signedDate: Date? = nil, rawEnvironment: String? = nil, recentSubscriptionStartDate: Date? = nil, renewalDate: Date? = nil) {
26+
public init(rawExpirationIntent: Int32? = nil, originalTransactionId: String? = nil, autoRenewProductId: String? = nil, productId: String? = nil, rawAutoRenewStatus: Int32? = nil, isInBillingRetryPeriod: Bool? = nil, rawPriceIncreaseStatus: Int32? = nil, gracePeriodExpiresDate: Date? = nil, rawOfferType: Int32? = nil, offerIdentifier: String? = nil, signedDate: Date? = nil, rawEnvironment: String? = nil, recentSubscriptionStartDate: Date? = nil, renewalDate: Date? = nil) {
2727
self.rawExpirationIntent = rawExpirationIntent
2828
self.originalTransactionId = originalTransactionId
2929
self.autoRenewProductId = autoRenewProductId

Sources/AppStoreServerLibrary/Models/JWSTransactionDecodedPayload.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Foundation
66
///[JWSTransactionDecodedPayload](https://developer.apple.com/documentation/appstoreserverapi/jwstransactiondecodedpayload)
77
public struct JWSTransactionDecodedPayload: DecodedSignedData, Decodable, Encodable, Hashable {
88

9-
init(originalTransactionId: String? = nil, transactionId: String? = nil, webOrderLineItemId: String? = nil, bundleId: String? = nil, productId: String? = nil, subscriptionGroupIdentifier: String? = nil, purchaseDate: Date? = nil, originalPurchaseDate: Date? = nil, expiresDate: Date? = nil, quantity: Int32? = nil, type: ProductType? = nil, appAccountToken: UUID? = nil, inAppOwnershipType: InAppOwnershipType? = nil, signedDate: Date? = nil, revocationReason: RevocationReason? = nil, revocationDate: Date? = nil, isUpgraded: Bool? = nil, offerType: OfferType? = nil, offerIdentifier: String? = nil, environment: Environment? = nil, storefront: String? = nil, storefrontId: String? = nil, transactionReason: TransactionReason? = nil, currency: String? = nil, price: Int32? = nil, offerDiscountType: OfferDiscountType? = nil) {
9+
public init(originalTransactionId: String? = nil, transactionId: String? = nil, webOrderLineItemId: String? = nil, bundleId: String? = nil, productId: String? = nil, subscriptionGroupIdentifier: String? = nil, purchaseDate: Date? = nil, originalPurchaseDate: Date? = nil, expiresDate: Date? = nil, quantity: Int32? = nil, type: ProductType? = nil, appAccountToken: UUID? = nil, inAppOwnershipType: InAppOwnershipType? = nil, signedDate: Date? = nil, revocationReason: RevocationReason? = nil, revocationDate: Date? = nil, isUpgraded: Bool? = nil, offerType: OfferType? = nil, offerIdentifier: String? = nil, environment: Environment? = nil, storefront: String? = nil, storefrontId: String? = nil, transactionReason: TransactionReason? = nil, currency: String? = nil, price: Int32? = nil, offerDiscountType: OfferDiscountType? = nil) {
1010
self.originalTransactionId = originalTransactionId
1111
self.transactionId = transactionId
1212
self.webOrderLineItemId = webOrderLineItemId
@@ -35,7 +35,7 @@ public struct JWSTransactionDecodedPayload: DecodedSignedData, Decodable, Encoda
3535
self.offerDiscountType = offerDiscountType
3636
}
3737

38-
init(originalTransactionId: String? = nil, transactionId: String? = nil, webOrderLineItemId: String? = nil, bundleId: String? = nil, productId: String? = nil, subscriptionGroupIdentifier: String? = nil, purchaseDate: Date? = nil, originalPurchaseDate: Date? = nil, expiresDate: Date? = nil, quantity: Int32? = nil, rawType: String? = nil, appAccountToken: UUID? = nil, rawInAppOwnershipType: String? = nil, signedDate: Date? = nil, rawRevocationReason: Int32? = nil, revocationDate: Date? = nil, isUpgraded: Bool? = nil, rawOfferType: Int32? = nil, offerIdentifier: String? = nil, rawEnvironment: String? = nil, storefront: String? = nil, storefrontId: String? = nil, rawTransactionReason: String? = nil, currency: String? = nil, price: Int32? = nil, rawOfferDiscountType: String? = nil) {
38+
public init(originalTransactionId: String? = nil, transactionId: String? = nil, webOrderLineItemId: String? = nil, bundleId: String? = nil, productId: String? = nil, subscriptionGroupIdentifier: String? = nil, purchaseDate: Date? = nil, originalPurchaseDate: Date? = nil, expiresDate: Date? = nil, quantity: Int32? = nil, rawType: String? = nil, appAccountToken: UUID? = nil, rawInAppOwnershipType: String? = nil, signedDate: Date? = nil, rawRevocationReason: Int32? = nil, revocationDate: Date? = nil, isUpgraded: Bool? = nil, rawOfferType: Int32? = nil, offerIdentifier: String? = nil, rawEnvironment: String? = nil, storefront: String? = nil, storefrontId: String? = nil, rawTransactionReason: String? = nil, currency: String? = nil, price: Int32? = nil, rawOfferDiscountType: String? = nil) {
3939
self.originalTransactionId = originalTransactionId
4040
self.transactionId = transactionId
4141
self.webOrderLineItemId = webOrderLineItemId

Sources/AppStoreServerLibrary/Models/LastTransactionsItem.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
///[lastTransactionsItem](https://developer.apple.com/documentation/appstoreserverapi/lasttransactionsitem)
66
public struct LastTransactionsItem: Decodable, Encodable, Hashable {
77

8-
init(status: Status? = nil, originalTransactionId: String? = nil, signedTransactionInfo: String? = nil, signedRenewalInfo: String? = nil) {
8+
public init(status: Status? = nil, originalTransactionId: String? = nil, signedTransactionInfo: String? = nil, signedRenewalInfo: String? = nil) {
99
self.status = status
1010
self.originalTransactionId = originalTransactionId
1111
self.signedTransactionInfo = signedTransactionInfo
1212
self.signedRenewalInfo = signedRenewalInfo
1313
}
1414

15-
init(rawStatus: Int32? = nil, originalTransactionId: String? = nil, signedTransactionInfo: String? = nil, signedRenewalInfo: String? = nil) {
15+
public init(rawStatus: Int32? = nil, originalTransactionId: String? = nil, signedTransactionInfo: String? = nil, signedRenewalInfo: String? = nil) {
1616
self.rawStatus = rawStatus
1717
self.originalTransactionId = originalTransactionId
1818
self.signedTransactionInfo = signedTransactionInfo

0 commit comments

Comments
 (0)