Skip to content

Commit 71db0d2

Browse files
authored
Sync AppStoreVersion model definition with App Store Connect API schema (#481)
1 parent b353d72 commit 71db0d2

7 files changed

Lines changed: 108 additions & 69 deletions

File tree

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
Version 0.62.1
2+
-------------
3+
4+
This release contains changes from [PR #481](https://github.com/codemagic-ci-cd/cli-tools/pull/481).
5+
6+
**Bugfixes**
7+
- Do not require deprecated [`ageRatingDeclaration`](https://developer.apple.com/documentation/appstoreconnectapi/appstoreversion/relationships-data.dictionary/ageratingdeclaration-data.dictionary) relationship for `codemagic.apple.resources.AppStoreVersion`.
8+
9+
**Development**
10+
- Define [`AppVersionState`] enumeration for App Store Connect resources and use it on `AppStoreVersion` resource.
11+
- Make deprecated attributes `usesIdfa` and `appStoreState` optional on `AppStoreVersion` resource.
12+
113
Version 0.62.0
214
-------------
315

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "codemagic-cli-tools"
3-
version = "0.62.0"
3+
version = "0.62.1"
44
description = "CLI tools used in Codemagic builds"
55
readme = "README.md"
66
authors = [

src/codemagic/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__title__ = "codemagic-cli-tools"
22
__description__ = "CLI tools used in Codemagic builds"
3-
__version__ = "0.62.0.dev"
3+
__version__ = "0.62.1.dev"
44
__url__ = "https://github.com/codemagic-ci-cd/cli-tools"
55
__licence__ = "GNU General Public License v3.0"

src/codemagic/apple/resources/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from .bundle_id_capability import CapabilitySetting
1717
from .device import Device
1818
from .enums import AppStoreState
19+
from .enums import AppVersionState
1920
from .enums import BetaReviewState
2021
from .enums import BuildAudienceType
2122
from .enums import BuildProcessingState

src/codemagic/apple/resources/app_store_version.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from typing import Optional
66

77
from .enums import AppStoreState
8+
from .enums import AppVersionState
89
from .enums import Platform
910
from .enums import ReleaseType
1011
from .resource import Relationship
@@ -22,20 +23,24 @@ class AppStoreVersion(Resource):
2223
@dataclass
2324
class Attributes(Resource.Attributes):
2425
platform: Platform
25-
appStoreState: AppStoreState
2626
copyright: str
2727
earliestReleaseDate: datetime
2828
releaseType: ReleaseType
29-
usesIdfa: bool
3029
versionString: str
3130
createdDate: datetime
3231
downloadable: bool
32+
appVersionState: AppVersionState
33+
34+
appStoreState: AppStoreState | None = None # Deprecated
35+
usesIdfa: bool | None = None # Deprecated
3336

3437
def __post_init__(self):
3538
if isinstance(self.platform, str):
3639
self.platform = Platform(self.platform)
3740
if isinstance(self.appStoreState, str):
3841
self.appStoreState = AppStoreState(self.appStoreState)
42+
if isinstance(self.appVersionState, str):
43+
self.appVersionState = AppVersionState(self.appVersionState)
3944
if isinstance(self.earliestReleaseDate, str):
4045
self.earliestReleaseDate = Resource.from_iso_8601(self.earliestReleaseDate)
4146
if isinstance(self.releaseType, str):
@@ -47,7 +52,6 @@ def __post_init__(self):
4752
class Relationships(Resource.Relationships):
4853
_OMIT_IF_NONE_KEYS = ("app", "appVersionExperiments")
4954

50-
ageRatingDeclaration: Relationship
5155
appStoreReviewDetail: Relationship
5256
appStoreVersionLocalizations: Relationship
5357
appStoreVersionPhasedRelease: Relationship

src/codemagic/apple/resources/enums.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313

1414

1515
class AppStoreState(ResourceEnum):
16+
"""
17+
https://developer.apple.com/documentation/appstoreconnectapi/appstoreversionstate
18+
Deprecated. Use `AppVersionState` instead.
19+
"""
20+
1621
DEVELOPER_REMOVED_FROM_SALE = "DEVELOPER_REMOVED_FROM_SALE"
1722
DEVELOPER_REJECTED = "DEVELOPER_REJECTED"
1823
IN_REVIEW = "IN_REVIEW"
@@ -43,6 +48,28 @@ def editable_states(cls) -> Tuple[AppStoreState, ...]:
4348
)
4449

4550

51+
class AppVersionState(ResourceEnum):
52+
"""
53+
https://developer.apple.com/documentation/appstoreconnectapi/appversionstate
54+
"""
55+
56+
ACCEPTED = "ACCEPTED"
57+
DEVELOPER_REJECTED = "DEVELOPER_REJECTED"
58+
IN_REVIEW = "IN_REVIEW"
59+
INVALID_BINARY = "INVALID_BINARY"
60+
METADATA_REJECTED = "METADATA_REJECTED"
61+
PENDING_APPLE_RELEASE = "PENDING_APPLE_RELEASE"
62+
PENDING_DEVELOPER_RELEASE = "PENDING_DEVELOPER_RELEASE"
63+
PREPARE_FOR_SUBMISSION = "PREPARE_FOR_SUBMISSION"
64+
PROCESSING_FOR_DISTRIBUTION = "PROCESSING_FOR_DISTRIBUTION"
65+
READY_FOR_DISTRIBUTION = "READY_FOR_DISTRIBUTION"
66+
READY_FOR_REVIEW = "READY_FOR_REVIEW"
67+
REJECTED = "REJECTED"
68+
REPLACED_WITH_NEW_VERSION = "REPLACED_WITH_NEW_VERSION"
69+
WAITING_FOR_EXPORT_COMPLIANCE = "WAITING_FOR_EXPORT_COMPLIANCE"
70+
WAITING_FOR_REVIEW = "WAITING_FOR_REVIEW"
71+
72+
4673
class BetaReviewState(ResourceEnum):
4774
APPROVED = "APPROVED"
4875
IN_REVIEW = "IN_REVIEW"
Lines changed: 59 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,69 @@
11
{
22
"type": "appStoreVersions",
3-
"id": "33c63053-09a9-4112-86cf-bb1539379896",
3+
"id": "409ebefb-ebd1-4f1a-903d-6ba16e013ebf",
44
"attributes": {
5-
"platform": "IOS",
6-
"versionString": "1.0",
7-
"appStoreState": "REJECTED",
8-
"copyright": "Nevercode Ltd",
9-
"releaseType": "AFTER_APPROVAL",
10-
"earliestReleaseDate": null,
11-
"usesIdfa": false,
12-
"downloadable": true,
13-
"createdDate": "2019-02-22T06:05:41-08:00"
5+
"platform": "IOS",
6+
"versionString": "2.0.17",
7+
"appStoreState": "PREPARE_FOR_SUBMISSION",
8+
"appVersionState": "PREPARE_FOR_SUBMISSION",
9+
"copyright": "2024 Nevercode",
10+
"releaseType": "MANUAL",
11+
"earliestReleaseDate": null,
12+
"usesIdfa": null,
13+
"downloadable": true,
14+
"createdDate": "2019-09-24T06:02:48-07:00"
1415
},
1516
"relationships": {
16-
"ageRatingDeclaration": {
17-
"links": {
18-
"self": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/33c63053-09a9-4112-86cf-bb1539379896/relationships/ageRatingDeclaration",
19-
"related": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/33c63053-09a9-4112-86cf-bb1539379896/ageRatingDeclaration"
17+
"appStoreVersionLocalizations": {
18+
"links": {
19+
"self": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/409ebefb-ebd1-4f1a-903d-6ba16e013ebf/relationships/appStoreVersionLocalizations",
20+
"related": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/409ebefb-ebd1-4f1a-903d-6ba16e013ebf/appStoreVersionLocalizations"
21+
}
22+
},
23+
"build": {
24+
"links": {
25+
"self": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/409ebefb-ebd1-4f1a-903d-6ba16e013ebf/relationships/build",
26+
"related": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/409ebefb-ebd1-4f1a-903d-6ba16e013ebf/build"
27+
}
28+
},
29+
"appStoreVersionPhasedRelease": {
30+
"links": {
31+
"self": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/409ebefb-ebd1-4f1a-903d-6ba16e013ebf/relationships/appStoreVersionPhasedRelease",
32+
"related": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/409ebefb-ebd1-4f1a-903d-6ba16e013ebf/appStoreVersionPhasedRelease"
33+
}
34+
},
35+
"routingAppCoverage": {
36+
"links": {
37+
"self": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/409ebefb-ebd1-4f1a-903d-6ba16e013ebf/relationships/routingAppCoverage",
38+
"related": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/409ebefb-ebd1-4f1a-903d-6ba16e013ebf/routingAppCoverage"
39+
}
40+
},
41+
"appStoreReviewDetail": {
42+
"links": {
43+
"self": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/409ebefb-ebd1-4f1a-903d-6ba16e013ebf/relationships/appStoreReviewDetail",
44+
"related": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/409ebefb-ebd1-4f1a-903d-6ba16e013ebf/appStoreReviewDetail"
45+
}
46+
},
47+
"appStoreVersionSubmission": {
48+
"links": {
49+
"self": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/409ebefb-ebd1-4f1a-903d-6ba16e013ebf/relationships/appStoreVersionSubmission",
50+
"related": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/409ebefb-ebd1-4f1a-903d-6ba16e013ebf/appStoreVersionSubmission"
51+
}
52+
},
53+
"appClipDefaultExperience": {
54+
"links": {
55+
"self": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/409ebefb-ebd1-4f1a-903d-6ba16e013ebf/relationships/appClipDefaultExperience",
56+
"related": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/409ebefb-ebd1-4f1a-903d-6ba16e013ebf/appClipDefaultExperience"
57+
}
58+
},
59+
"appStoreVersionExperiments": {
60+
"links": {
61+
"self": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/409ebefb-ebd1-4f1a-903d-6ba16e013ebf/relationships/appStoreVersionExperiments",
62+
"related": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/409ebefb-ebd1-4f1a-903d-6ba16e013ebf/appStoreVersionExperiments"
63+
}
2064
}
21-
},
22-
"appStoreVersionLocalizations": {
23-
"links": {
24-
"self": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/33c63053-09a9-4112-86cf-bb1539379896/relationships/appStoreVersionLocalizations",
25-
"related": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/33c63053-09a9-4112-86cf-bb1539379896/appStoreVersionLocalizations"
26-
}
27-
},
28-
"build": {
29-
"links": {
30-
"self": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/33c63053-09a9-4112-86cf-bb1539379896/relationships/build",
31-
"related": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/33c63053-09a9-4112-86cf-bb1539379896/build"
32-
}
33-
},
34-
"appStoreVersionPhasedRelease": {
35-
"links": {
36-
"self": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/33c63053-09a9-4112-86cf-bb1539379896/relationships/appStoreVersionPhasedRelease",
37-
"related": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/33c63053-09a9-4112-86cf-bb1539379896/appStoreVersionPhasedRelease"
38-
}
39-
},
40-
"routingAppCoverage": {
41-
"links": {
42-
"self": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/33c63053-09a9-4112-86cf-bb1539379896/relationships/routingAppCoverage",
43-
"related": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/33c63053-09a9-4112-86cf-bb1539379896/routingAppCoverage"
44-
}
45-
},
46-
"appStoreReviewDetail": {
47-
"links": {
48-
"self": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/33c63053-09a9-4112-86cf-bb1539379896/relationships/appStoreReviewDetail",
49-
"related": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/33c63053-09a9-4112-86cf-bb1539379896/appStoreReviewDetail"
50-
}
51-
},
52-
"appStoreVersionSubmission": {
53-
"links": {
54-
"self": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/33c63053-09a9-4112-86cf-bb1539379896/relationships/appStoreVersionSubmission",
55-
"related": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/33c63053-09a9-4112-86cf-bb1539379896/appStoreVersionSubmission"
56-
}
57-
},
58-
"appClipDefaultExperience": {
59-
"links": {
60-
"self": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/33c63053-09a9-4112-86cf-bb1539379896/relationships/appClipDefaultExperience",
61-
"related": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/33c63053-09a9-4112-86cf-bb1539379896/appClipDefaultExperience"
62-
}
63-
},
64-
"appStoreVersionExperiments": {
65-
"links": {
66-
"self": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/33c63053-09a9-4112-86cf-bb1539379896/relationships/appStoreVersionExperiments",
67-
"related": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/33c63053-09a9-4112-86cf-bb1539379896/appStoreVersionExperiments"
68-
}
69-
}
7065
},
7166
"links": {
72-
"self": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/33c63053-09a9-4112-86cf-bb1539379896"
67+
"self": "https://api.appstoreconnect.apple.com/v1/appStoreVersions/409ebefb-ebd1-4f1a-903d-6ba16e013ebf"
7368
}
7469
}

0 commit comments

Comments
 (0)