Skip to content

Commit 982919f

Browse files
Merge pull request #82 from hakusai22/fix_codestyle_desc
fix: update code and method annotation
2 parents 6c795d7 + a1f5f62 commit 982919f

12 files changed

+35
-26
lines changed

NOTICE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
5454
SOFTWARE.
5555
_____________________
5656

57-
requests contirbutors (requests)
57+
requests contributors (requests)
5858

5959
Apache License
6060
Version 2.0, January 2004

appstoreserverlibrary/api_client.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -472,17 +472,17 @@ def _generate_token(self) -> str:
472472

473473
def _make_request(self, path: str, method: str, queryParameters: Dict[str, Union[str, List[str]]], body, destination_class: Type[T]) -> T:
474474
url = self._base_url + path
475-
c = _get_cattrs_converter(type(body)) if body != None else None
476-
json = c.unstructure(body) if body != None else None
475+
c = _get_cattrs_converter(type(body)) if body is not None else None
476+
json = c.unstructure(body) if body is not None else None
477477
headers = {
478478
'User-Agent': "app-store-server-library/python/1.1.0",
479479
'Authorization': 'Bearer ' + self._generate_token(),
480480
'Accept': 'application/json'
481481
}
482482

483483
response = self._execute_request(method, url, queryParameters, headers, json)
484-
if response.status_code >= 200 and response.status_code < 300:
485-
if destination_class == None:
484+
if 200 <= response.status_code < 300:
485+
if destination_class is None:
486486
return
487487
c = _get_cattrs_converter(destination_class)
488488
response_body = response.json()
@@ -536,7 +536,7 @@ def get_all_subscription_statuses(self, transaction_id: str, status: Optional[Li
536536
:throws APIException: If a response was returned indicating the request could not be processed
537537
"""
538538
queryParameters: Dict[str, List[str]] = dict()
539-
if status != None:
539+
if status is not None:
540540
queryParameters["status"] = [s.value for s in status]
541541

542542
return self._make_request("/inApps/v1/subscriptions/" + transaction_id, "GET", queryParameters, None, StatusResponse)
@@ -547,13 +547,13 @@ def get_refund_history(self, transaction_id: str, revision: Optional[str]) -> Re
547547
https://developer.apple.com/documentation/appstoreserverapi/get_refund_history
548548
549549
:param transaction_id: The identifier of a transaction that belongs to the customer, and which may be an original transaction identifier.
550-
:param revision: A token you provide to get the next set of up to 20 transactions. All responses include a revision token. Use the revision token from the previous RefundHistoryResponse.
550+
:param revision: A token you provide to get the next set of up to 20 transactions. All responses include a revision token. Use the revision token from the previous RefundHistoryResponse.
551551
:return: A response that contains status information for all of a customer's auto-renewable subscriptions in your app.
552552
:throws APIException: If a response was returned indicating the request could not be processed
553553
"""
554554

555555
queryParameters: Dict[str, List[str]] = dict()
556-
if revision != None:
556+
if revision is not None:
557557
queryParameters["revision"] = [revision]
558558

559559
return self._make_request("/inApps/v2/refund/lookup/" + transaction_id, "GET", queryParameters, None, RefundHistoryResponse)
@@ -564,7 +564,7 @@ def get_status_of_subscription_renewal_date_extensions(self, request_identifier:
564564
https://developer.apple.com/documentation/appstoreserverapi/get_status_of_subscription_renewal_date_extensions
565565
566566
:param request_identifier: The UUID that represents your request to the Extend Subscription Renewal Dates for All Active Subscribers endpoint.
567-
:param product_id: The product identifier of the auto-renewable subscription that you request a renewal-date extension for.
567+
:param product_id: The product identifier of the auto-renewable subscription that you request a renewal-date extension for.
568568
:return: A response that indicates the current status of a request to extend the subscription renewal date to all eligible subscribers.
569569
:throws APIException: If a response was returned indicating the request could not be processed
570570
"""
@@ -592,7 +592,7 @@ def get_notification_history(self, pagination_token: Optional[str], notification
592592
:throws APIException: If a response was returned indicating the request could not be processed
593593
"""
594594
queryParameters: Dict[str, List[str]] = dict()
595-
if pagination_token != None:
595+
if pagination_token is not None:
596596
queryParameters["paginationToken"] = [pagination_token]
597597

598598
return self._make_request("/inApps/v1/notifications/history", "POST", queryParameters, notification_history_request, NotificationHistoryResponse)
@@ -603,36 +603,37 @@ def get_transaction_history(self, transaction_id: str, revision: Optional[str],
603603
https://developer.apple.com/documentation/appstoreserverapi/get_transaction_history
604604
605605
:param transaction_id: The identifier of a transaction that belongs to the customer, and which may be an original transaction identifier.
606-
:param revision: A token you provide to get the next set of up to 20 transactions. All responses include a revision token. Note: For requests that use the revision token, include the same query parameters from the initial request. Use the revision token from the previous HistoryResponse.
606+
:param revision: A token you provide to get the next set of up to 20 transactions. All responses include a revision token. Note: For requests that use the revision token, include the same query parameters from the initial request. Use the revision token from the previous HistoryResponse.
607+
:param transaction_history_request: The request parameters that includes the startDate,endDate,productIds,productTypes and optional query constraints.
607608
:return: A response that contains the customer's transaction history for an app.
608609
:throws APIException: If a response was returned indicating the request could not be processed
609610
"""
610611
queryParameters: Dict[str, List[str]] = dict()
611-
if revision != None:
612+
if revision is not None:
612613
queryParameters["revision"] = [revision]
613614

614-
if transaction_history_request.startDate != None:
615+
if transaction_history_request.startDate is not None:
615616
queryParameters["startDate"] = [str(transaction_history_request.startDate)]
616617

617-
if transaction_history_request.endDate != None:
618+
if transaction_history_request.endDate is not None:
618619
queryParameters["endDate"] = [str(transaction_history_request.endDate)]
619620

620-
if transaction_history_request.productIds != None:
621+
if transaction_history_request.productIds is not None:
621622
queryParameters["productId"] = transaction_history_request.productIds
622623

623-
if transaction_history_request.productTypes != None:
624+
if transaction_history_request.productTypes is not None:
624625
queryParameters["productType"] = [product_type.value for product_type in transaction_history_request.productTypes]
625626

626-
if transaction_history_request.sort != None:
627+
if transaction_history_request.sort is not None:
627628
queryParameters["sort"] = [transaction_history_request.sort.value]
628629

629-
if transaction_history_request.subscriptionGroupIdentifiers != None:
630+
if transaction_history_request.subscriptionGroupIdentifiers is not None:
630631
queryParameters["subscriptionGroupIdentifier"] = transaction_history_request.subscriptionGroupIdentifiers
631632

632-
if transaction_history_request.inAppOwnershipType != None:
633+
if transaction_history_request.inAppOwnershipType is not None:
633634
queryParameters["inAppOwnershipType"] = [transaction_history_request.inAppOwnershipType.value]
634635

635-
if transaction_history_request.revoked != None:
636+
if transaction_history_request.revoked is not None:
636637
queryParameters["revoked"] = [str(transaction_history_request.revoked)]
637638

638639
return self._make_request("/inApps/v1/history/" + transaction_id, "GET", queryParameters, None, HistoryResponse)

appstoreserverlibrary/models/ExtendRenewalDateRequest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class ExtendRenewalDateRequest:
1717
extendByDays: Optional[int] = attr.ib(default=None)
1818
"""
1919
The number of days to extend the subscription renewal date.
20-
20+
2121
https://developer.apple.com/documentation/appstoreserverapi/extendbydays
2222
maximum: 90
2323
"""

appstoreserverlibrary/models/JWSTransactionDecodedPayload.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ class JWSTransactionDecodedPayload(AttrsRawValueAware):
203203

204204
transactionReason: Optional[TransactionReason] = TransactionReason.create_main_attr('rawTransactionReason')
205205
"""
206-
The reason for the purchase transaction, which indicates whether it's a customer's purchase or a renewal for an auto-renewable subscription that the system initates.
206+
The reason for the purchase transaction, which indicates whether it's a customer's purchase or a renewal for an auto-renewable subscription that the system initiates.
207207
208208
https://developer.apple.com/documentation/appstoreserverapi/transactionreason
209209
"""

appstoreserverlibrary/models/NotificationHistoryResponse.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ class NotificationHistoryResponse:
3232
"""
3333
An array of App Store server notification history records.
3434
35+
https://developer.apple.com/documentation/appstoreserverapi/notificationhistoryresponseitem
3536
"""

appstoreserverlibrary/models/NotificationTypeV2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class NotificationTypeV2(str, Enum, metaclass=AppStoreServerLibraryEnumMeta):
88
"""
99
A notification type value that App Store Server Notifications V2 uses.
1010
11-
https://developer.apple.com/documentation/appstoreserverapi/notificationtype
11+
https://developer.apple.com/documentation/appstoreservernotifications/notificationtype
1212
"""
1313
SUBSCRIBED = "SUBSCRIBED"
1414
DID_CHANGE_RENEWAL_PREF = "DID_CHANGE_RENEWAL_PREF"

appstoreserverlibrary/models/OrderLookupResponse.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,6 @@ class OrderLookupResponse(AttrsRawValueAware):
3030
signedTransactions: Optional[List[str]] = attr.ib(default=None)
3131
"""
3232
An array of in-app purchase transactions that are part of order, signed by Apple, in JSON Web Signature format.
33+
34+
https://developer.apple.com/documentation/appstoreserverapi/jwstransaction
3335
"""

appstoreserverlibrary/models/RefundHistoryResponse.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ class RefundHistoryResponse:
1515
signedTransactions: Optional[List[str]] = attr.ib(default=None)
1616
"""
1717
A list of up to 20 JWS transactions, or an empty array if the customer hasn't received any refunds in your app. The transactions are sorted in ascending order by revocationDate.
18+
19+
https://developer.apple.com/documentation/appstoreserverapi/jwstransaction
1820
"""
1921

2022
revision: Optional[str] = attr.ib(default=None)

appstoreserverlibrary/models/StatusResponse.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,5 @@ class StatusResponse(AttrsRawValueAware):
4646
"""
4747
An array of information for auto-renewable subscriptions, including App Store-signed transaction information and App Store-signed renewal information.
4848
49+
https://developer.apple.com/documentation/appstoreserverapi/subscriptiongroupidentifieritem
4950
"""

appstoreserverlibrary/models/SubscriptionGroupIdentifierItem.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@ class SubscriptionGroupIdentifierItem:
2424
lastTransactions: Optional[List[LastTransactionsItem]] = attr.ib(default=None)
2525
"""
2626
An array of the most recent App Store-signed transaction information and App Store-signed renewal information for all auto-renewable subscriptions in the subscription group.
27+
28+
https://developer.apple.com/documentation/appstoreserverapi/lasttransactionsitem
2729
"""

0 commit comments

Comments
 (0)