Skip to content

Commit 5924dbe

Browse files
authored
Merge pull request #34 from elonzh/feat/make-enum-serializable
feat: Inherit enum classes with primiary types
2 parents 4cf9665 + b94324a commit 5924dbe

27 files changed

+46
-46
lines changed

appstoreserverlibrary/api_client.py

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

33
import calendar
44
import datetime
5-
from enum import Enum
5+
from enum import IntEnum
66
from typing import Dict, List, Optional, Type, TypeVar, Union
77
from attr import define
88
import cattrs
@@ -33,7 +33,7 @@
3333

3434
T = TypeVar('T')
3535

36-
class APIError(Enum):
36+
class APIError(IntEnum):
3737
GENERAL_BAD_REQUEST = 4000000
3838
INVALID_APP_IDENTIFIER = 4000002
3939
INVALID_REQUEST_REVISION = 4000005

appstoreserverlibrary/models/AccountTenure.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Copyright (c) 2023 Apple Inc. Licensed under MIT License.
22

3-
from enum import Enum
3+
from enum import IntEnum
44

5-
class AccountTenure(Enum):
5+
class AccountTenure(IntEnum):
66
"""
77
The age of the customer's account.
88

appstoreserverlibrary/models/AutoRenewStatus.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Copyright (c) 2023 Apple Inc. Licensed under MIT License.
22

3-
from enum import Enum
3+
from enum import IntEnum
44

5-
class AutoRenewStatus(Enum):
5+
class AutoRenewStatus(IntEnum):
66
"""
77
The renewal status for an auto-renewable subscription.
88

appstoreserverlibrary/models/ConsumptionStatus.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Copyright (c) 2023 Apple Inc. Licensed under MIT License.
22

3-
from enum import Enum
3+
from enum import IntEnum
44

5-
class ConsumptionStatus(Enum):
5+
class ConsumptionStatus(IntEnum):
66
"""
77
A value that indicates the extent to which the customer consumed the in-app purchase.
88

appstoreserverlibrary/models/DeliveryStatus.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Copyright (c) 2023 Apple Inc. Licensed under MIT License.
22

3-
from enum import Enum
3+
from enum import IntEnum
44

5-
class DeliveryStatus(Enum):
5+
class DeliveryStatus(IntEnum):
66
"""
77
A value that indicates whether the app successfully delivered an in-app purchase that works properly.
88

appstoreserverlibrary/models/Environment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from enum import Enum
44

5-
class Environment(Enum):
5+
class Environment(str, Enum):
66
"""
77
The server environment, either sandbox or production.
88

appstoreserverlibrary/models/ExpirationIntent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Copyright (c) 2023 Apple Inc. Licensed under MIT License.
22

3-
from enum import Enum
3+
from enum import IntEnum
44

5-
class ExpirationIntent(Enum):
5+
class ExpirationIntent(IntEnum):
66
"""
77
The reason an auto-renewable subscription expired.
88

appstoreserverlibrary/models/ExtendReasonCode.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Copyright (c) 2023 Apple Inc. Licensed under MIT License.
22

3-
from enum import Enum
3+
from enum import IntEnum
44

5-
class ExtendReasonCode(Enum):
5+
class ExtendReasonCode(IntEnum):
66
"""
77
The code that represents the reason for the subscription-renewal-date extension.
88

appstoreserverlibrary/models/FirstSendAttemptResult.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from enum import Enum, unique
44

55
@unique
6-
class FirstSendAttemptResult(Enum):
6+
class FirstSendAttemptResult(str, Enum):
77
"""
88
An error or result that the App Store server receives when attempting to send an App Store server notification to your server.
99

appstoreserverlibrary/models/InAppOwnershipType.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from enum import Enum
44

5-
class InAppOwnershipType(Enum):
5+
class InAppOwnershipType(str, Enum):
66
"""
77
The relationship of the user with the family-shared purchase to which they have access.
88

0 commit comments

Comments
 (0)