Skip to content
This repository was archived by the owner on Oct 16, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/generated/Types.kt
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,13 @@ public interface ProductCommon {
}

public interface PurchaseCommon {
/**
* The current plan identifier. This is:
* - On Android: the basePlanId (e.g., "premium", "premium-year")
* - On iOS: the productId (e.g., "com.example.premium_monthly", "com.example.premium_yearly")
* This provides a unified way to identify which specific plan/tier the user is subscribed to.
*/
val currentPlanId: String?
val id: String
val ids: List<String>?
val isAutoRenewing: Boolean
Expand All @@ -445,6 +452,14 @@ public interface PurchaseCommon {

public data class ActiveSubscription(
val autoRenewingAndroid: Boolean? = null,
val basePlanIdAndroid: String? = null,
/**
* The current plan identifier. This is:
* - On Android: the basePlanId (e.g., "premium", "premium-year")
* - On iOS: the productId (e.g., "com.example.premium_monthly", "com.example.premium_yearly")
* This provides a unified way to identify which specific plan/tier the user is subscribed to.
*/
val currentPlanId: String? = null,
val daysUntilExpirationIOS: Double? = null,
val environmentIOS: String? = null,
val expirationDateIOS: Double? = null,
Expand All @@ -460,6 +475,8 @@ public data class ActiveSubscription(
fun fromJson(json: Map<String, Any?>): ActiveSubscription {
return ActiveSubscription(
autoRenewingAndroid = json["autoRenewingAndroid"] as Boolean?,
basePlanIdAndroid = json["basePlanIdAndroid"] as String?,
currentPlanId = json["currentPlanId"] as String?,
daysUntilExpirationIOS = (json["daysUntilExpirationIOS"] as Number?)?.toDouble(),
environmentIOS = json["environmentIOS"] as String?,
expirationDateIOS = (json["expirationDateIOS"] as Number?)?.toDouble(),
Expand All @@ -476,6 +493,8 @@ public data class ActiveSubscription(
fun toJson(): Map<String, Any?> = mapOf(
"__typename" to "ActiveSubscription",
"autoRenewingAndroid" to autoRenewingAndroid,
"basePlanIdAndroid" to basePlanIdAndroid,
"currentPlanId" to currentPlanId,
"daysUntilExpirationIOS" to daysUntilExpirationIOS,
"environmentIOS" to environmentIOS,
"expirationDateIOS" to expirationDateIOS,
Expand Down Expand Up @@ -1015,6 +1034,7 @@ public data class ProductSubscriptionIOS(

public data class PurchaseAndroid(
val autoRenewingAndroid: Boolean? = null,
val currentPlanId: String? = null,
val dataAndroid: String? = null,
val developerPayloadAndroid: String? = null,
val id: String,
Expand All @@ -1038,6 +1058,7 @@ public data class PurchaseAndroid(
fun fromJson(json: Map<String, Any?>): PurchaseAndroid {
return PurchaseAndroid(
autoRenewingAndroid = json["autoRenewingAndroid"] as Boolean?,
currentPlanId = json["currentPlanId"] as String?,
dataAndroid = json["dataAndroid"] as String?,
developerPayloadAndroid = json["developerPayloadAndroid"] as String?,
id = json["id"] as String,
Expand All @@ -1062,6 +1083,7 @@ public data class PurchaseAndroid(
override fun toJson(): Map<String, Any?> = mapOf(
"__typename" to "PurchaseAndroid",
"autoRenewingAndroid" to autoRenewingAndroid,
"currentPlanId" to currentPlanId,
"dataAndroid" to dataAndroid,
"developerPayloadAndroid" to developerPayloadAndroid,
"id" to id,
Expand Down Expand Up @@ -1112,6 +1134,7 @@ public data class PurchaseIOS(
val countryCodeIOS: String? = null,
val currencyCodeIOS: String? = null,
val currencySymbolIOS: String? = null,
val currentPlanId: String? = null,
val environmentIOS: String? = null,
val expirationDateIOS: Double? = null,
val id: String,
Expand Down Expand Up @@ -1148,6 +1171,7 @@ public data class PurchaseIOS(
countryCodeIOS = json["countryCodeIOS"] as String?,
currencyCodeIOS = json["currencyCodeIOS"] as String?,
currencySymbolIOS = json["currencySymbolIOS"] as String?,
currentPlanId = json["currentPlanId"] as String?,
environmentIOS = json["environmentIOS"] as String?,
expirationDateIOS = (json["expirationDateIOS"] as Number?)?.toDouble(),
id = json["id"] as String,
Expand Down Expand Up @@ -1185,6 +1209,7 @@ public data class PurchaseIOS(
"countryCodeIOS" to countryCodeIOS,
"currencyCodeIOS" to currencyCodeIOS,
"currencySymbolIOS" to currencySymbolIOS,
"currentPlanId" to currentPlanId,
"environmentIOS" to environmentIOS,
"expirationDateIOS" to expirationDateIOS,
"id" to id,
Expand Down
26 changes: 26 additions & 0 deletions src/generated/Types.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ public protocol ProductCommon: Codable {
}

public protocol PurchaseCommon: Codable {
/// The current plan identifier. This is:
/// - On Android: the basePlanId (e.g., "premium", "premium-year")
/// - On iOS: the productId (e.g., "com.example.premium_monthly", "com.example.premium_yearly")
/// This provides a unified way to identify which specific plan/tier the user is subscribed to.
var currentPlanId: String? { get }
var id: String { get }
var ids: [String]? { get }
var isAutoRenewing: Bool { get }
Expand All @@ -147,6 +152,12 @@ public protocol PurchaseCommon: Codable {

public struct ActiveSubscription: Codable {
public var autoRenewingAndroid: Bool?
public var basePlanIdAndroid: String?
/// The current plan identifier. This is:
/// - On Android: the basePlanId (e.g., "premium", "premium-year")
/// - On iOS: the productId (e.g., "com.example.premium_monthly", "com.example.premium_yearly")
/// This provides a unified way to identify which specific plan/tier the user is subscribed to.
public var currentPlanId: String?
public var daysUntilExpirationIOS: Double?
public var environmentIOS: String?
public var expirationDateIOS: Double?
Expand Down Expand Up @@ -314,6 +325,7 @@ public struct ProductSubscriptionIOS: Codable, ProductCommon {

public struct PurchaseAndroid: Codable, PurchaseCommon {
public var autoRenewingAndroid: Bool?
public var currentPlanId: String?
public var dataAndroid: String?
public var developerPayloadAndroid: String?
public var id: String
Expand Down Expand Up @@ -345,6 +357,7 @@ public struct PurchaseIOS: Codable, PurchaseCommon {
public var countryCodeIOS: String?
public var currencyCodeIOS: String?
public var currencySymbolIOS: String?
public var currentPlanId: String?
public var environmentIOS: String?
public var expirationDateIOS: Double?
public var id: String
Expand Down Expand Up @@ -853,6 +866,19 @@ public enum Purchase: Codable, PurchaseCommon {
case purchaseAndroid(PurchaseAndroid)
case purchaseIos(PurchaseIOS)

/// The current plan identifier. This is:
/// - On Android: the basePlanId (e.g., "premium", "premium-year")
/// - On iOS: the productId (e.g., "com.example.premium_monthly", "com.example.premium_yearly")
/// This provides a unified way to identify which specific plan/tier the user is subscribed to.
public var currentPlanId: String? {
switch self {
case let .purchaseAndroid(value):
return value.currentPlanId
case let .purchaseIos(value):
return value.currentPlanId
}
}

public var id: String {
switch self {
case let .purchaseAndroid(value):
Expand Down
35 changes: 35 additions & 0 deletions src/generated/types.dart
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,11 @@ abstract class ProductCommon {
}

abstract class PurchaseCommon {
/// The current plan identifier. This is:
/// - On Android: the basePlanId (e.g., "premium", "premium-year")
/// - On iOS: the productId (e.g., "com.example.premium_monthly", "com.example.premium_yearly")
/// This provides a unified way to identify which specific plan/tier the user is subscribed to.
String? get currentPlanId;
String get id;
List<String>? get ids;
bool get isAutoRenewing;
Expand All @@ -539,6 +544,12 @@ abstract class PurchaseCommon {
class ActiveSubscription {
const ActiveSubscription({
this.autoRenewingAndroid,
this.basePlanIdAndroid,
/// The current plan identifier. This is:
/// - On Android: the basePlanId (e.g., "premium", "premium-year")
/// - On iOS: the productId (e.g., "com.example.premium_monthly", "com.example.premium_yearly")
/// This provides a unified way to identify which specific plan/tier the user is subscribed to.
this.currentPlanId,
this.daysUntilExpirationIOS,
this.environmentIOS,
this.expirationDateIOS,
Expand All @@ -551,6 +562,12 @@ class ActiveSubscription {
});

final bool? autoRenewingAndroid;
final String? basePlanIdAndroid;
/// The current plan identifier. This is:
/// - On Android: the basePlanId (e.g., "premium", "premium-year")
/// - On iOS: the productId (e.g., "com.example.premium_monthly", "com.example.premium_yearly")
/// This provides a unified way to identify which specific plan/tier the user is subscribed to.
final String? currentPlanId;
final double? daysUntilExpirationIOS;
final String? environmentIOS;
final double? expirationDateIOS;
Expand All @@ -564,6 +581,8 @@ class ActiveSubscription {
factory ActiveSubscription.fromJson(Map<String, dynamic> json) {
return ActiveSubscription(
autoRenewingAndroid: json['autoRenewingAndroid'] as bool?,
basePlanIdAndroid: json['basePlanIdAndroid'] as String?,
currentPlanId: json['currentPlanId'] as String?,
daysUntilExpirationIOS: (json['daysUntilExpirationIOS'] as num?)?.toDouble(),
environmentIOS: json['environmentIOS'] as String?,
expirationDateIOS: (json['expirationDateIOS'] as num?)?.toDouble(),
Expand All @@ -580,6 +599,8 @@ class ActiveSubscription {
return {
'__typename': 'ActiveSubscription',
'autoRenewingAndroid': autoRenewingAndroid,
'basePlanIdAndroid': basePlanIdAndroid,
'currentPlanId': currentPlanId,
'daysUntilExpirationIOS': daysUntilExpirationIOS,
'environmentIOS': environmentIOS,
'expirationDateIOS': expirationDateIOS,
Expand Down Expand Up @@ -1260,6 +1281,7 @@ class ProductSubscriptionIOS extends ProductSubscription implements ProductCommo
class PurchaseAndroid extends Purchase implements PurchaseCommon {
const PurchaseAndroid({
this.autoRenewingAndroid,
this.currentPlanId,
this.dataAndroid,
this.developerPayloadAndroid,
required this.id,
Expand All @@ -1281,6 +1303,7 @@ class PurchaseAndroid extends Purchase implements PurchaseCommon {
});

final bool? autoRenewingAndroid;
final String? currentPlanId;
final String? dataAndroid;
final String? developerPayloadAndroid;
final String id;
Expand All @@ -1303,6 +1326,7 @@ class PurchaseAndroid extends Purchase implements PurchaseCommon {
factory PurchaseAndroid.fromJson(Map<String, dynamic> json) {
return PurchaseAndroid(
autoRenewingAndroid: json['autoRenewingAndroid'] as bool?,
currentPlanId: json['currentPlanId'] as String?,
dataAndroid: json['dataAndroid'] as String?,
developerPayloadAndroid: json['developerPayloadAndroid'] as String?,
id: json['id'] as String,
Expand All @@ -1329,6 +1353,7 @@ class PurchaseAndroid extends Purchase implements PurchaseCommon {
return {
'__typename': 'PurchaseAndroid',
'autoRenewingAndroid': autoRenewingAndroid,
'currentPlanId': currentPlanId,
'dataAndroid': dataAndroid,
'developerPayloadAndroid': developerPayloadAndroid,
'id': id,
Expand Down Expand Up @@ -1387,6 +1412,7 @@ class PurchaseIOS extends Purchase implements PurchaseCommon {
this.countryCodeIOS,
this.currencyCodeIOS,
this.currencySymbolIOS,
this.currentPlanId,
this.environmentIOS,
this.expirationDateIOS,
required this.id,
Expand Down Expand Up @@ -1421,6 +1447,7 @@ class PurchaseIOS extends Purchase implements PurchaseCommon {
final String? countryCodeIOS;
final String? currencyCodeIOS;
final String? currencySymbolIOS;
final String? currentPlanId;
final String? environmentIOS;
final double? expirationDateIOS;
final String id;
Expand Down Expand Up @@ -1456,6 +1483,7 @@ class PurchaseIOS extends Purchase implements PurchaseCommon {
countryCodeIOS: json['countryCodeIOS'] as String?,
currencyCodeIOS: json['currencyCodeIOS'] as String?,
currencySymbolIOS: json['currencySymbolIOS'] as String?,
currentPlanId: json['currentPlanId'] as String?,
environmentIOS: json['environmentIOS'] as String?,
expirationDateIOS: (json['expirationDateIOS'] as num?)?.toDouble(),
id: json['id'] as String,
Expand Down Expand Up @@ -1495,6 +1523,7 @@ class PurchaseIOS extends Purchase implements PurchaseCommon {
'countryCodeIOS': countryCodeIOS,
'currencyCodeIOS': currencyCodeIOS,
'currencySymbolIOS': currencySymbolIOS,
'currentPlanId': currentPlanId,
'environmentIOS': environmentIOS,
'expirationDateIOS': expirationDateIOS,
'id': id,
Expand Down Expand Up @@ -2528,6 +2557,12 @@ sealed class Purchase implements PurchaseCommon {
throw ArgumentError('Unknown __typename for Purchase: $typeName');
}

/// The current plan identifier. This is:
/// - On Android: the basePlanId (e.g., "premium", "premium-year")
/// - On iOS: the productId (e.g., "com.example.premium_monthly", "com.example.premium_yearly")
/// This provides a unified way to identify which specific plan/tier the user is subscribed to.
@override
String? get currentPlanId;
@override
String get id;
@override
Expand Down
17 changes: 17 additions & 0 deletions src/generated/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@

export interface ActiveSubscription {
autoRenewingAndroid?: (boolean | null);
basePlanIdAndroid?: (string | null);
/**
* The current plan identifier. This is:
* - On Android: the basePlanId (e.g., "premium", "premium-year")
* - On iOS: the productId (e.g., "com.example.premium_monthly", "com.example.premium_yearly")
* This provides a unified way to identify which specific plan/tier the user is subscribed to.
*/
currentPlanId?: (string | null);
daysUntilExpirationIOS?: (number | null);
environmentIOS?: (string | null);
expirationDateIOS?: (number | null);
Expand Down Expand Up @@ -381,6 +389,7 @@ export type Purchase = PurchaseAndroid | PurchaseIOS;

export interface PurchaseAndroid extends PurchaseCommon {
autoRenewingAndroid?: (boolean | null);
currentPlanId?: (string | null);
dataAndroid?: (string | null);
developerPayloadAndroid?: (string | null);
id: string;
Expand All @@ -401,6 +410,13 @@ export interface PurchaseAndroid extends PurchaseCommon {
}

export interface PurchaseCommon {
/**
* The current plan identifier. This is:
* - On Android: the basePlanId (e.g., "premium", "premium-year")
* - On iOS: the productId (e.g., "com.example.premium_monthly", "com.example.premium_yearly")
* This provides a unified way to identify which specific plan/tier the user is subscribed to.
*/
currentPlanId?: (string | null);
id: string;
ids?: (string[] | null);
isAutoRenewing: boolean;
Expand All @@ -425,6 +441,7 @@ export interface PurchaseIOS extends PurchaseCommon {
countryCodeIOS?: (string | null);
currencyCodeIOS?: (string | null);
currencySymbolIOS?: (string | null);
currentPlanId?: (string | null);
environmentIOS?: (string | null);
expirationDateIOS?: (number | null);
id: string;
Expand Down
1 change: 1 addition & 0 deletions src/type-android.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ type PurchaseAndroid implements PurchaseCommon {
quantity: Int!
purchaseState: PurchaseState!
isAutoRenewing: Boolean!
currentPlanId: String

# Android-specific fields
dataAndroid: String
Expand Down
1 change: 1 addition & 0 deletions src/type-ios.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ type PurchaseIOS implements PurchaseCommon {
quantity: Int!
purchaseState: PurchaseState!
isAutoRenewing: Boolean!
currentPlanId: String

# iOS-specific fields
transactionId: String!
Expand Down
15 changes: 15 additions & 0 deletions src/type.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ interface PurchaseCommon {
quantity: Int!
purchaseState: PurchaseState!
isAutoRenewing: Boolean!
"""
The current plan identifier. This is:
- On Android: the basePlanId (e.g., "premium", "premium-year")
- On iOS: the productId (e.g., "com.example.premium_monthly", "com.example.premium_yearly")
This provides a unified way to identify which specific plan/tier the user is subscribed to.
"""
currentPlanId: String
}

# Unions for platform-specific types
Expand Down Expand Up @@ -203,6 +210,14 @@ type ActiveSubscription {
transactionId: String!
purchaseToken: String
transactionDate: Float!
basePlanIdAndroid: String
"""
The current plan identifier. This is:
- On Android: the basePlanId (e.g., "premium", "premium-year")
- On iOS: the productId (e.g., "com.example.premium_monthly", "com.example.premium_yearly")
This provides a unified way to identify which specific plan/tier the user is subscribed to.
"""
currentPlanId: String
}

# Initialization configuration
Expand Down