Skip to content

feat(api): update via SDK Studio #271

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
merged 1 commit into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ from python_intercom.types import (
Message,
MultipleFilterSearchRequest,
Note,
PaginatedResponse,
PartAttachment,
Reference,
SearchRequest,
Expand Down Expand Up @@ -365,35 +364,41 @@ Methods:
Types:

```python
from python_intercom.types.news import NewsItem, NewsItemDeleteResponse
from python_intercom.types.news import NewsItem, NewsItemListResponse, NewsItemDeleteResponse
```

Methods:

- <code title="post /news/news_items">client.news.news_items.<a href="./src/python_intercom/resources/news/news_items.py">create</a>(\*\*<a href="src/python_intercom/types/news/news_item_create_params.py">params</a>) -> <a href="./src/python_intercom/types/news/news_item.py">NewsItem</a></code>
- <code title="get /news/news_items/{id}">client.news.news_items.<a href="./src/python_intercom/resources/news/news_items.py">retrieve</a>(id) -> <a href="./src/python_intercom/types/news/news_item.py">NewsItem</a></code>
- <code title="put /news/news_items/{id}">client.news.news_items.<a href="./src/python_intercom/resources/news/news_items.py">update</a>(id, \*\*<a href="src/python_intercom/types/news/news_item_update_params.py">params</a>) -> <a href="./src/python_intercom/types/news/news_item.py">NewsItem</a></code>
- <code title="get /news/news_items">client.news.news_items.<a href="./src/python_intercom/resources/news/news_items.py">list</a>() -> <a href="./src/python_intercom/types/shared/paginated_response.py">PaginatedResponse</a></code>
- <code title="get /news/news_items">client.news.news_items.<a href="./src/python_intercom/resources/news/news_items.py">list</a>() -> <a href="./src/python_intercom/types/news/news_item_list_response.py">NewsItemListResponse</a></code>
- <code title="delete /news/news_items/{id}">client.news.news_items.<a href="./src/python_intercom/resources/news/news_items.py">delete</a>(id) -> <a href="./src/python_intercom/types/news/news_item_delete_response.py">NewsItemDeleteResponse</a></code>

## Newsfeeds

Types:

```python
from python_intercom.types.news import Newsfeed
from python_intercom.types.news import Newsfeed, NewsfeedListResponse
```

Methods:

- <code title="get /news/newsfeeds/{id}">client.news.newsfeeds.<a href="./src/python_intercom/resources/news/newsfeeds/newsfeeds.py">retrieve</a>(id) -> <a href="./src/python_intercom/types/news/newsfeed.py">Newsfeed</a></code>
- <code title="get /news/newsfeeds">client.news.newsfeeds.<a href="./src/python_intercom/resources/news/newsfeeds/newsfeeds.py">list</a>() -> <a href="./src/python_intercom/types/shared/paginated_response.py">PaginatedResponse</a></code>
- <code title="get /news/newsfeeds">client.news.newsfeeds.<a href="./src/python_intercom/resources/news/newsfeeds/newsfeeds.py">list</a>() -> <a href="./src/python_intercom/types/news/newsfeed_list_response.py">NewsfeedListResponse</a></code>

### Items

Types:

```python
from python_intercom.types.news.newsfeeds import ItemListResponse
```

Methods:

- <code title="get /news/newsfeeds/{id}/items">client.news.newsfeeds.items.<a href="./src/python_intercom/resources/news/newsfeeds/items.py">list</a>(id) -> <a href="./src/python_intercom/types/shared/paginated_response.py">PaginatedResponse</a></code>
- <code title="get /news/newsfeeds/{id}/items">client.news.newsfeeds.items.<a href="./src/python_intercom/resources/news/newsfeeds/items.py">list</a>(id) -> <a href="./src/python_intercom/types/news/newsfeeds/item_list_response.py">ItemListResponse</a></code>

# Notes

Expand Down
10 changes: 5 additions & 5 deletions src/python_intercom/resources/news/news_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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

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

Expand All @@ -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(
Expand Down
10 changes: 5 additions & 5 deletions src/python_intercom/resources/news/newsfeeds/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

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

Expand All @@ -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,
)


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

Expand All @@ -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,
)


Expand Down
10 changes: 5 additions & 5 deletions src/python_intercom/resources/news/newsfeeds/newsfeeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

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

Expand All @@ -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,
)


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

Expand All @@ -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,
)


Expand Down
1 change: 0 additions & 1 deletion src/python_intercom/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions src/python_intercom/types/news/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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"""

Expand Down
32 changes: 32 additions & 0 deletions src/python_intercom/types/news/newsfeed_list_response.py
Original file line number Diff line number Diff line change
@@ -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"""
2 changes: 2 additions & 0 deletions src/python_intercom/types/news/newsfeeds/__init__.py
Original file line number Diff line number Diff line change
@@ -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
32 changes: 32 additions & 0 deletions src/python_intercom/types/news/newsfeeds/item_list_response.py
Original file line number Diff line number Diff line change
@@ -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"""
1 change: 0 additions & 1 deletion src/python_intercom/types/shared/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions tests/api_resources/news/newsfeeds/test_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -22,15 +22,15 @@ 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:
item = client.news.newsfeeds.items.list(
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:
Expand All @@ -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:
Expand All @@ -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

Expand All @@ -72,15 +72,15 @@ 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:
item = await async_client.news.newsfeeds.items.list(
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:
Expand All @@ -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:
Expand All @@ -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

Expand Down
Loading