-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add SearchableAPIResource and SearchResultObject for types- 8000 stripe #8696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
AlexWaygood
merged 12 commits into
python:master
from
yejia-stripe:stripe-searchable-api-resource
Sep 13, 2022
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
56f5dc9
Add SearchableAPIResource and SearchResultObject for types-stripe
yejia-stripe 085a991
add type annotation for getitem key
yejia-stripe 312b588
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] b9bb711
fix lint errors
yejia-stripe 5205015
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 5d363dc
fix lint error
yejia-stripe 517d847
Fix type for SearchResultObject.OBJECT_NAME
yejia-stripe ae84ddb
Fix Literal import
yejia-stripe b1e3929
Add SearchableAPIResource methods to stubtest_allowlist
yejia-stripe 96fbe14
fix allowlist
yejia-stripe aea6720
Address review feedback
yejia-stripe c1915de
Remove unnecessary `...`
AlexWaygood File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# The following methods have custom classmethod decorators | ||
stripe\..*\.delete | ||
stripe\..*PaymentIntent\.confirm | ||
stripe\.api_resources\..*\.SearchableAPIResource\.search # Not defined on the actual class in v3, but expected to exist. | ||
stripe\.api_resources\..*\.SearchableAPIResource\.search_auto_paging_iter # Not defined on the actual class in v3, but expected to exist. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
stubs/stripe/stripe/api_resources/abstract/searchable_api_resource.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectiona
8000
l Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from _typeshed import Self | ||
from collections.abc import Iterator | ||
|
||
from stripe.api_resources.abstract.api_resource import APIResource as APIResource | ||
from stripe.api_resources.search_result_object import SearchResultObject | ||
|
||
class SearchableAPIResource(APIResource): | ||
@classmethod | ||
def search(cls: type[Self], *args: str | None, **kwargs) -> SearchResultObject[Self]: ... | ||
@classmethod | ||
def search_auto_paging_iter(cls: type[Self], *args: str | None, **kwargs) -> Iterator[Self]: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden o
6D40
r bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
from stripe.api_resources.abstract import ( | ||
CreateableAPIResource as CreateableAPIResource, | ||
ListableAPIResour 9E88 ce as ListableAPIResource, | ||
SearchableAPIResource as SearchableAPIResource, | ||
UpdateableAPIResource as UpdateableAPIResource, | ||
) | ||
|
||
class Price(CreateableAPIResource, ListableAPIResource, UpdateableAPIResource): | ||
class Price(CreateableAPIResource, ListableAPIResource, SearchableAPIResource, UpdateableAPIResource): | ||
OBJECT_NAME: str |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
stubs/stripe/stripe/api_resources/search_result_object.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from _typeshed import Self | ||
from collections.abc import Iterator | ||
from typing import Any, ClassVar, Generic, TypeVar | ||
from typing_extensions import Literal | ||
|
||
from stripe.stripe_object import StripeObject | ||
|
||
_T = TypeVar("_T") | ||
|
||
class SearchResultObject(StripeObject, Generic[_T]): | ||
OBJECT_NAME: ClassVar[Literal["search_result"]] | ||
url: str | ||
has_more: bool | ||
data: list[_T] | ||
next_page: str | ||
total_count: int | ||
|
||
def search( | ||
self: Self, api_key: str | None = ..., stripe_version: str | None = ..., stripe_account: str | None = ..., **params | ||
) -> Self: ... | ||
def __getitem__(self, k: str) -> Any: ... | ||
def __iter__(self) -> Iterator[_T]: ... | ||
def __len__(self) -> int: ... | ||
def auto_paging_iter(self) -> Iterator[_T]: ... | ||
@classmethod | ||
def empty_search_result( | ||
cls: type[Self], api_key: str | None = ..., stripe_version: str | None = ..., stripe_account: str | None = ... | ||
) -> Self: ... | ||
@property | ||
def is_empty(self) -> bool: ... | ||
def next_search_result_page( | ||
self: Self, api_key: str | None = ..., stripe_version: str | None = ..., stripe_account: str | None = ..., **params | ||
) -> Self: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.