Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Jul 30, 2024
1 parent 81453ce commit bcc28f6
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 20 deletions.
4 changes: 2 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ Methods:
Types:

```python
from python_intercom.types import ConversationList, ConversationListResponse
from python_intercom.types import Conversation, ConversationListResponse, ConversationSearchResponse
```

Methods:
Expand All @@ -254,7 +254,7 @@ Methods:
- <code title="get /conversations">client.conversations.<a href="./src/python_intercom/resources/conversations/conversations.py">list</a>(\*\*<a href="src/python_intercom/types/conversation_list_params.py">params</a>) -> <a href="./src/python_intercom/types/conversation_list_response.py">SyncCursorPagination[ConversationListResponse]</a></code>
- <code title="post /conversations/{id}/convert">client.conversations.<a href="./src/python_intercom/resources/conversations/conversations.py">convert</a>(id, \*\*<a href="src/python_intercom/types/conversation_convert_params.py">params</a>) -> <a href="./src/python_intercom/types/shared/ticket.py">Optional</a></code>
- <code title="post /conversations/redact">client.conversations.<a href="./src/python_intercom/resources/conversations/conversations.py">redact</a>(\*\*<a href="src/python_intercom/types/conversation_redact_params.py">params</a>) -> <a href="./src/python_intercom/types/shared/conversation.py">Conversation</a></code>
- <code title="post /conversations/search">client.conversations.<a href="./src/python_intercom/resources/conversations/conversations.py">search</a>(\*\*<a href="src/python_intercom/types/conversation_search_params.py">params</a>) -> <a href="./src/python_intercom/types/conversation_list.py">ConversationList</a></code>
- <code title="post /conversations/search">client.conversations.<a href="./src/python_intercom/resources/conversations/conversations.py">search</a>(\*\*<a href="src/python_intercom/types/conversation_search_params.py">params</a>) -> <a href="./src/python_intercom/types/conversation_search_response.py">ConversationSearchResponse</a></code>

## Tags

Expand Down
13 changes: 12 additions & 1 deletion bin/check-release-environment
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
#!/usr/bin/env bash

warnings=()
errors=()

if [ -z "${PYPI_TOKEN}" ]; then
errors+=("The INTERCOM_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
warnings+=("The INTERCOM_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
fi

lenWarnings=${#warnings[@]}

if [[ lenWarnings -gt 0 ]]; then
echo -e "Found the following warnings in the release environment:\n"

for warning in "${warnings[@]}"; do
echo -e "- $warning\n"
done
fi

lenErrors=${#errors[@]}
Expand Down
10 changes: 5 additions & 5 deletions src/python_intercom/resources/conversations/conversations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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,
)


Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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,
)


Expand Down
2 changes: 1 addition & 1 deletion src/python_intercom/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,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
Expand Down Expand Up @@ -94,6 +93,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"""

Expand Down
18 changes: 9 additions & 9 deletions tests/api_resources/test_conversations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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

Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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

0 comments on commit bcc28f6

Please sign in to comment.