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

Commit 74bb411

Browse files
committed
feat(android): getStorefrontAndroid
1 parent 48601d4 commit 74bb411

6 files changed

Lines changed: 74 additions & 13 deletions

File tree

src/api-android.graphql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
extend type Query {
44
"""
5-
Get the current Play Store storefront country code
5+
Returns: StorefrontResultAndroid!
66
"""
77
# Future
8-
getStorefrontAndroid: String!
8+
getStorefrontAndroid: StorefrontResultAndroid!
99
}
1010

1111
extend type Mutation {

src/generated/Types.kt

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,6 +1362,27 @@ public data class RequestPurchaseResultPurchase(val value: Purchase?) : RequestP
13621362

13631363
public data class RequestPurchaseResultPurchases(val value: List<Purchase>?) : RequestPurchaseResult
13641364

1365+
public data class StorefrontResultAndroid(
1366+
val countryCode: String,
1367+
val identifier: String
1368+
) {
1369+
1370+
companion object {
1371+
fun fromJson(json: Map<String, Any?>): StorefrontResultAndroid {
1372+
return StorefrontResultAndroid(
1373+
countryCode = json["countryCode"] as String,
1374+
identifier = json["identifier"] as String,
1375+
)
1376+
}
1377+
}
1378+
1379+
fun toJson(): Map<String, Any?> = mapOf(
1380+
"__typename" to "StorefrontResultAndroid",
1381+
"countryCode" to countryCode,
1382+
"identifier" to identifier,
1383+
)
1384+
}
1385+
13651386
public data class SubscriptionInfoIOS(
13661387
val introductoryOffer: SubscriptionOfferIOS? = null,
13671388
val promotionalOffers: List<SubscriptionOfferIOS>? = null,
@@ -2123,9 +2144,9 @@ public interface QueryResolver {
21232144
*/
21242145
suspend fun getReceiptDataIOS(): String?
21252146
/**
2126-
* Get the current Play Store storefront country code
2147+
* Returns: StorefrontResultAndroid!
21272148
*/
2128-
suspend fun getStorefrontAndroid(): String
2149+
suspend fun getStorefrontAndroid(): StorefrontResultAndroid
21292150
/**
21302151
* Get the current App Store storefront country code
21312152
*/
@@ -2226,7 +2247,7 @@ public typealias QueryGetAvailablePurchasesHandler = suspend (options: PurchaseO
22262247
public typealias QueryGetPendingTransactionsIOSHandler = suspend () -> List<PurchaseIOS>
22272248
public typealias QueryGetPromotedProductIOSHandler = suspend () -> ProductIOS?
22282249
public typealias QueryGetReceiptDataIOSHandler = suspend () -> String?
2229-
public typealias QueryGetStorefrontAndroidHandler = suspend () -> String
2250+
public typealias QueryGetStorefrontAndroidHandler = suspend () -> StorefrontResultAndroid
22302251
public typealias QueryGetStorefrontIOSHandler = suspend () -> String
22312252
public typealias QueryGetTransactionJwsIOSHandler = suspend (sku: String) -> String?
22322253
public typealias QueryHasActiveSubscriptionsHandler = suspend (subscriptionIds: List<String>?) -> Boolean

src/generated/Types.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,11 @@ public enum RequestPurchaseResult {
414414
case purchases([Purchase]?)
415415
}
416416

417+
public struct StorefrontResultAndroid: Codable {
418+
public var countryCode: String
419+
public var identifier: String
420+
}
421+
417422
public struct SubscriptionInfoIOS: Codable {
418423
public var introductoryOffer: SubscriptionOfferIOS?
419424
public var promotionalOffers: [SubscriptionOfferIOS]?
@@ -976,8 +981,8 @@ public protocol QueryResolver {
976981
func getPromotedProductIOS() async throws -> ProductIOS?
977982
/// Get base64-encoded receipt data for validation
978983
func getReceiptDataIOS() async throws -> String?
979-
/// Get the current Play Store storefront country code
980-
func getStorefrontAndroid() async throws -> String
984+
/// Returns: StorefrontResultAndroid!
985+
func getStorefrontAndroid() async throws -> StorefrontResultAndroid
981986
/// Get the current App Store storefront country code
982987
func getStorefrontIOS() async throws -> String
983988
/// Get the transaction JWS (StoreKit 2)
@@ -1088,7 +1093,7 @@ public typealias QueryGetAvailablePurchasesHandler = (_ options: PurchaseOptions
10881093
public typealias QueryGetPendingTransactionsIOSHandler = () async throws -> [PurchaseIOS]
10891094
public typealias QueryGetPromotedProductIOSHandler = () async throws -> ProductIOS?
10901095
public typealias QueryGetReceiptDataIOSHandler = () async throws -> String?
1091-
public typealias QueryGetStorefrontAndroidHandler = () async throws -> String
1096+
public typealias QueryGetStorefrontAndroidHandler = () async throws -> StorefrontResultAndroid
10921097
public typealias QueryGetStorefrontIOSHandler = () async throws -> String
10931098
public typealias QueryGetTransactionJwsIOSHandler = (_ sku: String) async throws -> String?
10941099
public typealias QueryHasActiveSubscriptionsHandler = (_ subscriptionIds: [String]?) async throws -> Bool

src/generated/types.dart

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1714,6 +1714,31 @@ class RequestPurchaseResultPurchases extends RequestPurchaseResult {
17141714
final List<Purchase>? value;
17151715
}
17161716

1717+
class StorefrontResultAndroid {
1718+
const StorefrontResultAndroid({
1719+
required this.countryCode,
1720+
required this.identifier,
1721+
});
1722+
1723+
final String countryCode;
1724+
final String identifier;
1725+
1726+
factory StorefrontResultAndroid.fromJson(Map<String, dynamic> json) {
1727+
return StorefrontResultAndroid(
1728+
countryCode: json['countryCode'] as String,
1729+
identifier: json['identifier'] as String,
1730+
);
1731+
}
1732+
1733+
Map<String, dynamic> toJson() {
1734+
return {
1735+
'__typename': 'StorefrontResultAndroid',
1736+
'countryCode': countryCode,
1737+
'identifier': identifier,
1738+
};
1739+
}
1740+
}
1741+
17171742
class SubscriptionInfoIOS {
17181743
const SubscriptionInfoIOS({
17191744
this.introductoryOffer,
@@ -2618,8 +2643,8 @@ abstract class QueryResolver {
26182643
Future<ProductIOS?> getPromotedProductIOS();
26192644
/// Get base64-encoded receipt data for validation
26202645
Future<String?> getReceiptDataIOS();
2621-
/// Get the current Play Store storefront country code
2622-
Future<String> getStorefrontAndroid();
2646+
/// Returns: StorefrontResultAndroid!
2647+
Future<StorefrontResultAndroid> getStorefrontAndroid();
26232648
/// Get the current App Store storefront country code
26242649
Future<String> getStorefrontIOS();
26252650
/// Get the transaction JWS (StoreKit 2)
@@ -2717,7 +2742,7 @@ typedef QueryGetAvailablePurchasesHandler = Future<List<Purchase>> Function([Pur
27172742
typedef QueryGetPendingTransactionsIOSHandler = Future<List<PurchaseIOS>> Function();
27182743
typedef QueryGetPromotedProductIOSHandler = Future<ProductIOS?> Function();
27192744
typedef QueryGetReceiptDataIOSHandler = Future<String?> Function();
2720-
typedef QueryGetStorefrontAndroidHandler = Future<String> Function();
2745+
typedef QueryGetStorefrontAndroidHandler = Future<StorefrontResultAndroid> Function();
27212746
typedef QueryGetStorefrontIOSHandler = Future<String> Function();
27222747
typedef QueryGetTransactionJwsIOSHandler = Future<String?> Function(String sku);
27232748
typedef QueryHasActiveSubscriptionsHandler = Future<bool> Function([List<String>? subscriptionIds]);

src/generated/types.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,8 @@ export interface Query {
449449
getPromotedProductIOS?: Promise<(ProductIOS | null)>;
450450
/** Get base64-encoded receipt data for validation */
451451
getReceiptDataIOS?: Promise<(string | null)>;
452-
/** Get the current Play Store storefront country code */
453-
getStorefrontAndroid: Promise<string>;
452+
/** Returns: StorefrontResultAndroid! */
453+
getStorefrontAndroid: StorefrontResultAndroid;
454454
/** Get the current App Store storefront country code */
455455
getStorefrontIOS: Promise<string>;
456456
/** Get the transaction JWS (StoreKit 2) */
@@ -629,6 +629,11 @@ export interface RequestSubscriptionPropsByPlatforms {
629629
ios?: (RequestSubscriptionIosProps | null);
630630
}
631631

632+
export interface StorefrontResultAndroid {
633+
countryCode: string;
634+
identifier: string;
635+
}
636+
632637
export interface Subscription {
633638
/** Fires when the App Store surfaces a promoted product (iOS only) */
634639
promotedProductIOS: string;

src/type-android.graphql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,8 @@ type ReceiptValidationResultAndroid {
179179
termSku: String!
180180
testTransaction: Boolean!
181181
}
182+
183+
type StorefrontResultAndroid {
184+
countryCode: String!
185+
identifier: String!
186+
}

0 commit comments

Comments
 (0)