Skip to content
This repository was archived by the owner on Oct 16, 2025. It is now read-only.

Commit 6c977c8

Browse files
committed
docs: update readme
1 parent 60d42e0 commit 6c977c8

File tree

1 file changed

+20
-31
lines changed

1 file changed

+20
-31
lines changed

README.md

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212
<a href="https://github.com/hyodotdev/openiap-apple">
1313
<img src="https://img.shields.io/github/v/tag/hyodotdev/openiap-apple?label=Swift%20Package&logo=swift&color=orange" alt="Swift Package" />
1414
</a>
15-
&nbsp;
1615
<a href="https://cocoapods.org/pods/openiap">
1716
<img src="https://img.shields.io/cocoapods/v/openiap?color=E35A5F&label=CocoaPods&logo=cocoapods" alt="CocoaPods" />
1817
</a>
19-
&nbsp;
2018
<a href="https://github.com/hyodotdev/openiap-apple/actions/workflows/test.yml">
2119
<img src="https://github.com/hyodotdev/openiap-apple/actions/workflows/test.yml/badge.svg" alt="Tests" />
2220
</a>
@@ -299,68 +297,59 @@ class StoreViewModel: ObservableObject {
299297

300298
## 📚 Data Models
301299

302-
### ProductIOS
300+
Our Swift data models are generated from the shared GraphQL schema in [`openiap-gql`](https://github.com/hyodotdev/openiap-gql). Run `./scripts/generate-types.sh` (or the equivalent tooling in that repo) to update `Sources/Models/Types.swift`, and every consumer—including the example app—should rely on those generated definitions instead of hand-written structs.
301+
302+
<details>
303+
<summary>ProductIOS snapshot</summary>
303304

304305
```swift
305306
struct ProductIOS {
306-
// Common properties
307307
let id: String
308308
let title: String
309309
let description: String
310-
let type: String // "in-app" (preferred) or legacy "inapp" (deprecated, removal in 1.2.0) or "subs"
310+
let type: ProductType
311311
let displayPrice: String
312312
let currency: String
313313
let price: Double?
314-
let platform: String
314+
let platform: IapPlatform
315315

316316
// iOS-specific properties
317317
let displayNameIOS: String
318318
let typeIOS: ProductTypeIOS
319-
let subscriptionInfoIOS: SubscriptionInfo?
320-
let discountsIOS: [Discount]?
319+
let subscriptionInfoIOS: SubscriptionInfoIOS?
320+
let discountsIOS: [DiscountIOS]?
321321
let isFamilyShareableIOS: Bool
322322
}
323-
324-
enum ProductTypeIOS {
325-
case consumable
326-
case nonConsumable
327-
case autoRenewableSubscription
328-
case nonRenewingSubscription
329-
330-
var isSubs: Bool { /* returns true for autoRenewableSubscription */ }
331-
}
332323
```
333324

334-
### PurchaseIOS
325+
</details>
326+
327+
<details>
328+
<summary>PurchaseIOS snapshot</summary>
335329

336330
```swift
337331
struct PurchaseIOS {
338-
// Common properties
339-
let id: String // Transaction ID
332+
let id: String
340333
let productId: String
341-
let transactionDate: Double // Unix timestamp in milliseconds
342-
let purchaseToken: String
334+
let transactionDate: Double
335+
let purchaseToken: String?
343336
let purchaseState: PurchaseState
344337
let isAutoRenewing: Bool
345338
let quantity: Int
346-
let platform: String
339+
let platform: IapPlatform
347340

348341
// iOS-specific properties
349342
let appAccountToken: String?
350343
let environmentIOS: String?
351344
let storefrontCountryCodeIOS: String?
352-
let productTypeIOS: String?
353345
let subscriptionGroupIdIOS: String?
354-
let transactionReasonIOS: String? // "PURCHASE" | "RENEWAL"
355-
let offerIOS: PurchaseOffer?
356-
// ... additional properties
357-
}
358-
359-
enum PurchaseState {
360-
case pending, purchased, failed, restored, deferred, unknown
346+
let transactionReasonIOS: String?
347+
let offerIOS: PurchaseOfferIOS?
361348
}
362349
```
363350

351+
</details>
352+
364353
### DiscountOffer
365354

366355
```swift

0 commit comments

Comments
 (0)