diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f7dc0ced..4ab5d2a0 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.0.0-alpha.1" + ".": "4.0.0-alpha.2" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 75bc5ebf..d3cca5f0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 108 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/intercom%2Fintercom-61fd2f21fb0fb6a94c5e87ea423d828bf37d1dd90ca1511eda9b91d58ccb5d39.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/intercom%2Fintercom-a52cc0e4313a38d4329e6c2f40afa341d800389762fc643b9bf5b13248f8c5da.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index ac19a05a..d106458a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # Changelog +## 4.0.0-alpha.2 (2024-07-30) + +Full Changelog: [v4.0.0-alpha.1...v4.0.0-alpha.2](https://github.com/intercom/python-intercom/compare/v4.0.0-alpha.1...v4.0.0-alpha.2) + +### Features + +* **api:** update via SDK Studio ([#263](https://github.com/intercom/python-intercom/issues/263)) ([35af217](https://github.com/intercom/python-intercom/commit/35af217c3ce6fb0ac47aa0ecde8a08a99b4819ed)) +* **api:** update via SDK Studio ([#265](https://github.com/intercom/python-intercom/issues/265)) ([bcc28f6](https://github.com/intercom/python-intercom/commit/bcc28f659e15461bf4b0308720e5cac7b088f273)) +* **api:** update via SDK Studio ([#271](https://github.com/intercom/python-intercom/issues/271)) ([c29da78](https://github.com/intercom/python-intercom/commit/c29da7803e93ca8046292a8036b0000767c0fd29)) + + +### Chores + +* fix error message import example ([#268](https://github.com/intercom/python-intercom/issues/268)) ([13ea06f](https://github.com/intercom/python-intercom/commit/13ea06f33714036c77082340858ce2207a5854e1)) +* **internal:** add type construction helper ([#270](https://github.com/intercom/python-intercom/issues/270)) ([038341c](https://github.com/intercom/python-intercom/commit/038341c1f602021861754f1c5a75d4b284192885)) +* **internal:** codegen related update ([#269](https://github.com/intercom/python-intercom/issues/269)) ([5c0b8a6](https://github.com/intercom/python-intercom/commit/5c0b8a60732430e13cc75a2eb02f643b7aca291f)) +* **internal:** refactor release doctor script ([#261](https://github.com/intercom/python-intercom/issues/261)) ([b78c4f0](https://github.com/intercom/python-intercom/commit/b78c4f0ac7ee4a571d0be0c08b313bce3134a019)) +* **internal:** refactor release doctor script ([#264](https://github.com/intercom/python-intercom/issues/264)) ([81453ce](https://github.com/intercom/python-intercom/commit/81453cea53317789d7fff13c8c68509f6f700462)) +* **internal:** refactor release doctor script ([#266](https://github.com/intercom/python-intercom/issues/266)) ([276360c](https://github.com/intercom/python-intercom/commit/276360c3cad7c86e0629b4762f8c3e8469894e01)) +* **internal:** version bump ([#259](https://github.com/intercom/python-intercom/issues/259)) ([10e1901](https://github.com/intercom/python-intercom/commit/10e190128e63b17011af01bb5b0d927d6977809c)) +* **tests:** update prism version ([#262](https://github.com/intercom/python-intercom/issues/262)) ([229a17a](https://github.com/intercom/python-intercom/commit/229a17ad3b474dd230561a3dcf2eaf19f7189c20)) +* **tests:** update prism version ([#267](https://github.com/intercom/python-intercom/issues/267)) ([fbcc2c3](https://github.com/intercom/python-intercom/commit/fbcc2c373d0b7147f7fb92d3026226713ebb9b90)) +* Update README.md ([c7a1a2f](https://github.com/intercom/python-intercom/commit/c7a1a2f2c99c4f550d92e6b5e2170f2b5e734ea2)) + ## 4.0.0-alpha.1 (2024-07-19) Full Changelog: [v0.1.0...v4.0.0-alpha.1](https://github.com/intercom/python-intercom/compare/v0.1.0...v4.0.0-alpha.1) diff --git a/README.md b/README.md index 62f1b294..7df85c33 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ The REST API documentation can be found on [developers.intercom.com](https://dev ```sh # install from PyPI -pip install python-intercom +pip install python-intercom==4.0.0a1 ``` ## Usage diff --git a/api.md b/api.md index 79fccd52..edb09daa 100644 --- a/api.md +++ b/api.md @@ -15,7 +15,6 @@ from python_intercom.types import ( Message, MultipleFilterSearchRequest, Note, - PaginatedResponse, PartAttachment, Reference, SearchRequest, @@ -243,7 +242,7 @@ Methods: Types: ```python -from python_intercom.types import ConversationList, ConversationListResponse +from python_intercom.types import ConversationListResponse, ConversationSearchResponse ``` Methods: @@ -254,7 +253,7 @@ Methods: - client.conversations.list(\*\*params) -> SyncCursorPagination[ConversationListResponse] - client.conversations.convert(id, \*\*params) -> Optional - client.conversations.redact(\*\*params) -> Conversation -- client.conversations.search(\*\*params) -> ConversationList +- client.conversations.search(\*\*params) -> ConversationSearchResponse ## Tags @@ -365,7 +364,7 @@ Methods: Types: ```python -from python_intercom.types.news import NewsItem, NewsItemDeleteResponse +from python_intercom.types.news import NewsItem, NewsItemListResponse, NewsItemDeleteResponse ``` Methods: @@ -373,7 +372,7 @@ Methods: - client.news.news_items.create(\*\*params) -> NewsItem - client.news.news_items.retrieve(id) -> NewsItem - client.news.news_items.update(id, \*\*params) -> NewsItem -- client.news.news_items.list() -> PaginatedResponse +- client.news.news_items.list() -> NewsItemListResponse - client.news.news_items.delete(id) -> NewsItemDeleteResponse ## Newsfeeds @@ -381,19 +380,25 @@ Methods: Types: ```python -from python_intercom.types.news import Newsfeed +from python_intercom.types.news import Newsfeed, NewsfeedListResponse ``` Methods: - client.news.newsfeeds.retrieve(id) -> Newsfeed -- client.news.newsfeeds.list() -> PaginatedResponse +- client.news.newsfeeds.list() -> NewsfeedListResponse ### Items +Types: + +```python +from python_intercom.types.news.newsfeeds import ItemListResponse +``` + Methods: -- client.news.newsfeeds.items.list(id) -> PaginatedResponse +- client.news.newsfeeds.items.list(id) -> ItemListResponse # Notes diff --git a/pyproject.toml b/pyproject.toml index 0d3aca3b..9e2a20cc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "python-intercom" -version = "4.0.0-alpha.1" +version = "4.0.0-alpha.2" description = "The official Python library for the intercom API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/scripts/mock b/scripts/mock index fe89a1d0..f5861576 100755 --- a/scripts/mock +++ b/scripts/mock @@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}" # Run prism mock on the given spec if [ "$1" == "--daemon" ]; then - npm exec --package=@stoplight/prism-cli@~5.8 -- prism mock "$URL" &> .prism.log & + npm exec --package=@stainless-api/prism-cli@5.8.4 -- prism mock "$URL" &> .prism.log & # Wait for server to come online echo -n "Waiting for server" @@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then echo else - npm exec --package=@stoplight/prism-cli@~5.8 -- prism mock "$URL" + npm exec --package=@stainless-api/prism-cli@5.8.4 -- prism mock "$URL" fi diff --git a/src/python_intercom/_base_client.py b/src/python_intercom/_base_client.py index f1d16835..32b776d4 100644 --- a/src/python_intercom/_base_client.py +++ b/src/python_intercom/_base_client.py @@ -363,7 +363,7 @@ def __init__( if max_retries is None: # pyright: ignore[reportUnnecessaryComparison] raise TypeError( - "max_retries cannot be None. If you want to disable retries, pass `0`; if you want unlimited retries, pass `math.inf` or a very high number; if you want the default behavior, pass `python-intercom.DEFAULT_MAX_RETRIES`" + "max_retries cannot be None. If you want to disable retries, pass `0`; if you want unlimited retries, pass `math.inf` or a very high number; if you want the default behavior, pass `python_intercom.DEFAULT_MAX_RETRIES`" ) def _enforce_trailing_slash(self, url: URL) -> URL: diff --git a/src/python_intercom/_models.py b/src/python_intercom/_models.py index eb7ce3bd..5148d5a7 100644 --- a/src/python_intercom/_models.py +++ b/src/python_intercom/_models.py @@ -406,6 +406,15 @@ def build( return cast(_BaseModelT, construct_type(type_=base_model_cls, value=kwargs)) +def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T: + """Loose coercion to the expected type with construction of nested values. + + Note: the returned value from this function is not guaranteed to match the + given type. + """ + return cast(_T, construct_type(value=value, type_=type_)) + + def construct_type(*, value: object, type_: object) -> object: """Loose coercion to the expected type with construction of nested values. diff --git a/src/python_intercom/_version.py b/src/python_intercom/_version.py index 21b3bf0a..a418ee2f 100644 --- a/src/python_intercom/_version.py +++ b/src/python_intercom/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "python_intercom" -__version__ = "4.0.0-alpha.1" # x-release-please-version +__version__ = "4.0.0-alpha.2" # x-release-please-version diff --git a/src/python_intercom/resources/conversations/conversations.py b/src/python_intercom/resources/conversations/conversations.py index bb5fe02c..e1b9625f 100644 --- a/src/python_intercom/resources/conversations/conversations.py +++ b/src/python_intercom/resources/conversations/conversations.py @@ -77,9 +77,9 @@ ) from ...types.shared.ticket import Ticket from ...types.shared.message import Message -from ...types.conversation_list import ConversationList from ...types.shared.conversation import Conversation from ...types.conversation_list_response import ConversationListResponse +from ...types.conversation_search_response import ConversationSearchResponse __all__ = ["ConversationsResource", "AsyncConversationsResource"] @@ -739,7 +739,7 @@ def search( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ConversationList: + ) -> ConversationSearchResponse: """ You can search for multiple conversations by the value of their attributes in order to fetch exactly which ones you want. @@ -883,7 +883,7 @@ def search( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ConversationList, + cast_to=ConversationSearchResponse, ) @@ -1544,7 +1544,7 @@ async def search( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ConversationList: + ) -> ConversationSearchResponse: """ You can search for multiple conversations by the value of their attributes in order to fetch exactly which ones you want. @@ -1688,7 +1688,7 @@ async def search( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ConversationList, + cast_to=ConversationSearchResponse, ) diff --git a/src/python_intercom/resources/news/news_items.py b/src/python_intercom/resources/news/news_items.py index b346eb33..a58f2f7a 100644 --- a/src/python_intercom/resources/news/news_items.py +++ b/src/python_intercom/resources/news/news_items.py @@ -25,7 +25,7 @@ from ...types.news import news_item_create_params, news_item_update_params from ..._base_client import make_request_options from ...types.news.news_item import NewsItem -from ...types.shared.paginated_response import PaginatedResponse +from ...types.news.news_item_list_response import NewsItemListResponse from ...types.news.news_item_delete_response import NewsItemDeleteResponse __all__ = ["NewsItemsResource", "AsyncNewsItemsResource"] @@ -327,7 +327,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PaginatedResponse: + ) -> NewsItemListResponse: """ You can fetch a list of all news items @@ -352,7 +352,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PaginatedResponse, + cast_to=NewsItemListResponse, ) def delete( @@ -711,7 +711,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PaginatedResponse: + ) -> NewsItemListResponse: """ You can fetch a list of all news items @@ -736,7 +736,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PaginatedResponse, + cast_to=NewsItemListResponse, ) async def delete( diff --git a/src/python_intercom/resources/news/newsfeeds/items.py b/src/python_intercom/resources/news/newsfeeds/items.py index 63175b30..571ee207 100644 --- a/src/python_intercom/resources/news/newsfeeds/items.py +++ b/src/python_intercom/resources/news/newsfeeds/items.py @@ -17,7 +17,7 @@ async_to_streamed_response_wrapper, ) from ...._base_client import make_request_options -from ....types.shared.paginated_response import PaginatedResponse +from ....types.news.newsfeeds.item_list_response import ItemListResponse __all__ = ["ItemsResource", "AsyncItemsResource"] @@ -62,7 +62,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PaginatedResponse: + ) -> ItemListResponse: """ You can fetch a list of all news items that are live on a given newsfeed @@ -89,7 +89,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PaginatedResponse, + cast_to=ItemListResponse, ) @@ -133,7 +133,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PaginatedResponse: + ) -> ItemListResponse: """ You can fetch a list of all news items that are live on a given newsfeed @@ -160,7 +160,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PaginatedResponse, + cast_to=ItemListResponse, ) diff --git a/src/python_intercom/resources/news/newsfeeds/newsfeeds.py b/src/python_intercom/resources/news/newsfeeds/newsfeeds.py index ffcd4985..ed398314 100644 --- a/src/python_intercom/resources/news/newsfeeds/newsfeeds.py +++ b/src/python_intercom/resources/news/newsfeeds/newsfeeds.py @@ -26,7 +26,7 @@ ) from ...._base_client import make_request_options from ....types.news.newsfeed import Newsfeed -from ....types.shared.paginated_response import PaginatedResponse +from ....types.news.newsfeed_list_response import NewsfeedListResponse __all__ = ["NewsfeedsResource", "AsyncNewsfeedsResource"] @@ -135,7 +135,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PaginatedResponse: + ) -> NewsfeedListResponse: """ You can fetch a list of all newsfeeds @@ -160,7 +160,7 @@ def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PaginatedResponse, + cast_to=NewsfeedListResponse, ) @@ -268,7 +268,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> PaginatedResponse: + ) -> NewsfeedListResponse: """ You can fetch a list of all newsfeeds @@ -293,7 +293,7 @@ async def list( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=PaginatedResponse, + cast_to=NewsfeedListResponse, ) diff --git a/src/python_intercom/types/__init__.py b/src/python_intercom/types/__init__.py index 798a027a..a0f68036 100644 --- a/src/python_intercom/types/__init__.py +++ b/src/python_intercom/types/__init__.py @@ -20,7 +20,6 @@ ArticleContent as ArticleContent, PartAttachment as PartAttachment, ContactReference as ContactReference, - PaginatedResponse as PaginatedResponse, StartingAfterPaging as StartingAfterPaging, TicketTypeAttribute as TicketTypeAttribute, SubscriptionTypeList as SubscriptionTypeList, @@ -51,7 +50,6 @@ from .contact_archived import ContactArchived as ContactArchived from .help_center_list import HelpCenterList as HelpCenterList from .ticket_type_list import TicketTypeList as TicketTypeList -from .conversation_list import ConversationList as ConversationList from .contact_unarchived import ContactUnarchived as ContactUnarchived from .data_event_summary import DataEventSummary as DataEventSummary from .company_list_params import CompanyListParams as CompanyListParams @@ -94,6 +92,7 @@ from .tag_create_or_update_params import TagCreateOrUpdateParams as TagCreateOrUpdateParams from .company_retrieve_list_params import CompanyRetrieveListParams as CompanyRetrieveListParams from .conversation_retrieve_params import ConversationRetrieveParams as ConversationRetrieveParams +from .conversation_search_response import ConversationSearchResponse as ConversationSearchResponse from .data_attribute_create_params import DataAttributeCreateParams as DataAttributeCreateParams from .data_attribute_update_params import DataAttributeUpdateParams as DataAttributeUpdateParams from .data_export_content_data_params import DataExportContentDataParams as DataExportContentDataParams diff --git a/src/python_intercom/types/conversation_list.py b/src/python_intercom/types/conversation_search_response.py similarity index 91% rename from src/python_intercom/types/conversation_list.py rename to src/python_intercom/types/conversation_search_response.py index fdbaef93..9b2ac476 100644 --- a/src/python_intercom/types/conversation_list.py +++ b/src/python_intercom/types/conversation_search_response.py @@ -7,10 +7,10 @@ from .shared.conversation import Conversation from .shared.cursor_pages import CursorPages -__all__ = ["ConversationList"] +__all__ = ["ConversationSearchResponse"] -class ConversationList(BaseModel): +class ConversationSearchResponse(BaseModel): conversations: Optional[List[Conversation]] = None """The list of conversation objects""" diff --git a/src/python_intercom/types/news/__init__.py b/src/python_intercom/types/news/__init__.py index 41c0fea4..cb408518 100644 --- a/src/python_intercom/types/news/__init__.py +++ b/src/python_intercom/types/news/__init__.py @@ -4,6 +4,8 @@ from .newsfeed import Newsfeed as Newsfeed from .news_item import NewsItem as NewsItem +from .newsfeed_list_response import NewsfeedListResponse as NewsfeedListResponse from .news_item_create_params import NewsItemCreateParams as NewsItemCreateParams +from .news_item_list_response import NewsItemListResponse as NewsItemListResponse from .news_item_update_params import NewsItemUpdateParams as NewsItemUpdateParams from .news_item_delete_response import NewsItemDeleteResponse as NewsItemDeleteResponse diff --git a/src/python_intercom/types/shared/paginated_response.py b/src/python_intercom/types/news/news_item_list_response.py similarity index 81% rename from src/python_intercom/types/shared/paginated_response.py rename to src/python_intercom/types/news/news_item_list_response.py index bc025b53..4cb5b729 100644 --- a/src/python_intercom/types/shared/paginated_response.py +++ b/src/python_intercom/types/news/news_item_list_response.py @@ -3,17 +3,17 @@ from typing import List, Union, Optional from typing_extensions import Literal +from .newsfeed import Newsfeed from ..._models import BaseModel -from .cursor_pages import CursorPages -from ..news.newsfeed import Newsfeed -from ..news.news_item import NewsItem +from .news_item import NewsItem +from ..shared.cursor_pages import CursorPages -__all__ = ["PaginatedResponse", "Data"] +__all__ = ["NewsItemListResponse", "Data"] Data = Union[NewsItem, Newsfeed] -class PaginatedResponse(BaseModel): +class NewsItemListResponse(BaseModel): data: Optional[List[Data]] = None """An array of Objects""" diff --git a/src/python_intercom/types/news/newsfeed_list_response.py b/src/python_intercom/types/news/newsfeed_list_response.py new file mode 100644 index 00000000..170dd1ff --- /dev/null +++ b/src/python_intercom/types/news/newsfeed_list_response.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import Literal + +from .newsfeed import Newsfeed +from ..._models import BaseModel +from .news_item import NewsItem +from ..shared.cursor_pages import CursorPages + +__all__ = ["NewsfeedListResponse", "Data"] + +Data = Union[NewsItem, Newsfeed] + + +class NewsfeedListResponse(BaseModel): + data: Optional[List[Data]] = None + """An array of Objects""" + + pages: Optional[CursorPages] = None + """ + Cursor-based pagination is a technique used in the Intercom API to navigate + through large amounts of data. A "cursor" or pointer is used to keep track of + the current position in the result set, allowing the API to return the data in + small chunks or "pages" as needed. + """ + + total_count: Optional[int] = None + """A count of the total number of objects.""" + + type: Optional[Literal["list", "conversation.list"]] = None + """The type of object""" diff --git a/src/python_intercom/types/news/newsfeeds/__init__.py b/src/python_intercom/types/news/newsfeeds/__init__.py index f8ee8b14..93502d4f 100644 --- a/src/python_intercom/types/news/newsfeeds/__init__.py +++ b/src/python_intercom/types/news/newsfeeds/__init__.py @@ -1,3 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations + +from .item_list_response import ItemListResponse as ItemListResponse diff --git a/src/python_intercom/types/news/newsfeeds/item_list_response.py b/src/python_intercom/types/news/newsfeeds/item_list_response.py new file mode 100644 index 00000000..4e2d7f31 --- /dev/null +++ b/src/python_intercom/types/news/newsfeeds/item_list_response.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import Literal + +from ..newsfeed import Newsfeed +from ...._models import BaseModel +from ..news_item import NewsItem +from ...shared.cursor_pages import CursorPages + +__all__ = ["ItemListResponse", "Data"] + +Data = Union[NewsItem, Newsfeed] + + +class ItemListResponse(BaseModel): + data: Optional[List[Data]] = None + """An array of Objects""" + + pages: Optional[CursorPages] = None + """ + Cursor-based pagination is a technique used in the Intercom API to navigate + through large amounts of data. A "cursor" or pointer is used to keep track of + the current position in the result set, allowing the API to return the data in + small chunks or "pages" as needed. + """ + + total_count: Optional[int] = None + """A count of the total number of objects.""" + + type: Optional[Literal["list", "conversation.list"]] = None + """The type of object""" diff --git a/src/python_intercom/types/shared/__init__.py b/src/python_intercom/types/shared/__init__.py index e5fe0d4f..4a029fbe 100644 --- a/src/python_intercom/types/shared/__init__.py +++ b/src/python_intercom/types/shared/__init__.py @@ -16,7 +16,6 @@ from .article_content import ArticleContent as ArticleContent from .part_attachment import PartAttachment as PartAttachment from .contact_reference import ContactReference as ContactReference -from .paginated_response import PaginatedResponse as PaginatedResponse from .starting_after_paging import StartingAfterPaging as StartingAfterPaging from .ticket_type_attribute import TicketTypeAttribute as TicketTypeAttribute from .subscription_type_list import SubscriptionTypeList as SubscriptionTypeList diff --git a/tests/api_resources/contacts/test_companies.py b/tests/api_resources/contacts/test_companies.py index 71a0abab..9dab6c9a 100644 --- a/tests/api_resources/contacts/test_companies.py +++ b/tests/api_resources/contacts/test_companies.py @@ -72,14 +72,14 @@ def test_path_params_create(self, client: Intercom) -> None: @parametrize def test_method_list(self, client: Intercom) -> None: company = client.contacts.companies.list( - contact_id="contact_id", + contact_id="63a07ddf05a32042dffac965", ) assert_matches_type(ContactAttachedCompanies, company, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Intercom) -> None: company = client.contacts.companies.list( - contact_id="contact_id", + contact_id="63a07ddf05a32042dffac965", intercom_version="2.11", ) assert_matches_type(ContactAttachedCompanies, company, path=["response"]) @@ -87,7 +87,7 @@ def test_method_list_with_all_params(self, client: Intercom) -> None: @parametrize def test_raw_response_list(self, client: Intercom) -> None: response = client.contacts.companies.with_raw_response.list( - contact_id="contact_id", + contact_id="63a07ddf05a32042dffac965", ) assert response.is_closed is True @@ -98,7 +98,7 @@ def test_raw_response_list(self, client: Intercom) -> None: @parametrize def test_streaming_response_list(self, client: Intercom) -> None: with client.contacts.companies.with_streaming_response.list( - contact_id="contact_id", + contact_id="63a07ddf05a32042dffac965", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -230,14 +230,14 @@ async def test_path_params_create(self, async_client: AsyncIntercom) -> None: @parametrize async def test_method_list(self, async_client: AsyncIntercom) -> None: company = await async_client.contacts.companies.list( - contact_id="contact_id", + contact_id="63a07ddf05a32042dffac965", ) assert_matches_type(ContactAttachedCompanies, company, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIntercom) -> None: company = await async_client.contacts.companies.list( - contact_id="contact_id", + contact_id="63a07ddf05a32042dffac965", intercom_version="2.11", ) assert_matches_type(ContactAttachedCompanies, company, path=["response"]) @@ -245,7 +245,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncIntercom) -> @parametrize async def test_raw_response_list(self, async_client: AsyncIntercom) -> None: response = await async_client.contacts.companies.with_raw_response.list( - contact_id="contact_id", + contact_id="63a07ddf05a32042dffac965", ) assert response.is_closed is True @@ -256,7 +256,7 @@ async def test_raw_response_list(self, async_client: AsyncIntercom) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncIntercom) -> None: async with async_client.contacts.companies.with_streaming_response.list( - contact_id="contact_id", + contact_id="63a07ddf05a32042dffac965", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/news/newsfeeds/test_items.py b/tests/api_resources/news/newsfeeds/test_items.py index 8bb85891..80926b94 100644 --- a/tests/api_resources/news/newsfeeds/test_items.py +++ b/tests/api_resources/news/newsfeeds/test_items.py @@ -9,7 +9,7 @@ from tests.utils import assert_matches_type from python_intercom import Intercom, AsyncIntercom -from python_intercom.types.shared import PaginatedResponse +from python_intercom.types.news.newsfeeds import ItemListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -22,7 +22,7 @@ def test_method_list(self, client: Intercom) -> None: item = client.news.newsfeeds.items.list( id="123", ) - assert_matches_type(PaginatedResponse, item, path=["response"]) + assert_matches_type(ItemListResponse, item, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Intercom) -> None: @@ -30,7 +30,7 @@ def test_method_list_with_all_params(self, client: Intercom) -> None: id="123", intercom_version="2.11", ) - assert_matches_type(PaginatedResponse, item, path=["response"]) + assert_matches_type(ItemListResponse, item, path=["response"]) @parametrize def test_raw_response_list(self, client: Intercom) -> None: @@ -41,7 +41,7 @@ def test_raw_response_list(self, client: Intercom) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" item = response.parse() - assert_matches_type(PaginatedResponse, item, path=["response"]) + assert_matches_type(ItemListResponse, item, path=["response"]) @parametrize def test_streaming_response_list(self, client: Intercom) -> None: @@ -52,7 +52,7 @@ def test_streaming_response_list(self, client: Intercom) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" item = response.parse() - assert_matches_type(PaginatedResponse, item, path=["response"]) + assert_matches_type(ItemListResponse, item, path=["response"]) assert cast(Any, response.is_closed) is True @@ -72,7 +72,7 @@ async def test_method_list(self, async_client: AsyncIntercom) -> None: item = await async_client.news.newsfeeds.items.list( id="123", ) - assert_matches_type(PaginatedResponse, item, path=["response"]) + assert_matches_type(ItemListResponse, item, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIntercom) -> None: @@ -80,7 +80,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncIntercom) -> id="123", intercom_version="2.11", ) - assert_matches_type(PaginatedResponse, item, path=["response"]) + assert_matches_type(ItemListResponse, item, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncIntercom) -> None: @@ -91,7 +91,7 @@ async def test_raw_response_list(self, async_client: AsyncIntercom) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" item = await response.parse() - assert_matches_type(PaginatedResponse, item, path=["response"]) + assert_matches_type(ItemListResponse, item, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncIntercom) -> None: @@ -102,7 +102,7 @@ async def test_streaming_response_list(self, async_client: AsyncIntercom) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" item = await response.parse() - assert_matches_type(PaginatedResponse, item, path=["response"]) + assert_matches_type(ItemListResponse, item, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/news/test_news_items.py b/tests/api_resources/news/test_news_items.py index 4b8b5cca..9a2a39f0 100644 --- a/tests/api_resources/news/test_news_items.py +++ b/tests/api_resources/news/test_news_items.py @@ -11,9 +11,9 @@ from python_intercom import Intercom, AsyncIntercom from python_intercom.types.news import ( NewsItem, + NewsItemListResponse, NewsItemDeleteResponse, ) -from python_intercom.types.shared import PaginatedResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -183,14 +183,14 @@ def test_streaming_response_update(self, client: Intercom) -> None: @parametrize def test_method_list(self, client: Intercom) -> None: news_item = client.news.news_items.list() - assert_matches_type(PaginatedResponse, news_item, path=["response"]) + assert_matches_type(NewsItemListResponse, news_item, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Intercom) -> None: news_item = client.news.news_items.list( intercom_version="2.11", ) - assert_matches_type(PaginatedResponse, news_item, path=["response"]) + assert_matches_type(NewsItemListResponse, news_item, path=["response"]) @parametrize def test_raw_response_list(self, client: Intercom) -> None: @@ -199,7 +199,7 @@ def test_raw_response_list(self, client: Intercom) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" news_item = response.parse() - assert_matches_type(PaginatedResponse, news_item, path=["response"]) + assert_matches_type(NewsItemListResponse, news_item, path=["response"]) @parametrize def test_streaming_response_list(self, client: Intercom) -> None: @@ -208,7 +208,7 @@ def test_streaming_response_list(self, client: Intercom) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" news_item = response.parse() - assert_matches_type(PaginatedResponse, news_item, path=["response"]) + assert_matches_type(NewsItemListResponse, news_item, path=["response"]) assert cast(Any, response.is_closed) is True @@ -417,14 +417,14 @@ async def test_streaming_response_update(self, async_client: AsyncIntercom) -> N @parametrize async def test_method_list(self, async_client: AsyncIntercom) -> None: news_item = await async_client.news.news_items.list() - assert_matches_type(PaginatedResponse, news_item, path=["response"]) + assert_matches_type(NewsItemListResponse, news_item, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIntercom) -> None: news_item = await async_client.news.news_items.list( intercom_version="2.11", ) - assert_matches_type(PaginatedResponse, news_item, path=["response"]) + assert_matches_type(NewsItemListResponse, news_item, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncIntercom) -> None: @@ -433,7 +433,7 @@ async def test_raw_response_list(self, async_client: AsyncIntercom) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" news_item = await response.parse() - assert_matches_type(PaginatedResponse, news_item, path=["response"]) + assert_matches_type(NewsItemListResponse, news_item, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncIntercom) -> None: @@ -442,7 +442,7 @@ async def test_streaming_response_list(self, async_client: AsyncIntercom) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" news_item = await response.parse() - assert_matches_type(PaginatedResponse, news_item, path=["response"]) + assert_matches_type(NewsItemListResponse, news_item, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/news/test_newsfeeds.py b/tests/api_resources/news/test_newsfeeds.py index 2db0f22f..f870dc00 100644 --- a/tests/api_resources/news/test_newsfeeds.py +++ b/tests/api_resources/news/test_newsfeeds.py @@ -9,8 +9,7 @@ from tests.utils import assert_matches_type from python_intercom import Intercom, AsyncIntercom -from python_intercom.types.news import Newsfeed -from python_intercom.types.shared import PaginatedResponse +from python_intercom.types.news import Newsfeed, NewsfeedListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -67,14 +66,14 @@ def test_path_params_retrieve(self, client: Intercom) -> None: @parametrize def test_method_list(self, client: Intercom) -> None: newsfeed = client.news.newsfeeds.list() - assert_matches_type(PaginatedResponse, newsfeed, path=["response"]) + assert_matches_type(NewsfeedListResponse, newsfeed, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Intercom) -> None: newsfeed = client.news.newsfeeds.list( intercom_version="2.11", ) - assert_matches_type(PaginatedResponse, newsfeed, path=["response"]) + assert_matches_type(NewsfeedListResponse, newsfeed, path=["response"]) @parametrize def test_raw_response_list(self, client: Intercom) -> None: @@ -83,7 +82,7 @@ def test_raw_response_list(self, client: Intercom) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" newsfeed = response.parse() - assert_matches_type(PaginatedResponse, newsfeed, path=["response"]) + assert_matches_type(NewsfeedListResponse, newsfeed, path=["response"]) @parametrize def test_streaming_response_list(self, client: Intercom) -> None: @@ -92,7 +91,7 @@ def test_streaming_response_list(self, client: Intercom) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" newsfeed = response.parse() - assert_matches_type(PaginatedResponse, newsfeed, path=["response"]) + assert_matches_type(NewsfeedListResponse, newsfeed, path=["response"]) assert cast(Any, response.is_closed) is True @@ -149,14 +148,14 @@ async def test_path_params_retrieve(self, async_client: AsyncIntercom) -> None: @parametrize async def test_method_list(self, async_client: AsyncIntercom) -> None: newsfeed = await async_client.news.newsfeeds.list() - assert_matches_type(PaginatedResponse, newsfeed, path=["response"]) + assert_matches_type(NewsfeedListResponse, newsfeed, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIntercom) -> None: newsfeed = await async_client.news.newsfeeds.list( intercom_version="2.11", ) - assert_matches_type(PaginatedResponse, newsfeed, path=["response"]) + assert_matches_type(NewsfeedListResponse, newsfeed, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncIntercom) -> None: @@ -165,7 +164,7 @@ async def test_raw_response_list(self, async_client: AsyncIntercom) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" newsfeed = await response.parse() - assert_matches_type(PaginatedResponse, newsfeed, path=["response"]) + assert_matches_type(NewsfeedListResponse, newsfeed, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncIntercom) -> None: @@ -174,6 +173,6 @@ async def test_streaming_response_list(self, async_client: AsyncIntercom) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" newsfeed = await response.parse() - assert_matches_type(PaginatedResponse, newsfeed, path=["response"]) + assert_matches_type(NewsfeedListResponse, newsfeed, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_conversations.py b/tests/api_resources/test_conversations.py index 38078f0e..18354405 100644 --- a/tests/api_resources/test_conversations.py +++ b/tests/api_resources/test_conversations.py @@ -10,8 +10,8 @@ from tests.utils import assert_matches_type from python_intercom import Intercom, AsyncIntercom from python_intercom.types import ( - ConversationList, ConversationListResponse, + ConversationSearchResponse, ) from python_intercom.pagination import SyncCursorPagination, AsyncCursorPagination from python_intercom.types.shared import Ticket, Message, Conversation @@ -342,7 +342,7 @@ def test_method_search(self, client: Intercom) -> None: conversation = client.conversations.search( query={}, ) - assert_matches_type(ConversationList, conversation, path=["response"]) + assert_matches_type(ConversationSearchResponse, conversation, path=["response"]) @parametrize def test_method_search_with_all_params(self, client: Intercom) -> None: @@ -358,7 +358,7 @@ def test_method_search_with_all_params(self, client: Intercom) -> None: }, intercom_version="2.11", ) - assert_matches_type(ConversationList, conversation, path=["response"]) + assert_matches_type(ConversationSearchResponse, conversation, path=["response"]) @parametrize def test_raw_response_search(self, client: Intercom) -> None: @@ -369,7 +369,7 @@ def test_raw_response_search(self, client: Intercom) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" conversation = response.parse() - assert_matches_type(ConversationList, conversation, path=["response"]) + assert_matches_type(ConversationSearchResponse, conversation, path=["response"]) @parametrize def test_streaming_response_search(self, client: Intercom) -> None: @@ -380,7 +380,7 @@ def test_streaming_response_search(self, client: Intercom) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" conversation = response.parse() - assert_matches_type(ConversationList, conversation, path=["response"]) + assert_matches_type(ConversationSearchResponse, conversation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -708,7 +708,7 @@ async def test_method_search(self, async_client: AsyncIntercom) -> None: conversation = await async_client.conversations.search( query={}, ) - assert_matches_type(ConversationList, conversation, path=["response"]) + assert_matches_type(ConversationSearchResponse, conversation, path=["response"]) @parametrize async def test_method_search_with_all_params(self, async_client: AsyncIntercom) -> None: @@ -724,7 +724,7 @@ async def test_method_search_with_all_params(self, async_client: AsyncIntercom) }, intercom_version="2.11", ) - assert_matches_type(ConversationList, conversation, path=["response"]) + assert_matches_type(ConversationSearchResponse, conversation, path=["response"]) @parametrize async def test_raw_response_search(self, async_client: AsyncIntercom) -> None: @@ -735,7 +735,7 @@ async def test_raw_response_search(self, async_client: AsyncIntercom) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" conversation = await response.parse() - assert_matches_type(ConversationList, conversation, path=["response"]) + assert_matches_type(ConversationSearchResponse, conversation, path=["response"]) @parametrize async def test_streaming_response_search(self, async_client: AsyncIntercom) -> None: @@ -746,6 +746,6 @@ async def test_streaming_response_search(self, async_client: AsyncIntercom) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" conversation = await response.parse() - assert_matches_type(ConversationList, conversation, path=["response"]) + assert_matches_type(ConversationSearchResponse, conversation, path=["response"]) assert cast(Any, response.is_closed) is True