client.admins.identify()client.admins.away(...)client.admins.list_all_activity_logs(...)client.admins.list()client.admins.find(...)client.articles.list(...)client.articles.create(...)client.articles.find(...)client.articles.update(...)New gifts in store for the jolly season
", +) + +``` +client.articles.delete(...)client.articles.search(...)client.help_centers.find(...)client.help_centers.list(...)client.companies.retrieve(...)client.companies.create_or_update(...)client.companies.find(...)client.companies.update(...)client.companies.delete(...)client.companies.list_attached_contacts(...)client.companies.list_attached_segments(...)client.companies.list(...)client.companies.scroll(...)client.companies.attach_contact(...)client.companies.detach_contact(...)client.contacts.list_attached_companies(...)client.contacts.list_attached_segments(...)client.contacts.list_attached_subscriptions(...)client.contacts.attach_subscription(...)client.contacts.detach_subscription(...)client.contacts.list_attached_tags(...)client.contacts.find(...)client.contacts.update(...)client.contacts.delete(...)client.contacts.merge_lead_in_user(...)client.contacts.search(...)client.contacts.list(...)client.contacts.create(...)client.contacts.archive(...)client.contacts.unarchive(...)client.notes.list(...)client.notes.create(...)client.notes.find(...)client.tags.tag_contact(...)client.tags.untag_contact(...)client.tags.tag_conversation(...)client.tags.untag_conversation(...)client.tags.list()client.tags.create(...)client.tags.find(...)client.tags.delete(...)client.tags.tag_ticket(...)client.tags.untag_ticket(...)client.conversations.list(...)client.conversations.create(...)client.conversations.find(...)client.conversations.update(...)client.conversations.search(...)client.conversations.reply(...)client.conversations.manage(...)client.conversations.run_assignment_rules(...)client.conversations.attach_contact_as_admin(...)client.conversations.detach_contact_as_admin(...)client.conversations.redact_conversation_part(...)client.conversations.convert_to_ticket(...)client.data_attributes.list(...)client.data_attributes.create(...)client.data_attributes.update(...)client.events.list(...)client.events.create(...)client.events.summaries(...)client.data_export.create(...)client.data_export.find(...)client.data_export.cancel(...)client.data_export.download(...)client.messages.create(...)client.segments.list(...)client.segments.find(...)client.subscription_types.list()client.phone_call_redirects.create(...)client.teams.list()client.teams.find(...)client.ticket_types.list()client.ticket_types.create(...)client.ticket_types.get(...)client.ticket_types.update(...)client.tickets.reply(...)client.tickets.create(...)client.tickets.get(...)client.tickets.update(...)client.tickets.search(...)client.visitors.find(...)client.visitors.update(...)client.visitors.merge_to_contact(...)client.help_centers.collections.list(...)client.help_centers.collections.create(...)client.help_centers.collections.find(...)client.help_centers.collections.update(...)client.help_centers.collections.delete(...)client.news.items.list()client.news.items.create(...)New costumes in store for this spooky season
", + sender_id=991267734, + state="live", + deliver_silently=True, + labels=["Product", "Update", "New"], + reactions=["😆", "😅"], + newsfeed_assignments=[ + NewsfeedAssignment( + newsfeed_id=53, + published_at=1664638214, + ) + ], +) + +``` +client.news.items.find(...)client.news.items.update(...)New gifts in store for the jolly season
", + sender_id=991267748, + reactions=["😝", "😂"], +) + +``` +client.news.items.delete(...)client.news.feeds.list_items(...)client.news.feeds.list()client.news.feeds.find(...)client.ticket_types.attributes.create(...)client.ticket_types.attributes.update(...)client.unstable.admins.identify_admin()client.unstable.admins.set_away_admin(...)client.unstable.admins.list_activity_logs(...)client.unstable.admins.list_admins()client.unstable.admins.retrieve_admin(...)client.unstable.ai_content.list_content_import_sources()client.unstable.ai_content.create_content_import_source(...)client.unstable.ai_content.get_content_import_source(...)client.unstable.ai_content.update_content_import_source(...)client.unstable.ai_content.delete_content_import_source(...)client.unstable.ai_content.list_external_pages()client.unstable.ai_content.create_external_page(...)client.unstable.ai_content.get_external_page(...)client.unstable.ai_content.update_external_page(...)client.unstable.ai_content.delete_external_page(...)client.unstable.articles.list_articles()client.unstable.articles.create_article(...)client.unstable.articles.retrieve_article(...)client.unstable.articles.delete_article(...)client.unstable.articles.search_articles(...)client.unstable.away_status_reasons.list_away_status_reasons()client.unstable.export.enqueue_a_new_reporting_data_export_job(...)client.unstable.export.list_available_datasets_and_attributes()client.unstable.help_center.list_all_collections()client.unstable.help_center.create_collection(...)client.unstable.help_center.retrieve_collection(...)client.unstable.help_center.update_collection(...)client.unstable.help_center.delete_collection(...)client.unstable.help_center.retrieve_help_center(...)client.unstable.help_center.list_help_centers()client.unstable.companies.retrieve_company(...)client.unstable.companies.create_or_update_company(...)client.unstable.companies.retrieve_a_company_by_id(...)client.unstable.companies.update_company(...)client.unstable.companies.delete_company(...)client.unstable.companies.list_attached_contacts(...)client.unstable.companies.list_attached_segments_for_companies(...)client.unstable.companies.list_all_companies(...)client.unstable.companies.scroll_over_all_companies(...)client.unstable.companies.attach_contact_to_a_company(...)client.unstable.companies.detach_contact_from_a_company(...)client.unstable.contacts.list_companies_for_a_contact(...)client.unstable.contacts.list_segments_for_a_contact(...)client.unstable.contacts.list_subscriptions_for_a_contact(...)client.unstable.contacts.list_tags_for_a_contact(...)client.unstable.contacts.show_contact(...)client.unstable.contacts.update_contact(...)client.unstable.contacts.delete_contact(...)client.unstable.contacts.merge_contact(...)client.unstable.contacts.search_contacts(...)client.unstable.contacts.list_contacts()client.unstable.contacts.create_contact(...)client.unstable.contacts.show_contact_by_external_id(...)client.unstable.contacts.archive_contact(...)client.unstable.contacts.unarchive_contact(...)client.unstable.contacts.block_contact(...)client.unstable.notes.list_notes(...)client.unstable.notes.create_note(...)client.unstable.notes.retrieve_note(...)client.unstable.subscription_types.attach_subscription_type_to_contact(...)client.unstable.subscription_types.detach_subscription_type_to_contact(...)client.unstable.subscription_types.list_subscription_types()client.unstable.tags.attach_tag_to_contact(...)client.unstable.tags.detach_tag_from_contact(...)client.unstable.tags.attach_tag_to_conversation(...)client.unstable.tags.detach_tag_from_conversation(...)client.unstable.tags.list_tags()client.unstable.tags.create_tag(...)client.unstable.tags.find_tag(...)client.unstable.tags.delete_tag(...)client.unstable.tags.attach_tag_to_ticket(...)client.unstable.tags.detach_tag_from_ticket(...)client.unstable.conversations.list_conversations(...)client.unstable.conversations.create_conversation(...)client.unstable.conversations.retrieve_conversation(...)client.unstable.conversations.update_conversation(...)client.unstable.conversations.delete_conversation(...)client.unstable.conversations.search_conversations(...)client.unstable.conversations.reply_conversation(...)client.unstable.conversations.manage_conversation(...)client.unstable.conversations.attach_contact_to_conversation(...)client.unstable.conversations.detach_contact_from_conversation(...)client.unstable.conversations.redact_conversation(...)client.unstable.conversations.convert_conversation_to_ticket(...)client.unstable.custom_channel_events.notify_new_conversation(...)client.unstable.custom_channel_events.notify_new_message(...)client.unstable.custom_channel_events.notify_quick_reply_selected(...)client.unstable.custom_channel_events.notify_attribute_collected(...)client.unstable.custom_object_instances.get_custom_object_instances_by_external_id(...)client.unstable.custom_object_instances.create_custom_object_instances(...)client.unstable.custom_object_instances.delete_custom_object_instances_by_id(...)client.unstable.custom_object_instances.get_custom_object_instances_by_id(...)client.unstable.custom_object_instances.delete_custom_object_instances_by_external_id(...)client.unstable.data_attributes.lis_data_attributes(...)client.unstable.data_attributes.create_data_attribute(...)client.unstable.data_attributes.update_data_attribute(...)client.unstable.data_events.lis_data_events(...)client.unstable.data_events.create_data_event(...)client.unstable.data_events.data_event_summaries(...)client.unstable.data_export.create_data_export(...)client.unstable.data_export.get_data_export(...)client.unstable.data_export.cancel_data_export(...)client.unstable.data_export.download_data_export(...)client.unstable.jobs.status(...)client.unstable.messages.create_message(...)client.unstable.messages.get_whats_app_message_status(...)client.unstable.news.list_news_items()client.unstable.news.create_news_item(...)New costumes in store for this spooky season
", + sender_id=991267834, + state="live", + deliver_silently=True, + labels=["Product", "Update", "New"], + reactions=["😆", "😅"], + newsfeed_assignments=[ + NewsfeedAssignment( + newsfeed_id=53, + published_at=1664638214, + ) + ], +) + +``` +client.unstable.news.retrieve_news_item(...)client.unstable.news.update_news_item(...)New gifts in store for the jolly season
", + sender_id=991267848, + reactions=["😝", "😂"], +) + +``` +client.unstable.news.delete_news_item(...)client.unstable.news.list_live_newsfeed_items(...)client.unstable.news.list_newsfeeds()client.unstable.news.retrieve_newsfeed(...)client.unstable.segments.list_segments(...)client.unstable.segments.retrieve_segment(...)client.unstable.switch.create_phone_switch(...)client.unstable.teams.list_teams()client.unstable.teams.retrieve_team(...)client.unstable.ticket_states.list_ticket_states()client.unstable.ticket_type_attributes.create_ticket_type_attribute(...)client.unstable.ticket_type_attributes.update_ticket_type_attribute(...)client.unstable.ticket_types.list_ticket_types()client.unstable.ticket_types.create_ticket_type(...)client.unstable.ticket_types.get_ticket_type(...)client.unstable.tickets.reply_ticket(...)client.unstable.tickets.enqueue_create_ticket(...)client.unstable.tickets.get_ticket(...)client.unstable.tickets.update_ticket(...)client.unstable.tickets.delete_ticket(...)client.unstable.tickets.search_tickets(...)client.unstable.visitors.retrieve_visitor_with_user_id(...)client.unstable.visitors.update_visitor(...)client.unstable.visitors.convert_visitor(...)New gifts in store for the jolly season
", + ) + """ + _response = self._raw_client.update( + article_id, + title=title, + description=description, + body=body, + author_id=author_id, + state=state, + parent_id=parent_id, + parent_type=parent_type, + translated_content=translated_content, + request_options=request_options, + ) + return _response.data + + def delete( + self, article_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeletedArticleObject: + """ + You can delete a single article by making a DELETE request to `https://api.intercom.io/articles/New gifts in store for the jolly season
", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + article_id, + title=title, + description=description, + body=body, + author_id=author_id, + state=state, + parent_id=parent_id, + parent_type=parent_type, + translated_content=translated_content, + request_options=request_options, + ) + return _response.data + + async def delete( + self, article_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeletedArticleObject: + """ + You can delete a single article by making a DELETE request to `https://api.intercom.io/articles/New costumes in store for this spooky season
", + sender_id=991267734, + state="live", + deliver_silently=True, + labels=["Product", "Update", "New"], + reactions=["😆", "😅"], + newsfeed_assignments=[ + NewsfeedAssignment( + newsfeed_id=53, + published_at=1664638214, + ) + ], + ) + """ + _response = self._raw_client.create( + title=title, + sender_id=sender_id, + body=body, + state=state, + deliver_silently=deliver_silently, + labels=labels, + reactions=reactions, + newsfeed_assignments=newsfeed_assignments, + request_options=request_options, + ) + return _response.data + + def find(self, news_item_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> NewsItem: + """ + You can fetch the details of a single news item. + + Parameters + ---------- + news_item_id : str + The unique identifier for the news item which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + NewsItem + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.news.items.find( + news_item_id="123", + ) + """ + _response = self._raw_client.find(news_item_id, request_options=request_options) + return _response.data + + def update( + self, + news_item_id: str, + *, + title: str, + sender_id: int, + body: typing.Optional[str] = OMIT, + state: typing.Optional[NewsItemRequestState] = OMIT, + deliver_silently: typing.Optional[bool] = OMIT, + labels: typing.Optional[typing.Sequence[str]] = OMIT, + reactions: typing.Optional[typing.Sequence[typing.Optional[str]]] = OMIT, + newsfeed_assignments: typing.Optional[typing.Sequence[NewsfeedAssignment]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> NewsItem: + """ + Parameters + ---------- + news_item_id : str + The unique identifier for the news item which is given by Intercom. + + title : str + The title of the news item. + + sender_id : int + The id of the sender of the news item. Must be a teammate on the workspace. + + body : typing.Optional[str] + The news item body, which may contain HTML. + + state : typing.Optional[NewsItemRequestState] + News items will not be visible to your users in the assigned newsfeeds until they are set live. + + deliver_silently : typing.Optional[bool] + When set to `true`, the news item will appear in the messenger newsfeed without showing a notification badge. + + labels : typing.Optional[typing.Sequence[str]] + Label names displayed to users to categorize the news item. + + reactions : typing.Optional[typing.Sequence[typing.Optional[str]]] + Ordered list of emoji reactions to the news item. When empty, reactions are disabled. + + newsfeed_assignments : typing.Optional[typing.Sequence[NewsfeedAssignment]] + A list of newsfeed_assignments to assign to the specified newsfeed. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + NewsItem + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.news.items.update( + news_item_id="123", + title="Christmas is here!", + body="New gifts in store for the jolly season
", + sender_id=991267745, + reactions=["😝", "😂"], + ) + """ + _response = self._raw_client.update( + news_item_id, + title=title, + sender_id=sender_id, + body=body, + state=state, + deliver_silently=deliver_silently, + labels=labels, + reactions=reactions, + newsfeed_assignments=newsfeed_assignments, + request_options=request_options, + ) + return _response.data + + def delete(self, news_item_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> DeletedObject: + """ + You can delete a single news item. + + Parameters + ---------- + news_item_id : str + The unique identifier for the news item which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeletedObject + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.news.items.delete( + news_item_id="123", + ) + """ + _response = self._raw_client.delete(news_item_id, request_options=request_options) + return _response.data + + +class AsyncItemsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawItemsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawItemsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawItemsClient + """ + return self._raw_client + + async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> PaginatedNewsItemResponse: + """ + You can fetch a list of all news items + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PaginatedNewsItemResponse + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.news.items.list() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(request_options=request_options) + return _response.data + + async def create( + self, + *, + title: str, + sender_id: int, + body: typing.Optional[str] = OMIT, + state: typing.Optional[NewsItemRequestState] = OMIT, + deliver_silently: typing.Optional[bool] = OMIT, + labels: typing.Optional[typing.Sequence[str]] = OMIT, + reactions: typing.Optional[typing.Sequence[typing.Optional[str]]] = OMIT, + newsfeed_assignments: typing.Optional[typing.Sequence[NewsfeedAssignment]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> NewsItem: + """ + You can create a news item + + Parameters + ---------- + title : str + The title of the news item. + + sender_id : int + The id of the sender of the news item. Must be a teammate on the workspace. + + body : typing.Optional[str] + The news item body, which may contain HTML. + + state : typing.Optional[NewsItemRequestState] + News items will not be visible to your users in the assigned newsfeeds until they are set live. + + deliver_silently : typing.Optional[bool] + When set to `true`, the news item will appear in the messenger newsfeed without showing a notification badge. + + labels : typing.Optional[typing.Sequence[str]] + Label names displayed to users to categorize the news item. + + reactions : typing.Optional[typing.Sequence[typing.Optional[str]]] + Ordered list of emoji reactions to the news item. When empty, reactions are disabled. + + newsfeed_assignments : typing.Optional[typing.Sequence[NewsfeedAssignment]] + A list of newsfeed_assignments to assign to the specified newsfeed. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + NewsItem + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + from intercom.news import NewsfeedAssignment + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.news.items.create( + title="Halloween is here!", + body="New costumes in store for this spooky season
", + sender_id=991267734, + state="live", + deliver_silently=True, + labels=["Product", "Update", "New"], + reactions=["😆", "😅"], + newsfeed_assignments=[ + NewsfeedAssignment( + newsfeed_id=53, + published_at=1664638214, + ) + ], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + title=title, + sender_id=sender_id, + body=body, + state=state, + deliver_silently=deliver_silently, + labels=labels, + reactions=reactions, + newsfeed_assignments=newsfeed_assignments, + request_options=request_options, + ) + return _response.data + + async def find(self, news_item_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> NewsItem: + """ + You can fetch the details of a single news item. + + Parameters + ---------- + news_item_id : str + The unique identifier for the news item which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + NewsItem + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.news.items.find( + news_item_id="123", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.find(news_item_id, request_options=request_options) + return _response.data + + async def update( + self, + news_item_id: str, + *, + title: str, + sender_id: int, + body: typing.Optional[str] = OMIT, + state: typing.Optional[NewsItemRequestState] = OMIT, + deliver_silently: typing.Optional[bool] = OMIT, + labels: typing.Optional[typing.Sequence[str]] = OMIT, + reactions: typing.Optional[typing.Sequence[typing.Optional[str]]] = OMIT, + newsfeed_assignments: typing.Optional[typing.Sequence[NewsfeedAssignment]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> NewsItem: + """ + Parameters + ---------- + news_item_id : str + The unique identifier for the news item which is given by Intercom. + + title : str + The title of the news item. + + sender_id : int + The id of the sender of the news item. Must be a teammate on the workspace. + + body : typing.Optional[str] + The news item body, which may contain HTML. + + state : typing.Optional[NewsItemRequestState] + News items will not be visible to your users in the assigned newsfeeds until they are set live. + + deliver_silently : typing.Optional[bool] + When set to `true`, the news item will appear in the messenger newsfeed without showing a notification badge. + + labels : typing.Optional[typing.Sequence[str]] + Label names displayed to users to categorize the news item. + + reactions : typing.Optional[typing.Sequence[typing.Optional[str]]] + Ordered list of emoji reactions to the news item. When empty, reactions are disabled. + + newsfeed_assignments : typing.Optional[typing.Sequence[NewsfeedAssignment]] + A list of newsfeed_assignments to assign to the specified newsfeed. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + NewsItem + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.news.items.update( + news_item_id="123", + title="Christmas is here!", + body="New gifts in store for the jolly season
", + sender_id=991267745, + reactions=["😝", "😂"], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + news_item_id, + title=title, + sender_id=sender_id, + body=body, + state=state, + deliver_silently=deliver_silently, + labels=labels, + reactions=reactions, + newsfeed_assignments=newsfeed_assignments, + request_options=request_options, + ) + return _response.data + + async def delete( + self, news_item_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeletedObject: + """ + You can delete a single news item. + + Parameters + ---------- + news_item_id : str + The unique identifier for the news item which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeletedObject + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.news.items.delete( + news_item_id="123", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(news_item_id, request_options=request_options) + return _response.data diff --git a/src/intercom/news/items/raw_client.py b/src/intercom/news/items/raw_client.py new file mode 100644 index 0000000..229758a --- /dev/null +++ b/src/intercom/news/items/raw_client.py @@ -0,0 +1,785 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.not_found_error import NotFoundError +from ...errors.unauthorized_error import UnauthorizedError +from ...types.deleted_object import DeletedObject +from ...types.error import Error +from ...types.news_item_request_state import NewsItemRequestState +from ...types.paginated_news_item_response import PaginatedNewsItemResponse +from ..types.news_item import NewsItem +from ..types.newsfeed_assignment import NewsfeedAssignment + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawItemsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[PaginatedNewsItemResponse]: + """ + You can fetch a list of all news items + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[PaginatedNewsItemResponse] + successful + """ + _response = self._client_wrapper.httpx_client.request( + "news/news_items", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PaginatedNewsItemResponse, + construct_type( + type_=PaginatedNewsItemResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + *, + title: str, + sender_id: int, + body: typing.Optional[str] = OMIT, + state: typing.Optional[NewsItemRequestState] = OMIT, + deliver_silently: typing.Optional[bool] = OMIT, + labels: typing.Optional[typing.Sequence[str]] = OMIT, + reactions: typing.Optional[typing.Sequence[typing.Optional[str]]] = OMIT, + newsfeed_assignments: typing.Optional[typing.Sequence[NewsfeedAssignment]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[NewsItem]: + """ + You can create a news item + + Parameters + ---------- + title : str + The title of the news item. + + sender_id : int + The id of the sender of the news item. Must be a teammate on the workspace. + + body : typing.Optional[str] + The news item body, which may contain HTML. + + state : typing.Optional[NewsItemRequestState] + News items will not be visible to your users in the assigned newsfeeds until they are set live. + + deliver_silently : typing.Optional[bool] + When set to `true`, the news item will appear in the messenger newsfeed without showing a notification badge. + + labels : typing.Optional[typing.Sequence[str]] + Label names displayed to users to categorize the news item. + + reactions : typing.Optional[typing.Sequence[typing.Optional[str]]] + Ordered list of emoji reactions to the news item. When empty, reactions are disabled. + + newsfeed_assignments : typing.Optional[typing.Sequence[NewsfeedAssignment]] + A list of newsfeed_assignments to assign to the specified newsfeed. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[NewsItem] + successful + """ + _response = self._client_wrapper.httpx_client.request( + "news/news_items", + method="POST", + json={ + "title": title, + "body": body, + "sender_id": sender_id, + "state": state, + "deliver_silently": deliver_silently, + "labels": labels, + "reactions": reactions, + "newsfeed_assignments": convert_and_respect_annotation_metadata( + object_=newsfeed_assignments, annotation=typing.Sequence[NewsfeedAssignment], direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + NewsItem, + construct_type( + type_=NewsItem, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def find( + self, news_item_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[NewsItem]: + """ + You can fetch the details of a single news item. + + Parameters + ---------- + news_item_id : str + The unique identifier for the news item which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[NewsItem] + successful + """ + _response = self._client_wrapper.httpx_client.request( + f"news/news_items/{jsonable_encoder(news_item_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + NewsItem, + construct_type( + type_=NewsItem, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + news_item_id: str, + *, + title: str, + sender_id: int, + body: typing.Optional[str] = OMIT, + state: typing.Optional[NewsItemRequestState] = OMIT, + deliver_silently: typing.Optional[bool] = OMIT, + labels: typing.Optional[typing.Sequence[str]] = OMIT, + reactions: typing.Optional[typing.Sequence[typing.Optional[str]]] = OMIT, + newsfeed_assignments: typing.Optional[typing.Sequence[NewsfeedAssignment]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[NewsItem]: + """ + Parameters + ---------- + news_item_id : str + The unique identifier for the news item which is given by Intercom. + + title : str + The title of the news item. + + sender_id : int + The id of the sender of the news item. Must be a teammate on the workspace. + + body : typing.Optional[str] + The news item body, which may contain HTML. + + state : typing.Optional[NewsItemRequestState] + News items will not be visible to your users in the assigned newsfeeds until they are set live. + + deliver_silently : typing.Optional[bool] + When set to `true`, the news item will appear in the messenger newsfeed without showing a notification badge. + + labels : typing.Optional[typing.Sequence[str]] + Label names displayed to users to categorize the news item. + + reactions : typing.Optional[typing.Sequence[typing.Optional[str]]] + Ordered list of emoji reactions to the news item. When empty, reactions are disabled. + + newsfeed_assignments : typing.Optional[typing.Sequence[NewsfeedAssignment]] + A list of newsfeed_assignments to assign to the specified newsfeed. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[NewsItem] + successful + """ + _response = self._client_wrapper.httpx_client.request( + f"news/news_items/{jsonable_encoder(news_item_id)}", + method="PUT", + json={ + "title": title, + "body": body, + "sender_id": sender_id, + "state": state, + "deliver_silently": deliver_silently, + "labels": labels, + "reactions": reactions, + "newsfeed_assignments": convert_and_respect_annotation_metadata( + object_=newsfeed_assignments, annotation=typing.Sequence[NewsfeedAssignment], direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + NewsItem, + construct_type( + type_=NewsItem, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, news_item_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DeletedObject]: + """ + You can delete a single news item. + + Parameters + ---------- + news_item_id : str + The unique identifier for the news item which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DeletedObject] + successful + """ + _response = self._client_wrapper.httpx_client.request( + f"news/news_items/{jsonable_encoder(news_item_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeletedObject, + construct_type( + type_=DeletedObject, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawItemsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[PaginatedNewsItemResponse]: + """ + You can fetch a list of all news items + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[PaginatedNewsItemResponse] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + "news/news_items", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PaginatedNewsItemResponse, + construct_type( + type_=PaginatedNewsItemResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + *, + title: str, + sender_id: int, + body: typing.Optional[str] = OMIT, + state: typing.Optional[NewsItemRequestState] = OMIT, + deliver_silently: typing.Optional[bool] = OMIT, + labels: typing.Optional[typing.Sequence[str]] = OMIT, + reactions: typing.Optional[typing.Sequence[typing.Optional[str]]] = OMIT, + newsfeed_assignments: typing.Optional[typing.Sequence[NewsfeedAssignment]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[NewsItem]: + """ + You can create a news item + + Parameters + ---------- + title : str + The title of the news item. + + sender_id : int + The id of the sender of the news item. Must be a teammate on the workspace. + + body : typing.Optional[str] + The news item body, which may contain HTML. + + state : typing.Optional[NewsItemRequestState] + News items will not be visible to your users in the assigned newsfeeds until they are set live. + + deliver_silently : typing.Optional[bool] + When set to `true`, the news item will appear in the messenger newsfeed without showing a notification badge. + + labels : typing.Optional[typing.Sequence[str]] + Label names displayed to users to categorize the news item. + + reactions : typing.Optional[typing.Sequence[typing.Optional[str]]] + Ordered list of emoji reactions to the news item. When empty, reactions are disabled. + + newsfeed_assignments : typing.Optional[typing.Sequence[NewsfeedAssignment]] + A list of newsfeed_assignments to assign to the specified newsfeed. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[NewsItem] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + "news/news_items", + method="POST", + json={ + "title": title, + "body": body, + "sender_id": sender_id, + "state": state, + "deliver_silently": deliver_silently, + "labels": labels, + "reactions": reactions, + "newsfeed_assignments": convert_and_respect_annotation_metadata( + object_=newsfeed_assignments, annotation=typing.Sequence[NewsfeedAssignment], direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + NewsItem, + construct_type( + type_=NewsItem, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def find( + self, news_item_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[NewsItem]: + """ + You can fetch the details of a single news item. + + Parameters + ---------- + news_item_id : str + The unique identifier for the news item which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[NewsItem] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"news/news_items/{jsonable_encoder(news_item_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + NewsItem, + construct_type( + type_=NewsItem, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + news_item_id: str, + *, + title: str, + sender_id: int, + body: typing.Optional[str] = OMIT, + state: typing.Optional[NewsItemRequestState] = OMIT, + deliver_silently: typing.Optional[bool] = OMIT, + labels: typing.Optional[typing.Sequence[str]] = OMIT, + reactions: typing.Optional[typing.Sequence[typing.Optional[str]]] = OMIT, + newsfeed_assignments: typing.Optional[typing.Sequence[NewsfeedAssignment]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[NewsItem]: + """ + Parameters + ---------- + news_item_id : str + The unique identifier for the news item which is given by Intercom. + + title : str + The title of the news item. + + sender_id : int + The id of the sender of the news item. Must be a teammate on the workspace. + + body : typing.Optional[str] + The news item body, which may contain HTML. + + state : typing.Optional[NewsItemRequestState] + News items will not be visible to your users in the assigned newsfeeds until they are set live. + + deliver_silently : typing.Optional[bool] + When set to `true`, the news item will appear in the messenger newsfeed without showing a notification badge. + + labels : typing.Optional[typing.Sequence[str]] + Label names displayed to users to categorize the news item. + + reactions : typing.Optional[typing.Sequence[typing.Optional[str]]] + Ordered list of emoji reactions to the news item. When empty, reactions are disabled. + + newsfeed_assignments : typing.Optional[typing.Sequence[NewsfeedAssignment]] + A list of newsfeed_assignments to assign to the specified newsfeed. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[NewsItem] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"news/news_items/{jsonable_encoder(news_item_id)}", + method="PUT", + json={ + "title": title, + "body": body, + "sender_id": sender_id, + "state": state, + "deliver_silently": deliver_silently, + "labels": labels, + "reactions": reactions, + "newsfeed_assignments": convert_and_respect_annotation_metadata( + object_=newsfeed_assignments, annotation=typing.Sequence[NewsfeedAssignment], direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + NewsItem, + construct_type( + type_=NewsItem, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, news_item_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DeletedObject]: + """ + You can delete a single news item. + + Parameters + ---------- + news_item_id : str + The unique identifier for the news item which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DeletedObject] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"news/news_items/{jsonable_encoder(news_item_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeletedObject, + construct_type( + type_=DeletedObject, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/intercom/news/raw_client.py b/src/intercom/news/raw_client.py new file mode 100644 index 0000000..a60e2ff --- /dev/null +++ b/src/intercom/news/raw_client.py @@ -0,0 +1,13 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper + + +class RawNewsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + +class AsyncRawNewsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper diff --git a/src/intercom/news/types/__init__.py b/src/intercom/news/types/__init__.py new file mode 100644 index 0000000..3cd466b --- /dev/null +++ b/src/intercom/news/types/__init__.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .news_item import NewsItem +from .news_item_state import NewsItemState +from .newsfeed import Newsfeed +from .newsfeed_assignment import NewsfeedAssignment + +__all__ = ["NewsItem", "NewsItemState", "Newsfeed", "NewsfeedAssignment"] diff --git a/src/intercom/news/types/news_item.py b/src/intercom/news/types/news_item.py new file mode 100644 index 0000000..0b6b04e --- /dev/null +++ b/src/intercom/news/types/news_item.py @@ -0,0 +1,94 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from .news_item_state import NewsItemState +from .newsfeed_assignment import NewsfeedAssignment + + +class NewsItem(UncheckedBaseModel): + """ + A News Item is a content type in Intercom enabling you to announce product updates, company news, promotions, events and more with your customers. + """ + + type: typing.Literal["news-item"] = pydantic.Field(default="news-item") + """ + The type of object. + """ + + id: str = pydantic.Field() + """ + The unique identifier for the news item which is given by Intercom. + """ + + workspace_id: str = pydantic.Field() + """ + The id of the workspace which the news item belongs to. + """ + + title: str = pydantic.Field() + """ + The title of the news item. + """ + + body: str = pydantic.Field() + """ + The news item body, which may contain HTML. + """ + + sender_id: int = pydantic.Field() + """ + The id of the sender of the news item. Must be a teammate on the workspace. + """ + + state: NewsItemState = pydantic.Field() + """ + News items will not be visible to your users in the assigned newsfeeds until they are set live. + """ + + newsfeed_assignments: typing.Optional[typing.List[NewsfeedAssignment]] = pydantic.Field(default=None) + """ + A list of newsfeed_assignments to assign to the specified newsfeed. + """ + + labels: typing.Optional[typing.List[typing.Optional[str]]] = pydantic.Field(default=None) + """ + Label names displayed to users to categorize the news item. + """ + + cover_image_url: typing.Optional[str] = pydantic.Field(default=None) + """ + URL of the image used as cover. Must have .jpg or .png extension. + """ + + reactions: typing.Optional[typing.List[typing.Optional[str]]] = pydantic.Field(default=None) + """ + Ordered list of emoji reactions to the news item. When empty, reactions are disabled. + """ + + deliver_silently: typing.Optional[bool] = pydantic.Field(default=None) + """ + When set to true, the news item will appear in the messenger newsfeed without showing a notification badge. + """ + + created_at: int = pydantic.Field() + """ + Timestamp for when the news item was created. + """ + + updated_at: typing.Optional[int] = pydantic.Field(default=None) + """ + Timestamp for when the news item was last updated. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/news/types/news_item_state.py b/src/intercom/news/types/news_item_state.py new file mode 100644 index 0000000..2b16536 --- /dev/null +++ b/src/intercom/news/types/news_item_state.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +NewsItemState = typing.Union[typing.Literal["draft", "live"], typing.Any] diff --git a/src/intercom/news/types/newsfeed.py b/src/intercom/news/types/newsfeed.py new file mode 100644 index 0000000..fb64616 --- /dev/null +++ b/src/intercom/news/types/newsfeed.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel + + +class Newsfeed(UncheckedBaseModel): + """ + A newsfeed is a collection of news items, targeted to a specific audience. + + Newsfeeds currently cannot be edited through the API, please refer to [this article](https://www.intercom.com/help/en/articles/6362267-getting-started-with-news) to set up your newsfeeds in Intercom. + """ + + id: str = pydantic.Field() + """ + The unique identifier for the newsfeed which is given by Intercom. + """ + + type: typing.Literal["newsfeed"] = pydantic.Field(default="newsfeed") + """ + The type of object. + """ + + name: str = pydantic.Field() + """ + The name of the newsfeed. This name will never be visible to your users. + """ + + created_at: int = pydantic.Field() + """ + Timestamp for when the newsfeed was created. + """ + + updated_at: typing.Optional[int] = pydantic.Field(default=None) + """ + Timestamp for when the newsfeed was last updated. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/news/types/newsfeed_assignment.py b/src/intercom/news/types/newsfeed_assignment.py new file mode 100644 index 0000000..94e1299 --- /dev/null +++ b/src/intercom/news/types/newsfeed_assignment.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel + + +class NewsfeedAssignment(UncheckedBaseModel): + """ + Assigns a news item to a newsfeed. + """ + + newsfeed_id: int = pydantic.Field() + """ + The unique identifier for the newsfeed which is given by Intercom. Publish dates cannot be in the future, to schedule news items use the dedicated feature in app (see this article). + """ + + published_at: int = pydantic.Field() + """ + Publish date of the news item on the newsfeed, use this field if you want to set a publish date in the past (e.g. when importing existing news items). On write, this field will be ignored if the news item state is "draft". + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/notes/__init__.py b/src/intercom/notes/__init__.py new file mode 100644 index 0000000..f4f2a2b --- /dev/null +++ b/src/intercom/notes/__init__.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .types import Note, NoteContact + +__all__ = ["Note", "NoteContact"] diff --git a/src/intercom/notes/client.py b/src/intercom/notes/client.py new file mode 100644 index 0000000..e6ad025 --- /dev/null +++ b/src/intercom/notes/client.py @@ -0,0 +1,321 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.pagination import AsyncPager, SyncPager +from ..core.request_options import RequestOptions +from .raw_client import AsyncRawNotesClient, RawNotesClient +from .types.note import Note + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class NotesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawNotesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawNotesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawNotesClient + """ + return self._raw_client + + def list( + self, + contact_id: str, + *, + page: typing.Optional[int] = None, + per_page: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> SyncPager[Note]: + """ + You can fetch a list of notes that are associated to a contact. + + Parameters + ---------- + contact_id : str + The unique identifier of a contact. + + page : typing.Optional[int] + The page of results to fetch. Defaults to first page + + per_page : typing.Optional[int] + How many results to display per page. Defaults to 15 + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SyncPager[Note] + Successful response + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + response = client.notes.list( + contact_id="contact_id", + ) + for item in response: + yield item + # alternatively, you can paginate page-by-page + for page in response.iter_pages(): + yield page + """ + return self._raw_client.list(contact_id, page=page, per_page=per_page, request_options=request_options) + + def create( + self, + contact_id: str, + *, + body: str, + admin_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Note: + """ + You can add a note to a single contact. + + Parameters + ---------- + contact_id : str + The unique identifier of a given contact. + + body : str + The text of the note. + + admin_id : typing.Optional[str] + The unique identifier of a given admin. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Note + Successful response + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.notes.create( + contact_id="123", + body="Hello", + admin_id="123", + ) + """ + _response = self._raw_client.create(contact_id, body=body, admin_id=admin_id, request_options=request_options) + return _response.data + + def find(self, note_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Note: + """ + You can fetch the details of a single note. + + Parameters + ---------- + note_id : str + The unique identifier of a given note + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Note + Note found + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.notes.find( + note_id="1", + ) + """ + _response = self._raw_client.find(note_id, request_options=request_options) + return _response.data + + +class AsyncNotesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawNotesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawNotesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawNotesClient + """ + return self._raw_client + + async def list( + self, + contact_id: str, + *, + page: typing.Optional[int] = None, + per_page: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncPager[Note]: + """ + You can fetch a list of notes that are associated to a contact. + + Parameters + ---------- + contact_id : str + The unique identifier of a contact. + + page : typing.Optional[int] + The page of results to fetch. Defaults to first page + + per_page : typing.Optional[int] + How many results to display per page. Defaults to 15 + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncPager[Note] + Successful response + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + response = await client.notes.list( + contact_id="contact_id", + ) + async for item in response: + yield item + + # alternatively, you can paginate page-by-page + async for page in response.iter_pages(): + yield page + + + asyncio.run(main()) + """ + return await self._raw_client.list(contact_id, page=page, per_page=per_page, request_options=request_options) + + async def create( + self, + contact_id: str, + *, + body: str, + admin_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Note: + """ + You can add a note to a single contact. + + Parameters + ---------- + contact_id : str + The unique identifier of a given contact. + + body : str + The text of the note. + + admin_id : typing.Optional[str] + The unique identifier of a given admin. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Note + Successful response + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.notes.create( + contact_id="123", + body="Hello", + admin_id="123", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + contact_id, body=body, admin_id=admin_id, request_options=request_options + ) + return _response.data + + async def find(self, note_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Note: + """ + You can fetch the details of a single note. + + Parameters + ---------- + note_id : str + The unique identifier of a given note + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Note + Note found + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.notes.find( + note_id="1", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.find(note_id, request_options=request_options) + return _response.data diff --git a/src/intercom/notes/raw_client.py b/src/intercom/notes/raw_client.py new file mode 100644 index 0000000..234f5c6 --- /dev/null +++ b/src/intercom/notes/raw_client.py @@ -0,0 +1,445 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import jsonable_encoder +from ..core.pagination import AsyncPager, BaseHttpResponse, SyncPager +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.not_found_error import NotFoundError +from ..errors.unauthorized_error import UnauthorizedError +from ..types.error import Error +from ..types.note_list import NoteList +from .types.note import Note + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawNotesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + contact_id: str, + *, + page: typing.Optional[int] = None, + per_page: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> SyncPager[Note]: + """ + You can fetch a list of notes that are associated to a contact. + + Parameters + ---------- + contact_id : str + The unique identifier of a contact. + + page : typing.Optional[int] + The page of results to fetch. Defaults to first page + + per_page : typing.Optional[int] + How many results to display per page. Defaults to 15 + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SyncPager[Note] + Successful response + """ + page = page if page is not None else 1 + + _response = self._client_wrapper.httpx_client.request( + f"contacts/{jsonable_encoder(contact_id)}/notes", + method="GET", + params={ + "page": page, + "per_page": per_page, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _parsed_response = typing.cast( + NoteList, + construct_type( + type_=NoteList, # type: ignore + object_=_response.json(), + ), + ) + _items = _parsed_response.data + _has_next = True + _get_next = lambda: self.list( + contact_id, + page=page + 1, + per_page=per_page, + request_options=request_options, + ) + return SyncPager( + has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response) + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + contact_id: str, + *, + body: str, + admin_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[Note]: + """ + You can add a note to a single contact. + + Parameters + ---------- + contact_id : str + The unique identifier of a given contact. + + body : str + The text of the note. + + admin_id : typing.Optional[str] + The unique identifier of a given admin. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Note] + Successful response + """ + _response = self._client_wrapper.httpx_client.request( + f"contacts/{jsonable_encoder(contact_id)}/notes", + method="POST", + json={ + "body": body, + "admin_id": admin_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Note, + construct_type( + type_=Note, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def find(self, note_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Note]: + """ + You can fetch the details of a single note. + + Parameters + ---------- + note_id : str + The unique identifier of a given note + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Note] + Note found + """ + _response = self._client_wrapper.httpx_client.request( + f"notes/{jsonable_encoder(note_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Note, + construct_type( + type_=Note, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawNotesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + contact_id: str, + *, + page: typing.Optional[int] = None, + per_page: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncPager[Note]: + """ + You can fetch a list of notes that are associated to a contact. + + Parameters + ---------- + contact_id : str + The unique identifier of a contact. + + page : typing.Optional[int] + The page of results to fetch. Defaults to first page + + per_page : typing.Optional[int] + How many results to display per page. Defaults to 15 + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncPager[Note] + Successful response + """ + page = page if page is not None else 1 + + _response = await self._client_wrapper.httpx_client.request( + f"contacts/{jsonable_encoder(contact_id)}/notes", + method="GET", + params={ + "page": page, + "per_page": per_page, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _parsed_response = typing.cast( + NoteList, + construct_type( + type_=NoteList, # type: ignore + object_=_response.json(), + ), + ) + _items = _parsed_response.data + _has_next = True + + async def _get_next(): + return await self.list( + contact_id, + page=page + 1, + per_page=per_page, + request_options=request_options, + ) + + return AsyncPager( + has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response) + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + contact_id: str, + *, + body: str, + admin_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[Note]: + """ + You can add a note to a single contact. + + Parameters + ---------- + contact_id : str + The unique identifier of a given contact. + + body : str + The text of the note. + + admin_id : typing.Optional[str] + The unique identifier of a given admin. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Note] + Successful response + """ + _response = await self._client_wrapper.httpx_client.request( + f"contacts/{jsonable_encoder(contact_id)}/notes", + method="POST", + json={ + "body": body, + "admin_id": admin_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Note, + construct_type( + type_=Note, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def find( + self, note_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[Note]: + """ + You can fetch the details of a single note. + + Parameters + ---------- + note_id : str + The unique identifier of a given note + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Note] + Note found + """ + _response = await self._client_wrapper.httpx_client.request( + f"notes/{jsonable_encoder(note_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Note, + construct_type( + type_=Note, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/intercom/notes/types/__init__.py b/src/intercom/notes/types/__init__.py new file mode 100644 index 0000000..4ca01f1 --- /dev/null +++ b/src/intercom/notes/types/__init__.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .note import Note +from .note_contact import NoteContact + +__all__ = ["Note", "NoteContact"] diff --git a/src/intercom/notes/types/note.py b/src/intercom/notes/types/note.py new file mode 100644 index 0000000..c5cb3c4 --- /dev/null +++ b/src/intercom/notes/types/note.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...admins.types.admin import Admin +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from .note_contact import NoteContact + + +class Note(UncheckedBaseModel): + """ + Notes allow you to annotate and comment on your contacts. + """ + + type: typing.Literal["note"] = pydantic.Field(default="note") + """ + String representing the object's type. Always has the value `note`. + """ + + id: str = pydantic.Field() + """ + The id of the note. + """ + + created_at: int = pydantic.Field() + """ + The time the note was created. + """ + + contact: typing.Optional[NoteContact] = pydantic.Field(default=None) + """ + Represents the contact that the note was created about. + """ + + author: Admin = pydantic.Field() + """ + Optional. Represents the Admin that created the note. + """ + + body: str = pydantic.Field() + """ + The body text of the note. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/notes/types/note_contact.py b/src/intercom/notes/types/note_contact.py new file mode 100644 index 0000000..5258ab7 --- /dev/null +++ b/src/intercom/notes/types/note_contact.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel + + +class NoteContact(UncheckedBaseModel): + """ + Represents the contact that the note was created about. + """ + + type: typing.Optional[typing.Literal["contact"]] = pydantic.Field(default=None) + """ + String representing the object's type. Always has the value `contact`. + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id of the contact. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/phone_call_redirects/__init__.py b/src/intercom/phone_call_redirects/__init__.py new file mode 100644 index 0000000..5cde020 --- /dev/null +++ b/src/intercom/phone_call_redirects/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/src/intercom/phone_call_redirects/client.py b/src/intercom/phone_call_redirects/client.py new file mode 100644 index 0000000..5f5157e --- /dev/null +++ b/src/intercom/phone_call_redirects/client.py @@ -0,0 +1,142 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.custom_attributes import CustomAttributes +from ..types.phone_switch import PhoneSwitch +from .raw_client import AsyncRawPhoneCallRedirectsClient, RawPhoneCallRedirectsClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class PhoneCallRedirectsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawPhoneCallRedirectsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawPhoneCallRedirectsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawPhoneCallRedirectsClient + """ + return self._raw_client + + def create( + self, + *, + phone: str, + custom_attributes: typing.Optional[CustomAttributes] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> PhoneSwitch: + """ + You can use the API to deflect phone calls to the Intercom Messenger. + Calling this endpoint will send an SMS with a link to the Messenger to the phone number specified. + + If custom attributes are specified, they will be added to the user or lead's custom data attributes. + + Parameters + ---------- + phone : str + Phone number in E.164 format, that will receive the SMS to continue the conversation in the Messenger. + + custom_attributes : typing.Optional[CustomAttributes] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PhoneSwitch + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.phone_call_redirects.create( + phone="+353832345678", + custom_attributes={"issue_type": "Billing", "priority": "High"}, + ) + """ + _response = self._raw_client.create( + phone=phone, custom_attributes=custom_attributes, request_options=request_options + ) + return _response.data + + +class AsyncPhoneCallRedirectsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawPhoneCallRedirectsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawPhoneCallRedirectsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawPhoneCallRedirectsClient + """ + return self._raw_client + + async def create( + self, + *, + phone: str, + custom_attributes: typing.Optional[CustomAttributes] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> PhoneSwitch: + """ + You can use the API to deflect phone calls to the Intercom Messenger. + Calling this endpoint will send an SMS with a link to the Messenger to the phone number specified. + + If custom attributes are specified, they will be added to the user or lead's custom data attributes. + + Parameters + ---------- + phone : str + Phone number in E.164 format, that will receive the SMS to continue the conversation in the Messenger. + + custom_attributes : typing.Optional[CustomAttributes] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PhoneSwitch + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.phone_call_redirects.create( + phone="+353832345678", + custom_attributes={"issue_type": "Billing", "priority": "High"}, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + phone=phone, custom_attributes=custom_attributes, request_options=request_options + ) + return _response.data diff --git a/src/intercom/phone_call_redirects/raw_client.py b/src/intercom/phone_call_redirects/raw_client.py new file mode 100644 index 0000000..b76fc65 --- /dev/null +++ b/src/intercom/phone_call_redirects/raw_client.py @@ -0,0 +1,207 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.bad_request_error import BadRequestError +from ..errors.unauthorized_error import UnauthorizedError +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.custom_attributes import CustomAttributes +from ..types.error import Error +from ..types.phone_switch import PhoneSwitch + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawPhoneCallRedirectsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, + *, + phone: str, + custom_attributes: typing.Optional[CustomAttributes] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[PhoneSwitch]: + """ + You can use the API to deflect phone calls to the Intercom Messenger. + Calling this endpoint will send an SMS with a link to the Messenger to the phone number specified. + + If custom attributes are specified, they will be added to the user or lead's custom data attributes. + + Parameters + ---------- + phone : str + Phone number in E.164 format, that will receive the SMS to continue the conversation in the Messenger. + + custom_attributes : typing.Optional[CustomAttributes] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[PhoneSwitch] + successful + """ + _response = self._client_wrapper.httpx_client.request( + "phone_call_redirects", + method="POST", + json={ + "phone": phone, + "custom_attributes": custom_attributes, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PhoneSwitch, + construct_type( + type_=PhoneSwitch, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawPhoneCallRedirectsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, + *, + phone: str, + custom_attributes: typing.Optional[CustomAttributes] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[PhoneSwitch]: + """ + You can use the API to deflect phone calls to the Intercom Messenger. + Calling this endpoint will send an SMS with a link to the Messenger to the phone number specified. + + If custom attributes are specified, they will be added to the user or lead's custom data attributes. + + Parameters + ---------- + phone : str + Phone number in E.164 format, that will receive the SMS to continue the conversation in the Messenger. + + custom_attributes : typing.Optional[CustomAttributes] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[PhoneSwitch] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + "phone_call_redirects", + method="POST", + json={ + "phone": phone, + "custom_attributes": custom_attributes, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PhoneSwitch, + construct_type( + type_=PhoneSwitch, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/intercom/py.typed b/src/intercom/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/src/intercom/segments/__init__.py b/src/intercom/segments/__init__.py new file mode 100644 index 0000000..de85632 --- /dev/null +++ b/src/intercom/segments/__init__.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .types import Segment, SegmentPersonType + +__all__ = ["Segment", "SegmentPersonType"] diff --git a/src/intercom/segments/client.py b/src/intercom/segments/client.py new file mode 100644 index 0000000..56aeacf --- /dev/null +++ b/src/intercom/segments/client.py @@ -0,0 +1,181 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.segment_list import SegmentList +from .raw_client import AsyncRawSegmentsClient, RawSegmentsClient +from .types.segment import Segment + + +class SegmentsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSegmentsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawSegmentsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSegmentsClient + """ + return self._raw_client + + def list( + self, *, include_count: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None + ) -> SegmentList: + """ + You can fetch a list of all segments. + + Parameters + ---------- + include_count : typing.Optional[bool] + It includes the count of contacts that belong to each segment. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SegmentList + Successful response + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.segments.list() + """ + _response = self._raw_client.list(include_count=include_count, request_options=request_options) + return _response.data + + def find(self, segment_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Segment: + """ + You can fetch the details of a single segment. + + Parameters + ---------- + segment_id : str + The unique identified of a given segment. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Segment + Successful response + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.segments.find( + segment_id="123", + ) + """ + _response = self._raw_client.find(segment_id, request_options=request_options) + return _response.data + + +class AsyncSegmentsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSegmentsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawSegmentsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSegmentsClient + """ + return self._raw_client + + async def list( + self, *, include_count: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None + ) -> SegmentList: + """ + You can fetch a list of all segments. + + Parameters + ---------- + include_count : typing.Optional[bool] + It includes the count of contacts that belong to each segment. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SegmentList + Successful response + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.segments.list() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(include_count=include_count, request_options=request_options) + return _response.data + + async def find(self, segment_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Segment: + """ + You can fetch the details of a single segment. + + Parameters + ---------- + segment_id : str + The unique identified of a given segment. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Segment + Successful response + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.segments.find( + segment_id="123", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.find(segment_id, request_options=request_options) + return _response.data diff --git a/src/intercom/segments/raw_client.py b/src/intercom/segments/raw_client.py new file mode 100644 index 0000000..2c37a71 --- /dev/null +++ b/src/intercom/segments/raw_client.py @@ -0,0 +1,254 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import jsonable_encoder +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.not_found_error import NotFoundError +from ..errors.unauthorized_error import UnauthorizedError +from ..types.error import Error +from ..types.segment_list import SegmentList +from .types.segment import Segment + + +class RawSegmentsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, *, include_count: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[SegmentList]: + """ + You can fetch a list of all segments. + + Parameters + ---------- + include_count : typing.Optional[bool] + It includes the count of contacts that belong to each segment. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SegmentList] + Successful response + """ + _response = self._client_wrapper.httpx_client.request( + "segments", + method="GET", + params={ + "include_count": include_count, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SegmentList, + construct_type( + type_=SegmentList, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def find( + self, segment_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[Segment]: + """ + You can fetch the details of a single segment. + + Parameters + ---------- + segment_id : str + The unique identified of a given segment. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Segment] + Successful response + """ + _response = self._client_wrapper.httpx_client.request( + f"segments/{jsonable_encoder(segment_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Segment, + construct_type( + type_=Segment, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawSegmentsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, *, include_count: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[SegmentList]: + """ + You can fetch a list of all segments. + + Parameters + ---------- + include_count : typing.Optional[bool] + It includes the count of contacts that belong to each segment. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SegmentList] + Successful response + """ + _response = await self._client_wrapper.httpx_client.request( + "segments", + method="GET", + params={ + "include_count": include_count, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SegmentList, + construct_type( + type_=SegmentList, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def find( + self, segment_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[Segment]: + """ + You can fetch the details of a single segment. + + Parameters + ---------- + segment_id : str + The unique identified of a given segment. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Segment] + Successful response + """ + _response = await self._client_wrapper.httpx_client.request( + f"segments/{jsonable_encoder(segment_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Segment, + construct_type( + type_=Segment, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/intercom/segments/types/__init__.py b/src/intercom/segments/types/__init__.py new file mode 100644 index 0000000..b63a3b6 --- /dev/null +++ b/src/intercom/segments/types/__init__.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .segment import Segment +from .segment_person_type import SegmentPersonType + +__all__ = ["Segment", "SegmentPersonType"] diff --git a/src/intercom/segments/types/segment.py b/src/intercom/segments/types/segment.py new file mode 100644 index 0000000..8dbd043 --- /dev/null +++ b/src/intercom/segments/types/segment.py @@ -0,0 +1,58 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from .segment_person_type import SegmentPersonType + + +class Segment(UncheckedBaseModel): + """ + A segment is a group of your contacts defined by the rules that you set. + """ + + type: typing.Literal["segment"] = pydantic.Field(default="segment") + """ + The type of object. + """ + + id: str = pydantic.Field() + """ + The unique identifier representing the segment. + """ + + name: str = pydantic.Field() + """ + The name of the segment. + """ + + created_at: int = pydantic.Field() + """ + The time the segment was created. + """ + + updated_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time the segment was updated. + """ + + person_type: SegmentPersonType = pydantic.Field() + """ + Type of the contact: contact (lead) or user. + """ + + count: typing.Optional[int] = pydantic.Field(default=None) + """ + The number of items in the user segment. It's returned when `include_count=true` is included in the request. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/segments/types/segment_person_type.py b/src/intercom/segments/types/segment_person_type.py new file mode 100644 index 0000000..3089d52 --- /dev/null +++ b/src/intercom/segments/types/segment_person_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SegmentPersonType = typing.Union[typing.Literal["contact", "user"], typing.Any] diff --git a/src/intercom/subscription_types/__init__.py b/src/intercom/subscription_types/__init__.py new file mode 100644 index 0000000..a43a24a --- /dev/null +++ b/src/intercom/subscription_types/__init__.py @@ -0,0 +1,17 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .types import ( + SubscriptionType, + SubscriptionTypeConsentType, + SubscriptionTypeContentTypesItem, + SubscriptionTypeState, +) + +__all__ = [ + "SubscriptionType", + "SubscriptionTypeConsentType", + "SubscriptionTypeContentTypesItem", + "SubscriptionTypeState", +] diff --git a/src/intercom/subscription_types/client.py b/src/intercom/subscription_types/client.py new file mode 100644 index 0000000..dc7367c --- /dev/null +++ b/src/intercom/subscription_types/client.py @@ -0,0 +1,100 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.subscription_type_list import SubscriptionTypeList +from .raw_client import AsyncRawSubscriptionTypesClient, RawSubscriptionTypesClient + + +class SubscriptionTypesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSubscriptionTypesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawSubscriptionTypesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSubscriptionTypesClient + """ + return self._raw_client + + def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> SubscriptionTypeList: + """ + You can list all subscription types. A list of subscription type objects will be returned. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SubscriptionTypeList + Successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.subscription_types.list() + """ + _response = self._raw_client.list(request_options=request_options) + return _response.data + + +class AsyncSubscriptionTypesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSubscriptionTypesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawSubscriptionTypesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSubscriptionTypesClient + """ + return self._raw_client + + async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> SubscriptionTypeList: + """ + You can list all subscription types. A list of subscription type objects will be returned. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SubscriptionTypeList + Successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.subscription_types.list() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(request_options=request_options) + return _response.data diff --git a/src/intercom/subscription_types/raw_client.py b/src/intercom/subscription_types/raw_client.py new file mode 100644 index 0000000..99018bf --- /dev/null +++ b/src/intercom/subscription_types/raw_client.py @@ -0,0 +1,115 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.unauthorized_error import UnauthorizedError +from ..types.error import Error +from ..types.subscription_type_list import SubscriptionTypeList + + +class RawSubscriptionTypesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[SubscriptionTypeList]: + """ + You can list all subscription types. A list of subscription type objects will be returned. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SubscriptionTypeList] + Successful + """ + _response = self._client_wrapper.httpx_client.request( + "subscription_types", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SubscriptionTypeList, + construct_type( + type_=SubscriptionTypeList, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawSubscriptionTypesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[SubscriptionTypeList]: + """ + You can list all subscription types. A list of subscription type objects will be returned. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SubscriptionTypeList] + Successful + """ + _response = await self._client_wrapper.httpx_client.request( + "subscription_types", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SubscriptionTypeList, + construct_type( + type_=SubscriptionTypeList, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/intercom/subscription_types/types/__init__.py b/src/intercom/subscription_types/types/__init__.py new file mode 100644 index 0000000..e3b517d --- /dev/null +++ b/src/intercom/subscription_types/types/__init__.py @@ -0,0 +1,15 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .subscription_type import SubscriptionType +from .subscription_type_consent_type import SubscriptionTypeConsentType +from .subscription_type_content_types_item import SubscriptionTypeContentTypesItem +from .subscription_type_state import SubscriptionTypeState + +__all__ = [ + "SubscriptionType", + "SubscriptionTypeConsentType", + "SubscriptionTypeContentTypesItem", + "SubscriptionTypeState", +] diff --git a/src/intercom/subscription_types/types/subscription_type.py b/src/intercom/subscription_types/types/subscription_type.py new file mode 100644 index 0000000..fa4dd1a --- /dev/null +++ b/src/intercom/subscription_types/types/subscription_type.py @@ -0,0 +1,57 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from ...types.translation import Translation +from .subscription_type_consent_type import SubscriptionTypeConsentType +from .subscription_type_content_types_item import SubscriptionTypeContentTypesItem +from .subscription_type_state import SubscriptionTypeState + + +class SubscriptionType(UncheckedBaseModel): + """ + A subscription type lets customers easily opt out of non-essential communications without missing what's important to them. + """ + + type: typing.Literal["subscription"] = pydantic.Field(default="subscription") + """ + The type of the object - subscription + """ + + id: str = pydantic.Field() + """ + The unique identifier representing the subscription type. + """ + + state: SubscriptionTypeState = pydantic.Field() + """ + The state of the subscription type. + """ + + default_translation: Translation + translations: typing.List[Translation] = pydantic.Field() + """ + An array of translations objects with the localised version of the subscription type in each available locale within your translation settings. + """ + + consent_type: SubscriptionTypeConsentType = pydantic.Field() + """ + Describes the type of consent. + """ + + content_types: typing.List[SubscriptionTypeContentTypesItem] = pydantic.Field() + """ + The message types that this subscription supports - can contain `email` or `sms_message`. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/subscription_types/types/subscription_type_consent_type.py b/src/intercom/subscription_types/types/subscription_type_consent_type.py new file mode 100644 index 0000000..d7f8b6a --- /dev/null +++ b/src/intercom/subscription_types/types/subscription_type_consent_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SubscriptionTypeConsentType = typing.Union[typing.Literal["opt_out", "opt_in"], typing.Any] diff --git a/src/intercom/subscription_types/types/subscription_type_content_types_item.py b/src/intercom/subscription_types/types/subscription_type_content_types_item.py new file mode 100644 index 0000000..d895f70 --- /dev/null +++ b/src/intercom/subscription_types/types/subscription_type_content_types_item.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SubscriptionTypeContentTypesItem = typing.Union[typing.Literal["email", "sms_message"], typing.Any] diff --git a/src/intercom/subscription_types/types/subscription_type_state.py b/src/intercom/subscription_types/types/subscription_type_state.py new file mode 100644 index 0000000..65c9259 --- /dev/null +++ b/src/intercom/subscription_types/types/subscription_type_state.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SubscriptionTypeState = typing.Union[typing.Literal["live", "draft", "archived"], typing.Any] diff --git a/src/intercom/tags/__init__.py b/src/intercom/tags/__init__.py new file mode 100644 index 0000000..fc57985 --- /dev/null +++ b/src/intercom/tags/__init__.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .types import Tag, TagsCreateRequestBody + +__all__ = ["Tag", "TagsCreateRequestBody"] diff --git a/src/intercom/tags/client.py b/src/intercom/tags/client.py new file mode 100644 index 0000000..0a0579c --- /dev/null +++ b/src/intercom/tags/client.py @@ -0,0 +1,901 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.tag_list import TagList +from .raw_client import AsyncRawTagsClient, RawTagsClient +from .types.tag import Tag +from .types.tags_create_request_body import TagsCreateRequestBody + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class TagsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTagsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawTagsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTagsClient + """ + return self._raw_client + + def tag_contact( + self, contact_id: str, *, tag_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> Tag: + """ + You can tag a specific contact. This will return a tag object for the tag that was added to the contact. + + Parameters + ---------- + contact_id : str + The unique identifier for the contact which is given by Intercom + + tag_id : str + The unique identifier for the tag which is given by Intercom + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.tags.tag_contact( + contact_id="63a07ddf05a32042dffac965", + tag_id="7522907", + ) + """ + _response = self._raw_client.tag_contact(contact_id, tag_id=tag_id, request_options=request_options) + return _response.data + + def untag_contact( + self, contact_id: str, tag_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> Tag: + """ + You can remove tag from a specific contact. This will return a tag object for the tag that was removed from the contact. + + Parameters + ---------- + contact_id : str + The unique identifier for the contact which is given by Intercom + + tag_id : str + The unique identifier for the tag which is given by Intercom + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.tags.untag_contact( + contact_id="63a07ddf05a32042dffac965", + tag_id="7522907", + ) + """ + _response = self._raw_client.untag_contact(contact_id, tag_id, request_options=request_options) + return _response.data + + def tag_conversation( + self, + conversation_id: str, + *, + tag_id: str, + admin_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> Tag: + """ + You can tag a specific conversation. This will return a tag object for the tag that was added to the conversation. + + Parameters + ---------- + conversation_id : str + conversation_id + + tag_id : str + The unique identifier for the tag which is given by Intercom + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.tags.tag_conversation( + conversation_id="64619700005694", + tag_id="7522907", + admin_id="780", + ) + """ + _response = self._raw_client.tag_conversation( + conversation_id, tag_id=tag_id, admin_id=admin_id, request_options=request_options + ) + return _response.data + + def untag_conversation( + self, + conversation_id: str, + tag_id: str, + *, + admin_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> Tag: + """ + You can remove tag from a specific conversation. This will return a tag object for the tag that was removed from the conversation. + + Parameters + ---------- + conversation_id : str + conversation_id + + tag_id : str + id + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.tags.untag_conversation( + conversation_id="64619700005694", + tag_id="7522907", + admin_id="123", + ) + """ + _response = self._raw_client.untag_conversation( + conversation_id, tag_id, admin_id=admin_id, request_options=request_options + ) + return _response.data + + def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> TagList: + """ + You can fetch a list of all tags for a given workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TagList + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.tags.list() + """ + _response = self._raw_client.list(request_options=request_options) + return _response.data + + def create(self, *, request: TagsCreateRequestBody, request_options: typing.Optional[RequestOptions] = None) -> Tag: + """ + You can use this endpoint to perform the following operations: + + **1. Create a new tag:** You can create a new tag by passing in the tag name as specified in "Create or Update Tag Request Payload" described below. + + **2. Update an existing tag:** You can update an existing tag by passing the id of the tag as specified in "Create or Update Tag Request Payload" described below. + + **3. Tag Companies:** You can tag single company or a list of companies. You can tag a company by passing in the tag name and the company details as specified in "Tag Company Request Payload" described below. Also, if the tag doesn't exist then a new one will be created automatically. + + **4. Untag Companies:** You can untag a single company or a list of companies. You can untag a company by passing in the tag id and the company details as specified in "Untag Company Request Payload" described below. + + **5. Tag Multiple Users:** You can tag a list of users. You can tag the users by passing in the tag name and the user details as specified in "Tag Users Request Payload" described below. + + Each operation will return a tag object. + + Parameters + ---------- + request : TagsCreateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + Action successful + + Examples + -------- + from intercom import CreateOrUpdateTagRequest, Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.tags.create( + request=CreateOrUpdateTagRequest( + name="test", + ), + ) + """ + _response = self._raw_client.create(request=request, request_options=request_options) + return _response.data + + def find(self, tag_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Tag: + """ + You can fetch the details of tags that are on the workspace by their id. + This will return a tag object. + + Parameters + ---------- + tag_id : str + The unique identifier of a given tag + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + Tag found + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.tags.find( + tag_id="123", + ) + """ + _response = self._raw_client.find(tag_id, request_options=request_options) + return _response.data + + def delete(self, tag_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + You can delete the details of tags that are on the workspace by passing in the id. + + Parameters + ---------- + tag_id : str + The unique identifier of a given tag + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.tags.delete( + tag_id="123", + ) + """ + _response = self._raw_client.delete(tag_id, request_options=request_options) + return _response.data + + def tag_ticket( + self, ticket_id: str, *, tag_id: str, admin_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> Tag: + """ + You can tag a specific ticket. This will return a tag object for the tag that was added to the ticket. + + Parameters + ---------- + ticket_id : str + ticket_id + + tag_id : str + The unique identifier for the tag which is given by Intercom + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.tags.tag_ticket( + ticket_id="64619700005694", + tag_id="7522907", + admin_id="780", + ) + """ + _response = self._raw_client.tag_ticket( + ticket_id, tag_id=tag_id, admin_id=admin_id, request_options=request_options + ) + return _response.data + + def untag_ticket( + self, ticket_id: str, tag_id: str, *, admin_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> Tag: + """ + You can remove tag from a specific ticket. This will return a tag object for the tag that was removed from the ticket. + + Parameters + ---------- + ticket_id : str + ticket_id + + tag_id : str + The unique identifier for the tag which is given by Intercom + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.tags.untag_ticket( + ticket_id="64619700005694", + tag_id="7522907", + admin_id="123", + ) + """ + _response = self._raw_client.untag_ticket(ticket_id, tag_id, admin_id=admin_id, request_options=request_options) + return _response.data + + +class AsyncTagsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTagsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawTagsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTagsClient + """ + return self._raw_client + + async def tag_contact( + self, contact_id: str, *, tag_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> Tag: + """ + You can tag a specific contact. This will return a tag object for the tag that was added to the contact. + + Parameters + ---------- + contact_id : str + The unique identifier for the contact which is given by Intercom + + tag_id : str + The unique identifier for the tag which is given by Intercom + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.tags.tag_contact( + contact_id="63a07ddf05a32042dffac965", + tag_id="7522907", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.tag_contact(contact_id, tag_id=tag_id, request_options=request_options) + return _response.data + + async def untag_contact( + self, contact_id: str, tag_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> Tag: + """ + You can remove tag from a specific contact. This will return a tag object for the tag that was removed from the contact. + + Parameters + ---------- + contact_id : str + The unique identifier for the contact which is given by Intercom + + tag_id : str + The unique identifier for the tag which is given by Intercom + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.tags.untag_contact( + contact_id="63a07ddf05a32042dffac965", + tag_id="7522907", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.untag_contact(contact_id, tag_id, request_options=request_options) + return _response.data + + async def tag_conversation( + self, + conversation_id: str, + *, + tag_id: str, + admin_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> Tag: + """ + You can tag a specific conversation. This will return a tag object for the tag that was added to the conversation. + + Parameters + ---------- + conversation_id : str + conversation_id + + tag_id : str + The unique identifier for the tag which is given by Intercom + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.tags.tag_conversation( + conversation_id="64619700005694", + tag_id="7522907", + admin_id="780", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.tag_conversation( + conversation_id, tag_id=tag_id, admin_id=admin_id, request_options=request_options + ) + return _response.data + + async def untag_conversation( + self, + conversation_id: str, + tag_id: str, + *, + admin_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> Tag: + """ + You can remove tag from a specific conversation. This will return a tag object for the tag that was removed from the conversation. + + Parameters + ---------- + conversation_id : str + conversation_id + + tag_id : str + id + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.tags.untag_conversation( + conversation_id="64619700005694", + tag_id="7522907", + admin_id="123", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.untag_conversation( + conversation_id, tag_id, admin_id=admin_id, request_options=request_options + ) + return _response.data + + async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> TagList: + """ + You can fetch a list of all tags for a given workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TagList + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.tags.list() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(request_options=request_options) + return _response.data + + async def create( + self, *, request: TagsCreateRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> Tag: + """ + You can use this endpoint to perform the following operations: + + **1. Create a new tag:** You can create a new tag by passing in the tag name as specified in "Create or Update Tag Request Payload" described below. + + **2. Update an existing tag:** You can update an existing tag by passing the id of the tag as specified in "Create or Update Tag Request Payload" described below. + + **3. Tag Companies:** You can tag single company or a list of companies. You can tag a company by passing in the tag name and the company details as specified in "Tag Company Request Payload" described below. Also, if the tag doesn't exist then a new one will be created automatically. + + **4. Untag Companies:** You can untag a single company or a list of companies. You can untag a company by passing in the tag id and the company details as specified in "Untag Company Request Payload" described below. + + **5. Tag Multiple Users:** You can tag a list of users. You can tag the users by passing in the tag name and the user details as specified in "Tag Users Request Payload" described below. + + Each operation will return a tag object. + + Parameters + ---------- + request : TagsCreateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + Action successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom, CreateOrUpdateTagRequest + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.tags.create( + request=CreateOrUpdateTagRequest( + name="test", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create(request=request, request_options=request_options) + return _response.data + + async def find(self, tag_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Tag: + """ + You can fetch the details of tags that are on the workspace by their id. + This will return a tag object. + + Parameters + ---------- + tag_id : str + The unique identifier of a given tag + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + Tag found + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.tags.find( + tag_id="123", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.find(tag_id, request_options=request_options) + return _response.data + + async def delete(self, tag_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + You can delete the details of tags that are on the workspace by passing in the id. + + Parameters + ---------- + tag_id : str + The unique identifier of a given tag + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.tags.delete( + tag_id="123", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(tag_id, request_options=request_options) + return _response.data + + async def tag_ticket( + self, ticket_id: str, *, tag_id: str, admin_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> Tag: + """ + You can tag a specific ticket. This will return a tag object for the tag that was added to the ticket. + + Parameters + ---------- + ticket_id : str + ticket_id + + tag_id : str + The unique identifier for the tag which is given by Intercom + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.tags.tag_ticket( + ticket_id="64619700005694", + tag_id="7522907", + admin_id="780", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.tag_ticket( + ticket_id, tag_id=tag_id, admin_id=admin_id, request_options=request_options + ) + return _response.data + + async def untag_ticket( + self, ticket_id: str, tag_id: str, *, admin_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> Tag: + """ + You can remove tag from a specific ticket. This will return a tag object for the tag that was removed from the ticket. + + Parameters + ---------- + ticket_id : str + ticket_id + + tag_id : str + The unique identifier for the tag which is given by Intercom + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.tags.untag_ticket( + ticket_id="64619700005694", + tag_id="7522907", + admin_id="123", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.untag_ticket( + ticket_id, tag_id, admin_id=admin_id, request_options=request_options + ) + return _response.data diff --git a/src/intercom/tags/raw_client.py b/src/intercom/tags/raw_client.py new file mode 100644 index 0000000..e54869d --- /dev/null +++ b/src/intercom/tags/raw_client.py @@ -0,0 +1,1436 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import jsonable_encoder +from ..core.request_options import RequestOptions +from ..core.serialization import convert_and_respect_annotation_metadata +from ..core.unchecked_base_model import construct_type +from ..errors.bad_request_error import BadRequestError +from ..errors.not_found_error import NotFoundError +from ..errors.unauthorized_error import UnauthorizedError +from ..types.error import Error +from ..types.tag_list import TagList +from .types.tag import Tag +from .types.tags_create_request_body import TagsCreateRequestBody + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawTagsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def tag_contact( + self, contact_id: str, *, tag_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[Tag]: + """ + You can tag a specific contact. This will return a tag object for the tag that was added to the contact. + + Parameters + ---------- + contact_id : str + The unique identifier for the contact which is given by Intercom + + tag_id : str + The unique identifier for the tag which is given by Intercom + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Tag] + successful + """ + _response = self._client_wrapper.httpx_client.request( + f"contacts/{jsonable_encoder(contact_id)}/tags", + method="POST", + json={ + "id": tag_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def untag_contact( + self, contact_id: str, tag_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[Tag]: + """ + You can remove tag from a specific contact. This will return a tag object for the tag that was removed from the contact. + + Parameters + ---------- + contact_id : str + The unique identifier for the contact which is given by Intercom + + tag_id : str + The unique identifier for the tag which is given by Intercom + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Tag] + successful + """ + _response = self._client_wrapper.httpx_client.request( + f"contacts/{jsonable_encoder(contact_id)}/tags/{jsonable_encoder(tag_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def tag_conversation( + self, + conversation_id: str, + *, + tag_id: str, + admin_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[Tag]: + """ + You can tag a specific conversation. This will return a tag object for the tag that was added to the conversation. + + Parameters + ---------- + conversation_id : str + conversation_id + + tag_id : str + The unique identifier for the tag which is given by Intercom + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Tag] + successful + """ + _response = self._client_wrapper.httpx_client.request( + f"conversations/{jsonable_encoder(conversation_id)}/tags", + method="POST", + json={ + "id": tag_id, + "admin_id": admin_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def untag_conversation( + self, + conversation_id: str, + tag_id: str, + *, + admin_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[Tag]: + """ + You can remove tag from a specific conversation. This will return a tag object for the tag that was removed from the conversation. + + Parameters + ---------- + conversation_id : str + conversation_id + + tag_id : str + id + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Tag] + successful + """ + _response = self._client_wrapper.httpx_client.request( + f"conversations/{jsonable_encoder(conversation_id)}/tags/{jsonable_encoder(tag_id)}", + method="DELETE", + json={ + "admin_id": admin_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[TagList]: + """ + You can fetch a list of all tags for a given workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TagList] + successful + """ + _response = self._client_wrapper.httpx_client.request( + "tags", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TagList, + construct_type( + type_=TagList, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, *, request: TagsCreateRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[Tag]: + """ + You can use this endpoint to perform the following operations: + + **1. Create a new tag:** You can create a new tag by passing in the tag name as specified in "Create or Update Tag Request Payload" described below. + + **2. Update an existing tag:** You can update an existing tag by passing the id of the tag as specified in "Create or Update Tag Request Payload" described below. + + **3. Tag Companies:** You can tag single company or a list of companies. You can tag a company by passing in the tag name and the company details as specified in "Tag Company Request Payload" described below. Also, if the tag doesn't exist then a new one will be created automatically. + + **4. Untag Companies:** You can untag a single company or a list of companies. You can untag a company by passing in the tag id and the company details as specified in "Untag Company Request Payload" described below. + + **5. Tag Multiple Users:** You can tag a list of users. You can tag the users by passing in the tag name and the user details as specified in "Tag Users Request Payload" described below. + + Each operation will return a tag object. + + Parameters + ---------- + request : TagsCreateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Tag] + Action successful + """ + _response = self._client_wrapper.httpx_client.request( + "tags", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=TagsCreateRequestBody, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def find(self, tag_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Tag]: + """ + You can fetch the details of tags that are on the workspace by their id. + This will return a tag object. + + Parameters + ---------- + tag_id : str + The unique identifier of a given tag + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Tag] + Tag found + """ + _response = self._client_wrapper.httpx_client.request( + f"tags/{jsonable_encoder(tag_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete(self, tag_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]: + """ + You can delete the details of tags that are on the workspace by passing in the id. + + Parameters + ---------- + tag_id : str + The unique identifier of a given tag + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"tags/{jsonable_encoder(tag_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def tag_ticket( + self, ticket_id: str, *, tag_id: str, admin_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[Tag]: + """ + You can tag a specific ticket. This will return a tag object for the tag that was added to the ticket. + + Parameters + ---------- + ticket_id : str + ticket_id + + tag_id : str + The unique identifier for the tag which is given by Intercom + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Tag] + successful + """ + _response = self._client_wrapper.httpx_client.request( + f"tickets/{jsonable_encoder(ticket_id)}/tags", + method="POST", + json={ + "id": tag_id, + "admin_id": admin_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def untag_ticket( + self, ticket_id: str, tag_id: str, *, admin_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[Tag]: + """ + You can remove tag from a specific ticket. This will return a tag object for the tag that was removed from the ticket. + + Parameters + ---------- + ticket_id : str + ticket_id + + tag_id : str + The unique identifier for the tag which is given by Intercom + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Tag] + successful + """ + _response = self._client_wrapper.httpx_client.request( + f"tickets/{jsonable_encoder(ticket_id)}/tags/{jsonable_encoder(tag_id)}", + method="DELETE", + json={ + "admin_id": admin_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawTagsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def tag_contact( + self, contact_id: str, *, tag_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[Tag]: + """ + You can tag a specific contact. This will return a tag object for the tag that was added to the contact. + + Parameters + ---------- + contact_id : str + The unique identifier for the contact which is given by Intercom + + tag_id : str + The unique identifier for the tag which is given by Intercom + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Tag] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"contacts/{jsonable_encoder(contact_id)}/tags", + method="POST", + json={ + "id": tag_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def untag_contact( + self, contact_id: str, tag_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[Tag]: + """ + You can remove tag from a specific contact. This will return a tag object for the tag that was removed from the contact. + + Parameters + ---------- + contact_id : str + The unique identifier for the contact which is given by Intercom + + tag_id : str + The unique identifier for the tag which is given by Intercom + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Tag] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"contacts/{jsonable_encoder(contact_id)}/tags/{jsonable_encoder(tag_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def tag_conversation( + self, + conversation_id: str, + *, + tag_id: str, + admin_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[Tag]: + """ + You can tag a specific conversation. This will return a tag object for the tag that was added to the conversation. + + Parameters + ---------- + conversation_id : str + conversation_id + + tag_id : str + The unique identifier for the tag which is given by Intercom + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Tag] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"conversations/{jsonable_encoder(conversation_id)}/tags", + method="POST", + json={ + "id": tag_id, + "admin_id": admin_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def untag_conversation( + self, + conversation_id: str, + tag_id: str, + *, + admin_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[Tag]: + """ + You can remove tag from a specific conversation. This will return a tag object for the tag that was removed from the conversation. + + Parameters + ---------- + conversation_id : str + conversation_id + + tag_id : str + id + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Tag] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"conversations/{jsonable_encoder(conversation_id)}/tags/{jsonable_encoder(tag_id)}", + method="DELETE", + json={ + "admin_id": admin_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> AsyncHttpResponse[TagList]: + """ + You can fetch a list of all tags for a given workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TagList] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + "tags", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TagList, + construct_type( + type_=TagList, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, *, request: TagsCreateRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[Tag]: + """ + You can use this endpoint to perform the following operations: + + **1. Create a new tag:** You can create a new tag by passing in the tag name as specified in "Create or Update Tag Request Payload" described below. + + **2. Update an existing tag:** You can update an existing tag by passing the id of the tag as specified in "Create or Update Tag Request Payload" described below. + + **3. Tag Companies:** You can tag single company or a list of companies. You can tag a company by passing in the tag name and the company details as specified in "Tag Company Request Payload" described below. Also, if the tag doesn't exist then a new one will be created automatically. + + **4. Untag Companies:** You can untag a single company or a list of companies. You can untag a company by passing in the tag id and the company details as specified in "Untag Company Request Payload" described below. + + **5. Tag Multiple Users:** You can tag a list of users. You can tag the users by passing in the tag name and the user details as specified in "Tag Users Request Payload" described below. + + Each operation will return a tag object. + + Parameters + ---------- + request : TagsCreateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Tag] + Action successful + """ + _response = await self._client_wrapper.httpx_client.request( + "tags", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=TagsCreateRequestBody, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def find( + self, tag_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[Tag]: + """ + You can fetch the details of tags that are on the workspace by their id. + This will return a tag object. + + Parameters + ---------- + tag_id : str + The unique identifier of a given tag + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Tag] + Tag found + """ + _response = await self._client_wrapper.httpx_client.request( + f"tags/{jsonable_encoder(tag_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, tag_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[None]: + """ + You can delete the details of tags that are on the workspace by passing in the id. + + Parameters + ---------- + tag_id : str + The unique identifier of a given tag + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"tags/{jsonable_encoder(tag_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def tag_ticket( + self, ticket_id: str, *, tag_id: str, admin_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[Tag]: + """ + You can tag a specific ticket. This will return a tag object for the tag that was added to the ticket. + + Parameters + ---------- + ticket_id : str + ticket_id + + tag_id : str + The unique identifier for the tag which is given by Intercom + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Tag] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"tickets/{jsonable_encoder(ticket_id)}/tags", + method="POST", + json={ + "id": tag_id, + "admin_id": admin_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def untag_ticket( + self, ticket_id: str, tag_id: str, *, admin_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[Tag]: + """ + You can remove tag from a specific ticket. This will return a tag object for the tag that was removed from the ticket. + + Parameters + ---------- + ticket_id : str + ticket_id + + tag_id : str + The unique identifier for the tag which is given by Intercom + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Tag] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"tickets/{jsonable_encoder(ticket_id)}/tags/{jsonable_encoder(tag_id)}", + method="DELETE", + json={ + "admin_id": admin_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/intercom/tags/types/__init__.py b/src/intercom/tags/types/__init__.py new file mode 100644 index 0000000..19ffcaa --- /dev/null +++ b/src/intercom/tags/types/__init__.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .tag import Tag +from .tags_create_request_body import TagsCreateRequestBody + +__all__ = ["Tag", "TagsCreateRequestBody"] diff --git a/src/intercom/tags/types/tag.py b/src/intercom/tags/types/tag.py new file mode 100644 index 0000000..fe9be06 --- /dev/null +++ b/src/intercom/tags/types/tag.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from ...types.reference import Reference + + +class Tag(UncheckedBaseModel): + """ + A tag allows you to label your contacts, companies, and conversations and list them using that tag. + """ + + type: typing.Literal["tag"] = pydantic.Field(default="tag") + """ + value is "tag" + """ + + id: str = pydantic.Field() + """ + The id of the tag + """ + + name: str = pydantic.Field() + """ + The name of the tag + """ + + applied_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time when the tag was applied to the object + """ + + applied_by: typing.Optional[Reference] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/tags/types/tags_create_request_body.py b/src/intercom/tags/types/tags_create_request_body.py new file mode 100644 index 0000000..ca21183 --- /dev/null +++ b/src/intercom/tags/types/tags_create_request_body.py @@ -0,0 +1,12 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.create_or_update_tag_request import CreateOrUpdateTagRequest +from ...types.tag_company_request import TagCompanyRequest +from ...types.tag_multiple_users_request import TagMultipleUsersRequest +from ...types.untag_company_request import UntagCompanyRequest + +TagsCreateRequestBody = typing.Union[ + CreateOrUpdateTagRequest, TagCompanyRequest, UntagCompanyRequest, TagMultipleUsersRequest +] diff --git a/src/intercom/teams/__init__.py b/src/intercom/teams/__init__.py new file mode 100644 index 0000000..fed79d9 --- /dev/null +++ b/src/intercom/teams/__init__.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .types import Team + +__all__ = ["Team"] diff --git a/src/intercom/teams/client.py b/src/intercom/teams/client.py new file mode 100644 index 0000000..a3657cd --- /dev/null +++ b/src/intercom/teams/client.py @@ -0,0 +1,171 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.team_list import TeamList +from .raw_client import AsyncRawTeamsClient, RawTeamsClient +from .types.team import Team + + +class TeamsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTeamsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawTeamsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTeamsClient + """ + return self._raw_client + + def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> TeamList: + """ + This will return a list of team objects for the App. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TeamList + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.teams.list() + """ + _response = self._raw_client.list(request_options=request_options) + return _response.data + + def find(self, team_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Team: + """ + You can fetch the details of a single team, containing an array of admins that belong to this team. + + Parameters + ---------- + team_id : str + The unique identifier of a given team. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Team + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.teams.find( + team_id="123", + ) + """ + _response = self._raw_client.find(team_id, request_options=request_options) + return _response.data + + +class AsyncTeamsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTeamsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawTeamsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTeamsClient + """ + return self._raw_client + + async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> TeamList: + """ + This will return a list of team objects for the App. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TeamList + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.teams.list() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(request_options=request_options) + return _response.data + + async def find(self, team_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Team: + """ + You can fetch the details of a single team, containing an array of admins that belong to this team. + + Parameters + ---------- + team_id : str + The unique identifier of a given team. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Team + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.teams.find( + team_id="123", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.find(team_id, request_options=request_options) + return _response.data diff --git a/src/intercom/teams/raw_client.py b/src/intercom/teams/raw_client.py new file mode 100644 index 0000000..ec2e308 --- /dev/null +++ b/src/intercom/teams/raw_client.py @@ -0,0 +1,236 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import jsonable_encoder +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.not_found_error import NotFoundError +from ..errors.unauthorized_error import UnauthorizedError +from ..types.error import Error +from ..types.team_list import TeamList +from .types.team import Team + + +class RawTeamsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[TeamList]: + """ + This will return a list of team objects for the App. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TeamList] + successful + """ + _response = self._client_wrapper.httpx_client.request( + "teams", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TeamList, + construct_type( + type_=TeamList, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def find(self, team_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Team]: + """ + You can fetch the details of a single team, containing an array of admins that belong to this team. + + Parameters + ---------- + team_id : str + The unique identifier of a given team. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Team] + successful + """ + _response = self._client_wrapper.httpx_client.request( + f"teams/{jsonable_encoder(team_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Team, + construct_type( + type_=Team, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawTeamsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> AsyncHttpResponse[TeamList]: + """ + This will return a list of team objects for the App. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TeamList] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + "teams", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TeamList, + construct_type( + type_=TeamList, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def find( + self, team_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[Team]: + """ + You can fetch the details of a single team, containing an array of admins that belong to this team. + + Parameters + ---------- + team_id : str + The unique identifier of a given team. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Team] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"teams/{jsonable_encoder(team_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Team, + construct_type( + type_=Team, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/intercom/teams/types/__init__.py b/src/intercom/teams/types/__init__.py new file mode 100644 index 0000000..2d434e8 --- /dev/null +++ b/src/intercom/teams/types/__init__.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .team import Team + +__all__ = ["Team"] diff --git a/src/intercom/teams/types/team.py b/src/intercom/teams/types/team.py new file mode 100644 index 0000000..d27fe24 --- /dev/null +++ b/src/intercom/teams/types/team.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from ...types.admin_priority_level import AdminPriorityLevel + + +class Team(UncheckedBaseModel): + """ + Teams are groups of admins in Intercom. + """ + + type: typing.Literal["team"] = pydantic.Field(default="team") + """ + Value is always "team" + """ + + id: str = pydantic.Field() + """ + The id of the team + """ + + name: str = pydantic.Field() + """ + The name of the team + """ + + admin_ids: typing.List[int] = pydantic.Field() + """ + The list of admin IDs that are a part of the team. + """ + + admin_priority_level: typing.Optional[AdminPriorityLevel] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/ticket_types/__init__.py b/src/intercom/ticket_types/__init__.py new file mode 100644 index 0000000..9eee489 --- /dev/null +++ b/src/intercom/ticket_types/__init__.py @@ -0,0 +1,14 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .types import CreateTicketTypeRequestCategory, UpdateTicketTypeRequestBodyCategory +from . import attributes +from .attributes import CreateTicketTypeAttributeRequestDataType + +__all__ = [ + "CreateTicketTypeAttributeRequestDataType", + "CreateTicketTypeRequestCategory", + "UpdateTicketTypeRequestBodyCategory", + "attributes", +] diff --git a/src/intercom/ticket_types/attributes/__init__.py b/src/intercom/ticket_types/attributes/__init__.py new file mode 100644 index 0000000..ff49df2 --- /dev/null +++ b/src/intercom/ticket_types/attributes/__init__.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .types import CreateTicketTypeAttributeRequestDataType + +__all__ = ["CreateTicketTypeAttributeRequestDataType"] diff --git a/src/intercom/ticket_types/attributes/client.py b/src/intercom/ticket_types/attributes/client.py new file mode 100644 index 0000000..4cb02c5 --- /dev/null +++ b/src/intercom/ticket_types/attributes/client.py @@ -0,0 +1,438 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.ticket_type_attribute import TicketTypeAttribute +from .raw_client import AsyncRawAttributesClient, RawAttributesClient +from .types.create_ticket_type_attribute_request_data_type import CreateTicketTypeAttributeRequestDataType + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class AttributesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawAttributesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawAttributesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawAttributesClient + """ + return self._raw_client + + def create( + self, + ticket_type_id: str, + *, + name: str, + description: str, + data_type: CreateTicketTypeAttributeRequestDataType, + required_to_create: typing.Optional[bool] = OMIT, + required_to_create_for_contacts: typing.Optional[bool] = OMIT, + visible_on_create: typing.Optional[bool] = OMIT, + visible_to_contacts: typing.Optional[bool] = OMIT, + multiline: typing.Optional[bool] = OMIT, + list_items: typing.Optional[str] = OMIT, + allow_multiple_values: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> TicketTypeAttribute: + """ + You can create a new attribute for a ticket type. + + Parameters + ---------- + ticket_type_id : str + The unique identifier for the ticket type which is given by Intercom. + + name : str + The name of the ticket type attribute + + description : str + The description of the attribute presented to the teammate or contact + + data_type : CreateTicketTypeAttributeRequestDataType + The data type of the attribute + + required_to_create : typing.Optional[bool] + Whether the attribute is required to be filled in when teammates are creating the ticket in Inbox. + + required_to_create_for_contacts : typing.Optional[bool] + Whether the attribute is required to be filled in when contacts are creating the ticket in Messenger. + + visible_on_create : typing.Optional[bool] + Whether the attribute is visible to teammates when creating a ticket in Inbox. + + visible_to_contacts : typing.Optional[bool] + Whether the attribute is visible to contacts when creating a ticket in Messenger. + + multiline : typing.Optional[bool] + Whether the attribute allows multiple lines of text (only applicable to string attributes) + + list_items : typing.Optional[str] + A comma delimited list of items for the attribute value (only applicable to list attributes) + + allow_multiple_values : typing.Optional[bool] + Whether the attribute allows multiple files to be attached to it (only applicable to file attributes) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TicketTypeAttribute + Ticket Type Attribute created + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.ticket_types.attributes.create( + ticket_type_id="ticket_type_id", + name="Attribute Title", + description="Attribute Description", + data_type="string", + required_to_create=False, + ) + """ + _response = self._raw_client.create( + ticket_type_id, + name=name, + description=description, + data_type=data_type, + required_to_create=required_to_create, + required_to_create_for_contacts=required_to_create_for_contacts, + visible_on_create=visible_on_create, + visible_to_contacts=visible_to_contacts, + multiline=multiline, + list_items=list_items, + allow_multiple_values=allow_multiple_values, + request_options=request_options, + ) + return _response.data + + def update( + self, + ticket_type_id: str, + attribute_id: str, + *, + name: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + required_to_create: typing.Optional[bool] = OMIT, + required_to_create_for_contacts: typing.Optional[bool] = OMIT, + visible_on_create: typing.Optional[bool] = OMIT, + visible_to_contacts: typing.Optional[bool] = OMIT, + multiline: typing.Optional[bool] = OMIT, + list_items: typing.Optional[str] = OMIT, + allow_multiple_values: typing.Optional[bool] = OMIT, + archived: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> TicketTypeAttribute: + """ + You can update an existing attribute for a ticket type. + + Parameters + ---------- + ticket_type_id : str + The unique identifier for the ticket type which is given by Intercom. + + attribute_id : str + The unique identifier for the ticket type attribute which is given by Intercom. + + name : typing.Optional[str] + The name of the ticket type attribute + + description : typing.Optional[str] + The description of the attribute presented to the teammate or contact + + required_to_create : typing.Optional[bool] + Whether the attribute is required to be filled in when teammates are creating the ticket in Inbox. + + required_to_create_for_contacts : typing.Optional[bool] + Whether the attribute is required to be filled in when contacts are creating the ticket in Messenger. + + visible_on_create : typing.Optional[bool] + Whether the attribute is visible to teammates when creating a ticket in Inbox. + + visible_to_contacts : typing.Optional[bool] + Whether the attribute is visible to contacts when creating a ticket in Messenger. + + multiline : typing.Optional[bool] + Whether the attribute allows multiple lines of text (only applicable to string attributes) + + list_items : typing.Optional[str] + A comma delimited list of items for the attribute value (only applicable to list attributes) + + allow_multiple_values : typing.Optional[bool] + Whether the attribute allows multiple files to be attached to it (only applicable to file attributes) + + archived : typing.Optional[bool] + Whether the attribute should be archived and not shown during creation of the ticket (it will still be present on previously created tickets) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TicketTypeAttribute + Ticket Type Attribute updated + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.ticket_types.attributes.update( + ticket_type_id="ticket_type_id", + attribute_id="attribute_id", + description="New Attribute Description", + ) + """ + _response = self._raw_client.update( + ticket_type_id, + attribute_id, + name=name, + description=description, + required_to_create=required_to_create, + required_to_create_for_contacts=required_to_create_for_contacts, + visible_on_create=visible_on_create, + visible_to_contacts=visible_to_contacts, + multiline=multiline, + list_items=list_items, + allow_multiple_values=allow_multiple_values, + archived=archived, + request_options=request_options, + ) + return _response.data + + +class AsyncAttributesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawAttributesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawAttributesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawAttributesClient + """ + return self._raw_client + + async def create( + self, + ticket_type_id: str, + *, + name: str, + description: str, + data_type: CreateTicketTypeAttributeRequestDataType, + required_to_create: typing.Optional[bool] = OMIT, + required_to_create_for_contacts: typing.Optional[bool] = OMIT, + visible_on_create: typing.Optional[bool] = OMIT, + visible_to_contacts: typing.Optional[bool] = OMIT, + multiline: typing.Optional[bool] = OMIT, + list_items: typing.Optional[str] = OMIT, + allow_multiple_values: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> TicketTypeAttribute: + """ + You can create a new attribute for a ticket type. + + Parameters + ---------- + ticket_type_id : str + The unique identifier for the ticket type which is given by Intercom. + + name : str + The name of the ticket type attribute + + description : str + The description of the attribute presented to the teammate or contact + + data_type : CreateTicketTypeAttributeRequestDataType + The data type of the attribute + + required_to_create : typing.Optional[bool] + Whether the attribute is required to be filled in when teammates are creating the ticket in Inbox. + + required_to_create_for_contacts : typing.Optional[bool] + Whether the attribute is required to be filled in when contacts are creating the ticket in Messenger. + + visible_on_create : typing.Optional[bool] + Whether the attribute is visible to teammates when creating a ticket in Inbox. + + visible_to_contacts : typing.Optional[bool] + Whether the attribute is visible to contacts when creating a ticket in Messenger. + + multiline : typing.Optional[bool] + Whether the attribute allows multiple lines of text (only applicable to string attributes) + + list_items : typing.Optional[str] + A comma delimited list of items for the attribute value (only applicable to list attributes) + + allow_multiple_values : typing.Optional[bool] + Whether the attribute allows multiple files to be attached to it (only applicable to file attributes) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TicketTypeAttribute + Ticket Type Attribute created + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.ticket_types.attributes.create( + ticket_type_id="ticket_type_id", + name="Attribute Title", + description="Attribute Description", + data_type="string", + required_to_create=False, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + ticket_type_id, + name=name, + description=description, + data_type=data_type, + required_to_create=required_to_create, + required_to_create_for_contacts=required_to_create_for_contacts, + visible_on_create=visible_on_create, + visible_to_contacts=visible_to_contacts, + multiline=multiline, + list_items=list_items, + allow_multiple_values=allow_multiple_values, + request_options=request_options, + ) + return _response.data + + async def update( + self, + ticket_type_id: str, + attribute_id: str, + *, + name: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + required_to_create: typing.Optional[bool] = OMIT, + required_to_create_for_contacts: typing.Optional[bool] = OMIT, + visible_on_create: typing.Optional[bool] = OMIT, + visible_to_contacts: typing.Optional[bool] = OMIT, + multiline: typing.Optional[bool] = OMIT, + list_items: typing.Optional[str] = OMIT, + allow_multiple_values: typing.Optional[bool] = OMIT, + archived: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> TicketTypeAttribute: + """ + You can update an existing attribute for a ticket type. + + Parameters + ---------- + ticket_type_id : str + The unique identifier for the ticket type which is given by Intercom. + + attribute_id : str + The unique identifier for the ticket type attribute which is given by Intercom. + + name : typing.Optional[str] + The name of the ticket type attribute + + description : typing.Optional[str] + The description of the attribute presented to the teammate or contact + + required_to_create : typing.Optional[bool] + Whether the attribute is required to be filled in when teammates are creating the ticket in Inbox. + + required_to_create_for_contacts : typing.Optional[bool] + Whether the attribute is required to be filled in when contacts are creating the ticket in Messenger. + + visible_on_create : typing.Optional[bool] + Whether the attribute is visible to teammates when creating a ticket in Inbox. + + visible_to_contacts : typing.Optional[bool] + Whether the attribute is visible to contacts when creating a ticket in Messenger. + + multiline : typing.Optional[bool] + Whether the attribute allows multiple lines of text (only applicable to string attributes) + + list_items : typing.Optional[str] + A comma delimited list of items for the attribute value (only applicable to list attributes) + + allow_multiple_values : typing.Optional[bool] + Whether the attribute allows multiple files to be attached to it (only applicable to file attributes) + + archived : typing.Optional[bool] + Whether the attribute should be archived and not shown during creation of the ticket (it will still be present on previously created tickets) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TicketTypeAttribute + Ticket Type Attribute updated + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.ticket_types.attributes.update( + ticket_type_id="ticket_type_id", + attribute_id="attribute_id", + description="New Attribute Description", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + ticket_type_id, + attribute_id, + name=name, + description=description, + required_to_create=required_to_create, + required_to_create_for_contacts=required_to_create_for_contacts, + visible_on_create=visible_on_create, + visible_to_contacts=visible_to_contacts, + multiline=multiline, + list_items=list_items, + allow_multiple_values=allow_multiple_values, + archived=archived, + request_options=request_options, + ) + return _response.data diff --git a/src/intercom/ticket_types/attributes/raw_client.py b/src/intercom/ticket_types/attributes/raw_client.py new file mode 100644 index 0000000..0de72e8 --- /dev/null +++ b/src/intercom/ticket_types/attributes/raw_client.py @@ -0,0 +1,472 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unauthorized_error import UnauthorizedError +from ...types.error import Error +from ...types.ticket_type_attribute import TicketTypeAttribute +from .types.create_ticket_type_attribute_request_data_type import CreateTicketTypeAttributeRequestDataType + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawAttributesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, + ticket_type_id: str, + *, + name: str, + description: str, + data_type: CreateTicketTypeAttributeRequestDataType, + required_to_create: typing.Optional[bool] = OMIT, + required_to_create_for_contacts: typing.Optional[bool] = OMIT, + visible_on_create: typing.Optional[bool] = OMIT, + visible_to_contacts: typing.Optional[bool] = OMIT, + multiline: typing.Optional[bool] = OMIT, + list_items: typing.Optional[str] = OMIT, + allow_multiple_values: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[TicketTypeAttribute]: + """ + You can create a new attribute for a ticket type. + + Parameters + ---------- + ticket_type_id : str + The unique identifier for the ticket type which is given by Intercom. + + name : str + The name of the ticket type attribute + + description : str + The description of the attribute presented to the teammate or contact + + data_type : CreateTicketTypeAttributeRequestDataType + The data type of the attribute + + required_to_create : typing.Optional[bool] + Whether the attribute is required to be filled in when teammates are creating the ticket in Inbox. + + required_to_create_for_contacts : typing.Optional[bool] + Whether the attribute is required to be filled in when contacts are creating the ticket in Messenger. + + visible_on_create : typing.Optional[bool] + Whether the attribute is visible to teammates when creating a ticket in Inbox. + + visible_to_contacts : typing.Optional[bool] + Whether the attribute is visible to contacts when creating a ticket in Messenger. + + multiline : typing.Optional[bool] + Whether the attribute allows multiple lines of text (only applicable to string attributes) + + list_items : typing.Optional[str] + A comma delimited list of items for the attribute value (only applicable to list attributes) + + allow_multiple_values : typing.Optional[bool] + Whether the attribute allows multiple files to be attached to it (only applicable to file attributes) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TicketTypeAttribute] + Ticket Type Attribute created + """ + _response = self._client_wrapper.httpx_client.request( + f"ticket_types/{jsonable_encoder(ticket_type_id)}/attributes", + method="POST", + json={ + "name": name, + "description": description, + "data_type": data_type, + "required_to_create": required_to_create, + "required_to_create_for_contacts": required_to_create_for_contacts, + "visible_on_create": visible_on_create, + "visible_to_contacts": visible_to_contacts, + "multiline": multiline, + "list_items": list_items, + "allow_multiple_values": allow_multiple_values, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TicketTypeAttribute, + construct_type( + type_=TicketTypeAttribute, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + ticket_type_id: str, + attribute_id: str, + *, + name: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + required_to_create: typing.Optional[bool] = OMIT, + required_to_create_for_contacts: typing.Optional[bool] = OMIT, + visible_on_create: typing.Optional[bool] = OMIT, + visible_to_contacts: typing.Optional[bool] = OMIT, + multiline: typing.Optional[bool] = OMIT, + list_items: typing.Optional[str] = OMIT, + allow_multiple_values: typing.Optional[bool] = OMIT, + archived: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[TicketTypeAttribute]: + """ + You can update an existing attribute for a ticket type. + + Parameters + ---------- + ticket_type_id : str + The unique identifier for the ticket type which is given by Intercom. + + attribute_id : str + The unique identifier for the ticket type attribute which is given by Intercom. + + name : typing.Optional[str] + The name of the ticket type attribute + + description : typing.Optional[str] + The description of the attribute presented to the teammate or contact + + required_to_create : typing.Optional[bool] + Whether the attribute is required to be filled in when teammates are creating the ticket in Inbox. + + required_to_create_for_contacts : typing.Optional[bool] + Whether the attribute is required to be filled in when contacts are creating the ticket in Messenger. + + visible_on_create : typing.Optional[bool] + Whether the attribute is visible to teammates when creating a ticket in Inbox. + + visible_to_contacts : typing.Optional[bool] + Whether the attribute is visible to contacts when creating a ticket in Messenger. + + multiline : typing.Optional[bool] + Whether the attribute allows multiple lines of text (only applicable to string attributes) + + list_items : typing.Optional[str] + A comma delimited list of items for the attribute value (only applicable to list attributes) + + allow_multiple_values : typing.Optional[bool] + Whether the attribute allows multiple files to be attached to it (only applicable to file attributes) + + archived : typing.Optional[bool] + Whether the attribute should be archived and not shown during creation of the ticket (it will still be present on previously created tickets) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TicketTypeAttribute] + Ticket Type Attribute updated + """ + _response = self._client_wrapper.httpx_client.request( + f"ticket_types/{jsonable_encoder(ticket_type_id)}/attributes/{jsonable_encoder(attribute_id)}", + method="PUT", + json={ + "name": name, + "description": description, + "required_to_create": required_to_create, + "required_to_create_for_contacts": required_to_create_for_contacts, + "visible_on_create": visible_on_create, + "visible_to_contacts": visible_to_contacts, + "multiline": multiline, + "list_items": list_items, + "allow_multiple_values": allow_multiple_values, + "archived": archived, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TicketTypeAttribute, + construct_type( + type_=TicketTypeAttribute, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawAttributesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, + ticket_type_id: str, + *, + name: str, + description: str, + data_type: CreateTicketTypeAttributeRequestDataType, + required_to_create: typing.Optional[bool] = OMIT, + required_to_create_for_contacts: typing.Optional[bool] = OMIT, + visible_on_create: typing.Optional[bool] = OMIT, + visible_to_contacts: typing.Optional[bool] = OMIT, + multiline: typing.Optional[bool] = OMIT, + list_items: typing.Optional[str] = OMIT, + allow_multiple_values: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[TicketTypeAttribute]: + """ + You can create a new attribute for a ticket type. + + Parameters + ---------- + ticket_type_id : str + The unique identifier for the ticket type which is given by Intercom. + + name : str + The name of the ticket type attribute + + description : str + The description of the attribute presented to the teammate or contact + + data_type : CreateTicketTypeAttributeRequestDataType + The data type of the attribute + + required_to_create : typing.Optional[bool] + Whether the attribute is required to be filled in when teammates are creating the ticket in Inbox. + + required_to_create_for_contacts : typing.Optional[bool] + Whether the attribute is required to be filled in when contacts are creating the ticket in Messenger. + + visible_on_create : typing.Optional[bool] + Whether the attribute is visible to teammates when creating a ticket in Inbox. + + visible_to_contacts : typing.Optional[bool] + Whether the attribute is visible to contacts when creating a ticket in Messenger. + + multiline : typing.Optional[bool] + Whether the attribute allows multiple lines of text (only applicable to string attributes) + + list_items : typing.Optional[str] + A comma delimited list of items for the attribute value (only applicable to list attributes) + + allow_multiple_values : typing.Optional[bool] + Whether the attribute allows multiple files to be attached to it (only applicable to file attributes) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TicketTypeAttribute] + Ticket Type Attribute created + """ + _response = await self._client_wrapper.httpx_client.request( + f"ticket_types/{jsonable_encoder(ticket_type_id)}/attributes", + method="POST", + json={ + "name": name, + "description": description, + "data_type": data_type, + "required_to_create": required_to_create, + "required_to_create_for_contacts": required_to_create_for_contacts, + "visible_on_create": visible_on_create, + "visible_to_contacts": visible_to_contacts, + "multiline": multiline, + "list_items": list_items, + "allow_multiple_values": allow_multiple_values, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TicketTypeAttribute, + construct_type( + type_=TicketTypeAttribute, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + ticket_type_id: str, + attribute_id: str, + *, + name: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + required_to_create: typing.Optional[bool] = OMIT, + required_to_create_for_contacts: typing.Optional[bool] = OMIT, + visible_on_create: typing.Optional[bool] = OMIT, + visible_to_contacts: typing.Optional[bool] = OMIT, + multiline: typing.Optional[bool] = OMIT, + list_items: typing.Optional[str] = OMIT, + allow_multiple_values: typing.Optional[bool] = OMIT, + archived: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[TicketTypeAttribute]: + """ + You can update an existing attribute for a ticket type. + + Parameters + ---------- + ticket_type_id : str + The unique identifier for the ticket type which is given by Intercom. + + attribute_id : str + The unique identifier for the ticket type attribute which is given by Intercom. + + name : typing.Optional[str] + The name of the ticket type attribute + + description : typing.Optional[str] + The description of the attribute presented to the teammate or contact + + required_to_create : typing.Optional[bool] + Whether the attribute is required to be filled in when teammates are creating the ticket in Inbox. + + required_to_create_for_contacts : typing.Optional[bool] + Whether the attribute is required to be filled in when contacts are creating the ticket in Messenger. + + visible_on_create : typing.Optional[bool] + Whether the attribute is visible to teammates when creating a ticket in Inbox. + + visible_to_contacts : typing.Optional[bool] + Whether the attribute is visible to contacts when creating a ticket in Messenger. + + multiline : typing.Optional[bool] + Whether the attribute allows multiple lines of text (only applicable to string attributes) + + list_items : typing.Optional[str] + A comma delimited list of items for the attribute value (only applicable to list attributes) + + allow_multiple_values : typing.Optional[bool] + Whether the attribute allows multiple files to be attached to it (only applicable to file attributes) + + archived : typing.Optional[bool] + Whether the attribute should be archived and not shown during creation of the ticket (it will still be present on previously created tickets) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TicketTypeAttribute] + Ticket Type Attribute updated + """ + _response = await self._client_wrapper.httpx_client.request( + f"ticket_types/{jsonable_encoder(ticket_type_id)}/attributes/{jsonable_encoder(attribute_id)}", + method="PUT", + json={ + "name": name, + "description": description, + "required_to_create": required_to_create, + "required_to_create_for_contacts": required_to_create_for_contacts, + "visible_on_create": visible_on_create, + "visible_to_contacts": visible_to_contacts, + "multiline": multiline, + "list_items": list_items, + "allow_multiple_values": allow_multiple_values, + "archived": archived, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TicketTypeAttribute, + construct_type( + type_=TicketTypeAttribute, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/intercom/ticket_types/attributes/types/__init__.py b/src/intercom/ticket_types/attributes/types/__init__.py new file mode 100644 index 0000000..038bb1a --- /dev/null +++ b/src/intercom/ticket_types/attributes/types/__init__.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .create_ticket_type_attribute_request_data_type import CreateTicketTypeAttributeRequestDataType + +__all__ = ["CreateTicketTypeAttributeRequestDataType"] diff --git a/src/intercom/ticket_types/attributes/types/create_ticket_type_attribute_request_data_type.py b/src/intercom/ticket_types/attributes/types/create_ticket_type_attribute_request_data_type.py new file mode 100644 index 0000000..af58adf --- /dev/null +++ b/src/intercom/ticket_types/attributes/types/create_ticket_type_attribute_request_data_type.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CreateTicketTypeAttributeRequestDataType = typing.Union[ + typing.Literal["string", "list", "integer", "decimal", "boolean", "datetime", "files"], typing.Any +] diff --git a/src/intercom/ticket_types/client.py b/src/intercom/ticket_types/client.py new file mode 100644 index 0000000..c01dd27 --- /dev/null +++ b/src/intercom/ticket_types/client.py @@ -0,0 +1,477 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..tickets.types.ticket_type import TicketType +from ..types.ticket_type_list import TicketTypeList +from .attributes.client import AsyncAttributesClient, AttributesClient +from .raw_client import AsyncRawTicketTypesClient, RawTicketTypesClient +from .types.create_ticket_type_request_category import CreateTicketTypeRequestCategory +from .types.update_ticket_type_request_body_category import UpdateTicketTypeRequestBodyCategory + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class TicketTypesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTicketTypesClient(client_wrapper=client_wrapper) + self.attributes = AttributesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawTicketTypesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTicketTypesClient + """ + return self._raw_client + + def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> TicketTypeList: + """ + You can get a list of all ticket types for a workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TicketTypeList + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.ticket_types.list() + """ + _response = self._raw_client.list(request_options=request_options) + return _response.data + + def create( + self, + *, + name: str, + description: typing.Optional[str] = OMIT, + category: typing.Optional[CreateTicketTypeRequestCategory] = OMIT, + icon: typing.Optional[str] = OMIT, + is_internal: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> TicketType: + """ + You can create a new ticket type. + > 📘 Creating ticket types. + > + > Every ticket type will be created with two default attributes: _default_title_ and _default_description_. + > For the `icon` propery, use an emoji from [Twemoji Cheatsheet](https://twemoji-cheatsheet.vercel.app/) + + Parameters + ---------- + name : str + The name of the ticket type. + + description : typing.Optional[str] + The description of the ticket type. + + category : typing.Optional[CreateTicketTypeRequestCategory] + Category of the Ticket Type. + + icon : typing.Optional[str] + The icon of the ticket type. + + is_internal : typing.Optional[bool] + Whether the tickets associated with this ticket type are intended for internal use only or will be shared with customers. This is currently a limited attribute. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TicketType + Ticket type created + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.ticket_types.create( + name="Customer Issue", + description="Customer Report Template", + category="Customer", + icon="🎟️", + ) + """ + _response = self._raw_client.create( + name=name, + description=description, + category=category, + icon=icon, + is_internal=is_internal, + request_options=request_options, + ) + return _response.data + + def get(self, ticket_type_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> TicketType: + """ + You can fetch the details of a single ticket type. + + Parameters + ---------- + ticket_type_id : str + The unique identifier for the ticket type which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TicketType + Ticket type found + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.ticket_types.get( + ticket_type_id="ticket_type_id", + ) + """ + _response = self._raw_client.get(ticket_type_id, request_options=request_options) + return _response.data + + def update( + self, + ticket_type_id: str, + *, + name: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + category: typing.Optional[UpdateTicketTypeRequestBodyCategory] = OMIT, + icon: typing.Optional[str] = OMIT, + archived: typing.Optional[bool] = OMIT, + is_internal: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> TicketType: + """ + + You can update a ticket type. + + > 📘 Updating a ticket type. + > + > For the `icon` propery, use an emoji from [Twemoji Cheatsheet](https://twemoji-cheatsheet.vercel.app/) + + Parameters + ---------- + ticket_type_id : str + The unique identifier for the ticket type which is given by Intercom. + + name : typing.Optional[str] + The name of the ticket type. + + description : typing.Optional[str] + The description of the ticket type. + + category : typing.Optional[UpdateTicketTypeRequestBodyCategory] + Category of the Ticket Type. + + icon : typing.Optional[str] + The icon of the ticket type. + + archived : typing.Optional[bool] + The archived status of the ticket type. + + is_internal : typing.Optional[bool] + Whether the tickets associated with this ticket type are intended for internal use only or will be shared with customers. This is currently a limited attribute. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TicketType + Ticket type updated + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.ticket_types.update( + ticket_type_id="ticket_type_id", + name="Bug Report 2", + ) + """ + _response = self._raw_client.update( + ticket_type_id, + name=name, + description=description, + category=category, + icon=icon, + archived=archived, + is_internal=is_internal, + request_options=request_options, + ) + return _response.data + + +class AsyncTicketTypesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTicketTypesClient(client_wrapper=client_wrapper) + self.attributes = AsyncAttributesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawTicketTypesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTicketTypesClient + """ + return self._raw_client + + async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> TicketTypeList: + """ + You can get a list of all ticket types for a workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TicketTypeList + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.ticket_types.list() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(request_options=request_options) + return _response.data + + async def create( + self, + *, + name: str, + description: typing.Optional[str] = OMIT, + category: typing.Optional[CreateTicketTypeRequestCategory] = OMIT, + icon: typing.Optional[str] = OMIT, + is_internal: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> TicketType: + """ + You can create a new ticket type. + > 📘 Creating ticket types. + > + > Every ticket type will be created with two default attributes: _default_title_ and _default_description_. + > For the `icon` propery, use an emoji from [Twemoji Cheatsheet](https://twemoji-cheatsheet.vercel.app/) + + Parameters + ---------- + name : str + The name of the ticket type. + + description : typing.Optional[str] + The description of the ticket type. + + category : typing.Optional[CreateTicketTypeRequestCategory] + Category of the Ticket Type. + + icon : typing.Optional[str] + The icon of the ticket type. + + is_internal : typing.Optional[bool] + Whether the tickets associated with this ticket type are intended for internal use only or will be shared with customers. This is currently a limited attribute. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TicketType + Ticket type created + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.ticket_types.create( + name="Customer Issue", + description="Customer Report Template", + category="Customer", + icon="🎟️", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + name=name, + description=description, + category=category, + icon=icon, + is_internal=is_internal, + request_options=request_options, + ) + return _response.data + + async def get(self, ticket_type_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> TicketType: + """ + You can fetch the details of a single ticket type. + + Parameters + ---------- + ticket_type_id : str + The unique identifier for the ticket type which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TicketType + Ticket type found + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.ticket_types.get( + ticket_type_id="ticket_type_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(ticket_type_id, request_options=request_options) + return _response.data + + async def update( + self, + ticket_type_id: str, + *, + name: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + category: typing.Optional[UpdateTicketTypeRequestBodyCategory] = OMIT, + icon: typing.Optional[str] = OMIT, + archived: typing.Optional[bool] = OMIT, + is_internal: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> TicketType: + """ + + You can update a ticket type. + + > 📘 Updating a ticket type. + > + > For the `icon` propery, use an emoji from [Twemoji Cheatsheet](https://twemoji-cheatsheet.vercel.app/) + + Parameters + ---------- + ticket_type_id : str + The unique identifier for the ticket type which is given by Intercom. + + name : typing.Optional[str] + The name of the ticket type. + + description : typing.Optional[str] + The description of the ticket type. + + category : typing.Optional[UpdateTicketTypeRequestBodyCategory] + Category of the Ticket Type. + + icon : typing.Optional[str] + The icon of the ticket type. + + archived : typing.Optional[bool] + The archived status of the ticket type. + + is_internal : typing.Optional[bool] + Whether the tickets associated with this ticket type are intended for internal use only or will be shared with customers. This is currently a limited attribute. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TicketType + Ticket type updated + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.ticket_types.update( + ticket_type_id="ticket_type_id", + name="Bug Report 2", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + ticket_type_id, + name=name, + description=description, + category=category, + icon=icon, + archived=archived, + is_internal=is_internal, + request_options=request_options, + ) + return _response.data diff --git a/src/intercom/ticket_types/raw_client.py b/src/intercom/ticket_types/raw_client.py new file mode 100644 index 0000000..b031dad --- /dev/null +++ b/src/intercom/ticket_types/raw_client.py @@ -0,0 +1,578 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import jsonable_encoder +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.unauthorized_error import UnauthorizedError +from ..tickets.types.ticket_type import TicketType +from ..types.error import Error +from ..types.ticket_type_list import TicketTypeList +from .types.create_ticket_type_request_category import CreateTicketTypeRequestCategory +from .types.update_ticket_type_request_body_category import UpdateTicketTypeRequestBodyCategory + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawTicketTypesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[TicketTypeList]: + """ + You can get a list of all ticket types for a workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TicketTypeList] + successful + """ + _response = self._client_wrapper.httpx_client.request( + "ticket_types", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TicketTypeList, + construct_type( + type_=TicketTypeList, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + *, + name: str, + description: typing.Optional[str] = OMIT, + category: typing.Optional[CreateTicketTypeRequestCategory] = OMIT, + icon: typing.Optional[str] = OMIT, + is_internal: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[TicketType]: + """ + You can create a new ticket type. + > 📘 Creating ticket types. + > + > Every ticket type will be created with two default attributes: _default_title_ and _default_description_. + > For the `icon` propery, use an emoji from [Twemoji Cheatsheet](https://twemoji-cheatsheet.vercel.app/) + + Parameters + ---------- + name : str + The name of the ticket type. + + description : typing.Optional[str] + The description of the ticket type. + + category : typing.Optional[CreateTicketTypeRequestCategory] + Category of the Ticket Type. + + icon : typing.Optional[str] + The icon of the ticket type. + + is_internal : typing.Optional[bool] + Whether the tickets associated with this ticket type are intended for internal use only or will be shared with customers. This is currently a limited attribute. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TicketType] + Ticket type created + """ + _response = self._client_wrapper.httpx_client.request( + "ticket_types", + method="POST", + json={ + "name": name, + "description": description, + "category": category, + "icon": icon, + "is_internal": is_internal, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TicketType, + construct_type( + type_=TicketType, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, ticket_type_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[TicketType]: + """ + You can fetch the details of a single ticket type. + + Parameters + ---------- + ticket_type_id : str + The unique identifier for the ticket type which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TicketType] + Ticket type found + """ + _response = self._client_wrapper.httpx_client.request( + f"ticket_types/{jsonable_encoder(ticket_type_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TicketType, + construct_type( + type_=TicketType, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + ticket_type_id: str, + *, + name: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + category: typing.Optional[UpdateTicketTypeRequestBodyCategory] = OMIT, + icon: typing.Optional[str] = OMIT, + archived: typing.Optional[bool] = OMIT, + is_internal: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[TicketType]: + """ + + You can update a ticket type. + + > 📘 Updating a ticket type. + > + > For the `icon` propery, use an emoji from [Twemoji Cheatsheet](https://twemoji-cheatsheet.vercel.app/) + + Parameters + ---------- + ticket_type_id : str + The unique identifier for the ticket type which is given by Intercom. + + name : typing.Optional[str] + The name of the ticket type. + + description : typing.Optional[str] + The description of the ticket type. + + category : typing.Optional[UpdateTicketTypeRequestBodyCategory] + Category of the Ticket Type. + + icon : typing.Optional[str] + The icon of the ticket type. + + archived : typing.Optional[bool] + The archived status of the ticket type. + + is_internal : typing.Optional[bool] + Whether the tickets associated with this ticket type are intended for internal use only or will be shared with customers. This is currently a limited attribute. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TicketType] + Ticket type updated + """ + _response = self._client_wrapper.httpx_client.request( + f"ticket_types/{jsonable_encoder(ticket_type_id)}", + method="PUT", + json={ + "name": name, + "description": description, + "category": category, + "icon": icon, + "archived": archived, + "is_internal": is_internal, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TicketType, + construct_type( + type_=TicketType, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawTicketTypesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[TicketTypeList]: + """ + You can get a list of all ticket types for a workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TicketTypeList] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + "ticket_types", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TicketTypeList, + construct_type( + type_=TicketTypeList, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + *, + name: str, + description: typing.Optional[str] = OMIT, + category: typing.Optional[CreateTicketTypeRequestCategory] = OMIT, + icon: typing.Optional[str] = OMIT, + is_internal: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[TicketType]: + """ + You can create a new ticket type. + > 📘 Creating ticket types. + > + > Every ticket type will be created with two default attributes: _default_title_ and _default_description_. + > For the `icon` propery, use an emoji from [Twemoji Cheatsheet](https://twemoji-cheatsheet.vercel.app/) + + Parameters + ---------- + name : str + The name of the ticket type. + + description : typing.Optional[str] + The description of the ticket type. + + category : typing.Optional[CreateTicketTypeRequestCategory] + Category of the Ticket Type. + + icon : typing.Optional[str] + The icon of the ticket type. + + is_internal : typing.Optional[bool] + Whether the tickets associated with this ticket type are intended for internal use only or will be shared with customers. This is currently a limited attribute. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TicketType] + Ticket type created + """ + _response = await self._client_wrapper.httpx_client.request( + "ticket_types", + method="POST", + json={ + "name": name, + "description": description, + "category": category, + "icon": icon, + "is_internal": is_internal, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TicketType, + construct_type( + type_=TicketType, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, ticket_type_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[TicketType]: + """ + You can fetch the details of a single ticket type. + + Parameters + ---------- + ticket_type_id : str + The unique identifier for the ticket type which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TicketType] + Ticket type found + """ + _response = await self._client_wrapper.httpx_client.request( + f"ticket_types/{jsonable_encoder(ticket_type_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TicketType, + construct_type( + type_=TicketType, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + ticket_type_id: str, + *, + name: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + category: typing.Optional[UpdateTicketTypeRequestBodyCategory] = OMIT, + icon: typing.Optional[str] = OMIT, + archived: typing.Optional[bool] = OMIT, + is_internal: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[TicketType]: + """ + + You can update a ticket type. + + > 📘 Updating a ticket type. + > + > For the `icon` propery, use an emoji from [Twemoji Cheatsheet](https://twemoji-cheatsheet.vercel.app/) + + Parameters + ---------- + ticket_type_id : str + The unique identifier for the ticket type which is given by Intercom. + + name : typing.Optional[str] + The name of the ticket type. + + description : typing.Optional[str] + The description of the ticket type. + + category : typing.Optional[UpdateTicketTypeRequestBodyCategory] + Category of the Ticket Type. + + icon : typing.Optional[str] + The icon of the ticket type. + + archived : typing.Optional[bool] + The archived status of the ticket type. + + is_internal : typing.Optional[bool] + Whether the tickets associated with this ticket type are intended for internal use only or will be shared with customers. This is currently a limited attribute. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TicketType] + Ticket type updated + """ + _response = await self._client_wrapper.httpx_client.request( + f"ticket_types/{jsonable_encoder(ticket_type_id)}", + method="PUT", + json={ + "name": name, + "description": description, + "category": category, + "icon": icon, + "archived": archived, + "is_internal": is_internal, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TicketType, + construct_type( + type_=TicketType, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/intercom/ticket_types/types/__init__.py b/src/intercom/ticket_types/types/__init__.py new file mode 100644 index 0000000..9f90de2 --- /dev/null +++ b/src/intercom/ticket_types/types/__init__.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .create_ticket_type_request_category import CreateTicketTypeRequestCategory +from .update_ticket_type_request_body_category import UpdateTicketTypeRequestBodyCategory + +__all__ = ["CreateTicketTypeRequestCategory", "UpdateTicketTypeRequestBodyCategory"] diff --git a/src/intercom/ticket_types/types/create_ticket_type_request_category.py b/src/intercom/ticket_types/types/create_ticket_type_request_category.py new file mode 100644 index 0000000..be7783a --- /dev/null +++ b/src/intercom/ticket_types/types/create_ticket_type_request_category.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CreateTicketTypeRequestCategory = typing.Union[typing.Literal["Customer", "Back-office", "Tracker"], typing.Any] diff --git a/src/intercom/ticket_types/types/update_ticket_type_request_body_category.py b/src/intercom/ticket_types/types/update_ticket_type_request_body_category.py new file mode 100644 index 0000000..2dc9d82 --- /dev/null +++ b/src/intercom/ticket_types/types/update_ticket_type_request_body_category.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +UpdateTicketTypeRequestBodyCategory = typing.Union[typing.Literal["Customer", "Back-office", "Tracker"], typing.Any] diff --git a/src/intercom/tickets/__init__.py b/src/intercom/tickets/__init__.py new file mode 100644 index 0000000..2b84247 --- /dev/null +++ b/src/intercom/tickets/__init__.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .types import ( + Ticket, + TicketCategory, + TicketContacts, + TicketPart, + TicketPartPreviousTicketState, + TicketPartTicketState, + TicketTicketState, + TicketType, + TicketTypeCategory, + TicketsReplyRequestBody, + UpdateTicketRequestAssignment, + UpdateTicketRequestState, +) + +__all__ = [ + "Ticket", + "TicketCategory", + "TicketContacts", + "TicketPart", + "TicketPartPreviousTicketState", + "TicketPartTicketState", + "TicketTicketState", + "TicketType", + "TicketTypeCategory", + "TicketsReplyRequestBody", + "UpdateTicketRequestAssignment", + "UpdateTicketRequestState", +] diff --git a/src/intercom/tickets/client.py b/src/intercom/tickets/client.py new file mode 100644 index 0000000..03cb766 --- /dev/null +++ b/src/intercom/tickets/client.py @@ -0,0 +1,771 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.pagination import AsyncPager, SyncPager +from ..core.request_options import RequestOptions +from ..types.create_ticket_request_contacts_item import CreateTicketRequestContactsItem +from ..types.search_request_query import SearchRequestQuery +from ..types.starting_after_paging import StartingAfterPaging +from ..types.ticket_reply import TicketReply +from ..types.ticket_request_custom_attributes import TicketRequestCustomAttributes +from .raw_client import AsyncRawTicketsClient, RawTicketsClient +from .types.ticket import Ticket +from .types.tickets_reply_request_body import TicketsReplyRequestBody +from .types.update_ticket_request_assignment import UpdateTicketRequestAssignment +from .types.update_ticket_request_state import UpdateTicketRequestState + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class TicketsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTicketsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawTicketsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTicketsClient + """ + return self._raw_client + + def reply( + self, + ticket_id: str, + *, + request: TicketsReplyRequestBody, + request_options: typing.Optional[RequestOptions] = None, + ) -> TicketReply: + """ + You can reply to a ticket with a message from an admin or on behalf of a contact, or with a note for admins. + + Parameters + ---------- + ticket_id : str + + request : TicketsReplyRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TicketReply + Admin quick_reply reply + + Examples + -------- + from intercom import ContactReplyTicketIntercomUserIdRequest, Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.tickets.reply( + ticket_id="123", + request=ContactReplyTicketIntercomUserIdRequest( + body="Thanks again :)", + intercom_user_id="667d619d8a68186f43bafe82", + ), + ) + """ + _response = self._raw_client.reply(ticket_id, request=request, request_options=request_options) + return _response.data + + def create( + self, + *, + ticket_type_id: str, + contacts: typing.Sequence[CreateTicketRequestContactsItem], + company_id: typing.Optional[str] = OMIT, + created_at: typing.Optional[int] = OMIT, + ticket_attributes: typing.Optional[TicketRequestCustomAttributes] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Ticket: + """ + You can create a new ticket. + + Parameters + ---------- + ticket_type_id : str + The ID of the type of ticket you want to create + + contacts : typing.Sequence[CreateTicketRequestContactsItem] + The list of contacts (users or leads) affected by this ticket. Currently only one is allowed + + company_id : typing.Optional[str] + The ID of the company that the ticket is associated with. The ID that you set upon company creation. + + created_at : typing.Optional[int] + The time the ticket was created. If not provided, the current time will be used. + + ticket_attributes : typing.Optional[TicketRequestCustomAttributes] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Ticket + Successful response + + Examples + -------- + from intercom import CreateTicketRequestContactsItemId, Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.tickets.create( + ticket_type_id="1234", + contacts=[ + CreateTicketRequestContactsItemId( + id="667d61b78a68186f43bafe8d", + ) + ], + ticket_attributes={ + "_default_title_": "example", + "_default_description_": "there is a problem", + }, + ) + """ + _response = self._raw_client.create( + ticket_type_id=ticket_type_id, + contacts=contacts, + company_id=company_id, + created_at=created_at, + ticket_attributes=ticket_attributes, + request_options=request_options, + ) + return _response.data + + def get(self, ticket_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Ticket: + """ + You can fetch the details of a single ticket. + + Parameters + ---------- + ticket_id : str + The unique identifier for the ticket which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Ticket + Ticket found + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.tickets.get( + ticket_id="ticket_id", + ) + """ + _response = self._raw_client.get(ticket_id, request_options=request_options) + return _response.data + + def update( + self, + ticket_id: str, + *, + ticket_attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + state: typing.Optional[UpdateTicketRequestState] = OMIT, + open: typing.Optional[bool] = OMIT, + is_shared: typing.Optional[bool] = OMIT, + snoozed_until: typing.Optional[int] = OMIT, + assignment: typing.Optional[UpdateTicketRequestAssignment] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Ticket: + """ + You can update a ticket. + + Parameters + ---------- + ticket_id : str + The unique identifier for the ticket which is given by Intercom + + ticket_attributes : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The attributes set on the ticket. + + state : typing.Optional[UpdateTicketRequestState] + The state of the ticket. + + open : typing.Optional[bool] + Specify if a ticket is open. Set to false to close a ticket. Closing a ticket will also unsnooze it. + + is_shared : typing.Optional[bool] + Specify whether the ticket is visible to users. + + snoozed_until : typing.Optional[int] + The time you want the ticket to reopen. + + assignment : typing.Optional[UpdateTicketRequestAssignment] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Ticket + Successful response + + Examples + -------- + from intercom import Intercom + from intercom.tickets import UpdateTicketRequestAssignment + + client = Intercom( + token="YOUR_TOKEN", + ) + client.tickets.update( + ticket_id="ticket_id", + ticket_attributes={ + "_default_title_": "example", + "_default_description_": "there is a problem", + }, + state="in_progress", + open=True, + snoozed_until=1673609604, + assignment=UpdateTicketRequestAssignment( + admin_id="991267883", + assignee_id="991267885", + ), + ) + """ + _response = self._raw_client.update( + ticket_id, + ticket_attributes=ticket_attributes, + state=state, + open=open, + is_shared=is_shared, + snoozed_until=snoozed_until, + assignment=assignment, + request_options=request_options, + ) + return _response.data + + def search( + self, + *, + query: SearchRequestQuery, + pagination: typing.Optional[StartingAfterPaging] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SyncPager[Ticket]: + """ + You can search for multiple tickets by the value of their attributes in order to fetch exactly which ones you want. + + To search for tickets, you send a `POST` request to `https://api.intercom.io/tickets/search`. + + This will accept a query object in the body which will define your filters. + {% admonition type="warning" name="Optimizing search queries" %} + Search queries can be complex, so optimizing them can help the performance of your search. + Use the `AND` and `OR` operators to combine multiple filters to get the exact results you need and utilize + pagination to limit the number of results returned. The default is `20` results per page. + See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#example-search-conversations-request) for more details on how to use the `starting_after` param. + {% /admonition %} + + ### Nesting & Limitations + + You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). + There are some limitations to the amount of multiples there can be: + - There's a limit of max 2 nested filters + - There's a limit of max 15 filters for each AND or OR group + + ### Accepted Fields + + Most keys listed as part of the Ticket model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as `created_at` accepts a date, the `value` cannot be a string such as `"foobar"`). + + | Field | Type | + | :---------------------------------------- | :--------------------------------------------------------------------------------------- | + | id | String | + | created_at | Date (UNIX timestamp) | + | updated_at | Date (UNIX timestamp) | + | _default_title_ | String | + | _default_description_ | String | + | category | String | + | ticket_type_id | String | + | contact_ids | String | + | teammate_ids | String | + | admin_assignee_id | String | + | team_assignee_id | String | + | open | Boolean | + | state | String | + | snoozed_until | Date (UNIX timestamp) | + | ticket_attribute.{id} | String or Boolean or Date (UNIX timestamp) or Float or Integer | + + ### Accepted Operators + + {% admonition type="info" name="Searching based on `created_at`" %} + You may use the `<=` or `>=` operators to search by `created_at`. + {% /admonition %} + + The table below shows the operators you can use to define how you want to search for the value. The operator should be put in as a string (`"="`). The operator has to be compatible with the field's type (eg. you cannot search with `>` for a given string value as it's only compatible for integer's and dates). + + | Operator | Valid Types | Description | + | :------- | :----------------------------- | :----------------------------------------------------------- | + | = | All | Equals | + | != | All | Doesn't Equal | + | IN | All | In Shortcut for `OR` queries Values most be in Array | + | NIN | All | Not In Shortcut for `OR !` queries Values must be in Array | + | > | Integer Date (UNIX Timestamp) | Greater (or equal) than | + | < | Integer Date (UNIX Timestamp) | Lower (or equal) than | + | ~ | String | Contains | + | !~ | String | Doesn't Contain | + | ^ | String | Starts With | + | $ | String | Ends With | + + Parameters + ---------- + query : SearchRequestQuery + + pagination : typing.Optional[StartingAfterPaging] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SyncPager[Ticket] + successful + + Examples + -------- + from intercom import ( + Intercom, + MultipleFilterSearchRequest, + SingleFilterSearchRequest, + StartingAfterPaging, + ) + + client = Intercom( + token="YOUR_TOKEN", + ) + response = client.tickets.search( + query=MultipleFilterSearchRequest( + operator="AND", + value=[ + SingleFilterSearchRequest( + field="created_at", + operator=">", + value="1306054154", + ) + ], + ), + pagination=StartingAfterPaging( + per_page=5, + ), + ) + for item in response: + yield item + # alternatively, you can paginate page-by-page + for page in response.iter_pages(): + yield page + """ + return self._raw_client.search(query=query, pagination=pagination, request_options=request_options) + + +class AsyncTicketsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTicketsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawTicketsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTicketsClient + """ + return self._raw_client + + async def reply( + self, + ticket_id: str, + *, + request: TicketsReplyRequestBody, + request_options: typing.Optional[RequestOptions] = None, + ) -> TicketReply: + """ + You can reply to a ticket with a message from an admin or on behalf of a contact, or with a note for admins. + + Parameters + ---------- + ticket_id : str + + request : TicketsReplyRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TicketReply + Admin quick_reply reply + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom, ContactReplyTicketIntercomUserIdRequest + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.tickets.reply( + ticket_id="123", + request=ContactReplyTicketIntercomUserIdRequest( + body="Thanks again :)", + intercom_user_id="667d619d8a68186f43bafe82", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.reply(ticket_id, request=request, request_options=request_options) + return _response.data + + async def create( + self, + *, + ticket_type_id: str, + contacts: typing.Sequence[CreateTicketRequestContactsItem], + company_id: typing.Optional[str] = OMIT, + created_at: typing.Optional[int] = OMIT, + ticket_attributes: typing.Optional[TicketRequestCustomAttributes] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Ticket: + """ + You can create a new ticket. + + Parameters + ---------- + ticket_type_id : str + The ID of the type of ticket you want to create + + contacts : typing.Sequence[CreateTicketRequestContactsItem] + The list of contacts (users or leads) affected by this ticket. Currently only one is allowed + + company_id : typing.Optional[str] + The ID of the company that the ticket is associated with. The ID that you set upon company creation. + + created_at : typing.Optional[int] + The time the ticket was created. If not provided, the current time will be used. + + ticket_attributes : typing.Optional[TicketRequestCustomAttributes] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Ticket + Successful response + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom, CreateTicketRequestContactsItemId + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.tickets.create( + ticket_type_id="1234", + contacts=[ + CreateTicketRequestContactsItemId( + id="667d61b78a68186f43bafe8d", + ) + ], + ticket_attributes={ + "_default_title_": "example", + "_default_description_": "there is a problem", + }, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + ticket_type_id=ticket_type_id, + contacts=contacts, + company_id=company_id, + created_at=created_at, + ticket_attributes=ticket_attributes, + request_options=request_options, + ) + return _response.data + + async def get(self, ticket_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Ticket: + """ + You can fetch the details of a single ticket. + + Parameters + ---------- + ticket_id : str + The unique identifier for the ticket which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Ticket + Ticket found + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.tickets.get( + ticket_id="ticket_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(ticket_id, request_options=request_options) + return _response.data + + async def update( + self, + ticket_id: str, + *, + ticket_attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + state: typing.Optional[UpdateTicketRequestState] = OMIT, + open: typing.Optional[bool] = OMIT, + is_shared: typing.Optional[bool] = OMIT, + snoozed_until: typing.Optional[int] = OMIT, + assignment: typing.Optional[UpdateTicketRequestAssignment] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Ticket: + """ + You can update a ticket. + + Parameters + ---------- + ticket_id : str + The unique identifier for the ticket which is given by Intercom + + ticket_attributes : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The attributes set on the ticket. + + state : typing.Optional[UpdateTicketRequestState] + The state of the ticket. + + open : typing.Optional[bool] + Specify if a ticket is open. Set to false to close a ticket. Closing a ticket will also unsnooze it. + + is_shared : typing.Optional[bool] + Specify whether the ticket is visible to users. + + snoozed_until : typing.Optional[int] + The time you want the ticket to reopen. + + assignment : typing.Optional[UpdateTicketRequestAssignment] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Ticket + Successful response + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + from intercom.tickets import UpdateTicketRequestAssignment + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.tickets.update( + ticket_id="ticket_id", + ticket_attributes={ + "_default_title_": "example", + "_default_description_": "there is a problem", + }, + state="in_progress", + open=True, + snoozed_until=1673609604, + assignment=UpdateTicketRequestAssignment( + admin_id="991267883", + assignee_id="991267885", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + ticket_id, + ticket_attributes=ticket_attributes, + state=state, + open=open, + is_shared=is_shared, + snoozed_until=snoozed_until, + assignment=assignment, + request_options=request_options, + ) + return _response.data + + async def search( + self, + *, + query: SearchRequestQuery, + pagination: typing.Optional[StartingAfterPaging] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncPager[Ticket]: + """ + You can search for multiple tickets by the value of their attributes in order to fetch exactly which ones you want. + + To search for tickets, you send a `POST` request to `https://api.intercom.io/tickets/search`. + + This will accept a query object in the body which will define your filters. + {% admonition type="warning" name="Optimizing search queries" %} + Search queries can be complex, so optimizing them can help the performance of your search. + Use the `AND` and `OR` operators to combine multiple filters to get the exact results you need and utilize + pagination to limit the number of results returned. The default is `20` results per page. + See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#example-search-conversations-request) for more details on how to use the `starting_after` param. + {% /admonition %} + + ### Nesting & Limitations + + You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). + There are some limitations to the amount of multiples there can be: + - There's a limit of max 2 nested filters + - There's a limit of max 15 filters for each AND or OR group + + ### Accepted Fields + + Most keys listed as part of the Ticket model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as `created_at` accepts a date, the `value` cannot be a string such as `"foobar"`). + + | Field | Type | + | :---------------------------------------- | :--------------------------------------------------------------------------------------- | + | id | String | + | created_at | Date (UNIX timestamp) | + | updated_at | Date (UNIX timestamp) | + | _default_title_ | String | + | _default_description_ | String | + | category | String | + | ticket_type_id | String | + | contact_ids | String | + | teammate_ids | String | + | admin_assignee_id | String | + | team_assignee_id | String | + | open | Boolean | + | state | String | + | snoozed_until | Date (UNIX timestamp) | + | ticket_attribute.{id} | String or Boolean or Date (UNIX timestamp) or Float or Integer | + + ### Accepted Operators + + {% admonition type="info" name="Searching based on `created_at`" %} + You may use the `<=` or `>=` operators to search by `created_at`. + {% /admonition %} + + The table below shows the operators you can use to define how you want to search for the value. The operator should be put in as a string (`"="`). The operator has to be compatible with the field's type (eg. you cannot search with `>` for a given string value as it's only compatible for integer's and dates). + + | Operator | Valid Types | Description | + | :------- | :----------------------------- | :----------------------------------------------------------- | + | = | All | Equals | + | != | All | Doesn't Equal | + | IN | All | In Shortcut for `OR` queries Values most be in Array | + | NIN | All | Not In Shortcut for `OR !` queries Values must be in Array | + | > | Integer Date (UNIX Timestamp) | Greater (or equal) than | + | < | Integer Date (UNIX Timestamp) | Lower (or equal) than | + | ~ | String | Contains | + | !~ | String | Doesn't Contain | + | ^ | String | Starts With | + | $ | String | Ends With | + + Parameters + ---------- + query : SearchRequestQuery + + pagination : typing.Optional[StartingAfterPaging] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncPager[Ticket] + successful + + Examples + -------- + import asyncio + + from intercom import ( + AsyncIntercom, + MultipleFilterSearchRequest, + SingleFilterSearchRequest, + StartingAfterPaging, + ) + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + response = await client.tickets.search( + query=MultipleFilterSearchRequest( + operator="AND", + value=[ + SingleFilterSearchRequest( + field="created_at", + operator=">", + value="1306054154", + ) + ], + ), + pagination=StartingAfterPaging( + per_page=5, + ), + ) + async for item in response: + yield item + + # alternatively, you can paginate page-by-page + async for page in response.iter_pages(): + yield page + + + asyncio.run(main()) + """ + return await self._raw_client.search(query=query, pagination=pagination, request_options=request_options) diff --git a/src/intercom/tickets/raw_client.py b/src/intercom/tickets/raw_client.py new file mode 100644 index 0000000..1a604dc --- /dev/null +++ b/src/intercom/tickets/raw_client.py @@ -0,0 +1,931 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import jsonable_encoder +from ..core.pagination import AsyncPager, BaseHttpResponse, SyncPager +from ..core.request_options import RequestOptions +from ..core.serialization import convert_and_respect_annotation_metadata +from ..core.unchecked_base_model import construct_type +from ..errors.bad_request_error import BadRequestError +from ..errors.not_found_error import NotFoundError +from ..errors.unauthorized_error import UnauthorizedError +from ..types.create_ticket_request_contacts_item import CreateTicketRequestContactsItem +from ..types.error import Error +from ..types.search_request_query import SearchRequestQuery +from ..types.starting_after_paging import StartingAfterPaging +from ..types.ticket_list import TicketList +from ..types.ticket_reply import TicketReply +from ..types.ticket_request_custom_attributes import TicketRequestCustomAttributes +from .types.ticket import Ticket +from .types.tickets_reply_request_body import TicketsReplyRequestBody +from .types.update_ticket_request_assignment import UpdateTicketRequestAssignment +from .types.update_ticket_request_state import UpdateTicketRequestState + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawTicketsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def reply( + self, + ticket_id: str, + *, + request: TicketsReplyRequestBody, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[TicketReply]: + """ + You can reply to a ticket with a message from an admin or on behalf of a contact, or with a note for admins. + + Parameters + ---------- + ticket_id : str + + request : TicketsReplyRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TicketReply] + Admin quick_reply reply + """ + _response = self._client_wrapper.httpx_client.request( + f"tickets/{jsonable_encoder(ticket_id)}/reply", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=TicketsReplyRequestBody, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TicketReply, + construct_type( + type_=TicketReply, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + *, + ticket_type_id: str, + contacts: typing.Sequence[CreateTicketRequestContactsItem], + company_id: typing.Optional[str] = OMIT, + created_at: typing.Optional[int] = OMIT, + ticket_attributes: typing.Optional[TicketRequestCustomAttributes] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[Ticket]: + """ + You can create a new ticket. + + Parameters + ---------- + ticket_type_id : str + The ID of the type of ticket you want to create + + contacts : typing.Sequence[CreateTicketRequestContactsItem] + The list of contacts (users or leads) affected by this ticket. Currently only one is allowed + + company_id : typing.Optional[str] + The ID of the company that the ticket is associated with. The ID that you set upon company creation. + + created_at : typing.Optional[int] + The time the ticket was created. If not provided, the current time will be used. + + ticket_attributes : typing.Optional[TicketRequestCustomAttributes] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Ticket] + Successful response + """ + _response = self._client_wrapper.httpx_client.request( + "tickets", + method="POST", + json={ + "ticket_type_id": ticket_type_id, + "contacts": convert_and_respect_annotation_metadata( + object_=contacts, annotation=typing.Sequence[CreateTicketRequestContactsItem], direction="write" + ), + "company_id": company_id, + "created_at": created_at, + "ticket_attributes": ticket_attributes, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Ticket, + construct_type( + type_=Ticket, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get(self, ticket_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Ticket]: + """ + You can fetch the details of a single ticket. + + Parameters + ---------- + ticket_id : str + The unique identifier for the ticket which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Ticket] + Ticket found + """ + _response = self._client_wrapper.httpx_client.request( + f"tickets/{jsonable_encoder(ticket_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Ticket, + construct_type( + type_=Ticket, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + ticket_id: str, + *, + ticket_attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + state: typing.Optional[UpdateTicketRequestState] = OMIT, + open: typing.Optional[bool] = OMIT, + is_shared: typing.Optional[bool] = OMIT, + snoozed_until: typing.Optional[int] = OMIT, + assignment: typing.Optional[UpdateTicketRequestAssignment] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[Ticket]: + """ + You can update a ticket. + + Parameters + ---------- + ticket_id : str + The unique identifier for the ticket which is given by Intercom + + ticket_attributes : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The attributes set on the ticket. + + state : typing.Optional[UpdateTicketRequestState] + The state of the ticket. + + open : typing.Optional[bool] + Specify if a ticket is open. Set to false to close a ticket. Closing a ticket will also unsnooze it. + + is_shared : typing.Optional[bool] + Specify whether the ticket is visible to users. + + snoozed_until : typing.Optional[int] + The time you want the ticket to reopen. + + assignment : typing.Optional[UpdateTicketRequestAssignment] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Ticket] + Successful response + """ + _response = self._client_wrapper.httpx_client.request( + f"tickets/{jsonable_encoder(ticket_id)}", + method="PUT", + json={ + "ticket_attributes": ticket_attributes, + "state": state, + "open": open, + "is_shared": is_shared, + "snoozed_until": snoozed_until, + "assignment": convert_and_respect_annotation_metadata( + object_=assignment, annotation=UpdateTicketRequestAssignment, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Ticket, + construct_type( + type_=Ticket, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def search( + self, + *, + query: SearchRequestQuery, + pagination: typing.Optional[StartingAfterPaging] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SyncPager[Ticket]: + """ + You can search for multiple tickets by the value of their attributes in order to fetch exactly which ones you want. + + To search for tickets, you send a `POST` request to `https://api.intercom.io/tickets/search`. + + This will accept a query object in the body which will define your filters. + {% admonition type="warning" name="Optimizing search queries" %} + Search queries can be complex, so optimizing them can help the performance of your search. + Use the `AND` and `OR` operators to combine multiple filters to get the exact results you need and utilize + pagination to limit the number of results returned. The default is `20` results per page. + See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#example-search-conversations-request) for more details on how to use the `starting_after` param. + {% /admonition %} + + ### Nesting & Limitations + + You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). + There are some limitations to the amount of multiples there can be: + - There's a limit of max 2 nested filters + - There's a limit of max 15 filters for each AND or OR group + + ### Accepted Fields + + Most keys listed as part of the Ticket model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as `created_at` accepts a date, the `value` cannot be a string such as `"foobar"`). + + | Field | Type | + | :---------------------------------------- | :--------------------------------------------------------------------------------------- | + | id | String | + | created_at | Date (UNIX timestamp) | + | updated_at | Date (UNIX timestamp) | + | _default_title_ | String | + | _default_description_ | String | + | category | String | + | ticket_type_id | String | + | contact_ids | String | + | teammate_ids | String | + | admin_assignee_id | String | + | team_assignee_id | String | + | open | Boolean | + | state | String | + | snoozed_until | Date (UNIX timestamp) | + | ticket_attribute.{id} | String or Boolean or Date (UNIX timestamp) or Float or Integer | + + ### Accepted Operators + + {% admonition type="info" name="Searching based on `created_at`" %} + You may use the `<=` or `>=` operators to search by `created_at`. + {% /admonition %} + + The table below shows the operators you can use to define how you want to search for the value. The operator should be put in as a string (`"="`). The operator has to be compatible with the field's type (eg. you cannot search with `>` for a given string value as it's only compatible for integer's and dates). + + | Operator | Valid Types | Description | + | :------- | :----------------------------- | :----------------------------------------------------------- | + | = | All | Equals | + | != | All | Doesn't Equal | + | IN | All | In Shortcut for `OR` queries Values most be in Array | + | NIN | All | Not In Shortcut for `OR !` queries Values must be in Array | + | > | Integer Date (UNIX Timestamp) | Greater (or equal) than | + | < | Integer Date (UNIX Timestamp) | Lower (or equal) than | + | ~ | String | Contains | + | !~ | String | Doesn't Contain | + | ^ | String | Starts With | + | $ | String | Ends With | + + Parameters + ---------- + query : SearchRequestQuery + + pagination : typing.Optional[StartingAfterPaging] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SyncPager[Ticket] + successful + """ + _response = self._client_wrapper.httpx_client.request( + "tickets/search", + method="POST", + json={ + "query": convert_and_respect_annotation_metadata( + object_=query, annotation=SearchRequestQuery, direction="write" + ), + "pagination": convert_and_respect_annotation_metadata( + object_=pagination, annotation=StartingAfterPaging, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _parsed_response = typing.cast( + TicketList, + construct_type( + type_=TicketList, # type: ignore + object_=_response.json(), + ), + ) + _items = _parsed_response.tickets + _has_next = False + _get_next = None + if _parsed_response.pages is not None and _parsed_response.pages.next is not None: + _parsed_next = _parsed_response.pages.next.starting_after + _has_next = _parsed_next is not None and _parsed_next != "" + _get_next = lambda: self.search( + query=query, + pagination=pagination, + request_options=request_options, + ) + return SyncPager( + has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawTicketsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def reply( + self, + ticket_id: str, + *, + request: TicketsReplyRequestBody, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[TicketReply]: + """ + You can reply to a ticket with a message from an admin or on behalf of a contact, or with a note for admins. + + Parameters + ---------- + ticket_id : str + + request : TicketsReplyRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TicketReply] + Admin quick_reply reply + """ + _response = await self._client_wrapper.httpx_client.request( + f"tickets/{jsonable_encoder(ticket_id)}/reply", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=TicketsReplyRequestBody, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TicketReply, + construct_type( + type_=TicketReply, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + *, + ticket_type_id: str, + contacts: typing.Sequence[CreateTicketRequestContactsItem], + company_id: typing.Optional[str] = OMIT, + created_at: typing.Optional[int] = OMIT, + ticket_attributes: typing.Optional[TicketRequestCustomAttributes] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[Ticket]: + """ + You can create a new ticket. + + Parameters + ---------- + ticket_type_id : str + The ID of the type of ticket you want to create + + contacts : typing.Sequence[CreateTicketRequestContactsItem] + The list of contacts (users or leads) affected by this ticket. Currently only one is allowed + + company_id : typing.Optional[str] + The ID of the company that the ticket is associated with. The ID that you set upon company creation. + + created_at : typing.Optional[int] + The time the ticket was created. If not provided, the current time will be used. + + ticket_attributes : typing.Optional[TicketRequestCustomAttributes] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Ticket] + Successful response + """ + _response = await self._client_wrapper.httpx_client.request( + "tickets", + method="POST", + json={ + "ticket_type_id": ticket_type_id, + "contacts": convert_and_respect_annotation_metadata( + object_=contacts, annotation=typing.Sequence[CreateTicketRequestContactsItem], direction="write" + ), + "company_id": company_id, + "created_at": created_at, + "ticket_attributes": ticket_attributes, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Ticket, + construct_type( + type_=Ticket, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, ticket_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[Ticket]: + """ + You can fetch the details of a single ticket. + + Parameters + ---------- + ticket_id : str + The unique identifier for the ticket which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Ticket] + Ticket found + """ + _response = await self._client_wrapper.httpx_client.request( + f"tickets/{jsonable_encoder(ticket_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Ticket, + construct_type( + type_=Ticket, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + ticket_id: str, + *, + ticket_attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + state: typing.Optional[UpdateTicketRequestState] = OMIT, + open: typing.Optional[bool] = OMIT, + is_shared: typing.Optional[bool] = OMIT, + snoozed_until: typing.Optional[int] = OMIT, + assignment: typing.Optional[UpdateTicketRequestAssignment] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[Ticket]: + """ + You can update a ticket. + + Parameters + ---------- + ticket_id : str + The unique identifier for the ticket which is given by Intercom + + ticket_attributes : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The attributes set on the ticket. + + state : typing.Optional[UpdateTicketRequestState] + The state of the ticket. + + open : typing.Optional[bool] + Specify if a ticket is open. Set to false to close a ticket. Closing a ticket will also unsnooze it. + + is_shared : typing.Optional[bool] + Specify whether the ticket is visible to users. + + snoozed_until : typing.Optional[int] + The time you want the ticket to reopen. + + assignment : typing.Optional[UpdateTicketRequestAssignment] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Ticket] + Successful response + """ + _response = await self._client_wrapper.httpx_client.request( + f"tickets/{jsonable_encoder(ticket_id)}", + method="PUT", + json={ + "ticket_attributes": ticket_attributes, + "state": state, + "open": open, + "is_shared": is_shared, + "snoozed_until": snoozed_until, + "assignment": convert_and_respect_annotation_metadata( + object_=assignment, annotation=UpdateTicketRequestAssignment, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Ticket, + construct_type( + type_=Ticket, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def search( + self, + *, + query: SearchRequestQuery, + pagination: typing.Optional[StartingAfterPaging] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncPager[Ticket]: + """ + You can search for multiple tickets by the value of their attributes in order to fetch exactly which ones you want. + + To search for tickets, you send a `POST` request to `https://api.intercom.io/tickets/search`. + + This will accept a query object in the body which will define your filters. + {% admonition type="warning" name="Optimizing search queries" %} + Search queries can be complex, so optimizing them can help the performance of your search. + Use the `AND` and `OR` operators to combine multiple filters to get the exact results you need and utilize + pagination to limit the number of results returned. The default is `20` results per page. + See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#example-search-conversations-request) for more details on how to use the `starting_after` param. + {% /admonition %} + + ### Nesting & Limitations + + You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). + There are some limitations to the amount of multiples there can be: + - There's a limit of max 2 nested filters + - There's a limit of max 15 filters for each AND or OR group + + ### Accepted Fields + + Most keys listed as part of the Ticket model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as `created_at` accepts a date, the `value` cannot be a string such as `"foobar"`). + + | Field | Type | + | :---------------------------------------- | :--------------------------------------------------------------------------------------- | + | id | String | + | created_at | Date (UNIX timestamp) | + | updated_at | Date (UNIX timestamp) | + | _default_title_ | String | + | _default_description_ | String | + | category | String | + | ticket_type_id | String | + | contact_ids | String | + | teammate_ids | String | + | admin_assignee_id | String | + | team_assignee_id | String | + | open | Boolean | + | state | String | + | snoozed_until | Date (UNIX timestamp) | + | ticket_attribute.{id} | String or Boolean or Date (UNIX timestamp) or Float or Integer | + + ### Accepted Operators + + {% admonition type="info" name="Searching based on `created_at`" %} + You may use the `<=` or `>=` operators to search by `created_at`. + {% /admonition %} + + The table below shows the operators you can use to define how you want to search for the value. The operator should be put in as a string (`"="`). The operator has to be compatible with the field's type (eg. you cannot search with `>` for a given string value as it's only compatible for integer's and dates). + + | Operator | Valid Types | Description | + | :------- | :----------------------------- | :----------------------------------------------------------- | + | = | All | Equals | + | != | All | Doesn't Equal | + | IN | All | In Shortcut for `OR` queries Values most be in Array | + | NIN | All | Not In Shortcut for `OR !` queries Values must be in Array | + | > | Integer Date (UNIX Timestamp) | Greater (or equal) than | + | < | Integer Date (UNIX Timestamp) | Lower (or equal) than | + | ~ | String | Contains | + | !~ | String | Doesn't Contain | + | ^ | String | Starts With | + | $ | String | Ends With | + + Parameters + ---------- + query : SearchRequestQuery + + pagination : typing.Optional[StartingAfterPaging] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncPager[Ticket] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + "tickets/search", + method="POST", + json={ + "query": convert_and_respect_annotation_metadata( + object_=query, annotation=SearchRequestQuery, direction="write" + ), + "pagination": convert_and_respect_annotation_metadata( + object_=pagination, annotation=StartingAfterPaging, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _parsed_response = typing.cast( + TicketList, + construct_type( + type_=TicketList, # type: ignore + object_=_response.json(), + ), + ) + _items = _parsed_response.tickets + _has_next = False + _get_next = None + if _parsed_response.pages is not None and _parsed_response.pages.next is not None: + _parsed_next = _parsed_response.pages.next.starting_after + _has_next = _parsed_next is not None and _parsed_next != "" + + async def _get_next(): + return await self.search( + query=query, + pagination=pagination, + request_options=request_options, + ) + + return AsyncPager( + has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response) + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/intercom/tickets/types/__init__.py b/src/intercom/tickets/types/__init__.py new file mode 100644 index 0000000..c28b527 --- /dev/null +++ b/src/intercom/tickets/types/__init__.py @@ -0,0 +1,31 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .ticket import Ticket +from .ticket_category import TicketCategory +from .ticket_contacts import TicketContacts +from .ticket_part import TicketPart +from .ticket_part_previous_ticket_state import TicketPartPreviousTicketState +from .ticket_part_ticket_state import TicketPartTicketState +from .ticket_ticket_state import TicketTicketState +from .ticket_type import TicketType +from .ticket_type_category import TicketTypeCategory +from .tickets_reply_request_body import TicketsReplyRequestBody +from .update_ticket_request_assignment import UpdateTicketRequestAssignment +from .update_ticket_request_state import UpdateTicketRequestState + +__all__ = [ + "Ticket", + "TicketCategory", + "TicketContacts", + "TicketPart", + "TicketPartPreviousTicketState", + "TicketPartTicketState", + "TicketTicketState", + "TicketType", + "TicketTypeCategory", + "TicketsReplyRequestBody", + "UpdateTicketRequestAssignment", + "UpdateTicketRequestState", +] diff --git a/src/intercom/tickets/types/ticket.py b/src/intercom/tickets/types/ticket.py new file mode 100644 index 0000000..a7e72bb --- /dev/null +++ b/src/intercom/tickets/types/ticket.py @@ -0,0 +1,104 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from ...types.linked_object_list import LinkedObjectList +from ...types.ticket_custom_attributes import TicketCustomAttributes +from ...types.ticket_parts import TicketParts +from .ticket_category import TicketCategory +from .ticket_contacts import TicketContacts +from .ticket_ticket_state import TicketTicketState +from .ticket_type import TicketType + + +class Ticket(UncheckedBaseModel): + """ + Tickets are how you track requests from your users. + """ + + type: typing.Literal["ticket"] = pydantic.Field(default="ticket") + """ + Always ticket + """ + + id: str = pydantic.Field() + """ + The unique identifier for the ticket which is given by Intercom. + """ + + ticket_id: str = pydantic.Field() + """ + The ID of the Ticket used in the Intercom Inbox and Messenger. Do not use ticket_id for API queries. + """ + + category: TicketCategory = pydantic.Field() + """ + Category of the Ticket. + """ + + ticket_attributes: TicketCustomAttributes + ticket_state: TicketTicketState = pydantic.Field() + """ + The state the ticket is currently in + """ + + ticket_type: TicketType + contacts: TicketContacts + admin_assignee_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id representing the admin assigned to the ticket. + """ + + team_assignee_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id representing the team assigned to the ticket. + """ + + created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time the ticket was created as a UTC Unix timestamp. + """ + + updated_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The last time the ticket was updated as a UTC Unix timestamp. + """ + + open: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether or not the ticket is open. If false, the ticket is closed. + """ + + snoozed_until: typing.Optional[int] = pydantic.Field(default=None) + """ + The time the ticket will be snoozed until as a UTC Unix timestamp. If null, the ticket is not currently snoozed. + """ + + linked_objects: typing.Optional[LinkedObjectList] = None + ticket_parts: typing.Optional[TicketParts] = None + is_shared: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether or not the ticket is shared with the customer. + """ + + ticket_state_internal_label: typing.Optional[str] = pydantic.Field(default=None) + """ + The state the ticket is currently in, in a human readable form - visible in Intercom + """ + + ticket_state_external_label: typing.Optional[str] = pydantic.Field(default=None) + """ + The state the ticket is currently in, in a human readable form - visible to customers, in the messenger, email and tickets portal. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/tickets/types/ticket_category.py b/src/intercom/tickets/types/ticket_category.py new file mode 100644 index 0000000..0bfaf71 --- /dev/null +++ b/src/intercom/tickets/types/ticket_category.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TicketCategory = typing.Union[typing.Literal["Customer", "Back-office", "Tracker"], typing.Any] diff --git a/src/intercom/tickets/types/ticket_contacts.py b/src/intercom/tickets/types/ticket_contacts.py new file mode 100644 index 0000000..7a11c16 --- /dev/null +++ b/src/intercom/tickets/types/ticket_contacts.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from ...types.contact_reference import ContactReference + + +class TicketContacts(UncheckedBaseModel): + """ + The list of contacts affected by a ticket. + """ + + type: typing.Literal["contact.list"] = pydantic.Field(default="contact.list") + """ + always contact.list + """ + + contacts: typing.List[ContactReference] = pydantic.Field() + """ + The list of contacts affected by this ticket. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/tickets/types/ticket_part.py b/src/intercom/tickets/types/ticket_part.py new file mode 100644 index 0000000..415a3a4 --- /dev/null +++ b/src/intercom/tickets/types/ticket_part.py @@ -0,0 +1,88 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from ...types.part_attachment import PartAttachment +from ...types.reference import Reference +from ...types.ticket_part_author import TicketPartAuthor +from .ticket_part_previous_ticket_state import TicketPartPreviousTicketState +from .ticket_part_ticket_state import TicketPartTicketState + + +class TicketPart(UncheckedBaseModel): + """ + A Ticket Part represents a message in the ticket. + """ + + type: typing.Literal["ticket_part"] = pydantic.Field(default="ticket_part") + """ + Always ticket_part + """ + + id: str = pydantic.Field() + """ + The id representing the ticket part. + """ + + part_type: str = pydantic.Field() + """ + The type of ticket part. + """ + + body: typing.Optional[str] = pydantic.Field(default=None) + """ + The message body, which may contain HTML. + """ + + previous_ticket_state: typing.Optional[TicketPartPreviousTicketState] = pydantic.Field(default=None) + """ + The previous state of the ticket. + """ + + ticket_state: TicketPartTicketState = pydantic.Field() + """ + The state of the ticket. + """ + + created_at: int = pydantic.Field() + """ + The time the ticket part was created. + """ + + updated_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The last time the ticket part was updated. + """ + + assigned_to: typing.Optional[Reference] = pydantic.Field(default=None) + """ + The id of the admin that was assigned the ticket by this ticket_part (null if there has been no change in assignment.) + """ + + author: typing.Optional[TicketPartAuthor] = None + attachments: typing.Optional[typing.List[PartAttachment]] = pydantic.Field(default=None) + """ + A list of attachments for the part. + """ + + external_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The external id of the ticket part + """ + + redacted: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether or not the ticket part has been redacted. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/tickets/types/ticket_part_previous_ticket_state.py b/src/intercom/tickets/types/ticket_part_previous_ticket_state.py new file mode 100644 index 0000000..650c92d --- /dev/null +++ b/src/intercom/tickets/types/ticket_part_previous_ticket_state.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TicketPartPreviousTicketState = typing.Union[ + typing.Literal["submitted", "in_progress", "waiting_on_customer", "resolved"], typing.Any +] diff --git a/src/intercom/tickets/types/ticket_part_ticket_state.py b/src/intercom/tickets/types/ticket_part_ticket_state.py new file mode 100644 index 0000000..c430063 --- /dev/null +++ b/src/intercom/tickets/types/ticket_part_ticket_state.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TicketPartTicketState = typing.Union[ + typing.Literal["submitted", "in_progress", "waiting_on_customer", "resolved"], typing.Any +] diff --git a/src/intercom/tickets/types/ticket_ticket_state.py b/src/intercom/tickets/types/ticket_ticket_state.py new file mode 100644 index 0000000..0c384dd --- /dev/null +++ b/src/intercom/tickets/types/ticket_ticket_state.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TicketTicketState = typing.Union[ + typing.Literal["submitted", "in_progress", "waiting_on_customer", "resolved"], typing.Any +] diff --git a/src/intercom/tickets/types/ticket_type.py b/src/intercom/tickets/types/ticket_type.py new file mode 100644 index 0000000..6f92762 --- /dev/null +++ b/src/intercom/tickets/types/ticket_type.py @@ -0,0 +1,75 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from ...types.ticket_type_attribute_list import TicketTypeAttributeList +from .ticket_type_category import TicketTypeCategory + + +class TicketType(UncheckedBaseModel): + """ + A ticket type, used to define the data fields to be captured in a ticket. + """ + + type: typing.Literal["ticket_type"] = pydantic.Field(default="ticket_type") + """ + String representing the object's type. Always has the value `ticket_type`. + """ + + id: str = pydantic.Field() + """ + The id representing the ticket type. + """ + + category: TicketTypeCategory = pydantic.Field() + """ + Category of the Ticket Type. + """ + + name: str = pydantic.Field() + """ + The name of the ticket type + """ + + description: str = pydantic.Field() + """ + The description of the ticket type + """ + + icon: str = pydantic.Field() + """ + The icon of the ticket type + """ + + workspace_id: str = pydantic.Field() + """ + The id of the workspace that the ticket type belongs to. + """ + + ticket_type_attributes: TicketTypeAttributeList + archived: bool = pydantic.Field() + """ + Whether the ticket type is archived or not. + """ + + created_at: int = pydantic.Field() + """ + The date and time the ticket type was created. + """ + + updated_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The date and time the ticket type was last updated. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/tickets/types/ticket_type_category.py b/src/intercom/tickets/types/ticket_type_category.py new file mode 100644 index 0000000..afbe5d6 --- /dev/null +++ b/src/intercom/tickets/types/ticket_type_category.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TicketTypeCategory = typing.Union[typing.Literal["Customer", "Back-office", "Tracker"], typing.Any] diff --git a/src/intercom/tickets/types/tickets_reply_request_body.py b/src/intercom/tickets/types/tickets_reply_request_body.py new file mode 100644 index 0000000..4eea13d --- /dev/null +++ b/src/intercom/tickets/types/tickets_reply_request_body.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.admin_reply_ticket_request import AdminReplyTicketRequest +from ...types.contact_reply_ticket_request import ContactReplyTicketRequest + +TicketsReplyRequestBody = typing.Union[ContactReplyTicketRequest, AdminReplyTicketRequest] diff --git a/src/intercom/tickets/types/update_ticket_request_assignment.py b/src/intercom/tickets/types/update_ticket_request_assignment.py new file mode 100644 index 0000000..b088f80 --- /dev/null +++ b/src/intercom/tickets/types/update_ticket_request_assignment.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel + + +class UpdateTicketRequestAssignment(UncheckedBaseModel): + admin_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the admin performing the action. + """ + + assignee_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the admin or team to which the ticket is assigned. Set this 0 to unassign it. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/tickets/types/update_ticket_request_state.py b/src/intercom/tickets/types/update_ticket_request_state.py new file mode 100644 index 0000000..effb50f --- /dev/null +++ b/src/intercom/tickets/types/update_ticket_request_state.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +UpdateTicketRequestState = typing.Union[typing.Literal["in_progress", "waiting_on_customer", "resolved"], typing.Any] diff --git a/src/intercom/types/__init__.py b/src/intercom/types/__init__.py new file mode 100644 index 0000000..6cdd39b --- /dev/null +++ b/src/intercom/types/__init__.py @@ -0,0 +1,508 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .action_component import ActionComponent, ActionComponent_Sheet, ActionComponent_Submit, ActionComponent_Url +from .activity_log import ActivityLog +from .activity_log_activity_type import ActivityLogActivityType +from .activity_log_list import ActivityLogList +from .activity_log_metadata import ActivityLogMetadata +from .activity_log_performed_by import ActivityLogPerformedBy +from .addressable_list import AddressableList +from .admin_list import AdminList +from .admin_priority_level import AdminPriorityLevel +from .admin_reply_conversation_request import AdminReplyConversationRequest +from .admin_reply_conversation_request_message_type import AdminReplyConversationRequestMessageType +from .admin_reply_ticket_request import AdminReplyTicketRequest +from .admin_reply_ticket_request_message_type import AdminReplyTicketRequestMessageType +from .admin_reply_ticket_request_reply_options_item import AdminReplyTicketRequestReplyOptionsItem +from .admin_with_app import AdminWithApp +from .admin_with_app_avatar import AdminWithAppAvatar +from .app import App +from .article_content import ArticleContent +from .article_content_state import ArticleContentState +from .article_list import ArticleList +from .article_statistics import ArticleStatistics +from .article_translated_content import ArticleTranslatedContent +from .assign_conversation_request import AssignConversationRequest +from .assign_conversation_request_type import AssignConversationRequestType +from .button_component import ButtonComponent +from .button_component_style import ButtonComponentStyle +from .canvas_object import CanvasObject +from .checkbox_component import CheckboxComponent +from .checkbox_component_save_state import CheckboxComponentSaveState +from .checkbox_option import CheckboxOption +from .close_conversation_request import CloseConversationRequest +from .collection_list import CollectionList +from .company_attached_contacts import CompanyAttachedContacts +from .company_attached_segments import CompanyAttachedSegments +from .company_list import CompanyList +from .company_scroll import CompanyScroll +from .component import ( + Component, + Component_Button, + Component_Checkbox, + Component_DataTable, + Component_Divider, + Component_Dropdown, + Component_Image, + Component_Input, + Component_List, + Component_SingleSelect, + Component_Spacer, + Component_Text, + Component_Textarea, +) +from .configure_request import ConfigureRequest +from .configure_request_component_id import ConfigureRequestComponentId +from .configure_request_zero import ConfigureRequestZero +from .configure_response import ConfigureResponse +from .configure_response_canvas import ConfigureResponseCanvas +from .contact_archived import ContactArchived +from .contact_attached_companies import ContactAttachedCompanies +from .contact_companies import ContactCompanies +from .contact_company import ContactCompany +from .contact_deleted import ContactDeleted +from .contact_list import ContactList +from .contact_location import ContactLocation +from .contact_notes import ContactNotes +from .contact_reference import ContactReference +from .contact_reply_base_request import ContactReplyBaseRequest +from .contact_reply_conversation_request import ContactReplyConversationRequest +from .contact_reply_email_request import ContactReplyEmailRequest +from .contact_reply_intercom_user_id_request import ContactReplyIntercomUserIdRequest +from .contact_reply_ticket_email_request import ContactReplyTicketEmailRequest +from .contact_reply_ticket_intercom_user_id_request import ContactReplyTicketIntercomUserIdRequest +from .contact_reply_ticket_request import ContactReplyTicketRequest +from .contact_reply_ticket_user_id_request import ContactReplyTicketUserIdRequest +from .contact_reply_user_id_request import ContactReplyUserIdRequest +from .contact_segments import ContactSegments +from .contact_social_profiles import ContactSocialProfiles +from .contact_subscription_types import ContactSubscriptionTypes +from .contact_tags import ContactTags +from .contact_unarchived import ContactUnarchived +from .content_object import ContentObject +from .content_sources_list import ContentSourcesList +from .context import Context +from .context_location import ContextLocation +from .conversation_attachment_files import ConversationAttachmentFiles +from .conversation_contacts import ConversationContacts +from .conversation_first_contact_reply import ConversationFirstContactReply +from .conversation_part import ConversationPart +from .conversation_part_author import ConversationPartAuthor +from .conversation_parts import ConversationParts +from .conversation_rating import ConversationRating +from .conversation_source import ConversationSource +from .conversation_source_type import ConversationSourceType +from .conversation_statistics import ConversationStatistics +from .conversation_teammates import ConversationTeammates +from .create_contact_request import CreateContactRequest +from .create_contact_request_two import CreateContactRequestTwo +from .create_contact_request_with_email import CreateContactRequestWithEmail +from .create_contact_request_with_external_id import CreateContactRequestWithExternalId +from .create_contact_request_with_role import CreateContactRequestWithRole +from .create_data_event_request import CreateDataEventRequest +from .create_data_event_request_two import CreateDataEventRequestTwo +from .create_data_event_request_with_email import CreateDataEventRequestWithEmail +from .create_data_event_request_with_id import CreateDataEventRequestWithId +from .create_data_event_request_with_user_id import CreateDataEventRequestWithUserId +from .create_message_request import CreateMessageRequest, CreateMessageRequest_Email, CreateMessageRequest_Inapp +from .create_message_request_from import CreateMessageRequestFrom +from .create_message_request_three import CreateMessageRequestThree +from .create_message_request_to import CreateMessageRequestTo +from .create_message_request_type import CreateMessageRequestType +from .create_message_request_with_email import CreateMessageRequestWithEmail +from .create_message_request_with_inapp import CreateMessageRequestWithInapp +from .create_or_update_tag_request import CreateOrUpdateTagRequest +from .create_ticket_reply_with_comment_request import CreateTicketReplyWithCommentRequest +from .create_ticket_request import CreateTicketRequest +from .create_ticket_request_contacts_item import CreateTicketRequestContactsItem +from .create_ticket_request_contacts_item_email import CreateTicketRequestContactsItemEmail +from .create_ticket_request_contacts_item_external_id import CreateTicketRequestContactsItemExternalId +from .create_ticket_request_contacts_item_id import CreateTicketRequestContactsItemId +from .current_canvas import CurrentCanvas +from .cursor_pages import CursorPages +from .custom_attributes import CustomAttributes +from .customer_request import CustomerRequest +from .customer_request_email import CustomerRequestEmail +from .customer_request_intercom_user_id import CustomerRequestIntercomUserId +from .customer_request_user_id import CustomerRequestUserId +from .data_attribute_list import DataAttributeList +from .data_event_list import DataEventList +from .data_event_list_pages import DataEventListPages +from .data_event_summary import DataEventSummary +from .data_event_summary_item import DataEventSummaryItem +from .data_export_csv import DataExportCsv +from .data_table_component import DataTableComponent +from .data_table_item import DataTableItem +from .deleted_article_object import DeletedArticleObject +from .deleted_collection_object import DeletedCollectionObject +from .deleted_company_object import DeletedCompanyObject +from .deleted_object import DeletedObject +from .divider_component import DividerComponent +from .dropdown_component import DropdownComponent +from .dropdown_component_save_state import DropdownComponentSaveState +from .dropdown_option import DropdownOption +from .error import Error +from .error_errors_item import ErrorErrorsItem +from .event import Event +from .file_attribute import FileAttribute +from .group_content import GroupContent +from .group_translated_content import GroupTranslatedContent +from .image_component import ImageComponent +from .image_component_align import ImageComponentAlign +from .initialize_request import InitializeRequest +from .initialize_response import InitializeResponse +from .input_component import InputComponent +from .input_component_save_state import InputComponentSaveState +from .linked_object import LinkedObject +from .linked_object_list import LinkedObjectList +from .linked_object_type import LinkedObjectType +from .list_component import ListComponent +from .list_component_items_item import ListComponentItemsItem +from .list_item import ListItem +from .list_item_with_image import ListItemWithImage +from .list_item_without_image import ListItemWithoutImage +from .live_canvas_request import LiveCanvasRequest +from .live_canvas_response import LiveCanvasResponse +from .metadata import Metadata +from .multiple_filter_search_request import MultipleFilterSearchRequest +from .multiple_filter_search_request_operator import MultipleFilterSearchRequestOperator +from .multiple_or_single_filter_search_request import MultipleOrSingleFilterSearchRequest +from .news_item_request import NewsItemRequest +from .news_item_request_state import NewsItemRequestState +from .note_list import NoteList +from .offset_pages import OffsetPages +from .open_conversation_request import OpenConversationRequest +from .pages_link import PagesLink +from .paginated_conversation_response import PaginatedConversationResponse +from .paginated_news_item_response import PaginatedNewsItemResponse +from .paginated_newsfeed_response import PaginatedNewsfeedResponse +from .part_attachment import PartAttachment +from .phone_switch import PhoneSwitch +from .redact_conversation_request import ( + RedactConversationRequest, + RedactConversationRequest_ConversationPart, + RedactConversationRequest_Source, +) +from .redact_conversation_request_conversation_part import RedactConversationRequestConversationPart +from .redact_conversation_request_source import RedactConversationRequestSource +from .reference import Reference +from .reply_conversation_request import ReplyConversationRequest +from .results_response import ResultsResponse +from .search_request import SearchRequest +from .search_request_query import SearchRequestQuery +from .segment_list import SegmentList +from .sheet_action_component import SheetActionComponent +from .single_filter_search_request import SingleFilterSearchRequest +from .single_filter_search_request_operator import SingleFilterSearchRequestOperator +from .single_filter_search_request_value import SingleFilterSearchRequestValue +from .single_select_component import SingleSelectComponent +from .single_select_component_save_state import SingleSelectComponentSaveState +from .single_select_option import SingleSelectOption +from .sla_applied import SlaApplied +from .sla_applied_sla_status import SlaAppliedSlaStatus +from .snooze_conversation_request import SnoozeConversationRequest +from .social_profile import SocialProfile +from .spacer_component import SpacerComponent +from .spacer_component_size import SpacerComponentSize +from .starting_after_paging import StartingAfterPaging +from .submit_action_component import SubmitActionComponent +from .submit_request import SubmitRequest +from .submit_response import SubmitResponse +from .subscription_type_list import SubscriptionTypeList +from .tag_company_request import TagCompanyRequest +from .tag_company_request_companies_item import TagCompanyRequestCompaniesItem +from .tag_list import TagList +from .tag_multiple_users_request import TagMultipleUsersRequest +from .tag_multiple_users_request_users_item import TagMultipleUsersRequestUsersItem +from .tags import Tags +from .team_list import TeamList +from .team_priority_level import TeamPriorityLevel +from .text_area_component import TextAreaComponent +from .text_component import TextComponent +from .text_component_align import TextComponentAlign +from .text_component_style import TextComponentStyle +from .ticket_custom_attributes import TicketCustomAttributes +from .ticket_list import TicketList +from .ticket_part_author import TicketPartAuthor +from .ticket_part_author_type import TicketPartAuthorType +from .ticket_parts import TicketParts +from .ticket_reply import TicketReply +from .ticket_reply_part_type import TicketReplyPartType +from .ticket_request_custom_attributes import TicketRequestCustomAttributes +from .ticket_type_attribute import TicketTypeAttribute +from .ticket_type_attribute_data_type import TicketTypeAttributeDataType +from .ticket_type_attribute_list import TicketTypeAttributeList +from .ticket_type_list import TicketTypeList +from .translation import Translation +from .untag_company_request import UntagCompanyRequest +from .untag_company_request_companies_item import UntagCompanyRequestCompaniesItem +from .update_visitor_request import UpdateVisitorRequest +from .update_visitor_request_one import UpdateVisitorRequestOne +from .update_visitor_request_with_id import UpdateVisitorRequestWithId +from .update_visitor_request_with_user_id import UpdateVisitorRequestWithUserId +from .url_action_component import UrlActionComponent +from .visitor import Visitor +from .visitor_avatar import VisitorAvatar +from .visitor_companies import VisitorCompanies +from .visitor_deleted_object import VisitorDeletedObject +from .visitor_location_data import VisitorLocationData +from .visitor_segments import VisitorSegments +from .visitor_social_profiles import VisitorSocialProfiles +from .visitor_tags import VisitorTags +from .visitor_tags_tags_item import VisitorTagsTagsItem + +__all__ = [ + "ActionComponent", + "ActionComponent_Sheet", + "ActionComponent_Submit", + "ActionComponent_Url", + "ActivityLog", + "ActivityLogActivityType", + "ActivityLogList", + "ActivityLogMetadata", + "ActivityLogPerformedBy", + "AddressableList", + "AdminList", + "AdminPriorityLevel", + "AdminReplyConversationRequest", + "AdminReplyConversationRequestMessageType", + "AdminReplyTicketRequest", + "AdminReplyTicketRequestMessageType", + "AdminReplyTicketRequestReplyOptionsItem", + "AdminWithApp", + "AdminWithAppAvatar", + "App", + "ArticleContent", + "ArticleContentState", + "ArticleList", + "ArticleStatistics", + "ArticleTranslatedContent", + "AssignConversationRequest", + "AssignConversationRequestType", + "ButtonComponent", + "ButtonComponentStyle", + "CanvasObject", + "CheckboxComponent", + "CheckboxComponentSaveState", + "CheckboxOption", + "CloseConversationRequest", + "CollectionList", + "CompanyAttachedContacts", + "CompanyAttachedSegments", + "CompanyList", + "CompanyScroll", + "Component", + "Component_Button", + "Component_Checkbox", + "Component_DataTable", + "Component_Divider", + "Component_Dropdown", + "Component_Image", + "Component_Input", + "Component_List", + "Component_SingleSelect", + "Component_Spacer", + "Component_Text", + "Component_Textarea", + "ConfigureRequest", + "ConfigureRequestComponentId", + "ConfigureRequestZero", + "ConfigureResponse", + "ConfigureResponseCanvas", + "ContactArchived", + "ContactAttachedCompanies", + "ContactCompanies", + "ContactCompany", + "ContactDeleted", + "ContactList", + "ContactLocation", + "ContactNotes", + "ContactReference", + "ContactReplyBaseRequest", + "ContactReplyConversationRequest", + "ContactReplyEmailRequest", + "ContactReplyIntercomUserIdRequest", + "ContactReplyTicketEmailRequest", + "ContactReplyTicketIntercomUserIdRequest", + "ContactReplyTicketRequest", + "ContactReplyTicketUserIdRequest", + "ContactReplyUserIdRequest", + "ContactSegments", + "ContactSocialProfiles", + "ContactSubscriptionTypes", + "ContactTags", + "ContactUnarchived", + "ContentObject", + "ContentSourcesList", + "Context", + "ContextLocation", + "ConversationAttachmentFiles", + "ConversationContacts", + "ConversationFirstContactReply", + "ConversationPart", + "ConversationPartAuthor", + "ConversationParts", + "ConversationRating", + "ConversationSource", + "ConversationSourceType", + "ConversationStatistics", + "ConversationTeammates", + "CreateContactRequest", + "CreateContactRequestTwo", + "CreateContactRequestWithEmail", + "CreateContactRequestWithExternalId", + "CreateContactRequestWithRole", + "CreateDataEventRequest", + "CreateDataEventRequestTwo", + "CreateDataEventRequestWithEmail", + "CreateDataEventRequestWithId", + "CreateDataEventRequestWithUserId", + "CreateMessageRequest", + "CreateMessageRequestFrom", + "CreateMessageRequestThree", + "CreateMessageRequestTo", + "CreateMessageRequestType", + "CreateMessageRequestWithEmail", + "CreateMessageRequestWithInapp", + "CreateMessageRequest_Email", + "CreateMessageRequest_Inapp", + "CreateOrUpdateTagRequest", + "CreateTicketReplyWithCommentRequest", + "CreateTicketRequest", + "CreateTicketRequestContactsItem", + "CreateTicketRequestContactsItemEmail", + "CreateTicketRequestContactsItemExternalId", + "CreateTicketRequestContactsItemId", + "CurrentCanvas", + "CursorPages", + "CustomAttributes", + "CustomerRequest", + "CustomerRequestEmail", + "CustomerRequestIntercomUserId", + "CustomerRequestUserId", + "DataAttributeList", + "DataEventList", + "DataEventListPages", + "DataEventSummary", + "DataEventSummaryItem", + "DataExportCsv", + "DataTableComponent", + "DataTableItem", + "DeletedArticleObject", + "DeletedCollectionObject", + "DeletedCompanyObject", + "DeletedObject", + "DividerComponent", + "DropdownComponent", + "DropdownComponentSaveState", + "DropdownOption", + "Error", + "ErrorErrorsItem", + "Event", + "FileAttribute", + "GroupContent", + "GroupTranslatedContent", + "ImageComponent", + "ImageComponentAlign", + "InitializeRequest", + "InitializeResponse", + "InputComponent", + "InputComponentSaveState", + "LinkedObject", + "LinkedObjectList", + "LinkedObjectType", + "ListComponent", + "ListComponentItemsItem", + "ListItem", + "ListItemWithImage", + "ListItemWithoutImage", + "LiveCanvasRequest", + "LiveCanvasResponse", + "Metadata", + "MultipleFilterSearchRequest", + "MultipleFilterSearchRequestOperator", + "MultipleOrSingleFilterSearchRequest", + "NewsItemRequest", + "NewsItemRequestState", + "NoteList", + "OffsetPages", + "OpenConversationRequest", + "PagesLink", + "PaginatedConversationResponse", + "PaginatedNewsItemResponse", + "PaginatedNewsfeedResponse", + "PartAttachment", + "PhoneSwitch", + "RedactConversationRequest", + "RedactConversationRequestConversationPart", + "RedactConversationRequestSource", + "RedactConversationRequest_ConversationPart", + "RedactConversationRequest_Source", + "Reference", + "ReplyConversationRequest", + "ResultsResponse", + "SearchRequest", + "SearchRequestQuery", + "SegmentList", + "SheetActionComponent", + "SingleFilterSearchRequest", + "SingleFilterSearchRequestOperator", + "SingleFilterSearchRequestValue", + "SingleSelectComponent", + "SingleSelectComponentSaveState", + "SingleSelectOption", + "SlaApplied", + "SlaAppliedSlaStatus", + "SnoozeConversationRequest", + "SocialProfile", + "SpacerComponent", + "SpacerComponentSize", + "StartingAfterPaging", + "SubmitActionComponent", + "SubmitRequest", + "SubmitResponse", + "SubscriptionTypeList", + "TagCompanyRequest", + "TagCompanyRequestCompaniesItem", + "TagList", + "TagMultipleUsersRequest", + "TagMultipleUsersRequestUsersItem", + "Tags", + "TeamList", + "TeamPriorityLevel", + "TextAreaComponent", + "TextComponent", + "TextComponentAlign", + "TextComponentStyle", + "TicketCustomAttributes", + "TicketList", + "TicketPartAuthor", + "TicketPartAuthorType", + "TicketParts", + "TicketReply", + "TicketReplyPartType", + "TicketRequestCustomAttributes", + "TicketTypeAttribute", + "TicketTypeAttributeDataType", + "TicketTypeAttributeList", + "TicketTypeList", + "Translation", + "UntagCompanyRequest", + "UntagCompanyRequestCompaniesItem", + "UpdateVisitorRequest", + "UpdateVisitorRequestOne", + "UpdateVisitorRequestWithId", + "UpdateVisitorRequestWithUserId", + "UrlActionComponent", + "Visitor", + "VisitorAvatar", + "VisitorCompanies", + "VisitorDeletedObject", + "VisitorLocationData", + "VisitorSegments", + "VisitorSocialProfiles", + "VisitorTags", + "VisitorTagsTagsItem", +] diff --git a/src/intercom/types/action_component.py b/src/intercom/types/action_component.py new file mode 100644 index 0000000..ccab028 --- /dev/null +++ b/src/intercom/types/action_component.py @@ -0,0 +1,56 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class ActionComponent_Sheet(UncheckedBaseModel): + type: typing.Literal["sheet"] = "sheet" + url: str + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class ActionComponent_Url(UncheckedBaseModel): + type: typing.Literal["url"] = "url" + url: str + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class ActionComponent_Submit(UncheckedBaseModel): + type: typing.Literal["submit"] = "submit" + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +ActionComponent = typing_extensions.Annotated[ + typing.Union[ActionComponent_Sheet, ActionComponent_Url, ActionComponent_Submit], UnionMetadata(discriminant="type") +] diff --git a/src/intercom/types/activity_log.py b/src/intercom/types/activity_log.py new file mode 100644 index 0000000..7aad54b --- /dev/null +++ b/src/intercom/types/activity_log.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .activity_log_activity_type import ActivityLogActivityType +from .activity_log_metadata import ActivityLogMetadata +from .activity_log_performed_by import ActivityLogPerformedBy + + +class ActivityLog(UncheckedBaseModel): + """ + Activities performed by Admins. + """ + + id: str = pydantic.Field() + """ + The id representing the activity. + """ + + performed_by: ActivityLogPerformedBy = pydantic.Field() + """ + Details about the Admin involved in the activity. + """ + + metadata: typing.Optional[ActivityLogMetadata] = None + created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time the activity was created. + """ + + activity_type: ActivityLogActivityType + activity_description: typing.Optional[str] = pydantic.Field(default=None) + """ + A sentence or two describing the activity. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/activity_log_activity_type.py b/src/intercom/types/activity_log_activity_type.py new file mode 100644 index 0000000..48d6405 --- /dev/null +++ b/src/intercom/types/activity_log_activity_type.py @@ -0,0 +1,76 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ActivityLogActivityType = typing.Union[ + typing.Literal[ + "admin_assignment_limit_change", + "admin_away_mode_change", + "admin_deletion", + "admin_deprovisioned", + "admin_impersonation_end", + "admin_impersonation_start", + "admin_invite_change", + "admin_invite_creation", + "admin_invite_deletion", + "admin_login_failure", + "admin_login_success", + "admin_logout", + "admin_password_reset_request", + "admin_password_reset_success", + "admin_permission_change", + "admin_provisioned", + "admin_two_factor_auth_change", + "admin_unauthorized_sign_in_method", + "app_admin_join", + "app_authentication_method_change", + "app_data_deletion", + "app_data_export", + "app_google_sso_domain_change", + "app_identity_verification_change", + "app_name_change", + "app_outbound_address_change", + "app_package_installation", + "app_package_token_regeneration", + "app_package_uninstallation", + "app_team_creation", + "app_team_deletion", + "app_team_membership_modification", + "app_timezone_change", + "app_webhook_creation", + "app_webhook_deletion", + "articles_in_messenger_enabled_change", + "bulk_delete", + "bulk_export", + "campaign_deletion", + "campaign_state_change", + "conversation_part_deletion", + "conversation_topic_change", + "conversation_topic_creation", + "conversation_topic_deletion", + "help_center_settings_change", + "inbound_conversations_change", + "inbox_access_change", + "message_deletion", + "message_state_change", + "messenger_look_and_feel_change", + "messenger_search_required_change", + "messenger_spaces_change", + "office_hours_change", + "role_change", + "role_creation", + "role_deletion", + "ruleset_activation_title_preview", + "ruleset_creation", + "ruleset_deletion", + "search_browse_enabled_change", + "search_browse_required_change", + "seat_change", + "seat_revoke", + "security_settings_change", + "temporary_expectation_change", + "upfront_email_collection_change", + "welcome_message_change", + ], + typing.Any, +] diff --git a/src/intercom/types/activity_log_list.py b/src/intercom/types/activity_log_list.py new file mode 100644 index 0000000..105a7c0 --- /dev/null +++ b/src/intercom/types/activity_log_list.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .activity_log import ActivityLog +from .cursor_pages import CursorPages + + +class ActivityLogList(UncheckedBaseModel): + """ + A paginated list of activity logs. + """ + + type: typing.Literal["activity_log.list"] = pydantic.Field(default="activity_log.list") + """ + String representing the object's type. Always has the value `activity_log.list`. + """ + + pages: typing.Optional[CursorPages] = None + activity_logs: typing.List[ActivityLog] = pydantic.Field() + """ + An array of activity logs + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/activity_log_metadata.py b/src/intercom/types/activity_log_metadata.py new file mode 100644 index 0000000..8c0d436 --- /dev/null +++ b/src/intercom/types/activity_log_metadata.py @@ -0,0 +1,67 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ActivityLogMetadata(UncheckedBaseModel): + """ + Additional data provided about Admin activity. + """ + + sign_in_method: typing.Optional[str] = pydantic.Field(default=None) + """ + The way the admin signed in. + """ + + external_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The unique identifier for the contact which is provided by the Client. + """ + + away_mode: typing.Optional[bool] = pydantic.Field(default=None) + """ + The away mode status which is set to true when away and false when returned. + """ + + away_status_reason: typing.Optional[str] = pydantic.Field(default=None) + """ + The reason the Admin is away. + """ + + reassign_conversations: typing.Optional[bool] = pydantic.Field(default=None) + """ + Indicates if conversations should be reassigned while an Admin is away. + """ + + source: typing.Optional[str] = pydantic.Field(default=None) + """ + The action that initiated the status change. + """ + + auto_changed: typing.Optional[str] = pydantic.Field(default=None) + """ + Indicates if the status was changed automatically or manually. + """ + + update_by: typing.Optional[int] = pydantic.Field(default=None) + """ + The ID of the Admin who initiated the activity. + """ + + update_by_name: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the Admin who initiated the activity. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/activity_log_performed_by.py b/src/intercom/types/activity_log_performed_by.py new file mode 100644 index 0000000..af8bcf8 --- /dev/null +++ b/src/intercom/types/activity_log_performed_by.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ActivityLogPerformedBy(UncheckedBaseModel): + """ + Details about the Admin involved in the activity. + """ + + type: typing.Optional[typing.Literal["admin"]] = pydantic.Field(default=None) + """ + String representing the object's type. Always has the value `admin`. + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id representing the admin. + """ + + email: typing.Optional[str] = pydantic.Field(default=None) + """ + The email of the admin. + """ + + ip: typing.Optional[str] = pydantic.Field(default=None) + """ + The IP address of the admin. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/addressable_list.py b/src/intercom/types/addressable_list.py new file mode 100644 index 0000000..4ed668e --- /dev/null +++ b/src/intercom/types/addressable_list.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AddressableList(UncheckedBaseModel): + """ + A list used to access other resources from a parent model. + """ + + type: str = pydantic.Field() + """ + The addressable object type + """ + + id: str = pydantic.Field() + """ + The id of the addressable object + """ + + url: str = pydantic.Field() + """ + Url to get more company resources for this contact + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/admin_list.py b/src/intercom/types/admin_list.py new file mode 100644 index 0000000..7ccd717 --- /dev/null +++ b/src/intercom/types/admin_list.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..admins.types.admin import Admin +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AdminList(UncheckedBaseModel): + """ + A list of admins associated with a given workspace. + """ + + type: typing.Literal["admin.list"] = pydantic.Field(default="admin.list") + """ + String representing the object's type. Always has the value `admin.list`. + """ + + admins: typing.List[Admin] = pydantic.Field() + """ + A list of admins associated with a given workspace. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/admin_priority_level.py b/src/intercom/types/admin_priority_level.py new file mode 100644 index 0000000..bf6b5d3 --- /dev/null +++ b/src/intercom/types/admin_priority_level.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AdminPriorityLevel(UncheckedBaseModel): + """ + Admin priority levels for the team + """ + + primary_admin_ids: typing.Optional[typing.List[int]] = pydantic.Field(default=None) + """ + The primary admin ids for the team + """ + + secondary_admin_ids: typing.Optional[typing.List[int]] = pydantic.Field(default=None) + """ + The secondary admin ids for the team + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/admin_reply_conversation_request.py b/src/intercom/types/admin_reply_conversation_request.py new file mode 100644 index 0000000..35451ff --- /dev/null +++ b/src/intercom/types/admin_reply_conversation_request.py @@ -0,0 +1,51 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .admin_reply_conversation_request_message_type import AdminReplyConversationRequestMessageType +from .conversation_attachment_files import ConversationAttachmentFiles + + +class AdminReplyConversationRequest(UncheckedBaseModel): + """ + Payload of the request to reply on behalf of an admin + """ + + message_type: AdminReplyConversationRequestMessageType + type: typing.Literal["admin"] = "admin" + body: typing.Optional[str] = pydantic.Field(default=None) + """ + The text body of the reply. Notes accept some HTML formatting. Must be present for comment and note message types. + """ + + admin_id: str = pydantic.Field() + """ + The id of the admin who is authoring the comment. + """ + + created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time the reply was created. If not provided, the current time will be used. + """ + + attachment_urls: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of image URLs that will be added as attachments. You can include up to 10 URLs. + """ + + attachment_files: typing.Optional[typing.List[ConversationAttachmentFiles]] = pydantic.Field(default=None) + """ + A list of files that will be added as attachments. You can include up to 10 files + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/admin_reply_conversation_request_message_type.py b/src/intercom/types/admin_reply_conversation_request_message_type.py new file mode 100644 index 0000000..de8dd8c --- /dev/null +++ b/src/intercom/types/admin_reply_conversation_request_message_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AdminReplyConversationRequestMessageType = typing.Union[typing.Literal["comment", "note"], typing.Any] diff --git a/src/intercom/types/admin_reply_ticket_request.py b/src/intercom/types/admin_reply_ticket_request.py new file mode 100644 index 0000000..a94ac7a --- /dev/null +++ b/src/intercom/types/admin_reply_ticket_request.py @@ -0,0 +1,51 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .admin_reply_ticket_request_message_type import AdminReplyTicketRequestMessageType +from .admin_reply_ticket_request_reply_options_item import AdminReplyTicketRequestReplyOptionsItem + + +class AdminReplyTicketRequest(UncheckedBaseModel): + """ + Payload of the request to reply on behalf of an admin + """ + + message_type: AdminReplyTicketRequestMessageType + type: typing.Literal["admin"] = "admin" + body: typing.Optional[str] = pydantic.Field(default=None) + """ + The text body of the reply. Notes accept some HTML formatting. Must be present for comment and note message types. + """ + + admin_id: str = pydantic.Field() + """ + The id of the admin who is authoring the comment. + """ + + created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time the reply was created. If not provided, the current time will be used. + """ + + reply_options: typing.Optional[typing.List[AdminReplyTicketRequestReplyOptionsItem]] = pydantic.Field(default=None) + """ + The quick reply options to display. Must be present for quick_reply message types. + """ + + attachment_urls: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of image URLs that will be added as attachments. You can include up to 10 URLs. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/admin_reply_ticket_request_message_type.py b/src/intercom/types/admin_reply_ticket_request_message_type.py new file mode 100644 index 0000000..1fdcf0c --- /dev/null +++ b/src/intercom/types/admin_reply_ticket_request_message_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AdminReplyTicketRequestMessageType = typing.Union[typing.Literal["comment", "note", "quick_reply"], typing.Any] diff --git a/src/intercom/types/admin_reply_ticket_request_reply_options_item.py b/src/intercom/types/admin_reply_ticket_request_reply_options_item.py new file mode 100644 index 0000000..04b828a --- /dev/null +++ b/src/intercom/types/admin_reply_ticket_request_reply_options_item.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AdminReplyTicketRequestReplyOptionsItem(UncheckedBaseModel): + text: str = pydantic.Field() + """ + The text to display in this quick reply option. + """ + + uuid_: typing_extensions.Annotated[str, FieldMetadata(alias="uuid")] = pydantic.Field() + """ + A unique identifier for this quick reply option. This value will be available within the metadata of the comment ticket part that is created when a user clicks on this reply option. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/admin_with_app.py b/src/intercom/types/admin_with_app.py new file mode 100644 index 0000000..a82a150 --- /dev/null +++ b/src/intercom/types/admin_with_app.py @@ -0,0 +1,84 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .admin_with_app_avatar import AdminWithAppAvatar +from .app import App + + +class AdminWithApp(UncheckedBaseModel): + """ + Admins are the teammate accounts that have access to a workspace + """ + + type: typing.Literal["admin"] = pydantic.Field(default="admin") + """ + String representing the object's type. Always has the value `admin`. + """ + + id: str = pydantic.Field() + """ + The id representing the admin. + """ + + name: str = pydantic.Field() + """ + The name of the admin. + """ + + email: str = pydantic.Field() + """ + The email of the admin. + """ + + job_title: str = pydantic.Field() + """ + The job title of the admin. + """ + + away_mode_enabled: bool = pydantic.Field() + """ + Identifies if this admin is currently set in away mode. + """ + + away_mode_reassign: bool = pydantic.Field() + """ + Identifies if this admin is set to automatically reassign new conversations to the apps default inbox. + """ + + has_inbox_seat: bool = pydantic.Field() + """ + Identifies if this admin has a paid inbox seat to restrict/allow features that require them. + """ + + team_ids: typing.List[int] = pydantic.Field() + """ + This is a list of ids of the teams that this admin is part of. + """ + + avatar: typing.Optional[AdminWithAppAvatar] = pydantic.Field(default=None) + """ + This object represents the avatar associated with the admin. + """ + + email_verified: typing.Optional[bool] = pydantic.Field(default=None) + """ + Identifies if this admin's email is verified. + """ + + app: typing.Optional[App] = pydantic.Field(default=None) + """ + App that the admin belongs to. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/admin_with_app_avatar.py b/src/intercom/types/admin_with_app_avatar.py new file mode 100644 index 0000000..48aac24 --- /dev/null +++ b/src/intercom/types/admin_with_app_avatar.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AdminWithAppAvatar(UncheckedBaseModel): + """ + This object represents the avatar associated with the admin. + """ + + type: typing.Optional[typing.Literal["avatar"]] = pydantic.Field(default=None) + """ + This is a string that identifies the type of the object. It will always have the value `avatar`. + """ + + image_url: typing.Optional[str] = pydantic.Field(default=None) + """ + This object represents the avatar associated with the admin. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/app.py b/src/intercom/types/app.py new file mode 100644 index 0000000..36711e9 --- /dev/null +++ b/src/intercom/types/app.py @@ -0,0 +1,57 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class App(UncheckedBaseModel): + """ + App is a workspace on Intercom + """ + + type: str = pydantic.Field() + """ + + """ + + id_code: str = pydantic.Field() + """ + The id of the app. + """ + + name: str = pydantic.Field() + """ + The name of the app. + """ + + region: str = pydantic.Field() + """ + The Intercom region the app is located in. + """ + + timezone: str = pydantic.Field() + """ + The timezone of the region where the app is located. + """ + + created_at: int = pydantic.Field() + """ + When the app was created. + """ + + identity_verification: bool = pydantic.Field() + """ + Whether or not the app uses identity verification. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/article_content.py b/src/intercom/types/article_content.py new file mode 100644 index 0000000..071f3ef --- /dev/null +++ b/src/intercom/types/article_content.py @@ -0,0 +1,68 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .article_content_state import ArticleContentState + + +class ArticleContent(UncheckedBaseModel): + """ + The Content of an Article. + """ + + type: typing.Literal["article_content"] = pydantic.Field(default="article_content") + """ + The type of object - `article_content` . + """ + + title: str = pydantic.Field() + """ + The title of the article. + """ + + description: str = pydantic.Field() + """ + The description of the article. + """ + + body: str = pydantic.Field() + """ + The body of the article. + """ + + author_id: int = pydantic.Field() + """ + The ID of the author of the article. + """ + + state: ArticleContentState = pydantic.Field() + """ + Whether the article is `published` or is a `draft` . + """ + + created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time when the article was created (seconds). + """ + + updated_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time when the article was last updated (seconds). + """ + + url: typing.Optional[str] = pydantic.Field(default=None) + """ + The URL of the article. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/article_content_state.py b/src/intercom/types/article_content_state.py new file mode 100644 index 0000000..8fbede3 --- /dev/null +++ b/src/intercom/types/article_content_state.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ArticleContentState = typing.Union[typing.Literal["published", "draft"], typing.Any] diff --git a/src/intercom/types/article_list.py b/src/intercom/types/article_list.py new file mode 100644 index 0000000..00943b9 --- /dev/null +++ b/src/intercom/types/article_list.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..articles.types.article_list_item import ArticleListItem +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ArticleList(UncheckedBaseModel): + """ + This will return a list of articles for the App. + """ + + type: typing.Literal["list"] = pydantic.Field(default="list") + """ + The type of the object - `list`. + """ + + pages: typing.Optional[typing.Optional[typing.Any]] = None + total_count: int = pydantic.Field() + """ + A count of the total number of articles. + """ + + data: typing.List[ArticleListItem] = pydantic.Field() + """ + An array of Article objects + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/article_statistics.py b/src/intercom/types/article_statistics.py new file mode 100644 index 0000000..42009ab --- /dev/null +++ b/src/intercom/types/article_statistics.py @@ -0,0 +1,57 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ArticleStatistics(UncheckedBaseModel): + """ + The statistics of an article. + """ + + type: typing.Literal["article_statistics"] = pydantic.Field(default="article_statistics") + """ + The type of object - `article_statistics`. + """ + + views: int = pydantic.Field() + """ + The number of total views the article has received. + """ + + conversions: typing.Optional[int] = pydantic.Field(default=None) + """ + The number of conversations started from the article. + """ + + reactions: int = pydantic.Field() + """ + The number of total reactions the article has received. + """ + + happy_reaction_percentage: float = pydantic.Field() + """ + The percentage of happy reactions the article has received against other types of reaction. + """ + + neutral_reaction_percentage: float = pydantic.Field() + """ + The percentage of neutral reactions the article has received against other types of reaction. + """ + + sad_reaction_percentage: float = pydantic.Field() + """ + The percentage of sad reactions the article has received against other types of reaction. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/article_translated_content.py b/src/intercom/types/article_translated_content.py new file mode 100644 index 0000000..acf5968 --- /dev/null +++ b/src/intercom/types/article_translated_content.py @@ -0,0 +1,221 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .article_content import ArticleContent + + +class ArticleTranslatedContent(UncheckedBaseModel): + """ + The Translated Content of an Article. The keys are the locale codes and the values are the translated content of the article. + """ + + type: typing.Optional[typing.Literal["article_translated_content"]] = pydantic.Field(default=None) + """ + The type of object - article_translated_content. + """ + + ar: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Arabic + """ + + bg: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Bulgarian + """ + + bs: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Bosnian + """ + + ca: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Catalan + """ + + cs: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Czech + """ + + da: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Danish + """ + + de: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in German + """ + + el: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Greek + """ + + en: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in English + """ + + es: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Spanish + """ + + et: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Estonian + """ + + fi: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Finnish + """ + + fr: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in French + """ + + he: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Hebrew + """ + + hr: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Croatian + """ + + hu: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Hungarian + """ + + id: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Indonesian + """ + + it: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Italian + """ + + ja: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Japanese + """ + + ko: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Korean + """ + + lt: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Lithuanian + """ + + lv: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Latvian + """ + + mn: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Mongolian + """ + + nb: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Norwegian + """ + + nl: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Dutch + """ + + pl: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Polish + """ + + pt: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Portuguese (Portugal) + """ + + ro: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Romanian + """ + + ru: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Russian + """ + + sl: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Slovenian + """ + + sr: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Serbian + """ + + sv: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Swedish + """ + + tr: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Turkish + """ + + vi: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Vietnamese + """ + + pt_br: typing_extensions.Annotated[typing.Optional[ArticleContent], FieldMetadata(alias="pt-BR")] = pydantic.Field( + default=None + ) + """ + The content of the article in Portuguese (Brazil) + """ + + zh_cn: typing_extensions.Annotated[typing.Optional[ArticleContent], FieldMetadata(alias="zh-CN")] = pydantic.Field( + default=None + ) + """ + The content of the article in Chinese (China) + """ + + zh_tw: typing_extensions.Annotated[typing.Optional[ArticleContent], FieldMetadata(alias="zh-TW")] = pydantic.Field( + default=None + ) + """ + The content of the article in Chinese (Taiwan) + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/assign_conversation_request.py b/src/intercom/types/assign_conversation_request.py new file mode 100644 index 0000000..1f91611 --- /dev/null +++ b/src/intercom/types/assign_conversation_request.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .assign_conversation_request_type import AssignConversationRequestType + + +class AssignConversationRequest(UncheckedBaseModel): + """ + Payload of the request to assign a conversation + """ + + type: AssignConversationRequestType + admin_id: str = pydantic.Field() + """ + The id of the admin who is performing the action. + """ + + assignee_id: str = pydantic.Field() + """ + The `id` of the `admin` or `team` which will be assigned the conversation. A conversation can be assigned both an admin and a team.\nSet `0` if you want this assign to no admin or team (ie. Unassigned). + """ + + body: typing.Optional[str] = pydantic.Field(default=None) + """ + Optionally you can send a response in the conversation when it is assigned. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/assign_conversation_request_type.py b/src/intercom/types/assign_conversation_request_type.py new file mode 100644 index 0000000..08756b6 --- /dev/null +++ b/src/intercom/types/assign_conversation_request_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AssignConversationRequestType = typing.Union[typing.Literal["admin", "team"], typing.Any] diff --git a/src/intercom/types/button_component.py b/src/intercom/types/button_component.py new file mode 100644 index 0000000..e5ca43e --- /dev/null +++ b/src/intercom/types/button_component.py @@ -0,0 +1,52 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .action_component import ActionComponent +from .button_component_style import ButtonComponentStyle + + +class ButtonComponent(UncheckedBaseModel): + """ + A button component is used to take an action by clicking a button. This can either: + - [Trigger a submit request to be sent](https://developers.intercom.com/docs/references/canvas-kit/actioncomponents/submit-action) Inbox Messenger + - [Open a link in a new page](https://developers.intercom.com/docs/references/canvas-kit/actioncomponents/url-action) Inbox Messenger + - [Open a sheet](https://developers.intercom.com/docs/references/canvas-kit/actioncomponents/sheets-action) Messenger + """ + + id: str = pydantic.Field() + """ + A unique identifier for the component. + """ + + label: str = pydantic.Field() + """ + The text that will be rendered inside the button. + """ + + action: ActionComponent = pydantic.Field() + """ + This can be a Submit Action, URL Action, or Sheets Action. + """ + + style: typing.Optional[ButtonComponentStyle] = pydantic.Field(default=None) + """ + Styles the button. Default is 'primary'. + """ + + disabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Styles the button and prevents the action. Default is false. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/button_component_style.py b/src/intercom/types/button_component_style.py new file mode 100644 index 0000000..ea9ad49 --- /dev/null +++ b/src/intercom/types/button_component_style.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ButtonComponentStyle = typing.Union[typing.Literal["primary", "secondary", "link"], typing.Any] diff --git a/src/intercom/types/canvas_object.py b/src/intercom/types/canvas_object.py new file mode 100644 index 0000000..b3f3b74 --- /dev/null +++ b/src/intercom/types/canvas_object.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .content_object import ContentObject + + +class CanvasObject(UncheckedBaseModel): + """ + You have to respond to the majority of requests with a canvas object. This will tell us what UI to show for your app. + + A canvas can either be static (meaning we send you the next request only when an action takes place) or live (meaning we send you the next request when someone views the app). + + - A static canvas needs a ContentObject which will contain the components to show. + - A live canvas needs a `content_url` which we we will make the Live Canvas requests to when the app is viewed. This is only possible for apps viewed or used in the Messenger. + """ + + content: ContentObject = pydantic.Field() + """ + The content object that will be shown as the UI of the app. Max Size is 64KB. + """ + + content_url: typing.Optional[str] = pydantic.Field(default=None) + """ + The URL which we make Live Canvas requests to. You must respond to these with a content object. Max size is 64KB. + """ + + stored_data: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + """ + Optional Stored Data that you want to be returned in the next sent request. Max Size is 64KB. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/checkbox_component.py b/src/intercom/types/checkbox_component.py new file mode 100644 index 0000000..1c98f18 --- /dev/null +++ b/src/intercom/types/checkbox_component.py @@ -0,0 +1,58 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .checkbox_component_save_state import CheckboxComponentSaveState +from .checkbox_option import CheckboxOption + + +class CheckboxComponent(UncheckedBaseModel): + """ + A checkbox component is used to capture multiple choices from as many options as you want to provide. You can submit the options by: + + - Using a ButtonComponent (which will submit all interactive components in the canvas) + + When a submit action takes place, the results are given in a hash with the `id` from the checkbox component used as the key and an array containing the `id` of each chosen option as the value. + """ + + id: str = pydantic.Field() + """ + A unique identifier for the component. + """ + + option: typing.List[CheckboxOption] = pydantic.Field() + """ + The list of options. Minimum of 1. + """ + + label: str = pydantic.Field() + """ + The text shown above the options. + """ + + value: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + The option's that are selected by default. + """ + + save_state: typing.Optional[CheckboxComponentSaveState] = pydantic.Field(default=None) + """ + Styles the input. Default is `unsaved`. Prevent action with `saved`. + """ + + disabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Styles all options and prevents the action. Default is false. Will be overridden if save_state is saved. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/checkbox_component_save_state.py b/src/intercom/types/checkbox_component_save_state.py new file mode 100644 index 0000000..33ed701 --- /dev/null +++ b/src/intercom/types/checkbox_component_save_state.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CheckboxComponentSaveState = typing.Union[typing.Literal["unsaved", "saved", "failed"], typing.Any] diff --git a/src/intercom/types/checkbox_option.py b/src/intercom/types/checkbox_option.py new file mode 100644 index 0000000..edc6c9b --- /dev/null +++ b/src/intercom/types/checkbox_option.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CheckboxOption(UncheckedBaseModel): + """ + A checkbox option component that can be selected. + """ + + type: typing.Literal["option"] = pydantic.Field(default="option") + """ + The type of component you are rendering. + """ + + id: str = pydantic.Field() + """ + A unique identifier for the option. + """ + + text: str = pydantic.Field() + """ + The text shown next to the checkbox. + """ + + disabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Styles the option and prevents the action. Default is false. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/close_conversation_request.py b/src/intercom/types/close_conversation_request.py new file mode 100644 index 0000000..07d5c94 --- /dev/null +++ b/src/intercom/types/close_conversation_request.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CloseConversationRequest(UncheckedBaseModel): + """ + Payload of the request to close a conversation + """ + + type: typing.Literal["admin"] = "admin" + admin_id: str = pydantic.Field() + """ + The id of the admin who is performing the action. + """ + + body: typing.Optional[str] = pydantic.Field(default=None) + """ + Optionally you can leave a message in the conversation to provide additional context to the user and other teammates. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/collection_list.py b/src/intercom/types/collection_list.py new file mode 100644 index 0000000..7dafac2 --- /dev/null +++ b/src/intercom/types/collection_list.py @@ -0,0 +1,40 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from ..help_center.types.collection import Collection +from .offset_pages import OffsetPages + + +class CollectionList(UncheckedBaseModel): + """ + This will return a list of Collections for the App. + """ + + type: typing.Literal["list"] = pydantic.Field(default="list") + """ + The type of the object - `list`. + """ + + pages: typing.Optional[OffsetPages] = None + total_count: int = pydantic.Field() + """ + A count of the total number of collections. + """ + + data: typing.List[Collection] = pydantic.Field() + """ + An array of collection objects + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/company_attached_contacts.py b/src/intercom/types/company_attached_contacts.py new file mode 100644 index 0000000..8240704 --- /dev/null +++ b/src/intercom/types/company_attached_contacts.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..contacts.types.contact import Contact +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .cursor_pages import CursorPages + + +class CompanyAttachedContacts(UncheckedBaseModel): + """ + A list of Contact Objects + """ + + type: typing.Literal["list"] = pydantic.Field(default="list") + """ + The type of object - `list` + """ + + data: typing.List[Contact] = pydantic.Field() + """ + An array containing Contact Objects + """ + + total_count: int = pydantic.Field() + """ + The total number of contacts + """ + + pages: typing.Optional[CursorPages] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/company_attached_segments.py b/src/intercom/types/company_attached_segments.py new file mode 100644 index 0000000..c0a3439 --- /dev/null +++ b/src/intercom/types/company_attached_segments.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from ..segments.types.segment import Segment + + +class CompanyAttachedSegments(UncheckedBaseModel): + """ + A list of Segment Objects + """ + + type: typing.Literal["list"] = pydantic.Field(default="list") + """ + The type of object - `list` + """ + + data: typing.List[Segment] = pydantic.Field() + """ + An array containing Segment Objects + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/company_list.py b/src/intercom/types/company_list.py new file mode 100644 index 0000000..7a67bad --- /dev/null +++ b/src/intercom/types/company_list.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..companies.types.company import Company +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .offset_pages import OffsetPages + + +class CompanyList(UncheckedBaseModel): + """ + This will return a list of companies for the App. + """ + + pages: typing.Optional[OffsetPages] = None + total_count: int = pydantic.Field() + """ + The total number of companies. + """ + + data: typing.List[Company] = pydantic.Field() + """ + An array containing Company Objects. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/company_scroll.py b/src/intercom/types/company_scroll.py new file mode 100644 index 0000000..72fd10e --- /dev/null +++ b/src/intercom/types/company_scroll.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..companies.types.company import Company +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .cursor_pages import CursorPages + + +class CompanyScroll(UncheckedBaseModel): + """ + Companies allow you to represent organizations using your product. Each company will have its own description and be associated with contacts. You can fetch, create, update and list companies. + """ + + type: typing.Literal["list"] = pydantic.Field(default="list") + """ + The type of object - `list` + """ + + data: typing.List[Company] + pages: typing.Optional[CursorPages] = None + total_count: typing.Optional[int] = pydantic.Field(default=None) + """ + The total number of companies + """ + + scroll_param: typing.Optional[str] = pydantic.Field(default=None) + """ + The scroll parameter to use in the next request to fetch the next page of results. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/component.py b/src/intercom/types/component.py new file mode 100644 index 0000000..4c9f1ad --- /dev/null +++ b/src/intercom/types/component.py @@ -0,0 +1,258 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .action_component import ActionComponent +from .button_component_style import ButtonComponentStyle +from .checkbox_component_save_state import CheckboxComponentSaveState +from .checkbox_option import CheckboxOption +from .data_table_item import DataTableItem +from .dropdown_component_save_state import DropdownComponentSaveState +from .dropdown_option import DropdownOption +from .image_component_align import ImageComponentAlign +from .input_component_save_state import InputComponentSaveState +from .list_component_items_item import ListComponentItemsItem +from .single_select_component_save_state import SingleSelectComponentSaveState +from .single_select_option import SingleSelectOption +from .spacer_component_size import SpacerComponentSize +from .text_component_align import TextComponentAlign +from .text_component_style import TextComponentStyle +from .url_action_component import UrlActionComponent + + +class Component_Button(UncheckedBaseModel): + type: typing.Literal["button"] = "button" + id: str + label: str + action: ActionComponent + style: typing.Optional[ButtonComponentStyle] = None + disabled: typing.Optional[bool] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class Component_Checkbox(UncheckedBaseModel): + type: typing.Literal["checkbox"] = "checkbox" + id: str + option: typing.List[CheckboxOption] + label: str + value: typing.Optional[typing.List[str]] = None + save_state: typing.Optional[CheckboxComponentSaveState] = None + disabled: typing.Optional[bool] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class Component_Dropdown(UncheckedBaseModel): + type: typing.Literal["dropdown"] = "dropdown" + id: str + options: typing.List[DropdownOption] + label: typing.Optional[str] = None + value: typing.Optional[str] = None + save_state: typing.Optional[DropdownComponentSaveState] = None + disabled: typing.Optional[bool] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class Component_Input(UncheckedBaseModel): + type: typing.Literal["input"] = "input" + id: str + label: typing.Optional[str] = None + placeholder: typing.Optional[str] = None + value: typing.Optional[str] = None + action: typing.Optional[ActionComponent] = None + save_state: typing.Optional[InputComponentSaveState] = None + disabled: typing.Optional[bool] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class Component_List(UncheckedBaseModel): + type: typing.Literal["list"] = "list" + items: typing.List[ListComponentItemsItem] + disabled: typing.Optional[bool] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class Component_SingleSelect(UncheckedBaseModel): + type: typing.Literal["single-select"] = "single-select" + id: str + options: typing.List[SingleSelectOption] + label: typing.Optional[str] = None + value: typing.Optional[str] = None + save_state: typing.Optional[SingleSelectComponentSaveState] = None + disabled: typing.Optional[bool] = None + action: typing.Optional[ActionComponent] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class Component_Textarea(UncheckedBaseModel): + type: typing.Literal["textarea"] = "textarea" + id: str + label: typing.Optional[str] = None + placeholder: typing.Optional[str] = None + value: typing.Optional[str] = None + error: typing.Optional[bool] = None + disabled: typing.Optional[bool] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class Component_DataTable(UncheckedBaseModel): + type: typing.Literal["data-table"] = "data-table" + items: typing.List[DataTableItem] + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class Component_Divider(UncheckedBaseModel): + type: typing.Literal["divider"] = "divider" + id: typing.Optional[str] = None + bottom_margin: typing.Optional[typing.Literal["none"]] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class Component_Image(UncheckedBaseModel): + type: typing.Literal["image"] = "image" + id: typing.Optional[str] = None + url: str + align: typing.Optional[ImageComponentAlign] = None + width: int + height: int + rounded: typing.Optional[bool] = None + bottom_margin: typing.Optional[typing.Literal["none"]] = None + action: typing.Optional[UrlActionComponent] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class Component_Spacer(UncheckedBaseModel): + type: typing.Literal["spacer"] = "spacer" + id: typing.Optional[str] = None + size: typing.Optional[SpacerComponentSize] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class Component_Text(UncheckedBaseModel): + type: typing.Literal["text"] = "text" + id: typing.Optional[str] = None + text: str + align: typing.Optional[TextComponentAlign] = None + style: typing.Optional[TextComponentStyle] = None + bottom_margin: typing.Optional[typing.Literal["none"]] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +Component = typing_extensions.Annotated[ + typing.Union[ + Component_Button, + Component_Checkbox, + Component_Dropdown, + Component_Input, + Component_List, + Component_SingleSelect, + Component_Textarea, + Component_DataTable, + Component_Divider, + Component_Image, + Component_Spacer, + Component_Text, + ], + UnionMetadata(discriminant="type"), +] diff --git a/src/intercom/types/configure_request.py b/src/intercom/types/configure_request.py new file mode 100644 index 0000000..ff26b90 --- /dev/null +++ b/src/intercom/types/configure_request.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .configure_request_component_id import ConfigureRequestComponentId +from .configure_request_zero import ConfigureRequestZero + +ConfigureRequest = typing.Union[ConfigureRequestZero, ConfigureRequestComponentId] diff --git a/src/intercom/types/configure_request_component_id.py b/src/intercom/types/configure_request_component_id.py new file mode 100644 index 0000000..ccd2a11 --- /dev/null +++ b/src/intercom/types/configure_request_component_id.py @@ -0,0 +1,56 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..admins.types.admin import Admin +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .canvas_object import CanvasObject +from .context import Context + + +class ConfigureRequestComponentId(UncheckedBaseModel): + workspace_id: str = pydantic.Field() + """ + The workspace ID of the teammate. Attribute is app_id for V1.2 and below. + """ + + workspace_region: str = pydantic.Field() + """ + The Intercom hosted region that this app is located in. + """ + + component_id: str = pydantic.Field() + """ + The id of the component clicked by the teammate to trigger the request. + """ + + admin: Admin = pydantic.Field() + """ + The Intercom teammate configuring the app. + """ + + context: Context = pydantic.Field() + """ + The context of where the app is added, where the user last visited, and information on the Messenger settings. + """ + + current_canvas: CanvasObject = pydantic.Field() + """ + The current canvas the teammate can see. + """ + + input_values: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + """ + A list of key/value pairs of data, inputted by the teammate on the current canvas. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/configure_request_zero.py b/src/intercom/types/configure_request_zero.py new file mode 100644 index 0000000..46bef93 --- /dev/null +++ b/src/intercom/types/configure_request_zero.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..admins.types.admin import Admin +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .context import Context + + +class ConfigureRequestZero(UncheckedBaseModel): + workspace_id: str = pydantic.Field() + """ + The workspace ID of the teammate. Attribute is app_id for V1.2 and below. + """ + + admin: Admin = pydantic.Field() + """ + The Intercom teammate configuring the app. + """ + + context: Context = pydantic.Field() + """ + The context of where the app is added, where the user last visited, and information on the Messenger settings. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/configure_response.py b/src/intercom/types/configure_response.py new file mode 100644 index 0000000..1f812a1 --- /dev/null +++ b/src/intercom/types/configure_response.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .configure_response_canvas import ConfigureResponseCanvas +from .results_response import ResultsResponse + +ConfigureResponse = typing.Union[ResultsResponse, ConfigureResponseCanvas] diff --git a/src/intercom/types/configure_response_canvas.py b/src/intercom/types/configure_response_canvas.py new file mode 100644 index 0000000..ee41462 --- /dev/null +++ b/src/intercom/types/configure_response_canvas.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .canvas_object import CanvasObject + + +class ConfigureResponseCanvas(UncheckedBaseModel): + canvas: CanvasObject = pydantic.Field() + """ + The canvas object that defines the new UI to be shown. This will replace the previous canvas that was visible until the teammate interacted with your app. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/contact_archived.py b/src/intercom/types/contact_archived.py new file mode 100644 index 0000000..8430ed0 --- /dev/null +++ b/src/intercom/types/contact_archived.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ContactArchived(UncheckedBaseModel): + """ + archived contact object + """ + + type: typing.Literal["contact"] = pydantic.Field(default="contact") + """ + always contact + """ + + id: str = pydantic.Field() + """ + The unique identifier for the contact which is given by Intercom. + """ + + external_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The unique identifier for the contact which is provided by the Client. + """ + + archived: bool = pydantic.Field() + """ + Whether the contact is archived or not. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/contact_attached_companies.py b/src/intercom/types/contact_attached_companies.py new file mode 100644 index 0000000..94c093f --- /dev/null +++ b/src/intercom/types/contact_attached_companies.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..companies.types.company import Company +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .pages_link import PagesLink + + +class ContactAttachedCompanies(UncheckedBaseModel): + """ + A list of Company Objects + """ + + type: typing.Literal["list"] = pydantic.Field(default="list") + """ + The type of object + """ + + companies: typing.List[Company] = pydantic.Field() + """ + An array containing Company Objects + """ + + total_count: int = pydantic.Field() + """ + The total number of companies associated to this contact + """ + + pages: typing.Optional[PagesLink] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/contact_companies.py b/src/intercom/types/contact_companies.py new file mode 100644 index 0000000..79ddfcb --- /dev/null +++ b/src/intercom/types/contact_companies.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .contact_company import ContactCompany + + +class ContactCompanies(UncheckedBaseModel): + """ + An object containing companies meta data about the companies that a contact has. Up to 10 will be displayed here. Use the url to get more. + """ + + type: typing.Optional[typing.Literal["list"]] = pydantic.Field(default=None) + """ + The type of object + """ + + data: typing.Optional[typing.List[ContactCompany]] = pydantic.Field(default=None) + """ + An array containing Company Objects + """ + + url: str = pydantic.Field() + """ + Url to get more company resources for this contact + """ + + total_count: int = pydantic.Field() + """ + Int representing the total number of companyies attached to this contact + """ + + has_more: bool = pydantic.Field() + """ + Whether there's more Addressable Objects to be viewed. If true, use the url to view all + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/contact_company.py b/src/intercom/types/contact_company.py new file mode 100644 index 0000000..bd60d28 --- /dev/null +++ b/src/intercom/types/contact_company.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ContactCompany(UncheckedBaseModel): + """ + A reference to a company associated with a contact + """ + + id: str = pydantic.Field() + """ + The unique identifier for the company + """ + + type: typing.Literal["company"] = pydantic.Field(default="company") + """ + The type of the object + """ + + url: str = pydantic.Field() + """ + URL to get the full company resource + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/contact_deleted.py b/src/intercom/types/contact_deleted.py new file mode 100644 index 0000000..f6e6c80 --- /dev/null +++ b/src/intercom/types/contact_deleted.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ContactDeleted(UncheckedBaseModel): + """ + deleted contact object + """ + + type: typing.Literal["contact"] = pydantic.Field(default="contact") + """ + always contact + """ + + id: str = pydantic.Field() + """ + The unique identifier for the contact which is given by Intercom. + """ + + external_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The unique identifier for the contact which is provided by the Client. + """ + + deleted: bool = pydantic.Field() + """ + Whether the contact is deleted or not. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/contact_list.py b/src/intercom/types/contact_list.py new file mode 100644 index 0000000..867f09f --- /dev/null +++ b/src/intercom/types/contact_list.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..contacts.types.contact import Contact +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .cursor_pages import CursorPages + + +class ContactList(UncheckedBaseModel): + """ + Contacts are your users in Intercom. + """ + + type: typing.Literal["list"] = pydantic.Field(default="list") + """ + Always list + """ + + data: typing.List[Contact] = pydantic.Field() + """ + The list of contact objects + """ + + total_count: int = pydantic.Field() + """ + A count of the total number of objects. + """ + + pages: typing.Optional[CursorPages] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/contact_location.py b/src/intercom/types/contact_location.py new file mode 100644 index 0000000..0866784 --- /dev/null +++ b/src/intercom/types/contact_location.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ContactLocation(UncheckedBaseModel): + """ + An object containing location meta data about a Intercom contact. + """ + + type: typing.Literal["location"] = pydantic.Field(default="location") + """ + Always location + """ + + country: typing.Optional[str] = pydantic.Field(default=None) + """ + The country that the contact is located in + """ + + region: typing.Optional[str] = pydantic.Field(default=None) + """ + The overal region that the contact is located in + """ + + city: typing.Optional[str] = pydantic.Field(default=None) + """ + The city that the contact is located in + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/contact_notes.py b/src/intercom/types/contact_notes.py new file mode 100644 index 0000000..9cf498f --- /dev/null +++ b/src/intercom/types/contact_notes.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .addressable_list import AddressableList + + +class ContactNotes(UncheckedBaseModel): + """ + An object containing notes meta data about the notes that a contact has. Up to 10 will be displayed here. Use the url to get more. + """ + + data: typing.List[AddressableList] = pydantic.Field() + """ + This object represents the notes attached to a contact. + """ + + url: str = pydantic.Field() + """ + Url to get more company resources for this contact + """ + + total_count: int = pydantic.Field() + """ + Int representing the total number of companyies attached to this contact + """ + + has_more: bool = pydantic.Field() + """ + Whether there's more Addressable Objects to be viewed. If true, use the url to view all + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/contact_reference.py b/src/intercom/types/contact_reference.py new file mode 100644 index 0000000..e5502fe --- /dev/null +++ b/src/intercom/types/contact_reference.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ContactReference(UncheckedBaseModel): + """ + reference to contact object + """ + + type: typing.Literal["contact"] = pydantic.Field(default="contact") + """ + always contact + """ + + id: str = pydantic.Field() + """ + The unique identifier for the contact which is given by Intercom. + """ + + external_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The unique identifier for the contact which is provided by the Client. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/contact_reply_base_request.py b/src/intercom/types/contact_reply_base_request.py new file mode 100644 index 0000000..49d6df9 --- /dev/null +++ b/src/intercom/types/contact_reply_base_request.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ContactReplyBaseRequest(UncheckedBaseModel): + message_type: typing.Literal["comment"] = "comment" + type: typing.Literal["user"] = "user" + body: str = pydantic.Field() + """ + The text body of the comment. + """ + + created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time the reply was created. If not provided, the current time will be used. + """ + + attachment_urls: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of image URLs that will be added as attachments. You can include up to 10 URLs. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/contact_reply_conversation_request.py b/src/intercom/types/contact_reply_conversation_request.py new file mode 100644 index 0000000..7803e41 --- /dev/null +++ b/src/intercom/types/contact_reply_conversation_request.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .contact_reply_email_request import ContactReplyEmailRequest +from .contact_reply_intercom_user_id_request import ContactReplyIntercomUserIdRequest +from .contact_reply_user_id_request import ContactReplyUserIdRequest + +ContactReplyConversationRequest = typing.Union[ + ContactReplyIntercomUserIdRequest, ContactReplyEmailRequest, ContactReplyUserIdRequest +] diff --git a/src/intercom/types/contact_reply_email_request.py b/src/intercom/types/contact_reply_email_request.py new file mode 100644 index 0000000..c3290d4 --- /dev/null +++ b/src/intercom/types/contact_reply_email_request.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from .contact_reply_base_request import ContactReplyBaseRequest +from .conversation_attachment_files import ConversationAttachmentFiles + + +class ContactReplyEmailRequest(ContactReplyBaseRequest): + """ + Payload of the request to reply on behalf of a contact using their `email` + """ + + email: str = pydantic.Field() + """ + The email you have defined for the user. + """ + + attachment_files: typing.Optional[typing.List[ConversationAttachmentFiles]] = pydantic.Field(default=None) + """ + A list of files that will be added as attachments. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/contact_reply_intercom_user_id_request.py b/src/intercom/types/contact_reply_intercom_user_id_request.py new file mode 100644 index 0000000..f984836 --- /dev/null +++ b/src/intercom/types/contact_reply_intercom_user_id_request.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from .contact_reply_base_request import ContactReplyBaseRequest +from .conversation_attachment_files import ConversationAttachmentFiles + + +class ContactReplyIntercomUserIdRequest(ContactReplyBaseRequest): + """ + Payload of the request to reply on behalf of a contact using their `intercom_user_id` + """ + + intercom_user_id: str = pydantic.Field() + """ + The identifier for the contact as given by Intercom. + """ + + attachment_files: typing.Optional[typing.List[ConversationAttachmentFiles]] = pydantic.Field(default=None) + """ + A list of files that will be added as attachments. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/contact_reply_ticket_email_request.py b/src/intercom/types/contact_reply_ticket_email_request.py new file mode 100644 index 0000000..b67d8b2 --- /dev/null +++ b/src/intercom/types/contact_reply_ticket_email_request.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from .contact_reply_base_request import ContactReplyBaseRequest + + +class ContactReplyTicketEmailRequest(ContactReplyBaseRequest): + """ + Payload of the request to reply on behalf of a contact using their `email` + """ + + email: str = pydantic.Field() + """ + The email you have defined for the user. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/contact_reply_ticket_intercom_user_id_request.py b/src/intercom/types/contact_reply_ticket_intercom_user_id_request.py new file mode 100644 index 0000000..516dc8d --- /dev/null +++ b/src/intercom/types/contact_reply_ticket_intercom_user_id_request.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from .contact_reply_base_request import ContactReplyBaseRequest + + +class ContactReplyTicketIntercomUserIdRequest(ContactReplyBaseRequest): + """ + Payload of the request to reply on behalf of a contact using their `intercom_user_id` + """ + + intercom_user_id: str = pydantic.Field() + """ + The identifier for the contact as given by Intercom. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/contact_reply_ticket_request.py b/src/intercom/types/contact_reply_ticket_request.py new file mode 100644 index 0000000..3422595 --- /dev/null +++ b/src/intercom/types/contact_reply_ticket_request.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .contact_reply_ticket_email_request import ContactReplyTicketEmailRequest +from .contact_reply_ticket_intercom_user_id_request import ContactReplyTicketIntercomUserIdRequest +from .contact_reply_ticket_user_id_request import ContactReplyTicketUserIdRequest + +ContactReplyTicketRequest = typing.Union[ + ContactReplyTicketIntercomUserIdRequest, ContactReplyTicketUserIdRequest, ContactReplyTicketEmailRequest +] diff --git a/src/intercom/types/contact_reply_ticket_user_id_request.py b/src/intercom/types/contact_reply_ticket_user_id_request.py new file mode 100644 index 0000000..ffdceb2 --- /dev/null +++ b/src/intercom/types/contact_reply_ticket_user_id_request.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from .contact_reply_base_request import ContactReplyBaseRequest + + +class ContactReplyTicketUserIdRequest(ContactReplyBaseRequest): + """ + Payload of the request to reply on behalf of a contact using their `user_id` + """ + + user_id: str = pydantic.Field() + """ + The external_id you have defined for the contact. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/contact_reply_user_id_request.py b/src/intercom/types/contact_reply_user_id_request.py new file mode 100644 index 0000000..710c1b2 --- /dev/null +++ b/src/intercom/types/contact_reply_user_id_request.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from .contact_reply_base_request import ContactReplyBaseRequest +from .conversation_attachment_files import ConversationAttachmentFiles + + +class ContactReplyUserIdRequest(ContactReplyBaseRequest): + """ + Payload of the request to reply on behalf of a contact using their `user_id` + """ + + user_id: str = pydantic.Field() + """ + The external_id you have defined for the contact. + """ + + attachment_files: typing.Optional[typing.List[ConversationAttachmentFiles]] = pydantic.Field(default=None) + """ + A list of files that will be added as attachments. You can include up to 10 files. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/contact_segments.py b/src/intercom/types/contact_segments.py new file mode 100644 index 0000000..48d5a1b --- /dev/null +++ b/src/intercom/types/contact_segments.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from ..segments.types.segment import Segment + + +class ContactSegments(UncheckedBaseModel): + """ + A list of segments objects attached to a specific contact. + """ + + type: typing.Literal["list"] = pydantic.Field(default="list") + """ + The type of the object + """ + + data: typing.List[Segment] = pydantic.Field() + """ + Segment objects associated with the contact. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/contact_social_profiles.py b/src/intercom/types/contact_social_profiles.py new file mode 100644 index 0000000..946c8c1 --- /dev/null +++ b/src/intercom/types/contact_social_profiles.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .social_profile import SocialProfile + + +class ContactSocialProfiles(UncheckedBaseModel): + """ + An object containing social profiles that a contact has. + """ + + data: typing.List[SocialProfile] = pydantic.Field() + """ + A list of social profiles objects associated with the contact. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/contact_subscription_types.py b/src/intercom/types/contact_subscription_types.py new file mode 100644 index 0000000..ae348c9 --- /dev/null +++ b/src/intercom/types/contact_subscription_types.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .addressable_list import AddressableList + + +class ContactSubscriptionTypes(UncheckedBaseModel): + """ + An object containing Subscription Types meta data about the SubscriptionTypes that a contact has. + """ + + data: typing.List[AddressableList] = pydantic.Field() + """ + This object represents the subscriptions attached to a contact. + """ + + url: str = pydantic.Field() + """ + Url to get more subscription type resources for this contact + """ + + total_count: int = pydantic.Field() + """ + Int representing the total number of subscription types attached to this contact + """ + + has_more: bool = pydantic.Field() + """ + Whether there's more Addressable Objects to be viewed. If true, use the url to view all + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/contact_tags.py b/src/intercom/types/contact_tags.py new file mode 100644 index 0000000..5a94714 --- /dev/null +++ b/src/intercom/types/contact_tags.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .addressable_list import AddressableList + + +class ContactTags(UncheckedBaseModel): + """ + An object containing tags meta data about the tags that a contact has. Up to 10 will be displayed here. Use the url to get more. + """ + + data: typing.List[AddressableList] = pydantic.Field() + """ + This object represents the tags attached to a contact. + """ + + url: str = pydantic.Field() + """ + url to get more tag resources for this contact + """ + + total_count: int = pydantic.Field() + """ + Int representing the total number of tags attached to this contact + """ + + has_more: bool = pydantic.Field() + """ + Whether there's more Addressable Objects to be viewed. If true, use the url to view all + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/contact_unarchived.py b/src/intercom/types/contact_unarchived.py new file mode 100644 index 0000000..38fac21 --- /dev/null +++ b/src/intercom/types/contact_unarchived.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ContactUnarchived(UncheckedBaseModel): + """ + unarchived contact object + """ + + type: typing.Literal["contact"] = pydantic.Field(default="contact") + """ + always contact + """ + + id: str = pydantic.Field() + """ + The unique identifier for the contact which is given by Intercom. + """ + + external_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The unique identifier for the contact which is provided by the Client. + """ + + archived: bool = pydantic.Field() + """ + Whether the contact is archived or not. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/content_object.py b/src/intercom/types/content_object.py new file mode 100644 index 0000000..857f544 --- /dev/null +++ b/src/intercom/types/content_object.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .component import Component + + +class ContentObject(UncheckedBaseModel): + """ + The content object is where you specify the UI of your app. You provide us with a set of `components` in a components array that we then render. + + The content object should usually be returned within the [canvas object](https://developers.intercom.com/docs/references/canvas-kit/responseobjects/canvas). If you're responding to a Live Canvas request however, then you should only respond with the content object. + """ + + components: typing.List[Component] = pydantic.Field() + """ + The list of components to be rendered. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/content_sources_list.py b/src/intercom/types/content_sources_list.py new file mode 100644 index 0000000..14cdd1c --- /dev/null +++ b/src/intercom/types/content_sources_list.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..ai_content_source.types.content_source import ContentSource +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ContentSourcesList(UncheckedBaseModel): + type: typing.Literal["content_source.list"] = "content_source.list" + total_count: int = pydantic.Field() + """ + The total number of content sources used by AI Agent in the conversation. + """ + + content_sources: typing.List[ContentSource] = pydantic.Field() + """ + The content sources used by AI Agent in the conversation. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/context.py b/src/intercom/types/context.py new file mode 100644 index 0000000..25e0f59 --- /dev/null +++ b/src/intercom/types/context.py @@ -0,0 +1,55 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .context_location import ContextLocation + + +class Context(UncheckedBaseModel): + """ + The context object provides additional details on where the app has been added (or is currently being used), what page the app is being used on, and information on the Messenger settings. This is in order for you give a fully customised experience based on the customers use case. + + If the `location` is `conversation` then you will also be given a `conversation_id`. If you need to use details about the conversation, then you have to use the `conversation_id` to [make a call to our Conversations API and retrieve the conversation object](https://developers.intercom.com/intercom-api-reference/reference#get-a-single-conversation). + """ + + conversation_id: typing.Optional[int] = pydantic.Field(default=None) + """ + The id of the conversation where the app is added or being used. + """ + + location: typing.Optional[ContextLocation] = pydantic.Field(default=None) + """ + Where the app is added or the action took place. Can be either 'conversation', 'home', 'message', or 'operator'. + """ + + locale: typing.Optional[str] = pydantic.Field(default=None) + """ + The default end-user language of the Messenger. Use to localise Messenger App content. + """ + + messenger_action_colour: typing.Optional[str] = pydantic.Field(default=None) + """ + The messengers action colour. Use in Sheets and Icons to make a Messenger App experience feel part of the host Messenger. + """ + + messenger_background_colour: typing.Optional[str] = pydantic.Field(default=None) + """ + The messengers background colour. Use in Sheets and Icons to make a Messenger App experience feel part of the host Messenger. + """ + + referrer: typing.Optional[str] = pydantic.Field(default=None) + """ + The current page URL where the app is being used. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/context_location.py b/src/intercom/types/context_location.py new file mode 100644 index 0000000..f416a3b --- /dev/null +++ b/src/intercom/types/context_location.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ContextLocation = typing.Union[typing.Literal["conversation", "home", "message", "operator"], typing.Any] diff --git a/src/intercom/types/conversation_attachment_files.py b/src/intercom/types/conversation_attachment_files.py new file mode 100644 index 0000000..97f5197 --- /dev/null +++ b/src/intercom/types/conversation_attachment_files.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConversationAttachmentFiles(UncheckedBaseModel): + """ + Properties of the attachment files in a conversation part + """ + + content_type: str = pydantic.Field() + """ + The content type of the file + """ + + data: str = pydantic.Field() + """ + The base64 encoded file data. + """ + + name: str = pydantic.Field() + """ + The name of the file. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/conversation_contacts.py b/src/intercom/types/conversation_contacts.py new file mode 100644 index 0000000..450c24a --- /dev/null +++ b/src/intercom/types/conversation_contacts.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .contact_reference import ContactReference + + +class ConversationContacts(UncheckedBaseModel): + """ + The list of contacts (users or leads) involved in this conversation. This will only contain one customer unless more were added via the group conversation feature. + """ + + type: typing.Literal["contact.list"] = "contact.list" + contacts: typing.List[ContactReference] = pydantic.Field() + """ + The list of contacts (users or leads) involved in this conversation. This will only contain one customer unless more were added via the group conversation feature. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/conversation_first_contact_reply.py b/src/intercom/types/conversation_first_contact_reply.py new file mode 100644 index 0000000..7963edd --- /dev/null +++ b/src/intercom/types/conversation_first_contact_reply.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConversationFirstContactReply(UncheckedBaseModel): + """ + An object containing information on the first users message. For a contact initiated message this will represent the users original message. + """ + + created_at: int = pydantic.Field() + """ + + """ + + type: str = pydantic.Field() + """ + + """ + + url: typing.Optional[str] = pydantic.Field(default=None) + """ + + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/conversation_part.py b/src/intercom/types/conversation_part.py new file mode 100644 index 0000000..152337e --- /dev/null +++ b/src/intercom/types/conversation_part.py @@ -0,0 +1,81 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_part_author import ConversationPartAuthor +from .part_attachment import PartAttachment +from .reference import Reference + + +class ConversationPart(UncheckedBaseModel): + """ + A Conversation Part represents a message in the conversation. + """ + + type: typing.Literal["conversation_part"] = pydantic.Field(default="conversation_part") + """ + Always conversation_part + """ + + id: str = pydantic.Field() + """ + The id representing the conversation part. + """ + + part_type: str = pydantic.Field() + """ + The type of conversation part. + """ + + body: typing.Optional[str] = pydantic.Field(default=None) + """ + The message body, which may contain HTML. For Twitter, this will show a generic message regarding why the body is obscured. + """ + + created_at: int = pydantic.Field() + """ + The time the conversation part was created. + """ + + updated_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The last time the conversation part was updated. + """ + + notified_at: int = pydantic.Field() + """ + The time the user was notified with the conversation part. + """ + + assigned_to: typing.Optional[Reference] = pydantic.Field(default=None) + """ + The id of the admin that was assigned the conversation by this conversation_part (null if there has been no change in assignment.) + """ + + author: ConversationPartAuthor + attachments: typing.Optional[typing.List[PartAttachment]] = pydantic.Field(default=None) + """ + A list of attachments for the part. + """ + + external_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The external id of the conversation part + """ + + redacted: bool = pydantic.Field() + """ + Whether or not the conversation part has been redacted. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/conversation_part_author.py b/src/intercom/types/conversation_part_author.py new file mode 100644 index 0000000..bcfeafb --- /dev/null +++ b/src/intercom/types/conversation_part_author.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConversationPartAuthor(UncheckedBaseModel): + """ + The object who initiated the conversation, which can be a Contact, Admin or Team. Bots and campaigns send messages on behalf of Admins or Teams. For Twitter, this will be blank. + """ + + type: str = pydantic.Field() + """ + The type of the author + """ + + id: str = pydantic.Field() + """ + The id of the author + """ + + name: str = pydantic.Field() + """ + The name of the author + """ + + email: str = pydantic.Field() + """ + The email of the author + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/conversation_parts.py b/src/intercom/types/conversation_parts.py new file mode 100644 index 0000000..f3e3374 --- /dev/null +++ b/src/intercom/types/conversation_parts.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_part import ConversationPart + + +class ConversationParts(UncheckedBaseModel): + """ + A list of Conversation Part objects for each part message in the conversation. This is only returned when Retrieving a Conversation, and ignored when Listing all Conversations. There is a limit of 500 parts. + """ + + type: typing.Literal["conversation_part.list"] = pydantic.Field(default="conversation_part.list") + """ + + """ + + conversation_parts: typing.List[ConversationPart] = pydantic.Field() + """ + A list of Conversation Part objects for each part message in the conversation. This is only returned when Retrieving a Conversation, and ignored when Listing all Conversations. There is a limit of 500 parts. + """ + + total_count: int = pydantic.Field() + """ + + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/conversation_rating.py b/src/intercom/types/conversation_rating.py new file mode 100644 index 0000000..fd76822 --- /dev/null +++ b/src/intercom/types/conversation_rating.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .contact_reference import ContactReference +from .reference import Reference + + +class ConversationRating(UncheckedBaseModel): + """ + The Conversation Rating object which contains information on the rating and/or remark added by a Contact and the Admin assigned to the conversation. + """ + + rating: int = pydantic.Field() + """ + The rating, between 1 and 5, for the conversation. + """ + + remark: str = pydantic.Field() + """ + An optional field to add a remark to correspond to the number rating + """ + + created_at: int = pydantic.Field() + """ + The time the rating was requested in the conversation being rated. + """ + + contact: ContactReference + teammate: Reference + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/conversation_source.py b/src/intercom/types/conversation_source.py new file mode 100644 index 0000000..b016f53 --- /dev/null +++ b/src/intercom/types/conversation_source.py @@ -0,0 +1,66 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_part_author import ConversationPartAuthor +from .conversation_source_type import ConversationSourceType +from .part_attachment import PartAttachment + + +class ConversationSource(UncheckedBaseModel): + """ + The Conversation Part that originated this conversation, which can be Contact, Admin, Campaign, Automated or Operator initiated. + """ + + type: ConversationSourceType = pydantic.Field() + """ + This includes conversation, email, facebook, instagram, phone_call, phone_switch, push, sms, twitter and whatsapp. + """ + + id: str = pydantic.Field() + """ + The id representing the message. + """ + + delivered_as: str = pydantic.Field() + """ + The conversation's initiation type. Possible values are customer_initiated, campaigns_initiated (legacy campaigns), operator_initiated (Custom bot), automated (Series and other outbounds with dynamic audience message) and admin_initiated (fixed audience message, ticket initiated by an admin, group email). + """ + + subject: str = pydantic.Field() + """ + Optional. The message subject. For Twitter, this will show a generic message regarding why the subject is obscured. + """ + + body: typing.Optional[str] = pydantic.Field(default=None) + """ + The message body, which may contain HTML. For Twitter, this will show a generic message regarding why the body is obscured. + """ + + author: ConversationPartAuthor + attachments: typing.Optional[typing.List[PartAttachment]] = pydantic.Field(default=None) + """ + A list of attachments for the part. + """ + + url: typing.Optional[str] = pydantic.Field(default=None) + """ + The URL where the conversation was started. For Twitter, Email, and Bots, this will be blank. + """ + + redacted: bool = pydantic.Field() + """ + Whether or not the source message has been redacted. Only applicable for contact initiated messages. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/conversation_source_type.py b/src/intercom/types/conversation_source_type.py new file mode 100644 index 0000000..0a56fc3 --- /dev/null +++ b/src/intercom/types/conversation_source_type.py @@ -0,0 +1,19 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConversationSourceType = typing.Union[ + typing.Literal[ + "conversation", + "email", + "facebook", + "instagram", + "phone_call", + "phone_switch", + "push", + "sms", + "twitter", + "whatsapp", + ], + typing.Any, +] diff --git a/src/intercom/types/conversation_statistics.py b/src/intercom/types/conversation_statistics.py new file mode 100644 index 0000000..4e65607 --- /dev/null +++ b/src/intercom/types/conversation_statistics.py @@ -0,0 +1,117 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConversationStatistics(UncheckedBaseModel): + """ + A Statistics object containing all information required for reporting, with timestamps and calculated metrics. + """ + + type: typing.Literal["conversation_statistics"] = pydantic.Field(default="conversation_statistics") + """ + + """ + + time_to_assignment: typing.Optional[int] = pydantic.Field(default=None) + """ + Duration until last assignment before first admin reply. In seconds. + """ + + time_to_admin_reply: typing.Optional[int] = pydantic.Field(default=None) + """ + Duration until first admin reply. Subtracts out of business hours. In seconds. + """ + + time_to_first_close: typing.Optional[int] = pydantic.Field(default=None) + """ + Duration until conversation was closed first time. Subtracts out of business hours. In seconds. + """ + + time_to_last_close: typing.Optional[int] = pydantic.Field(default=None) + """ + Duration until conversation was closed last time. Subtracts out of business hours. In seconds. + """ + + median_time_to_reply: typing.Optional[int] = pydantic.Field(default=None) + """ + Median based on all admin replies after a contact reply. Subtracts out of business hours. In seconds. + """ + + first_contact_reply_at: typing.Optional[int] = pydantic.Field(default=None) + """ + Time of first text conversation part from a contact. + """ + + first_assignment_at: typing.Optional[int] = pydantic.Field(default=None) + """ + Time of first assignment after first_contact_reply_at. + """ + + first_admin_reply_at: typing.Optional[int] = pydantic.Field(default=None) + """ + Time of first admin reply after first_contact_reply_at. + """ + + first_close_at: typing.Optional[int] = pydantic.Field(default=None) + """ + Time of first close after first_contact_reply_at. + """ + + last_assignment_at: typing.Optional[int] = pydantic.Field(default=None) + """ + Time of last assignment after first_contact_reply_at. + """ + + last_assignment_admin_reply_at: typing.Optional[int] = pydantic.Field(default=None) + """ + Time of first admin reply since most recent assignment. + """ + + last_contact_reply_at: typing.Optional[int] = pydantic.Field(default=None) + """ + Time of the last conversation part from a contact. + """ + + last_admin_reply_at: typing.Optional[int] = pydantic.Field(default=None) + """ + Time of the last conversation part from an admin. + """ + + last_close_at: typing.Optional[int] = pydantic.Field(default=None) + """ + Time of the last conversation close. + """ + + last_closed_by_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The last admin who closed the conversation. Returns a reference to an Admin object. + """ + + count_reopens: typing.Optional[int] = pydantic.Field(default=None) + """ + Number of reopens after first_contact_reply_at. + """ + + count_assignments: typing.Optional[int] = pydantic.Field(default=None) + """ + Number of assignments after first_contact_reply_at. + """ + + count_conversation_parts: typing.Optional[int] = pydantic.Field(default=None) + """ + Total number of conversation parts. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/conversation_teammates.py b/src/intercom/types/conversation_teammates.py new file mode 100644 index 0000000..0d9ea9e --- /dev/null +++ b/src/intercom/types/conversation_teammates.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .reference import Reference + + +class ConversationTeammates(UncheckedBaseModel): + """ + The list of teammates who participated in the conversation (wrote at least one conversation part). + """ + + type: typing.Literal["admin.list"] = pydantic.Field(default="admin.list") + """ + The type of the object - `admin.list`. + """ + + admins: typing.List[Reference] = pydantic.Field() + """ + The list of teammates who participated in the conversation (wrote at least one conversation part). + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/create_contact_request.py b/src/intercom/types/create_contact_request.py new file mode 100644 index 0000000..054a5eb --- /dev/null +++ b/src/intercom/types/create_contact_request.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .create_contact_request_with_email import CreateContactRequestWithEmail +from .create_contact_request_with_external_id import CreateContactRequestWithExternalId +from .create_contact_request_with_role import CreateContactRequestWithRole + +CreateContactRequest = typing.Union[ + CreateContactRequestWithEmail, CreateContactRequestWithExternalId, CreateContactRequestWithRole +] diff --git a/src/intercom/types/create_contact_request_two.py b/src/intercom/types/create_contact_request_two.py new file mode 100644 index 0000000..3df2703 --- /dev/null +++ b/src/intercom/types/create_contact_request_two.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CreateContactRequestTwo = typing.Optional[typing.Any] diff --git a/src/intercom/types/create_contact_request_with_email.py b/src/intercom/types/create_contact_request_with_email.py new file mode 100644 index 0000000..6f649fb --- /dev/null +++ b/src/intercom/types/create_contact_request_with_email.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateContactRequestWithEmail(UncheckedBaseModel): + email: str = pydantic.Field() + """ + The contacts email + """ + + phone: typing.Optional[str] = pydantic.Field(default=None) + """ + The contacts phone + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + The contacts name + """ + + avatar: typing.Optional[str] = pydantic.Field(default=None) + """ + An image URL containing the avatar of a contact + """ + + signed_up_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time specified for when a contact signed up + """ + + last_seen_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time when the contact was last seen (either where the Intercom Messenger was installed or when specified manually) + """ + + owner_id: typing.Optional[int] = pydantic.Field(default=None) + """ + The id of an admin that has been assigned account ownership of the contact + """ + + unsubscribed_from_emails: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the contact is unsubscribed from emails + """ + + custom_attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + """ + The custom attributes which are set for the contact + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/create_contact_request_with_external_id.py b/src/intercom/types/create_contact_request_with_external_id.py new file mode 100644 index 0000000..dcc1ca7 --- /dev/null +++ b/src/intercom/types/create_contact_request_with_external_id.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateContactRequestWithExternalId(UncheckedBaseModel): + external_id: str = pydantic.Field() + """ + A unique identifier for the contact which is given to Intercom + """ + + phone: typing.Optional[str] = pydantic.Field(default=None) + """ + The contacts phone + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + The contacts name + """ + + avatar: typing.Optional[str] = pydantic.Field(default=None) + """ + An image URL containing the avatar of a contact + """ + + signed_up_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time specified for when a contact signed up + """ + + last_seen_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time when the contact was last seen (either where the Intercom Messenger was installed or when specified manually) + """ + + owner_id: typing.Optional[int] = pydantic.Field(default=None) + """ + The id of an admin that has been assigned account ownership of the contact + """ + + unsubscribed_from_emails: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the contact is unsubscribed from emails + """ + + custom_attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + """ + The custom attributes which are set for the contact + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/create_contact_request_with_role.py b/src/intercom/types/create_contact_request_with_role.py new file mode 100644 index 0000000..37460ca --- /dev/null +++ b/src/intercom/types/create_contact_request_with_role.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateContactRequestWithRole(UncheckedBaseModel): + role: str = pydantic.Field() + """ + The role of the contact. + """ + + phone: typing.Optional[str] = pydantic.Field(default=None) + """ + The contacts phone + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + The contacts name + """ + + avatar: typing.Optional[str] = pydantic.Field(default=None) + """ + An image URL containing the avatar of a contact + """ + + signed_up_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time specified for when a contact signed up + """ + + last_seen_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time when the contact was last seen (either where the Intercom Messenger was installed or when specified manually) + """ + + owner_id: typing.Optional[int] = pydantic.Field(default=None) + """ + The id of an admin that has been assigned account ownership of the contact + """ + + unsubscribed_from_emails: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the contact is unsubscribed from emails + """ + + custom_attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + """ + The custom attributes which are set for the contact + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/create_data_event_request.py b/src/intercom/types/create_data_event_request.py new file mode 100644 index 0000000..89437be --- /dev/null +++ b/src/intercom/types/create_data_event_request.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .create_data_event_request_with_email import CreateDataEventRequestWithEmail +from .create_data_event_request_with_id import CreateDataEventRequestWithId +from .create_data_event_request_with_user_id import CreateDataEventRequestWithUserId + +CreateDataEventRequest = typing.Union[ + CreateDataEventRequestWithId, CreateDataEventRequestWithUserId, CreateDataEventRequestWithEmail +] diff --git a/src/intercom/types/create_data_event_request_two.py b/src/intercom/types/create_data_event_request_two.py new file mode 100644 index 0000000..9d6e063 --- /dev/null +++ b/src/intercom/types/create_data_event_request_two.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CreateDataEventRequestTwo = typing.Optional[typing.Any] diff --git a/src/intercom/types/create_data_event_request_with_email.py b/src/intercom/types/create_data_event_request_with_email.py new file mode 100644 index 0000000..83dc54b --- /dev/null +++ b/src/intercom/types/create_data_event_request_with_email.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateDataEventRequestWithEmail(UncheckedBaseModel): + email: str = pydantic.Field() + """ + An email address for your user. An email should only be used where your application uses email to uniquely identify users. + """ + + event_name: str = pydantic.Field() + """ + The name of the event that occurred. This is presented to your App's admins when filtering and creating segments - a good event name is typically a past tense 'verb-noun' combination, to improve readability, for example `updated-plan`. + """ + + created_at: int = pydantic.Field() + """ + The time the event occurred as a UTC Unix timestamp + """ + + metadata: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None) + """ + Optional metadata about the event. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/create_data_event_request_with_id.py b/src/intercom/types/create_data_event_request_with_id.py new file mode 100644 index 0000000..13f1d10 --- /dev/null +++ b/src/intercom/types/create_data_event_request_with_id.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateDataEventRequestWithId(UncheckedBaseModel): + id: str = pydantic.Field() + """ + The unique identifier for the contact (lead or user) which is given by Intercom. + """ + + event_name: str = pydantic.Field() + """ + The name of the event that occurred. This is presented to your App's admins when filtering and creating segments - a good event name is typically a past tense 'verb-noun' combination, to improve readability, for example `updated-plan`. + """ + + created_at: int = pydantic.Field() + """ + The time the event occurred as a UTC Unix timestamp + """ + + metadata: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None) + """ + Optional metadata about the event. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/create_data_event_request_with_user_id.py b/src/intercom/types/create_data_event_request_with_user_id.py new file mode 100644 index 0000000..ad49497 --- /dev/null +++ b/src/intercom/types/create_data_event_request_with_user_id.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateDataEventRequestWithUserId(UncheckedBaseModel): + user_id: str = pydantic.Field() + """ + Your identifier for the user. + """ + + event_name: str = pydantic.Field() + """ + The name of the event that occurred. This is presented to your App's admins when filtering and creating segments - a good event name is typically a past tense 'verb-noun' combination, to improve readability, for example `updated-plan`. + """ + + created_at: int = pydantic.Field() + """ + The time the event occurred as a UTC Unix timestamp + """ + + metadata: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None) + """ + Optional metadata about the event. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/create_message_request.py b/src/intercom/types/create_message_request.py new file mode 100644 index 0000000..d10e75f --- /dev/null +++ b/src/intercom/types/create_message_request.py @@ -0,0 +1,66 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .create_message_request_from import CreateMessageRequestFrom +from .create_message_request_to import CreateMessageRequestTo + + +class CreateMessageRequest_Email(UncheckedBaseModel): + """ + You can create a message + """ + + message_type: typing.Literal["email"] = "email" + subject: str + body: str + template: str + from_: typing_extensions.Annotated[CreateMessageRequestFrom, FieldMetadata(alias="from")] + to: CreateMessageRequestTo + created_at: typing.Optional[int] = None + create_conversation_without_contact_reply: typing.Optional[bool] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class CreateMessageRequest_Inapp(UncheckedBaseModel): + """ + You can create a message + """ + + message_type: typing.Literal["inapp"] = "inapp" + subject: typing.Optional[str] = None + body: str + template: typing.Optional[str] = None + from_: typing_extensions.Annotated[CreateMessageRequestFrom, FieldMetadata(alias="from")] + to: CreateMessageRequestTo + created_at: typing.Optional[int] = None + create_conversation_without_contact_reply: typing.Optional[bool] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +CreateMessageRequest = typing_extensions.Annotated[ + typing.Union[CreateMessageRequest_Email, CreateMessageRequest_Inapp], UnionMetadata(discriminant="message_type") +] diff --git a/src/intercom/types/create_message_request_from.py b/src/intercom/types/create_message_request_from.py new file mode 100644 index 0000000..784fd7a --- /dev/null +++ b/src/intercom/types/create_message_request_from.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateMessageRequestFrom(UncheckedBaseModel): + """ + The sender of the message. If not provided, the default sender will be used. + """ + + type: typing.Literal["admin"] = pydantic.Field(default="admin") + """ + Always `admin`. + """ + + id: int = pydantic.Field() + """ + The identifier for the admin which is given by Intercom. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/create_message_request_three.py b/src/intercom/types/create_message_request_three.py new file mode 100644 index 0000000..1fdcfa4 --- /dev/null +++ b/src/intercom/types/create_message_request_three.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CreateMessageRequestThree = typing.Optional[typing.Any] diff --git a/src/intercom/types/create_message_request_to.py b/src/intercom/types/create_message_request_to.py new file mode 100644 index 0000000..6e462f8 --- /dev/null +++ b/src/intercom/types/create_message_request_to.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .create_message_request_type import CreateMessageRequestType + + +class CreateMessageRequestTo(UncheckedBaseModel): + """ + The sender of the message. If not provided, the default sender will be used. + """ + + type: CreateMessageRequestType = pydantic.Field() + """ + The role associated to the contact - `user` or `lead`. + """ + + id: str = pydantic.Field() + """ + The identifier for the contact which is given by Intercom. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/create_message_request_type.py b/src/intercom/types/create_message_request_type.py new file mode 100644 index 0000000..0d27b8e --- /dev/null +++ b/src/intercom/types/create_message_request_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CreateMessageRequestType = typing.Union[typing.Literal["user", "lead"], typing.Any] diff --git a/src/intercom/types/create_message_request_with_email.py b/src/intercom/types/create_message_request_with_email.py new file mode 100644 index 0000000..af09619 --- /dev/null +++ b/src/intercom/types/create_message_request_with_email.py @@ -0,0 +1,57 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .create_message_request_from import CreateMessageRequestFrom +from .create_message_request_to import CreateMessageRequestTo + + +class CreateMessageRequestWithEmail(UncheckedBaseModel): + subject: str = pydantic.Field() + """ + The title of the email. + """ + + body: str = pydantic.Field() + """ + The content of the message. HTML and plaintext are supported. + """ + + template: str = pydantic.Field() + """ + The style of the outgoing message. Possible values `plain` or `personal`. + """ + + from_: typing_extensions.Annotated[CreateMessageRequestFrom, FieldMetadata(alias="from")] = pydantic.Field() + """ + The sender of the message. If not provided, the default sender will be used. + """ + + to: CreateMessageRequestTo = pydantic.Field() + """ + The sender of the message. If not provided, the default sender will be used. + """ + + created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time the message was created. If not provided, the current time will be used. + """ + + create_conversation_without_contact_reply: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether a conversation should be opened in the inbox for the message without the contact replying. Defaults to false if not provided. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/create_message_request_with_inapp.py b/src/intercom/types/create_message_request_with_inapp.py new file mode 100644 index 0000000..239667f --- /dev/null +++ b/src/intercom/types/create_message_request_with_inapp.py @@ -0,0 +1,57 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .create_message_request_from import CreateMessageRequestFrom +from .create_message_request_to import CreateMessageRequestTo + + +class CreateMessageRequestWithInapp(UncheckedBaseModel): + subject: typing.Optional[str] = pydantic.Field(default=None) + """ + The title of the email. + """ + + body: str = pydantic.Field() + """ + The content of the message. HTML and plaintext are supported. + """ + + template: typing.Optional[str] = pydantic.Field(default=None) + """ + The style of the outgoing message. Possible values `plain` or `personal`. + """ + + from_: typing_extensions.Annotated[CreateMessageRequestFrom, FieldMetadata(alias="from")] = pydantic.Field() + """ + The sender of the message. If not provided, the default sender will be used. + """ + + to: CreateMessageRequestTo = pydantic.Field() + """ + The sender of the message. If not provided, the default sender will be used. + """ + + created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time the message was created. If not provided, the current time will be used. + """ + + create_conversation_without_contact_reply: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether a conversation should be opened in the inbox for the message without the contact replying. Defaults to false if not provided. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/create_or_update_tag_request.py b/src/intercom/types/create_or_update_tag_request.py new file mode 100644 index 0000000..31129c9 --- /dev/null +++ b/src/intercom/types/create_or_update_tag_request.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateOrUpdateTagRequest(UncheckedBaseModel): + """ + You can create or update an existing tag. + """ + + name: str = pydantic.Field() + """ + The name of the tag, which will be created if not found, or the new name for the tag if this is an update request. Names are case insensitive. + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id of tag to updates. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/create_ticket_reply_with_comment_request.py b/src/intercom/types/create_ticket_reply_with_comment_request.py new file mode 100644 index 0000000..107d44a --- /dev/null +++ b/src/intercom/types/create_ticket_reply_with_comment_request.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .admin_reply_ticket_request import AdminReplyTicketRequest +from .contact_reply_ticket_request import ContactReplyTicketRequest + +CreateTicketReplyWithCommentRequest = typing.Union[ContactReplyTicketRequest, AdminReplyTicketRequest] diff --git a/src/intercom/types/create_ticket_request.py b/src/intercom/types/create_ticket_request.py new file mode 100644 index 0000000..abee343 --- /dev/null +++ b/src/intercom/types/create_ticket_request.py @@ -0,0 +1,46 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .create_ticket_request_contacts_item import CreateTicketRequestContactsItem +from .ticket_request_custom_attributes import TicketRequestCustomAttributes + + +class CreateTicketRequest(UncheckedBaseModel): + """ + You can create a Ticket + """ + + ticket_type_id: str = pydantic.Field() + """ + The ID of the type of ticket you want to create + """ + + contacts: typing.List[CreateTicketRequestContactsItem] = pydantic.Field() + """ + The list of contacts (users or leads) affected by this ticket. Currently only one is allowed + """ + + company_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the company that the ticket is associated with. The ID that you set upon company creation. + """ + + created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time the ticket was created. If not provided, the current time will be used. + """ + + ticket_attributes: typing.Optional[TicketRequestCustomAttributes] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/create_ticket_request_contacts_item.py b/src/intercom/types/create_ticket_request_contacts_item.py new file mode 100644 index 0000000..2d5d66c --- /dev/null +++ b/src/intercom/types/create_ticket_request_contacts_item.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .create_ticket_request_contacts_item_email import CreateTicketRequestContactsItemEmail +from .create_ticket_request_contacts_item_external_id import CreateTicketRequestContactsItemExternalId +from .create_ticket_request_contacts_item_id import CreateTicketRequestContactsItemId + +CreateTicketRequestContactsItem = typing.Union[ + CreateTicketRequestContactsItemId, CreateTicketRequestContactsItemExternalId, CreateTicketRequestContactsItemEmail +] diff --git a/src/intercom/types/create_ticket_request_contacts_item_email.py b/src/intercom/types/create_ticket_request_contacts_item_email.py new file mode 100644 index 0000000..45941af --- /dev/null +++ b/src/intercom/types/create_ticket_request_contacts_item_email.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateTicketRequestContactsItemEmail(UncheckedBaseModel): + email: str = pydantic.Field() + """ + The email you have defined for the contact who is being added as a participant. If a contact with this email does not exist, one will be created. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/create_ticket_request_contacts_item_external_id.py b/src/intercom/types/create_ticket_request_contacts_item_external_id.py new file mode 100644 index 0000000..96a1cef --- /dev/null +++ b/src/intercom/types/create_ticket_request_contacts_item_external_id.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateTicketRequestContactsItemExternalId(UncheckedBaseModel): + external_id: str = pydantic.Field() + """ + The external_id you have defined for the contact who is being added as a participant. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/create_ticket_request_contacts_item_id.py b/src/intercom/types/create_ticket_request_contacts_item_id.py new file mode 100644 index 0000000..26859f1 --- /dev/null +++ b/src/intercom/types/create_ticket_request_contacts_item_id.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateTicketRequestContactsItemId(UncheckedBaseModel): + id: str = pydantic.Field() + """ + The identifier for the contact as given by Intercom. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/current_canvas.py b/src/intercom/types/current_canvas.py new file mode 100644 index 0000000..9adeb2e --- /dev/null +++ b/src/intercom/types/current_canvas.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .canvas_object import CanvasObject + + +class CurrentCanvas(UncheckedBaseModel): + """ + The current canvas that was most recently showing before the request was sent. This object mirrors the same format as the Canvas Object. + """ + + current_canvas: CanvasObject = pydantic.Field() + """ + The canvas object representing the current canvas state. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/cursor_pages.py b/src/intercom/types/cursor_pages.py new file mode 100644 index 0000000..1c27e2e --- /dev/null +++ b/src/intercom/types/cursor_pages.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .starting_after_paging import StartingAfterPaging + + +class CursorPages(UncheckedBaseModel): + """ + 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. + """ + + type: typing.Literal["pages"] = pydantic.Field(default="pages") + """ + the type of object `pages`. + """ + + page: typing.Optional[int] = pydantic.Field(default=None) + """ + The current page + """ + + next: typing.Optional[StartingAfterPaging] = None + per_page: typing.Optional[int] = pydantic.Field(default=None) + """ + Number of results per page + """ + + total_pages: typing.Optional[int] = pydantic.Field(default=None) + """ + Total number of pages + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/custom_attributes.py b/src/intercom/types/custom_attributes.py new file mode 100644 index 0000000..751b394 --- /dev/null +++ b/src/intercom/types/custom_attributes.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CustomAttributes = typing.Dict[str, typing.Optional[typing.Any]] diff --git a/src/intercom/types/customer_request.py b/src/intercom/types/customer_request.py new file mode 100644 index 0000000..a61840b --- /dev/null +++ b/src/intercom/types/customer_request.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .customer_request_email import CustomerRequestEmail +from .customer_request_intercom_user_id import CustomerRequestIntercomUserId +from .customer_request_user_id import CustomerRequestUserId + +CustomerRequest = typing.Union[CustomerRequestIntercomUserId, CustomerRequestUserId, CustomerRequestEmail] diff --git a/src/intercom/types/customer_request_email.py b/src/intercom/types/customer_request_email.py new file mode 100644 index 0000000..2291e9b --- /dev/null +++ b/src/intercom/types/customer_request_email.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CustomerRequestEmail(UncheckedBaseModel): + email: str = pydantic.Field() + """ + The email you have defined for the contact who is being added as a participant. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/customer_request_intercom_user_id.py b/src/intercom/types/customer_request_intercom_user_id.py new file mode 100644 index 0000000..355cd81 --- /dev/null +++ b/src/intercom/types/customer_request_intercom_user_id.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CustomerRequestIntercomUserId(UncheckedBaseModel): + intercom_user_id: str = pydantic.Field() + """ + The identifier for the contact as given by Intercom. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/customer_request_user_id.py b/src/intercom/types/customer_request_user_id.py new file mode 100644 index 0000000..4f0f150 --- /dev/null +++ b/src/intercom/types/customer_request_user_id.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CustomerRequestUserId(UncheckedBaseModel): + user_id: str = pydantic.Field() + """ + The external_id you have defined for the contact who is being added as a participant. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/data_attribute_list.py b/src/intercom/types/data_attribute_list.py new file mode 100644 index 0000000..5690567 --- /dev/null +++ b/src/intercom/types/data_attribute_list.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from ..data_attributes.types.data_attribute import DataAttribute + + +class DataAttributeList(UncheckedBaseModel): + """ + A list of all data attributes belonging to a workspace for contacts, companies or conversations. + """ + + type: typing.Literal["list"] = pydantic.Field(default="list") + """ + The type of the object + """ + + data: typing.List[DataAttribute] = pydantic.Field() + """ + A list of data attributes + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/data_event_list.py b/src/intercom/types/data_event_list.py new file mode 100644 index 0000000..1ebe4a5 --- /dev/null +++ b/src/intercom/types/data_event_list.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from ..data_events.types.data_event import DataEvent +from .data_event_list_pages import DataEventListPages + + +class DataEventList(UncheckedBaseModel): + """ + This will return a list of data events for the App. + """ + + type: typing.Literal["event.list"] = pydantic.Field(default="event.list") + """ + The type of the object + """ + + events: typing.List[DataEvent] = pydantic.Field() + """ + A list of data events + """ + + pages: typing.Optional[DataEventListPages] = pydantic.Field(default=None) + """ + Pagination + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/data_event_list_pages.py b/src/intercom/types/data_event_list_pages.py new file mode 100644 index 0000000..f4634d7 --- /dev/null +++ b/src/intercom/types/data_event_list_pages.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DataEventListPages(UncheckedBaseModel): + """ + Pagination + """ + + next: typing.Optional[str] = None + since: typing.Optional[str] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/data_event_summary.py b/src/intercom/types/data_event_summary.py new file mode 100644 index 0000000..e39975d --- /dev/null +++ b/src/intercom/types/data_event_summary.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .data_event_summary_item import DataEventSummaryItem + + +class DataEventSummary(UncheckedBaseModel): + """ + This will return a summary of data events for the App. + """ + + type: typing.Optional[typing.Literal["event.summary"]] = pydantic.Field(default=None) + """ + The type of the object + """ + + email: typing.Optional[str] = pydantic.Field(default=None) + """ + The email address of the user + """ + + intercom_user_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The Intercom user ID of the user + """ + + user_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The user ID of the user + """ + + events: typing.List[DataEventSummaryItem] = pydantic.Field() + """ + A summary of data events + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/data_event_summary_item.py b/src/intercom/types/data_event_summary_item.py new file mode 100644 index 0000000..f540a43 --- /dev/null +++ b/src/intercom/types/data_event_summary_item.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DataEventSummaryItem(UncheckedBaseModel): + """ + This will return a summary of a data event for the App. + """ + + name: str = pydantic.Field() + """ + The name of the event + """ + + first: str = pydantic.Field() + """ + The first time the event was sent + """ + + last: str = pydantic.Field() + """ + The last time the event was sent + """ + + count: int = pydantic.Field() + """ + The number of times the event was sent + """ + + description: typing.Optional[str] = pydantic.Field(default=None) + """ + The description of the event + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/data_export_csv.py b/src/intercom/types/data_export_csv.py new file mode 100644 index 0000000..2f83871 --- /dev/null +++ b/src/intercom/types/data_export_csv.py @@ -0,0 +1,152 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DataExportCsv(UncheckedBaseModel): + """ + A CSV output file + """ + + user_id: str = pydantic.Field() + """ + The user_id of the user who was sent the message. + """ + + user_external_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The external_user_id of the user who was sent the message + """ + + company_id: str = pydantic.Field() + """ + The company ID of the user in relation to the message that was sent. Will return -1 if no company is present. + """ + + email: str = pydantic.Field() + """ + The users email who was sent the message. + """ + + name: str = pydantic.Field() + """ + The full name of the user receiving the message + """ + + ruleset_id: str = pydantic.Field() + """ + The id of the message. + """ + + content_id: str = pydantic.Field() + """ + The specific content that was received. In an A/B test each version has its own Content ID. + """ + + content_type: str = pydantic.Field() + """ + Email, Chat, Post etc. + """ + + content_title: str = pydantic.Field() + """ + The title of the content you see in your Intercom workspace. + """ + + ruleset_version_id: typing.Optional[str] = pydantic.Field(default=None) + """ + As you edit content we record new versions. This ID can help you determine which version of a piece of content that was received. + """ + + receipt_id: typing.Optional[str] = pydantic.Field(default=None) + """ + ID for this receipt. Will be included with any related stats in other files to identify this specific delivery of a message. + """ + + received_at: typing.Optional[int] = pydantic.Field(default=None) + """ + Timestamp for when the receipt was recorded. + """ + + series_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id of the series that this content is part of. Will return -1 if not part of a series. + """ + + series_title: typing.Optional[str] = pydantic.Field(default=None) + """ + The title of the series that this content is part of. + """ + + node_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id of the series node that this ruleset is associated with. Each block in a series has a corresponding node_id. + """ + + first_reply: typing.Optional[int] = pydantic.Field(default=None) + """ + The first time a user replied to this message if the content was able to receive replies. + """ + + first_completion: typing.Optional[int] = pydantic.Field(default=None) + """ + The first time a user completed this message if the content was able to be completed e.g. Tours, Surveys. + """ + + first_series_completion: typing.Optional[int] = pydantic.Field(default=None) + """ + The first time the series this message was a part of was completed by the user. + """ + + first_series_disengagement: typing.Optional[int] = pydantic.Field(default=None) + """ + The first time the series this message was a part of was disengaged by the user. + """ + + first_series_exit: typing.Optional[int] = pydantic.Field(default=None) + """ + The first time the series this message was a part of was exited by the user. + """ + + first_goal_success: typing.Optional[int] = pydantic.Field(default=None) + """ + The first time the user met this messages associated goal if one exists. + """ + + first_open: typing.Optional[int] = pydantic.Field(default=None) + """ + The first time the user opened this message. + """ + + first_click: typing.Optional[int] = pydantic.Field(default=None) + """ + The first time the series the user clicked on a link within this message. + """ + + first_dismisall: typing.Optional[int] = pydantic.Field(default=None) + """ + The first time the series the user dismissed this message. + """ + + first_unsubscribe: typing.Optional[int] = pydantic.Field(default=None) + """ + The first time the user unsubscribed from this message. + """ + + first_hard_bounce: typing.Optional[int] = pydantic.Field(default=None) + """ + The first time this message hard bounced for this user + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/data_table_component.py b/src/intercom/types/data_table_component.py new file mode 100644 index 0000000..0ebe884 --- /dev/null +++ b/src/intercom/types/data_table_component.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .data_table_item import DataTableItem + + +class DataTableComponent(UncheckedBaseModel): + """ + A data-table component is used for rendering a table of key-value pairs. For Messenger, text will wrap around on multiple lines. For Inbox and Frame (ie. Configure) views, we will truncate and use tooltips on hover if the text overflows. + """ + + items: typing.List[DataTableItem] = pydantic.Field() + """ + The items that will be rendered in the data-table. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/data_table_item.py b/src/intercom/types/data_table_item.py new file mode 100644 index 0000000..eb416f2 --- /dev/null +++ b/src/intercom/types/data_table_item.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DataTableItem(UncheckedBaseModel): + """ + A field-value pair component for use in a data table. + """ + + type: typing.Literal["field-value"] = pydantic.Field(default="field-value") + """ + The type of component you are rendering. + """ + + field: str = pydantic.Field() + """ + The text of the key in your key-value pair. + """ + + value: str = pydantic.Field() + """ + The text of the value in your key-value pair. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/deleted_article_object.py b/src/intercom/types/deleted_article_object.py new file mode 100644 index 0000000..13bf420 --- /dev/null +++ b/src/intercom/types/deleted_article_object.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeletedArticleObject(UncheckedBaseModel): + """ + Response returned when an object is deleted + """ + + id: str = pydantic.Field() + """ + The unique identifier for the article which you provided in the URL. + """ + + object: typing.Literal["article"] = pydantic.Field(default="article") + """ + The type of object which was deleted. - article + """ + + deleted: bool = pydantic.Field() + """ + Whether the article was deleted successfully or not. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/deleted_collection_object.py b/src/intercom/types/deleted_collection_object.py new file mode 100644 index 0000000..509a2fc --- /dev/null +++ b/src/intercom/types/deleted_collection_object.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeletedCollectionObject(UncheckedBaseModel): + """ + Response returned when an object is deleted + """ + + id: str = pydantic.Field() + """ + The unique identifier for the collection which you provided in the URL. + """ + + object: typing.Literal["collection"] = pydantic.Field(default="collection") + """ + The type of object which was deleted. - `collection` + """ + + deleted: bool = pydantic.Field() + """ + Whether the collection was deleted successfully or not. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/deleted_company_object.py b/src/intercom/types/deleted_company_object.py new file mode 100644 index 0000000..e173078 --- /dev/null +++ b/src/intercom/types/deleted_company_object.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeletedCompanyObject(UncheckedBaseModel): + """ + Response returned when an object is deleted + """ + + id: str = pydantic.Field() + """ + The unique identifier for the company which is given by Intercom. + """ + + object: typing.Literal["company"] = pydantic.Field(default="company") + """ + The type of object which was deleted. - `company` + """ + + deleted: bool = pydantic.Field() + """ + Whether the company was deleted successfully or not. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/deleted_object.py b/src/intercom/types/deleted_object.py new file mode 100644 index 0000000..c3ed7d6 --- /dev/null +++ b/src/intercom/types/deleted_object.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeletedObject(UncheckedBaseModel): + """ + Response returned when an object is deleted + """ + + id: str = pydantic.Field() + """ + The unique identifier for the news item which you provided in the URL. + """ + + object: typing.Literal["news-item"] = pydantic.Field(default="news-item") + """ + The type of object which was deleted - news-item. + """ + + deleted: bool = pydantic.Field() + """ + Whether the news item was deleted successfully or not. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/divider_component.py b/src/intercom/types/divider_component.py new file mode 100644 index 0000000..ef729f1 --- /dev/null +++ b/src/intercom/types/divider_component.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DividerComponent(UncheckedBaseModel): + """ + A divider component is used to separate components with a line. + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + A unique identifier for the component. + """ + + bottom_margin: typing.Optional[typing.Literal["none"]] = pydantic.Field(default=None) + """ + Disables a component's margin-bottom of 10px. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/dropdown_component.py b/src/intercom/types/dropdown_component.py new file mode 100644 index 0000000..dd170e7 --- /dev/null +++ b/src/intercom/types/dropdown_component.py @@ -0,0 +1,56 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dropdown_component_save_state import DropdownComponentSaveState +from .dropdown_option import DropdownOption + + +class DropdownComponent(UncheckedBaseModel): + """ + A dropdown component is used to capture a choice from the options that you provide. + + When submitted, the dropdown choices are returned in a hash with the id from the dropdown component used as the key and the id from the chosen option as the value. + """ + + id: str = pydantic.Field() + """ + A unique identifier for the component. + """ + + options: typing.List[DropdownOption] = pydantic.Field() + """ + The list of options. Can provide 2 to 10. + """ + + label: typing.Optional[str] = pydantic.Field(default=None) + """ + The text shown above the dropdown. + """ + + value: typing.Optional[str] = pydantic.Field(default=None) + """ + The option that is selected by default. + """ + + save_state: typing.Optional[DropdownComponentSaveState] = pydantic.Field(default=None) + """ + Styles all options and prevents the action. Default is `unsaved`. Will be overridden if `save_state` is `saved`. + """ + + disabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Styles all options and prevents the action. Default is false. Will be overridden if save_state is saved. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/dropdown_component_save_state.py b/src/intercom/types/dropdown_component_save_state.py new file mode 100644 index 0000000..acd8e89 --- /dev/null +++ b/src/intercom/types/dropdown_component_save_state.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DropdownComponentSaveState = typing.Union[typing.Literal["unsaved", "saved", "failed"], typing.Any] diff --git a/src/intercom/types/dropdown_option.py b/src/intercom/types/dropdown_option.py new file mode 100644 index 0000000..324abfa --- /dev/null +++ b/src/intercom/types/dropdown_option.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DropdownOption(UncheckedBaseModel): + """ + A dropdown option component that can be selected. + """ + + type: typing.Literal["option"] = pydantic.Field(default="option") + """ + The type of component you are rendering. + """ + + id: str = pydantic.Field() + """ + A unique identifier for the option. + """ + + text: str = pydantic.Field() + """ + The text shown within this option. + """ + + disabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Styles the option and prevents the action. Default is false. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/error.py b/src/intercom/types/error.py new file mode 100644 index 0000000..a374acf --- /dev/null +++ b/src/intercom/types/error.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .error_errors_item import ErrorErrorsItem + + +class Error(UncheckedBaseModel): + """ + The API will return an Error List for a failed request, which will contain one or more Error objects. + """ + + type: typing.Literal["error.list"] = pydantic.Field(default="error.list") + """ + The type is error.list + """ + + request_id: typing.Optional[str] = pydantic.Field(default=None) + """ + + """ + + errors: typing.List[ErrorErrorsItem] = pydantic.Field() + """ + An array of one or more error objects + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/error_errors_item.py b/src/intercom/types/error_errors_item.py new file mode 100644 index 0000000..85607be --- /dev/null +++ b/src/intercom/types/error_errors_item.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ErrorErrorsItem(UncheckedBaseModel): + code: str = pydantic.Field() + """ + A string indicating the kind of error, used to further qualify the HTTP response code + """ + + message: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional. Human readable description of the error. + """ + + field: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional. Used to identify a particular field or query parameter that was in error. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/event.py b/src/intercom/types/event.py new file mode 100644 index 0000000..96d58e4 --- /dev/null +++ b/src/intercom/types/event.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class Event(UncheckedBaseModel): + """ + The event object enables Intercom to know more about the actions that took place in your app. Currently, you can only tell us when an app's flow has been completed. + """ + + type: typing.Literal["completed"] = pydantic.Field(default="completed") + """ + What action took place. The only value currently accepted is `completed`. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/file_attribute.py b/src/intercom/types/file_attribute.py new file mode 100644 index 0000000..8ba2af0 --- /dev/null +++ b/src/intercom/types/file_attribute.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class FileAttribute(UncheckedBaseModel): + """ + The value describing a file upload set for a custom attribute + """ + + type: str + name: str = pydantic.Field() + """ + The name of the file + """ + + url: str = pydantic.Field() + """ + The url of the file. This is a temporary URL and will expire after 30 minutes. + """ + + content_type: str = pydantic.Field() + """ + The type of file + """ + + filesize: int = pydantic.Field() + """ + The size of the file in bytes + """ + + width: int = pydantic.Field() + """ + The width of the file in pixels, if applicable + """ + + height: int = pydantic.Field() + """ + The height of the file in pixels, if applicable + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/group_content.py b/src/intercom/types/group_content.py new file mode 100644 index 0000000..d06dca4 --- /dev/null +++ b/src/intercom/types/group_content.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class GroupContent(UncheckedBaseModel): + """ + The Content of a Group. + """ + + type: typing.Literal["group_content"] = pydantic.Field(default="group_content") + """ + The type of object - `group_content` . + """ + + name: str = pydantic.Field() + """ + The name of the collection or section. + """ + + description: str = pydantic.Field() + """ + The description of the collection. Only available for collections. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/group_translated_content.py b/src/intercom/types/group_translated_content.py new file mode 100644 index 0000000..7bc6b60 --- /dev/null +++ b/src/intercom/types/group_translated_content.py @@ -0,0 +1,221 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .group_content import GroupContent + + +class GroupTranslatedContent(UncheckedBaseModel): + """ + The Translated Content of an Group. The keys are the locale codes and the values are the translated content of the Group. + """ + + type: typing.Literal["group_translated_content"] = pydantic.Field(default="group_translated_content") + """ + The type of object - group_translated_content. + """ + + ar: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Arabic + """ + + bg: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Bulgarian + """ + + bs: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Bosnian + """ + + ca: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Catalan + """ + + cs: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Czech + """ + + da: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Danish + """ + + de: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in German + """ + + el: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Greek + """ + + en: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in English + """ + + es: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Spanish + """ + + et: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Estonian + """ + + fi: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Finnish + """ + + fr: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in French + """ + + he: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Hebrew + """ + + hr: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Croatian + """ + + hu: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Hungarian + """ + + id: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Indonesian + """ + + it: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Italian + """ + + ja: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Japanese + """ + + ko: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Korean + """ + + lt: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Lithuanian + """ + + lv: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Latvian + """ + + mn: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Mongolian + """ + + nb: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Norwegian + """ + + nl: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Dutch + """ + + pl: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Polish + """ + + pt: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Portuguese (Portugal) + """ + + ro: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Romanian + """ + + ru: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Russian + """ + + sl: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Slovenian + """ + + sr: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Serbian + """ + + sv: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Swedish + """ + + tr: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Turkish + """ + + vi: typing.Optional[GroupContent] = pydantic.Field(default=None) + """ + The content of the group in Vietnamese + """ + + pt_br: typing_extensions.Annotated[typing.Optional[GroupContent], FieldMetadata(alias="pt-BR")] = pydantic.Field( + default=None + ) + """ + The content of the group in Portuguese (Brazil) + """ + + zh_cn: typing_extensions.Annotated[typing.Optional[GroupContent], FieldMetadata(alias="zh-CN")] = pydantic.Field( + default=None + ) + """ + The content of the group in Chinese (China) + """ + + zh_tw: typing_extensions.Annotated[typing.Optional[GroupContent], FieldMetadata(alias="zh-TW")] = pydantic.Field( + default=None + ) + """ + The content of the group in Chinese (Taiwan) + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/image_component.py b/src/intercom/types/image_component.py new file mode 100644 index 0000000..74b796c --- /dev/null +++ b/src/intercom/types/image_component.py @@ -0,0 +1,67 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .image_component_align import ImageComponentAlign +from .url_action_component import UrlActionComponent + + +class ImageComponent(UncheckedBaseModel): + """ + An image component is used to display an image. + + HTTPS Images: + If your request URLs (or website URLs) are over HTTPS, you will need to ensure that images are loaded over HTTPS likewise. Otherwise, they will not work. + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + A unique identifier for the component. + """ + + url: str = pydantic.Field() + """ + The URL where the image is located. + """ + + align: typing.Optional[ImageComponentAlign] = pydantic.Field(default=None) + """ + Aligns the image inside the component. Default is `left`. + """ + + width: int = pydantic.Field() + """ + The exact width of the image in pixels. + """ + + height: int = pydantic.Field() + """ + The exact height of the image in pixels. + """ + + rounded: typing.Optional[bool] = pydantic.Field(default=None) + """ + Rounds the corners of the image. Default is `false`. + """ + + bottom_margin: typing.Optional[typing.Literal["none"]] = pydantic.Field(default=None) + """ + Disables a component's margin-bottom of 10px. + """ + + action: typing.Optional[UrlActionComponent] = pydantic.Field(default=None) + """ + This can be a URL Action only. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/image_component_align.py b/src/intercom/types/image_component_align.py new file mode 100644 index 0000000..2464853 --- /dev/null +++ b/src/intercom/types/image_component_align.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ImageComponentAlign = typing.Union[typing.Literal["left", "center", "right", "full_width"], typing.Any] diff --git a/src/intercom/types/initialize_request.py b/src/intercom/types/initialize_request.py new file mode 100644 index 0000000..ac06b2d --- /dev/null +++ b/src/intercom/types/initialize_request.py @@ -0,0 +1,61 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..admins.types.admin import Admin +from ..contacts.types.contact import Contact +from ..conversations.types.conversation import Conversation +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .context import Context + + +class InitializeRequest(UncheckedBaseModel): + """ + The request payload will have all the data needed for you to understand who is using your app, where they are using it, and how you should respond. There are different request payloads for Messenger capabilities and Inbox capabilities. + """ + + workspace_id: str = pydantic.Field() + """ + The workspace ID of the teammate. Attribute is `app_id` for V1.2 and below. + """ + + workspace_region: str = pydantic.Field() + """ + The Intercom hosted region that this app is located in. + """ + + admin: Admin = pydantic.Field() + """ + The Intercom teammate viewing the conversation. + """ + + card_creation_options: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + """ + Key-value pairs which were given as results in response to the Configure request. + """ + + context: Context = pydantic.Field() + """ + The context of where the app is added, where the user last visited, and information on the Messenger settings. + """ + + conversation: Conversation = pydantic.Field() + """ + The conversation your app is being shown for. + """ + + contact: Contact = pydantic.Field() + """ + The contact which is currently being viewed by the teammate in the conversation details panel. We send an individual initialize request for each customer when it's a group conversation. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/initialize_response.py b/src/intercom/types/initialize_response.py new file mode 100644 index 0000000..b7f9adf --- /dev/null +++ b/src/intercom/types/initialize_response.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .canvas_object import CanvasObject + + +class InitializeResponse(UncheckedBaseModel): + """ + The response object returned when initializing an app, specifying the UI for the first screen using components. + """ + + canvas: CanvasObject = pydantic.Field() + """ + The canvas object that defines the UI to be shown for the app. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/input_component.py b/src/intercom/types/input_component.py new file mode 100644 index 0000000..d9e3eed --- /dev/null +++ b/src/intercom/types/input_component.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .action_component import ActionComponent +from .input_component_save_state import InputComponentSaveState + + +class InputComponent(UncheckedBaseModel): + """ + An input component is used to capture text input from the end user. You can submit the value of the input by: + + - Adding an `action` to the input component (which will render an inline button) + - Using a ButtonComponent (which will submit all interactive components in the canvas) + """ + + id: str = pydantic.Field() + """ + A unique identifier for the component. + """ + + label: typing.Optional[str] = pydantic.Field(default=None) + """ + The text shown above the input. + """ + + placeholder: typing.Optional[str] = pydantic.Field(default=None) + """ + An example value shown inside the component when it's empty. + """ + + value: typing.Optional[str] = pydantic.Field(default=None) + """ + An entered value which is already inside the component. + """ + + action: typing.Optional[ActionComponent] = pydantic.Field(default=None) + """ + This can be a Submit Action, URL Action, or Sheets Action. + """ + + save_state: typing.Optional[InputComponentSaveState] = pydantic.Field(default=None) + """ + Styles the input. Default is `unsaved`. Prevent action with `saved`. + """ + + disabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Styles the input and prevents the action. Default is false. Will be overridden if save_state is saved. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/input_component_save_state.py b/src/intercom/types/input_component_save_state.py new file mode 100644 index 0000000..eee1e9a --- /dev/null +++ b/src/intercom/types/input_component_save_state.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +InputComponentSaveState = typing.Union[typing.Literal["unsaved", "saved", "failed"], typing.Any] diff --git a/src/intercom/types/linked_object.py b/src/intercom/types/linked_object.py new file mode 100644 index 0000000..bc8f836 --- /dev/null +++ b/src/intercom/types/linked_object.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .linked_object_type import LinkedObjectType + + +class LinkedObject(UncheckedBaseModel): + """ + A linked conversation or ticket. + """ + + type: LinkedObjectType = pydantic.Field() + """ + ticket or conversation + """ + + id: str = pydantic.Field() + """ + The ID of the linked object + """ + + category: typing.Optional[str] = pydantic.Field(default=None) + """ + Category of the Linked Ticket Object. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/linked_object_list.py b/src/intercom/types/linked_object_list.py new file mode 100644 index 0000000..660b7ec --- /dev/null +++ b/src/intercom/types/linked_object_list.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .linked_object import LinkedObject + + +class LinkedObjectList(UncheckedBaseModel): + """ + An object containing metadata about linked conversations and linked tickets. Up to 1000 can be returned. + """ + + type: typing.Literal["list"] = pydantic.Field(default="list") + """ + Always list. + """ + + total_count: int = pydantic.Field() + """ + The total number of linked objects. + """ + + has_more: bool = pydantic.Field() + """ + Whether or not there are more linked objects than returned. + """ + + data: typing.List[LinkedObject] = pydantic.Field() + """ + An array containing the linked conversations and linked tickets. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/linked_object_type.py b/src/intercom/types/linked_object_type.py new file mode 100644 index 0000000..16749f1 --- /dev/null +++ b/src/intercom/types/linked_object_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +LinkedObjectType = typing.Union[typing.Literal["ticket", "conversation"], typing.Any] diff --git a/src/intercom/types/list_component.py b/src/intercom/types/list_component.py new file mode 100644 index 0000000..69f3393 --- /dev/null +++ b/src/intercom/types/list_component.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .list_component_items_item import ListComponentItemsItem + + +class ListComponent(UncheckedBaseModel): + """ + A list component renders a list of items which you provide in an array. You can make each list item take an action by adding the relevant action object to the item: + + - [Trigger a submit request to be sent](https://developers.intercom.com/docs/references/canvas-kit/actioncomponents/submit-action) Inbox Messenger + - [Open a link in a new page](https://developers.intercom.com/docs/references/canvas-kit/actioncomponents/url-action) Inbox Messenger + - [Open a sheet](https://developers.intercom.com/docs/references/canvas-kit/actioncomponents/sheets-action) Messenger + """ + + items: typing.List[ListComponentItemsItem] = pydantic.Field() + """ + The items that will be rendered in the list. + """ + + disabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Styles all list items and prevents the action. Default is `false`. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/list_component_items_item.py b/src/intercom/types/list_component_items_item.py new file mode 100644 index 0000000..8549e33 --- /dev/null +++ b/src/intercom/types/list_component_items_item.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .list_item_with_image import ListItemWithImage +from .list_item_without_image import ListItemWithoutImage + +ListComponentItemsItem = typing.Union[ListItemWithImage, ListItemWithoutImage] diff --git a/src/intercom/types/list_item.py b/src/intercom/types/list_item.py new file mode 100644 index 0000000..f2263d3 --- /dev/null +++ b/src/intercom/types/list_item.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .action_component import ActionComponent + + +class ListItem(UncheckedBaseModel): + """ + A list item component that can be rendered in a list. + """ + + type: typing.Literal["item"] = pydantic.Field(default="item") + """ + The type of component you are rendering. + """ + + id: str = pydantic.Field() + """ + A unique identifier for the item. + """ + + title: str = pydantic.Field() + """ + The text shown as the title for the item. + """ + + subtitle: typing.Optional[str] = pydantic.Field(default=None) + """ + The text shown underneath the item's title. + """ + + tertiary_text: typing.Optional[str] = pydantic.Field(default=None) + """ + The text shown next to the subtitle, separates by a bullet. + """ + + rounded_image: typing.Optional[bool] = pydantic.Field(default=None) + """ + Rounds the corners of the image. Default is `false`. + """ + + disabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Styles all list items and prevents the action. Default is `false`. + """ + + action: typing.Optional[ActionComponent] = pydantic.Field(default=None) + """ + This can be a Submit Action, URL Action, or Sheets Action. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/list_item_with_image.py b/src/intercom/types/list_item_with_image.py new file mode 100644 index 0000000..e69d8a9 --- /dev/null +++ b/src/intercom/types/list_item_with_image.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from .list_item import ListItem + + +class ListItemWithImage(ListItem): + image: str = pydantic.Field() + """ + An image that will be displayed to the left of the item. + """ + + image_width: int = pydantic.Field() + """ + The exact width of the image in pixels. + """ + + image_height: int = pydantic.Field() + """ + The exact height of the image in pixels. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/list_item_without_image.py b/src/intercom/types/list_item_without_image.py new file mode 100644 index 0000000..ee43156 --- /dev/null +++ b/src/intercom/types/list_item_without_image.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from .list_item import ListItem + + +class ListItemWithoutImage(ListItem): + image: typing.Optional[str] = pydantic.Field(default=None) + """ + An image that will be displayed to the left of the item. + """ + + image_width: typing.Optional[int] = pydantic.Field(default=None) + """ + The exact width of the image in pixels. + """ + + image_height: typing.Optional[int] = pydantic.Field(default=None) + """ + The exact height of the image in pixels. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/live_canvas_request.py b/src/intercom/types/live_canvas_request.py new file mode 100644 index 0000000..998c617 --- /dev/null +++ b/src/intercom/types/live_canvas_request.py @@ -0,0 +1,52 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..contacts.types.contact import Contact +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .canvas_object import CanvasObject +from .context import Context + + +class LiveCanvasRequest(UncheckedBaseModel): + """ + Canvases are static by default and require a new request to come through in order to update them. Live canvases however will make requests every time the card is viewed without any interaction needed, meaning the canvas can be kept up-to-date with no action from the user. + + This works for every Messenger request that you can respond with a canvas object to. Instead of returning the content object within the canvas object, you should provide a `content_url` attribute instead with the value being the URL you want us to send a POST request to when someone views the app. + """ + + workspace_id: str = pydantic.Field() + """ + The workspace ID of the teammate. Attribute is `app_id` for V1.2 and below. + """ + + workspace_region: str = pydantic.Field() + """ + The Intercom hosted region that this app is located in. + """ + + canvas: CanvasObject = pydantic.Field() + """ + The current_canvas the teammate can see. + """ + + context: Context = pydantic.Field() + """ + The context of where the app is added, where the user last visited, and information on the Messenger settings. + """ + + contact: Contact = pydantic.Field() + """ + The contact who viewed the card. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/live_canvas_response.py b/src/intercom/types/live_canvas_response.py new file mode 100644 index 0000000..4f8d833 --- /dev/null +++ b/src/intercom/types/live_canvas_response.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .content_object import ContentObject + + +class LiveCanvasResponse(UncheckedBaseModel): + """ + The response object returned when responding to a Live Canvas request. This contains the components you want to show. + """ + + content: ContentObject = pydantic.Field() + """ + The content object that defines the components to be shown. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/metadata.py b/src/intercom/types/metadata.py new file mode 100644 index 0000000..cf4ab6d --- /dev/null +++ b/src/intercom/types/metadata.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..unstable.types.conversation_part_metadata import ConversationPartMetadata + +Metadata = ConversationPartMetadata diff --git a/src/intercom/types/multiple_filter_search_request.py b/src/intercom/types/multiple_filter_search_request.py new file mode 100644 index 0000000..9ed97b0 --- /dev/null +++ b/src/intercom/types/multiple_filter_search_request.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .multiple_filter_search_request_operator import MultipleFilterSearchRequestOperator + + +class MultipleFilterSearchRequest(UncheckedBaseModel): + """ + Search using Intercoms Search APIs with more than one filter. + """ + + operator: typing.Optional[MultipleFilterSearchRequestOperator] = pydantic.Field(default=None) + """ + An operator to allow boolean inspection between multiple fields. + """ + + value: typing.Optional[typing.List["MultipleOrSingleFilterSearchRequest"]] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +from .multiple_or_single_filter_search_request import MultipleOrSingleFilterSearchRequest # noqa: E402, F401, I001 + +update_forward_refs(MultipleFilterSearchRequest) diff --git a/src/intercom/types/multiple_filter_search_request_operator.py b/src/intercom/types/multiple_filter_search_request_operator.py new file mode 100644 index 0000000..38d4659 --- /dev/null +++ b/src/intercom/types/multiple_filter_search_request_operator.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +MultipleFilterSearchRequestOperator = typing.Union[typing.Literal["AND", "OR"], typing.Any] diff --git a/src/intercom/types/multiple_or_single_filter_search_request.py b/src/intercom/types/multiple_or_single_filter_search_request.py new file mode 100644 index 0000000..1d6d20f --- /dev/null +++ b/src/intercom/types/multiple_or_single_filter_search_request.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from .single_filter_search_request import SingleFilterSearchRequest + +if typing.TYPE_CHECKING: + from .multiple_filter_search_request import MultipleFilterSearchRequest +MultipleOrSingleFilterSearchRequest = typing.Union["MultipleFilterSearchRequest", SingleFilterSearchRequest] diff --git a/src/intercom/types/news_item_request.py b/src/intercom/types/news_item_request.py new file mode 100644 index 0000000..284e24a --- /dev/null +++ b/src/intercom/types/news_item_request.py @@ -0,0 +1,64 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from ..news.types.newsfeed_assignment import NewsfeedAssignment +from .news_item_request_state import NewsItemRequestState + + +class NewsItemRequest(UncheckedBaseModel): + """ + A News Item is a content type in Intercom enabling you to announce product updates, company news, promotions, events and more with your customers. + """ + + title: str = pydantic.Field() + """ + The title of the news item. + """ + + body: typing.Optional[str] = pydantic.Field(default=None) + """ + The news item body, which may contain HTML. + """ + + sender_id: int = pydantic.Field() + """ + The id of the sender of the news item. Must be a teammate on the workspace. + """ + + state: typing.Optional[NewsItemRequestState] = pydantic.Field(default=None) + """ + News items will not be visible to your users in the assigned newsfeeds until they are set live. + """ + + deliver_silently: typing.Optional[bool] = pydantic.Field(default=None) + """ + When set to `true`, the news item will appear in the messenger newsfeed without showing a notification badge. + """ + + labels: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Label names displayed to users to categorize the news item. + """ + + reactions: typing.Optional[typing.List[typing.Optional[str]]] = pydantic.Field(default=None) + """ + Ordered list of emoji reactions to the news item. When empty, reactions are disabled. + """ + + newsfeed_assignments: typing.Optional[typing.List[NewsfeedAssignment]] = pydantic.Field(default=None) + """ + A list of newsfeed_assignments to assign to the specified newsfeed. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/news_item_request_state.py b/src/intercom/types/news_item_request_state.py new file mode 100644 index 0000000..0c6a233 --- /dev/null +++ b/src/intercom/types/news_item_request_state.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +NewsItemRequestState = typing.Union[typing.Literal["draft", "live"], typing.Any] diff --git a/src/intercom/types/note_list.py b/src/intercom/types/note_list.py new file mode 100644 index 0000000..b095fe0 --- /dev/null +++ b/src/intercom/types/note_list.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from ..notes.types.note import Note + + +class NoteList(UncheckedBaseModel): + """ + A paginated list of notes associated with a contact. + """ + + type: typing.Literal["list"] = pydantic.Field(default="list") + """ + String representing the object's type. Always has the value `list`. + """ + + data: typing.List[Note] = pydantic.Field() + """ + An array of notes. + """ + + total_count: int = pydantic.Field() + """ + A count of the total number of notes. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/offset_pages.py b/src/intercom/types/offset_pages.py new file mode 100644 index 0000000..b340bc8 --- /dev/null +++ b/src/intercom/types/offset_pages.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class OffsetPages(UncheckedBaseModel): + type: typing.Literal["offset_pages"] = pydantic.Field(default="offset_pages") + """ + the type of object `offset_pages` + """ + + page: typing.Optional[int] = pydantic.Field(default=None) + """ + The current offset + """ + + next: typing.Optional[str] = None + per_page: typing.Optional[int] = pydantic.Field(default=None) + """ + Number of results per page + """ + + total_pages: typing.Optional[int] = pydantic.Field(default=None) + """ + Total number of pages + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/open_conversation_request.py b/src/intercom/types/open_conversation_request.py new file mode 100644 index 0000000..4f15d73 --- /dev/null +++ b/src/intercom/types/open_conversation_request.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class OpenConversationRequest(UncheckedBaseModel): + """ + Payload of the request to open a conversation + """ + + admin_id: str = pydantic.Field() + """ + The id of the admin who is performing the action. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/pages_link.py b/src/intercom/types/pages_link.py new file mode 100644 index 0000000..f041d00 --- /dev/null +++ b/src/intercom/types/pages_link.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PagesLink(UncheckedBaseModel): + """ + The majority of list resources in the API are paginated to allow clients to traverse data over multiple requests. + + Their responses are likely to contain a pages object that hosts pagination links which a client can use to paginate through the data without having to construct a query. The link relations for the pages field are as follows. + """ + + type: typing.Literal["pages"] = "pages" + page: int + next: typing.Optional[str] = pydantic.Field(default=None) + """ + A link to the next page of results. A response that does not contain a next link does not have further data to fetch. + """ + + per_page: int + total_pages: int + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/paginated_conversation_response.py b/src/intercom/types/paginated_conversation_response.py new file mode 100644 index 0000000..d07c35d --- /dev/null +++ b/src/intercom/types/paginated_conversation_response.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..conversations.types.conversation import Conversation +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .cursor_pages import CursorPages + + +class PaginatedConversationResponse(UncheckedBaseModel): + """ + Conversations are how you can communicate with users in Intercom. They are created when a contact replies to an outbound message, or when one admin directly sends a message to a single contact. + """ + + type: typing.Literal["conversation.list"] = pydantic.Field(default="conversation.list") + """ + Always conversation.list + """ + + conversations: typing.List[Conversation] = pydantic.Field() + """ + The list of conversation objects + """ + + total_count: int = pydantic.Field() + """ + A count of the total number of objects. + """ + + pages: typing.Optional[CursorPages] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/paginated_news_item_response.py b/src/intercom/types/paginated_news_item_response.py new file mode 100644 index 0000000..1cf9dcd --- /dev/null +++ b/src/intercom/types/paginated_news_item_response.py @@ -0,0 +1,40 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from ..news.types.news_item import NewsItem +from .cursor_pages import CursorPages + + +class PaginatedNewsItemResponse(UncheckedBaseModel): + """ + Paginated News Item Response + """ + + type: typing.Literal["list"] = pydantic.Field(default="list") + """ + The type of object + """ + + pages: typing.Optional[CursorPages] = None + total_count: int = pydantic.Field() + """ + A count of the total number of News Items. + """ + + data: typing.List[NewsItem] = pydantic.Field() + """ + An array of News Items + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/paginated_newsfeed_response.py b/src/intercom/types/paginated_newsfeed_response.py new file mode 100644 index 0000000..4da53c3 --- /dev/null +++ b/src/intercom/types/paginated_newsfeed_response.py @@ -0,0 +1,40 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from ..news.types.newsfeed import Newsfeed +from .cursor_pages import CursorPages + + +class PaginatedNewsfeedResponse(UncheckedBaseModel): + """ + Paginated Newsfeed Response + """ + + type: typing.Literal["list"] = pydantic.Field(default="list") + """ + The type of object + """ + + pages: typing.Optional[CursorPages] = None + total_count: int = pydantic.Field() + """ + A count of the total number of Newsfeeds. + """ + + data: typing.List[Newsfeed] = pydantic.Field() + """ + An array of Newsfeeds + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/part_attachment.py b/src/intercom/types/part_attachment.py new file mode 100644 index 0000000..0c4495f --- /dev/null +++ b/src/intercom/types/part_attachment.py @@ -0,0 +1,57 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PartAttachment(UncheckedBaseModel): + """ + The file attached to a part + """ + + type: str = pydantic.Field() + """ + The type of attachment + """ + + name: str = pydantic.Field() + """ + The name of the attachment + """ + + url: str = pydantic.Field() + """ + The URL of the attachment + """ + + content_type: str = pydantic.Field() + """ + The content type of the attachment + """ + + filesize: int = pydantic.Field() + """ + The size of the attachment + """ + + width: int = pydantic.Field() + """ + The width of the attachment + """ + + height: int = pydantic.Field() + """ + The height of the attachment + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/phone_switch.py b/src/intercom/types/phone_switch.py new file mode 100644 index 0000000..a8cfb40 --- /dev/null +++ b/src/intercom/types/phone_switch.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PhoneSwitch(UncheckedBaseModel): + """ + Phone Switch Response + """ + + type: typing.Literal["phone_call_redirect"] = pydantic.Field(default="phone_call_redirect") + """ + + """ + + phone: str = pydantic.Field() + """ + Phone number in E.164 format, that has received the SMS to continue the conversation in the Messenger. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/redact_conversation_request.py b/src/intercom/types/redact_conversation_request.py new file mode 100644 index 0000000..54e3107 --- /dev/null +++ b/src/intercom/types/redact_conversation_request.py @@ -0,0 +1,46 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class RedactConversationRequest_ConversationPart(UncheckedBaseModel): + type: typing.Literal["conversation_part"] = "conversation_part" + conversation_id: str + conversation_part_id: str + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class RedactConversationRequest_Source(UncheckedBaseModel): + type: typing.Literal["source"] = "source" + conversation_id: str + source_id: str + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +RedactConversationRequest = typing_extensions.Annotated[ + typing.Union[RedactConversationRequest_ConversationPart, RedactConversationRequest_Source], + UnionMetadata(discriminant="type"), +] diff --git a/src/intercom/types/redact_conversation_request_conversation_part.py b/src/intercom/types/redact_conversation_request_conversation_part.py new file mode 100644 index 0000000..2be9204 --- /dev/null +++ b/src/intercom/types/redact_conversation_request_conversation_part.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class RedactConversationRequestConversationPart(UncheckedBaseModel): + """ + Payload of the request to redact a conversation part + """ + + conversation_id: str = pydantic.Field() + """ + The id of the conversation. + """ + + conversation_part_id: str = pydantic.Field() + """ + The id of the conversation_part. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/redact_conversation_request_source.py b/src/intercom/types/redact_conversation_request_source.py new file mode 100644 index 0000000..f5c3866 --- /dev/null +++ b/src/intercom/types/redact_conversation_request_source.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class RedactConversationRequestSource(UncheckedBaseModel): + """ + Payload of the request to redact a conversation source + """ + + conversation_id: str = pydantic.Field() + """ + The id of the conversation. + """ + + source_id: str = pydantic.Field() + """ + The id of the source. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/reference.py b/src/intercom/types/reference.py new file mode 100644 index 0000000..2905e15 --- /dev/null +++ b/src/intercom/types/reference.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class Reference(UncheckedBaseModel): + """ + reference to another object + """ + + type: str = pydantic.Field() + """ + + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/reply_conversation_request.py b/src/intercom/types/reply_conversation_request.py new file mode 100644 index 0000000..e90aa4c --- /dev/null +++ b/src/intercom/types/reply_conversation_request.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .admin_reply_conversation_request import AdminReplyConversationRequest +from .contact_reply_conversation_request import ContactReplyConversationRequest + +ReplyConversationRequest = typing.Union[ContactReplyConversationRequest, AdminReplyConversationRequest] diff --git a/src/intercom/types/results_response.py b/src/intercom/types/results_response.py new file mode 100644 index 0000000..f6631fc --- /dev/null +++ b/src/intercom/types/results_response.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ResultsResponse(UncheckedBaseModel): + """ + The results object should be sent when you want to end configuration of the app and trigger the [Initialize request](https://developers.intercom.com/docs/canvas-kit/#initialize) to be sent. You provide the key-value pairs of data you want access to and we will send these in the Initialize request within a [card_creation_options object](https://developers.intercom.com/docs/references/canvas-kit/requestobjects/card-creation-options/#card-creation-options). + """ + + results: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + """ + Key-value pairs of data you want access to in the Initialize request + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/search_request.py b/src/intercom/types/search_request.py new file mode 100644 index 0000000..2f54c34 --- /dev/null +++ b/src/intercom/types/search_request.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .search_request_query import SearchRequestQuery +from .starting_after_paging import StartingAfterPaging + + +class SearchRequest(UncheckedBaseModel): + """ + Search using Intercoms Search APIs. + """ + + query: SearchRequestQuery + pagination: typing.Optional[StartingAfterPaging] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +from .multiple_filter_search_request import MultipleFilterSearchRequest # noqa: E402, F401, I001 + +update_forward_refs(SearchRequest) diff --git a/src/intercom/types/search_request_query.py b/src/intercom/types/search_request_query.py new file mode 100644 index 0000000..c338cbe --- /dev/null +++ b/src/intercom/types/search_request_query.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .multiple_filter_search_request import MultipleFilterSearchRequest +from .single_filter_search_request import SingleFilterSearchRequest + +SearchRequestQuery = typing.Union[SingleFilterSearchRequest, MultipleFilterSearchRequest] diff --git a/src/intercom/types/segment_list.py b/src/intercom/types/segment_list.py new file mode 100644 index 0000000..4f1c48a --- /dev/null +++ b/src/intercom/types/segment_list.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from ..segments.types.segment import Segment + + +class SegmentList(UncheckedBaseModel): + """ + This will return a list of Segment Objects. The result may also have a pages object if the response is paginated. + """ + + type: typing.Literal["segment.list"] = pydantic.Field(default="segment.list") + """ + The type of the object + """ + + segments: typing.List[Segment] = pydantic.Field() + """ + A list of Segment objects + """ + + pages: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + """ + A pagination object, which may be empty, indicating no further pages to fetch. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/sheet_action_component.py b/src/intercom/types/sheet_action_component.py new file mode 100644 index 0000000..656bd49 --- /dev/null +++ b/src/intercom/types/sheet_action_component.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SheetActionComponent(UncheckedBaseModel): + """ + A sheet action opens the link you give within the Messenger as an embedded iframe. + + [More on how Sheets work is in our Canvas Kit documentation.](https://developers.intercom.com/docs/canvas-kit#sheets-optional) + """ + + url: str = pydantic.Field() + """ + The link which hosts your sheet. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/single_filter_search_request.py b/src/intercom/types/single_filter_search_request.py new file mode 100644 index 0000000..8f17533 --- /dev/null +++ b/src/intercom/types/single_filter_search_request.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .single_filter_search_request_operator import SingleFilterSearchRequestOperator +from .single_filter_search_request_value import SingleFilterSearchRequestValue + + +class SingleFilterSearchRequest(UncheckedBaseModel): + """ + Search using Intercoms Search APIs with a single filter. + """ + + field: typing.Optional[str] = pydantic.Field(default=None) + """ + The accepted field that you want to search on. + """ + + operator: typing.Optional[SingleFilterSearchRequestOperator] = pydantic.Field(default=None) + """ + The accepted operators you can use to define how you want to search for the value. + """ + + value: typing.Optional[SingleFilterSearchRequestValue] = pydantic.Field(default=None) + """ + The value that you want to search on. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/single_filter_search_request_operator.py b/src/intercom/types/single_filter_search_request_operator.py new file mode 100644 index 0000000..3f4667d --- /dev/null +++ b/src/intercom/types/single_filter_search_request_operator.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SingleFilterSearchRequestOperator = typing.Union[ + typing.Literal["=", "!=", "IN", "NIN", "<", ">", "~", "!~", "^", "$"], typing.Any +] diff --git a/src/intercom/types/single_filter_search_request_value.py b/src/intercom/types/single_filter_search_request_value.py new file mode 100644 index 0000000..8bfa5aa --- /dev/null +++ b/src/intercom/types/single_filter_search_request_value.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SingleFilterSearchRequestValue = typing.Union[str, int, typing.List[str], typing.List[int]] diff --git a/src/intercom/types/single_select_component.py b/src/intercom/types/single_select_component.py new file mode 100644 index 0000000..ad33ef0 --- /dev/null +++ b/src/intercom/types/single_select_component.py @@ -0,0 +1,65 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .action_component import ActionComponent +from .single_select_component_save_state import SingleSelectComponentSaveState +from .single_select_option import SingleSelectOption + + +class SingleSelectComponent(UncheckedBaseModel): + """ + A single-select component is used to capture a choice from up to 10 options that you provide. You can submit the value of the select option by: + + - Adding an `action` to the single-select component + - Using a ButtonComponent (which will submit all interactive components in the canvas) + + When a submit action takes place, the results are given in a hash with the `id` from the single-select component used as the key and the `id` from the chosen option as the value. + """ + + id: str = pydantic.Field() + """ + A unique identifier for the component. + """ + + options: typing.List[SingleSelectOption] = pydantic.Field() + """ + The list of options. Can provide 2 to 10. + """ + + label: typing.Optional[str] = pydantic.Field(default=None) + """ + The text shown above the options. + """ + + value: typing.Optional[str] = pydantic.Field(default=None) + """ + The option that is selected by default. + """ + + save_state: typing.Optional[SingleSelectComponentSaveState] = pydantic.Field(default=None) + """ + Styles the input. Default is `unsaved`. Prevent action with `saved`. + """ + + disabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Styles all options and prevents the action. Default is false. Will be overridden if save_state is saved. + """ + + action: typing.Optional[ActionComponent] = pydantic.Field(default=None) + """ + This can be a Submit Action, URL Action, or Sheets Action. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/single_select_component_save_state.py b/src/intercom/types/single_select_component_save_state.py new file mode 100644 index 0000000..dc85ce8 --- /dev/null +++ b/src/intercom/types/single_select_component_save_state.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SingleSelectComponentSaveState = typing.Union[typing.Literal["unsaved", "saved", "failed"], typing.Any] diff --git a/src/intercom/types/single_select_option.py b/src/intercom/types/single_select_option.py new file mode 100644 index 0000000..fe2ef03 --- /dev/null +++ b/src/intercom/types/single_select_option.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SingleSelectOption(UncheckedBaseModel): + """ + A single select option component that can be selected. + """ + + type: typing.Literal["option"] = pydantic.Field(default="option") + """ + The type of component you are rendering. + """ + + id: str = pydantic.Field() + """ + A unique identifier for the option. + """ + + text: str = pydantic.Field() + """ + The text shown within this option. + """ + + disabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Styles the option and prevents the action. Default is false. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/sla_applied.py b/src/intercom/types/sla_applied.py new file mode 100644 index 0000000..187d1e7 --- /dev/null +++ b/src/intercom/types/sla_applied.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .sla_applied_sla_status import SlaAppliedSlaStatus + + +class SlaApplied(UncheckedBaseModel): + """ + The SLA Applied object contains the details for which SLA has been applied to this conversation. + Important: if there are any canceled sla_events for the conversation - meaning an SLA has been manually removed from a conversation, the sla_status will always be returned as null. + """ + + type: str = pydantic.Field() + """ + object type + """ + + sla_name: str = pydantic.Field() + """ + The name of the SLA as given by the teammate when it was created. + """ + + sla_status: SlaAppliedSlaStatus = pydantic.Field() + """ + SLA statuses: + - `hit`: If there’s at least one hit event in the underlying sla_events table, and no “missed” or “canceled” events for the conversation. + - `missed`: If there are any missed sla_events for the conversation and no canceled events. If there’s even a single missed sla event, the status will always be missed. A missed status is not applied when the SLA expires, only the next time a teammate replies. + - `active`: An SLA has been applied to a conversation, but has not yet been fulfilled. SLA status is active only if there are no “hit, “missed”, or “canceled” events. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/sla_applied_sla_status.py b/src/intercom/types/sla_applied_sla_status.py new file mode 100644 index 0000000..c2ad85a --- /dev/null +++ b/src/intercom/types/sla_applied_sla_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SlaAppliedSlaStatus = typing.Union[typing.Literal["hit", "missed", "cancelled", "active"], typing.Any] diff --git a/src/intercom/types/snooze_conversation_request.py b/src/intercom/types/snooze_conversation_request.py new file mode 100644 index 0000000..811a665 --- /dev/null +++ b/src/intercom/types/snooze_conversation_request.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SnoozeConversationRequest(UncheckedBaseModel): + """ + Payload of the request to snooze a conversation + """ + + admin_id: str = pydantic.Field() + """ + The id of the admin who is performing the action. + """ + + snoozed_until: int = pydantic.Field() + """ + The time you want the conversation to reopen. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/social_profile.py b/src/intercom/types/social_profile.py new file mode 100644 index 0000000..3838408 --- /dev/null +++ b/src/intercom/types/social_profile.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SocialProfile(UncheckedBaseModel): + """ + A Social Profile allows you to label your contacts, companies, and conversations and list them using that Social Profile. + """ + + type: typing.Literal["social_profile"] = pydantic.Field(default="social_profile") + """ + value is "social_profile" + """ + + name: str = pydantic.Field() + """ + The name of the Social media profile + """ + + url: str = pydantic.Field() + """ + The name of the Social media profile + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/spacer_component.py b/src/intercom/types/spacer_component.py new file mode 100644 index 0000000..0374242 --- /dev/null +++ b/src/intercom/types/spacer_component.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .spacer_component_size import SpacerComponentSize + + +class SpacerComponent(UncheckedBaseModel): + """ + A spacer component is used to create empty space between components. + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + A unique identifier for the component. + """ + + size: typing.Optional[SpacerComponentSize] = pydantic.Field(default=None) + """ + The amount of space between components. Default is `s`. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/spacer_component_size.py b/src/intercom/types/spacer_component_size.py new file mode 100644 index 0000000..3d4f5d3 --- /dev/null +++ b/src/intercom/types/spacer_component_size.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SpacerComponentSize = typing.Union[typing.Literal["xs", "s", "m", "l", "xl"], typing.Any] diff --git a/src/intercom/types/starting_after_paging.py b/src/intercom/types/starting_after_paging.py new file mode 100644 index 0000000..7e5e9cc --- /dev/null +++ b/src/intercom/types/starting_after_paging.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class StartingAfterPaging(UncheckedBaseModel): + per_page: int = pydantic.Field() + """ + The number of results to fetch per page. + """ + + starting_after: typing.Optional[str] = pydantic.Field(default=None) + """ + The cursor to use in the next request to get the next page of results. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/submit_action_component.py b/src/intercom/types/submit_action_component.py new file mode 100644 index 0000000..ea5788f --- /dev/null +++ b/src/intercom/types/submit_action_component.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SubmitActionComponent(UncheckedBaseModel): + """ + A submit action triggers a [Submit Request](https://developers.intercom.com/docs/canvas-kit#submit-request) to be sent. This request will include all values which have been entered into all the interactive components on the current canvas. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/submit_request.py b/src/intercom/types/submit_request.py new file mode 100644 index 0000000..2022592 --- /dev/null +++ b/src/intercom/types/submit_request.py @@ -0,0 +1,77 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..admins.types.admin import Admin +from ..contacts.types.contact import Contact +from ..conversations.types.conversation import Conversation +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .context import Context +from .current_canvas import CurrentCanvas + + +class SubmitRequest(UncheckedBaseModel): + """ + The Submit request is triggered when a component with a submit action is interacted with in Messenger Inbox. + """ + + workspace_id: str = pydantic.Field() + """ + The workspace ID of the teammate. Attribute is `app_id` for V1.2 and below. + """ + + workspace_region: str = pydantic.Field() + """ + The Intercom hosted region that this app is located in. + """ + + admin: Admin = pydantic.Field() + """ + The Intercom teammate viewing the conversation. + """ + + component_id: str = pydantic.Field() + """ + The id of the component clicked by the teammate to trigger the request. + """ + + context: Context = pydantic.Field() + """ + The context of where the app is added, where the user last visited, and information on the Messenger settings. + """ + + conversation: Conversation = pydantic.Field() + """ + The conversation where your app is being shown. + """ + + current_canvas: CurrentCanvas = pydantic.Field() + """ + The current canvas the teammate can see. + """ + + contact: Contact = pydantic.Field() + """ + The contact which is currently being viewed by the teammate in the conversation details panel. + """ + + input_values: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + """ + A list of key/value pairs of data, inputted by the teammate on the current canvas. + """ + + user: Contact = pydantic.Field() + """ + The user who took the action. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/submit_response.py b/src/intercom/types/submit_response.py new file mode 100644 index 0000000..3e04cf1 --- /dev/null +++ b/src/intercom/types/submit_response.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .canvas_object import CanvasObject +from .event import Event + + +class SubmitResponse(UncheckedBaseModel): + """ + The response object returned when submitting an app interaction. This will replace the previous canvas that was visible until the app was interacted with. + + You can optionally provide an event object with the attribute `type` given as `completed` to tell us if the app has completed its purpose. For example, an email collector app would be complete when the end-user submits their email address. + + Apps in conversation details can also optionally insert an app into the conversation reply: + + 1. You respond with a card_creation_options object (https://developers.intercom.com/canvas-kit-reference/reference/card-creation-options) + 2. We send a request to the initialize URL for Messenger capabilities (https://developers.intercom.com/docs/build-an-integration/getting-started/build-an-app-for-your-messenger/request-flows) with the card_creation_options object present + 3. You respond with a canvas object with the components you want to insert into the conversation reply + """ + + canvas: CanvasObject = pydantic.Field() + """ + The canvas object that defines the new UI to be shown. + """ + + card_creation_options: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + """ + Optional. Key-value pairs that will be sent in the initialize request to insert an app into the conversation reply. + """ + + event: typing.Optional[Event] = pydantic.Field(default=None) + """ + Optional. Indicates if the app has completed its purpose. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/subscription_type_list.py b/src/intercom/types/subscription_type_list.py new file mode 100644 index 0000000..c6e39c2 --- /dev/null +++ b/src/intercom/types/subscription_type_list.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from ..subscription_types.types.subscription_type import SubscriptionType + + +class SubscriptionTypeList(UncheckedBaseModel): + """ + A list of subscription type objects. + """ + + type: typing.Literal["list"] = pydantic.Field(default="list") + """ + The type of the object + """ + + data: typing.List[SubscriptionType] = pydantic.Field() + """ + A list of subscription type objects associated with the workspace . + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/tag_company_request.py b/src/intercom/types/tag_company_request.py new file mode 100644 index 0000000..4af6d20 --- /dev/null +++ b/src/intercom/types/tag_company_request.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .tag_company_request_companies_item import TagCompanyRequestCompaniesItem + + +class TagCompanyRequest(UncheckedBaseModel): + """ + You can tag a single company or a list of companies. + """ + + name: str = pydantic.Field() + """ + The name of the tag, which will be created if not found. + """ + + companies: typing.List[TagCompanyRequestCompaniesItem] = pydantic.Field() + """ + The id or company_id of the company can be passed as input parameters. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/tag_company_request_companies_item.py b/src/intercom/types/tag_company_request_companies_item.py new file mode 100644 index 0000000..b31f48b --- /dev/null +++ b/src/intercom/types/tag_company_request_companies_item.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TagCompanyRequestCompaniesItem(UncheckedBaseModel): + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The Intercom defined id representing the company. + """ + + company_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The company id you have defined for the company. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/tag_list.py b/src/intercom/types/tag_list.py new file mode 100644 index 0000000..3ad1c5d --- /dev/null +++ b/src/intercom/types/tag_list.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from ..tags.types.tag import Tag + + +class TagList(UncheckedBaseModel): + """ + A list of tags objects in the workspace. + """ + + type: typing.Literal["list"] = pydantic.Field(default="list") + """ + The type of the object + """ + + data: typing.List[Tag] = pydantic.Field() + """ + A list of tags objects associated with the workspace . + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/tag_multiple_users_request.py b/src/intercom/types/tag_multiple_users_request.py new file mode 100644 index 0000000..4a6a285 --- /dev/null +++ b/src/intercom/types/tag_multiple_users_request.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .tag_multiple_users_request_users_item import TagMultipleUsersRequestUsersItem + + +class TagMultipleUsersRequest(UncheckedBaseModel): + """ + You can tag a list of users. + """ + + name: str = pydantic.Field() + """ + The name of the tag, which will be created if not found. + """ + + users: typing.List[TagMultipleUsersRequestUsersItem] + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/tag_multiple_users_request_users_item.py b/src/intercom/types/tag_multiple_users_request_users_item.py new file mode 100644 index 0000000..9181387 --- /dev/null +++ b/src/intercom/types/tag_multiple_users_request_users_item.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TagMultipleUsersRequestUsersItem(UncheckedBaseModel): + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The Intercom defined id representing the user. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/tags.py b/src/intercom/types/tags.py new file mode 100644 index 0000000..341ec73 --- /dev/null +++ b/src/intercom/types/tags.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from ..tags.types.tag import Tag + + +class Tags(UncheckedBaseModel): + """ + A list of tags objects associated with a conversation + """ + + type: typing.Literal["tag.list"] = pydantic.Field(default="tag.list") + """ + The type of the object + """ + + tags: typing.List[Tag] = pydantic.Field() + """ + A list of tags objects associated with the conversation. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/team_list.py b/src/intercom/types/team_list.py new file mode 100644 index 0000000..e4e69ed --- /dev/null +++ b/src/intercom/types/team_list.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from ..teams.types.team import Team + + +class TeamList(UncheckedBaseModel): + """ + This will return a list of team objects for the App. + """ + + type: typing.Literal["team.list"] = pydantic.Field(default="team.list") + """ + The type of the object + """ + + teams: typing.List[Team] = pydantic.Field() + """ + A list of team objects + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/team_priority_level.py b/src/intercom/types/team_priority_level.py new file mode 100644 index 0000000..3bfb121 --- /dev/null +++ b/src/intercom/types/team_priority_level.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TeamPriorityLevel(UncheckedBaseModel): + """ + Admin priority levels for teams + """ + + primary_team_ids: typing.Optional[typing.List[int]] = pydantic.Field(default=None) + """ + The primary team ids for the team + """ + + secondary_team_ids: typing.Optional[typing.List[int]] = pydantic.Field(default=None) + """ + The secondary team ids for the team + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/text_area_component.py b/src/intercom/types/text_area_component.py new file mode 100644 index 0000000..9f7263e --- /dev/null +++ b/src/intercom/types/text_area_component.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TextAreaComponent(UncheckedBaseModel): + """ + A text area component is used to capture a large amount of text as input with a multi-line text box. You can submit the value of the text area by: + + - Using a ButtonComponent (which will submit all interactive components in the canvas) + """ + + id: str = pydantic.Field() + """ + A unique identifier for the component. + """ + + label: typing.Optional[str] = pydantic.Field(default=None) + """ + The text shown above the text area. + """ + + placeholder: typing.Optional[str] = pydantic.Field(default=None) + """ + An example value shown inside the component when it's empty. + """ + + value: typing.Optional[str] = pydantic.Field(default=None) + """ + An entered value which is already inside the component. + """ + + error: typing.Optional[bool] = pydantic.Field(default=None) + """ + Styles the input as failed. Default is false. + """ + + disabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Styles the input and prevents the action. Default is false. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/text_component.py b/src/intercom/types/text_component.py new file mode 100644 index 0000000..a08dda6 --- /dev/null +++ b/src/intercom/types/text_component.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .text_component_align import TextComponentAlign +from .text_component_style import TextComponentStyle + + +class TextComponent(UncheckedBaseModel): + """ + A text component is used for rendering blocks of text. Links and bold font can be rendered through Markdown. There are different styles provided which edit the color, weight, and font size. These cannot be edited through Markdown. + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + A unique identifier for the component. + """ + + text: str = pydantic.Field() + """ + The text that will be rendered. + """ + + align: typing.Optional[TextComponentAlign] = pydantic.Field(default=None) + """ + Aligns the text. Default is `left`. + """ + + style: typing.Optional[TextComponentStyle] = pydantic.Field(default=None) + """ + Styles the text. Default is `paragraph`. + """ + + bottom_margin: typing.Optional[typing.Literal["none"]] = pydantic.Field(default=None) + """ + Disables a component's margin-bottom of 10px. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/text_component_align.py b/src/intercom/types/text_component_align.py new file mode 100644 index 0000000..0ba0243 --- /dev/null +++ b/src/intercom/types/text_component_align.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextComponentAlign = typing.Union[typing.Literal["left", "center", "right"], typing.Any] diff --git a/src/intercom/types/text_component_style.py b/src/intercom/types/text_component_style.py new file mode 100644 index 0000000..a2d0aa9 --- /dev/null +++ b/src/intercom/types/text_component_style.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextComponentStyle = typing.Union[typing.Literal["header", "paragraph", "muted", "error"], typing.Any] diff --git a/src/intercom/types/ticket_custom_attributes.py b/src/intercom/types/ticket_custom_attributes.py new file mode 100644 index 0000000..8bbc975 --- /dev/null +++ b/src/intercom/types/ticket_custom_attributes.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TicketCustomAttributes = typing.Dict[str, typing.Optional[typing.Any]] diff --git a/src/intercom/types/ticket_list.py b/src/intercom/types/ticket_list.py new file mode 100644 index 0000000..bb24c3e --- /dev/null +++ b/src/intercom/types/ticket_list.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from ..tickets.types.ticket import Ticket +from .cursor_pages import CursorPages + + +class TicketList(UncheckedBaseModel): + """ + Tickets are how you track requests from your users. + """ + + type: typing.Literal["ticket.list"] = pydantic.Field(default="ticket.list") + """ + Always ticket.list + """ + + tickets: typing.List[Ticket] = pydantic.Field() + """ + The list of ticket objects + """ + + total_count: int = pydantic.Field() + """ + A count of the total number of objects. + """ + + pages: typing.Optional[CursorPages] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/ticket_part_author.py b/src/intercom/types/ticket_part_author.py new file mode 100644 index 0000000..0412078 --- /dev/null +++ b/src/intercom/types/ticket_part_author.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .ticket_part_author_type import TicketPartAuthorType + + +class TicketPartAuthor(UncheckedBaseModel): + """ + The author that wrote or triggered the part. Can be a bot, admin, team or user. + """ + + type: TicketPartAuthorType = pydantic.Field() + """ + The type of the author + """ + + id: str = pydantic.Field() + """ + The id of the author + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the author + """ + + email: str = pydantic.Field() + """ + The email of the author + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/ticket_part_author_type.py b/src/intercom/types/ticket_part_author_type.py new file mode 100644 index 0000000..1c4aa87 --- /dev/null +++ b/src/intercom/types/ticket_part_author_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TicketPartAuthorType = typing.Union[typing.Literal["admin", "bot", "team", "user"], typing.Any] diff --git a/src/intercom/types/ticket_parts.py b/src/intercom/types/ticket_parts.py new file mode 100644 index 0000000..8957065 --- /dev/null +++ b/src/intercom/types/ticket_parts.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from ..tickets.types.ticket_part import TicketPart + + +class TicketParts(UncheckedBaseModel): + """ + A list of Ticket Part objects for each note and event in the ticket. There is a limit of 500 parts. + """ + + type: typing.Literal["ticket_part.list"] = pydantic.Field(default="ticket_part.list") + """ + + """ + + ticket_parts: typing.List[TicketPart] = pydantic.Field() + """ + A list of Ticket Part objects for each ticket. There is a limit of 500 parts. + """ + + total_count: int = pydantic.Field() + """ + + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/ticket_reply.py b/src/intercom/types/ticket_reply.py new file mode 100644 index 0000000..d55ee84 --- /dev/null +++ b/src/intercom/types/ticket_reply.py @@ -0,0 +1,66 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .part_attachment import PartAttachment +from .ticket_part_author import TicketPartAuthor +from .ticket_reply_part_type import TicketReplyPartType + + +class TicketReply(UncheckedBaseModel): + """ + A Ticket Part representing a note, comment, or quick_reply on a ticket + """ + + type: typing.Literal["ticket_part"] = pydantic.Field(default="ticket_part") + """ + Always ticket_part + """ + + id: str = pydantic.Field() + """ + The id representing the part. + """ + + part_type: TicketReplyPartType = pydantic.Field() + """ + Type of the part + """ + + body: typing.Optional[str] = pydantic.Field(default=None) + """ + The message body, which may contain HTML. + """ + + created_at: int = pydantic.Field() + """ + The time the note was created. + """ + + updated_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The last time the note was updated. + """ + + author: typing.Optional[TicketPartAuthor] = None + attachments: typing.Optional[typing.List[PartAttachment]] = pydantic.Field(default=None) + """ + A list of attachments for the part. + """ + + redacted: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether or not the ticket part has been redacted. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/ticket_reply_part_type.py b/src/intercom/types/ticket_reply_part_type.py new file mode 100644 index 0000000..c7796a4 --- /dev/null +++ b/src/intercom/types/ticket_reply_part_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TicketReplyPartType = typing.Union[typing.Literal["note", "comment", "quick_reply"], typing.Any] diff --git a/src/intercom/types/ticket_request_custom_attributes.py b/src/intercom/types/ticket_request_custom_attributes.py new file mode 100644 index 0000000..483917f --- /dev/null +++ b/src/intercom/types/ticket_request_custom_attributes.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TicketRequestCustomAttributes = typing.Dict[str, typing.Optional[typing.Any]] diff --git a/src/intercom/types/ticket_type_attribute.py b/src/intercom/types/ticket_type_attribute.py new file mode 100644 index 0000000..60141c0 --- /dev/null +++ b/src/intercom/types/ticket_type_attribute.py @@ -0,0 +1,108 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .ticket_type_attribute_data_type import TicketTypeAttributeDataType + + +class TicketTypeAttribute(UncheckedBaseModel): + """ + Ticket type attribute, used to define each data field to be captured in a ticket. + """ + + type: typing.Literal["ticket_type_attribute"] = pydantic.Field(default="ticket_type_attribute") + """ + String representing the object's type. Always has the value `ticket_type_attribute`. + """ + + id: str = pydantic.Field() + """ + The id representing the ticket type attribute. + """ + + workspace_id: str = pydantic.Field() + """ + The id of the workspace that the ticket type attribute belongs to. + """ + + name: str = pydantic.Field() + """ + The name of the ticket type attribute + """ + + description: str = pydantic.Field() + """ + The description of the ticket type attribute + """ + + data_type: TicketTypeAttributeDataType = pydantic.Field() + """ + The type of the data attribute (allowed values: "string list integer decimal boolean datetime files") + """ + + input_options: typing.Dict[str, typing.Optional[typing.Any]] = pydantic.Field() + """ + Input options for the attribute + """ + + order: int = pydantic.Field() + """ + The order of the attribute against other attributes + """ + + required_to_create: bool = pydantic.Field() + """ + Whether the attribute is required or not for teammates. + """ + + required_to_create_for_contacts: bool = pydantic.Field() + """ + Whether the attribute is required or not for contacts. + """ + + visible_on_create: bool = pydantic.Field() + """ + Whether the attribute is visible or not to teammates. + """ + + visible_to_contacts: bool = pydantic.Field() + """ + Whether the attribute is visible or not to contacts. + """ + + default: bool = pydantic.Field() + """ + Whether the attribute is built in or not. + """ + + ticket_type_id: int = pydantic.Field() + """ + The id of the ticket type that the attribute belongs to. + """ + + archived: bool = pydantic.Field() + """ + Whether the ticket type attribute is archived or not. + """ + + created_at: int = pydantic.Field() + """ + The date and time the ticket type attribute was created. + """ + + updated_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The date and time the ticket type attribute was last updated. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/ticket_type_attribute_data_type.py b/src/intercom/types/ticket_type_attribute_data_type.py new file mode 100644 index 0000000..be33a88 --- /dev/null +++ b/src/intercom/types/ticket_type_attribute_data_type.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TicketTypeAttributeDataType = typing.Union[ + typing.Literal["string", "list", "integer", "decimal", "boolean", "datetime", "files"], typing.Any +] diff --git a/src/intercom/types/ticket_type_attribute_list.py b/src/intercom/types/ticket_type_attribute_list.py new file mode 100644 index 0000000..c707631 --- /dev/null +++ b/src/intercom/types/ticket_type_attribute_list.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .ticket_type_attribute import TicketTypeAttribute + + +class TicketTypeAttributeList(UncheckedBaseModel): + """ + A list of attributes associated with a given ticket type. + """ + + type: typing.Literal["ticket_type_attributes.list"] = pydantic.Field(default="ticket_type_attributes.list") + """ + String representing the object's type. Always has the value `ticket_type_attributes.list`. + """ + + ticket_type_attributes: typing.List[TicketTypeAttribute] = pydantic.Field() + """ + A list of ticket type attributes associated with a given ticket type. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/ticket_type_list.py b/src/intercom/types/ticket_type_list.py new file mode 100644 index 0000000..098c902 --- /dev/null +++ b/src/intercom/types/ticket_type_list.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from ..tickets.types.ticket_type import TicketType + + +class TicketTypeList(UncheckedBaseModel): + """ + A list of ticket types associated with a given workspace. + """ + + type: typing.Literal["ticket_type_attributes.list"] = pydantic.Field(default="ticket_type_attributes.list") + """ + String representing the object's type. Always has the value `ticket_type.list`. + """ + + ticket_types: typing.List[TicketType] = pydantic.Field() + """ + A list of ticket_types associated with a given workspace. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/translation.py b/src/intercom/types/translation.py new file mode 100644 index 0000000..a2b14e9 --- /dev/null +++ b/src/intercom/types/translation.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class Translation(UncheckedBaseModel): + """ + A translation object contains the localised details of a subscription type. + """ + + name: str = pydantic.Field() + """ + The localised name of the subscription type. + """ + + description: str = pydantic.Field() + """ + The localised description of the subscription type. + """ + + locale: str = pydantic.Field() + """ + The two character identifier for the language of the translation object. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/untag_company_request.py b/src/intercom/types/untag_company_request.py new file mode 100644 index 0000000..477bb3b --- /dev/null +++ b/src/intercom/types/untag_company_request.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .untag_company_request_companies_item import UntagCompanyRequestCompaniesItem + + +class UntagCompanyRequest(UncheckedBaseModel): + """ + You can tag a single company or a list of companies. + """ + + name: str = pydantic.Field() + """ + The name of the tag which will be untagged from the company + """ + + companies: typing.List[UntagCompanyRequestCompaniesItem] = pydantic.Field() + """ + The id or company_id of the company can be passed as input parameters. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/untag_company_request_companies_item.py b/src/intercom/types/untag_company_request_companies_item.py new file mode 100644 index 0000000..f7ec650 --- /dev/null +++ b/src/intercom/types/untag_company_request_companies_item.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UntagCompanyRequestCompaniesItem(UncheckedBaseModel): + id: str = pydantic.Field() + """ + The Intercom defined id representing the company. + """ + + company_id: str = pydantic.Field() + """ + The company id you have defined for the company. + """ + + untag: typing.Literal[True] = pydantic.Field(default=True) + """ + Always set to true + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/update_visitor_request.py b/src/intercom/types/update_visitor_request.py new file mode 100644 index 0000000..5f9c689 --- /dev/null +++ b/src/intercom/types/update_visitor_request.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .update_visitor_request_with_id import UpdateVisitorRequestWithId +from .update_visitor_request_with_user_id import UpdateVisitorRequestWithUserId + +UpdateVisitorRequest = typing.Union[UpdateVisitorRequestWithId, UpdateVisitorRequestWithUserId] diff --git a/src/intercom/types/update_visitor_request_one.py b/src/intercom/types/update_visitor_request_one.py new file mode 100644 index 0000000..f2d21b0 --- /dev/null +++ b/src/intercom/types/update_visitor_request_one.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +UpdateVisitorRequestOne = typing.Optional[typing.Any] diff --git a/src/intercom/types/update_visitor_request_with_id.py b/src/intercom/types/update_visitor_request_with_id.py new file mode 100644 index 0000000..a3ccacb --- /dev/null +++ b/src/intercom/types/update_visitor_request_with_id.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateVisitorRequestWithId(UncheckedBaseModel): + id: str = pydantic.Field() + """ + A unique identified for the visitor which is given by Intercom. + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + The visitor's name. + """ + + custom_attributes: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None) + """ + The custom attributes which are set for the visitor. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/update_visitor_request_with_user_id.py b/src/intercom/types/update_visitor_request_with_user_id.py new file mode 100644 index 0000000..6d426bb --- /dev/null +++ b/src/intercom/types/update_visitor_request_with_user_id.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateVisitorRequestWithUserId(UncheckedBaseModel): + user_id: str = pydantic.Field() + """ + A unique identified for the visitor which is given by you. + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + The visitor's name. + """ + + custom_attributes: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None) + """ + The custom attributes which are set for the visitor. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/url_action_component.py b/src/intercom/types/url_action_component.py new file mode 100644 index 0000000..7c961fe --- /dev/null +++ b/src/intercom/types/url_action_component.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UrlActionComponent(UncheckedBaseModel): + """ + A URL action opens a given link in a new browser tab. + """ + + url: str = pydantic.Field() + """ + The link you want to open. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/visitor.py b/src/intercom/types/visitor.py new file mode 100644 index 0000000..d5b780b --- /dev/null +++ b/src/intercom/types/visitor.py @@ -0,0 +1,169 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .visitor_avatar import VisitorAvatar +from .visitor_companies import VisitorCompanies +from .visitor_location_data import VisitorLocationData +from .visitor_segments import VisitorSegments +from .visitor_social_profiles import VisitorSocialProfiles +from .visitor_tags import VisitorTags + + +class Visitor(UncheckedBaseModel): + """ + Visitors are useful for representing anonymous people that have not yet been identified. They usually represent website visitors. Visitors are not visible in Intercom platform. The Visitors resource provides methods to fetch, update, convert and delete. + """ + + type: typing.Literal["visitor"] = pydantic.Field(default="visitor") + """ + Value is 'visitor' + """ + + id: str = pydantic.Field() + """ + The Intercom defined id representing the Visitor. + """ + + user_id: str = pydantic.Field() + """ + Automatically generated identifier for the Visitor. + """ + + anonymous: bool = pydantic.Field() + """ + Identifies if this visitor is anonymous. + """ + + email: str = pydantic.Field() + """ + The email of the visitor. + """ + + phone: typing.Optional[str] = pydantic.Field(default=None) + """ + The phone number of the visitor. + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the visitor. + """ + + pseudonym: typing.Optional[str] = pydantic.Field(default=None) + """ + The pseudonym of the visitor. + """ + + avatar: typing.Optional[VisitorAvatar] = None + app_id: str = pydantic.Field() + """ + The id of the app the visitor is associated with. + """ + + companies: typing.Optional[VisitorCompanies] = None + location_data: typing.Optional[VisitorLocationData] = None + las_request_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time the Lead last recorded making a request. + """ + + created_at: int = pydantic.Field() + """ + The time the Visitor was added to Intercom. + """ + + remote_created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time the Visitor was added to Intercom. + """ + + signed_up_at: int = pydantic.Field() + """ + The time the Visitor signed up for your product. + """ + + updated_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The last time the Visitor was updated. + """ + + session_count: typing.Optional[int] = pydantic.Field(default=None) + """ + The number of sessions the Visitor has had. + """ + + social_profiles: typing.Optional[VisitorSocialProfiles] = None + owner_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id of the admin that owns the Visitor. + """ + + unsubscribed_from_emails: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the Visitor is unsubscribed from emails. + """ + + marked_email_as_spam: typing.Optional[bool] = pydantic.Field(default=None) + """ + Identifies if this visitor has marked an email as spam. + """ + + has_hard_bounced: typing.Optional[bool] = pydantic.Field(default=None) + """ + Identifies if this visitor has had a hard bounce. + """ + + tags: typing.Optional[VisitorTags] = None + segments: typing.Optional[VisitorSegments] = None + custom_attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None) + """ + The custom attributes you have set on the Visitor. + """ + + referrer: typing.Optional[str] = pydantic.Field(default=None) + """ + The referer of the visitor. + """ + + utm_campaign: typing.Optional[str] = pydantic.Field(default=None) + """ + The utm_campaign of the visitor. + """ + + utm_content: typing.Optional[str] = pydantic.Field(default=None) + """ + The utm_content of the visitor. + """ + + utm_medium: typing.Optional[str] = pydantic.Field(default=None) + """ + The utm_medium of the visitor. + """ + + utm_source: typing.Optional[str] = pydantic.Field(default=None) + """ + The utm_source of the visitor. + """ + + utm_term: typing.Optional[str] = pydantic.Field(default=None) + """ + The utm_term of the visitor. + """ + + do_not_track: typing.Optional[bool] = pydantic.Field(default=None) + """ + Identifies if this visitor has do not track enabled. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/visitor_avatar.py b/src/intercom/types/visitor_avatar.py new file mode 100644 index 0000000..9a30724 --- /dev/null +++ b/src/intercom/types/visitor_avatar.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VisitorAvatar(UncheckedBaseModel): + type: typing.Optional[str] = pydantic.Field(default=None) + """ + + """ + + image_url: typing.Optional[str] = pydantic.Field(default=None) + """ + This object represents the avatar associated with the visitor. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/visitor_companies.py b/src/intercom/types/visitor_companies.py new file mode 100644 index 0000000..c35fc0e --- /dev/null +++ b/src/intercom/types/visitor_companies.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..companies.types.company import Company +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VisitorCompanies(UncheckedBaseModel): + type: typing.Optional[typing.Literal["company.list"]] = pydantic.Field(default=None) + """ + The type of the object + """ + + companies: typing.Optional[typing.List[Company]] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/visitor_deleted_object.py b/src/intercom/types/visitor_deleted_object.py new file mode 100644 index 0000000..f2cc5b2 --- /dev/null +++ b/src/intercom/types/visitor_deleted_object.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VisitorDeletedObject(UncheckedBaseModel): + """ + Response returned when an object is deleted + """ + + id: str = pydantic.Field() + """ + The unique identifier for the visitor which is given by Intercom. + """ + + type: typing.Literal["visitor"] = pydantic.Field(default="visitor") + """ + The type of object which was deleted + """ + + user_id: str = pydantic.Field() + """ + Automatically generated identifier for the Visitor. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/visitor_location_data.py b/src/intercom/types/visitor_location_data.py new file mode 100644 index 0000000..400d637 --- /dev/null +++ b/src/intercom/types/visitor_location_data.py @@ -0,0 +1,58 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VisitorLocationData(UncheckedBaseModel): + type: typing.Optional[str] = pydantic.Field(default=None) + """ + + """ + + city_name: typing.Optional[str] = pydantic.Field(default=None) + """ + The city name of the visitor. + """ + + continent_code: typing.Optional[str] = pydantic.Field(default=None) + """ + The continent code of the visitor. + """ + + country_code: typing.Optional[str] = pydantic.Field(default=None) + """ + The country code of the visitor. + """ + + country_name: typing.Optional[str] = pydantic.Field(default=None) + """ + The country name of the visitor. + """ + + postal_code: typing.Optional[str] = pydantic.Field(default=None) + """ + The postal code of the visitor. + """ + + region_name: typing.Optional[str] = pydantic.Field(default=None) + """ + The region name of the visitor. + """ + + timezone: typing.Optional[str] = pydantic.Field(default=None) + """ + The timezone of the visitor. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/visitor_segments.py b/src/intercom/types/visitor_segments.py new file mode 100644 index 0000000..80d2310 --- /dev/null +++ b/src/intercom/types/visitor_segments.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VisitorSegments(UncheckedBaseModel): + type: typing.Optional[typing.Literal["segment.list"]] = pydantic.Field(default=None) + """ + The type of the object + """ + + segments: typing.Optional[typing.List[str]] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/visitor_social_profiles.py b/src/intercom/types/visitor_social_profiles.py new file mode 100644 index 0000000..008fbe1 --- /dev/null +++ b/src/intercom/types/visitor_social_profiles.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VisitorSocialProfiles(UncheckedBaseModel): + type: typing.Optional[typing.Literal["social_profile.list"]] = pydantic.Field(default=None) + """ + The type of the object + """ + + social_profiles: typing.Optional[typing.List[str]] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/visitor_tags.py b/src/intercom/types/visitor_tags.py new file mode 100644 index 0000000..e311913 --- /dev/null +++ b/src/intercom/types/visitor_tags.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .visitor_tags_tags_item import VisitorTagsTagsItem + + +class VisitorTags(UncheckedBaseModel): + type: typing.Optional[typing.Literal["tag.list"]] = pydantic.Field(default=None) + """ + The type of the object + """ + + tags: typing.Optional[typing.List[VisitorTagsTagsItem]] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/types/visitor_tags_tags_item.py b/src/intercom/types/visitor_tags_tags_item.py new file mode 100644 index 0000000..e0ae659 --- /dev/null +++ b/src/intercom/types/visitor_tags_tags_item.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VisitorTagsTagsItem(UncheckedBaseModel): + type: typing.Optional[typing.Literal["tag"]] = pydantic.Field(default=None) + """ + The type of the object + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id of the tag. + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the tag. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/__init__.py b/src/intercom/unstable/__init__.py new file mode 100644 index 0000000..d7f4dd4 --- /dev/null +++ b/src/intercom/unstable/__init__.py @@ -0,0 +1,748 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .types import ( + ActivityLog, + ActivityLogActivityType, + ActivityLogList, + ActivityLogMetadata, + ActivityLogPerformedBy, + AddressableList, + AdminList, + AdminPriorityLevel, + AdminReplyConversationRequest, + AdminReplyConversationRequestMessageType, + AdminReplyTicketRequest, + AdminReplyTicketRequestMessageType, + AdminReplyTicketRequestReplyOptionsItem, + AdminWithApp, + AdminWithAppAvatar, + App, + ArticleContent, + ArticleContentState, + ArticleList, + ArticleStatistics, + ArticleTranslatedContent, + AssignConversationRequest, + AssignConversationRequestType, + AwayStatusReason, + CloseConversationRequest, + CollectionList, + CompanyAttachedContacts, + CompanyAttachedSegments, + CompanyData, + CompanyList, + CompanyScroll, + ContactArchived, + ContactAttachedCompanies, + ContactBlocked, + ContactCompanies, + ContactDeleted, + ContactList, + ContactLocation, + ContactNotes, + ContactReference, + ContactReplyBaseRequest, + ContactReplyBaseRequestReplyOptionsItem, + ContactReplyConversationRequest, + ContactReplyEmailRequest, + ContactReplyIntercomUserIdRequest, + ContactReplyTicketEmailRequest, + ContactReplyTicketIntercomUserIdRequest, + ContactReplyTicketRequest, + ContactReplyTicketUserIdRequest, + ContactReplyUserIdRequest, + ContactSegments, + ContactSocialProfiles, + ContactSubscriptionTypes, + ContactTags, + ContactUnarchived, + ContentSourcesList, + ConversationAttachmentFiles, + ConversationAttributeUpdatedByAdmin, + ConversationAttributeUpdatedByAdminAttribute, + ConversationAttributeUpdatedByAdminValue, + ConversationAttributeUpdatedByWorkflow, + ConversationAttributeUpdatedByWorkflowAttribute, + ConversationAttributeUpdatedByWorkflowValue, + ConversationAttributeUpdatedByWorkflowWorkflow, + ConversationContacts, + ConversationDeleted, + ConversationFirstContactReply, + ConversationList, + ConversationPart, + ConversationPartAuthor, + ConversationPartMetadata, + ConversationPartMetadataQuickReplyOptionsItem, + ConversationPartState, + ConversationParts, + ConversationRating, + ConversationResponseTime, + ConversationSource, + ConversationSourceType, + ConversationStatistics, + ConversationTeammates, + CreateOrUpdateTagRequest, + CreateTicketReplyWithCommentRequest, + CreateTicketRequestAssignment, + CreateTicketRequestBody, + CreateTicketRequestContactsItem, + CreateTicketRequestContactsItemEmail, + CreateTicketRequestContactsItemExternalId, + CreateTicketRequestContactsItemId, + CursorPages, + CustomActionFinished, + CustomActionFinishedAction, + CustomActionFinishedActionResult, + CustomActionStarted, + CustomActionStartedAction, + CustomAttributes, + CustomAttributesValue, + CustomChannelAttribute, + CustomChannelBaseEvent, + CustomChannelContact, + CustomChannelContactType, + CustomChannelNotificationResponse, + CustomObjectInstanceDeleted, + CustomObjectInstanceList, + CustomerRequest, + CustomerRequestEmail, + CustomerRequestIntercomUserId, + CustomerRequestUserId, + DataAttributeList, + DataEventList, + DataEventListPages, + DataEventSummary, + DataEventSummaryItem, + DataExportCsv, + Datetime, + DeletedArticleObject, + DeletedCollectionObject, + DeletedCompanyObject, + DeletedObject, + EmailAddressHeader, + EmailMessageMetadata, + Error, + ErrorErrorsItem, + EventDetails, + FileAttribute, + GroupContent, + GroupTranslatedContent, + IntercomVersion, + IntercomVersionUnstable, + LinkedObject, + LinkedObjectList, + LinkedObjectType, + MultipleFilterSearchRequest, + MultipleFilterSearchRequestOperator, + MultipleFilterSearchRequestValue, + NewsItemRequest, + NewsItemRequestState, + NotFoundErrorBody, + NotFoundErrorBodyErrorsItem, + NoteList, + OpenConversationRequest, + OperatorWorkflowEvent, + OperatorWorkflowEventEvent, + OperatorWorkflowEventWorkflow, + PagesLink, + PaginatedResponse, + PaginatedResponseDataItem, + PaginatedResponseDataItem_NewsItem, + PaginatedResponseDataItem_Newsfeed, + PaginatedResponseType, + PartAttachment, + PhoneSwitch, + QuickReplyOption, + Recipient, + RecipientType, + RedactConversationRequest, + RedactConversationRequestConversationPart, + RedactConversationRequestSource, + RedactConversationRequest_ConversationPart, + RedactConversationRequest_Source, + Reference, + ReplyConversationRequestBody, + SearchRequest, + SearchRequestQuery, + SegmentList, + SingleFilterSearchRequest, + SingleFilterSearchRequestOperator, + SingleFilterSearchRequestValue, + SingleFilterSearchRequestValueItem, + SlaApplied, + SlaAppliedSlaStatus, + SnoozeConversationRequest, + SocialProfile, + StartingAfterPaging, + SubscriptionTypeList, + TagCompanyRequest, + TagCompanyRequestCompaniesItem, + TagList, + TagMultipleUsersRequest, + TagMultipleUsersRequestUsersItem, + Tags, + TeamList, + TeamPriorityLevel, + TicketCustomAttributes, + TicketCustomAttributesValue, + TicketList, + TicketPartAuthor, + TicketPartAuthorType, + TicketParts, + TicketReply, + TicketReplyPartType, + TicketRequestCustomAttributes, + TicketRequestCustomAttributesValue, + TicketStateList, + TicketTypeAttribute, + TicketTypeAttributeList, + TicketTypeList, + Translation, + UntagCompanyRequest, + UntagCompanyRequestCompaniesItem, + UpdateArticleRequestBody, + UpdateArticleRequestState, + UpdateTicketTypeRequestBody, + UpdateTicketTypeRequestCategory, + Visitor, + VisitorAvatar, + VisitorCompanies, + VisitorDeletedObject, + VisitorLocationData, + VisitorSegments, + VisitorSocialProfiles, + VisitorTags, + VisitorTagsTagsItem, + WhatsappMessageStatusList, + WhatsappMessageStatusListEventsItem, + WhatsappMessageStatusListEventsItemStatus, + WhatsappMessageStatusListPages, + WhatsappMessageStatusListPagesNext, +) +from .errors import ( + BadRequestError, + ForbiddenError, + InternalServerError, + NotFoundError, + TooManyRequestsError, + UnauthorizedError, + UnprocessableEntityError, +) +from . import ( + admins, + ai_agent, + ai_content, + ai_content_source, + articles, + away_status_reasons, + companies, + contacts, + conversations, + custom_channel_events, + custom_object_instances, + data_attributes, + data_events, + data_export, + export, + help_center, + jobs, + messages, + news, + notes, + segments, + subscription_types, + switch, + tags, + teams, + ticket_states, + ticket_type_attributes, + ticket_types, + tickets, + visitors, +) +from .admins import Admin +from .ai_agent import AiAgent, AiAgentSourceType +from .ai_content import ( + ContentImportSource, + ContentImportSourceStatus, + ContentImportSourceSyncBehavior, + ContentImportSourcesList, + CreateContentImportSourceRequestStatus, + ExternalPage, + ExternalPagesList, + UpdateContentImportSourceRequestStatus, + UpdateContentImportSourceRequestSyncBehavior, +) +from .ai_content_source import ContentSource, ContentSourceContentType +from .articles import ( + Article, + ArticleListItem, + ArticleListItemState, + ArticleSearchHighlights, + ArticleSearchHighlightsHighlightedSummaryItemItem, + ArticleSearchHighlightsHighlightedSummaryItemItemType, + ArticleSearchHighlightsHighlightedTitleItem, + ArticleSearchHighlightsHighlightedTitleItemType, + ArticleSearchResponse, + ArticleSearchResponseData, +) +from .companies import Company, CompanyPlan, CompanySegments, CompanyTags +from .contacts import ( + Contact, + ContactAvatar, + CreateContactResponse, + MergeContactResponse, + ShowContactByExternalIdResponse, + ShowContactResponse, + UpdateContactResponse, +) +from .conversations import ( + AttachContactToConversationRequestCustomer, + AttachContactToConversationRequestCustomerCustomer, + AttachContactToConversationRequestCustomerIntercomUserId, + AttachContactToConversationRequestCustomerUserId, + Conversation, + ConversationPriority, + ConversationState, + CreateConversationRequestFrom, + CreateConversationRequestFromType, + ManageConversationRequestBody, + ManageConversationRequestBody_Assignment, + ManageConversationRequestBody_Close, + ManageConversationRequestBody_Open, + ManageConversationRequestBody_Snoozed, +) +from .custom_object_instances import CustomObjectInstance +from .data_attributes import ( + CreateDataAttributeRequestDataType, + CreateDataAttributeRequestModel, + DataAttribute, + DataAttributeDataType, + DataAttributeModel, + LisDataAttributesRequestModel, +) +from .data_events import ( + CreateDataEventSummariesRequestEventSummaries, + DataEvent, + LisDataEventsRequestFilter, + LisDataEventsRequestFilterEmail, + LisDataEventsRequestFilterIntercomUserId, + LisDataEventsRequestFilterUserId, +) +from .data_export import DataExport, DataExportStatus +from .export import ( + GetExportReportingDataGetDatasetsResponse, + GetExportReportingDataGetDatasetsResponseDataItem, + GetExportReportingDataGetDatasetsResponseDataItemAttributesItem, + PostExportReportingDataEnqueueResponse, +) +from .help_center import Collection, HelpCenter, HelpCenterList +from .jobs import Jobs, JobsStatus +from .messages import Message, MessageMessageType +from .news import NewsItem, NewsItemState, Newsfeed, NewsfeedAssignment +from .notes import Note, NoteContact +from .segments import Segment, SegmentPersonType +from .subscription_types import ( + SubscriptionType, + SubscriptionTypeConsentType, + SubscriptionTypeContentTypesItem, + SubscriptionTypeState, +) +from .tags import CreateTagRequestBody, Tag, TagBasic +from .teams import Team +from .ticket_type_attributes import CreateTicketTypeAttributeRequestDataType +from .tickets import ( + DeleteTicketResponse, + ReplyTicketRequestBody, + Ticket, + TicketCategory, + TicketContacts, + TicketPart, + TicketPartPreviousTicketState, + TicketPartTicketState, + TicketPartUpdatedAttributeData, + TicketPartUpdatedAttributeDataAttribute, + TicketPartUpdatedAttributeDataValue, + TicketPartUpdatedAttributeDataValueId, + TicketPartUpdatedAttributeDataValueLabel, + TicketState, + TicketStateCategory, + TicketStateDetailed, + TicketStateDetailedCategory, + TicketStateDetailedTicketTypes, + TicketType, + TicketTypeCategory, + TicketTypeTicketStates, +) + +__all__ = [ + "ActivityLog", + "ActivityLogActivityType", + "ActivityLogList", + "ActivityLogMetadata", + "ActivityLogPerformedBy", + "AddressableList", + "Admin", + "AdminList", + "AdminPriorityLevel", + "AdminReplyConversationRequest", + "AdminReplyConversationRequestMessageType", + "AdminReplyTicketRequest", + "AdminReplyTicketRequestMessageType", + "AdminReplyTicketRequestReplyOptionsItem", + "AdminWithApp", + "AdminWithAppAvatar", + "AiAgent", + "AiAgentSourceType", + "App", + "Article", + "ArticleContent", + "ArticleContentState", + "ArticleList", + "ArticleListItem", + "ArticleListItemState", + "ArticleSearchHighlights", + "ArticleSearchHighlightsHighlightedSummaryItemItem", + "ArticleSearchHighlightsHighlightedSummaryItemItemType", + "ArticleSearchHighlightsHighlightedTitleItem", + "ArticleSearchHighlightsHighlightedTitleItemType", + "ArticleSearchResponse", + "ArticleSearchResponseData", + "ArticleStatistics", + "ArticleTranslatedContent", + "AssignConversationRequest", + "AssignConversationRequestType", + "AttachContactToConversationRequestCustomer", + "AttachContactToConversationRequestCustomerCustomer", + "AttachContactToConversationRequestCustomerIntercomUserId", + "AttachContactToConversationRequestCustomerUserId", + "AwayStatusReason", + "BadRequestError", + "CloseConversationRequest", + "Collection", + "CollectionList", + "Company", + "CompanyAttachedContacts", + "CompanyAttachedSegments", + "CompanyData", + "CompanyList", + "CompanyPlan", + "CompanyScroll", + "CompanySegments", + "CompanyTags", + "Contact", + "ContactArchived", + "ContactAttachedCompanies", + "ContactAvatar", + "ContactBlocked", + "ContactCompanies", + "ContactDeleted", + "ContactList", + "ContactLocation", + "ContactNotes", + "ContactReference", + "ContactReplyBaseRequest", + "ContactReplyBaseRequestReplyOptionsItem", + "ContactReplyConversationRequest", + "ContactReplyEmailRequest", + "ContactReplyIntercomUserIdRequest", + "ContactReplyTicketEmailRequest", + "ContactReplyTicketIntercomUserIdRequest", + "ContactReplyTicketRequest", + "ContactReplyTicketUserIdRequest", + "ContactReplyUserIdRequest", + "ContactSegments", + "ContactSocialProfiles", + "ContactSubscriptionTypes", + "ContactTags", + "ContactUnarchived", + "ContentImportSource", + "ContentImportSourceStatus", + "ContentImportSourceSyncBehavior", + "ContentImportSourcesList", + "ContentSource", + "ContentSourceContentType", + "ContentSourcesList", + "Conversation", + "ConversationAttachmentFiles", + "ConversationAttributeUpdatedByAdmin", + "ConversationAttributeUpdatedByAdminAttribute", + "ConversationAttributeUpdatedByAdminValue", + "ConversationAttributeUpdatedByWorkflow", + "ConversationAttributeUpdatedByWorkflowAttribute", + "ConversationAttributeUpdatedByWorkflowValue", + "ConversationAttributeUpdatedByWorkflowWorkflow", + "ConversationContacts", + "ConversationDeleted", + "ConversationFirstContactReply", + "ConversationList", + "ConversationPart", + "ConversationPartAuthor", + "ConversationPartMetadata", + "ConversationPartMetadataQuickReplyOptionsItem", + "ConversationPartState", + "ConversationParts", + "ConversationPriority", + "ConversationRating", + "ConversationResponseTime", + "ConversationSource", + "ConversationSourceType", + "ConversationState", + "ConversationStatistics", + "ConversationTeammates", + "CreateContactResponse", + "CreateContentImportSourceRequestStatus", + "CreateConversationRequestFrom", + "CreateConversationRequestFromType", + "CreateDataAttributeRequestDataType", + "CreateDataAttributeRequestModel", + "CreateDataEventSummariesRequestEventSummaries", + "CreateOrUpdateTagRequest", + "CreateTagRequestBody", + "CreateTicketReplyWithCommentRequest", + "CreateTicketRequestAssignment", + "CreateTicketRequestBody", + "CreateTicketRequestContactsItem", + "CreateTicketRequestContactsItemEmail", + "CreateTicketRequestContactsItemExternalId", + "CreateTicketRequestContactsItemId", + "CreateTicketTypeAttributeRequestDataType", + "CursorPages", + "CustomActionFinished", + "CustomActionFinishedAction", + "CustomActionFinishedActionResult", + "CustomActionStarted", + "CustomActionStartedAction", + "CustomAttributes", + "CustomAttributesValue", + "CustomChannelAttribute", + "CustomChannelBaseEvent", + "CustomChannelContact", + "CustomChannelContactType", + "CustomChannelNotificationResponse", + "CustomObjectInstance", + "CustomObjectInstanceDeleted", + "CustomObjectInstanceList", + "CustomerRequest", + "CustomerRequestEmail", + "CustomerRequestIntercomUserId", + "CustomerRequestUserId", + "DataAttribute", + "DataAttributeDataType", + "DataAttributeList", + "DataAttributeModel", + "DataEvent", + "DataEventList", + "DataEventListPages", + "DataEventSummary", + "DataEventSummaryItem", + "DataExport", + "DataExportCsv", + "DataExportStatus", + "Datetime", + "DeleteTicketResponse", + "DeletedArticleObject", + "DeletedCollectionObject", + "DeletedCompanyObject", + "DeletedObject", + "EmailAddressHeader", + "EmailMessageMetadata", + "Error", + "ErrorErrorsItem", + "EventDetails", + "ExternalPage", + "ExternalPagesList", + "FileAttribute", + "ForbiddenError", + "GetExportReportingDataGetDatasetsResponse", + "GetExportReportingDataGetDatasetsResponseDataItem", + "GetExportReportingDataGetDatasetsResponseDataItemAttributesItem", + "GroupContent", + "GroupTranslatedContent", + "HelpCenter", + "HelpCenterList", + "IntercomVersion", + "IntercomVersionUnstable", + "InternalServerError", + "Jobs", + "JobsStatus", + "LinkedObject", + "LinkedObjectList", + "LinkedObjectType", + "LisDataAttributesRequestModel", + "LisDataEventsRequestFilter", + "LisDataEventsRequestFilterEmail", + "LisDataEventsRequestFilterIntercomUserId", + "LisDataEventsRequestFilterUserId", + "ManageConversationRequestBody", + "ManageConversationRequestBody_Assignment", + "ManageConversationRequestBody_Close", + "ManageConversationRequestBody_Open", + "ManageConversationRequestBody_Snoozed", + "MergeContactResponse", + "Message", + "MessageMessageType", + "MultipleFilterSearchRequest", + "MultipleFilterSearchRequestOperator", + "MultipleFilterSearchRequestValue", + "NewsItem", + "NewsItemRequest", + "NewsItemRequestState", + "NewsItemState", + "Newsfeed", + "NewsfeedAssignment", + "NotFoundError", + "NotFoundErrorBody", + "NotFoundErrorBodyErrorsItem", + "Note", + "NoteContact", + "NoteList", + "OpenConversationRequest", + "OperatorWorkflowEvent", + "OperatorWorkflowEventEvent", + "OperatorWorkflowEventWorkflow", + "PagesLink", + "PaginatedResponse", + "PaginatedResponseDataItem", + "PaginatedResponseDataItem_NewsItem", + "PaginatedResponseDataItem_Newsfeed", + "PaginatedResponseType", + "PartAttachment", + "PhoneSwitch", + "PostExportReportingDataEnqueueResponse", + "QuickReplyOption", + "Recipient", + "RecipientType", + "RedactConversationRequest", + "RedactConversationRequestConversationPart", + "RedactConversationRequestSource", + "RedactConversationRequest_ConversationPart", + "RedactConversationRequest_Source", + "Reference", + "ReplyConversationRequestBody", + "ReplyTicketRequestBody", + "SearchRequest", + "SearchRequestQuery", + "Segment", + "SegmentList", + "SegmentPersonType", + "ShowContactByExternalIdResponse", + "ShowContactResponse", + "SingleFilterSearchRequest", + "SingleFilterSearchRequestOperator", + "SingleFilterSearchRequestValue", + "SingleFilterSearchRequestValueItem", + "SlaApplied", + "SlaAppliedSlaStatus", + "SnoozeConversationRequest", + "SocialProfile", + "StartingAfterPaging", + "SubscriptionType", + "SubscriptionTypeConsentType", + "SubscriptionTypeContentTypesItem", + "SubscriptionTypeList", + "SubscriptionTypeState", + "Tag", + "TagBasic", + "TagCompanyRequest", + "TagCompanyRequestCompaniesItem", + "TagList", + "TagMultipleUsersRequest", + "TagMultipleUsersRequestUsersItem", + "Tags", + "Team", + "TeamList", + "TeamPriorityLevel", + "Ticket", + "TicketCategory", + "TicketContacts", + "TicketCustomAttributes", + "TicketCustomAttributesValue", + "TicketList", + "TicketPart", + "TicketPartAuthor", + "TicketPartAuthorType", + "TicketPartPreviousTicketState", + "TicketPartTicketState", + "TicketPartUpdatedAttributeData", + "TicketPartUpdatedAttributeDataAttribute", + "TicketPartUpdatedAttributeDataValue", + "TicketPartUpdatedAttributeDataValueId", + "TicketPartUpdatedAttributeDataValueLabel", + "TicketParts", + "TicketReply", + "TicketReplyPartType", + "TicketRequestCustomAttributes", + "TicketRequestCustomAttributesValue", + "TicketState", + "TicketStateCategory", + "TicketStateDetailed", + "TicketStateDetailedCategory", + "TicketStateDetailedTicketTypes", + "TicketStateList", + "TicketType", + "TicketTypeAttribute", + "TicketTypeAttributeList", + "TicketTypeCategory", + "TicketTypeList", + "TicketTypeTicketStates", + "TooManyRequestsError", + "Translation", + "UnauthorizedError", + "UnprocessableEntityError", + "UntagCompanyRequest", + "UntagCompanyRequestCompaniesItem", + "UpdateArticleRequestBody", + "UpdateArticleRequestState", + "UpdateContactResponse", + "UpdateContentImportSourceRequestStatus", + "UpdateContentImportSourceRequestSyncBehavior", + "UpdateTicketTypeRequestBody", + "UpdateTicketTypeRequestCategory", + "Visitor", + "VisitorAvatar", + "VisitorCompanies", + "VisitorDeletedObject", + "VisitorLocationData", + "VisitorSegments", + "VisitorSocialProfiles", + "VisitorTags", + "VisitorTagsTagsItem", + "WhatsappMessageStatusList", + "WhatsappMessageStatusListEventsItem", + "WhatsappMessageStatusListEventsItemStatus", + "WhatsappMessageStatusListPages", + "WhatsappMessageStatusListPagesNext", + "admins", + "ai_agent", + "ai_content", + "ai_content_source", + "articles", + "away_status_reasons", + "companies", + "contacts", + "conversations", + "custom_channel_events", + "custom_object_instances", + "data_attributes", + "data_events", + "data_export", + "export", + "help_center", + "jobs", + "messages", + "news", + "notes", + "segments", + "subscription_types", + "switch", + "tags", + "teams", + "ticket_states", + "ticket_type_attributes", + "ticket_types", + "tickets", + "visitors", +] diff --git a/src/intercom/unstable/admins/__init__.py b/src/intercom/unstable/admins/__init__.py new file mode 100644 index 0000000..54c16eb --- /dev/null +++ b/src/intercom/unstable/admins/__init__.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .types import Admin + +__all__ = ["Admin"] diff --git a/src/intercom/unstable/admins/client.py b/src/intercom/unstable/admins/client.py new file mode 100644 index 0000000..3759648 --- /dev/null +++ b/src/intercom/unstable/admins/client.py @@ -0,0 +1,470 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ..types.activity_log_list import ActivityLogList +from ..types.admin_list import AdminList +from ..types.admin_with_app import AdminWithApp +from .raw_client import AsyncRawAdminsClient, RawAdminsClient +from .types.admin import Admin + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class AdminsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawAdminsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawAdminsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawAdminsClient + """ + return self._raw_client + + def identify_admin( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Optional[AdminWithApp]: + """ + + You can view the currently authorised admin along with the embedded app object (a "workspace" in legacy terminology). + + > 🚧 Single Sign On + > + > If you are building a custom "Log in with Intercom" flow for your site, and you call the `/me` endpoint to identify the logged-in user, you should not accept any sign-ins from users with unverified email addresses as it poses a potential impersonation security risk. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[AdminWithApp] + Successful response + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.admins.identify_admin() + """ + _response = self._raw_client.identify_admin(request_options=request_options) + return _response.data + + def set_away_admin( + self, + id: int, + *, + away_mode_enabled: bool, + away_mode_reassign: bool, + away_status_reason_id: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Optional[Admin]: + """ + You can set an Admin as away for the Inbox. + + Parameters + ---------- + id : int + The unique identifier of a given admin + + away_mode_enabled : bool + Set to "true" to change the status of the admin to away. + + away_mode_reassign : bool + Set to "true" to assign any new conversation replies to your default inbox. + + away_status_reason_id : typing.Optional[int] + The unique identifier of the away status reason + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[Admin] + Successful response + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.admins.set_away_admin( + id=1, + away_mode_enabled=True, + away_mode_reassign=True, + away_status_reason_id=12345, + ) + """ + _response = self._raw_client.set_away_admin( + id, + away_mode_enabled=away_mode_enabled, + away_mode_reassign=away_mode_reassign, + away_status_reason_id=away_status_reason_id, + request_options=request_options, + ) + return _response.data + + def list_activity_logs( + self, + *, + created_at_after: str, + created_at_before: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ActivityLogList: + """ + You can get a log of activities by all admins in an app. + + Parameters + ---------- + created_at_after : str + The start date that you request data for. It must be formatted as a UNIX timestamp. + + created_at_before : typing.Optional[str] + The end date that you request data for. It must be formatted as a UNIX timestamp. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ActivityLogList + Successful response + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.admins.list_activity_logs( + created_at_after="1677253093", + created_at_before="1677861493", + ) + """ + _response = self._raw_client.list_activity_logs( + created_at_after=created_at_after, created_at_before=created_at_before, request_options=request_options + ) + return _response.data + + def list_admins(self, *, request_options: typing.Optional[RequestOptions] = None) -> AdminList: + """ + You can fetch a list of admins for a given workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AdminList + Successful response + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.admins.list_admins() + """ + _response = self._raw_client.list_admins(request_options=request_options) + return _response.data + + def retrieve_admin( + self, id: int, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Optional[Admin]: + """ + You can retrieve the details of a single admin. + + Parameters + ---------- + id : int + The unique identifier of a given admin + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[Admin] + Admin found + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.admins.retrieve_admin( + id=1, + ) + """ + _response = self._raw_client.retrieve_admin(id, request_options=request_options) + return _response.data + + +class AsyncAdminsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawAdminsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawAdminsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawAdminsClient + """ + return self._raw_client + + async def identify_admin( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Optional[AdminWithApp]: + """ + + You can view the currently authorised admin along with the embedded app object (a "workspace" in legacy terminology). + + > 🚧 Single Sign On + > + > If you are building a custom "Log in with Intercom" flow for your site, and you call the `/me` endpoint to identify the logged-in user, you should not accept any sign-ins from users with unverified email addresses as it poses a potential impersonation security risk. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[AdminWithApp] + Successful response + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.admins.identify_admin() + + + asyncio.run(main()) + """ + _response = await self._raw_client.identify_admin(request_options=request_options) + return _response.data + + async def set_away_admin( + self, + id: int, + *, + away_mode_enabled: bool, + away_mode_reassign: bool, + away_status_reason_id: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Optional[Admin]: + """ + You can set an Admin as away for the Inbox. + + Parameters + ---------- + id : int + The unique identifier of a given admin + + away_mode_enabled : bool + Set to "true" to change the status of the admin to away. + + away_mode_reassign : bool + Set to "true" to assign any new conversation replies to your default inbox. + + away_status_reason_id : typing.Optional[int] + The unique identifier of the away status reason + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[Admin] + Successful response + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.admins.set_away_admin( + id=1, + away_mode_enabled=True, + away_mode_reassign=True, + away_status_reason_id=12345, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.set_away_admin( + id, + away_mode_enabled=away_mode_enabled, + away_mode_reassign=away_mode_reassign, + away_status_reason_id=away_status_reason_id, + request_options=request_options, + ) + return _response.data + + async def list_activity_logs( + self, + *, + created_at_after: str, + created_at_before: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ActivityLogList: + """ + You can get a log of activities by all admins in an app. + + Parameters + ---------- + created_at_after : str + The start date that you request data for. It must be formatted as a UNIX timestamp. + + created_at_before : typing.Optional[str] + The end date that you request data for. It must be formatted as a UNIX timestamp. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ActivityLogList + Successful response + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.admins.list_activity_logs( + created_at_after="1677253093", + created_at_before="1677861493", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list_activity_logs( + created_at_after=created_at_after, created_at_before=created_at_before, request_options=request_options + ) + return _response.data + + async def list_admins(self, *, request_options: typing.Optional[RequestOptions] = None) -> AdminList: + """ + You can fetch a list of admins for a given workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AdminList + Successful response + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.admins.list_admins() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list_admins(request_options=request_options) + return _response.data + + async def retrieve_admin( + self, id: int, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Optional[Admin]: + """ + You can retrieve the details of a single admin. + + Parameters + ---------- + id : int + The unique identifier of a given admin + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[Admin] + Admin found + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.admins.retrieve_admin( + id=1, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.retrieve_admin(id, request_options=request_options) + return _response.data diff --git a/src/intercom/unstable/admins/raw_client.py b/src/intercom/unstable/admins/raw_client.py new file mode 100644 index 0000000..958e183 --- /dev/null +++ b/src/intercom/unstable/admins/raw_client.py @@ -0,0 +1,654 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ..errors.bad_request_error import BadRequestError +from ..errors.not_found_error import NotFoundError +from ..errors.unauthorized_error import UnauthorizedError +from ..types.activity_log_list import ActivityLogList +from ..types.admin_list import AdminList +from ..types.admin_with_app import AdminWithApp +from ..types.error import Error +from .types.admin import Admin + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawAdminsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def identify_admin( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[typing.Optional[AdminWithApp]]: + """ + + You can view the currently authorised admin along with the embedded app object (a "workspace" in legacy terminology). + + > 🚧 Single Sign On + > + > If you are building a custom "Log in with Intercom" flow for your site, and you call the `/me` endpoint to identify the logged-in user, you should not accept any sign-ins from users with unverified email addresses as it poses a potential impersonation security risk. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Optional[AdminWithApp]] + Successful response + """ + _response = self._client_wrapper.httpx_client.request( + "me", + method="GET", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Optional[AdminWithApp], + construct_type( + type_=typing.Optional[AdminWithApp], # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def set_away_admin( + self, + id: int, + *, + away_mode_enabled: bool, + away_mode_reassign: bool, + away_status_reason_id: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.Optional[Admin]]: + """ + You can set an Admin as away for the Inbox. + + Parameters + ---------- + id : int + The unique identifier of a given admin + + away_mode_enabled : bool + Set to "true" to change the status of the admin to away. + + away_mode_reassign : bool + Set to "true" to assign any new conversation replies to your default inbox. + + away_status_reason_id : typing.Optional[int] + The unique identifier of the away status reason + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Optional[Admin]] + Successful response + """ + _response = self._client_wrapper.httpx_client.request( + f"admins/{jsonable_encoder(id)}/away", + method="PUT", + json={ + "away_mode_enabled": away_mode_enabled, + "away_mode_reassign": away_mode_reassign, + "away_status_reason_id": away_status_reason_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Optional[Admin], + construct_type( + type_=typing.Optional[Admin], # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def list_activity_logs( + self, + *, + created_at_after: str, + created_at_before: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ActivityLogList]: + """ + You can get a log of activities by all admins in an app. + + Parameters + ---------- + created_at_after : str + The start date that you request data for. It must be formatted as a UNIX timestamp. + + created_at_before : typing.Optional[str] + The end date that you request data for. It must be formatted as a UNIX timestamp. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ActivityLogList] + Successful response + """ + _response = self._client_wrapper.httpx_client.request( + "admins/activity_logs", + method="GET", + params={ + "created_at_after": created_at_after, + "created_at_before": created_at_before, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ActivityLogList, + construct_type( + type_=ActivityLogList, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def list_admins(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[AdminList]: + """ + You can fetch a list of admins for a given workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AdminList] + Successful response + """ + _response = self._client_wrapper.httpx_client.request( + "admins", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AdminList, + construct_type( + type_=AdminList, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def retrieve_admin( + self, id: int, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[typing.Optional[Admin]]: + """ + You can retrieve the details of a single admin. + + Parameters + ---------- + id : int + The unique identifier of a given admin + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Optional[Admin]] + Admin found + """ + _response = self._client_wrapper.httpx_client.request( + f"admins/{jsonable_encoder(id)}", + method="GET", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Optional[Admin], + construct_type( + type_=typing.Optional[Admin], # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawAdminsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def identify_admin( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[typing.Optional[AdminWithApp]]: + """ + + You can view the currently authorised admin along with the embedded app object (a "workspace" in legacy terminology). + + > 🚧 Single Sign On + > + > If you are building a custom "Log in with Intercom" flow for your site, and you call the `/me` endpoint to identify the logged-in user, you should not accept any sign-ins from users with unverified email addresses as it poses a potential impersonation security risk. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Optional[AdminWithApp]] + Successful response + """ + _response = await self._client_wrapper.httpx_client.request( + "me", + method="GET", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Optional[AdminWithApp], + construct_type( + type_=typing.Optional[AdminWithApp], # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def set_away_admin( + self, + id: int, + *, + away_mode_enabled: bool, + away_mode_reassign: bool, + away_status_reason_id: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.Optional[Admin]]: + """ + You can set an Admin as away for the Inbox. + + Parameters + ---------- + id : int + The unique identifier of a given admin + + away_mode_enabled : bool + Set to "true" to change the status of the admin to away. + + away_mode_reassign : bool + Set to "true" to assign any new conversation replies to your default inbox. + + away_status_reason_id : typing.Optional[int] + The unique identifier of the away status reason + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Optional[Admin]] + Successful response + """ + _response = await self._client_wrapper.httpx_client.request( + f"admins/{jsonable_encoder(id)}/away", + method="PUT", + json={ + "away_mode_enabled": away_mode_enabled, + "away_mode_reassign": away_mode_reassign, + "away_status_reason_id": away_status_reason_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Optional[Admin], + construct_type( + type_=typing.Optional[Admin], # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def list_activity_logs( + self, + *, + created_at_after: str, + created_at_before: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ActivityLogList]: + """ + You can get a log of activities by all admins in an app. + + Parameters + ---------- + created_at_after : str + The start date that you request data for. It must be formatted as a UNIX timestamp. + + created_at_before : typing.Optional[str] + The end date that you request data for. It must be formatted as a UNIX timestamp. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ActivityLogList] + Successful response + """ + _response = await self._client_wrapper.httpx_client.request( + "admins/activity_logs", + method="GET", + params={ + "created_at_after": created_at_after, + "created_at_before": created_at_before, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ActivityLogList, + construct_type( + type_=ActivityLogList, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def list_admins( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[AdminList]: + """ + You can fetch a list of admins for a given workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AdminList] + Successful response + """ + _response = await self._client_wrapper.httpx_client.request( + "admins", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AdminList, + construct_type( + type_=AdminList, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def retrieve_admin( + self, id: int, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[typing.Optional[Admin]]: + """ + You can retrieve the details of a single admin. + + Parameters + ---------- + id : int + The unique identifier of a given admin + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Optional[Admin]] + Admin found + """ + _response = await self._client_wrapper.httpx_client.request( + f"admins/{jsonable_encoder(id)}", + method="GET", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Optional[Admin], + construct_type( + type_=typing.Optional[Admin], # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/intercom/unstable/admins/types/__init__.py b/src/intercom/unstable/admins/types/__init__.py new file mode 100644 index 0000000..cd34677 --- /dev/null +++ b/src/intercom/unstable/admins/types/__init__.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .admin import Admin + +__all__ = ["Admin"] diff --git a/src/intercom/unstable/admins/types/admin.py b/src/intercom/unstable/admins/types/admin.py new file mode 100644 index 0000000..8972bf2 --- /dev/null +++ b/src/intercom/unstable/admins/types/admin.py @@ -0,0 +1,80 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from ...types.team_priority_level import TeamPriorityLevel + + +class Admin(UncheckedBaseModel): + """ + Admins are teammate accounts that have access to a workspace. + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + String representing the object's type. Always has the value `admin`. + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id representing the admin. + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the admin. + """ + + email: typing.Optional[str] = pydantic.Field(default=None) + """ + The email of the admin. + """ + + job_title: typing.Optional[str] = pydantic.Field(default=None) + """ + The job title of the admin. + """ + + away_mode_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Identifies if this admin is currently set in away mode. + """ + + away_mode_reassign: typing.Optional[bool] = pydantic.Field(default=None) + """ + Identifies if this admin is set to automatically reassign new conversations to the apps default inbox. + """ + + away_status_reason_id: typing.Optional[int] = pydantic.Field(default=None) + """ + The unique identifier of the away status reason + """ + + has_inbox_seat: typing.Optional[bool] = pydantic.Field(default=None) + """ + Identifies if this admin has a paid inbox seat to restrict/allow features that require them. + """ + + team_ids: typing.Optional[typing.List[int]] = pydantic.Field(default=None) + """ + This object represents the avatar associated with the admin. + """ + + avatar: typing.Optional[str] = pydantic.Field(default=None) + """ + Image for the associated team or teammate + """ + + team_priority_level: typing.Optional[TeamPriorityLevel] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/ai_agent/__init__.py b/src/intercom/unstable/ai_agent/__init__.py new file mode 100644 index 0000000..da3b829 --- /dev/null +++ b/src/intercom/unstable/ai_agent/__init__.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .types import AiAgent, AiAgentSourceType + +__all__ = ["AiAgent", "AiAgentSourceType"] diff --git a/src/intercom/unstable/ai_agent/types/__init__.py b/src/intercom/unstable/ai_agent/types/__init__.py new file mode 100644 index 0000000..5793a5c --- /dev/null +++ b/src/intercom/unstable/ai_agent/types/__init__.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .ai_agent import AiAgent +from .ai_agent_source_type import AiAgentSourceType + +__all__ = ["AiAgent", "AiAgentSourceType"] diff --git a/src/intercom/unstable/ai_agent/types/ai_agent.py b/src/intercom/unstable/ai_agent/types/ai_agent.py new file mode 100644 index 0000000..3c61c27 --- /dev/null +++ b/src/intercom/unstable/ai_agent/types/ai_agent.py @@ -0,0 +1,56 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from ...types.content_sources_list import ContentSourcesList +from .ai_agent_source_type import AiAgentSourceType + + +class AiAgent(UncheckedBaseModel): + """ + Data related to AI Agent involvement in the conversation. + """ + + source_type: typing.Optional[AiAgentSourceType] = pydantic.Field(default=None) + """ + The type of the source that triggered AI Agent involvement in the conversation. + """ + + source_title: typing.Optional[str] = pydantic.Field(default=None) + """ + The title of the source that triggered AI Agent involvement in the conversation. If this is `essentials_plan_setup` then it will return `null`. + """ + + last_answer_type: typing.Optional[str] = pydantic.Field(default=None) + """ + The type of the last answer delivered by AI Agent. If no answer was delivered then this will return `null` + """ + + resolution_state: typing.Optional[str] = pydantic.Field(default=None) + """ + The resolution state of AI Agent. If no AI or custom answer has been delivered then this will return `null`. + """ + + rating: typing.Optional[int] = pydantic.Field(default=None) + """ + The customer satisfaction rating given to AI Agent, from 1-5. + """ + + rating_remark: typing.Optional[str] = pydantic.Field(default=None) + """ + The customer satisfaction rating remark given to AI Agent. + """ + + content_sources: typing.Optional[ContentSourcesList] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/ai_agent/types/ai_agent_source_type.py b/src/intercom/unstable/ai_agent/types/ai_agent_source_type.py new file mode 100644 index 0000000..f108bc8 --- /dev/null +++ b/src/intercom/unstable/ai_agent/types/ai_agent_source_type.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AiAgentSourceType = typing.Union[ + typing.Literal["essentials_plan_setup", "profile", "workflow", "workflow_preview", "fin_preview"], typing.Any +] diff --git a/src/intercom/unstable/ai_content/__init__.py b/src/intercom/unstable/ai_content/__init__.py new file mode 100644 index 0000000..80c5656 --- /dev/null +++ b/src/intercom/unstable/ai_content/__init__.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .types import ( + ContentImportSource, + ContentImportSourceStatus, + ContentImportSourceSyncBehavior, + ContentImportSourcesList, + CreateContentImportSourceRequestStatus, + ExternalPage, + ExternalPagesList, + UpdateContentImportSourceRequestStatus, + UpdateContentImportSourceRequestSyncBehavior, +) + +__all__ = [ + "ContentImportSource", + "ContentImportSourceStatus", + "ContentImportSourceSyncBehavior", + "ContentImportSourcesList", + "CreateContentImportSourceRequestStatus", + "ExternalPage", + "ExternalPagesList", + "UpdateContentImportSourceRequestStatus", + "UpdateContentImportSourceRequestSyncBehavior", +] diff --git a/src/intercom/unstable/ai_content/client.py b/src/intercom/unstable/ai_content/client.py new file mode 100644 index 0000000..7d2ed8a --- /dev/null +++ b/src/intercom/unstable/ai_content/client.py @@ -0,0 +1,973 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from .raw_client import AsyncRawAiContentClient, RawAiContentClient +from .types.content_import_source import ContentImportSource +from .types.content_import_sources_list import ContentImportSourcesList +from .types.create_content_import_source_request_status import CreateContentImportSourceRequestStatus +from .types.external_page import ExternalPage +from .types.external_pages_list import ExternalPagesList +from .types.update_content_import_source_request_status import UpdateContentImportSourceRequestStatus +from .types.update_content_import_source_request_sync_behavior import UpdateContentImportSourceRequestSyncBehavior + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class AiContentClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawAiContentClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawAiContentClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawAiContentClient + """ + return self._raw_client + + def list_content_import_sources( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> ContentImportSourcesList: + """ + You can retrieve a list of all content import sources for a workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ContentImportSourcesList + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.ai_content.list_content_import_sources() + """ + _response = self._raw_client.list_content_import_sources(request_options=request_options) + return _response.data + + def create_content_import_source( + self, + *, + url: str, + status: typing.Optional[CreateContentImportSourceRequestStatus] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ContentImportSource: + """ + You can create a new content import source by sending a POST request to this endpoint. + + Parameters + ---------- + url : str + The URL of the content import source. + + status : typing.Optional[CreateContentImportSourceRequestStatus] + The status of the content import source. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ContentImportSource + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.ai_content.create_content_import_source( + url="https://www.example.com", + ) + """ + _response = self._raw_client.create_content_import_source( + url=url, status=status, request_options=request_options + ) + return _response.data + + def get_content_import_source( + self, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ContentImportSource: + """ + Parameters + ---------- + id : str + The unique identifier for the content import source which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ContentImportSource + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.ai_content.get_content_import_source( + id="id", + ) + """ + _response = self._raw_client.get_content_import_source(id, request_options=request_options) + return _response.data + + def update_content_import_source( + self, + id: str, + *, + sync_behavior: UpdateContentImportSourceRequestSyncBehavior, + url: str, + status: typing.Optional[UpdateContentImportSourceRequestStatus] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ContentImportSource: + """ + You can update an existing content import source. + + Parameters + ---------- + id : str + The unique identifier for the content import source which is given by Intercom. + + sync_behavior : UpdateContentImportSourceRequestSyncBehavior + If you intend to create or update External Pages via the API, this should be set to `api`. You can not change the value to or from api. + + url : str + The URL of the content import source. This may only be different from the existing value if the sync behavior is API. + + status : typing.Optional[UpdateContentImportSourceRequestStatus] + The status of the content import source. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ContentImportSource + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.ai_content.update_content_import_source( + id="id", + sync_behavior="api", + url="https://www.example.com", + ) + """ + _response = self._raw_client.update_content_import_source( + id, sync_behavior=sync_behavior, url=url, status=status, request_options=request_options + ) + return _response.data + + def delete_content_import_source(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + You can delete a content import source by making a DELETE request this endpoint. This will also delete all external pages that were imported from this source. + + Parameters + ---------- + id : str + The unique identifier for the content import source which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.ai_content.delete_content_import_source( + id="id", + ) + """ + _response = self._raw_client.delete_content_import_source(id, request_options=request_options) + return _response.data + + def list_external_pages(self, *, request_options: typing.Optional[RequestOptions] = None) -> ExternalPagesList: + """ + You can retrieve a list of all external pages for a workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ExternalPagesList + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.ai_content.list_external_pages() + """ + _response = self._raw_client.list_external_pages(request_options=request_options) + return _response.data + + def create_external_page( + self, + *, + title: str, + html: str, + source_id: int, + external_id: str, + url: typing.Optional[str] = OMIT, + ai_agent_availability: typing.Optional[bool] = OMIT, + ai_copilot_availability: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ExternalPage: + """ + You can create a new external page by sending a POST request to this endpoint. If an external page already exists with the specified source_id and external_id, it will be updated instead. + + Parameters + ---------- + title : str + The title of the external page. + + html : str + The body of the external page in HTML. + + source_id : int + The unique identifier for the source of the external page which was given by Intercom. Every external page must be associated with a Content Import Source which represents the place it comes from and from which it inherits a default audience (configured in the UI). For a new source, make a POST request to the Content Import Source endpoint and an ID for the source will be returned in the response. + + external_id : str + The identifier for the external page which was given by the source. Must be unique for the source. + + url : typing.Optional[str] + The URL of the external page. This will be used by Fin to link end users to the page it based its answer on. When a URL is not present, Fin will not reference the source. + + ai_agent_availability : typing.Optional[bool] + Whether the external page should be used to answer questions by AI Agent. Will not default when updating an existing external page. + + ai_copilot_availability : typing.Optional[bool] + Whether the external page should be used to answer questions by AI Copilot. Will not default when updating an existing external page. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ExternalPage + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.ai_content.create_external_page( + title="Test", + html="New costumes in store for this spooky season
", + sender_id=991267834, + state="live", + deliver_silently=True, + labels=["Product", "Update", "New"], + reactions=["😆", "😅"], + newsfeed_assignments=[ + NewsfeedAssignment( + newsfeed_id=53, + published_at=1664638214, + ) + ], + ) + """ + _response = self._raw_client.create_news_item( + title=title, + sender_id=sender_id, + body=body, + state=state, + deliver_silently=deliver_silently, + labels=labels, + reactions=reactions, + newsfeed_assignments=newsfeed_assignments, + request_options=request_options, + ) + return _response.data + + def retrieve_news_item(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> NewsItem: + """ + You can fetch the details of a single news item. + + Parameters + ---------- + id : int + The unique identifier for the news item which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + NewsItem + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.news.retrieve_news_item( + id=1, + ) + """ + _response = self._raw_client.retrieve_news_item(id, request_options=request_options) + return _response.data + + def update_news_item( + self, + id: int, + *, + title: str, + sender_id: int, + body: typing.Optional[str] = OMIT, + state: typing.Optional[NewsItemRequestState] = OMIT, + deliver_silently: typing.Optional[bool] = OMIT, + labels: typing.Optional[typing.Sequence[str]] = OMIT, + reactions: typing.Optional[typing.Sequence[typing.Optional[str]]] = OMIT, + newsfeed_assignments: typing.Optional[typing.Sequence[NewsfeedAssignment]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> NewsItem: + """ + Parameters + ---------- + id : int + The unique identifier for the news item which is given by Intercom. + + title : str + The title of the news item. + + sender_id : int + The id of the sender of the news item. Must be a teammate on the workspace. + + body : typing.Optional[str] + The news item body, which may contain HTML. + + state : typing.Optional[NewsItemRequestState] + News items will not be visible to your users in the assigned newsfeeds until they are set live. + + deliver_silently : typing.Optional[bool] + When set to `true`, the news item will appear in the messenger newsfeed without showing a notification badge. + + labels : typing.Optional[typing.Sequence[str]] + Label names displayed to users to categorize the news item. + + reactions : typing.Optional[typing.Sequence[typing.Optional[str]]] + Ordered list of emoji reactions to the news item. When empty, reactions are disabled. + + newsfeed_assignments : typing.Optional[typing.Sequence[NewsfeedAssignment]] + A list of newsfeed_assignments to assign to the specified newsfeed. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + NewsItem + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.news.update_news_item( + id=1, + title="Christmas is here!", + body="New gifts in store for the jolly season
", + sender_id=991267845, + reactions=["😝", "😂"], + ) + """ + _response = self._raw_client.update_news_item( + id, + title=title, + sender_id=sender_id, + body=body, + state=state, + deliver_silently=deliver_silently, + labels=labels, + reactions=reactions, + newsfeed_assignments=newsfeed_assignments, + request_options=request_options, + ) + return _response.data + + def delete_news_item(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> DeletedObject: + """ + You can delete a single news item. + + Parameters + ---------- + id : int + The unique identifier for the news item which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeletedObject + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.news.delete_news_item( + id=1, + ) + """ + _response = self._raw_client.delete_news_item(id, request_options=request_options) + return _response.data + + def list_live_newsfeed_items( + self, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> PaginatedResponse: + """ + You can fetch a list of all news items that are live on a given newsfeed + + Parameters + ---------- + id : str + The unique identifier for the news feed item which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PaginatedResponse + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.news.list_live_newsfeed_items( + id="123", + ) + """ + _response = self._raw_client.list_live_newsfeed_items(id, request_options=request_options) + return _response.data + + def list_newsfeeds(self, *, request_options: typing.Optional[RequestOptions] = None) -> PaginatedResponse: + """ + You can fetch a list of all newsfeeds + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PaginatedResponse + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.news.list_newsfeeds() + """ + _response = self._raw_client.list_newsfeeds(request_options=request_options) + return _response.data + + def retrieve_newsfeed(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Newsfeed: + """ + You can fetch the details of a single newsfeed + + Parameters + ---------- + id : str + The unique identifier for the news feed item which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Newsfeed + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.news.retrieve_newsfeed( + id="123", + ) + """ + _response = self._raw_client.retrieve_newsfeed(id, request_options=request_options) + return _response.data + + +class AsyncNewsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawNewsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawNewsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawNewsClient + """ + return self._raw_client + + async def list_news_items(self, *, request_options: typing.Optional[RequestOptions] = None) -> PaginatedResponse: + """ + You can fetch a list of all news items + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PaginatedResponse + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.news.list_news_items() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list_news_items(request_options=request_options) + return _response.data + + async def create_news_item( + self, + *, + title: str, + sender_id: int, + body: typing.Optional[str] = OMIT, + state: typing.Optional[NewsItemRequestState] = OMIT, + deliver_silently: typing.Optional[bool] = OMIT, + labels: typing.Optional[typing.Sequence[str]] = OMIT, + reactions: typing.Optional[typing.Sequence[typing.Optional[str]]] = OMIT, + newsfeed_assignments: typing.Optional[typing.Sequence[NewsfeedAssignment]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> NewsItem: + """ + You can create a news item + + Parameters + ---------- + title : str + The title of the news item. + + sender_id : int + The id of the sender of the news item. Must be a teammate on the workspace. + + body : typing.Optional[str] + The news item body, which may contain HTML. + + state : typing.Optional[NewsItemRequestState] + News items will not be visible to your users in the assigned newsfeeds until they are set live. + + deliver_silently : typing.Optional[bool] + When set to `true`, the news item will appear in the messenger newsfeed without showing a notification badge. + + labels : typing.Optional[typing.Sequence[str]] + Label names displayed to users to categorize the news item. + + reactions : typing.Optional[typing.Sequence[typing.Optional[str]]] + Ordered list of emoji reactions to the news item. When empty, reactions are disabled. + + newsfeed_assignments : typing.Optional[typing.Sequence[NewsfeedAssignment]] + A list of newsfeed_assignments to assign to the specified newsfeed. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + NewsItem + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + from intercom.unstable.news import NewsfeedAssignment + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.news.create_news_item( + title="Halloween is here!", + body="New costumes in store for this spooky season
", + sender_id=991267834, + state="live", + deliver_silently=True, + labels=["Product", "Update", "New"], + reactions=["😆", "😅"], + newsfeed_assignments=[ + NewsfeedAssignment( + newsfeed_id=53, + published_at=1664638214, + ) + ], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create_news_item( + title=title, + sender_id=sender_id, + body=body, + state=state, + deliver_silently=deliver_silently, + labels=labels, + reactions=reactions, + newsfeed_assignments=newsfeed_assignments, + request_options=request_options, + ) + return _response.data + + async def retrieve_news_item(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> NewsItem: + """ + You can fetch the details of a single news item. + + Parameters + ---------- + id : int + The unique identifier for the news item which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + NewsItem + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.news.retrieve_news_item( + id=1, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.retrieve_news_item(id, request_options=request_options) + return _response.data + + async def update_news_item( + self, + id: int, + *, + title: str, + sender_id: int, + body: typing.Optional[str] = OMIT, + state: typing.Optional[NewsItemRequestState] = OMIT, + deliver_silently: typing.Optional[bool] = OMIT, + labels: typing.Optional[typing.Sequence[str]] = OMIT, + reactions: typing.Optional[typing.Sequence[typing.Optional[str]]] = OMIT, + newsfeed_assignments: typing.Optional[typing.Sequence[NewsfeedAssignment]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> NewsItem: + """ + Parameters + ---------- + id : int + The unique identifier for the news item which is given by Intercom. + + title : str + The title of the news item. + + sender_id : int + The id of the sender of the news item. Must be a teammate on the workspace. + + body : typing.Optional[str] + The news item body, which may contain HTML. + + state : typing.Optional[NewsItemRequestState] + News items will not be visible to your users in the assigned newsfeeds until they are set live. + + deliver_silently : typing.Optional[bool] + When set to `true`, the news item will appear in the messenger newsfeed without showing a notification badge. + + labels : typing.Optional[typing.Sequence[str]] + Label names displayed to users to categorize the news item. + + reactions : typing.Optional[typing.Sequence[typing.Optional[str]]] + Ordered list of emoji reactions to the news item. When empty, reactions are disabled. + + newsfeed_assignments : typing.Optional[typing.Sequence[NewsfeedAssignment]] + A list of newsfeed_assignments to assign to the specified newsfeed. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + NewsItem + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.news.update_news_item( + id=1, + title="Christmas is here!", + body="New gifts in store for the jolly season
", + sender_id=991267845, + reactions=["😝", "😂"], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update_news_item( + id, + title=title, + sender_id=sender_id, + body=body, + state=state, + deliver_silently=deliver_silently, + labels=labels, + reactions=reactions, + newsfeed_assignments=newsfeed_assignments, + request_options=request_options, + ) + return _response.data + + async def delete_news_item( + self, id: int, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeletedObject: + """ + You can delete a single news item. + + Parameters + ---------- + id : int + The unique identifier for the news item which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeletedObject + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.news.delete_news_item( + id=1, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete_news_item(id, request_options=request_options) + return _response.data + + async def list_live_newsfeed_items( + self, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> PaginatedResponse: + """ + You can fetch a list of all news items that are live on a given newsfeed + + Parameters + ---------- + id : str + The unique identifier for the news feed item which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PaginatedResponse + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.news.list_live_newsfeed_items( + id="123", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list_live_newsfeed_items(id, request_options=request_options) + return _response.data + + async def list_newsfeeds(self, *, request_options: typing.Optional[RequestOptions] = None) -> PaginatedResponse: + """ + You can fetch a list of all newsfeeds + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PaginatedResponse + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.news.list_newsfeeds() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list_newsfeeds(request_options=request_options) + return _response.data + + async def retrieve_newsfeed(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Newsfeed: + """ + You can fetch the details of a single newsfeed + + Parameters + ---------- + id : str + The unique identifier for the news feed item which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Newsfeed + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.news.retrieve_newsfeed( + id="123", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.retrieve_newsfeed(id, request_options=request_options) + return _response.data diff --git a/src/intercom/unstable/news/raw_client.py b/src/intercom/unstable/news/raw_client.py new file mode 100644 index 0000000..b02fc9c --- /dev/null +++ b/src/intercom/unstable/news/raw_client.py @@ -0,0 +1,1080 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ..errors.not_found_error import NotFoundError +from ..errors.unauthorized_error import UnauthorizedError +from ..types.deleted_object import DeletedObject +from ..types.error import Error +from ..types.news_item_request_state import NewsItemRequestState +from ..types.paginated_response import PaginatedResponse +from .types.news_item import NewsItem +from .types.newsfeed import Newsfeed +from .types.newsfeed_assignment import NewsfeedAssignment + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawNewsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list_news_items( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[PaginatedResponse]: + """ + You can fetch a list of all news items + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[PaginatedResponse] + successful + """ + _response = self._client_wrapper.httpx_client.request( + "news/news_items", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PaginatedResponse, + construct_type( + type_=PaginatedResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create_news_item( + self, + *, + title: str, + sender_id: int, + body: typing.Optional[str] = OMIT, + state: typing.Optional[NewsItemRequestState] = OMIT, + deliver_silently: typing.Optional[bool] = OMIT, + labels: typing.Optional[typing.Sequence[str]] = OMIT, + reactions: typing.Optional[typing.Sequence[typing.Optional[str]]] = OMIT, + newsfeed_assignments: typing.Optional[typing.Sequence[NewsfeedAssignment]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[NewsItem]: + """ + You can create a news item + + Parameters + ---------- + title : str + The title of the news item. + + sender_id : int + The id of the sender of the news item. Must be a teammate on the workspace. + + body : typing.Optional[str] + The news item body, which may contain HTML. + + state : typing.Optional[NewsItemRequestState] + News items will not be visible to your users in the assigned newsfeeds until they are set live. + + deliver_silently : typing.Optional[bool] + When set to `true`, the news item will appear in the messenger newsfeed without showing a notification badge. + + labels : typing.Optional[typing.Sequence[str]] + Label names displayed to users to categorize the news item. + + reactions : typing.Optional[typing.Sequence[typing.Optional[str]]] + Ordered list of emoji reactions to the news item. When empty, reactions are disabled. + + newsfeed_assignments : typing.Optional[typing.Sequence[NewsfeedAssignment]] + A list of newsfeed_assignments to assign to the specified newsfeed. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[NewsItem] + successful + """ + _response = self._client_wrapper.httpx_client.request( + "news/news_items", + method="POST", + json={ + "title": title, + "body": body, + "sender_id": sender_id, + "state": state, + "deliver_silently": deliver_silently, + "labels": labels, + "reactions": reactions, + "newsfeed_assignments": convert_and_respect_annotation_metadata( + object_=newsfeed_assignments, annotation=typing.Sequence[NewsfeedAssignment], direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + NewsItem, + construct_type( + type_=NewsItem, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def retrieve_news_item( + self, id: int, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[NewsItem]: + """ + You can fetch the details of a single news item. + + Parameters + ---------- + id : int + The unique identifier for the news item which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[NewsItem] + successful + """ + _response = self._client_wrapper.httpx_client.request( + f"news/news_items/{jsonable_encoder(id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + NewsItem, + construct_type( + type_=NewsItem, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update_news_item( + self, + id: int, + *, + title: str, + sender_id: int, + body: typing.Optional[str] = OMIT, + state: typing.Optional[NewsItemRequestState] = OMIT, + deliver_silently: typing.Optional[bool] = OMIT, + labels: typing.Optional[typing.Sequence[str]] = OMIT, + reactions: typing.Optional[typing.Sequence[typing.Optional[str]]] = OMIT, + newsfeed_assignments: typing.Optional[typing.Sequence[NewsfeedAssignment]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[NewsItem]: + """ + Parameters + ---------- + id : int + The unique identifier for the news item which is given by Intercom. + + title : str + The title of the news item. + + sender_id : int + The id of the sender of the news item. Must be a teammate on the workspace. + + body : typing.Optional[str] + The news item body, which may contain HTML. + + state : typing.Optional[NewsItemRequestState] + News items will not be visible to your users in the assigned newsfeeds until they are set live. + + deliver_silently : typing.Optional[bool] + When set to `true`, the news item will appear in the messenger newsfeed without showing a notification badge. + + labels : typing.Optional[typing.Sequence[str]] + Label names displayed to users to categorize the news item. + + reactions : typing.Optional[typing.Sequence[typing.Optional[str]]] + Ordered list of emoji reactions to the news item. When empty, reactions are disabled. + + newsfeed_assignments : typing.Optional[typing.Sequence[NewsfeedAssignment]] + A list of newsfeed_assignments to assign to the specified newsfeed. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[NewsItem] + successful + """ + _response = self._client_wrapper.httpx_client.request( + f"news/news_items/{jsonable_encoder(id)}", + method="PUT", + json={ + "title": title, + "body": body, + "sender_id": sender_id, + "state": state, + "deliver_silently": deliver_silently, + "labels": labels, + "reactions": reactions, + "newsfeed_assignments": convert_and_respect_annotation_metadata( + object_=newsfeed_assignments, annotation=typing.Sequence[NewsfeedAssignment], direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + NewsItem, + construct_type( + type_=NewsItem, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete_news_item( + self, id: int, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DeletedObject]: + """ + You can delete a single news item. + + Parameters + ---------- + id : int + The unique identifier for the news item which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DeletedObject] + successful + """ + _response = self._client_wrapper.httpx_client.request( + f"news/news_items/{jsonable_encoder(id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeletedObject, + construct_type( + type_=DeletedObject, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def list_live_newsfeed_items( + self, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[PaginatedResponse]: + """ + You can fetch a list of all news items that are live on a given newsfeed + + Parameters + ---------- + id : str + The unique identifier for the news feed item which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[PaginatedResponse] + successful + """ + _response = self._client_wrapper.httpx_client.request( + f"news/newsfeeds/{jsonable_encoder(id)}/items", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PaginatedResponse, + construct_type( + type_=PaginatedResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def list_newsfeeds( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[PaginatedResponse]: + """ + You can fetch a list of all newsfeeds + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[PaginatedResponse] + successful + """ + _response = self._client_wrapper.httpx_client.request( + "news/newsfeeds", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PaginatedResponse, + construct_type( + type_=PaginatedResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def retrieve_newsfeed( + self, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[Newsfeed]: + """ + You can fetch the details of a single newsfeed + + Parameters + ---------- + id : str + The unique identifier for the news feed item which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Newsfeed] + successful + """ + _response = self._client_wrapper.httpx_client.request( + f"news/newsfeeds/{jsonable_encoder(id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Newsfeed, + construct_type( + type_=Newsfeed, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawNewsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list_news_items( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[PaginatedResponse]: + """ + You can fetch a list of all news items + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[PaginatedResponse] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + "news/news_items", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PaginatedResponse, + construct_type( + type_=PaginatedResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create_news_item( + self, + *, + title: str, + sender_id: int, + body: typing.Optional[str] = OMIT, + state: typing.Optional[NewsItemRequestState] = OMIT, + deliver_silently: typing.Optional[bool] = OMIT, + labels: typing.Optional[typing.Sequence[str]] = OMIT, + reactions: typing.Optional[typing.Sequence[typing.Optional[str]]] = OMIT, + newsfeed_assignments: typing.Optional[typing.Sequence[NewsfeedAssignment]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[NewsItem]: + """ + You can create a news item + + Parameters + ---------- + title : str + The title of the news item. + + sender_id : int + The id of the sender of the news item. Must be a teammate on the workspace. + + body : typing.Optional[str] + The news item body, which may contain HTML. + + state : typing.Optional[NewsItemRequestState] + News items will not be visible to your users in the assigned newsfeeds until they are set live. + + deliver_silently : typing.Optional[bool] + When set to `true`, the news item will appear in the messenger newsfeed without showing a notification badge. + + labels : typing.Optional[typing.Sequence[str]] + Label names displayed to users to categorize the news item. + + reactions : typing.Optional[typing.Sequence[typing.Optional[str]]] + Ordered list of emoji reactions to the news item. When empty, reactions are disabled. + + newsfeed_assignments : typing.Optional[typing.Sequence[NewsfeedAssignment]] + A list of newsfeed_assignments to assign to the specified newsfeed. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[NewsItem] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + "news/news_items", + method="POST", + json={ + "title": title, + "body": body, + "sender_id": sender_id, + "state": state, + "deliver_silently": deliver_silently, + "labels": labels, + "reactions": reactions, + "newsfeed_assignments": convert_and_respect_annotation_metadata( + object_=newsfeed_assignments, annotation=typing.Sequence[NewsfeedAssignment], direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + NewsItem, + construct_type( + type_=NewsItem, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def retrieve_news_item( + self, id: int, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[NewsItem]: + """ + You can fetch the details of a single news item. + + Parameters + ---------- + id : int + The unique identifier for the news item which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[NewsItem] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"news/news_items/{jsonable_encoder(id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + NewsItem, + construct_type( + type_=NewsItem, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update_news_item( + self, + id: int, + *, + title: str, + sender_id: int, + body: typing.Optional[str] = OMIT, + state: typing.Optional[NewsItemRequestState] = OMIT, + deliver_silently: typing.Optional[bool] = OMIT, + labels: typing.Optional[typing.Sequence[str]] = OMIT, + reactions: typing.Optional[typing.Sequence[typing.Optional[str]]] = OMIT, + newsfeed_assignments: typing.Optional[typing.Sequence[NewsfeedAssignment]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[NewsItem]: + """ + Parameters + ---------- + id : int + The unique identifier for the news item which is given by Intercom. + + title : str + The title of the news item. + + sender_id : int + The id of the sender of the news item. Must be a teammate on the workspace. + + body : typing.Optional[str] + The news item body, which may contain HTML. + + state : typing.Optional[NewsItemRequestState] + News items will not be visible to your users in the assigned newsfeeds until they are set live. + + deliver_silently : typing.Optional[bool] + When set to `true`, the news item will appear in the messenger newsfeed without showing a notification badge. + + labels : typing.Optional[typing.Sequence[str]] + Label names displayed to users to categorize the news item. + + reactions : typing.Optional[typing.Sequence[typing.Optional[str]]] + Ordered list of emoji reactions to the news item. When empty, reactions are disabled. + + newsfeed_assignments : typing.Optional[typing.Sequence[NewsfeedAssignment]] + A list of newsfeed_assignments to assign to the specified newsfeed. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[NewsItem] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"news/news_items/{jsonable_encoder(id)}", + method="PUT", + json={ + "title": title, + "body": body, + "sender_id": sender_id, + "state": state, + "deliver_silently": deliver_silently, + "labels": labels, + "reactions": reactions, + "newsfeed_assignments": convert_and_respect_annotation_metadata( + object_=newsfeed_assignments, annotation=typing.Sequence[NewsfeedAssignment], direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + NewsItem, + construct_type( + type_=NewsItem, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete_news_item( + self, id: int, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DeletedObject]: + """ + You can delete a single news item. + + Parameters + ---------- + id : int + The unique identifier for the news item which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DeletedObject] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"news/news_items/{jsonable_encoder(id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeletedObject, + construct_type( + type_=DeletedObject, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def list_live_newsfeed_items( + self, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[PaginatedResponse]: + """ + You can fetch a list of all news items that are live on a given newsfeed + + Parameters + ---------- + id : str + The unique identifier for the news feed item which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[PaginatedResponse] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"news/newsfeeds/{jsonable_encoder(id)}/items", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PaginatedResponse, + construct_type( + type_=PaginatedResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def list_newsfeeds( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[PaginatedResponse]: + """ + You can fetch a list of all newsfeeds + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[PaginatedResponse] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + "news/newsfeeds", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PaginatedResponse, + construct_type( + type_=PaginatedResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def retrieve_newsfeed( + self, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[Newsfeed]: + """ + You can fetch the details of a single newsfeed + + Parameters + ---------- + id : str + The unique identifier for the news feed item which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Newsfeed] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"news/newsfeeds/{jsonable_encoder(id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Newsfeed, + construct_type( + type_=Newsfeed, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/intercom/unstable/news/types/__init__.py b/src/intercom/unstable/news/types/__init__.py new file mode 100644 index 0000000..3cd466b --- /dev/null +++ b/src/intercom/unstable/news/types/__init__.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .news_item import NewsItem +from .news_item_state import NewsItemState +from .newsfeed import Newsfeed +from .newsfeed_assignment import NewsfeedAssignment + +__all__ = ["NewsItem", "NewsItemState", "Newsfeed", "NewsfeedAssignment"] diff --git a/src/intercom/unstable/news/types/news_item.py b/src/intercom/unstable/news/types/news_item.py new file mode 100644 index 0000000..51bc531 --- /dev/null +++ b/src/intercom/unstable/news/types/news_item.py @@ -0,0 +1,89 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from .news_item_state import NewsItemState +from .newsfeed_assignment import NewsfeedAssignment + + +class NewsItem(UncheckedBaseModel): + """ + A News Item is a content type in Intercom enabling you to announce product updates, company news, promotions, events and more with your customers. + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The unique identifier for the news item which is given by Intercom. + """ + + workspace_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id of the workspace which the news item belongs to. + """ + + title: typing.Optional[str] = pydantic.Field(default=None) + """ + The title of the news item. + """ + + body: typing.Optional[str] = pydantic.Field(default=None) + """ + The news item body, which may contain HTML. + """ + + sender_id: typing.Optional[int] = pydantic.Field(default=None) + """ + The id of the sender of the news item. Must be a teammate on the workspace. + """ + + state: typing.Optional[NewsItemState] = pydantic.Field(default=None) + """ + News items will not be visible to your users in the assigned newsfeeds until they are set live. + """ + + newsfeed_assignments: typing.Optional[typing.List[NewsfeedAssignment]] = pydantic.Field(default=None) + """ + A list of newsfeed_assignments to assign to the specified newsfeed. + """ + + labels: typing.Optional[typing.List[typing.Optional[str]]] = pydantic.Field(default=None) + """ + Label names displayed to users to categorize the news item. + """ + + cover_image_url: typing.Optional[str] = pydantic.Field(default=None) + """ + URL of the image used as cover. Must have .jpg or .png extension. + """ + + reactions: typing.Optional[typing.List[typing.Optional[str]]] = pydantic.Field(default=None) + """ + Ordered list of emoji reactions to the news item. When empty, reactions are disabled. + """ + + deliver_silently: typing.Optional[bool] = pydantic.Field(default=None) + """ + When set to true, the news item will appear in the messenger newsfeed without showing a notification badge. + """ + + created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + Timestamp for when the news item was created. + """ + + updated_at: typing.Optional[int] = pydantic.Field(default=None) + """ + Timestamp for when the news item was last updated. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/news/types/news_item_state.py b/src/intercom/unstable/news/types/news_item_state.py new file mode 100644 index 0000000..2b16536 --- /dev/null +++ b/src/intercom/unstable/news/types/news_item_state.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +NewsItemState = typing.Union[typing.Literal["draft", "live"], typing.Any] diff --git a/src/intercom/unstable/news/types/newsfeed.py b/src/intercom/unstable/news/types/newsfeed.py new file mode 100644 index 0000000..d5045c4 --- /dev/null +++ b/src/intercom/unstable/news/types/newsfeed.py @@ -0,0 +1,44 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel + + +class Newsfeed(UncheckedBaseModel): + """ + A newsfeed is a collection of news items, targeted to a specific audience. + + Newsfeeds currently cannot be edited through the API, please refer to [this article](https://www.intercom.com/help/en/articles/6362267-getting-started-with-news) to set up your newsfeeds in Intercom. + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The unique identifier for the newsfeed which is given by Intercom. + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the newsfeed. This name will never be visible to your users. + """ + + created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + Timestamp for when the newsfeed was created. + """ + + updated_at: typing.Optional[int] = pydantic.Field(default=None) + """ + Timestamp for when the newsfeed was last updated. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/news/types/newsfeed_assignment.py b/src/intercom/unstable/news/types/newsfeed_assignment.py new file mode 100644 index 0000000..124dc6a --- /dev/null +++ b/src/intercom/unstable/news/types/newsfeed_assignment.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel + + +class NewsfeedAssignment(UncheckedBaseModel): + """ + Assigns a news item to a newsfeed. + """ + + newsfeed_id: typing.Optional[int] = pydantic.Field(default=None) + """ + The unique identifier for the newsfeed which is given by Intercom. Publish dates cannot be in the future, to schedule news items use the dedicated feature in app (see this article). + """ + + published_at: typing.Optional[int] = pydantic.Field(default=None) + """ + Publish date of the news item on the newsfeed, use this field if you want to set a publish date in the past (e.g. when importing existing news items). On write, this field will be ignored if the news item state is "draft". + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/notes/__init__.py b/src/intercom/unstable/notes/__init__.py new file mode 100644 index 0000000..f4f2a2b --- /dev/null +++ b/src/intercom/unstable/notes/__init__.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .types import Note, NoteContact + +__all__ = ["Note", "NoteContact"] diff --git a/src/intercom/unstable/notes/client.py b/src/intercom/unstable/notes/client.py new file mode 100644 index 0000000..78b0daa --- /dev/null +++ b/src/intercom/unstable/notes/client.py @@ -0,0 +1,298 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ..types.note_list import NoteList +from .raw_client import AsyncRawNotesClient, RawNotesClient +from .types.note import Note + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class NotesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawNotesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawNotesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawNotesClient + """ + return self._raw_client + + def list_notes(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> NoteList: + """ + You can fetch a list of notes that are associated to a contact. + + Parameters + ---------- + id : int + The unique identifier of a contact. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + NoteList + Successful response + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.notes.list_notes( + id=1, + ) + """ + _response = self._raw_client.list_notes(id, request_options=request_options) + return _response.data + + def create_note( + self, + id: int, + *, + body: str, + contact_id: typing.Optional[str] = OMIT, + admin_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Note: + """ + You can add a note to a single contact. + + Parameters + ---------- + id : int + The unique identifier of a given contact. + + body : str + The text of the note. + + contact_id : typing.Optional[str] + The unique identifier of a given contact. + + admin_id : typing.Optional[str] + The unique identifier of a given admin. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Note + Successful response + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.notes.create_note( + id=1, + body="Hello", + contact_id="6762f0ad1bb69f9f2193bb62", + admin_id="123", + ) + """ + _response = self._raw_client.create_note( + id, body=body, contact_id=contact_id, admin_id=admin_id, request_options=request_options + ) + return _response.data + + def retrieve_note(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> Note: + """ + You can fetch the details of a single note. + + Parameters + ---------- + id : int + The unique identifier of a given note + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Note + Note found + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.notes.retrieve_note( + id=1, + ) + """ + _response = self._raw_client.retrieve_note(id, request_options=request_options) + return _response.data + + +class AsyncNotesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawNotesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawNotesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawNotesClient + """ + return self._raw_client + + async def list_notes(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> NoteList: + """ + You can fetch a list of notes that are associated to a contact. + + Parameters + ---------- + id : int + The unique identifier of a contact. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + NoteList + Successful response + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.notes.list_notes( + id=1, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list_notes(id, request_options=request_options) + return _response.data + + async def create_note( + self, + id: int, + *, + body: str, + contact_id: typing.Optional[str] = OMIT, + admin_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Note: + """ + You can add a note to a single contact. + + Parameters + ---------- + id : int + The unique identifier of a given contact. + + body : str + The text of the note. + + contact_id : typing.Optional[str] + The unique identifier of a given contact. + + admin_id : typing.Optional[str] + The unique identifier of a given admin. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Note + Successful response + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.notes.create_note( + id=1, + body="Hello", + contact_id="6762f0ad1bb69f9f2193bb62", + admin_id="123", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create_note( + id, body=body, contact_id=contact_id, admin_id=admin_id, request_options=request_options + ) + return _response.data + + async def retrieve_note(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> Note: + """ + You can fetch the details of a single note. + + Parameters + ---------- + id : int + The unique identifier of a given note + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Note + Note found + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.notes.retrieve_note( + id=1, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.retrieve_note(id, request_options=request_options) + return _response.data diff --git a/src/intercom/unstable/notes/raw_client.py b/src/intercom/unstable/notes/raw_client.py new file mode 100644 index 0000000..29426fc --- /dev/null +++ b/src/intercom/unstable/notes/raw_client.py @@ -0,0 +1,395 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ..errors.not_found_error import NotFoundError +from ..errors.unauthorized_error import UnauthorizedError +from ..types.error import Error +from ..types.note_list import NoteList +from .types.note import Note + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawNotesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list_notes(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[NoteList]: + """ + You can fetch a list of notes that are associated to a contact. + + Parameters + ---------- + id : int + The unique identifier of a contact. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[NoteList] + Successful response + """ + _response = self._client_wrapper.httpx_client.request( + f"contacts/{jsonable_encoder(id)}/notes", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + NoteList, + construct_type( + type_=NoteList, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create_note( + self, + id: int, + *, + body: str, + contact_id: typing.Optional[str] = OMIT, + admin_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[Note]: + """ + You can add a note to a single contact. + + Parameters + ---------- + id : int + The unique identifier of a given contact. + + body : str + The text of the note. + + contact_id : typing.Optional[str] + The unique identifier of a given contact. + + admin_id : typing.Optional[str] + The unique identifier of a given admin. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Note] + Successful response + """ + _response = self._client_wrapper.httpx_client.request( + f"contacts/{jsonable_encoder(id)}/notes", + method="POST", + json={ + "body": body, + "contact_id": contact_id, + "admin_id": admin_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Note, + construct_type( + type_=Note, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def retrieve_note(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Note]: + """ + You can fetch the details of a single note. + + Parameters + ---------- + id : int + The unique identifier of a given note + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Note] + Note found + """ + _response = self._client_wrapper.httpx_client.request( + f"notes/{jsonable_encoder(id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Note, + construct_type( + type_=Note, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawNotesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list_notes( + self, id: int, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[NoteList]: + """ + You can fetch a list of notes that are associated to a contact. + + Parameters + ---------- + id : int + The unique identifier of a contact. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[NoteList] + Successful response + """ + _response = await self._client_wrapper.httpx_client.request( + f"contacts/{jsonable_encoder(id)}/notes", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + NoteList, + construct_type( + type_=NoteList, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create_note( + self, + id: int, + *, + body: str, + contact_id: typing.Optional[str] = OMIT, + admin_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[Note]: + """ + You can add a note to a single contact. + + Parameters + ---------- + id : int + The unique identifier of a given contact. + + body : str + The text of the note. + + contact_id : typing.Optional[str] + The unique identifier of a given contact. + + admin_id : typing.Optional[str] + The unique identifier of a given admin. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Note] + Successful response + """ + _response = await self._client_wrapper.httpx_client.request( + f"contacts/{jsonable_encoder(id)}/notes", + method="POST", + json={ + "body": body, + "contact_id": contact_id, + "admin_id": admin_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Note, + construct_type( + type_=Note, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def retrieve_note( + self, id: int, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[Note]: + """ + You can fetch the details of a single note. + + Parameters + ---------- + id : int + The unique identifier of a given note + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Note] + Note found + """ + _response = await self._client_wrapper.httpx_client.request( + f"notes/{jsonable_encoder(id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Note, + construct_type( + type_=Note, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/intercom/unstable/notes/types/__init__.py b/src/intercom/unstable/notes/types/__init__.py new file mode 100644 index 0000000..4ca01f1 --- /dev/null +++ b/src/intercom/unstable/notes/types/__init__.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .note import Note +from .note_contact import NoteContact + +__all__ = ["Note", "NoteContact"] diff --git a/src/intercom/unstable/notes/types/note.py b/src/intercom/unstable/notes/types/note.py new file mode 100644 index 0000000..db3abe7 --- /dev/null +++ b/src/intercom/unstable/notes/types/note.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from ...admins.types.admin import Admin +from .note_contact import NoteContact + + +class Note(UncheckedBaseModel): + """ + Notes allow you to annotate and comment on your contacts. + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + String representing the object's type. Always has the value `note`. + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id of the note. + """ + + created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time the note was created. + """ + + contact: typing.Optional[NoteContact] = pydantic.Field(default=None) + """ + Represents the contact that the note was created about. + """ + + author: typing.Optional[Admin] = pydantic.Field(default=None) + """ + Optional. Represents the Admin that created the note. + """ + + body: typing.Optional[str] = pydantic.Field(default=None) + """ + The body text of the note. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/notes/types/note_contact.py b/src/intercom/unstable/notes/types/note_contact.py new file mode 100644 index 0000000..8117c1d --- /dev/null +++ b/src/intercom/unstable/notes/types/note_contact.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel + + +class NoteContact(UncheckedBaseModel): + """ + Represents the contact that the note was created about. + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + String representing the object's type. Always has the value `contact`. + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id of the contact. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/raw_client.py b/src/intercom/unstable/raw_client.py new file mode 100644 index 0000000..5201a51 --- /dev/null +++ b/src/intercom/unstable/raw_client.py @@ -0,0 +1,13 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper + + +class RawUnstableClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + +class AsyncRawUnstableClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper diff --git a/src/intercom/unstable/segments/__init__.py b/src/intercom/unstable/segments/__init__.py new file mode 100644 index 0000000..de85632 --- /dev/null +++ b/src/intercom/unstable/segments/__init__.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .types import Segment, SegmentPersonType + +__all__ = ["Segment", "SegmentPersonType"] diff --git a/src/intercom/unstable/segments/client.py b/src/intercom/unstable/segments/client.py new file mode 100644 index 0000000..2e9fd62 --- /dev/null +++ b/src/intercom/unstable/segments/client.py @@ -0,0 +1,181 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ..types.segment_list import SegmentList +from .raw_client import AsyncRawSegmentsClient, RawSegmentsClient +from .types.segment import Segment + + +class SegmentsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSegmentsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawSegmentsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSegmentsClient + """ + return self._raw_client + + def list_segments( + self, *, include_count: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None + ) -> SegmentList: + """ + You can fetch a list of all segments. + + Parameters + ---------- + include_count : typing.Optional[bool] + It includes the count of contacts that belong to each segment. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SegmentList + Successful response + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.segments.list_segments() + """ + _response = self._raw_client.list_segments(include_count=include_count, request_options=request_options) + return _response.data + + def retrieve_segment(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Segment: + """ + You can fetch the details of a single segment. + + Parameters + ---------- + id : str + The unique identified of a given segment. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Segment + Successful response + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.segments.retrieve_segment( + id="123", + ) + """ + _response = self._raw_client.retrieve_segment(id, request_options=request_options) + return _response.data + + +class AsyncSegmentsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSegmentsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawSegmentsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSegmentsClient + """ + return self._raw_client + + async def list_segments( + self, *, include_count: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None + ) -> SegmentList: + """ + You can fetch a list of all segments. + + Parameters + ---------- + include_count : typing.Optional[bool] + It includes the count of contacts that belong to each segment. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SegmentList + Successful response + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.segments.list_segments() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list_segments(include_count=include_count, request_options=request_options) + return _response.data + + async def retrieve_segment(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Segment: + """ + You can fetch the details of a single segment. + + Parameters + ---------- + id : str + The unique identified of a given segment. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Segment + Successful response + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.segments.retrieve_segment( + id="123", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.retrieve_segment(id, request_options=request_options) + return _response.data diff --git a/src/intercom/unstable/segments/raw_client.py b/src/intercom/unstable/segments/raw_client.py new file mode 100644 index 0000000..0ffd17c --- /dev/null +++ b/src/intercom/unstable/segments/raw_client.py @@ -0,0 +1,254 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ..errors.not_found_error import NotFoundError +from ..errors.unauthorized_error import UnauthorizedError +from ..types.error import Error +from ..types.segment_list import SegmentList +from .types.segment import Segment + + +class RawSegmentsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list_segments( + self, *, include_count: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[SegmentList]: + """ + You can fetch a list of all segments. + + Parameters + ---------- + include_count : typing.Optional[bool] + It includes the count of contacts that belong to each segment. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SegmentList] + Successful response + """ + _response = self._client_wrapper.httpx_client.request( + "segments", + method="GET", + params={ + "include_count": include_count, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SegmentList, + construct_type( + type_=SegmentList, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def retrieve_segment( + self, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[Segment]: + """ + You can fetch the details of a single segment. + + Parameters + ---------- + id : str + The unique identified of a given segment. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Segment] + Successful response + """ + _response = self._client_wrapper.httpx_client.request( + f"segments/{jsonable_encoder(id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Segment, + construct_type( + type_=Segment, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawSegmentsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list_segments( + self, *, include_count: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[SegmentList]: + """ + You can fetch a list of all segments. + + Parameters + ---------- + include_count : typing.Optional[bool] + It includes the count of contacts that belong to each segment. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SegmentList] + Successful response + """ + _response = await self._client_wrapper.httpx_client.request( + "segments", + method="GET", + params={ + "include_count": include_count, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SegmentList, + construct_type( + type_=SegmentList, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def retrieve_segment( + self, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[Segment]: + """ + You can fetch the details of a single segment. + + Parameters + ---------- + id : str + The unique identified of a given segment. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Segment] + Successful response + """ + _response = await self._client_wrapper.httpx_client.request( + f"segments/{jsonable_encoder(id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Segment, + construct_type( + type_=Segment, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/intercom/unstable/segments/types/__init__.py b/src/intercom/unstable/segments/types/__init__.py new file mode 100644 index 0000000..b63a3b6 --- /dev/null +++ b/src/intercom/unstable/segments/types/__init__.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .segment import Segment +from .segment_person_type import SegmentPersonType + +__all__ = ["Segment", "SegmentPersonType"] diff --git a/src/intercom/unstable/segments/types/segment.py b/src/intercom/unstable/segments/types/segment.py new file mode 100644 index 0000000..ce873d4 --- /dev/null +++ b/src/intercom/unstable/segments/types/segment.py @@ -0,0 +1,58 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from .segment_person_type import SegmentPersonType + + +class Segment(UncheckedBaseModel): + """ + A segment is a group of your contacts defined by the rules that you set. + """ + + type: typing.Optional[typing.Literal["segment"]] = pydantic.Field(default=None) + """ + The type of object. + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The unique identifier representing the segment. + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the segment. + """ + + created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time the segment was created. + """ + + updated_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time the segment was updated. + """ + + person_type: typing.Optional[SegmentPersonType] = pydantic.Field(default=None) + """ + Type of the contact: contact (lead) or user. + """ + + count: typing.Optional[int] = pydantic.Field(default=None) + """ + The number of items in the user segment. It's returned when `include_count=true` is included in the request. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/segments/types/segment_person_type.py b/src/intercom/unstable/segments/types/segment_person_type.py new file mode 100644 index 0000000..3089d52 --- /dev/null +++ b/src/intercom/unstable/segments/types/segment_person_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SegmentPersonType = typing.Union[typing.Literal["contact", "user"], typing.Any] diff --git a/src/intercom/unstable/subscription_types/__init__.py b/src/intercom/unstable/subscription_types/__init__.py new file mode 100644 index 0000000..a43a24a --- /dev/null +++ b/src/intercom/unstable/subscription_types/__init__.py @@ -0,0 +1,17 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .types import ( + SubscriptionType, + SubscriptionTypeConsentType, + SubscriptionTypeContentTypesItem, + SubscriptionTypeState, +) + +__all__ = [ + "SubscriptionType", + "SubscriptionTypeConsentType", + "SubscriptionTypeContentTypesItem", + "SubscriptionTypeState", +] diff --git a/src/intercom/unstable/subscription_types/client.py b/src/intercom/unstable/subscription_types/client.py new file mode 100644 index 0000000..bb9913b --- /dev/null +++ b/src/intercom/unstable/subscription_types/client.py @@ -0,0 +1,300 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ..types.subscription_type_list import SubscriptionTypeList +from .raw_client import AsyncRawSubscriptionTypesClient, RawSubscriptionTypesClient +from .types.subscription_type import SubscriptionType + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class SubscriptionTypesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSubscriptionTypesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawSubscriptionTypesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSubscriptionTypesClient + """ + return self._raw_client + + def attach_subscription_type_to_contact( + self, contact_id: str, *, id: str, consent_type: str, request_options: typing.Optional[RequestOptions] = None + ) -> SubscriptionType: + """ + You can add a specific subscription to a contact. In Intercom, we have two different subscription types based on user consent - opt-out and opt-in: + + 1.Attaching a contact to an opt-out subscription type will opt that user out from receiving messages related to that subscription type. + + 2.Attaching a contact to an opt-in subscription type will opt that user in to receiving messages related to that subscription type. + + This will return a subscription type model for the subscription type that was added to the contact. + + Parameters + ---------- + contact_id : str + The unique identifier for the contact which is given by Intercom + + id : str + The unique identifier for the subscription which is given by Intercom + + consent_type : str + The consent_type of a subscription, opt_out or opt_in. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SubscriptionType + Successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.subscription_types.attach_subscription_type_to_contact( + contact_id="63a07ddf05a32042dffac965", + id="37846", + consent_type="opt_in", + ) + """ + _response = self._raw_client.attach_subscription_type_to_contact( + contact_id, id=id, consent_type=consent_type, request_options=request_options + ) + return _response.data + + def detach_subscription_type_to_contact( + self, contact_id: str, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> SubscriptionType: + """ + You can remove a specific subscription from a contact. This will return a subscription type model for the subscription type that was removed from the contact. + + Parameters + ---------- + contact_id : str + The unique identifier for the contact which is given by Intercom + + id : str + The unique identifier for the subscription type which is given by Intercom + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SubscriptionType + Successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.subscription_types.detach_subscription_type_to_contact( + contact_id="63a07ddf05a32042dffac965", + id="37846", + ) + """ + _response = self._raw_client.detach_subscription_type_to_contact( + contact_id, id, request_options=request_options + ) + return _response.data + + def list_subscription_types( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> SubscriptionTypeList: + """ + You can list all subscription types. A list of subscription type objects will be returned. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SubscriptionTypeList + Successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.subscription_types.list_subscription_types() + """ + _response = self._raw_client.list_subscription_types(request_options=request_options) + return _response.data + + +class AsyncSubscriptionTypesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSubscriptionTypesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawSubscriptionTypesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSubscriptionTypesClient + """ + return self._raw_client + + async def attach_subscription_type_to_contact( + self, contact_id: str, *, id: str, consent_type: str, request_options: typing.Optional[RequestOptions] = None + ) -> SubscriptionType: + """ + You can add a specific subscription to a contact. In Intercom, we have two different subscription types based on user consent - opt-out and opt-in: + + 1.Attaching a contact to an opt-out subscription type will opt that user out from receiving messages related to that subscription type. + + 2.Attaching a contact to an opt-in subscription type will opt that user in to receiving messages related to that subscription type. + + This will return a subscription type model for the subscription type that was added to the contact. + + Parameters + ---------- + contact_id : str + The unique identifier for the contact which is given by Intercom + + id : str + The unique identifier for the subscription which is given by Intercom + + consent_type : str + The consent_type of a subscription, opt_out or opt_in. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SubscriptionType + Successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.subscription_types.attach_subscription_type_to_contact( + contact_id="63a07ddf05a32042dffac965", + id="37846", + consent_type="opt_in", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.attach_subscription_type_to_contact( + contact_id, id=id, consent_type=consent_type, request_options=request_options + ) + return _response.data + + async def detach_subscription_type_to_contact( + self, contact_id: str, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> SubscriptionType: + """ + You can remove a specific subscription from a contact. This will return a subscription type model for the subscription type that was removed from the contact. + + Parameters + ---------- + contact_id : str + The unique identifier for the contact which is given by Intercom + + id : str + The unique identifier for the subscription type which is given by Intercom + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SubscriptionType + Successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.subscription_types.detach_subscription_type_to_contact( + contact_id="63a07ddf05a32042dffac965", + id="37846", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.detach_subscription_type_to_contact( + contact_id, id, request_options=request_options + ) + return _response.data + + async def list_subscription_types( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> SubscriptionTypeList: + """ + You can list all subscription types. A list of subscription type objects will be returned. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SubscriptionTypeList + Successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.subscription_types.list_subscription_types() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list_subscription_types(request_options=request_options) + return _response.data diff --git a/src/intercom/unstable/subscription_types/raw_client.py b/src/intercom/unstable/subscription_types/raw_client.py new file mode 100644 index 0000000..9a72b5b --- /dev/null +++ b/src/intercom/unstable/subscription_types/raw_client.py @@ -0,0 +1,413 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ..errors.not_found_error import NotFoundError +from ..errors.unauthorized_error import UnauthorizedError +from ..types.error import Error +from ..types.subscription_type_list import SubscriptionTypeList +from .types.subscription_type import SubscriptionType + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawSubscriptionTypesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def attach_subscription_type_to_contact( + self, contact_id: str, *, id: str, consent_type: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[SubscriptionType]: + """ + You can add a specific subscription to a contact. In Intercom, we have two different subscription types based on user consent - opt-out and opt-in: + + 1.Attaching a contact to an opt-out subscription type will opt that user out from receiving messages related to that subscription type. + + 2.Attaching a contact to an opt-in subscription type will opt that user in to receiving messages related to that subscription type. + + This will return a subscription type model for the subscription type that was added to the contact. + + Parameters + ---------- + contact_id : str + The unique identifier for the contact which is given by Intercom + + id : str + The unique identifier for the subscription which is given by Intercom + + consent_type : str + The consent_type of a subscription, opt_out or opt_in. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SubscriptionType] + Successful + """ + _response = self._client_wrapper.httpx_client.request( + f"contacts/{jsonable_encoder(contact_id)}/subscriptions", + method="POST", + json={ + "id": id, + "consent_type": consent_type, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SubscriptionType, + construct_type( + type_=SubscriptionType, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def detach_subscription_type_to_contact( + self, contact_id: str, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[SubscriptionType]: + """ + You can remove a specific subscription from a contact. This will return a subscription type model for the subscription type that was removed from the contact. + + Parameters + ---------- + contact_id : str + The unique identifier for the contact which is given by Intercom + + id : str + The unique identifier for the subscription type which is given by Intercom + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SubscriptionType] + Successful + """ + _response = self._client_wrapper.httpx_client.request( + f"contacts/{jsonable_encoder(contact_id)}/subscriptions/{jsonable_encoder(id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SubscriptionType, + construct_type( + type_=SubscriptionType, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def list_subscription_types( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[SubscriptionTypeList]: + """ + You can list all subscription types. A list of subscription type objects will be returned. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SubscriptionTypeList] + Successful + """ + _response = self._client_wrapper.httpx_client.request( + "subscription_types", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SubscriptionTypeList, + construct_type( + type_=SubscriptionTypeList, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawSubscriptionTypesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def attach_subscription_type_to_contact( + self, contact_id: str, *, id: str, consent_type: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[SubscriptionType]: + """ + You can add a specific subscription to a contact. In Intercom, we have two different subscription types based on user consent - opt-out and opt-in: + + 1.Attaching a contact to an opt-out subscription type will opt that user out from receiving messages related to that subscription type. + + 2.Attaching a contact to an opt-in subscription type will opt that user in to receiving messages related to that subscription type. + + This will return a subscription type model for the subscription type that was added to the contact. + + Parameters + ---------- + contact_id : str + The unique identifier for the contact which is given by Intercom + + id : str + The unique identifier for the subscription which is given by Intercom + + consent_type : str + The consent_type of a subscription, opt_out or opt_in. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SubscriptionType] + Successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"contacts/{jsonable_encoder(contact_id)}/subscriptions", + method="POST", + json={ + "id": id, + "consent_type": consent_type, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SubscriptionType, + construct_type( + type_=SubscriptionType, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def detach_subscription_type_to_contact( + self, contact_id: str, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[SubscriptionType]: + """ + You can remove a specific subscription from a contact. This will return a subscription type model for the subscription type that was removed from the contact. + + Parameters + ---------- + contact_id : str + The unique identifier for the contact which is given by Intercom + + id : str + The unique identifier for the subscription type which is given by Intercom + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SubscriptionType] + Successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"contacts/{jsonable_encoder(contact_id)}/subscriptions/{jsonable_encoder(id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SubscriptionType, + construct_type( + type_=SubscriptionType, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def list_subscription_types( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[SubscriptionTypeList]: + """ + You can list all subscription types. A list of subscription type objects will be returned. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SubscriptionTypeList] + Successful + """ + _response = await self._client_wrapper.httpx_client.request( + "subscription_types", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SubscriptionTypeList, + construct_type( + type_=SubscriptionTypeList, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/intercom/unstable/subscription_types/types/__init__.py b/src/intercom/unstable/subscription_types/types/__init__.py new file mode 100644 index 0000000..e3b517d --- /dev/null +++ b/src/intercom/unstable/subscription_types/types/__init__.py @@ -0,0 +1,15 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .subscription_type import SubscriptionType +from .subscription_type_consent_type import SubscriptionTypeConsentType +from .subscription_type_content_types_item import SubscriptionTypeContentTypesItem +from .subscription_type_state import SubscriptionTypeState + +__all__ = [ + "SubscriptionType", + "SubscriptionTypeConsentType", + "SubscriptionTypeContentTypesItem", + "SubscriptionTypeState", +] diff --git a/src/intercom/unstable/subscription_types/types/subscription_type.py b/src/intercom/unstable/subscription_types/types/subscription_type.py new file mode 100644 index 0000000..005c71f --- /dev/null +++ b/src/intercom/unstable/subscription_types/types/subscription_type.py @@ -0,0 +1,57 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from ...types.translation import Translation +from .subscription_type_consent_type import SubscriptionTypeConsentType +from .subscription_type_content_types_item import SubscriptionTypeContentTypesItem +from .subscription_type_state import SubscriptionTypeState + + +class SubscriptionType(UncheckedBaseModel): + """ + A subscription type lets customers easily opt out of non-essential communications without missing what's important to them. + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + The type of the object - subscription + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The unique identifier representing the subscription type. + """ + + state: typing.Optional[SubscriptionTypeState] = pydantic.Field(default=None) + """ + The state of the subscription type. + """ + + default_translation: typing.Optional[Translation] = None + translations: typing.Optional[typing.List[Translation]] = pydantic.Field(default=None) + """ + An array of translations objects with the localised version of the subscription type in each available locale within your translation settings. + """ + + consent_type: typing.Optional[SubscriptionTypeConsentType] = pydantic.Field(default=None) + """ + Describes the type of consent. + """ + + content_types: typing.Optional[typing.List[SubscriptionTypeContentTypesItem]] = pydantic.Field(default=None) + """ + The message types that this subscription supports - can contain `email` or `sms_message`. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/subscription_types/types/subscription_type_consent_type.py b/src/intercom/unstable/subscription_types/types/subscription_type_consent_type.py new file mode 100644 index 0000000..d7f8b6a --- /dev/null +++ b/src/intercom/unstable/subscription_types/types/subscription_type_consent_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SubscriptionTypeConsentType = typing.Union[typing.Literal["opt_out", "opt_in"], typing.Any] diff --git a/src/intercom/unstable/subscription_types/types/subscription_type_content_types_item.py b/src/intercom/unstable/subscription_types/types/subscription_type_content_types_item.py new file mode 100644 index 0000000..d895f70 --- /dev/null +++ b/src/intercom/unstable/subscription_types/types/subscription_type_content_types_item.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SubscriptionTypeContentTypesItem = typing.Union[typing.Literal["email", "sms_message"], typing.Any] diff --git a/src/intercom/unstable/subscription_types/types/subscription_type_state.py b/src/intercom/unstable/subscription_types/types/subscription_type_state.py new file mode 100644 index 0000000..65c9259 --- /dev/null +++ b/src/intercom/unstable/subscription_types/types/subscription_type_state.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SubscriptionTypeState = typing.Union[typing.Literal["live", "draft", "archived"], typing.Any] diff --git a/src/intercom/unstable/switch/__init__.py b/src/intercom/unstable/switch/__init__.py new file mode 100644 index 0000000..5cde020 --- /dev/null +++ b/src/intercom/unstable/switch/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/src/intercom/unstable/switch/client.py b/src/intercom/unstable/switch/client.py new file mode 100644 index 0000000..8335b34 --- /dev/null +++ b/src/intercom/unstable/switch/client.py @@ -0,0 +1,121 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ..types.phone_switch import PhoneSwitch +from .raw_client import AsyncRawSwitchClient, RawSwitchClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class SwitchClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSwitchClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawSwitchClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSwitchClient + """ + return self._raw_client + + def create_phone_switch( + self, *, request: typing.Optional[typing.Any] = None, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Optional[PhoneSwitch]: + """ + You can use the API to deflect phone calls to the Intercom Messenger. + Calling this endpoint will send an SMS with a link to the Messenger to the phone number specified. + + If custom attributes are specified, they will be added to the user or lead's custom data attributes. + + Parameters + ---------- + request : typing.Optional[typing.Any] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[PhoneSwitch] + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.switch.create_phone_switch( + request={"key": "value"}, + ) + """ + _response = self._raw_client.create_phone_switch(request=request, request_options=request_options) + return _response.data + + +class AsyncSwitchClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSwitchClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawSwitchClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSwitchClient + """ + return self._raw_client + + async def create_phone_switch( + self, *, request: typing.Optional[typing.Any] = None, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Optional[PhoneSwitch]: + """ + You can use the API to deflect phone calls to the Intercom Messenger. + Calling this endpoint will send an SMS with a link to the Messenger to the phone number specified. + + If custom attributes are specified, they will be added to the user or lead's custom data attributes. + + Parameters + ---------- + request : typing.Optional[typing.Any] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[PhoneSwitch] + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.switch.create_phone_switch( + request={"key": "value"}, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create_phone_switch(request=request, request_options=request_options) + return _response.data diff --git a/src/intercom/unstable/switch/raw_client.py b/src/intercom/unstable/switch/raw_client.py new file mode 100644 index 0000000..6b50219 --- /dev/null +++ b/src/intercom/unstable/switch/raw_client.py @@ -0,0 +1,190 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ..errors.bad_request_error import BadRequestError +from ..errors.unauthorized_error import UnauthorizedError +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.error import Error +from ..types.phone_switch import PhoneSwitch + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawSwitchClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create_phone_switch( + self, *, request: typing.Optional[typing.Any] = None, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[typing.Optional[PhoneSwitch]]: + """ + You can use the API to deflect phone calls to the Intercom Messenger. + Calling this endpoint will send an SMS with a link to the Messenger to the phone number specified. + + If custom attributes are specified, they will be added to the user or lead's custom data attributes. + + Parameters + ---------- + request : typing.Optional[typing.Any] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Optional[PhoneSwitch]] + successful + """ + _response = self._client_wrapper.httpx_client.request( + "phone_call_redirects", + method="POST", + json=request, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Optional[PhoneSwitch], + construct_type( + type_=typing.Optional[PhoneSwitch], # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawSwitchClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create_phone_switch( + self, *, request: typing.Optional[typing.Any] = None, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[typing.Optional[PhoneSwitch]]: + """ + You can use the API to deflect phone calls to the Intercom Messenger. + Calling this endpoint will send an SMS with a link to the Messenger to the phone number specified. + + If custom attributes are specified, they will be added to the user or lead's custom data attributes. + + Parameters + ---------- + request : typing.Optional[typing.Any] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Optional[PhoneSwitch]] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + "phone_call_redirects", + method="POST", + json=request, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Optional[PhoneSwitch], + construct_type( + type_=typing.Optional[PhoneSwitch], # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/intercom/unstable/tags/__init__.py b/src/intercom/unstable/tags/__init__.py new file mode 100644 index 0000000..cb98c64 --- /dev/null +++ b/src/intercom/unstable/tags/__init__.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .types import CreateTagRequestBody, Tag, TagBasic + +__all__ = ["CreateTagRequestBody", "Tag", "TagBasic"] diff --git a/src/intercom/unstable/tags/client.py b/src/intercom/unstable/tags/client.py new file mode 100644 index 0000000..30f7d78 --- /dev/null +++ b/src/intercom/unstable/tags/client.py @@ -0,0 +1,887 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ..types.tag_list import TagList +from .raw_client import AsyncRawTagsClient, RawTagsClient +from .types.create_tag_request_body import CreateTagRequestBody +from .types.tag import Tag + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class TagsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTagsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawTagsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTagsClient + """ + return self._raw_client + + def attach_tag_to_contact( + self, contact_id: str, *, id: str, request_options: typing.Optional[RequestOptions] = None + ) -> Tag: + """ + You can tag a specific contact. This will return a tag object for the tag that was added to the contact. + + Parameters + ---------- + contact_id : str + The unique identifier for the contact which is given by Intercom + + id : str + The unique identifier for the tag which is given by Intercom + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.tags.attach_tag_to_contact( + contact_id="63a07ddf05a32042dffac965", + id="7522907", + ) + """ + _response = self._raw_client.attach_tag_to_contact(contact_id, id=id, request_options=request_options) + return _response.data + + def detach_tag_from_contact( + self, contact_id: str, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> Tag: + """ + You can remove tag from a specific contact. This will return a tag object for the tag that was removed from the contact. + + Parameters + ---------- + contact_id : str + The unique identifier for the contact which is given by Intercom + + id : str + The unique identifier for the tag which is given by Intercom + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.tags.detach_tag_from_contact( + contact_id="63a07ddf05a32042dffac965", + id="7522907", + ) + """ + _response = self._raw_client.detach_tag_from_contact(contact_id, id, request_options=request_options) + return _response.data + + def attach_tag_to_conversation( + self, conversation_id: str, *, id: str, admin_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> Tag: + """ + You can tag a specific conversation. This will return a tag object for the tag that was added to the conversation. + + Parameters + ---------- + conversation_id : str + conversation_id + + id : str + The unique identifier for the tag which is given by Intercom + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.tags.attach_tag_to_conversation( + conversation_id="64619700005694", + id="7522907", + admin_id="780", + ) + """ + _response = self._raw_client.attach_tag_to_conversation( + conversation_id, id=id, admin_id=admin_id, request_options=request_options + ) + return _response.data + + def detach_tag_from_conversation( + self, conversation_id: str, id: str, *, admin_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> Tag: + """ + You can remove tag from a specific conversation. This will return a tag object for the tag that was removed from the conversation. + + Parameters + ---------- + conversation_id : str + conversation_id + + id : str + id + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.tags.detach_tag_from_conversation( + conversation_id="64619700005694", + id="7522907", + admin_id="123", + ) + """ + _response = self._raw_client.detach_tag_from_conversation( + conversation_id, id, admin_id=admin_id, request_options=request_options + ) + return _response.data + + def list_tags(self, *, request_options: typing.Optional[RequestOptions] = None) -> TagList: + """ + You can fetch a list of all tags for a given workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TagList + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.tags.list_tags() + """ + _response = self._raw_client.list_tags(request_options=request_options) + return _response.data + + def create_tag( + self, *, request: CreateTagRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> Tag: + """ + You can use this endpoint to perform the following operations: + + **1. Create a new tag:** You can create a new tag by passing in the tag name as specified in "Create or Update Tag Request Payload" described below. + + **2. Update an existing tag:** You can update an existing tag by passing the id of the tag as specified in "Create or Update Tag Request Payload" described below. + + **3. Tag Companies:** You can tag single company or a list of companies. You can tag a company by passing in the tag name and the company details as specified in "Tag Company Request Payload" described below. Also, if the tag doesn't exist then a new one will be created automatically. + + **4. Untag Companies:** You can untag a single company or a list of companies. You can untag a company by passing in the tag id and the company details as specified in "Untag Company Request Payload" described below. + + **5. Tag Multiple Users:** You can tag a list of users. You can tag the users by passing in the tag name and the user details as specified in "Tag Users Request Payload" described below. + + Each operation will return a tag object. + + Parameters + ---------- + request : CreateTagRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + Action successful + + Examples + -------- + from intercom import Intercom + from intercom.unstable import CreateOrUpdateTagRequest + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.tags.create_tag( + request=CreateOrUpdateTagRequest( + name="test", + ), + ) + """ + _response = self._raw_client.create_tag(request=request, request_options=request_options) + return _response.data + + def find_tag(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Tag: + """ + You can fetch the details of tags that are on the workspace by their id. + This will return a tag object. + + Parameters + ---------- + id : str + The unique identifier of a given tag + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + Tag found + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.tags.find_tag( + id="123", + ) + """ + _response = self._raw_client.find_tag(id, request_options=request_options) + return _response.data + + def delete_tag(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + You can delete the details of tags that are on the workspace by passing in the id. + + Parameters + ---------- + id : str + The unique identifier of a given tag + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.tags.delete_tag( + id="123", + ) + """ + _response = self._raw_client.delete_tag(id, request_options=request_options) + return _response.data + + def attach_tag_to_ticket( + self, ticket_id: str, *, id: str, admin_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> Tag: + """ + You can tag a specific ticket. This will return a tag object for the tag that was added to the ticket. + + Parameters + ---------- + ticket_id : str + ticket_id + + id : str + The unique identifier for the tag which is given by Intercom + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.tags.attach_tag_to_ticket( + ticket_id="64619700005694", + id="7522907", + admin_id="780", + ) + """ + _response = self._raw_client.attach_tag_to_ticket( + ticket_id, id=id, admin_id=admin_id, request_options=request_options + ) + return _response.data + + def detach_tag_from_ticket( + self, ticket_id: str, id: str, *, admin_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> Tag: + """ + You can remove tag from a specific ticket. This will return a tag object for the tag that was removed from the ticket. + + Parameters + ---------- + ticket_id : str + ticket_id + + id : str + The unique identifier for the tag which is given by Intercom + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.tags.detach_tag_from_ticket( + ticket_id="64619700005694", + id="7522907", + admin_id="123", + ) + """ + _response = self._raw_client.detach_tag_from_ticket( + ticket_id, id, admin_id=admin_id, request_options=request_options + ) + return _response.data + + +class AsyncTagsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTagsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawTagsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTagsClient + """ + return self._raw_client + + async def attach_tag_to_contact( + self, contact_id: str, *, id: str, request_options: typing.Optional[RequestOptions] = None + ) -> Tag: + """ + You can tag a specific contact. This will return a tag object for the tag that was added to the contact. + + Parameters + ---------- + contact_id : str + The unique identifier for the contact which is given by Intercom + + id : str + The unique identifier for the tag which is given by Intercom + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.tags.attach_tag_to_contact( + contact_id="63a07ddf05a32042dffac965", + id="7522907", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.attach_tag_to_contact(contact_id, id=id, request_options=request_options) + return _response.data + + async def detach_tag_from_contact( + self, contact_id: str, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> Tag: + """ + You can remove tag from a specific contact. This will return a tag object for the tag that was removed from the contact. + + Parameters + ---------- + contact_id : str + The unique identifier for the contact which is given by Intercom + + id : str + The unique identifier for the tag which is given by Intercom + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.tags.detach_tag_from_contact( + contact_id="63a07ddf05a32042dffac965", + id="7522907", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.detach_tag_from_contact(contact_id, id, request_options=request_options) + return _response.data + + async def attach_tag_to_conversation( + self, conversation_id: str, *, id: str, admin_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> Tag: + """ + You can tag a specific conversation. This will return a tag object for the tag that was added to the conversation. + + Parameters + ---------- + conversation_id : str + conversation_id + + id : str + The unique identifier for the tag which is given by Intercom + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.tags.attach_tag_to_conversation( + conversation_id="64619700005694", + id="7522907", + admin_id="780", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.attach_tag_to_conversation( + conversation_id, id=id, admin_id=admin_id, request_options=request_options + ) + return _response.data + + async def detach_tag_from_conversation( + self, conversation_id: str, id: str, *, admin_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> Tag: + """ + You can remove tag from a specific conversation. This will return a tag object for the tag that was removed from the conversation. + + Parameters + ---------- + conversation_id : str + conversation_id + + id : str + id + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.tags.detach_tag_from_conversation( + conversation_id="64619700005694", + id="7522907", + admin_id="123", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.detach_tag_from_conversation( + conversation_id, id, admin_id=admin_id, request_options=request_options + ) + return _response.data + + async def list_tags(self, *, request_options: typing.Optional[RequestOptions] = None) -> TagList: + """ + You can fetch a list of all tags for a given workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TagList + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.tags.list_tags() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list_tags(request_options=request_options) + return _response.data + + async def create_tag( + self, *, request: CreateTagRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> Tag: + """ + You can use this endpoint to perform the following operations: + + **1. Create a new tag:** You can create a new tag by passing in the tag name as specified in "Create or Update Tag Request Payload" described below. + + **2. Update an existing tag:** You can update an existing tag by passing the id of the tag as specified in "Create or Update Tag Request Payload" described below. + + **3. Tag Companies:** You can tag single company or a list of companies. You can tag a company by passing in the tag name and the company details as specified in "Tag Company Request Payload" described below. Also, if the tag doesn't exist then a new one will be created automatically. + + **4. Untag Companies:** You can untag a single company or a list of companies. You can untag a company by passing in the tag id and the company details as specified in "Untag Company Request Payload" described below. + + **5. Tag Multiple Users:** You can tag a list of users. You can tag the users by passing in the tag name and the user details as specified in "Tag Users Request Payload" described below. + + Each operation will return a tag object. + + Parameters + ---------- + request : CreateTagRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + Action successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + from intercom.unstable import CreateOrUpdateTagRequest + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.tags.create_tag( + request=CreateOrUpdateTagRequest( + name="test", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create_tag(request=request, request_options=request_options) + return _response.data + + async def find_tag(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Tag: + """ + You can fetch the details of tags that are on the workspace by their id. + This will return a tag object. + + Parameters + ---------- + id : str + The unique identifier of a given tag + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + Tag found + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.tags.find_tag( + id="123", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.find_tag(id, request_options=request_options) + return _response.data + + async def delete_tag(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + You can delete the details of tags that are on the workspace by passing in the id. + + Parameters + ---------- + id : str + The unique identifier of a given tag + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.tags.delete_tag( + id="123", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete_tag(id, request_options=request_options) + return _response.data + + async def attach_tag_to_ticket( + self, ticket_id: str, *, id: str, admin_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> Tag: + """ + You can tag a specific ticket. This will return a tag object for the tag that was added to the ticket. + + Parameters + ---------- + ticket_id : str + ticket_id + + id : str + The unique identifier for the tag which is given by Intercom + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.tags.attach_tag_to_ticket( + ticket_id="64619700005694", + id="7522907", + admin_id="780", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.attach_tag_to_ticket( + ticket_id, id=id, admin_id=admin_id, request_options=request_options + ) + return _response.data + + async def detach_tag_from_ticket( + self, ticket_id: str, id: str, *, admin_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> Tag: + """ + You can remove tag from a specific ticket. This will return a tag object for the tag that was removed from the ticket. + + Parameters + ---------- + ticket_id : str + ticket_id + + id : str + The unique identifier for the tag which is given by Intercom + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tag + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.tags.detach_tag_from_ticket( + ticket_id="64619700005694", + id="7522907", + admin_id="123", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.detach_tag_from_ticket( + ticket_id, id, admin_id=admin_id, request_options=request_options + ) + return _response.data diff --git a/src/intercom/unstable/tags/raw_client.py b/src/intercom/unstable/tags/raw_client.py new file mode 100644 index 0000000..a66cddb --- /dev/null +++ b/src/intercom/unstable/tags/raw_client.py @@ -0,0 +1,1416 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ..errors.bad_request_error import BadRequestError +from ..errors.not_found_error import NotFoundError +from ..errors.unauthorized_error import UnauthorizedError +from ..types.error import Error +from ..types.tag_list import TagList +from .types.create_tag_request_body import CreateTagRequestBody +from .types.tag import Tag + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawTagsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def attach_tag_to_contact( + self, contact_id: str, *, id: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[Tag]: + """ + You can tag a specific contact. This will return a tag object for the tag that was added to the contact. + + Parameters + ---------- + contact_id : str + The unique identifier for the contact which is given by Intercom + + id : str + The unique identifier for the tag which is given by Intercom + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Tag] + successful + """ + _response = self._client_wrapper.httpx_client.request( + f"contacts/{jsonable_encoder(contact_id)}/tags", + method="POST", + json={ + "id": id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def detach_tag_from_contact( + self, contact_id: str, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[Tag]: + """ + You can remove tag from a specific contact. This will return a tag object for the tag that was removed from the contact. + + Parameters + ---------- + contact_id : str + The unique identifier for the contact which is given by Intercom + + id : str + The unique identifier for the tag which is given by Intercom + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Tag] + successful + """ + _response = self._client_wrapper.httpx_client.request( + f"contacts/{jsonable_encoder(contact_id)}/tags/{jsonable_encoder(id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def attach_tag_to_conversation( + self, conversation_id: str, *, id: str, admin_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[Tag]: + """ + You can tag a specific conversation. This will return a tag object for the tag that was added to the conversation. + + Parameters + ---------- + conversation_id : str + conversation_id + + id : str + The unique identifier for the tag which is given by Intercom + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Tag] + successful + """ + _response = self._client_wrapper.httpx_client.request( + f"conversations/{jsonable_encoder(conversation_id)}/tags", + method="POST", + json={ + "id": id, + "admin_id": admin_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def detach_tag_from_conversation( + self, conversation_id: str, id: str, *, admin_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[Tag]: + """ + You can remove tag from a specific conversation. This will return a tag object for the tag that was removed from the conversation. + + Parameters + ---------- + conversation_id : str + conversation_id + + id : str + id + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Tag] + successful + """ + _response = self._client_wrapper.httpx_client.request( + f"conversations/{jsonable_encoder(conversation_id)}/tags/{jsonable_encoder(id)}", + method="DELETE", + json={ + "admin_id": admin_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def list_tags(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[TagList]: + """ + You can fetch a list of all tags for a given workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TagList] + successful + """ + _response = self._client_wrapper.httpx_client.request( + "tags", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TagList, + construct_type( + type_=TagList, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create_tag( + self, *, request: CreateTagRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[Tag]: + """ + You can use this endpoint to perform the following operations: + + **1. Create a new tag:** You can create a new tag by passing in the tag name as specified in "Create or Update Tag Request Payload" described below. + + **2. Update an existing tag:** You can update an existing tag by passing the id of the tag as specified in "Create or Update Tag Request Payload" described below. + + **3. Tag Companies:** You can tag single company or a list of companies. You can tag a company by passing in the tag name and the company details as specified in "Tag Company Request Payload" described below. Also, if the tag doesn't exist then a new one will be created automatically. + + **4. Untag Companies:** You can untag a single company or a list of companies. You can untag a company by passing in the tag id and the company details as specified in "Untag Company Request Payload" described below. + + **5. Tag Multiple Users:** You can tag a list of users. You can tag the users by passing in the tag name and the user details as specified in "Tag Users Request Payload" described below. + + Each operation will return a tag object. + + Parameters + ---------- + request : CreateTagRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Tag] + Action successful + """ + _response = self._client_wrapper.httpx_client.request( + "tags", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=CreateTagRequestBody, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def find_tag(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Tag]: + """ + You can fetch the details of tags that are on the workspace by their id. + This will return a tag object. + + Parameters + ---------- + id : str + The unique identifier of a given tag + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Tag] + Tag found + """ + _response = self._client_wrapper.httpx_client.request( + f"tags/{jsonable_encoder(id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete_tag(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]: + """ + You can delete the details of tags that are on the workspace by passing in the id. + + Parameters + ---------- + id : str + The unique identifier of a given tag + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"tags/{jsonable_encoder(id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def attach_tag_to_ticket( + self, ticket_id: str, *, id: str, admin_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[Tag]: + """ + You can tag a specific ticket. This will return a tag object for the tag that was added to the ticket. + + Parameters + ---------- + ticket_id : str + ticket_id + + id : str + The unique identifier for the tag which is given by Intercom + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Tag] + successful + """ + _response = self._client_wrapper.httpx_client.request( + f"tickets/{jsonable_encoder(ticket_id)}/tags", + method="POST", + json={ + "id": id, + "admin_id": admin_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def detach_tag_from_ticket( + self, ticket_id: str, id: str, *, admin_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[Tag]: + """ + You can remove tag from a specific ticket. This will return a tag object for the tag that was removed from the ticket. + + Parameters + ---------- + ticket_id : str + ticket_id + + id : str + The unique identifier for the tag which is given by Intercom + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Tag] + successful + """ + _response = self._client_wrapper.httpx_client.request( + f"tickets/{jsonable_encoder(ticket_id)}/tags/{jsonable_encoder(id)}", + method="DELETE", + json={ + "admin_id": admin_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawTagsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def attach_tag_to_contact( + self, contact_id: str, *, id: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[Tag]: + """ + You can tag a specific contact. This will return a tag object for the tag that was added to the contact. + + Parameters + ---------- + contact_id : str + The unique identifier for the contact which is given by Intercom + + id : str + The unique identifier for the tag which is given by Intercom + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Tag] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"contacts/{jsonable_encoder(contact_id)}/tags", + method="POST", + json={ + "id": id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def detach_tag_from_contact( + self, contact_id: str, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[Tag]: + """ + You can remove tag from a specific contact. This will return a tag object for the tag that was removed from the contact. + + Parameters + ---------- + contact_id : str + The unique identifier for the contact which is given by Intercom + + id : str + The unique identifier for the tag which is given by Intercom + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Tag] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"contacts/{jsonable_encoder(contact_id)}/tags/{jsonable_encoder(id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def attach_tag_to_conversation( + self, conversation_id: str, *, id: str, admin_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[Tag]: + """ + You can tag a specific conversation. This will return a tag object for the tag that was added to the conversation. + + Parameters + ---------- + conversation_id : str + conversation_id + + id : str + The unique identifier for the tag which is given by Intercom + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Tag] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"conversations/{jsonable_encoder(conversation_id)}/tags", + method="POST", + json={ + "id": id, + "admin_id": admin_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def detach_tag_from_conversation( + self, conversation_id: str, id: str, *, admin_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[Tag]: + """ + You can remove tag from a specific conversation. This will return a tag object for the tag that was removed from the conversation. + + Parameters + ---------- + conversation_id : str + conversation_id + + id : str + id + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Tag] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"conversations/{jsonable_encoder(conversation_id)}/tags/{jsonable_encoder(id)}", + method="DELETE", + json={ + "admin_id": admin_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def list_tags(self, *, request_options: typing.Optional[RequestOptions] = None) -> AsyncHttpResponse[TagList]: + """ + You can fetch a list of all tags for a given workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TagList] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + "tags", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TagList, + construct_type( + type_=TagList, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create_tag( + self, *, request: CreateTagRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[Tag]: + """ + You can use this endpoint to perform the following operations: + + **1. Create a new tag:** You can create a new tag by passing in the tag name as specified in "Create or Update Tag Request Payload" described below. + + **2. Update an existing tag:** You can update an existing tag by passing the id of the tag as specified in "Create or Update Tag Request Payload" described below. + + **3. Tag Companies:** You can tag single company or a list of companies. You can tag a company by passing in the tag name and the company details as specified in "Tag Company Request Payload" described below. Also, if the tag doesn't exist then a new one will be created automatically. + + **4. Untag Companies:** You can untag a single company or a list of companies. You can untag a company by passing in the tag id and the company details as specified in "Untag Company Request Payload" described below. + + **5. Tag Multiple Users:** You can tag a list of users. You can tag the users by passing in the tag name and the user details as specified in "Tag Users Request Payload" described below. + + Each operation will return a tag object. + + Parameters + ---------- + request : CreateTagRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Tag] + Action successful + """ + _response = await self._client_wrapper.httpx_client.request( + "tags", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=CreateTagRequestBody, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def find_tag( + self, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[Tag]: + """ + You can fetch the details of tags that are on the workspace by their id. + This will return a tag object. + + Parameters + ---------- + id : str + The unique identifier of a given tag + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Tag] + Tag found + """ + _response = await self._client_wrapper.httpx_client.request( + f"tags/{jsonable_encoder(id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete_tag( + self, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[None]: + """ + You can delete the details of tags that are on the workspace by passing in the id. + + Parameters + ---------- + id : str + The unique identifier of a given tag + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"tags/{jsonable_encoder(id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def attach_tag_to_ticket( + self, ticket_id: str, *, id: str, admin_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[Tag]: + """ + You can tag a specific ticket. This will return a tag object for the tag that was added to the ticket. + + Parameters + ---------- + ticket_id : str + ticket_id + + id : str + The unique identifier for the tag which is given by Intercom + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Tag] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"tickets/{jsonable_encoder(ticket_id)}/tags", + method="POST", + json={ + "id": id, + "admin_id": admin_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def detach_tag_from_ticket( + self, ticket_id: str, id: str, *, admin_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[Tag]: + """ + You can remove tag from a specific ticket. This will return a tag object for the tag that was removed from the ticket. + + Parameters + ---------- + ticket_id : str + ticket_id + + id : str + The unique identifier for the tag which is given by Intercom + + admin_id : str + The unique identifier for the admin which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Tag] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"tickets/{jsonable_encoder(ticket_id)}/tags/{jsonable_encoder(id)}", + method="DELETE", + json={ + "admin_id": admin_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Tag, + construct_type( + type_=Tag, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/intercom/unstable/tags/types/__init__.py b/src/intercom/unstable/tags/types/__init__.py new file mode 100644 index 0000000..a34eba2 --- /dev/null +++ b/src/intercom/unstable/tags/types/__init__.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .create_tag_request_body import CreateTagRequestBody +from .tag import Tag +from .tag_basic import TagBasic + +__all__ = ["CreateTagRequestBody", "Tag", "TagBasic"] diff --git a/src/intercom/unstable/tags/types/create_tag_request_body.py b/src/intercom/unstable/tags/types/create_tag_request_body.py new file mode 100644 index 0000000..bb1dd87 --- /dev/null +++ b/src/intercom/unstable/tags/types/create_tag_request_body.py @@ -0,0 +1,12 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.create_or_update_tag_request import CreateOrUpdateTagRequest +from ...types.tag_company_request import TagCompanyRequest +from ...types.tag_multiple_users_request import TagMultipleUsersRequest +from ...types.untag_company_request import UntagCompanyRequest + +CreateTagRequestBody = typing.Union[ + CreateOrUpdateTagRequest, TagCompanyRequest, UntagCompanyRequest, TagMultipleUsersRequest +] diff --git a/src/intercom/unstable/tags/types/tag.py b/src/intercom/unstable/tags/types/tag.py new file mode 100644 index 0000000..160fbbf --- /dev/null +++ b/src/intercom/unstable/tags/types/tag.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from ...types.reference import Reference + + +class Tag(UncheckedBaseModel): + """ + A tag allows you to label your contacts, companies, and conversations and list them using that tag. + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + value is "tag" + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id of the tag + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the tag + """ + + applied_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time when the tag was applied to the object + """ + + applied_by: typing.Optional[Reference] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/tags/types/tag_basic.py b/src/intercom/unstable/tags/types/tag_basic.py new file mode 100644 index 0000000..b95a9c8 --- /dev/null +++ b/src/intercom/unstable/tags/types/tag_basic.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel + + +class TagBasic(UncheckedBaseModel): + """ + A tag allows you to label your contacts, companies, and conversations and list them using that tag. + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + value is "tag" + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id of the tag + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the tag + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/teams/__init__.py b/src/intercom/unstable/teams/__init__.py new file mode 100644 index 0000000..fed79d9 --- /dev/null +++ b/src/intercom/unstable/teams/__init__.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .types import Team + +__all__ = ["Team"] diff --git a/src/intercom/unstable/teams/client.py b/src/intercom/unstable/teams/client.py new file mode 100644 index 0000000..7766c94 --- /dev/null +++ b/src/intercom/unstable/teams/client.py @@ -0,0 +1,171 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ..types.team_list import TeamList +from .raw_client import AsyncRawTeamsClient, RawTeamsClient +from .types.team import Team + + +class TeamsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTeamsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawTeamsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTeamsClient + """ + return self._raw_client + + def list_teams(self, *, request_options: typing.Optional[RequestOptions] = None) -> TeamList: + """ + This will return a list of team objects for the App. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TeamList + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.teams.list_teams() + """ + _response = self._raw_client.list_teams(request_options=request_options) + return _response.data + + def retrieve_team(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Team: + """ + You can fetch the details of a single team, containing an array of admins that belong to this team. + + Parameters + ---------- + id : str + The unique identifier of a given team. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Team + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.teams.retrieve_team( + id="123", + ) + """ + _response = self._raw_client.retrieve_team(id, request_options=request_options) + return _response.data + + +class AsyncTeamsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTeamsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawTeamsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTeamsClient + """ + return self._raw_client + + async def list_teams(self, *, request_options: typing.Optional[RequestOptions] = None) -> TeamList: + """ + This will return a list of team objects for the App. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TeamList + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.teams.list_teams() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list_teams(request_options=request_options) + return _response.data + + async def retrieve_team(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Team: + """ + You can fetch the details of a single team, containing an array of admins that belong to this team. + + Parameters + ---------- + id : str + The unique identifier of a given team. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Team + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.teams.retrieve_team( + id="123", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.retrieve_team(id, request_options=request_options) + return _response.data diff --git a/src/intercom/unstable/teams/raw_client.py b/src/intercom/unstable/teams/raw_client.py new file mode 100644 index 0000000..9c2ae7c --- /dev/null +++ b/src/intercom/unstable/teams/raw_client.py @@ -0,0 +1,238 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ..errors.not_found_error import NotFoundError +from ..errors.unauthorized_error import UnauthorizedError +from ..types.error import Error +from ..types.team_list import TeamList +from .types.team import Team + + +class RawTeamsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list_teams(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[TeamList]: + """ + This will return a list of team objects for the App. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TeamList] + successful + """ + _response = self._client_wrapper.httpx_client.request( + "teams", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TeamList, + construct_type( + type_=TeamList, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def retrieve_team(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Team]: + """ + You can fetch the details of a single team, containing an array of admins that belong to this team. + + Parameters + ---------- + id : str + The unique identifier of a given team. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Team] + successful + """ + _response = self._client_wrapper.httpx_client.request( + f"teams/{jsonable_encoder(id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Team, + construct_type( + type_=Team, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawTeamsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list_teams( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[TeamList]: + """ + This will return a list of team objects for the App. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TeamList] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + "teams", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TeamList, + construct_type( + type_=TeamList, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def retrieve_team( + self, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[Team]: + """ + You can fetch the details of a single team, containing an array of admins that belong to this team. + + Parameters + ---------- + id : str + The unique identifier of a given team. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Team] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"teams/{jsonable_encoder(id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Team, + construct_type( + type_=Team, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/intercom/unstable/teams/types/__init__.py b/src/intercom/unstable/teams/types/__init__.py new file mode 100644 index 0000000..2d434e8 --- /dev/null +++ b/src/intercom/unstable/teams/types/__init__.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .team import Team + +__all__ = ["Team"] diff --git a/src/intercom/unstable/teams/types/team.py b/src/intercom/unstable/teams/types/team.py new file mode 100644 index 0000000..6ce3c60 --- /dev/null +++ b/src/intercom/unstable/teams/types/team.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from ...types.admin_priority_level import AdminPriorityLevel + + +class Team(UncheckedBaseModel): + """ + Teams are groups of admins in Intercom. + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + Value is always "team" + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id of the team + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the team + """ + + admin_ids: typing.Optional[typing.List[int]] = pydantic.Field(default=None) + """ + The list of admin IDs that are a part of the team. + """ + + admin_priority_level: typing.Optional[AdminPriorityLevel] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/ticket_states/__init__.py b/src/intercom/unstable/ticket_states/__init__.py new file mode 100644 index 0000000..5cde020 --- /dev/null +++ b/src/intercom/unstable/ticket_states/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/src/intercom/unstable/ticket_states/client.py b/src/intercom/unstable/ticket_states/client.py new file mode 100644 index 0000000..3e08bd0 --- /dev/null +++ b/src/intercom/unstable/ticket_states/client.py @@ -0,0 +1,100 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ..types.ticket_state_list import TicketStateList +from .raw_client import AsyncRawTicketStatesClient, RawTicketStatesClient + + +class TicketStatesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTicketStatesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawTicketStatesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTicketStatesClient + """ + return self._raw_client + + def list_ticket_states(self, *, request_options: typing.Optional[RequestOptions] = None) -> TicketStateList: + """ + You can get a list of all ticket states for a workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TicketStateList + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.ticket_states.list_ticket_states() + """ + _response = self._raw_client.list_ticket_states(request_options=request_options) + return _response.data + + +class AsyncTicketStatesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTicketStatesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawTicketStatesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTicketStatesClient + """ + return self._raw_client + + async def list_ticket_states(self, *, request_options: typing.Optional[RequestOptions] = None) -> TicketStateList: + """ + You can get a list of all ticket states for a workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TicketStateList + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.ticket_states.list_ticket_states() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list_ticket_states(request_options=request_options) + return _response.data diff --git a/src/intercom/unstable/ticket_states/raw_client.py b/src/intercom/unstable/ticket_states/raw_client.py new file mode 100644 index 0000000..b17ac0a --- /dev/null +++ b/src/intercom/unstable/ticket_states/raw_client.py @@ -0,0 +1,117 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ..errors.unauthorized_error import UnauthorizedError +from ..types.error import Error +from ..types.ticket_state_list import TicketStateList + + +class RawTicketStatesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list_ticket_states( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[TicketStateList]: + """ + You can get a list of all ticket states for a workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TicketStateList] + successful + """ + _response = self._client_wrapper.httpx_client.request( + "ticket_states", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TicketStateList, + construct_type( + type_=TicketStateList, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawTicketStatesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list_ticket_states( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[TicketStateList]: + """ + You can get a list of all ticket states for a workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TicketStateList] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + "ticket_states", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TicketStateList, + construct_type( + type_=TicketStateList, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/intercom/unstable/ticket_type_attributes/__init__.py b/src/intercom/unstable/ticket_type_attributes/__init__.py new file mode 100644 index 0000000..ff49df2 --- /dev/null +++ b/src/intercom/unstable/ticket_type_attributes/__init__.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .types import CreateTicketTypeAttributeRequestDataType + +__all__ = ["CreateTicketTypeAttributeRequestDataType"] diff --git a/src/intercom/unstable/ticket_type_attributes/client.py b/src/intercom/unstable/ticket_type_attributes/client.py new file mode 100644 index 0000000..955f38f --- /dev/null +++ b/src/intercom/unstable/ticket_type_attributes/client.py @@ -0,0 +1,438 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ..types.ticket_type_attribute import TicketTypeAttribute +from .raw_client import AsyncRawTicketTypeAttributesClient, RawTicketTypeAttributesClient +from .types.create_ticket_type_attribute_request_data_type import CreateTicketTypeAttributeRequestDataType + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class TicketTypeAttributesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTicketTypeAttributesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawTicketTypeAttributesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTicketTypeAttributesClient + """ + return self._raw_client + + def create_ticket_type_attribute( + self, + ticket_type_id: str, + *, + name: str, + description: str, + data_type: CreateTicketTypeAttributeRequestDataType, + required_to_create: typing.Optional[bool] = OMIT, + required_to_create_for_contacts: typing.Optional[bool] = OMIT, + visible_on_create: typing.Optional[bool] = OMIT, + visible_to_contacts: typing.Optional[bool] = OMIT, + multiline: typing.Optional[bool] = OMIT, + list_items: typing.Optional[str] = OMIT, + allow_multiple_values: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Optional[TicketTypeAttribute]: + """ + You can create a new attribute for a ticket type. + + Parameters + ---------- + ticket_type_id : str + The unique identifier for the ticket type which is given by Intercom. + + name : str + The name of the ticket type attribute + + description : str + The description of the attribute presented to the teammate or contact + + data_type : CreateTicketTypeAttributeRequestDataType + The data type of the attribute + + required_to_create : typing.Optional[bool] + Whether the attribute is required to be filled in when teammates are creating the ticket in Inbox. + + required_to_create_for_contacts : typing.Optional[bool] + Whether the attribute is required to be filled in when contacts are creating the ticket in Messenger. + + visible_on_create : typing.Optional[bool] + Whether the attribute is visible to teammates when creating a ticket in Inbox. + + visible_to_contacts : typing.Optional[bool] + Whether the attribute is visible to contacts when creating a ticket in Messenger. + + multiline : typing.Optional[bool] + Whether the attribute allows multiple lines of text (only applicable to string attributes) + + list_items : typing.Optional[str] + A comma delimited list of items for the attribute value (only applicable to list attributes) + + allow_multiple_values : typing.Optional[bool] + Whether the attribute allows multiple files to be attached to it (only applicable to file attributes) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[TicketTypeAttribute] + Ticket Type Attribute created + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.ticket_type_attributes.create_ticket_type_attribute( + ticket_type_id="ticket_type_id", + name="Attribute Title", + description="Attribute Description", + data_type="string", + required_to_create=False, + ) + """ + _response = self._raw_client.create_ticket_type_attribute( + ticket_type_id, + name=name, + description=description, + data_type=data_type, + required_to_create=required_to_create, + required_to_create_for_contacts=required_to_create_for_contacts, + visible_on_create=visible_on_create, + visible_to_contacts=visible_to_contacts, + multiline=multiline, + list_items=list_items, + allow_multiple_values=allow_multiple_values, + request_options=request_options, + ) + return _response.data + + def update_ticket_type_attribute( + self, + ticket_type_id: str, + id: str, + *, + name: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + required_to_create: typing.Optional[bool] = OMIT, + required_to_create_for_contacts: typing.Optional[bool] = OMIT, + visible_on_create: typing.Optional[bool] = OMIT, + visible_to_contacts: typing.Optional[bool] = OMIT, + multiline: typing.Optional[bool] = OMIT, + list_items: typing.Optional[str] = OMIT, + allow_multiple_values: typing.Optional[bool] = OMIT, + archived: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Optional[TicketTypeAttribute]: + """ + You can update an existing attribute for a ticket type. + + Parameters + ---------- + ticket_type_id : str + The unique identifier for the ticket type which is given by Intercom. + + id : str + The unique identifier for the ticket type attribute which is given by Intercom. + + name : typing.Optional[str] + The name of the ticket type attribute + + description : typing.Optional[str] + The description of the attribute presented to the teammate or contact + + required_to_create : typing.Optional[bool] + Whether the attribute is required to be filled in when teammates are creating the ticket in Inbox. + + required_to_create_for_contacts : typing.Optional[bool] + Whether the attribute is required to be filled in when contacts are creating the ticket in Messenger. + + visible_on_create : typing.Optional[bool] + Whether the attribute is visible to teammates when creating a ticket in Inbox. + + visible_to_contacts : typing.Optional[bool] + Whether the attribute is visible to contacts when creating a ticket in Messenger. + + multiline : typing.Optional[bool] + Whether the attribute allows multiple lines of text (only applicable to string attributes) + + list_items : typing.Optional[str] + A comma delimited list of items for the attribute value (only applicable to list attributes) + + allow_multiple_values : typing.Optional[bool] + Whether the attribute allows multiple files to be attached to it (only applicable to file attributes) + + archived : typing.Optional[bool] + Whether the attribute should be archived and not shown during creation of the ticket (it will still be present on previously created tickets) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[TicketTypeAttribute] + Ticket Type Attribute updated + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.ticket_type_attributes.update_ticket_type_attribute( + ticket_type_id="ticket_type_id", + id="id", + description="New Attribute Description", + ) + """ + _response = self._raw_client.update_ticket_type_attribute( + ticket_type_id, + id, + name=name, + description=description, + required_to_create=required_to_create, + required_to_create_for_contacts=required_to_create_for_contacts, + visible_on_create=visible_on_create, + visible_to_contacts=visible_to_contacts, + multiline=multiline, + list_items=list_items, + allow_multiple_values=allow_multiple_values, + archived=archived, + request_options=request_options, + ) + return _response.data + + +class AsyncTicketTypeAttributesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTicketTypeAttributesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawTicketTypeAttributesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTicketTypeAttributesClient + """ + return self._raw_client + + async def create_ticket_type_attribute( + self, + ticket_type_id: str, + *, + name: str, + description: str, + data_type: CreateTicketTypeAttributeRequestDataType, + required_to_create: typing.Optional[bool] = OMIT, + required_to_create_for_contacts: typing.Optional[bool] = OMIT, + visible_on_create: typing.Optional[bool] = OMIT, + visible_to_contacts: typing.Optional[bool] = OMIT, + multiline: typing.Optional[bool] = OMIT, + list_items: typing.Optional[str] = OMIT, + allow_multiple_values: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Optional[TicketTypeAttribute]: + """ + You can create a new attribute for a ticket type. + + Parameters + ---------- + ticket_type_id : str + The unique identifier for the ticket type which is given by Intercom. + + name : str + The name of the ticket type attribute + + description : str + The description of the attribute presented to the teammate or contact + + data_type : CreateTicketTypeAttributeRequestDataType + The data type of the attribute + + required_to_create : typing.Optional[bool] + Whether the attribute is required to be filled in when teammates are creating the ticket in Inbox. + + required_to_create_for_contacts : typing.Optional[bool] + Whether the attribute is required to be filled in when contacts are creating the ticket in Messenger. + + visible_on_create : typing.Optional[bool] + Whether the attribute is visible to teammates when creating a ticket in Inbox. + + visible_to_contacts : typing.Optional[bool] + Whether the attribute is visible to contacts when creating a ticket in Messenger. + + multiline : typing.Optional[bool] + Whether the attribute allows multiple lines of text (only applicable to string attributes) + + list_items : typing.Optional[str] + A comma delimited list of items for the attribute value (only applicable to list attributes) + + allow_multiple_values : typing.Optional[bool] + Whether the attribute allows multiple files to be attached to it (only applicable to file attributes) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[TicketTypeAttribute] + Ticket Type Attribute created + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.ticket_type_attributes.create_ticket_type_attribute( + ticket_type_id="ticket_type_id", + name="Attribute Title", + description="Attribute Description", + data_type="string", + required_to_create=False, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create_ticket_type_attribute( + ticket_type_id, + name=name, + description=description, + data_type=data_type, + required_to_create=required_to_create, + required_to_create_for_contacts=required_to_create_for_contacts, + visible_on_create=visible_on_create, + visible_to_contacts=visible_to_contacts, + multiline=multiline, + list_items=list_items, + allow_multiple_values=allow_multiple_values, + request_options=request_options, + ) + return _response.data + + async def update_ticket_type_attribute( + self, + ticket_type_id: str, + id: str, + *, + name: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + required_to_create: typing.Optional[bool] = OMIT, + required_to_create_for_contacts: typing.Optional[bool] = OMIT, + visible_on_create: typing.Optional[bool] = OMIT, + visible_to_contacts: typing.Optional[bool] = OMIT, + multiline: typing.Optional[bool] = OMIT, + list_items: typing.Optional[str] = OMIT, + allow_multiple_values: typing.Optional[bool] = OMIT, + archived: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Optional[TicketTypeAttribute]: + """ + You can update an existing attribute for a ticket type. + + Parameters + ---------- + ticket_type_id : str + The unique identifier for the ticket type which is given by Intercom. + + id : str + The unique identifier for the ticket type attribute which is given by Intercom. + + name : typing.Optional[str] + The name of the ticket type attribute + + description : typing.Optional[str] + The description of the attribute presented to the teammate or contact + + required_to_create : typing.Optional[bool] + Whether the attribute is required to be filled in when teammates are creating the ticket in Inbox. + + required_to_create_for_contacts : typing.Optional[bool] + Whether the attribute is required to be filled in when contacts are creating the ticket in Messenger. + + visible_on_create : typing.Optional[bool] + Whether the attribute is visible to teammates when creating a ticket in Inbox. + + visible_to_contacts : typing.Optional[bool] + Whether the attribute is visible to contacts when creating a ticket in Messenger. + + multiline : typing.Optional[bool] + Whether the attribute allows multiple lines of text (only applicable to string attributes) + + list_items : typing.Optional[str] + A comma delimited list of items for the attribute value (only applicable to list attributes) + + allow_multiple_values : typing.Optional[bool] + Whether the attribute allows multiple files to be attached to it (only applicable to file attributes) + + archived : typing.Optional[bool] + Whether the attribute should be archived and not shown during creation of the ticket (it will still be present on previously created tickets) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[TicketTypeAttribute] + Ticket Type Attribute updated + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.ticket_type_attributes.update_ticket_type_attribute( + ticket_type_id="ticket_type_id", + id="id", + description="New Attribute Description", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update_ticket_type_attribute( + ticket_type_id, + id, + name=name, + description=description, + required_to_create=required_to_create, + required_to_create_for_contacts=required_to_create_for_contacts, + visible_on_create=visible_on_create, + visible_to_contacts=visible_to_contacts, + multiline=multiline, + list_items=list_items, + allow_multiple_values=allow_multiple_values, + archived=archived, + request_options=request_options, + ) + return _response.data diff --git a/src/intercom/unstable/ticket_type_attributes/raw_client.py b/src/intercom/unstable/ticket_type_attributes/raw_client.py new file mode 100644 index 0000000..c05d357 --- /dev/null +++ b/src/intercom/unstable/ticket_type_attributes/raw_client.py @@ -0,0 +1,480 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ..errors.unauthorized_error import UnauthorizedError +from ..types.error import Error +from ..types.ticket_type_attribute import TicketTypeAttribute +from .types.create_ticket_type_attribute_request_data_type import CreateTicketTypeAttributeRequestDataType + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawTicketTypeAttributesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create_ticket_type_attribute( + self, + ticket_type_id: str, + *, + name: str, + description: str, + data_type: CreateTicketTypeAttributeRequestDataType, + required_to_create: typing.Optional[bool] = OMIT, + required_to_create_for_contacts: typing.Optional[bool] = OMIT, + visible_on_create: typing.Optional[bool] = OMIT, + visible_to_contacts: typing.Optional[bool] = OMIT, + multiline: typing.Optional[bool] = OMIT, + list_items: typing.Optional[str] = OMIT, + allow_multiple_values: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.Optional[TicketTypeAttribute]]: + """ + You can create a new attribute for a ticket type. + + Parameters + ---------- + ticket_type_id : str + The unique identifier for the ticket type which is given by Intercom. + + name : str + The name of the ticket type attribute + + description : str + The description of the attribute presented to the teammate or contact + + data_type : CreateTicketTypeAttributeRequestDataType + The data type of the attribute + + required_to_create : typing.Optional[bool] + Whether the attribute is required to be filled in when teammates are creating the ticket in Inbox. + + required_to_create_for_contacts : typing.Optional[bool] + Whether the attribute is required to be filled in when contacts are creating the ticket in Messenger. + + visible_on_create : typing.Optional[bool] + Whether the attribute is visible to teammates when creating a ticket in Inbox. + + visible_to_contacts : typing.Optional[bool] + Whether the attribute is visible to contacts when creating a ticket in Messenger. + + multiline : typing.Optional[bool] + Whether the attribute allows multiple lines of text (only applicable to string attributes) + + list_items : typing.Optional[str] + A comma delimited list of items for the attribute value (only applicable to list attributes) + + allow_multiple_values : typing.Optional[bool] + Whether the attribute allows multiple files to be attached to it (only applicable to file attributes) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Optional[TicketTypeAttribute]] + Ticket Type Attribute created + """ + _response = self._client_wrapper.httpx_client.request( + f"ticket_types/{jsonable_encoder(ticket_type_id)}/attributes", + method="POST", + json={ + "name": name, + "description": description, + "data_type": data_type, + "required_to_create": required_to_create, + "required_to_create_for_contacts": required_to_create_for_contacts, + "visible_on_create": visible_on_create, + "visible_to_contacts": visible_to_contacts, + "multiline": multiline, + "list_items": list_items, + "allow_multiple_values": allow_multiple_values, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Optional[TicketTypeAttribute], + construct_type( + type_=typing.Optional[TicketTypeAttribute], # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update_ticket_type_attribute( + self, + ticket_type_id: str, + id: str, + *, + name: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + required_to_create: typing.Optional[bool] = OMIT, + required_to_create_for_contacts: typing.Optional[bool] = OMIT, + visible_on_create: typing.Optional[bool] = OMIT, + visible_to_contacts: typing.Optional[bool] = OMIT, + multiline: typing.Optional[bool] = OMIT, + list_items: typing.Optional[str] = OMIT, + allow_multiple_values: typing.Optional[bool] = OMIT, + archived: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.Optional[TicketTypeAttribute]]: + """ + You can update an existing attribute for a ticket type. + + Parameters + ---------- + ticket_type_id : str + The unique identifier for the ticket type which is given by Intercom. + + id : str + The unique identifier for the ticket type attribute which is given by Intercom. + + name : typing.Optional[str] + The name of the ticket type attribute + + description : typing.Optional[str] + The description of the attribute presented to the teammate or contact + + required_to_create : typing.Optional[bool] + Whether the attribute is required to be filled in when teammates are creating the ticket in Inbox. + + required_to_create_for_contacts : typing.Optional[bool] + Whether the attribute is required to be filled in when contacts are creating the ticket in Messenger. + + visible_on_create : typing.Optional[bool] + Whether the attribute is visible to teammates when creating a ticket in Inbox. + + visible_to_contacts : typing.Optional[bool] + Whether the attribute is visible to contacts when creating a ticket in Messenger. + + multiline : typing.Optional[bool] + Whether the attribute allows multiple lines of text (only applicable to string attributes) + + list_items : typing.Optional[str] + A comma delimited list of items for the attribute value (only applicable to list attributes) + + allow_multiple_values : typing.Optional[bool] + Whether the attribute allows multiple files to be attached to it (only applicable to file attributes) + + archived : typing.Optional[bool] + Whether the attribute should be archived and not shown during creation of the ticket (it will still be present on previously created tickets) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Optional[TicketTypeAttribute]] + Ticket Type Attribute updated + """ + _response = self._client_wrapper.httpx_client.request( + f"ticket_types/{jsonable_encoder(ticket_type_id)}/attributes/{jsonable_encoder(id)}", + method="PUT", + json={ + "name": name, + "description": description, + "required_to_create": required_to_create, + "required_to_create_for_contacts": required_to_create_for_contacts, + "visible_on_create": visible_on_create, + "visible_to_contacts": visible_to_contacts, + "multiline": multiline, + "list_items": list_items, + "allow_multiple_values": allow_multiple_values, + "archived": archived, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Optional[TicketTypeAttribute], + construct_type( + type_=typing.Optional[TicketTypeAttribute], # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawTicketTypeAttributesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create_ticket_type_attribute( + self, + ticket_type_id: str, + *, + name: str, + description: str, + data_type: CreateTicketTypeAttributeRequestDataType, + required_to_create: typing.Optional[bool] = OMIT, + required_to_create_for_contacts: typing.Optional[bool] = OMIT, + visible_on_create: typing.Optional[bool] = OMIT, + visible_to_contacts: typing.Optional[bool] = OMIT, + multiline: typing.Optional[bool] = OMIT, + list_items: typing.Optional[str] = OMIT, + allow_multiple_values: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.Optional[TicketTypeAttribute]]: + """ + You can create a new attribute for a ticket type. + + Parameters + ---------- + ticket_type_id : str + The unique identifier for the ticket type which is given by Intercom. + + name : str + The name of the ticket type attribute + + description : str + The description of the attribute presented to the teammate or contact + + data_type : CreateTicketTypeAttributeRequestDataType + The data type of the attribute + + required_to_create : typing.Optional[bool] + Whether the attribute is required to be filled in when teammates are creating the ticket in Inbox. + + required_to_create_for_contacts : typing.Optional[bool] + Whether the attribute is required to be filled in when contacts are creating the ticket in Messenger. + + visible_on_create : typing.Optional[bool] + Whether the attribute is visible to teammates when creating a ticket in Inbox. + + visible_to_contacts : typing.Optional[bool] + Whether the attribute is visible to contacts when creating a ticket in Messenger. + + multiline : typing.Optional[bool] + Whether the attribute allows multiple lines of text (only applicable to string attributes) + + list_items : typing.Optional[str] + A comma delimited list of items for the attribute value (only applicable to list attributes) + + allow_multiple_values : typing.Optional[bool] + Whether the attribute allows multiple files to be attached to it (only applicable to file attributes) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Optional[TicketTypeAttribute]] + Ticket Type Attribute created + """ + _response = await self._client_wrapper.httpx_client.request( + f"ticket_types/{jsonable_encoder(ticket_type_id)}/attributes", + method="POST", + json={ + "name": name, + "description": description, + "data_type": data_type, + "required_to_create": required_to_create, + "required_to_create_for_contacts": required_to_create_for_contacts, + "visible_on_create": visible_on_create, + "visible_to_contacts": visible_to_contacts, + "multiline": multiline, + "list_items": list_items, + "allow_multiple_values": allow_multiple_values, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Optional[TicketTypeAttribute], + construct_type( + type_=typing.Optional[TicketTypeAttribute], # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update_ticket_type_attribute( + self, + ticket_type_id: str, + id: str, + *, + name: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + required_to_create: typing.Optional[bool] = OMIT, + required_to_create_for_contacts: typing.Optional[bool] = OMIT, + visible_on_create: typing.Optional[bool] = OMIT, + visible_to_contacts: typing.Optional[bool] = OMIT, + multiline: typing.Optional[bool] = OMIT, + list_items: typing.Optional[str] = OMIT, + allow_multiple_values: typing.Optional[bool] = OMIT, + archived: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.Optional[TicketTypeAttribute]]: + """ + You can update an existing attribute for a ticket type. + + Parameters + ---------- + ticket_type_id : str + The unique identifier for the ticket type which is given by Intercom. + + id : str + The unique identifier for the ticket type attribute which is given by Intercom. + + name : typing.Optional[str] + The name of the ticket type attribute + + description : typing.Optional[str] + The description of the attribute presented to the teammate or contact + + required_to_create : typing.Optional[bool] + Whether the attribute is required to be filled in when teammates are creating the ticket in Inbox. + + required_to_create_for_contacts : typing.Optional[bool] + Whether the attribute is required to be filled in when contacts are creating the ticket in Messenger. + + visible_on_create : typing.Optional[bool] + Whether the attribute is visible to teammates when creating a ticket in Inbox. + + visible_to_contacts : typing.Optional[bool] + Whether the attribute is visible to contacts when creating a ticket in Messenger. + + multiline : typing.Optional[bool] + Whether the attribute allows multiple lines of text (only applicable to string attributes) + + list_items : typing.Optional[str] + A comma delimited list of items for the attribute value (only applicable to list attributes) + + allow_multiple_values : typing.Optional[bool] + Whether the attribute allows multiple files to be attached to it (only applicable to file attributes) + + archived : typing.Optional[bool] + Whether the attribute should be archived and not shown during creation of the ticket (it will still be present on previously created tickets) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Optional[TicketTypeAttribute]] + Ticket Type Attribute updated + """ + _response = await self._client_wrapper.httpx_client.request( + f"ticket_types/{jsonable_encoder(ticket_type_id)}/attributes/{jsonable_encoder(id)}", + method="PUT", + json={ + "name": name, + "description": description, + "required_to_create": required_to_create, + "required_to_create_for_contacts": required_to_create_for_contacts, + "visible_on_create": visible_on_create, + "visible_to_contacts": visible_to_contacts, + "multiline": multiline, + "list_items": list_items, + "allow_multiple_values": allow_multiple_values, + "archived": archived, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Optional[TicketTypeAttribute], + construct_type( + type_=typing.Optional[TicketTypeAttribute], # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/intercom/unstable/ticket_type_attributes/types/__init__.py b/src/intercom/unstable/ticket_type_attributes/types/__init__.py new file mode 100644 index 0000000..038bb1a --- /dev/null +++ b/src/intercom/unstable/ticket_type_attributes/types/__init__.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .create_ticket_type_attribute_request_data_type import CreateTicketTypeAttributeRequestDataType + +__all__ = ["CreateTicketTypeAttributeRequestDataType"] diff --git a/src/intercom/unstable/ticket_type_attributes/types/create_ticket_type_attribute_request_data_type.py b/src/intercom/unstable/ticket_type_attributes/types/create_ticket_type_attribute_request_data_type.py new file mode 100644 index 0000000..af58adf --- /dev/null +++ b/src/intercom/unstable/ticket_type_attributes/types/create_ticket_type_attribute_request_data_type.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CreateTicketTypeAttributeRequestDataType = typing.Union[ + typing.Literal["string", "list", "integer", "decimal", "boolean", "datetime", "files"], typing.Any +] diff --git a/src/intercom/unstable/ticket_types/__init__.py b/src/intercom/unstable/ticket_types/__init__.py new file mode 100644 index 0000000..5cde020 --- /dev/null +++ b/src/intercom/unstable/ticket_types/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/src/intercom/unstable/ticket_types/client.py b/src/intercom/unstable/ticket_types/client.py new file mode 100644 index 0000000..3571d73 --- /dev/null +++ b/src/intercom/unstable/ticket_types/client.py @@ -0,0 +1,258 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ..tickets.types.ticket_type import TicketType +from ..types.ticket_type_list import TicketTypeList +from .raw_client import AsyncRawTicketTypesClient, RawTicketTypesClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class TicketTypesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTicketTypesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawTicketTypesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTicketTypesClient + """ + return self._raw_client + + def list_ticket_types(self, *, request_options: typing.Optional[RequestOptions] = None) -> TicketTypeList: + """ + You can get a list of all ticket types for a workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TicketTypeList + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.ticket_types.list_ticket_types() + """ + _response = self._raw_client.list_ticket_types(request_options=request_options) + return _response.data + + def create_ticket_type( + self, *, request: typing.Optional[typing.Any] = None, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Optional[TicketType]: + """ + You can create a new ticket type. + > 📘 Creating ticket types. + > + > Every ticket type will be created with two default attributes: _default_title_ and _default_description_. + > For the `icon` propery, use an emoji from [Twemoji Cheatsheet](https://twemoji-cheatsheet.vercel.app/) + + Parameters + ---------- + request : typing.Optional[typing.Any] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[TicketType] + Ticket type created + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.ticket_types.create_ticket_type( + request={"key": "value"}, + ) + """ + _response = self._raw_client.create_ticket_type(request=request, request_options=request_options) + return _response.data + + def get_ticket_type( + self, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Optional[TicketType]: + """ + You can fetch the details of a single ticket type. + + Parameters + ---------- + id : str + The unique identifier for the ticket type which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[TicketType] + Ticket type found + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.ticket_types.get_ticket_type( + id="id", + ) + """ + _response = self._raw_client.get_ticket_type(id, request_options=request_options) + return _response.data + + +class AsyncTicketTypesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTicketTypesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawTicketTypesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTicketTypesClient + """ + return self._raw_client + + async def list_ticket_types(self, *, request_options: typing.Optional[RequestOptions] = None) -> TicketTypeList: + """ + You can get a list of all ticket types for a workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TicketTypeList + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.ticket_types.list_ticket_types() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list_ticket_types(request_options=request_options) + return _response.data + + async def create_ticket_type( + self, *, request: typing.Optional[typing.Any] = None, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Optional[TicketType]: + """ + You can create a new ticket type. + > 📘 Creating ticket types. + > + > Every ticket type will be created with two default attributes: _default_title_ and _default_description_. + > For the `icon` propery, use an emoji from [Twemoji Cheatsheet](https://twemoji-cheatsheet.vercel.app/) + + Parameters + ---------- + request : typing.Optional[typing.Any] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[TicketType] + Ticket type created + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.ticket_types.create_ticket_type( + request={"key": "value"}, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create_ticket_type(request=request, request_options=request_options) + return _response.data + + async def get_ticket_type( + self, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Optional[TicketType]: + """ + You can fetch the details of a single ticket type. + + Parameters + ---------- + id : str + The unique identifier for the ticket type which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[TicketType] + Ticket type found + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.ticket_types.get_ticket_type( + id="id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_ticket_type(id, request_options=request_options) + return _response.data diff --git a/src/intercom/unstable/ticket_types/raw_client.py b/src/intercom/unstable/ticket_types/raw_client.py new file mode 100644 index 0000000..fe7bd35 --- /dev/null +++ b/src/intercom/unstable/ticket_types/raw_client.py @@ -0,0 +1,346 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ..errors.unauthorized_error import UnauthorizedError +from ..tickets.types.ticket_type import TicketType +from ..types.error import Error +from ..types.ticket_type_list import TicketTypeList + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawTicketTypesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list_ticket_types( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[TicketTypeList]: + """ + You can get a list of all ticket types for a workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TicketTypeList] + successful + """ + _response = self._client_wrapper.httpx_client.request( + "ticket_types", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TicketTypeList, + construct_type( + type_=TicketTypeList, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create_ticket_type( + self, *, request: typing.Optional[typing.Any] = None, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[typing.Optional[TicketType]]: + """ + You can create a new ticket type. + > 📘 Creating ticket types. + > + > Every ticket type will be created with two default attributes: _default_title_ and _default_description_. + > For the `icon` propery, use an emoji from [Twemoji Cheatsheet](https://twemoji-cheatsheet.vercel.app/) + + Parameters + ---------- + request : typing.Optional[typing.Any] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Optional[TicketType]] + Ticket type created + """ + _response = self._client_wrapper.httpx_client.request( + "ticket_types", + method="POST", + json=request, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Optional[TicketType], + construct_type( + type_=typing.Optional[TicketType], # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get_ticket_type( + self, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[typing.Optional[TicketType]]: + """ + You can fetch the details of a single ticket type. + + Parameters + ---------- + id : str + The unique identifier for the ticket type which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Optional[TicketType]] + Ticket type found + """ + _response = self._client_wrapper.httpx_client.request( + f"ticket_types/{jsonable_encoder(id)}", + method="GET", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Optional[TicketType], + construct_type( + type_=typing.Optional[TicketType], # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawTicketTypesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list_ticket_types( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[TicketTypeList]: + """ + You can get a list of all ticket types for a workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TicketTypeList] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + "ticket_types", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TicketTypeList, + construct_type( + type_=TicketTypeList, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create_ticket_type( + self, *, request: typing.Optional[typing.Any] = None, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[typing.Optional[TicketType]]: + """ + You can create a new ticket type. + > 📘 Creating ticket types. + > + > Every ticket type will be created with two default attributes: _default_title_ and _default_description_. + > For the `icon` propery, use an emoji from [Twemoji Cheatsheet](https://twemoji-cheatsheet.vercel.app/) + + Parameters + ---------- + request : typing.Optional[typing.Any] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Optional[TicketType]] + Ticket type created + """ + _response = await self._client_wrapper.httpx_client.request( + "ticket_types", + method="POST", + json=request, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Optional[TicketType], + construct_type( + type_=typing.Optional[TicketType], # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get_ticket_type( + self, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[typing.Optional[TicketType]]: + """ + You can fetch the details of a single ticket type. + + Parameters + ---------- + id : str + The unique identifier for the ticket type which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Optional[TicketType]] + Ticket type found + """ + _response = await self._client_wrapper.httpx_client.request( + f"ticket_types/{jsonable_encoder(id)}", + method="GET", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Optional[TicketType], + construct_type( + type_=typing.Optional[TicketType], # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/intercom/unstable/tickets/__init__.py b/src/intercom/unstable/tickets/__init__.py new file mode 100644 index 0000000..f19a54d --- /dev/null +++ b/src/intercom/unstable/tickets/__init__.py @@ -0,0 +1,51 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .types import ( + DeleteTicketResponse, + ReplyTicketRequestBody, + Ticket, + TicketCategory, + TicketContacts, + TicketPart, + TicketPartPreviousTicketState, + TicketPartTicketState, + TicketPartUpdatedAttributeData, + TicketPartUpdatedAttributeDataAttribute, + TicketPartUpdatedAttributeDataValue, + TicketPartUpdatedAttributeDataValueId, + TicketPartUpdatedAttributeDataValueLabel, + TicketState, + TicketStateCategory, + TicketStateDetailed, + TicketStateDetailedCategory, + TicketStateDetailedTicketTypes, + TicketType, + TicketTypeCategory, + TicketTypeTicketStates, +) + +__all__ = [ + "DeleteTicketResponse", + "ReplyTicketRequestBody", + "Ticket", + "TicketCategory", + "TicketContacts", + "TicketPart", + "TicketPartPreviousTicketState", + "TicketPartTicketState", + "TicketPartUpdatedAttributeData", + "TicketPartUpdatedAttributeDataAttribute", + "TicketPartUpdatedAttributeDataValue", + "TicketPartUpdatedAttributeDataValueId", + "TicketPartUpdatedAttributeDataValueLabel", + "TicketState", + "TicketStateCategory", + "TicketStateDetailed", + "TicketStateDetailedCategory", + "TicketStateDetailedTicketTypes", + "TicketType", + "TicketTypeCategory", + "TicketTypeTicketStates", +] diff --git a/src/intercom/unstable/tickets/client.py b/src/intercom/unstable/tickets/client.py new file mode 100644 index 0000000..b10a909 --- /dev/null +++ b/src/intercom/unstable/tickets/client.py @@ -0,0 +1,876 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ..jobs.types.jobs import Jobs +from ..types.create_ticket_request_assignment import CreateTicketRequestAssignment +from ..types.create_ticket_request_contacts_item import CreateTicketRequestContactsItem +from ..types.search_request_query import SearchRequestQuery +from ..types.starting_after_paging import StartingAfterPaging +from ..types.ticket_list import TicketList +from ..types.ticket_reply import TicketReply +from .raw_client import AsyncRawTicketsClient, RawTicketsClient +from .types.delete_ticket_response import DeleteTicketResponse +from .types.reply_ticket_request_body import ReplyTicketRequestBody +from .types.ticket import Ticket + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class TicketsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTicketsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawTicketsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTicketsClient + """ + return self._raw_client + + def reply_ticket( + self, id: str, *, request: ReplyTicketRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> TicketReply: + """ + You can reply to a ticket with a message from an admin or on behalf of a contact, or with a note for admins. + + Parameters + ---------- + id : str + + request : ReplyTicketRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TicketReply + Admin Reply to send Quick Reply Options + + Examples + -------- + from intercom import Intercom + from intercom.unstable import ContactReplyTicketIntercomUserIdRequest + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.tickets.reply_ticket( + id="123", + request=ContactReplyTicketIntercomUserIdRequest( + body="Thanks again :)", + intercom_user_id="6762f2971bb69f9f2193bc49", + ), + ) + """ + _response = self._raw_client.reply_ticket(id, request=request, request_options=request_options) + return _response.data + + def enqueue_create_ticket( + self, + *, + ticket_type_id: str, + contacts: typing.Sequence[CreateTicketRequestContactsItem], + skip_notifications: typing.Optional[bool] = OMIT, + conversation_to_link_id: typing.Optional[str] = OMIT, + company_id: typing.Optional[str] = OMIT, + created_at: typing.Optional[int] = OMIT, + assignment: typing.Optional[CreateTicketRequestAssignment] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Jobs: + """ + Enqueues ticket creation for asynchronous processing, returning if the job was enqueued successfully to be processed. We attempt to perform a best-effort validation on inputs before tasks are enqueued. If the given parameters are incorrect, we won't enqueue the job. + + Parameters + ---------- + ticket_type_id : str + The ID of the type of ticket you want to create + + contacts : typing.Sequence[CreateTicketRequestContactsItem] + The list of contacts (users or leads) affected by this ticket. Currently only one is allowed + + skip_notifications : typing.Optional[bool] + Option to disable notifications when a Ticket is created. + + conversation_to_link_id : typing.Optional[str] + The ID of the conversation you want to link to the ticket. Here are the valid ways of linking two tickets: + - conversation | back-office ticket + - customer tickets | non-shared back-office ticket + - conversation | tracker ticket + - customer ticket | tracker ticket + + company_id : typing.Optional[str] + The ID of the company that the ticket is associated with. The unique identifier for the company which is given by Intercom + + created_at : typing.Optional[int] + The time the ticket was created. If not provided, the current time will be used. + + assignment : typing.Optional[CreateTicketRequestAssignment] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Jobs + Successful response + + Examples + -------- + from intercom import Intercom + from intercom.unstable import CreateTicketRequestContactsItemId + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.tickets.enqueue_create_ticket( + ticket_type_id="1234", + contacts=[ + CreateTicketRequestContactsItemId( + id="6762f2d81bb69f9f2193bc54", + ) + ], + ) + """ + _response = self._raw_client.enqueue_create_ticket( + ticket_type_id=ticket_type_id, + contacts=contacts, + skip_notifications=skip_notifications, + conversation_to_link_id=conversation_to_link_id, + company_id=company_id, + created_at=created_at, + assignment=assignment, + request_options=request_options, + ) + return _response.data + + def get_ticket( + self, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Optional[Ticket]: + """ + You can fetch the details of a single ticket. + + Parameters + ---------- + id : str + The unique identifier for the ticket which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[Ticket] + Ticket found + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.tickets.get_ticket( + id="id", + ) + """ + _response = self._raw_client.get_ticket(id, request_options=request_options) + return _response.data + + def update_ticket( + self, + id: str, + *, + ticket_attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + ticket_state_id: typing.Optional[str] = OMIT, + company_id: typing.Optional[str] = OMIT, + open: typing.Optional[bool] = OMIT, + is_shared: typing.Optional[bool] = OMIT, + snoozed_until: typing.Optional[int] = OMIT, + admin_id: typing.Optional[int] = OMIT, + assignee_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Optional[Ticket]: + """ + You can update a ticket. + + Parameters + ---------- + id : str + The unique identifier for the ticket which is given by Intercom + + ticket_attributes : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The attributes set on the ticket. + + ticket_state_id : typing.Optional[str] + The ID of the ticket state associated with the ticket type. + + company_id : typing.Optional[str] + The ID of the company that the ticket is associated with. The unique identifier for the company which is given by Intercom. Set to nil to remove company. + + open : typing.Optional[bool] + Specify if a ticket is open. Set to false to close a ticket. Closing a ticket will also unsnooze it. + + is_shared : typing.Optional[bool] + Specify whether the ticket is visible to users. + + snoozed_until : typing.Optional[int] + The time you want the ticket to reopen. + + admin_id : typing.Optional[int] + The ID of the admin performing ticket update. Needed for workflows execution and attributing actions to specific admins. + + assignee_id : typing.Optional[str] + The ID of the admin or team to which the ticket is assigned. Set this 0 to unassign it. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[Ticket] + Successful response + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.tickets.update_ticket( + id="id", + ticket_attributes={ + "_default_title_": "example", + "_default_description_": "there is a problem", + }, + ticket_state_id="123", + open=True, + snoozed_until=1673609604, + admin_id=991268011, + assignee_id="123", + ) + """ + _response = self._raw_client.update_ticket( + id, + ticket_attributes=ticket_attributes, + ticket_state_id=ticket_state_id, + company_id=company_id, + open=open, + is_shared=is_shared, + snoozed_until=snoozed_until, + admin_id=admin_id, + assignee_id=assignee_id, + request_options=request_options, + ) + return _response.data + + def delete_ticket( + self, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteTicketResponse: + """ + You can delete a ticket using the Intercom provided ID. + + Parameters + ---------- + id : str + The unique identifier for the ticket which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteTicketResponse + successful + + Examples + -------- + from intercom import Intercom + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.tickets.delete_ticket( + id="id", + ) + """ + _response = self._raw_client.delete_ticket(id, request_options=request_options) + return _response.data + + def search_tickets( + self, + *, + query: SearchRequestQuery, + pagination: typing.Optional[StartingAfterPaging] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> TicketList: + """ + You can search for multiple tickets by the value of their attributes in order to fetch exactly which ones you want. + + To search for tickets, you send a `POST` request to `https://api.intercom.io/tickets/search`. + + This will accept a query object in the body which will define your filters. + {% admonition type="warning" name="Optimizing search queries" %} + Search queries can be complex, so optimizing them can help the performance of your search. + Use the `AND` and `OR` operators to combine multiple filters to get the exact results you need and utilize + pagination to limit the number of results returned. The default is `20` results per page. + See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#example-search-conversations-request) for more details on how to use the `starting_after` param. + {% /admonition %} + + ### Nesting & Limitations + + You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). + There are some limitations to the amount of multiples there can be: + - There's a limit of max 2 nested filters + - There's a limit of max 15 filters for each AND or OR group + + ### Accepted Fields + + Most keys listed as part of the Ticket model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as `created_at` accepts a date, the `value` cannot be a string such as `"foobar"`). + The `source.body` field is unique as the search will not be performed against the entire value, but instead against every element of the value separately. For example, when searching for a conversation with a `"I need support"` body - the query should contain a `=` operator with the value `"support"` for such conversation to be returned. A query with a `=` operator and a `"need support"` value will not yield a result. + + | Field | Type | + | :---------------------------------------- | :--------------------------------------------------------------------------------------- | + | id | String | + | created_at | Date (UNIX timestamp) | + | updated_at | Date (UNIX timestamp) | + | _default_title_ | String | + | _default_description_ | String | + | category | String | + | ticket_type_id | String | + | contact_ids | String | + | teammate_ids | String | + | admin_assignee_id | String | + | team_assignee_id | String | + | open | Boolean | + | state | String | + | snoozed_until | Date (UNIX timestamp) | + | ticket_attribute.{id} | String or Boolean or Date (UNIX timestamp) or Float or Integer | + + ### Accepted Operators + + {% admonition type="info" name="Searching based on `created_at`" %} + You may use the `<=` or `>=` operators to search by `created_at`. + {% /admonition %} + + The table below shows the operators you can use to define how you want to search for the value. The operator should be put in as a string (`"="`). The operator has to be compatible with the field's type (eg. you cannot search with `>` for a given string value as it's only compatible for integer's and dates). + + | Operator | Valid Types | Description | + | :------- | :----------------------------- | :----------------------------------------------------------- | + | = | All | Equals | + | != | All | Doesn't Equal | + | IN | All | In Shortcut for `OR` queries Values most be in Array | + | NIN | All | Not In Shortcut for `OR !` queries Values must be in Array | + | > | Integer Date (UNIX Timestamp) | Greater (or equal) than | + | < | Integer Date (UNIX Timestamp) | Lower (or equal) than | + | ~ | String | Contains | + | !~ | String | Doesn't Contain | + | ^ | String | Starts With | + | $ | String | Ends With | + + Parameters + ---------- + query : SearchRequestQuery + + pagination : typing.Optional[StartingAfterPaging] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TicketList + successful + + Examples + -------- + from intercom import Intercom + from intercom.unstable import ( + MultipleFilterSearchRequest, + SingleFilterSearchRequest, + StartingAfterPaging, + ) + + client = Intercom( + token="YOUR_TOKEN", + ) + client.unstable.tickets.search_tickets( + query=MultipleFilterSearchRequest( + operator="AND", + value=[ + SingleFilterSearchRequest( + field="created_at", + operator=">", + value="1306054154", + ) + ], + ), + pagination=StartingAfterPaging( + per_page=5, + ), + ) + """ + _response = self._raw_client.search_tickets(query=query, pagination=pagination, request_options=request_options) + return _response.data + + +class AsyncTicketsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTicketsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawTicketsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTicketsClient + """ + return self._raw_client + + async def reply_ticket( + self, id: str, *, request: ReplyTicketRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> TicketReply: + """ + You can reply to a ticket with a message from an admin or on behalf of a contact, or with a note for admins. + + Parameters + ---------- + id : str + + request : ReplyTicketRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TicketReply + Admin Reply to send Quick Reply Options + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + from intercom.unstable import ContactReplyTicketIntercomUserIdRequest + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.tickets.reply_ticket( + id="123", + request=ContactReplyTicketIntercomUserIdRequest( + body="Thanks again :)", + intercom_user_id="6762f2971bb69f9f2193bc49", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.reply_ticket(id, request=request, request_options=request_options) + return _response.data + + async def enqueue_create_ticket( + self, + *, + ticket_type_id: str, + contacts: typing.Sequence[CreateTicketRequestContactsItem], + skip_notifications: typing.Optional[bool] = OMIT, + conversation_to_link_id: typing.Optional[str] = OMIT, + company_id: typing.Optional[str] = OMIT, + created_at: typing.Optional[int] = OMIT, + assignment: typing.Optional[CreateTicketRequestAssignment] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Jobs: + """ + Enqueues ticket creation for asynchronous processing, returning if the job was enqueued successfully to be processed. We attempt to perform a best-effort validation on inputs before tasks are enqueued. If the given parameters are incorrect, we won't enqueue the job. + + Parameters + ---------- + ticket_type_id : str + The ID of the type of ticket you want to create + + contacts : typing.Sequence[CreateTicketRequestContactsItem] + The list of contacts (users or leads) affected by this ticket. Currently only one is allowed + + skip_notifications : typing.Optional[bool] + Option to disable notifications when a Ticket is created. + + conversation_to_link_id : typing.Optional[str] + The ID of the conversation you want to link to the ticket. Here are the valid ways of linking two tickets: + - conversation | back-office ticket + - customer tickets | non-shared back-office ticket + - conversation | tracker ticket + - customer ticket | tracker ticket + + company_id : typing.Optional[str] + The ID of the company that the ticket is associated with. The unique identifier for the company which is given by Intercom + + created_at : typing.Optional[int] + The time the ticket was created. If not provided, the current time will be used. + + assignment : typing.Optional[CreateTicketRequestAssignment] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Jobs + Successful response + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + from intercom.unstable import CreateTicketRequestContactsItemId + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.tickets.enqueue_create_ticket( + ticket_type_id="1234", + contacts=[ + CreateTicketRequestContactsItemId( + id="6762f2d81bb69f9f2193bc54", + ) + ], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.enqueue_create_ticket( + ticket_type_id=ticket_type_id, + contacts=contacts, + skip_notifications=skip_notifications, + conversation_to_link_id=conversation_to_link_id, + company_id=company_id, + created_at=created_at, + assignment=assignment, + request_options=request_options, + ) + return _response.data + + async def get_ticket( + self, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Optional[Ticket]: + """ + You can fetch the details of a single ticket. + + Parameters + ---------- + id : str + The unique identifier for the ticket which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[Ticket] + Ticket found + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.tickets.get_ticket( + id="id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_ticket(id, request_options=request_options) + return _response.data + + async def update_ticket( + self, + id: str, + *, + ticket_attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + ticket_state_id: typing.Optional[str] = OMIT, + company_id: typing.Optional[str] = OMIT, + open: typing.Optional[bool] = OMIT, + is_shared: typing.Optional[bool] = OMIT, + snoozed_until: typing.Optional[int] = OMIT, + admin_id: typing.Optional[int] = OMIT, + assignee_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Optional[Ticket]: + """ + You can update a ticket. + + Parameters + ---------- + id : str + The unique identifier for the ticket which is given by Intercom + + ticket_attributes : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The attributes set on the ticket. + + ticket_state_id : typing.Optional[str] + The ID of the ticket state associated with the ticket type. + + company_id : typing.Optional[str] + The ID of the company that the ticket is associated with. The unique identifier for the company which is given by Intercom. Set to nil to remove company. + + open : typing.Optional[bool] + Specify if a ticket is open. Set to false to close a ticket. Closing a ticket will also unsnooze it. + + is_shared : typing.Optional[bool] + Specify whether the ticket is visible to users. + + snoozed_until : typing.Optional[int] + The time you want the ticket to reopen. + + admin_id : typing.Optional[int] + The ID of the admin performing ticket update. Needed for workflows execution and attributing actions to specific admins. + + assignee_id : typing.Optional[str] + The ID of the admin or team to which the ticket is assigned. Set this 0 to unassign it. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[Ticket] + Successful response + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.tickets.update_ticket( + id="id", + ticket_attributes={ + "_default_title_": "example", + "_default_description_": "there is a problem", + }, + ticket_state_id="123", + open=True, + snoozed_until=1673609604, + admin_id=991268011, + assignee_id="123", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update_ticket( + id, + ticket_attributes=ticket_attributes, + ticket_state_id=ticket_state_id, + company_id=company_id, + open=open, + is_shared=is_shared, + snoozed_until=snoozed_until, + admin_id=admin_id, + assignee_id=assignee_id, + request_options=request_options, + ) + return _response.data + + async def delete_ticket( + self, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteTicketResponse: + """ + You can delete a ticket using the Intercom provided ID. + + Parameters + ---------- + id : str + The unique identifier for the ticket which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteTicketResponse + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.tickets.delete_ticket( + id="id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete_ticket(id, request_options=request_options) + return _response.data + + async def search_tickets( + self, + *, + query: SearchRequestQuery, + pagination: typing.Optional[StartingAfterPaging] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> TicketList: + """ + You can search for multiple tickets by the value of their attributes in order to fetch exactly which ones you want. + + To search for tickets, you send a `POST` request to `https://api.intercom.io/tickets/search`. + + This will accept a query object in the body which will define your filters. + {% admonition type="warning" name="Optimizing search queries" %} + Search queries can be complex, so optimizing them can help the performance of your search. + Use the `AND` and `OR` operators to combine multiple filters to get the exact results you need and utilize + pagination to limit the number of results returned. The default is `20` results per page. + See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#example-search-conversations-request) for more details on how to use the `starting_after` param. + {% /admonition %} + + ### Nesting & Limitations + + You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). + There are some limitations to the amount of multiples there can be: + - There's a limit of max 2 nested filters + - There's a limit of max 15 filters for each AND or OR group + + ### Accepted Fields + + Most keys listed as part of the Ticket model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as `created_at` accepts a date, the `value` cannot be a string such as `"foobar"`). + The `source.body` field is unique as the search will not be performed against the entire value, but instead against every element of the value separately. For example, when searching for a conversation with a `"I need support"` body - the query should contain a `=` operator with the value `"support"` for such conversation to be returned. A query with a `=` operator and a `"need support"` value will not yield a result. + + | Field | Type | + | :---------------------------------------- | :--------------------------------------------------------------------------------------- | + | id | String | + | created_at | Date (UNIX timestamp) | + | updated_at | Date (UNIX timestamp) | + | _default_title_ | String | + | _default_description_ | String | + | category | String | + | ticket_type_id | String | + | contact_ids | String | + | teammate_ids | String | + | admin_assignee_id | String | + | team_assignee_id | String | + | open | Boolean | + | state | String | + | snoozed_until | Date (UNIX timestamp) | + | ticket_attribute.{id} | String or Boolean or Date (UNIX timestamp) or Float or Integer | + + ### Accepted Operators + + {% admonition type="info" name="Searching based on `created_at`" %} + You may use the `<=` or `>=` operators to search by `created_at`. + {% /admonition %} + + The table below shows the operators you can use to define how you want to search for the value. The operator should be put in as a string (`"="`). The operator has to be compatible with the field's type (eg. you cannot search with `>` for a given string value as it's only compatible for integer's and dates). + + | Operator | Valid Types | Description | + | :------- | :----------------------------- | :----------------------------------------------------------- | + | = | All | Equals | + | != | All | Doesn't Equal | + | IN | All | In Shortcut for `OR` queries Values most be in Array | + | NIN | All | Not In Shortcut for `OR !` queries Values must be in Array | + | > | Integer Date (UNIX Timestamp) | Greater (or equal) than | + | < | Integer Date (UNIX Timestamp) | Lower (or equal) than | + | ~ | String | Contains | + | !~ | String | Doesn't Contain | + | ^ | String | Starts With | + | $ | String | Ends With | + + Parameters + ---------- + query : SearchRequestQuery + + pagination : typing.Optional[StartingAfterPaging] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TicketList + successful + + Examples + -------- + import asyncio + + from intercom import AsyncIntercom + from intercom.unstable import ( + MultipleFilterSearchRequest, + SingleFilterSearchRequest, + StartingAfterPaging, + ) + + client = AsyncIntercom( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.unstable.tickets.search_tickets( + query=MultipleFilterSearchRequest( + operator="AND", + value=[ + SingleFilterSearchRequest( + field="created_at", + operator=">", + value="1306054154", + ) + ], + ), + pagination=StartingAfterPaging( + per_page=5, + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.search_tickets( + query=query, pagination=pagination, request_options=request_options + ) + return _response.data diff --git a/src/intercom/unstable/tickets/raw_client.py b/src/intercom/unstable/tickets/raw_client.py new file mode 100644 index 0000000..a8cc8ef --- /dev/null +++ b/src/intercom/unstable/tickets/raw_client.py @@ -0,0 +1,1121 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ..errors.bad_request_error import BadRequestError +from ..errors.not_found_error import NotFoundError +from ..errors.unauthorized_error import UnauthorizedError +from ..jobs.types.jobs import Jobs +from ..types.create_ticket_request_assignment import CreateTicketRequestAssignment +from ..types.create_ticket_request_contacts_item import CreateTicketRequestContactsItem +from ..types.error import Error +from ..types.search_request_query import SearchRequestQuery +from ..types.starting_after_paging import StartingAfterPaging +from ..types.ticket_list import TicketList +from ..types.ticket_reply import TicketReply +from .types.delete_ticket_response import DeleteTicketResponse +from .types.reply_ticket_request_body import ReplyTicketRequestBody +from .types.ticket import Ticket + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawTicketsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def reply_ticket( + self, id: str, *, request: ReplyTicketRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[TicketReply]: + """ + You can reply to a ticket with a message from an admin or on behalf of a contact, or with a note for admins. + + Parameters + ---------- + id : str + + request : ReplyTicketRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TicketReply] + Admin Reply to send Quick Reply Options + """ + _response = self._client_wrapper.httpx_client.request( + f"tickets/{jsonable_encoder(id)}/reply", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=ReplyTicketRequestBody, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TicketReply, + construct_type( + type_=TicketReply, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def enqueue_create_ticket( + self, + *, + ticket_type_id: str, + contacts: typing.Sequence[CreateTicketRequestContactsItem], + skip_notifications: typing.Optional[bool] = OMIT, + conversation_to_link_id: typing.Optional[str] = OMIT, + company_id: typing.Optional[str] = OMIT, + created_at: typing.Optional[int] = OMIT, + assignment: typing.Optional[CreateTicketRequestAssignment] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[Jobs]: + """ + Enqueues ticket creation for asynchronous processing, returning if the job was enqueued successfully to be processed. We attempt to perform a best-effort validation on inputs before tasks are enqueued. If the given parameters are incorrect, we won't enqueue the job. + + Parameters + ---------- + ticket_type_id : str + The ID of the type of ticket you want to create + + contacts : typing.Sequence[CreateTicketRequestContactsItem] + The list of contacts (users or leads) affected by this ticket. Currently only one is allowed + + skip_notifications : typing.Optional[bool] + Option to disable notifications when a Ticket is created. + + conversation_to_link_id : typing.Optional[str] + The ID of the conversation you want to link to the ticket. Here are the valid ways of linking two tickets: + - conversation | back-office ticket + - customer tickets | non-shared back-office ticket + - conversation | tracker ticket + - customer ticket | tracker ticket + + company_id : typing.Optional[str] + The ID of the company that the ticket is associated with. The unique identifier for the company which is given by Intercom + + created_at : typing.Optional[int] + The time the ticket was created. If not provided, the current time will be used. + + assignment : typing.Optional[CreateTicketRequestAssignment] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Jobs] + Successful response + """ + _response = self._client_wrapper.httpx_client.request( + "tickets/enqueue", + method="POST", + json={ + "skip_notifications": skip_notifications, + "ticket_type_id": ticket_type_id, + "contacts": convert_and_respect_annotation_metadata( + object_=contacts, annotation=typing.Sequence[CreateTicketRequestContactsItem], direction="write" + ), + "conversation_to_link_id": conversation_to_link_id, + "company_id": company_id, + "created_at": created_at, + "assignment": convert_and_respect_annotation_metadata( + object_=assignment, annotation=CreateTicketRequestAssignment, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Jobs, + construct_type( + type_=Jobs, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get_ticket( + self, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[typing.Optional[Ticket]]: + """ + You can fetch the details of a single ticket. + + Parameters + ---------- + id : str + The unique identifier for the ticket which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Optional[Ticket]] + Ticket found + """ + _response = self._client_wrapper.httpx_client.request( + f"tickets/{jsonable_encoder(id)}", + method="GET", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Optional[Ticket], + construct_type( + type_=typing.Optional[Ticket], # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update_ticket( + self, + id: str, + *, + ticket_attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + ticket_state_id: typing.Optional[str] = OMIT, + company_id: typing.Optional[str] = OMIT, + open: typing.Optional[bool] = OMIT, + is_shared: typing.Optional[bool] = OMIT, + snoozed_until: typing.Optional[int] = OMIT, + admin_id: typing.Optional[int] = OMIT, + assignee_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.Optional[Ticket]]: + """ + You can update a ticket. + + Parameters + ---------- + id : str + The unique identifier for the ticket which is given by Intercom + + ticket_attributes : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The attributes set on the ticket. + + ticket_state_id : typing.Optional[str] + The ID of the ticket state associated with the ticket type. + + company_id : typing.Optional[str] + The ID of the company that the ticket is associated with. The unique identifier for the company which is given by Intercom. Set to nil to remove company. + + open : typing.Optional[bool] + Specify if a ticket is open. Set to false to close a ticket. Closing a ticket will also unsnooze it. + + is_shared : typing.Optional[bool] + Specify whether the ticket is visible to users. + + snoozed_until : typing.Optional[int] + The time you want the ticket to reopen. + + admin_id : typing.Optional[int] + The ID of the admin performing ticket update. Needed for workflows execution and attributing actions to specific admins. + + assignee_id : typing.Optional[str] + The ID of the admin or team to which the ticket is assigned. Set this 0 to unassign it. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Optional[Ticket]] + Successful response + """ + _response = self._client_wrapper.httpx_client.request( + f"tickets/{jsonable_encoder(id)}", + method="PUT", + json={ + "ticket_attributes": ticket_attributes, + "ticket_state_id": ticket_state_id, + "company_id": company_id, + "open": open, + "is_shared": is_shared, + "snoozed_until": snoozed_until, + "admin_id": admin_id, + "assignee_id": assignee_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Optional[Ticket], + construct_type( + type_=typing.Optional[Ticket], # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete_ticket( + self, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DeleteTicketResponse]: + """ + You can delete a ticket using the Intercom provided ID. + + Parameters + ---------- + id : str + The unique identifier for the ticket which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DeleteTicketResponse] + successful + """ + _response = self._client_wrapper.httpx_client.request( + f"tickets/{jsonable_encoder(id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteTicketResponse, + construct_type( + type_=DeleteTicketResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def search_tickets( + self, + *, + query: SearchRequestQuery, + pagination: typing.Optional[StartingAfterPaging] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[TicketList]: + """ + You can search for multiple tickets by the value of their attributes in order to fetch exactly which ones you want. + + To search for tickets, you send a `POST` request to `https://api.intercom.io/tickets/search`. + + This will accept a query object in the body which will define your filters. + {% admonition type="warning" name="Optimizing search queries" %} + Search queries can be complex, so optimizing them can help the performance of your search. + Use the `AND` and `OR` operators to combine multiple filters to get the exact results you need and utilize + pagination to limit the number of results returned. The default is `20` results per page. + See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#example-search-conversations-request) for more details on how to use the `starting_after` param. + {% /admonition %} + + ### Nesting & Limitations + + You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). + There are some limitations to the amount of multiples there can be: + - There's a limit of max 2 nested filters + - There's a limit of max 15 filters for each AND or OR group + + ### Accepted Fields + + Most keys listed as part of the Ticket model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as `created_at` accepts a date, the `value` cannot be a string such as `"foobar"`). + The `source.body` field is unique as the search will not be performed against the entire value, but instead against every element of the value separately. For example, when searching for a conversation with a `"I need support"` body - the query should contain a `=` operator with the value `"support"` for such conversation to be returned. A query with a `=` operator and a `"need support"` value will not yield a result. + + | Field | Type | + | :---------------------------------------- | :--------------------------------------------------------------------------------------- | + | id | String | + | created_at | Date (UNIX timestamp) | + | updated_at | Date (UNIX timestamp) | + | _default_title_ | String | + | _default_description_ | String | + | category | String | + | ticket_type_id | String | + | contact_ids | String | + | teammate_ids | String | + | admin_assignee_id | String | + | team_assignee_id | String | + | open | Boolean | + | state | String | + | snoozed_until | Date (UNIX timestamp) | + | ticket_attribute.{id} | String or Boolean or Date (UNIX timestamp) or Float or Integer | + + ### Accepted Operators + + {% admonition type="info" name="Searching based on `created_at`" %} + You may use the `<=` or `>=` operators to search by `created_at`. + {% /admonition %} + + The table below shows the operators you can use to define how you want to search for the value. The operator should be put in as a string (`"="`). The operator has to be compatible with the field's type (eg. you cannot search with `>` for a given string value as it's only compatible for integer's and dates). + + | Operator | Valid Types | Description | + | :------- | :----------------------------- | :----------------------------------------------------------- | + | = | All | Equals | + | != | All | Doesn't Equal | + | IN | All | In Shortcut for `OR` queries Values most be in Array | + | NIN | All | Not In Shortcut for `OR !` queries Values must be in Array | + | > | Integer Date (UNIX Timestamp) | Greater (or equal) than | + | < | Integer Date (UNIX Timestamp) | Lower (or equal) than | + | ~ | String | Contains | + | !~ | String | Doesn't Contain | + | ^ | String | Starts With | + | $ | String | Ends With | + + Parameters + ---------- + query : SearchRequestQuery + + pagination : typing.Optional[StartingAfterPaging] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TicketList] + successful + """ + _response = self._client_wrapper.httpx_client.request( + "tickets/search", + method="POST", + json={ + "query": convert_and_respect_annotation_metadata( + object_=query, annotation=SearchRequestQuery, direction="write" + ), + "pagination": convert_and_respect_annotation_metadata( + object_=pagination, annotation=StartingAfterPaging, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TicketList, + construct_type( + type_=TicketList, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawTicketsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def reply_ticket( + self, id: str, *, request: ReplyTicketRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[TicketReply]: + """ + You can reply to a ticket with a message from an admin or on behalf of a contact, or with a note for admins. + + Parameters + ---------- + id : str + + request : ReplyTicketRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TicketReply] + Admin Reply to send Quick Reply Options + """ + _response = await self._client_wrapper.httpx_client.request( + f"tickets/{jsonable_encoder(id)}/reply", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=ReplyTicketRequestBody, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TicketReply, + construct_type( + type_=TicketReply, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def enqueue_create_ticket( + self, + *, + ticket_type_id: str, + contacts: typing.Sequence[CreateTicketRequestContactsItem], + skip_notifications: typing.Optional[bool] = OMIT, + conversation_to_link_id: typing.Optional[str] = OMIT, + company_id: typing.Optional[str] = OMIT, + created_at: typing.Optional[int] = OMIT, + assignment: typing.Optional[CreateTicketRequestAssignment] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[Jobs]: + """ + Enqueues ticket creation for asynchronous processing, returning if the job was enqueued successfully to be processed. We attempt to perform a best-effort validation on inputs before tasks are enqueued. If the given parameters are incorrect, we won't enqueue the job. + + Parameters + ---------- + ticket_type_id : str + The ID of the type of ticket you want to create + + contacts : typing.Sequence[CreateTicketRequestContactsItem] + The list of contacts (users or leads) affected by this ticket. Currently only one is allowed + + skip_notifications : typing.Optional[bool] + Option to disable notifications when a Ticket is created. + + conversation_to_link_id : typing.Optional[str] + The ID of the conversation you want to link to the ticket. Here are the valid ways of linking two tickets: + - conversation | back-office ticket + - customer tickets | non-shared back-office ticket + - conversation | tracker ticket + - customer ticket | tracker ticket + + company_id : typing.Optional[str] + The ID of the company that the ticket is associated with. The unique identifier for the company which is given by Intercom + + created_at : typing.Optional[int] + The time the ticket was created. If not provided, the current time will be used. + + assignment : typing.Optional[CreateTicketRequestAssignment] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Jobs] + Successful response + """ + _response = await self._client_wrapper.httpx_client.request( + "tickets/enqueue", + method="POST", + json={ + "skip_notifications": skip_notifications, + "ticket_type_id": ticket_type_id, + "contacts": convert_and_respect_annotation_metadata( + object_=contacts, annotation=typing.Sequence[CreateTicketRequestContactsItem], direction="write" + ), + "conversation_to_link_id": conversation_to_link_id, + "company_id": company_id, + "created_at": created_at, + "assignment": convert_and_respect_annotation_metadata( + object_=assignment, annotation=CreateTicketRequestAssignment, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Jobs, + construct_type( + type_=Jobs, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get_ticket( + self, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[typing.Optional[Ticket]]: + """ + You can fetch the details of a single ticket. + + Parameters + ---------- + id : str + The unique identifier for the ticket which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Optional[Ticket]] + Ticket found + """ + _response = await self._client_wrapper.httpx_client.request( + f"tickets/{jsonable_encoder(id)}", + method="GET", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Optional[Ticket], + construct_type( + type_=typing.Optional[Ticket], # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update_ticket( + self, + id: str, + *, + ticket_attributes: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, + ticket_state_id: typing.Optional[str] = OMIT, + company_id: typing.Optional[str] = OMIT, + open: typing.Optional[bool] = OMIT, + is_shared: typing.Optional[bool] = OMIT, + snoozed_until: typing.Optional[int] = OMIT, + admin_id: typing.Optional[int] = OMIT, + assignee_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.Optional[Ticket]]: + """ + You can update a ticket. + + Parameters + ---------- + id : str + The unique identifier for the ticket which is given by Intercom + + ticket_attributes : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] + The attributes set on the ticket. + + ticket_state_id : typing.Optional[str] + The ID of the ticket state associated with the ticket type. + + company_id : typing.Optional[str] + The ID of the company that the ticket is associated with. The unique identifier for the company which is given by Intercom. Set to nil to remove company. + + open : typing.Optional[bool] + Specify if a ticket is open. Set to false to close a ticket. Closing a ticket will also unsnooze it. + + is_shared : typing.Optional[bool] + Specify whether the ticket is visible to users. + + snoozed_until : typing.Optional[int] + The time you want the ticket to reopen. + + admin_id : typing.Optional[int] + The ID of the admin performing ticket update. Needed for workflows execution and attributing actions to specific admins. + + assignee_id : typing.Optional[str] + The ID of the admin or team to which the ticket is assigned. Set this 0 to unassign it. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Optional[Ticket]] + Successful response + """ + _response = await self._client_wrapper.httpx_client.request( + f"tickets/{jsonable_encoder(id)}", + method="PUT", + json={ + "ticket_attributes": ticket_attributes, + "ticket_state_id": ticket_state_id, + "company_id": company_id, + "open": open, + "is_shared": is_shared, + "snoozed_until": snoozed_until, + "admin_id": admin_id, + "assignee_id": assignee_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Optional[Ticket], + construct_type( + type_=typing.Optional[Ticket], # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete_ticket( + self, id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DeleteTicketResponse]: + """ + You can delete a ticket using the Intercom provided ID. + + Parameters + ---------- + id : str + The unique identifier for the ticket which is given by Intercom. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DeleteTicketResponse] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + f"tickets/{jsonable_encoder(id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteTicketResponse, + construct_type( + type_=DeleteTicketResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + Error, + construct_type( + type_=Error, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Optional[typing.Any], + construct_type( + type_=typing.Optional[typing.Any], # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def search_tickets( + self, + *, + query: SearchRequestQuery, + pagination: typing.Optional[StartingAfterPaging] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[TicketList]: + """ + You can search for multiple tickets by the value of their attributes in order to fetch exactly which ones you want. + + To search for tickets, you send a `POST` request to `https://api.intercom.io/tickets/search`. + + This will accept a query object in the body which will define your filters. + {% admonition type="warning" name="Optimizing search queries" %} + Search queries can be complex, so optimizing them can help the performance of your search. + Use the `AND` and `OR` operators to combine multiple filters to get the exact results you need and utilize + pagination to limit the number of results returned. The default is `20` results per page. + See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#example-search-conversations-request) for more details on how to use the `starting_after` param. + {% /admonition %} + + ### Nesting & Limitations + + You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). + There are some limitations to the amount of multiples there can be: + - There's a limit of max 2 nested filters + - There's a limit of max 15 filters for each AND or OR group + + ### Accepted Fields + + Most keys listed as part of the Ticket model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as `created_at` accepts a date, the `value` cannot be a string such as `"foobar"`). + The `source.body` field is unique as the search will not be performed against the entire value, but instead against every element of the value separately. For example, when searching for a conversation with a `"I need support"` body - the query should contain a `=` operator with the value `"support"` for such conversation to be returned. A query with a `=` operator and a `"need support"` value will not yield a result. + + | Field | Type | + | :---------------------------------------- | :--------------------------------------------------------------------------------------- | + | id | String | + | created_at | Date (UNIX timestamp) | + | updated_at | Date (UNIX timestamp) | + | _default_title_ | String | + | _default_description_ | String | + | category | String | + | ticket_type_id | String | + | contact_ids | String | + | teammate_ids | String | + | admin_assignee_id | String | + | team_assignee_id | String | + | open | Boolean | + | state | String | + | snoozed_until | Date (UNIX timestamp) | + | ticket_attribute.{id} | String or Boolean or Date (UNIX timestamp) or Float or Integer | + + ### Accepted Operators + + {% admonition type="info" name="Searching based on `created_at`" %} + You may use the `<=` or `>=` operators to search by `created_at`. + {% /admonition %} + + The table below shows the operators you can use to define how you want to search for the value. The operator should be put in as a string (`"="`). The operator has to be compatible with the field's type (eg. you cannot search with `>` for a given string value as it's only compatible for integer's and dates). + + | Operator | Valid Types | Description | + | :------- | :----------------------------- | :----------------------------------------------------------- | + | = | All | Equals | + | != | All | Doesn't Equal | + | IN | All | In Shortcut for `OR` queries Values most be in Array | + | NIN | All | Not In Shortcut for `OR !` queries Values must be in Array | + | > | Integer Date (UNIX Timestamp) | Greater (or equal) than | + | < | Integer Date (UNIX Timestamp) | Lower (or equal) than | + | ~ | String | Contains | + | !~ | String | Doesn't Contain | + | ^ | String | Starts With | + | $ | String | Ends With | + + Parameters + ---------- + query : SearchRequestQuery + + pagination : typing.Optional[StartingAfterPaging] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TicketList] + successful + """ + _response = await self._client_wrapper.httpx_client.request( + "tickets/search", + method="POST", + json={ + "query": convert_and_respect_annotation_metadata( + object_=query, annotation=SearchRequestQuery, direction="write" + ), + "pagination": convert_and_respect_annotation_metadata( + object_=pagination, annotation=StartingAfterPaging, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TicketList, + construct_type( + type_=TicketList, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/src/intercom/unstable/tickets/types/__init__.py b/src/intercom/unstable/tickets/types/__init__.py new file mode 100644 index 0000000..e4b0d09 --- /dev/null +++ b/src/intercom/unstable/tickets/types/__init__.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .delete_ticket_response import DeleteTicketResponse +from .reply_ticket_request_body import ReplyTicketRequestBody +from .ticket import Ticket +from .ticket_category import TicketCategory +from .ticket_contacts import TicketContacts +from .ticket_part import TicketPart +from .ticket_part_previous_ticket_state import TicketPartPreviousTicketState +from .ticket_part_ticket_state import TicketPartTicketState +from .ticket_part_updated_attribute_data import TicketPartUpdatedAttributeData +from .ticket_part_updated_attribute_data_attribute import TicketPartUpdatedAttributeDataAttribute +from .ticket_part_updated_attribute_data_value import TicketPartUpdatedAttributeDataValue +from .ticket_part_updated_attribute_data_value_id import TicketPartUpdatedAttributeDataValueId +from .ticket_part_updated_attribute_data_value_label import TicketPartUpdatedAttributeDataValueLabel +from .ticket_state import TicketState +from .ticket_state_category import TicketStateCategory +from .ticket_state_detailed import TicketStateDetailed +from .ticket_state_detailed_category import TicketStateDetailedCategory +from .ticket_state_detailed_ticket_types import TicketStateDetailedTicketTypes +from .ticket_type import TicketType +from .ticket_type_category import TicketTypeCategory +from .ticket_type_ticket_states import TicketTypeTicketStates + +__all__ = [ + "DeleteTicketResponse", + "ReplyTicketRequestBody", + "Ticket", + "TicketCategory", + "TicketContacts", + "TicketPart", + "TicketPartPreviousTicketState", + "TicketPartTicketState", + "TicketPartUpdatedAttributeData", + "TicketPartUpdatedAttributeDataAttribute", + "TicketPartUpdatedAttributeDataValue", + "TicketPartUpdatedAttributeDataValueId", + "TicketPartUpdatedAttributeDataValueLabel", + "TicketState", + "TicketStateCategory", + "TicketStateDetailed", + "TicketStateDetailedCategory", + "TicketStateDetailedTicketTypes", + "TicketType", + "TicketTypeCategory", + "TicketTypeTicketStates", +] diff --git a/src/intercom/unstable/tickets/types/delete_ticket_response.py b/src/intercom/unstable/tickets/types/delete_ticket_response.py new file mode 100644 index 0000000..4c439b3 --- /dev/null +++ b/src/intercom/unstable/tickets/types/delete_ticket_response.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel + + +class DeleteTicketResponse(UncheckedBaseModel): + """ + Response when a ticket is deleted. + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The unique identifier for the ticket. + """ + + object: typing.Optional[typing.Literal["ticket"]] = pydantic.Field(default=None) + """ + always ticket + """ + + deleted: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the ticket is deleted or not. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/tickets/types/reply_ticket_request_body.py b/src/intercom/unstable/tickets/types/reply_ticket_request_body.py new file mode 100644 index 0000000..2c3fcad --- /dev/null +++ b/src/intercom/unstable/tickets/types/reply_ticket_request_body.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.admin_reply_ticket_request import AdminReplyTicketRequest +from ...types.contact_reply_ticket_request import ContactReplyTicketRequest + +ReplyTicketRequestBody = typing.Union[ContactReplyTicketRequest, AdminReplyTicketRequest] diff --git a/src/intercom/unstable/tickets/types/ticket.py b/src/intercom/unstable/tickets/types/ticket.py new file mode 100644 index 0000000..bcf4b62 --- /dev/null +++ b/src/intercom/unstable/tickets/types/ticket.py @@ -0,0 +1,90 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from ...types.linked_object_list import LinkedObjectList +from ...types.ticket_custom_attributes import TicketCustomAttributes +from ...types.ticket_parts import TicketParts +from .ticket_category import TicketCategory +from .ticket_contacts import TicketContacts +from .ticket_state import TicketState +from .ticket_type import TicketType + + +class Ticket(UncheckedBaseModel): + """ + Tickets are how you track requests from your users. + """ + + type: typing.Optional[typing.Literal["ticket"]] = pydantic.Field(default=None) + """ + Always ticket + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The unique identifier for the ticket which is given by Intercom. + """ + + ticket_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the Ticket used in the Intercom Inbox and Messenger. Do not use ticket_id for API queries. + """ + + category: typing.Optional[TicketCategory] = pydantic.Field(default=None) + """ + Category of the Ticket. + """ + + ticket_attributes: typing.Optional[TicketCustomAttributes] = None + ticket_state: typing.Optional[TicketState] = None + ticket_type: typing.Optional[TicketType] = None + contacts: typing.Optional[TicketContacts] = None + admin_assignee_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id representing the admin assigned to the ticket. + """ + + team_assignee_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id representing the team assigned to the ticket. + """ + + created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time the ticket was created as a UTC Unix timestamp. + """ + + updated_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The last time the ticket was updated as a UTC Unix timestamp. + """ + + open: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether or not the ticket is open. If false, the ticket is closed. + """ + + snoozed_until: typing.Optional[int] = pydantic.Field(default=None) + """ + The time the ticket will be snoozed until as a UTC Unix timestamp. If null, the ticket is not currently snoozed. + """ + + linked_objects: typing.Optional[LinkedObjectList] = None + ticket_parts: typing.Optional[TicketParts] = None + is_shared: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether or not the ticket is shared with the customer. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/tickets/types/ticket_category.py b/src/intercom/unstable/tickets/types/ticket_category.py new file mode 100644 index 0000000..0bfaf71 --- /dev/null +++ b/src/intercom/unstable/tickets/types/ticket_category.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TicketCategory = typing.Union[typing.Literal["Customer", "Back-office", "Tracker"], typing.Any] diff --git a/src/intercom/unstable/tickets/types/ticket_contacts.py b/src/intercom/unstable/tickets/types/ticket_contacts.py new file mode 100644 index 0000000..8146c4b --- /dev/null +++ b/src/intercom/unstable/tickets/types/ticket_contacts.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from ...types.contact_reference import ContactReference + + +class TicketContacts(UncheckedBaseModel): + """ + The list of contacts affected by a ticket. + """ + + type: typing.Optional[typing.Literal["contact.list"]] = pydantic.Field(default=None) + """ + always contact.list + """ + + contacts: typing.Optional[typing.List[ContactReference]] = pydantic.Field(default=None) + """ + The list of contacts affected by this ticket. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/tickets/types/ticket_part.py b/src/intercom/unstable/tickets/types/ticket_part.py new file mode 100644 index 0000000..b7106de --- /dev/null +++ b/src/intercom/unstable/tickets/types/ticket_part.py @@ -0,0 +1,99 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from ...types.part_attachment import PartAttachment +from ...types.reference import Reference +from ...types.ticket_part_author import TicketPartAuthor +from .ticket_part_previous_ticket_state import TicketPartPreviousTicketState +from .ticket_part_ticket_state import TicketPartTicketState +from .ticket_part_updated_attribute_data import TicketPartUpdatedAttributeData + + +class TicketPart(UncheckedBaseModel): + """ + A Ticket Part represents a message in the ticket. + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + Always ticket_part + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id representing the ticket part. + """ + + part_type: typing.Optional[str] = pydantic.Field(default=None) + """ + The type of ticket part. + """ + + body: typing.Optional[str] = pydantic.Field(default=None) + """ + The message body, which may contain HTML. + """ + + previous_ticket_state: typing.Optional[TicketPartPreviousTicketState] = pydantic.Field(default=None) + """ + The previous state of the ticket. + """ + + ticket_state: typing.Optional[TicketPartTicketState] = pydantic.Field(default=None) + """ + The state of the ticket. + """ + + created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time the ticket part was created. + """ + + updated_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The last time the ticket part was updated. + """ + + assigned_to: typing.Optional[Reference] = pydantic.Field(default=None) + """ + The id of the admin that was assigned the ticket by this ticket_part (null if there has been no change in assignment.) + """ + + author: typing.Optional[TicketPartAuthor] = None + attachments: typing.Optional[typing.List[PartAttachment]] = pydantic.Field(default=None) + """ + A list of attachments for the part. + """ + + external_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The external id of the ticket part + """ + + redacted: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether or not the ticket part has been redacted. + """ + + app_package_code: typing.Optional[str] = pydantic.Field(default=None) + """ + The app package code if this part was created via API. Note this field won't show if the part was not created via API. + """ + + updated_attribute_data: typing.Optional[TicketPartUpdatedAttributeData] = pydantic.Field(default=None) + """ + The updated attribute data of the ticket part. Only present for attribute update parts. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/tickets/types/ticket_part_previous_ticket_state.py b/src/intercom/unstable/tickets/types/ticket_part_previous_ticket_state.py new file mode 100644 index 0000000..650c92d --- /dev/null +++ b/src/intercom/unstable/tickets/types/ticket_part_previous_ticket_state.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TicketPartPreviousTicketState = typing.Union[ + typing.Literal["submitted", "in_progress", "waiting_on_customer", "resolved"], typing.Any +] diff --git a/src/intercom/unstable/tickets/types/ticket_part_ticket_state.py b/src/intercom/unstable/tickets/types/ticket_part_ticket_state.py new file mode 100644 index 0000000..c430063 --- /dev/null +++ b/src/intercom/unstable/tickets/types/ticket_part_ticket_state.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TicketPartTicketState = typing.Union[ + typing.Literal["submitted", "in_progress", "waiting_on_customer", "resolved"], typing.Any +] diff --git a/src/intercom/unstable/tickets/types/ticket_part_updated_attribute_data.py b/src/intercom/unstable/tickets/types/ticket_part_updated_attribute_data.py new file mode 100644 index 0000000..3d1b710 --- /dev/null +++ b/src/intercom/unstable/tickets/types/ticket_part_updated_attribute_data.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from .ticket_part_updated_attribute_data_attribute import TicketPartUpdatedAttributeDataAttribute +from .ticket_part_updated_attribute_data_value import TicketPartUpdatedAttributeDataValue + + +class TicketPartUpdatedAttributeData(UncheckedBaseModel): + """ + The updated attribute data of the ticket part. Only present for attribute update parts. + """ + + attribute: TicketPartUpdatedAttributeDataAttribute = pydantic.Field() + """ + Information about the attribute that was updated. + """ + + value: TicketPartUpdatedAttributeDataValue = pydantic.Field() + """ + The new value of the attribute. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/tickets/types/ticket_part_updated_attribute_data_attribute.py b/src/intercom/unstable/tickets/types/ticket_part_updated_attribute_data_attribute.py new file mode 100644 index 0000000..2825ec6 --- /dev/null +++ b/src/intercom/unstable/tickets/types/ticket_part_updated_attribute_data_attribute.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel + + +class TicketPartUpdatedAttributeDataAttribute(UncheckedBaseModel): + """ + Information about the attribute that was updated. + """ + + type: typing.Literal["attribute"] = pydantic.Field(default="attribute") + """ + The type of the object. Always 'attribute'. + """ + + id: str = pydantic.Field() + """ + The unique identifier of the attribute. + """ + + label: str = pydantic.Field() + """ + The human-readable name of the attribute. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/tickets/types/ticket_part_updated_attribute_data_value.py b/src/intercom/unstable/tickets/types/ticket_part_updated_attribute_data_value.py new file mode 100644 index 0000000..d0c6f09 --- /dev/null +++ b/src/intercom/unstable/tickets/types/ticket_part_updated_attribute_data_value.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from .ticket_part_updated_attribute_data_value_id import TicketPartUpdatedAttributeDataValueId +from .ticket_part_updated_attribute_data_value_label import TicketPartUpdatedAttributeDataValueLabel + + +class TicketPartUpdatedAttributeDataValue(UncheckedBaseModel): + """ + The new value of the attribute. + """ + + type: typing.Literal["value"] = pydantic.Field(default="value") + """ + The type of the object. Always 'value'. + """ + + id: TicketPartUpdatedAttributeDataValueId + label: TicketPartUpdatedAttributeDataValueLabel + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/tickets/types/ticket_part_updated_attribute_data_value_id.py b/src/intercom/unstable/tickets/types/ticket_part_updated_attribute_data_value_id.py new file mode 100644 index 0000000..01d2f9d --- /dev/null +++ b/src/intercom/unstable/tickets/types/ticket_part_updated_attribute_data_value_id.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TicketPartUpdatedAttributeDataValueId = typing.Union[typing.Optional[str], typing.List[int]] diff --git a/src/intercom/unstable/tickets/types/ticket_part_updated_attribute_data_value_label.py b/src/intercom/unstable/tickets/types/ticket_part_updated_attribute_data_value_label.py new file mode 100644 index 0000000..4026e8a --- /dev/null +++ b/src/intercom/unstable/tickets/types/ticket_part_updated_attribute_data_value_label.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TicketPartUpdatedAttributeDataValueLabel = typing.Union[str, typing.List[str]] diff --git a/src/intercom/unstable/tickets/types/ticket_state.py b/src/intercom/unstable/tickets/types/ticket_state.py new file mode 100644 index 0000000..6782355 --- /dev/null +++ b/src/intercom/unstable/tickets/types/ticket_state.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from .ticket_state_category import TicketStateCategory + + +class TicketState(UncheckedBaseModel): + """ + A ticket state, used to define the state of a ticket. + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + String representing the object's type. Always has the value `ticket_state`. + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id of the ticket state + """ + + category: typing.Optional[TicketStateCategory] = pydantic.Field(default=None) + """ + The category of the ticket state + """ + + internal_label: typing.Optional[str] = pydantic.Field(default=None) + """ + The state the ticket is currently in, in a human readable form - visible in Intercom + """ + + external_label: typing.Optional[str] = pydantic.Field(default=None) + """ + The state the ticket is currently in, in a human readable form - visible to customers, in the messenger, email and tickets portal. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/tickets/types/ticket_state_category.py b/src/intercom/unstable/tickets/types/ticket_state_category.py new file mode 100644 index 0000000..d53c56a --- /dev/null +++ b/src/intercom/unstable/tickets/types/ticket_state_category.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TicketStateCategory = typing.Union[ + typing.Literal["submitted", "in_progress", "waiting_on_customer", "resolved"], typing.Any +] diff --git a/src/intercom/unstable/tickets/types/ticket_state_detailed.py b/src/intercom/unstable/tickets/types/ticket_state_detailed.py new file mode 100644 index 0000000..c596d92 --- /dev/null +++ b/src/intercom/unstable/tickets/types/ticket_state_detailed.py @@ -0,0 +1,59 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from .ticket_state_detailed_category import TicketStateDetailedCategory +from .ticket_state_detailed_ticket_types import TicketStateDetailedTicketTypes + + +class TicketStateDetailed(UncheckedBaseModel): + """ + A ticket state, used to define the state of a ticket. + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + String representing the object's type. Always has the value `ticket_state`. + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id of the ticket state + """ + + category: typing.Optional[TicketStateDetailedCategory] = pydantic.Field(default=None) + """ + The category of the ticket state + """ + + internal_label: typing.Optional[str] = pydantic.Field(default=None) + """ + The state the ticket is currently in, in a human readable form - visible in Intercom + """ + + external_label: typing.Optional[str] = pydantic.Field(default=None) + """ + The state the ticket is currently in, in a human readable form - visible to customers, in the messenger, email and tickets portal. + """ + + archived: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the ticket state is archived + """ + + ticket_types: typing.Optional[TicketStateDetailedTicketTypes] = pydantic.Field(default=None) + """ + A list of ticket types associated with a given ticket state. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/tickets/types/ticket_state_detailed_category.py b/src/intercom/unstable/tickets/types/ticket_state_detailed_category.py new file mode 100644 index 0000000..d8426ec --- /dev/null +++ b/src/intercom/unstable/tickets/types/ticket_state_detailed_category.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TicketStateDetailedCategory = typing.Union[ + typing.Literal["submitted", "in_progress", "waiting_on_customer", "resolved"], typing.Any +] diff --git a/src/intercom/unstable/tickets/types/ticket_state_detailed_ticket_types.py b/src/intercom/unstable/tickets/types/ticket_state_detailed_ticket_types.py new file mode 100644 index 0000000..9e018f7 --- /dev/null +++ b/src/intercom/unstable/tickets/types/ticket_state_detailed_ticket_types.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from .ticket_type import TicketType + + +class TicketStateDetailedTicketTypes(UncheckedBaseModel): + """ + A list of ticket types associated with a given ticket state. + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + String representing the object's type. Always has the value `list`. + """ + + data: typing.Optional[typing.List[typing.Optional[TicketType]]] = pydantic.Field(default=None) + """ + A list of ticket type attributes associated with a given ticket type. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/tickets/types/ticket_type.py b/src/intercom/unstable/tickets/types/ticket_type.py new file mode 100644 index 0000000..c75332b --- /dev/null +++ b/src/intercom/unstable/tickets/types/ticket_type.py @@ -0,0 +1,81 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from ...types.ticket_type_attribute_list import TicketTypeAttributeList +from .ticket_type_category import TicketTypeCategory +from .ticket_type_ticket_states import TicketTypeTicketStates + + +class TicketType(UncheckedBaseModel): + """ + A ticket type, used to define the data fields to be captured in a ticket. + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + String representing the object's type. Always has the value `ticket_type`. + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id representing the ticket type. + """ + + category: typing.Optional[TicketTypeCategory] = pydantic.Field(default=None) + """ + Category of the Ticket Type. + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the ticket type + """ + + description: typing.Optional[str] = pydantic.Field(default=None) + """ + The description of the ticket type + """ + + icon: typing.Optional[str] = pydantic.Field(default=None) + """ + The icon of the ticket type + """ + + workspace_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id of the workspace that the ticket type belongs to. + """ + + ticket_type_attributes: typing.Optional[TicketTypeAttributeList] = None + ticket_states: typing.Optional[TicketTypeTicketStates] = pydantic.Field(default=None) + """ + A list of ticket states associated with a given ticket type. + """ + + archived: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the ticket type is archived or not. + """ + + created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The date and time the ticket type was created. + """ + + updated_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The date and time the ticket type was last updated. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/tickets/types/ticket_type_category.py b/src/intercom/unstable/tickets/types/ticket_type_category.py new file mode 100644 index 0000000..afbe5d6 --- /dev/null +++ b/src/intercom/unstable/tickets/types/ticket_type_category.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TicketTypeCategory = typing.Union[typing.Literal["Customer", "Back-office", "Tracker"], typing.Any] diff --git a/src/intercom/unstable/tickets/types/ticket_type_ticket_states.py b/src/intercom/unstable/tickets/types/ticket_type_ticket_states.py new file mode 100644 index 0000000..d4d22c9 --- /dev/null +++ b/src/intercom/unstable/tickets/types/ticket_type_ticket_states.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel +from .ticket_state import TicketState + + +class TicketTypeTicketStates(UncheckedBaseModel): + """ + A list of ticket states associated with a given ticket type. + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + String representing the object's type. Always has the value `list`. + """ + + data: typing.Optional[typing.List[typing.Optional[TicketState]]] = pydantic.Field(default=None) + """ + A list of ticket states associated with a given ticket type. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/__init__.py b/src/intercom/unstable/types/__init__.py new file mode 100644 index 0000000..c9883d2 --- /dev/null +++ b/src/intercom/unstable/types/__init__.py @@ -0,0 +1,445 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +from .activity_log import ActivityLog +from .activity_log_activity_type import ActivityLogActivityType +from .activity_log_list import ActivityLogList +from .activity_log_metadata import ActivityLogMetadata +from .activity_log_performed_by import ActivityLogPerformedBy +from .addressable_list import AddressableList +from .admin_list import AdminList +from .admin_priority_level import AdminPriorityLevel +from .admin_reply_conversation_request import AdminReplyConversationRequest +from .admin_reply_conversation_request_message_type import AdminReplyConversationRequestMessageType +from .admin_reply_ticket_request import AdminReplyTicketRequest +from .admin_reply_ticket_request_message_type import AdminReplyTicketRequestMessageType +from .admin_reply_ticket_request_reply_options_item import AdminReplyTicketRequestReplyOptionsItem +from .admin_with_app import AdminWithApp +from .admin_with_app_avatar import AdminWithAppAvatar +from .app import App +from .article_content import ArticleContent +from .article_content_state import ArticleContentState +from .article_list import ArticleList +from .article_statistics import ArticleStatistics +from .article_translated_content import ArticleTranslatedContent +from .assign_conversation_request import AssignConversationRequest +from .assign_conversation_request_type import AssignConversationRequestType +from .away_status_reason import AwayStatusReason +from .close_conversation_request import CloseConversationRequest +from .collection_list import CollectionList +from .company_attached_contacts import CompanyAttachedContacts +from .company_attached_segments import CompanyAttachedSegments +from .company_data import CompanyData +from .company_list import CompanyList +from .company_scroll import CompanyScroll +from .contact_archived import ContactArchived +from .contact_attached_companies import ContactAttachedCompanies +from .contact_blocked import ContactBlocked +from .contact_companies import ContactCompanies +from .contact_deleted import ContactDeleted +from .contact_list import ContactList +from .contact_location import ContactLocation +from .contact_notes import ContactNotes +from .contact_reference import ContactReference +from .contact_reply_base_request import ContactReplyBaseRequest +from .contact_reply_base_request_reply_options_item import ContactReplyBaseRequestReplyOptionsItem +from .contact_reply_conversation_request import ContactReplyConversationRequest +from .contact_reply_email_request import ContactReplyEmailRequest +from .contact_reply_intercom_user_id_request import ContactReplyIntercomUserIdRequest +from .contact_reply_ticket_email_request import ContactReplyTicketEmailRequest +from .contact_reply_ticket_intercom_user_id_request import ContactReplyTicketIntercomUserIdRequest +from .contact_reply_ticket_request import ContactReplyTicketRequest +from .contact_reply_ticket_user_id_request import ContactReplyTicketUserIdRequest +from .contact_reply_user_id_request import ContactReplyUserIdRequest +from .contact_segments import ContactSegments +from .contact_social_profiles import ContactSocialProfiles +from .contact_subscription_types import ContactSubscriptionTypes +from .contact_tags import ContactTags +from .contact_unarchived import ContactUnarchived +from .content_sources_list import ContentSourcesList +from .conversation_attachment_files import ConversationAttachmentFiles +from .conversation_attribute_updated_by_admin import ConversationAttributeUpdatedByAdmin +from .conversation_attribute_updated_by_admin_attribute import ConversationAttributeUpdatedByAdminAttribute +from .conversation_attribute_updated_by_admin_value import ConversationAttributeUpdatedByAdminValue +from .conversation_attribute_updated_by_workflow import ConversationAttributeUpdatedByWorkflow +from .conversation_attribute_updated_by_workflow_attribute import ConversationAttributeUpdatedByWorkflowAttribute +from .conversation_attribute_updated_by_workflow_value import ConversationAttributeUpdatedByWorkflowValue +from .conversation_attribute_updated_by_workflow_workflow import ConversationAttributeUpdatedByWorkflowWorkflow +from .conversation_contacts import ConversationContacts +from .conversation_deleted import ConversationDeleted +from .conversation_first_contact_reply import ConversationFirstContactReply +from .conversation_list import ConversationList +from .conversation_part import ConversationPart +from .conversation_part_author import ConversationPartAuthor +from .conversation_part_metadata import ConversationPartMetadata +from .conversation_part_metadata_quick_reply_options_item import ConversationPartMetadataQuickReplyOptionsItem +from .conversation_part_state import ConversationPartState +from .conversation_parts import ConversationParts +from .conversation_rating import ConversationRating +from .conversation_response_time import ConversationResponseTime +from .conversation_source import ConversationSource +from .conversation_source_type import ConversationSourceType +from .conversation_statistics import ConversationStatistics +from .conversation_teammates import ConversationTeammates +from .create_or_update_tag_request import CreateOrUpdateTagRequest +from .create_ticket_reply_with_comment_request import CreateTicketReplyWithCommentRequest +from .create_ticket_request_assignment import CreateTicketRequestAssignment +from .create_ticket_request_body import CreateTicketRequestBody +from .create_ticket_request_contacts_item import CreateTicketRequestContactsItem +from .create_ticket_request_contacts_item_email import CreateTicketRequestContactsItemEmail +from .create_ticket_request_contacts_item_external_id import CreateTicketRequestContactsItemExternalId +from .create_ticket_request_contacts_item_id import CreateTicketRequestContactsItemId +from .cursor_pages import CursorPages +from .custom_action_finished import CustomActionFinished +from .custom_action_finished_action import CustomActionFinishedAction +from .custom_action_finished_action_result import CustomActionFinishedActionResult +from .custom_action_started import CustomActionStarted +from .custom_action_started_action import CustomActionStartedAction +from .custom_attributes import CustomAttributes +from .custom_attributes_value import CustomAttributesValue +from .custom_channel_attribute import CustomChannelAttribute +from .custom_channel_base_event import CustomChannelBaseEvent +from .custom_channel_contact import CustomChannelContact +from .custom_channel_contact_type import CustomChannelContactType +from .custom_channel_notification_response import CustomChannelNotificationResponse +from .custom_object_instance_deleted import CustomObjectInstanceDeleted +from .custom_object_instance_list import CustomObjectInstanceList +from .customer_request import CustomerRequest +from .customer_request_email import CustomerRequestEmail +from .customer_request_intercom_user_id import CustomerRequestIntercomUserId +from .customer_request_user_id import CustomerRequestUserId +from .data_attribute_list import DataAttributeList +from .data_event_list import DataEventList +from .data_event_list_pages import DataEventListPages +from .data_event_summary import DataEventSummary +from .data_event_summary_item import DataEventSummaryItem +from .data_export_csv import DataExportCsv +from .datetime import Datetime +from .deleted_article_object import DeletedArticleObject +from .deleted_collection_object import DeletedCollectionObject +from .deleted_company_object import DeletedCompanyObject +from .deleted_object import DeletedObject +from .email_address_header import EmailAddressHeader +from .email_message_metadata import EmailMessageMetadata +from .error import Error +from .error_errors_item import ErrorErrorsItem +from .event_details import EventDetails +from .file_attribute import FileAttribute +from .group_content import GroupContent +from .group_translated_content import GroupTranslatedContent +from .intercom_version import IntercomVersion +from .intercom_version_unstable import IntercomVersionUnstable +from .linked_object import LinkedObject +from .linked_object_list import LinkedObjectList +from .linked_object_type import LinkedObjectType +from .multiple_filter_search_request import MultipleFilterSearchRequest +from .multiple_filter_search_request_operator import MultipleFilterSearchRequestOperator +from .multiple_filter_search_request_value import MultipleFilterSearchRequestValue +from .news_item_request import NewsItemRequest +from .news_item_request_state import NewsItemRequestState +from .not_found_error_body import NotFoundErrorBody +from .not_found_error_body_errors_item import NotFoundErrorBodyErrorsItem +from .note_list import NoteList +from .open_conversation_request import OpenConversationRequest +from .operator_workflow_event import OperatorWorkflowEvent +from .operator_workflow_event_event import OperatorWorkflowEventEvent +from .operator_workflow_event_workflow import OperatorWorkflowEventWorkflow +from .pages_link import PagesLink +from .paginated_response import PaginatedResponse +from .paginated_response_data_item import ( + PaginatedResponseDataItem, + PaginatedResponseDataItem_NewsItem, + PaginatedResponseDataItem_Newsfeed, +) +from .paginated_response_type import PaginatedResponseType +from .part_attachment import PartAttachment +from .phone_switch import PhoneSwitch +from .quick_reply_option import QuickReplyOption +from .recipient import Recipient +from .recipient_type import RecipientType +from .redact_conversation_request import ( + RedactConversationRequest, + RedactConversationRequest_ConversationPart, + RedactConversationRequest_Source, +) +from .redact_conversation_request_conversation_part import RedactConversationRequestConversationPart +from .redact_conversation_request_source import RedactConversationRequestSource +from .reference import Reference +from .reply_conversation_request_body import ReplyConversationRequestBody +from .search_request import SearchRequest +from .search_request_query import SearchRequestQuery +from .segment_list import SegmentList +from .single_filter_search_request import SingleFilterSearchRequest +from .single_filter_search_request_operator import SingleFilterSearchRequestOperator +from .single_filter_search_request_value import SingleFilterSearchRequestValue +from .single_filter_search_request_value_item import SingleFilterSearchRequestValueItem +from .sla_applied import SlaApplied +from .sla_applied_sla_status import SlaAppliedSlaStatus +from .snooze_conversation_request import SnoozeConversationRequest +from .social_profile import SocialProfile +from .starting_after_paging import StartingAfterPaging +from .subscription_type_list import SubscriptionTypeList +from .tag_company_request import TagCompanyRequest +from .tag_company_request_companies_item import TagCompanyRequestCompaniesItem +from .tag_list import TagList +from .tag_multiple_users_request import TagMultipleUsersRequest +from .tag_multiple_users_request_users_item import TagMultipleUsersRequestUsersItem +from .tags import Tags +from .team_list import TeamList +from .team_priority_level import TeamPriorityLevel +from .ticket_custom_attributes import TicketCustomAttributes +from .ticket_custom_attributes_value import TicketCustomAttributesValue +from .ticket_list import TicketList +from .ticket_part_author import TicketPartAuthor +from .ticket_part_author_type import TicketPartAuthorType +from .ticket_parts import TicketParts +from .ticket_reply import TicketReply +from .ticket_reply_part_type import TicketReplyPartType +from .ticket_request_custom_attributes import TicketRequestCustomAttributes +from .ticket_request_custom_attributes_value import TicketRequestCustomAttributesValue +from .ticket_state_list import TicketStateList +from .ticket_type_attribute import TicketTypeAttribute +from .ticket_type_attribute_list import TicketTypeAttributeList +from .ticket_type_list import TicketTypeList +from .translation import Translation +from .untag_company_request import UntagCompanyRequest +from .untag_company_request_companies_item import UntagCompanyRequestCompaniesItem +from .update_article_request_body import UpdateArticleRequestBody +from .update_article_request_state import UpdateArticleRequestState +from .update_ticket_type_request_body import UpdateTicketTypeRequestBody +from .update_ticket_type_request_category import UpdateTicketTypeRequestCategory +from .visitor import Visitor +from .visitor_avatar import VisitorAvatar +from .visitor_companies import VisitorCompanies +from .visitor_deleted_object import VisitorDeletedObject +from .visitor_location_data import VisitorLocationData +from .visitor_segments import VisitorSegments +from .visitor_social_profiles import VisitorSocialProfiles +from .visitor_tags import VisitorTags +from .visitor_tags_tags_item import VisitorTagsTagsItem +from .whatsapp_message_status_list import WhatsappMessageStatusList +from .whatsapp_message_status_list_events_item import WhatsappMessageStatusListEventsItem +from .whatsapp_message_status_list_events_item_status import WhatsappMessageStatusListEventsItemStatus +from .whatsapp_message_status_list_pages import WhatsappMessageStatusListPages +from .whatsapp_message_status_list_pages_next import WhatsappMessageStatusListPagesNext + +__all__ = [ + "ActivityLog", + "ActivityLogActivityType", + "ActivityLogList", + "ActivityLogMetadata", + "ActivityLogPerformedBy", + "AddressableList", + "AdminList", + "AdminPriorityLevel", + "AdminReplyConversationRequest", + "AdminReplyConversationRequestMessageType", + "AdminReplyTicketRequest", + "AdminReplyTicketRequestMessageType", + "AdminReplyTicketRequestReplyOptionsItem", + "AdminWithApp", + "AdminWithAppAvatar", + "App", + "ArticleContent", + "ArticleContentState", + "ArticleList", + "ArticleStatistics", + "ArticleTranslatedContent", + "AssignConversationRequest", + "AssignConversationRequestType", + "AwayStatusReason", + "CloseConversationRequest", + "CollectionList", + "CompanyAttachedContacts", + "CompanyAttachedSegments", + "CompanyData", + "CompanyList", + "CompanyScroll", + "ContactArchived", + "ContactAttachedCompanies", + "ContactBlocked", + "ContactCompanies", + "ContactDeleted", + "ContactList", + "ContactLocation", + "ContactNotes", + "ContactReference", + "ContactReplyBaseRequest", + "ContactReplyBaseRequestReplyOptionsItem", + "ContactReplyConversationRequest", + "ContactReplyEmailRequest", + "ContactReplyIntercomUserIdRequest", + "ContactReplyTicketEmailRequest", + "ContactReplyTicketIntercomUserIdRequest", + "ContactReplyTicketRequest", + "ContactReplyTicketUserIdRequest", + "ContactReplyUserIdRequest", + "ContactSegments", + "ContactSocialProfiles", + "ContactSubscriptionTypes", + "ContactTags", + "ContactUnarchived", + "ContentSourcesList", + "ConversationAttachmentFiles", + "ConversationAttributeUpdatedByAdmin", + "ConversationAttributeUpdatedByAdminAttribute", + "ConversationAttributeUpdatedByAdminValue", + "ConversationAttributeUpdatedByWorkflow", + "ConversationAttributeUpdatedByWorkflowAttribute", + "ConversationAttributeUpdatedByWorkflowValue", + "ConversationAttributeUpdatedByWorkflowWorkflow", + "ConversationContacts", + "ConversationDeleted", + "ConversationFirstContactReply", + "ConversationList", + "ConversationPart", + "ConversationPartAuthor", + "ConversationPartMetadata", + "ConversationPartMetadataQuickReplyOptionsItem", + "ConversationPartState", + "ConversationParts", + "ConversationRating", + "ConversationResponseTime", + "ConversationSource", + "ConversationSourceType", + "ConversationStatistics", + "ConversationTeammates", + "CreateOrUpdateTagRequest", + "CreateTicketReplyWithCommentRequest", + "CreateTicketRequestAssignment", + "CreateTicketRequestBody", + "CreateTicketRequestContactsItem", + "CreateTicketRequestContactsItemEmail", + "CreateTicketRequestContactsItemExternalId", + "CreateTicketRequestContactsItemId", + "CursorPages", + "CustomActionFinished", + "CustomActionFinishedAction", + "CustomActionFinishedActionResult", + "CustomActionStarted", + "CustomActionStartedAction", + "CustomAttributes", + "CustomAttributesValue", + "CustomChannelAttribute", + "CustomChannelBaseEvent", + "CustomChannelContact", + "CustomChannelContactType", + "CustomChannelNotificationResponse", + "CustomObjectInstanceDeleted", + "CustomObjectInstanceList", + "CustomerRequest", + "CustomerRequestEmail", + "CustomerRequestIntercomUserId", + "CustomerRequestUserId", + "DataAttributeList", + "DataEventList", + "DataEventListPages", + "DataEventSummary", + "DataEventSummaryItem", + "DataExportCsv", + "Datetime", + "DeletedArticleObject", + "DeletedCollectionObject", + "DeletedCompanyObject", + "DeletedObject", + "EmailAddressHeader", + "EmailMessageMetadata", + "Error", + "ErrorErrorsItem", + "EventDetails", + "FileAttribute", + "GroupContent", + "GroupTranslatedContent", + "IntercomVersion", + "IntercomVersionUnstable", + "LinkedObject", + "LinkedObjectList", + "LinkedObjectType", + "MultipleFilterSearchRequest", + "MultipleFilterSearchRequestOperator", + "MultipleFilterSearchRequestValue", + "NewsItemRequest", + "NewsItemRequestState", + "NotFoundErrorBody", + "NotFoundErrorBodyErrorsItem", + "NoteList", + "OpenConversationRequest", + "OperatorWorkflowEvent", + "OperatorWorkflowEventEvent", + "OperatorWorkflowEventWorkflow", + "PagesLink", + "PaginatedResponse", + "PaginatedResponseDataItem", + "PaginatedResponseDataItem_NewsItem", + "PaginatedResponseDataItem_Newsfeed", + "PaginatedResponseType", + "PartAttachment", + "PhoneSwitch", + "QuickReplyOption", + "Recipient", + "RecipientType", + "RedactConversationRequest", + "RedactConversationRequestConversationPart", + "RedactConversationRequestSource", + "RedactConversationRequest_ConversationPart", + "RedactConversationRequest_Source", + "Reference", + "ReplyConversationRequestBody", + "SearchRequest", + "SearchRequestQuery", + "SegmentList", + "SingleFilterSearchRequest", + "SingleFilterSearchRequestOperator", + "SingleFilterSearchRequestValue", + "SingleFilterSearchRequestValueItem", + "SlaApplied", + "SlaAppliedSlaStatus", + "SnoozeConversationRequest", + "SocialProfile", + "StartingAfterPaging", + "SubscriptionTypeList", + "TagCompanyRequest", + "TagCompanyRequestCompaniesItem", + "TagList", + "TagMultipleUsersRequest", + "TagMultipleUsersRequestUsersItem", + "Tags", + "TeamList", + "TeamPriorityLevel", + "TicketCustomAttributes", + "TicketCustomAttributesValue", + "TicketList", + "TicketPartAuthor", + "TicketPartAuthorType", + "TicketParts", + "TicketReply", + "TicketReplyPartType", + "TicketRequestCustomAttributes", + "TicketRequestCustomAttributesValue", + "TicketStateList", + "TicketTypeAttribute", + "TicketTypeAttributeList", + "TicketTypeList", + "Translation", + "UntagCompanyRequest", + "UntagCompanyRequestCompaniesItem", + "UpdateArticleRequestBody", + "UpdateArticleRequestState", + "UpdateTicketTypeRequestBody", + "UpdateTicketTypeRequestCategory", + "Visitor", + "VisitorAvatar", + "VisitorCompanies", + "VisitorDeletedObject", + "VisitorLocationData", + "VisitorSegments", + "VisitorSocialProfiles", + "VisitorTags", + "VisitorTagsTagsItem", + "WhatsappMessageStatusList", + "WhatsappMessageStatusListEventsItem", + "WhatsappMessageStatusListEventsItemStatus", + "WhatsappMessageStatusListPages", + "WhatsappMessageStatusListPagesNext", +] diff --git a/src/intercom/unstable/types/activity_log.py b/src/intercom/unstable/types/activity_log.py new file mode 100644 index 0000000..50acb70 --- /dev/null +++ b/src/intercom/unstable/types/activity_log.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from .activity_log_activity_type import ActivityLogActivityType +from .activity_log_metadata import ActivityLogMetadata +from .activity_log_performed_by import ActivityLogPerformedBy + + +class ActivityLog(UncheckedBaseModel): + """ + Activities performed by Admins. + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id representing the activity. + """ + + performed_by: typing.Optional[ActivityLogPerformedBy] = pydantic.Field(default=None) + """ + Details about the Admin involved in the activity. + """ + + metadata: typing.Optional[ActivityLogMetadata] = None + created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time the activity was created. + """ + + activity_type: typing.Optional[ActivityLogActivityType] = None + activity_description: typing.Optional[str] = pydantic.Field(default=None) + """ + A sentence or two describing the activity. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/activity_log_activity_type.py b/src/intercom/unstable/types/activity_log_activity_type.py new file mode 100644 index 0000000..48d6405 --- /dev/null +++ b/src/intercom/unstable/types/activity_log_activity_type.py @@ -0,0 +1,76 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ActivityLogActivityType = typing.Union[ + typing.Literal[ + "admin_assignment_limit_change", + "admin_away_mode_change", + "admin_deletion", + "admin_deprovisioned", + "admin_impersonation_end", + "admin_impersonation_start", + "admin_invite_change", + "admin_invite_creation", + "admin_invite_deletion", + "admin_login_failure", + "admin_login_success", + "admin_logout", + "admin_password_reset_request", + "admin_password_reset_success", + "admin_permission_change", + "admin_provisioned", + "admin_two_factor_auth_change", + "admin_unauthorized_sign_in_method", + "app_admin_join", + "app_authentication_method_change", + "app_data_deletion", + "app_data_export", + "app_google_sso_domain_change", + "app_identity_verification_change", + "app_name_change", + "app_outbound_address_change", + "app_package_installation", + "app_package_token_regeneration", + "app_package_uninstallation", + "app_team_creation", + "app_team_deletion", + "app_team_membership_modification", + "app_timezone_change", + "app_webhook_creation", + "app_webhook_deletion", + "articles_in_messenger_enabled_change", + "bulk_delete", + "bulk_export", + "campaign_deletion", + "campaign_state_change", + "conversation_part_deletion", + "conversation_topic_change", + "conversation_topic_creation", + "conversation_topic_deletion", + "help_center_settings_change", + "inbound_conversations_change", + "inbox_access_change", + "message_deletion", + "message_state_change", + "messenger_look_and_feel_change", + "messenger_search_required_change", + "messenger_spaces_change", + "office_hours_change", + "role_change", + "role_creation", + "role_deletion", + "ruleset_activation_title_preview", + "ruleset_creation", + "ruleset_deletion", + "search_browse_enabled_change", + "search_browse_required_change", + "seat_change", + "seat_revoke", + "security_settings_change", + "temporary_expectation_change", + "upfront_email_collection_change", + "welcome_message_change", + ], + typing.Any, +] diff --git a/src/intercom/unstable/types/activity_log_list.py b/src/intercom/unstable/types/activity_log_list.py new file mode 100644 index 0000000..80b585d --- /dev/null +++ b/src/intercom/unstable/types/activity_log_list.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from .activity_log import ActivityLog +from .cursor_pages import CursorPages + + +class ActivityLogList(UncheckedBaseModel): + """ + A paginated list of activity logs. + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + String representing the object's type. Always has the value `activity_log.list`. + """ + + pages: typing.Optional[CursorPages] = None + activity_logs: typing.Optional[typing.List[typing.Optional[ActivityLog]]] = pydantic.Field(default=None) + """ + An array of activity logs + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/activity_log_metadata.py b/src/intercom/unstable/types/activity_log_metadata.py new file mode 100644 index 0000000..dd417f6 --- /dev/null +++ b/src/intercom/unstable/types/activity_log_metadata.py @@ -0,0 +1,67 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel + + +class ActivityLogMetadata(UncheckedBaseModel): + """ + Additional data provided about Admin activity. + """ + + sign_in_method: typing.Optional[str] = pydantic.Field(default=None) + """ + The way the admin signed in. + """ + + external_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The unique identifier for the contact which is provided by the Client. + """ + + away_mode: typing.Optional[bool] = pydantic.Field(default=None) + """ + The away mode status which is set to true when away and false when returned. + """ + + away_status_reason: typing.Optional[str] = pydantic.Field(default=None) + """ + The reason the Admin is away. + """ + + reassign_conversations: typing.Optional[bool] = pydantic.Field(default=None) + """ + Indicates if conversations should be reassigned while an Admin is away. + """ + + source: typing.Optional[str] = pydantic.Field(default=None) + """ + The action that initiated the status change. + """ + + auto_changed: typing.Optional[str] = pydantic.Field(default=None) + """ + Indicates if the status was changed automatically or manually. + """ + + update_by: typing.Optional[int] = pydantic.Field(default=None) + """ + The ID of the Admin who initiated the activity. + """ + + update_by_name: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the Admin who initiated the activity. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/activity_log_performed_by.py b/src/intercom/unstable/types/activity_log_performed_by.py new file mode 100644 index 0000000..03f51fb --- /dev/null +++ b/src/intercom/unstable/types/activity_log_performed_by.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel + + +class ActivityLogPerformedBy(UncheckedBaseModel): + """ + Details about the Admin involved in the activity. + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + String representing the object's type. Always has the value `admin`. + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id representing the admin. + """ + + email: typing.Optional[str] = pydantic.Field(default=None) + """ + The email of the admin. + """ + + ip: typing.Optional[str] = pydantic.Field(default=None) + """ + The IP address of the admin. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/addressable_list.py b/src/intercom/unstable/types/addressable_list.py new file mode 100644 index 0000000..09bb518 --- /dev/null +++ b/src/intercom/unstable/types/addressable_list.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel + + +class AddressableList(UncheckedBaseModel): + """ + A list used to access other resources from a parent model. + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + The addressable object type + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id of the addressable object + """ + + url: typing.Optional[str] = pydantic.Field(default=None) + """ + Url to get more company resources for this contact + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/admin_list.py b/src/intercom/unstable/types/admin_list.py new file mode 100644 index 0000000..02b12cf --- /dev/null +++ b/src/intercom/unstable/types/admin_list.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from ..admins.types.admin import Admin + + +class AdminList(UncheckedBaseModel): + """ + A list of admins associated with a given workspace. + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + String representing the object's type. Always has the value `admin.list`. + """ + + admins: typing.Optional[typing.List[typing.Optional[Admin]]] = pydantic.Field(default=None) + """ + A list of admins associated with a given workspace. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/admin_priority_level.py b/src/intercom/unstable/types/admin_priority_level.py new file mode 100644 index 0000000..1b4d2e2 --- /dev/null +++ b/src/intercom/unstable/types/admin_priority_level.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel + + +class AdminPriorityLevel(UncheckedBaseModel): + """ + Admin priority levels for the team + """ + + primary_admin_ids: typing.Optional[typing.List[int]] = pydantic.Field(default=None) + """ + The primary admin ids for the team + """ + + secondary_admin_ids: typing.Optional[typing.List[int]] = pydantic.Field(default=None) + """ + The secondary admin ids for the team + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/admin_reply_conversation_request.py b/src/intercom/unstable/types/admin_reply_conversation_request.py new file mode 100644 index 0000000..445e6f5 --- /dev/null +++ b/src/intercom/unstable/types/admin_reply_conversation_request.py @@ -0,0 +1,57 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from .admin_reply_conversation_request_message_type import AdminReplyConversationRequestMessageType +from .conversation_attachment_files import ConversationAttachmentFiles +from .quick_reply_option import QuickReplyOption + + +class AdminReplyConversationRequest(UncheckedBaseModel): + """ + Payload of the request to reply on behalf of an admin + """ + + message_type: AdminReplyConversationRequestMessageType + type: typing.Literal["admin"] = "admin" + body: typing.Optional[str] = pydantic.Field(default=None) + """ + The text body of the reply. Notes accept some HTML formatting. Must be present for comment and note message types. + """ + + admin_id: str = pydantic.Field() + """ + The id of the admin who is authoring the comment. + """ + + created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time the reply was created. If not provided, the current time will be used. + """ + + reply_options: typing.Optional[typing.List[QuickReplyOption]] = pydantic.Field(default=None) + """ + The quick reply options to display to the end user. Must be present for quick_reply message types. + """ + + attachment_urls: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of image URLs that will be added as attachments. You can include up to 10 URLs. + """ + + attachment_files: typing.Optional[typing.List[ConversationAttachmentFiles]] = pydantic.Field(default=None) + """ + A list of files that will be added as attachments. You can include up to 10 files + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/admin_reply_conversation_request_message_type.py b/src/intercom/unstable/types/admin_reply_conversation_request_message_type.py new file mode 100644 index 0000000..23e821b --- /dev/null +++ b/src/intercom/unstable/types/admin_reply_conversation_request_message_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AdminReplyConversationRequestMessageType = typing.Union[typing.Literal["comment", "note", "quick_reply"], typing.Any] diff --git a/src/intercom/unstable/types/admin_reply_ticket_request.py b/src/intercom/unstable/types/admin_reply_ticket_request.py new file mode 100644 index 0000000..2fc3af2 --- /dev/null +++ b/src/intercom/unstable/types/admin_reply_ticket_request.py @@ -0,0 +1,51 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from .admin_reply_ticket_request_message_type import AdminReplyTicketRequestMessageType +from .admin_reply_ticket_request_reply_options_item import AdminReplyTicketRequestReplyOptionsItem + + +class AdminReplyTicketRequest(UncheckedBaseModel): + """ + Payload of the request to reply on behalf of an admin + """ + + message_type: AdminReplyTicketRequestMessageType + type: typing.Literal["admin"] = "admin" + body: typing.Optional[str] = pydantic.Field(default=None) + """ + The text body of the reply. Notes accept some HTML formatting. Must be present for comment and note message types. + """ + + admin_id: str = pydantic.Field() + """ + The id of the admin who is authoring the comment. + """ + + created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time the reply was created. If not provided, the current time will be used. + """ + + reply_options: typing.Optional[typing.List[AdminReplyTicketRequestReplyOptionsItem]] = pydantic.Field(default=None) + """ + The quick reply options to display. Must be present for quick_reply message types. + """ + + attachment_urls: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of image URLs that will be added as attachments. You can include up to 10 URLs. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/admin_reply_ticket_request_message_type.py b/src/intercom/unstable/types/admin_reply_ticket_request_message_type.py new file mode 100644 index 0000000..1fdcf0c --- /dev/null +++ b/src/intercom/unstable/types/admin_reply_ticket_request_message_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AdminReplyTicketRequestMessageType = typing.Union[typing.Literal["comment", "note", "quick_reply"], typing.Any] diff --git a/src/intercom/unstable/types/admin_reply_ticket_request_reply_options_item.py b/src/intercom/unstable/types/admin_reply_ticket_request_reply_options_item.py new file mode 100644 index 0000000..edc8c5f --- /dev/null +++ b/src/intercom/unstable/types/admin_reply_ticket_request_reply_options_item.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.serialization import FieldMetadata +from ...core.unchecked_base_model import UncheckedBaseModel + + +class AdminReplyTicketRequestReplyOptionsItem(UncheckedBaseModel): + text: str = pydantic.Field() + """ + The text to display in this quick reply option. + """ + + uuid_: typing_extensions.Annotated[str, FieldMetadata(alias="uuid")] = pydantic.Field() + """ + A unique identifier for this quick reply option. This value will be available within the metadata of the comment ticket part that is created when a user clicks on this reply option. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/admin_with_app.py b/src/intercom/unstable/types/admin_with_app.py new file mode 100644 index 0000000..9af7709 --- /dev/null +++ b/src/intercom/unstable/types/admin_with_app.py @@ -0,0 +1,84 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from .admin_with_app_avatar import AdminWithAppAvatar +from .app import App + + +class AdminWithApp(UncheckedBaseModel): + """ + Admins are the teammate accounts that have access to a workspace + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + String representing the object's type. Always has the value `admin`. + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The id representing the admin. + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the admin. + """ + + email: typing.Optional[str] = pydantic.Field(default=None) + """ + The email of the admin. + """ + + job_title: typing.Optional[str] = pydantic.Field(default=None) + """ + The job title of the admin. + """ + + away_mode_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Identifies if this admin is currently set in away mode. + """ + + away_mode_reassign: typing.Optional[bool] = pydantic.Field(default=None) + """ + Identifies if this admin is set to automatically reassign new conversations to the apps default inbox. + """ + + has_inbox_seat: typing.Optional[bool] = pydantic.Field(default=None) + """ + Identifies if this admin has a paid inbox seat to restrict/allow features that require them. + """ + + team_ids: typing.Optional[typing.List[int]] = pydantic.Field(default=None) + """ + This is a list of ids of the teams that this admin is part of. + """ + + avatar: typing.Optional[AdminWithAppAvatar] = pydantic.Field(default=None) + """ + This object represents the avatar associated with the admin. + """ + + email_verified: typing.Optional[bool] = pydantic.Field(default=None) + """ + Identifies if this admin's email is verified. + """ + + app: typing.Optional[App] = pydantic.Field(default=None) + """ + App that the admin belongs to. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/admin_with_app_avatar.py b/src/intercom/unstable/types/admin_with_app_avatar.py new file mode 100644 index 0000000..78b74bf --- /dev/null +++ b/src/intercom/unstable/types/admin_with_app_avatar.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel + + +class AdminWithAppAvatar(UncheckedBaseModel): + """ + This object represents the avatar associated with the admin. + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + This is a string that identifies the type of the object. It will always have the value `avatar`. + """ + + image_url: typing.Optional[str] = pydantic.Field(default=None) + """ + This object represents the avatar associated with the admin. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/app.py b/src/intercom/unstable/types/app.py new file mode 100644 index 0000000..5357f69 --- /dev/null +++ b/src/intercom/unstable/types/app.py @@ -0,0 +1,57 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel + + +class App(UncheckedBaseModel): + """ + App is a workspace on Intercom + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + + """ + + id_code: typing.Optional[str] = pydantic.Field(default=None) + """ + The id of the app. + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the app. + """ + + region: typing.Optional[str] = pydantic.Field(default=None) + """ + The Intercom region the app is located in. + """ + + timezone: typing.Optional[str] = pydantic.Field(default=None) + """ + The timezone of the region where the app is located. + """ + + created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + When the app was created. + """ + + identity_verification: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether or not the app uses identity verification. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/article_content.py b/src/intercom/unstable/types/article_content.py new file mode 100644 index 0000000..71a579f --- /dev/null +++ b/src/intercom/unstable/types/article_content.py @@ -0,0 +1,68 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from .article_content_state import ArticleContentState + + +class ArticleContent(UncheckedBaseModel): + """ + The Content of an Article. + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + The type of object - `article_content` . + """ + + title: typing.Optional[str] = pydantic.Field(default=None) + """ + The title of the article. + """ + + description: typing.Optional[str] = pydantic.Field(default=None) + """ + The description of the article. + """ + + body: typing.Optional[str] = pydantic.Field(default=None) + """ + The body of the article. + """ + + author_id: typing.Optional[int] = pydantic.Field(default=None) + """ + The ID of the author of the article. + """ + + state: typing.Optional[ArticleContentState] = pydantic.Field(default=None) + """ + Whether the article is `published` or is a `draft` . + """ + + created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time when the article was created (seconds). + """ + + updated_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time when the article was last updated (seconds). + """ + + url: typing.Optional[str] = pydantic.Field(default=None) + """ + The URL of the article. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/article_content_state.py b/src/intercom/unstable/types/article_content_state.py new file mode 100644 index 0000000..8fbede3 --- /dev/null +++ b/src/intercom/unstable/types/article_content_state.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ArticleContentState = typing.Union[typing.Literal["published", "draft"], typing.Any] diff --git a/src/intercom/unstable/types/article_list.py b/src/intercom/unstable/types/article_list.py new file mode 100644 index 0000000..603a035 --- /dev/null +++ b/src/intercom/unstable/types/article_list.py @@ -0,0 +1,40 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from ..articles.types.article_list_item import ArticleListItem +from .cursor_pages import CursorPages + + +class ArticleList(UncheckedBaseModel): + """ + This will return a list of articles for the App. + """ + + type: typing.Optional[typing.Literal["list"]] = pydantic.Field(default=None) + """ + The type of the object - `list`. + """ + + pages: typing.Optional[CursorPages] = None + total_count: typing.Optional[int] = pydantic.Field(default=None) + """ + A count of the total number of articles. + """ + + data: typing.Optional[typing.List[ArticleListItem]] = pydantic.Field(default=None) + """ + An array of Article objects + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/article_statistics.py b/src/intercom/unstable/types/article_statistics.py new file mode 100644 index 0000000..d643c46 --- /dev/null +++ b/src/intercom/unstable/types/article_statistics.py @@ -0,0 +1,57 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel + + +class ArticleStatistics(UncheckedBaseModel): + """ + The statistics of an article. + """ + + type: typing.Optional[typing.Literal["article_statistics"]] = pydantic.Field(default=None) + """ + The type of object - `article_statistics`. + """ + + views: typing.Optional[int] = pydantic.Field(default=None) + """ + The number of total views the article has received. + """ + + conversions: typing.Optional[int] = pydantic.Field(default=None) + """ + The number of conversations started from the article. + """ + + reactions: typing.Optional[int] = pydantic.Field(default=None) + """ + The number of total reactions the article has received. + """ + + happy_reaction_percentage: typing.Optional[float] = pydantic.Field(default=None) + """ + The percentage of happy reactions the article has received against other types of reaction. + """ + + neutral_reaction_percentage: typing.Optional[float] = pydantic.Field(default=None) + """ + The percentage of neutral reactions the article has received against other types of reaction. + """ + + sad_reaction_percentage: typing.Optional[float] = pydantic.Field(default=None) + """ + The percentage of sad reactions the article has received against other types of reaction. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/article_translated_content.py b/src/intercom/unstable/types/article_translated_content.py new file mode 100644 index 0000000..45ea17c --- /dev/null +++ b/src/intercom/unstable/types/article_translated_content.py @@ -0,0 +1,221 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.serialization import FieldMetadata +from ...core.unchecked_base_model import UncheckedBaseModel +from .article_content import ArticleContent + + +class ArticleTranslatedContent(UncheckedBaseModel): + """ + The Translated Content of an Article. The keys are the locale codes and the values are the translated content of the article. + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + The type of object - article_translated_content. + """ + + ar: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Arabic + """ + + bg: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Bulgarian + """ + + bs: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Bosnian + """ + + ca: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Catalan + """ + + cs: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Czech + """ + + da: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Danish + """ + + de: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in German + """ + + el: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Greek + """ + + en: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in English + """ + + es: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Spanish + """ + + et: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Estonian + """ + + fi: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Finnish + """ + + fr: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in French + """ + + he: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Hebrew + """ + + hr: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Croatian + """ + + hu: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Hungarian + """ + + id: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Indonesian + """ + + it: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Italian + """ + + ja: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Japanese + """ + + ko: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Korean + """ + + lt: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Lithuanian + """ + + lv: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Latvian + """ + + mn: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Mongolian + """ + + nb: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Norwegian + """ + + nl: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Dutch + """ + + pl: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Polish + """ + + pt: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Portuguese (Portugal) + """ + + ro: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Romanian + """ + + ru: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Russian + """ + + sl: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Slovenian + """ + + sr: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Serbian + """ + + sv: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Swedish + """ + + tr: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Turkish + """ + + vi: typing.Optional[ArticleContent] = pydantic.Field(default=None) + """ + The content of the article in Vietnamese + """ + + pt_br: typing_extensions.Annotated[typing.Optional[ArticleContent], FieldMetadata(alias="pt-BR")] = pydantic.Field( + default=None + ) + """ + The content of the article in Portuguese (Brazil) + """ + + zh_cn: typing_extensions.Annotated[typing.Optional[ArticleContent], FieldMetadata(alias="zh-CN")] = pydantic.Field( + default=None + ) + """ + The content of the article in Chinese (China) + """ + + zh_tw: typing_extensions.Annotated[typing.Optional[ArticleContent], FieldMetadata(alias="zh-TW")] = pydantic.Field( + default=None + ) + """ + The content of the article in Chinese (Taiwan) + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/assign_conversation_request.py b/src/intercom/unstable/types/assign_conversation_request.py new file mode 100644 index 0000000..b7770bc --- /dev/null +++ b/src/intercom/unstable/types/assign_conversation_request.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from .assign_conversation_request_type import AssignConversationRequestType + + +class AssignConversationRequest(UncheckedBaseModel): + """ + Payload of the request to assign a conversation + """ + + type: AssignConversationRequestType + admin_id: str = pydantic.Field() + """ + The id of the admin who is performing the action. + """ + + assignee_id: str = pydantic.Field() + """ + The `id` of the `admin` or `team` which will be assigned the conversation. A conversation can be assigned both an admin and a team.\nSet `0` if you want this assign to no admin or team (ie. Unassigned). + """ + + body: typing.Optional[str] = pydantic.Field(default=None) + """ + Optionally you can send a response in the conversation when it is assigned. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/assign_conversation_request_type.py b/src/intercom/unstable/types/assign_conversation_request_type.py new file mode 100644 index 0000000..08756b6 --- /dev/null +++ b/src/intercom/unstable/types/assign_conversation_request_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AssignConversationRequestType = typing.Union[typing.Literal["admin", "team"], typing.Any] diff --git a/src/intercom/unstable/types/away_status_reason.py b/src/intercom/unstable/types/away_status_reason.py new file mode 100644 index 0000000..13de24a --- /dev/null +++ b/src/intercom/unstable/types/away_status_reason.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel + + +class AwayStatusReason(UncheckedBaseModel): + type: typing.Optional[str] = None + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The unique identifier for the away status reason + """ + + label: typing.Optional[str] = pydantic.Field(default=None) + """ + The display text for the away status reason + """ + + emoji: typing.Optional[str] = pydantic.Field(default=None) + """ + The emoji associated with the status reason + """ + + order: typing.Optional[int] = pydantic.Field(default=None) + """ + The display order of the status reason + """ + + deleted: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the status reason has been soft deleted + """ + + created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The Unix timestamp when the status reason was created + """ + + updated_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The Unix timestamp when the status reason was last updated + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/close_conversation_request.py b/src/intercom/unstable/types/close_conversation_request.py new file mode 100644 index 0000000..88b31d0 --- /dev/null +++ b/src/intercom/unstable/types/close_conversation_request.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel + + +class CloseConversationRequest(UncheckedBaseModel): + """ + Payload of the request to close a conversation + """ + + type: typing.Literal["admin"] = "admin" + admin_id: str = pydantic.Field() + """ + The id of the admin who is performing the action. + """ + + body: typing.Optional[str] = pydantic.Field(default=None) + """ + Optionally you can leave a message in the conversation to provide additional context to the user and other teammates. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/collection_list.py b/src/intercom/unstable/types/collection_list.py new file mode 100644 index 0000000..1a38131 --- /dev/null +++ b/src/intercom/unstable/types/collection_list.py @@ -0,0 +1,40 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from ..help_center.types.collection import Collection +from .cursor_pages import CursorPages + + +class CollectionList(UncheckedBaseModel): + """ + This will return a list of Collections for the App. + """ + + type: typing.Optional[typing.Literal["list"]] = pydantic.Field(default=None) + """ + The type of the object - `list`. + """ + + pages: typing.Optional[CursorPages] = None + total_count: typing.Optional[int] = pydantic.Field(default=None) + """ + A count of the total number of collections. + """ + + data: typing.Optional[typing.List[Collection]] = pydantic.Field(default=None) + """ + An array of collection objects + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/company_attached_contacts.py b/src/intercom/unstable/types/company_attached_contacts.py new file mode 100644 index 0000000..53ae40f --- /dev/null +++ b/src/intercom/unstable/types/company_attached_contacts.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from ..contacts.types.contact import Contact +from .cursor_pages import CursorPages + + +class CompanyAttachedContacts(UncheckedBaseModel): + """ + A list of Contact Objects + """ + + type: typing.Optional[typing.Literal["list"]] = pydantic.Field(default=None) + """ + The type of object - `list` + """ + + data: typing.Optional[typing.List[Contact]] = pydantic.Field(default=None) + """ + An array containing Contact Objects + """ + + total_count: typing.Optional[int] = pydantic.Field(default=None) + """ + The total number of contacts + """ + + pages: typing.Optional[CursorPages] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/company_attached_segments.py b/src/intercom/unstable/types/company_attached_segments.py new file mode 100644 index 0000000..c911cdf --- /dev/null +++ b/src/intercom/unstable/types/company_attached_segments.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from ..segments.types.segment import Segment + + +class CompanyAttachedSegments(UncheckedBaseModel): + """ + A list of Segment Objects + """ + + type: typing.Optional[typing.Literal["list"]] = pydantic.Field(default=None) + """ + The type of object - `list` + """ + + data: typing.Optional[typing.List[Segment]] = pydantic.Field(default=None) + """ + An array containing Segment Objects + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/company_data.py b/src/intercom/unstable/types/company_data.py new file mode 100644 index 0000000..2c61faf --- /dev/null +++ b/src/intercom/unstable/types/company_data.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel + + +class CompanyData(UncheckedBaseModel): + """ + An object containing data about the companies that a contact is associated with. + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The unique identifier for the company which is given by Intercom. + """ + + type: typing.Optional[typing.Literal["company"]] = pydantic.Field(default=None) + """ + The type of the object. Always company. + """ + + url: typing.Optional[str] = pydantic.Field(default=None) + """ + The relative URL of the company. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/company_list.py b/src/intercom/unstable/types/company_list.py new file mode 100644 index 0000000..2f6e0f9 --- /dev/null +++ b/src/intercom/unstable/types/company_list.py @@ -0,0 +1,40 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from ..companies.types.company import Company +from .cursor_pages import CursorPages + + +class CompanyList(UncheckedBaseModel): + """ + This will return a list of companies for the App. + """ + + type: typing.Optional[typing.Literal["list"]] = pydantic.Field(default=None) + """ + The type of object - `list`. + """ + + pages: typing.Optional[CursorPages] = None + total_count: typing.Optional[int] = pydantic.Field(default=None) + """ + The total number of companies. + """ + + data: typing.Optional[typing.List[Company]] = pydantic.Field(default=None) + """ + An array containing Company Objects. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/company_scroll.py b/src/intercom/unstable/types/company_scroll.py new file mode 100644 index 0000000..2bf69d7 --- /dev/null +++ b/src/intercom/unstable/types/company_scroll.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from ..companies.types.company import Company +from .cursor_pages import CursorPages + + +class CompanyScroll(UncheckedBaseModel): + """ + Companies allow you to represent organizations using your product. Each company will have its own description and be associated with contacts. You can fetch, create, update and list companies. + """ + + type: typing.Optional[typing.Literal["list"]] = pydantic.Field(default=None) + """ + The type of object - `list` + """ + + data: typing.Optional[typing.List[Company]] = None + pages: typing.Optional[CursorPages] = None + total_count: typing.Optional[int] = pydantic.Field(default=None) + """ + The total number of companies + """ + + scroll_param: typing.Optional[str] = pydantic.Field(default=None) + """ + The scroll parameter to use in the next request to fetch the next page of results. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/contact_archived.py b/src/intercom/unstable/types/contact_archived.py new file mode 100644 index 0000000..c4b7001 --- /dev/null +++ b/src/intercom/unstable/types/contact_archived.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from .contact_reference import ContactReference + + +class ContactArchived(ContactReference): + """ + archived contact object + """ + + archived: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the contact is archived or not. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/contact_attached_companies.py b/src/intercom/unstable/types/contact_attached_companies.py new file mode 100644 index 0000000..9038872 --- /dev/null +++ b/src/intercom/unstable/types/contact_attached_companies.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from ..companies.types.company import Company +from .pages_link import PagesLink + + +class ContactAttachedCompanies(UncheckedBaseModel): + """ + A list of Company Objects + """ + + type: typing.Optional[typing.Literal["list"]] = pydantic.Field(default=None) + """ + The type of object + """ + + companies: typing.Optional[typing.List[Company]] = pydantic.Field(default=None) + """ + An array containing Company Objects + """ + + total_count: typing.Optional[int] = pydantic.Field(default=None) + """ + The total number of companies associated to this contact + """ + + pages: typing.Optional[PagesLink] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/contact_blocked.py b/src/intercom/unstable/types/contact_blocked.py new file mode 100644 index 0000000..f5f2607 --- /dev/null +++ b/src/intercom/unstable/types/contact_blocked.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from .contact_reference import ContactReference + + +class ContactBlocked(ContactReference): + """ + blocked contact object + """ + + blocked: typing.Optional[bool] = pydantic.Field(default=None) + """ + Always true. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/contact_companies.py b/src/intercom/unstable/types/contact_companies.py new file mode 100644 index 0000000..7e90282 --- /dev/null +++ b/src/intercom/unstable/types/contact_companies.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from .company_data import CompanyData + + +class ContactCompanies(UncheckedBaseModel): + """ + An object with metadata about companies attached to a contact . Up to 10 will be displayed here. Use the url to get more. + """ + + data: typing.Optional[typing.List[CompanyData]] = pydantic.Field(default=None) + """ + An array of company data objects attached to the contact. + """ + + url: typing.Optional[str] = pydantic.Field(default=None) + """ + Url to get more company resources for this contact + """ + + total_count: typing.Optional[int] = pydantic.Field(default=None) + """ + Integer representing the total number of companies attached to this contact + """ + + has_more: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether there's more Addressable Objects to be viewed. If true, use the url to view all + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/contact_deleted.py b/src/intercom/unstable/types/contact_deleted.py new file mode 100644 index 0000000..6c1f065 --- /dev/null +++ b/src/intercom/unstable/types/contact_deleted.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from .contact_reference import ContactReference + + +class ContactDeleted(ContactReference): + """ + deleted contact object + """ + + deleted: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the contact is deleted or not. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/contact_list.py b/src/intercom/unstable/types/contact_list.py new file mode 100644 index 0000000..dbc3a8e --- /dev/null +++ b/src/intercom/unstable/types/contact_list.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from ..contacts.types.contact import Contact +from .cursor_pages import CursorPages + + +class ContactList(UncheckedBaseModel): + """ + Contacts are your users in Intercom. + """ + + type: typing.Optional[typing.Literal["list"]] = pydantic.Field(default=None) + """ + Always list + """ + + data: typing.Optional[typing.List[Contact]] = pydantic.Field(default=None) + """ + The list of contact objects + """ + + total_count: typing.Optional[int] = pydantic.Field(default=None) + """ + A count of the total number of objects. + """ + + pages: typing.Optional[CursorPages] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/contact_location.py b/src/intercom/unstable/types/contact_location.py new file mode 100644 index 0000000..2b1b4c5 --- /dev/null +++ b/src/intercom/unstable/types/contact_location.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel + + +class ContactLocation(UncheckedBaseModel): + """ + An object containing location meta data about a Intercom contact. + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + Always location + """ + + country: typing.Optional[str] = pydantic.Field(default=None) + """ + The country that the contact is located in + """ + + region: typing.Optional[str] = pydantic.Field(default=None) + """ + The overal region that the contact is located in + """ + + city: typing.Optional[str] = pydantic.Field(default=None) + """ + The city that the contact is located in + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/contact_notes.py b/src/intercom/unstable/types/contact_notes.py new file mode 100644 index 0000000..86998b1 --- /dev/null +++ b/src/intercom/unstable/types/contact_notes.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from .addressable_list import AddressableList + + +class ContactNotes(UncheckedBaseModel): + """ + An object containing notes meta data about the notes that a contact has. Up to 10 will be displayed here. Use the url to get more. + """ + + data: typing.Optional[typing.List[AddressableList]] = pydantic.Field(default=None) + """ + This object represents the notes attached to a contact. + """ + + url: typing.Optional[str] = pydantic.Field(default=None) + """ + Url to get more company resources for this contact + """ + + total_count: typing.Optional[int] = pydantic.Field(default=None) + """ + Int representing the total number of companyies attached to this contact + """ + + has_more: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether there's more Addressable Objects to be viewed. If true, use the url to view all + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/contact_reference.py b/src/intercom/unstable/types/contact_reference.py new file mode 100644 index 0000000..f0d9797 --- /dev/null +++ b/src/intercom/unstable/types/contact_reference.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel + + +class ContactReference(UncheckedBaseModel): + """ + reference to contact object + """ + + type: typing.Optional[typing.Literal["contact"]] = pydantic.Field(default=None) + """ + always contact + """ + + id: typing.Optional[str] = pydantic.Field(default=None) + """ + The unique identifier for the contact which is given by Intercom. + """ + + external_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The unique identifier for the contact which is provided by the Client. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/contact_reply_base_request.py b/src/intercom/unstable/types/contact_reply_base_request.py new file mode 100644 index 0000000..67d2c30 --- /dev/null +++ b/src/intercom/unstable/types/contact_reply_base_request.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from .contact_reply_base_request_reply_options_item import ContactReplyBaseRequestReplyOptionsItem + + +class ContactReplyBaseRequest(UncheckedBaseModel): + message_type: typing.Literal["comment"] = "comment" + type: typing.Literal["user"] = "user" + body: str = pydantic.Field() + """ + The text body of the comment. + """ + + created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + The time the reply was created. If not provided, the current time will be used. + """ + + attachment_urls: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of image URLs that will be added as attachments. You can include up to 10 URLs. + """ + + reply_options: typing.Optional[typing.List[ContactReplyBaseRequestReplyOptionsItem]] = pydantic.Field(default=None) + """ + The quick reply selection the contact wishes to respond with. These map to buttons displayed in the Messenger UI if sent by a bot, or the reply options sent by an Admin via the API. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/contact_reply_base_request_reply_options_item.py b/src/intercom/unstable/types/contact_reply_base_request_reply_options_item.py new file mode 100644 index 0000000..0f16e8a --- /dev/null +++ b/src/intercom/unstable/types/contact_reply_base_request_reply_options_item.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.serialization import FieldMetadata +from ...core.unchecked_base_model import UncheckedBaseModel + + +class ContactReplyBaseRequestReplyOptionsItem(UncheckedBaseModel): + text: str = pydantic.Field() + """ + The text of the chosen reply option. + """ + + uuid_: typing_extensions.Annotated[str, FieldMetadata(alias="uuid")] = pydantic.Field() + """ + The unique identifier for the quick reply option selected. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/contact_reply_conversation_request.py b/src/intercom/unstable/types/contact_reply_conversation_request.py new file mode 100644 index 0000000..7803e41 --- /dev/null +++ b/src/intercom/unstable/types/contact_reply_conversation_request.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .contact_reply_email_request import ContactReplyEmailRequest +from .contact_reply_intercom_user_id_request import ContactReplyIntercomUserIdRequest +from .contact_reply_user_id_request import ContactReplyUserIdRequest + +ContactReplyConversationRequest = typing.Union[ + ContactReplyIntercomUserIdRequest, ContactReplyEmailRequest, ContactReplyUserIdRequest +] diff --git a/src/intercom/unstable/types/contact_reply_email_request.py b/src/intercom/unstable/types/contact_reply_email_request.py new file mode 100644 index 0000000..37d8688 --- /dev/null +++ b/src/intercom/unstable/types/contact_reply_email_request.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from .contact_reply_base_request import ContactReplyBaseRequest +from .conversation_attachment_files import ConversationAttachmentFiles + + +class ContactReplyEmailRequest(ContactReplyBaseRequest): + """ + Payload of the request to reply on behalf of a contact using their `email` + """ + + email: str = pydantic.Field() + """ + The email you have defined for the user. + """ + + attachment_files: typing.Optional[typing.List[ConversationAttachmentFiles]] = pydantic.Field(default=None) + """ + A list of files that will be added as attachments. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/contact_reply_intercom_user_id_request.py b/src/intercom/unstable/types/contact_reply_intercom_user_id_request.py new file mode 100644 index 0000000..1c383cc --- /dev/null +++ b/src/intercom/unstable/types/contact_reply_intercom_user_id_request.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from .contact_reply_base_request import ContactReplyBaseRequest +from .conversation_attachment_files import ConversationAttachmentFiles + + +class ContactReplyIntercomUserIdRequest(ContactReplyBaseRequest): + """ + Payload of the request to reply on behalf of a contact using their `intercom_user_id` + """ + + intercom_user_id: str = pydantic.Field() + """ + The identifier for the contact as given by Intercom. + """ + + attachment_files: typing.Optional[typing.List[ConversationAttachmentFiles]] = pydantic.Field(default=None) + """ + A list of files that will be added as attachments. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/contact_reply_ticket_email_request.py b/src/intercom/unstable/types/contact_reply_ticket_email_request.py new file mode 100644 index 0000000..96d773c --- /dev/null +++ b/src/intercom/unstable/types/contact_reply_ticket_email_request.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from .contact_reply_base_request import ContactReplyBaseRequest + + +class ContactReplyTicketEmailRequest(ContactReplyBaseRequest): + """ + Payload of the request to reply on behalf of a contact using their `email` + """ + + email: str = pydantic.Field() + """ + The email you have defined for the user. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/contact_reply_ticket_intercom_user_id_request.py b/src/intercom/unstable/types/contact_reply_ticket_intercom_user_id_request.py new file mode 100644 index 0000000..daadd83 --- /dev/null +++ b/src/intercom/unstable/types/contact_reply_ticket_intercom_user_id_request.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from .contact_reply_base_request import ContactReplyBaseRequest + + +class ContactReplyTicketIntercomUserIdRequest(ContactReplyBaseRequest): + """ + Payload of the request to reply on behalf of a contact using their `intercom_user_id` + """ + + intercom_user_id: str = pydantic.Field() + """ + The identifier for the contact as given by Intercom. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/contact_reply_ticket_request.py b/src/intercom/unstable/types/contact_reply_ticket_request.py new file mode 100644 index 0000000..3422595 --- /dev/null +++ b/src/intercom/unstable/types/contact_reply_ticket_request.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .contact_reply_ticket_email_request import ContactReplyTicketEmailRequest +from .contact_reply_ticket_intercom_user_id_request import ContactReplyTicketIntercomUserIdRequest +from .contact_reply_ticket_user_id_request import ContactReplyTicketUserIdRequest + +ContactReplyTicketRequest = typing.Union[ + ContactReplyTicketIntercomUserIdRequest, ContactReplyTicketUserIdRequest, ContactReplyTicketEmailRequest +] diff --git a/src/intercom/unstable/types/contact_reply_ticket_user_id_request.py b/src/intercom/unstable/types/contact_reply_ticket_user_id_request.py new file mode 100644 index 0000000..f425802 --- /dev/null +++ b/src/intercom/unstable/types/contact_reply_ticket_user_id_request.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from .contact_reply_base_request import ContactReplyBaseRequest + + +class ContactReplyTicketUserIdRequest(ContactReplyBaseRequest): + """ + Payload of the request to reply on behalf of a contact using their `user_id` + """ + + user_id: str = pydantic.Field() + """ + The external_id you have defined for the contact. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/contact_reply_user_id_request.py b/src/intercom/unstable/types/contact_reply_user_id_request.py new file mode 100644 index 0000000..0a867a2 --- /dev/null +++ b/src/intercom/unstable/types/contact_reply_user_id_request.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from .contact_reply_base_request import ContactReplyBaseRequest +from .conversation_attachment_files import ConversationAttachmentFiles + + +class ContactReplyUserIdRequest(ContactReplyBaseRequest): + """ + Payload of the request to reply on behalf of a contact using their `user_id` + """ + + user_id: str = pydantic.Field() + """ + The external_id you have defined for the contact. + """ + + attachment_files: typing.Optional[typing.List[ConversationAttachmentFiles]] = pydantic.Field(default=None) + """ + A list of files that will be added as attachments. You can include up to 10 files. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/contact_segments.py b/src/intercom/unstable/types/contact_segments.py new file mode 100644 index 0000000..2cbdf9f --- /dev/null +++ b/src/intercom/unstable/types/contact_segments.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from ..segments.types.segment import Segment + + +class ContactSegments(UncheckedBaseModel): + """ + A list of segments objects attached to a specific contact. + """ + + type: typing.Optional[typing.Literal["list"]] = pydantic.Field(default=None) + """ + The type of the object + """ + + data: typing.Optional[typing.List[Segment]] = pydantic.Field(default=None) + """ + Segment objects associated with the contact. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/contact_social_profiles.py b/src/intercom/unstable/types/contact_social_profiles.py new file mode 100644 index 0000000..983a77d --- /dev/null +++ b/src/intercom/unstable/types/contact_social_profiles.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from .social_profile import SocialProfile + + +class ContactSocialProfiles(UncheckedBaseModel): + """ + An object containing social profiles that a contact has. + """ + + data: typing.Optional[typing.List[SocialProfile]] = pydantic.Field(default=None) + """ + A list of social profiles objects associated with the contact. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/contact_subscription_types.py b/src/intercom/unstable/types/contact_subscription_types.py new file mode 100644 index 0000000..91a6dd1 --- /dev/null +++ b/src/intercom/unstable/types/contact_subscription_types.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from .addressable_list import AddressableList + + +class ContactSubscriptionTypes(UncheckedBaseModel): + """ + An object containing Subscription Types meta data about the SubscriptionTypes that a contact has. + """ + + data: typing.Optional[typing.List[AddressableList]] = pydantic.Field(default=None) + """ + This object represents the subscriptions attached to a contact. + """ + + url: typing.Optional[str] = pydantic.Field(default=None) + """ + Url to get more subscription type resources for this contact + """ + + total_count: typing.Optional[int] = pydantic.Field(default=None) + """ + Int representing the total number of subscription types attached to this contact + """ + + has_more: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether there's more Addressable Objects to be viewed. If true, use the url to view all + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/contact_tags.py b/src/intercom/unstable/types/contact_tags.py new file mode 100644 index 0000000..ccd5675 --- /dev/null +++ b/src/intercom/unstable/types/contact_tags.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from .addressable_list import AddressableList + + +class ContactTags(UncheckedBaseModel): + """ + An object containing tags meta data about the tags that a contact has. Up to 10 will be displayed here. Use the url to get more. + """ + + data: typing.Optional[typing.List[AddressableList]] = pydantic.Field(default=None) + """ + This object represents the tags attached to a contact. + """ + + url: typing.Optional[str] = pydantic.Field(default=None) + """ + url to get more tag resources for this contact + """ + + total_count: typing.Optional[int] = pydantic.Field(default=None) + """ + Int representing the total number of tags attached to this contact + """ + + has_more: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether there's more Addressable Objects to be viewed. If true, use the url to view all + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/contact_unarchived.py b/src/intercom/unstable/types/contact_unarchived.py new file mode 100644 index 0000000..54c245a --- /dev/null +++ b/src/intercom/unstable/types/contact_unarchived.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from .contact_reference import ContactReference + + +class ContactUnarchived(ContactReference): + """ + unarchived contact object + """ + + archived: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the contact is archived or not. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/content_sources_list.py b/src/intercom/unstable/types/content_sources_list.py new file mode 100644 index 0000000..fc41d33 --- /dev/null +++ b/src/intercom/unstable/types/content_sources_list.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from ..ai_content_source.types.content_source import ContentSource + + +class ContentSourcesList(UncheckedBaseModel): + type: typing.Optional[typing.Literal["content_source.list"]] = None + total_count: typing.Optional[int] = pydantic.Field(default=None) + """ + The total number of content sources used by AI Agent in the conversation. + """ + + content_sources: typing.Optional[typing.List[ContentSource]] = pydantic.Field(default=None) + """ + The content sources used by AI Agent in the conversation. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/conversation_attachment_files.py b/src/intercom/unstable/types/conversation_attachment_files.py new file mode 100644 index 0000000..12985bb --- /dev/null +++ b/src/intercom/unstable/types/conversation_attachment_files.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel + + +class ConversationAttachmentFiles(UncheckedBaseModel): + """ + Properties of the attachment files in a conversation part + """ + + content_type: typing.Optional[str] = pydantic.Field(default=None) + """ + The content type of the file + """ + + data: typing.Optional[str] = pydantic.Field(default=None) + """ + The base64 encoded file data. + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the file. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/intercom/unstable/types/conversation_attribute_updated_by_admin.py b/src/intercom/unstable/types/conversation_attribute_updated_by_admin.py new file mode 100644 index 0000000..3d45497 --- /dev/null +++ b/src/intercom/unstable/types/conversation_attribute_updated_by_admin.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel +from .conversation_attribute_updated_by_admin_attribute import ConversationAttributeUpdatedByAdminAttribute +from .conversation_attribute_updated_by_admin_value import ConversationAttributeUpdatedByAdminValue + + +class ConversationAttributeUpdatedByAdmin(UncheckedBaseModel): + """ + Contains details about Custom Data Attributes (CDAs) that were modified by an admin (operator) for conversation part typeconversation_attribute_updated_by_admin.
+ """
+
+ attribute: typing.Optional[ConversationAttributeUpdatedByAdminAttribute] = None
+ value: typing.Optional[ConversationAttributeUpdatedByAdminValue] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/conversation_attribute_updated_by_admin_attribute.py b/src/intercom/unstable/types/conversation_attribute_updated_by_admin_attribute.py
new file mode 100644
index 0000000..9a84534
--- /dev/null
+++ b/src/intercom/unstable/types/conversation_attribute_updated_by_admin_attribute.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class ConversationAttributeUpdatedByAdminAttribute(UncheckedBaseModel):
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the CDA updated
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/conversation_attribute_updated_by_admin_value.py b/src/intercom/unstable/types/conversation_attribute_updated_by_admin_value.py
new file mode 100644
index 0000000..511bc30
--- /dev/null
+++ b/src/intercom/unstable/types/conversation_attribute_updated_by_admin_value.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class ConversationAttributeUpdatedByAdminValue(UncheckedBaseModel):
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Value of the CDA updated
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/conversation_attribute_updated_by_workflow.py b/src/intercom/unstable/types/conversation_attribute_updated_by_workflow.py
new file mode 100644
index 0000000..b13dfad
--- /dev/null
+++ b/src/intercom/unstable/types/conversation_attribute_updated_by_workflow.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .conversation_attribute_updated_by_workflow_attribute import ConversationAttributeUpdatedByWorkflowAttribute
+from .conversation_attribute_updated_by_workflow_value import ConversationAttributeUpdatedByWorkflowValue
+from .conversation_attribute_updated_by_workflow_workflow import ConversationAttributeUpdatedByWorkflowWorkflow
+
+
+class ConversationAttributeUpdatedByWorkflow(UncheckedBaseModel):
+ """
+ Contains details about the workflow that was triggered and any Custom Data Attributes (CDAs) that were modified during the workflow execution for conversation part type conversation_attribute_updated_by_workflow.
+ """
+
+ workflow: typing.Optional[ConversationAttributeUpdatedByWorkflowWorkflow] = None
+ attribute: typing.Optional[ConversationAttributeUpdatedByWorkflowAttribute] = None
+ value: typing.Optional[ConversationAttributeUpdatedByWorkflowValue] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/conversation_attribute_updated_by_workflow_attribute.py b/src/intercom/unstable/types/conversation_attribute_updated_by_workflow_attribute.py
new file mode 100644
index 0000000..e3a2579
--- /dev/null
+++ b/src/intercom/unstable/types/conversation_attribute_updated_by_workflow_attribute.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class ConversationAttributeUpdatedByWorkflowAttribute(UncheckedBaseModel):
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the CDA updated
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/conversation_attribute_updated_by_workflow_value.py b/src/intercom/unstable/types/conversation_attribute_updated_by_workflow_value.py
new file mode 100644
index 0000000..e465577
--- /dev/null
+++ b/src/intercom/unstable/types/conversation_attribute_updated_by_workflow_value.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class ConversationAttributeUpdatedByWorkflowValue(UncheckedBaseModel):
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Value of the CDA updated
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/conversation_attribute_updated_by_workflow_workflow.py b/src/intercom/unstable/types/conversation_attribute_updated_by_workflow_workflow.py
new file mode 100644
index 0000000..d496c90
--- /dev/null
+++ b/src/intercom/unstable/types/conversation_attribute_updated_by_workflow_workflow.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class ConversationAttributeUpdatedByWorkflowWorkflow(UncheckedBaseModel):
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the workflow
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/conversation_contacts.py b/src/intercom/unstable/types/conversation_contacts.py
new file mode 100644
index 0000000..f1c74b0
--- /dev/null
+++ b/src/intercom/unstable/types/conversation_contacts.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .contact_reference import ContactReference
+
+
+class ConversationContacts(UncheckedBaseModel):
+ """
+ The list of contacts (users or leads) involved in this conversation. This will only contain one customer unless more were added via the group conversation feature.
+ """
+
+ type: typing.Optional[typing.Literal["contact.list"]] = pydantic.Field(default=None)
+ """
+
+ """
+
+ contacts: typing.Optional[typing.List[ContactReference]] = pydantic.Field(default=None)
+ """
+ The list of contacts (users or leads) involved in this conversation. This will only contain one customer unless more were added via the group conversation feature.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/conversation_deleted.py b/src/intercom/unstable/types/conversation_deleted.py
new file mode 100644
index 0000000..265b2a7
--- /dev/null
+++ b/src/intercom/unstable/types/conversation_deleted.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class ConversationDeleted(UncheckedBaseModel):
+ """
+ deleted conversation object
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique identifier for the conversation.
+ """
+
+ object: typing.Optional[typing.Literal["conversation"]] = pydantic.Field(default=None)
+ """
+ always conversation
+ """
+
+ deleted: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the conversation is deleted or not.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/conversation_first_contact_reply.py b/src/intercom/unstable/types/conversation_first_contact_reply.py
new file mode 100644
index 0000000..30a41a6
--- /dev/null
+++ b/src/intercom/unstable/types/conversation_first_contact_reply.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class ConversationFirstContactReply(UncheckedBaseModel):
+ """
+ An object containing information on the first users message. For a contact initiated message this will represent the users original message.
+ """
+
+ created_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+
+ """
+
+ url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/conversation_list.py b/src/intercom/unstable/types/conversation_list.py
new file mode 100644
index 0000000..5c5d45f
--- /dev/null
+++ b/src/intercom/unstable/types/conversation_list.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from ..conversations.types.conversation import Conversation
+from .cursor_pages import CursorPages
+
+
+class ConversationList(UncheckedBaseModel):
+ """
+ Conversations are how you can communicate with users in Intercom. They are created when a contact replies to an outbound message, or when one admin directly sends a message to a single contact.
+ """
+
+ type: typing.Optional[typing.Literal["conversation.list"]] = pydantic.Field(default=None)
+ """
+ Always conversation.list
+ """
+
+ conversations: typing.Optional[typing.List[Conversation]] = pydantic.Field(default=None)
+ """
+ The list of conversation objects
+ """
+
+ total_count: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ A count of the total number of objects.
+ """
+
+ pages: typing.Optional[CursorPages] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/conversation_part.py b/src/intercom/unstable/types/conversation_part.py
new file mode 100644
index 0000000..f1eda18
--- /dev/null
+++ b/src/intercom/unstable/types/conversation_part.py
@@ -0,0 +1,104 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from ..tags.types.tag_basic import TagBasic
+from .conversation_part_author import ConversationPartAuthor
+from .conversation_part_metadata import ConversationPartMetadata
+from .conversation_part_state import ConversationPartState
+from .email_message_metadata import EmailMessageMetadata
+from .event_details import EventDetails
+from .part_attachment import PartAttachment
+from .reference import Reference
+
+
+class ConversationPart(UncheckedBaseModel):
+ """
+ A Conversation Part represents a message in the conversation.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Always conversation_part
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The id representing the conversation part.
+ """
+
+ part_type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of conversation part.
+ """
+
+ body: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The message body, which may contain HTML. For Twitter, this will show a generic message regarding why the body is obscured.
+ """
+
+ created_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The time the conversation part was created.
+ """
+
+ updated_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The last time the conversation part was updated.
+ """
+
+ notified_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The time the user was notified with the conversation part.
+ """
+
+ assigned_to: typing.Optional[Reference] = pydantic.Field(default=None)
+ """
+ The id of the admin that was assigned the conversation by this conversation_part (null if there has been no change in assignment.)
+ """
+
+ author: typing.Optional[ConversationPartAuthor] = None
+ attachments: typing.Optional[typing.List[PartAttachment]] = pydantic.Field(default=None)
+ """
+ A list of attachments for the part.
+ """
+
+ external_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The external id of the conversation part
+ """
+
+ redacted: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether or not the conversation part has been redacted.
+ """
+
+ email_message_metadata: typing.Optional[EmailMessageMetadata] = None
+ metadata: typing.Optional[ConversationPartMetadata] = None
+ state: typing.Optional[ConversationPartState] = pydantic.Field(default=None)
+ """
+ Indicates the current state of conversation when the conversation part was created.
+ """
+
+ tags: typing.Optional[typing.List[TagBasic]] = pydantic.Field(default=None)
+ """
+ A list of tags objects associated with the conversation part.
+ """
+
+ event_details: typing.Optional[EventDetails] = None
+ app_package_code: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The app package code if this part was created via API. null if the part was not created via API.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/conversation_part_author.py b/src/intercom/unstable/types/conversation_part_author.py
new file mode 100644
index 0000000..185e7b8
--- /dev/null
+++ b/src/intercom/unstable/types/conversation_part_author.py
@@ -0,0 +1,52 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class ConversationPartAuthor(UncheckedBaseModel):
+ """
+ The object who initiated the conversation, which can be a Contact, Admin or Team. Bots and campaigns send messages on behalf of Admins or Teams. For Twitter, this will be blank.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of the author
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The id of the author
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the author
+ """
+
+ email: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The email of the author
+ """
+
+ from_ai_agent: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ If this conversation part was sent by the AI Agent
+ """
+
+ is_ai_answer: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ If this conversation part body was generated by the AI Agent
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/conversation_part_metadata.py b/src/intercom/unstable/types/conversation_part_metadata.py
new file mode 100644
index 0000000..0cfa0f3
--- /dev/null
+++ b/src/intercom/unstable/types/conversation_part_metadata.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .conversation_part_metadata_quick_reply_options_item import ConversationPartMetadataQuickReplyOptionsItem
+
+
+class ConversationPartMetadata(UncheckedBaseModel):
+ """
+ Metadata for a conversation part
+ """
+
+ quick_reply_options: typing.Optional[typing.List[ConversationPartMetadataQuickReplyOptionsItem]] = pydantic.Field(
+ default=None
+ )
+ """
+ The quick reply options sent by the Admin or bot, presented in this conversation part.
+ """
+
+ quick_reply_uuid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique identifier for the quick reply option that was clicked by the end user.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/conversation_part_metadata_quick_reply_options_item.py b/src/intercom/unstable/types/conversation_part_metadata_quick_reply_options_item.py
new file mode 100644
index 0000000..fb931fe
--- /dev/null
+++ b/src/intercom/unstable/types/conversation_part_metadata_quick_reply_options_item.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from .quick_reply_option import QuickReplyOption
+
+
+class ConversationPartMetadataQuickReplyOptionsItem(QuickReplyOption):
+ translations: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
+ """
+ The translations for the quick reply option.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/conversation_part_state.py b/src/intercom/unstable/types/conversation_part_state.py
new file mode 100644
index 0000000..96342fb
--- /dev/null
+++ b/src/intercom/unstable/types/conversation_part_state.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ConversationPartState = typing.Union[typing.Literal["open", "closed", "snoozed"], typing.Any]
diff --git a/src/intercom/unstable/types/conversation_parts.py b/src/intercom/unstable/types/conversation_parts.py
new file mode 100644
index 0000000..b3b5940
--- /dev/null
+++ b/src/intercom/unstable/types/conversation_parts.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .conversation_part import ConversationPart
+
+
+class ConversationParts(UncheckedBaseModel):
+ """
+ A list of Conversation Part objects for each part message in the conversation. This is only returned when Retrieving a Conversation, and ignored when Listing all Conversations. There is a limit of 500 parts.
+ """
+
+ type: typing.Optional[typing.Literal["conversation_part.list"]] = pydantic.Field(default=None)
+ """
+
+ """
+
+ conversation_parts: typing.Optional[typing.List[ConversationPart]] = pydantic.Field(default=None)
+ """
+ A list of Conversation Part objects for each part message in the conversation. This is only returned when Retrieving a Conversation, and ignored when Listing all Conversations. There is a limit of 500 parts.
+ """
+
+ total_count: typing.Optional[int] = pydantic.Field(default=None)
+ """
+
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/conversation_rating.py b/src/intercom/unstable/types/conversation_rating.py
new file mode 100644
index 0000000..4455b68
--- /dev/null
+++ b/src/intercom/unstable/types/conversation_rating.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .contact_reference import ContactReference
+from .reference import Reference
+
+
+class ConversationRating(UncheckedBaseModel):
+ """
+ The Conversation Rating object which contains information on the rating and/or remark added by a Contact and the Admin assigned to the conversation.
+ """
+
+ rating: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The rating, between 1 and 5, for the conversation.
+ """
+
+ remark: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An optional field to add a remark to correspond to the number rating
+ """
+
+ created_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The time the rating was requested in the conversation being rated.
+ """
+
+ contact: typing.Optional[ContactReference] = None
+ teammate: typing.Optional[Reference] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/conversation_response_time.py b/src/intercom/unstable/types/conversation_response_time.py
new file mode 100644
index 0000000..e739209
--- /dev/null
+++ b/src/intercom/unstable/types/conversation_response_time.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class ConversationResponseTime(UncheckedBaseModel):
+ """
+ Details of first response time of assigned team in seconds.
+ """
+
+ team_id: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Id of the assigned team.
+ """
+
+ team_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the assigned Team, null if team does not exist, Unassigned if no team is assigned.
+ """
+
+ response_time: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ First response time of assigned team in seconds.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/conversation_source.py b/src/intercom/unstable/types/conversation_source.py
new file mode 100644
index 0000000..7e79ca4
--- /dev/null
+++ b/src/intercom/unstable/types/conversation_source.py
@@ -0,0 +1,66 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .conversation_part_author import ConversationPartAuthor
+from .conversation_source_type import ConversationSourceType
+from .part_attachment import PartAttachment
+
+
+class ConversationSource(UncheckedBaseModel):
+ """
+ The type of the conversation part that started this conversation. Can be Contact, Admin, Campaign, Automated or Operator initiated.
+ """
+
+ type: typing.Optional[ConversationSourceType] = pydantic.Field(default=None)
+ """
+ This includes conversation, email, facebook, instagram, phone_call, phone_switch, push, sms, twitter and whatsapp.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The id representing the message.
+ """
+
+ delivered_as: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The conversation's initiation type. Possible values are customer_initiated, campaigns_initiated (legacy campaigns), operator_initiated (Custom bot), automated (Series and other outbounds with dynamic audience message) and admin_initiated (fixed audience message, ticket initiated by an admin, group email).
+ """
+
+ subject: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Optional. The message subject. For Twitter, this will show a generic message regarding why the subject is obscured.
+ """
+
+ body: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The message body, which may contain HTML. For Twitter, this will show a generic message regarding why the body is obscured.
+ """
+
+ author: typing.Optional[ConversationPartAuthor] = None
+ attachments: typing.Optional[typing.List[PartAttachment]] = pydantic.Field(default=None)
+ """
+ A list of attachments for the part.
+ """
+
+ url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The URL where the conversation was started. For Twitter, Email, and Bots, this will be blank.
+ """
+
+ redacted: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether or not the source message has been redacted. Only applicable for contact initiated messages.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/conversation_source_type.py b/src/intercom/unstable/types/conversation_source_type.py
new file mode 100644
index 0000000..0a56fc3
--- /dev/null
+++ b/src/intercom/unstable/types/conversation_source_type.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ConversationSourceType = typing.Union[
+ typing.Literal[
+ "conversation",
+ "email",
+ "facebook",
+ "instagram",
+ "phone_call",
+ "phone_switch",
+ "push",
+ "sms",
+ "twitter",
+ "whatsapp",
+ ],
+ typing.Any,
+]
diff --git a/src/intercom/unstable/types/conversation_statistics.py b/src/intercom/unstable/types/conversation_statistics.py
new file mode 100644
index 0000000..ab9f9cf
--- /dev/null
+++ b/src/intercom/unstable/types/conversation_statistics.py
@@ -0,0 +1,137 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .conversation_response_time import ConversationResponseTime
+
+
+class ConversationStatistics(UncheckedBaseModel):
+ """
+ A Statistics object containing all information required for reporting, with timestamps and calculated metrics.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+
+ """
+
+ time_to_assignment: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Duration until last assignment before first admin reply. In seconds.
+ """
+
+ time_to_admin_reply: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Duration until first admin reply. Subtracts out of business hours. In seconds.
+ """
+
+ time_to_first_close: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Duration until conversation was closed first time. Subtracts out of business hours. In seconds.
+ """
+
+ time_to_last_close: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Duration until conversation was closed last time. Subtracts out of business hours. In seconds.
+ """
+
+ median_time_to_reply: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Median based on all admin replies after a contact reply. Subtracts out of business hours. In seconds.
+ """
+
+ first_contact_reply_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Time of first text conversation part from a contact.
+ """
+
+ first_assignment_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Time of first assignment after first_contact_reply_at.
+ """
+
+ first_admin_reply_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Time of first admin reply after first_contact_reply_at.
+ """
+
+ first_close_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Time of first close after first_contact_reply_at.
+ """
+
+ last_assignment_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Time of last assignment after first_contact_reply_at.
+ """
+
+ last_assignment_admin_reply_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Time of first admin reply since most recent assignment.
+ """
+
+ last_contact_reply_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Time of the last conversation part from a contact.
+ """
+
+ last_admin_reply_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Time of the last conversation part from an admin.
+ """
+
+ last_close_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Time of the last conversation close.
+ """
+
+ last_closed_by_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The last admin who closed the conversation. Returns a reference to an Admin object.
+ """
+
+ count_reopens: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Number of reopens after first_contact_reply_at.
+ """
+
+ count_assignments: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Number of assignments after first_contact_reply_at.
+ """
+
+ count_conversation_parts: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Total number of conversation parts.
+ """
+
+ assigned_team_first_response_time_by_team: typing.Optional[typing.List[ConversationResponseTime]] = pydantic.Field(
+ default=None
+ )
+ """
+ An array of conversation response time objects
+ """
+
+ assigned_team_first_response_time_in_office_hours: typing.Optional[typing.List[ConversationResponseTime]] = (
+ pydantic.Field(default=None)
+ )
+ """
+ An array of conversation response time objects within office hours
+ """
+
+ handling_time: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Time from conversation assignment to conversation close in seconds.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/conversation_teammates.py b/src/intercom/unstable/types/conversation_teammates.py
new file mode 100644
index 0000000..64c8131
--- /dev/null
+++ b/src/intercom/unstable/types/conversation_teammates.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .reference import Reference
+
+
+class ConversationTeammates(UncheckedBaseModel):
+ """
+ The list of teammates who participated in the conversation (wrote at least one conversation part).
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of the object - `admin.list`.
+ """
+
+ teammates: typing.Optional[typing.List[Reference]] = pydantic.Field(default=None)
+ """
+ The list of teammates who participated in the conversation (wrote at least one conversation part).
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/create_or_update_tag_request.py b/src/intercom/unstable/types/create_or_update_tag_request.py
new file mode 100644
index 0000000..be51aea
--- /dev/null
+++ b/src/intercom/unstable/types/create_or_update_tag_request.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class CreateOrUpdateTagRequest(UncheckedBaseModel):
+ """
+ You can create or update an existing tag.
+ """
+
+ name: str = pydantic.Field()
+ """
+ The name of the tag, which will be created if not found, or the new name for the tag if this is an update request. Names are case insensitive.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The id of tag to updates.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/create_ticket_reply_with_comment_request.py b/src/intercom/unstable/types/create_ticket_reply_with_comment_request.py
new file mode 100644
index 0000000..107d44a
--- /dev/null
+++ b/src/intercom/unstable/types/create_ticket_reply_with_comment_request.py
@@ -0,0 +1,8 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from .admin_reply_ticket_request import AdminReplyTicketRequest
+from .contact_reply_ticket_request import ContactReplyTicketRequest
+
+CreateTicketReplyWithCommentRequest = typing.Union[ContactReplyTicketRequest, AdminReplyTicketRequest]
diff --git a/src/intercom/unstable/types/create_ticket_request_assignment.py b/src/intercom/unstable/types/create_ticket_request_assignment.py
new file mode 100644
index 0000000..fa4de4f
--- /dev/null
+++ b/src/intercom/unstable/types/create_ticket_request_assignment.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class CreateTicketRequestAssignment(UncheckedBaseModel):
+ admin_assignee_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the admin to which the ticket is assigned. If not provided, the ticket will be unassigned.
+ """
+
+ team_assignee_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the team to which the ticket is assigned. If not provided, the ticket will be unassigned.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/create_ticket_request_body.py b/src/intercom/unstable/types/create_ticket_request_body.py
new file mode 100644
index 0000000..24e77d7
--- /dev/null
+++ b/src/intercom/unstable/types/create_ticket_request_body.py
@@ -0,0 +1,55 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .create_ticket_request_assignment import CreateTicketRequestAssignment
+from .create_ticket_request_contacts_item import CreateTicketRequestContactsItem
+
+
+class CreateTicketRequestBody(UncheckedBaseModel):
+ """
+ You can create a Ticket
+ """
+
+ ticket_type_id: str = pydantic.Field()
+ """
+ The ID of the type of ticket you want to create
+ """
+
+ contacts: typing.List[CreateTicketRequestContactsItem] = pydantic.Field()
+ """
+ The list of contacts (users or leads) affected by this ticket. Currently only one is allowed
+ """
+
+ conversation_to_link_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the conversation you want to link to the ticket. Here are the valid ways of linking two tickets:
+ - conversation | back-office ticket
+ - customer tickets | non-shared back-office ticket
+ - conversation | tracker ticket
+ - customer ticket | tracker ticket
+ """
+
+ company_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the company that the ticket is associated with. The unique identifier for the company which is given by Intercom
+ """
+
+ created_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The time the ticket was created. If not provided, the current time will be used.
+ """
+
+ assignment: typing.Optional[CreateTicketRequestAssignment] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/create_ticket_request_contacts_item.py b/src/intercom/unstable/types/create_ticket_request_contacts_item.py
new file mode 100644
index 0000000..2d5d66c
--- /dev/null
+++ b/src/intercom/unstable/types/create_ticket_request_contacts_item.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from .create_ticket_request_contacts_item_email import CreateTicketRequestContactsItemEmail
+from .create_ticket_request_contacts_item_external_id import CreateTicketRequestContactsItemExternalId
+from .create_ticket_request_contacts_item_id import CreateTicketRequestContactsItemId
+
+CreateTicketRequestContactsItem = typing.Union[
+ CreateTicketRequestContactsItemId, CreateTicketRequestContactsItemExternalId, CreateTicketRequestContactsItemEmail
+]
diff --git a/src/intercom/unstable/types/create_ticket_request_contacts_item_email.py b/src/intercom/unstable/types/create_ticket_request_contacts_item_email.py
new file mode 100644
index 0000000..39cf4c2
--- /dev/null
+++ b/src/intercom/unstable/types/create_ticket_request_contacts_item_email.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class CreateTicketRequestContactsItemEmail(UncheckedBaseModel):
+ email: str = pydantic.Field()
+ """
+ The email you have defined for the contact who is being added as a participant. If a contact with this email does not exist, one will be created.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/create_ticket_request_contacts_item_external_id.py b/src/intercom/unstable/types/create_ticket_request_contacts_item_external_id.py
new file mode 100644
index 0000000..857a1ec
--- /dev/null
+++ b/src/intercom/unstable/types/create_ticket_request_contacts_item_external_id.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class CreateTicketRequestContactsItemExternalId(UncheckedBaseModel):
+ external_id: str = pydantic.Field()
+ """
+ The external_id you have defined for the contact who is being added as a participant.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/create_ticket_request_contacts_item_id.py b/src/intercom/unstable/types/create_ticket_request_contacts_item_id.py
new file mode 100644
index 0000000..adc100b
--- /dev/null
+++ b/src/intercom/unstable/types/create_ticket_request_contacts_item_id.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class CreateTicketRequestContactsItemId(UncheckedBaseModel):
+ id: str = pydantic.Field()
+ """
+ The identifier for the contact as given by Intercom.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/cursor_pages.py b/src/intercom/unstable/types/cursor_pages.py
new file mode 100644
index 0000000..cc3f4bd
--- /dev/null
+++ b/src/intercom/unstable/types/cursor_pages.py
@@ -0,0 +1,45 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .starting_after_paging import StartingAfterPaging
+
+
+class CursorPages(UncheckedBaseModel):
+ """
+ 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.
+ """
+
+ type: typing.Optional[typing.Literal["pages"]] = pydantic.Field(default=None)
+ """
+ the type of object `pages`.
+ """
+
+ page: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The current page
+ """
+
+ next: typing.Optional[StartingAfterPaging] = None
+ per_page: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Number of results per page
+ """
+
+ total_pages: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Total number of pages
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/custom_action_finished.py b/src/intercom/unstable/types/custom_action_finished.py
new file mode 100644
index 0000000..f96b391
--- /dev/null
+++ b/src/intercom/unstable/types/custom_action_finished.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .custom_action_finished_action import CustomActionFinishedAction
+
+
+class CustomActionFinished(UncheckedBaseModel):
+ """
+ Contains details about final status of the completed action for conversation part type custom_action_finished.
+ """
+
+ action: typing.Optional[CustomActionFinishedAction] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/custom_action_finished_action.py b/src/intercom/unstable/types/custom_action_finished_action.py
new file mode 100644
index 0000000..19082b9
--- /dev/null
+++ b/src/intercom/unstable/types/custom_action_finished_action.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .custom_action_finished_action_result import CustomActionFinishedActionResult
+
+
+class CustomActionFinishedAction(UncheckedBaseModel):
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the action
+ """
+
+ result: typing.Optional[CustomActionFinishedActionResult] = pydantic.Field(default=None)
+ """
+ Status of the action
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/custom_action_finished_action_result.py b/src/intercom/unstable/types/custom_action_finished_action_result.py
new file mode 100644
index 0000000..0f1e35a
--- /dev/null
+++ b/src/intercom/unstable/types/custom_action_finished_action_result.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CustomActionFinishedActionResult = typing.Union[typing.Literal["success", "failed"], typing.Any]
diff --git a/src/intercom/unstable/types/custom_action_started.py b/src/intercom/unstable/types/custom_action_started.py
new file mode 100644
index 0000000..060fc29
--- /dev/null
+++ b/src/intercom/unstable/types/custom_action_started.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .custom_action_started_action import CustomActionStartedAction
+
+
+class CustomActionStarted(UncheckedBaseModel):
+ """
+ Contains details about name of the action that was initiated for conversation part type custom_action_started.
+ """
+
+ action: typing.Optional[CustomActionStartedAction] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/custom_action_started_action.py b/src/intercom/unstable/types/custom_action_started_action.py
new file mode 100644
index 0000000..daada6c
--- /dev/null
+++ b/src/intercom/unstable/types/custom_action_started_action.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class CustomActionStartedAction(UncheckedBaseModel):
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the action
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/custom_attributes.py b/src/intercom/unstable/types/custom_attributes.py
new file mode 100644
index 0000000..52b1b17
--- /dev/null
+++ b/src/intercom/unstable/types/custom_attributes.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from .custom_attributes_value import CustomAttributesValue
+
+CustomAttributes = typing.Dict[str, CustomAttributesValue]
diff --git a/src/intercom/unstable/types/custom_attributes_value.py b/src/intercom/unstable/types/custom_attributes_value.py
new file mode 100644
index 0000000..93669f7
--- /dev/null
+++ b/src/intercom/unstable/types/custom_attributes_value.py
@@ -0,0 +1,8 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from .custom_object_instance_list import CustomObjectInstanceList
+from .datetime import Datetime
+
+CustomAttributesValue = typing.Union[str, int, Datetime, CustomObjectInstanceList]
diff --git a/src/intercom/unstable/types/custom_channel_attribute.py b/src/intercom/unstable/types/custom_channel_attribute.py
new file mode 100644
index 0000000..4d5efd3
--- /dev/null
+++ b/src/intercom/unstable/types/custom_channel_attribute.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class CustomChannelAttribute(UncheckedBaseModel):
+ id: str = pydantic.Field()
+ """
+ Identifier for the attribute being collected.
+ """
+
+ value: str = pydantic.Field()
+ """
+ Value provided by the user for the attribute.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/custom_channel_base_event.py b/src/intercom/unstable/types/custom_channel_base_event.py
new file mode 100644
index 0000000..0a836d4
--- /dev/null
+++ b/src/intercom/unstable/types/custom_channel_base_event.py
@@ -0,0 +1,31 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .custom_channel_contact import CustomChannelContact
+
+
+class CustomChannelBaseEvent(UncheckedBaseModel):
+ event_id: str = pydantic.Field()
+ """
+ Unique identifier for the event.
+ """
+
+ external_conversation_id: str = pydantic.Field()
+ """
+ Identifier for the conversation in your application.
+ """
+
+ contact: CustomChannelContact
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/custom_channel_contact.py b/src/intercom/unstable/types/custom_channel_contact.py
new file mode 100644
index 0000000..84fb391
--- /dev/null
+++ b/src/intercom/unstable/types/custom_channel_contact.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .custom_channel_contact_type import CustomChannelContactType
+
+
+class CustomChannelContact(UncheckedBaseModel):
+ type: CustomChannelContactType = pydantic.Field()
+ """
+ Type of contact, must be "user" or "lead".
+ """
+
+ external_id: str = pydantic.Field()
+ """
+ External identifier for the contact. Intercom will take care of the mapping of your external_id with our internal ones so you don't have to worry about it.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the contact. Required for user type.
+ """
+
+ email: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Email address of the contact. Required for user type.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/custom_channel_contact_type.py b/src/intercom/unstable/types/custom_channel_contact_type.py
new file mode 100644
index 0000000..de33161
--- /dev/null
+++ b/src/intercom/unstable/types/custom_channel_contact_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CustomChannelContactType = typing.Union[typing.Literal["user", "lead"], typing.Any]
diff --git a/src/intercom/unstable/types/custom_channel_notification_response.py b/src/intercom/unstable/types/custom_channel_notification_response.py
new file mode 100644
index 0000000..4ccfc99
--- /dev/null
+++ b/src/intercom/unstable/types/custom_channel_notification_response.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class CustomChannelNotificationResponse(UncheckedBaseModel):
+ external_conversation_id: str = pydantic.Field()
+ """
+ The external conversation ID provided in the notification request
+ """
+
+ conversation_id: str = pydantic.Field()
+ """
+ The Intercom conversation ID mapped to the external conversation ID
+ """
+
+ external_contact_id: str = pydantic.Field()
+ """
+ The external contact ID provided in the notification request
+ """
+
+ contact_id: str = pydantic.Field()
+ """
+ The Intercom contact ID mapped to the external contact ID
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/custom_object_instance_deleted.py b/src/intercom/unstable/types/custom_object_instance_deleted.py
new file mode 100644
index 0000000..b43813e
--- /dev/null
+++ b/src/intercom/unstable/types/custom_object_instance_deleted.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class CustomObjectInstanceDeleted(UncheckedBaseModel):
+ """
+ deleted custom object instance object
+ """
+
+ object: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique identifier of the Custom Object type that defines the structure of the Custom Object instance.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Intercom defined id representing the Custom Object instance.
+ """
+
+ deleted: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the Custom Object instance is deleted or not.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/custom_object_instance_list.py b/src/intercom/unstable/types/custom_object_instance_list.py
new file mode 100644
index 0000000..1bea85e
--- /dev/null
+++ b/src/intercom/unstable/types/custom_object_instance_list.py
@@ -0,0 +1,29 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from ..custom_object_instances.types.custom_object_instance import CustomObjectInstance
+
+
+class CustomObjectInstanceList(UncheckedBaseModel):
+ """
+ The list of associated custom object instances for a given reference attribute on the parent object.
+ """
+
+ type: typing.Optional[str] = None
+ instances: typing.Optional[typing.List[typing.Optional[CustomObjectInstance]]] = pydantic.Field(default=None)
+ """
+ The list of associated custom object instances for a given reference attribute on the parent object.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/customer_request.py b/src/intercom/unstable/types/customer_request.py
new file mode 100644
index 0000000..a61840b
--- /dev/null
+++ b/src/intercom/unstable/types/customer_request.py
@@ -0,0 +1,9 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from .customer_request_email import CustomerRequestEmail
+from .customer_request_intercom_user_id import CustomerRequestIntercomUserId
+from .customer_request_user_id import CustomerRequestUserId
+
+CustomerRequest = typing.Union[CustomerRequestIntercomUserId, CustomerRequestUserId, CustomerRequestEmail]
diff --git a/src/intercom/unstable/types/customer_request_email.py b/src/intercom/unstable/types/customer_request_email.py
new file mode 100644
index 0000000..3ecd6a8
--- /dev/null
+++ b/src/intercom/unstable/types/customer_request_email.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class CustomerRequestEmail(UncheckedBaseModel):
+ email: str = pydantic.Field()
+ """
+ The email you have defined for the contact who is being added as a participant.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/customer_request_intercom_user_id.py b/src/intercom/unstable/types/customer_request_intercom_user_id.py
new file mode 100644
index 0000000..5eb5082
--- /dev/null
+++ b/src/intercom/unstable/types/customer_request_intercom_user_id.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class CustomerRequestIntercomUserId(UncheckedBaseModel):
+ intercom_user_id: str = pydantic.Field()
+ """
+ The identifier for the contact as given by Intercom.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/customer_request_user_id.py b/src/intercom/unstable/types/customer_request_user_id.py
new file mode 100644
index 0000000..b4bf8e3
--- /dev/null
+++ b/src/intercom/unstable/types/customer_request_user_id.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class CustomerRequestUserId(UncheckedBaseModel):
+ user_id: str = pydantic.Field()
+ """
+ The external_id you have defined for the contact who is being added as a participant.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/data_attribute_list.py b/src/intercom/unstable/types/data_attribute_list.py
new file mode 100644
index 0000000..a0a49bb
--- /dev/null
+++ b/src/intercom/unstable/types/data_attribute_list.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from ..data_attributes.types.data_attribute import DataAttribute
+
+
+class DataAttributeList(UncheckedBaseModel):
+ """
+ A list of all data attributes belonging to a workspace for contacts, companies or conversations.
+ """
+
+ type: typing.Optional[typing.Literal["list"]] = pydantic.Field(default=None)
+ """
+ The type of the object
+ """
+
+ data: typing.Optional[typing.List[DataAttribute]] = pydantic.Field(default=None)
+ """
+ A list of data attributes
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/data_event_list.py b/src/intercom/unstable/types/data_event_list.py
new file mode 100644
index 0000000..920dc25
--- /dev/null
+++ b/src/intercom/unstable/types/data_event_list.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from ..data_events.types.data_event import DataEvent
+from .data_event_list_pages import DataEventListPages
+
+
+class DataEventList(UncheckedBaseModel):
+ """
+ This will return a list of data events for the App.
+ """
+
+ type: typing.Optional[typing.Literal["event.list"]] = pydantic.Field(default=None)
+ """
+ The type of the object
+ """
+
+ events: typing.Optional[typing.List[DataEvent]] = pydantic.Field(default=None)
+ """
+ A list of data events
+ """
+
+ pages: typing.Optional[DataEventListPages] = pydantic.Field(default=None)
+ """
+ Pagination
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/data_event_list_pages.py b/src/intercom/unstable/types/data_event_list_pages.py
new file mode 100644
index 0000000..4300048
--- /dev/null
+++ b/src/intercom/unstable/types/data_event_list_pages.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class DataEventListPages(UncheckedBaseModel):
+ """
+ Pagination
+ """
+
+ next: typing.Optional[str] = None
+ since: typing.Optional[str] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/data_event_summary.py b/src/intercom/unstable/types/data_event_summary.py
new file mode 100644
index 0000000..ad9f6fe
--- /dev/null
+++ b/src/intercom/unstable/types/data_event_summary.py
@@ -0,0 +1,48 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .data_event_summary_item import DataEventSummaryItem
+
+
+class DataEventSummary(UncheckedBaseModel):
+ """
+ This will return a summary of data events for the App.
+ """
+
+ type: typing.Optional[typing.Literal["event.summary"]] = pydantic.Field(default=None)
+ """
+ The type of the object
+ """
+
+ email: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The email address of the user
+ """
+
+ intercom_user_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Intercom user ID of the user
+ """
+
+ user_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The user ID of the user
+ """
+
+ events: typing.Optional[typing.List[typing.Optional[DataEventSummaryItem]]] = pydantic.Field(default=None)
+ """
+ A summary of data events
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/data_event_summary_item.py b/src/intercom/unstable/types/data_event_summary_item.py
new file mode 100644
index 0000000..c1ee6db
--- /dev/null
+++ b/src/intercom/unstable/types/data_event_summary_item.py
@@ -0,0 +1,47 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class DataEventSummaryItem(UncheckedBaseModel):
+ """
+ This will return a summary of a data event for the App.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the event
+ """
+
+ first: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The first time the event was sent
+ """
+
+ last: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The last time the event was sent
+ """
+
+ count: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The number of times the event was sent
+ """
+
+ description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The description of the event
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/data_export_csv.py b/src/intercom/unstable/types/data_export_csv.py
new file mode 100644
index 0000000..2e6495d
--- /dev/null
+++ b/src/intercom/unstable/types/data_export_csv.py
@@ -0,0 +1,152 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class DataExportCsv(UncheckedBaseModel):
+ """
+ A CSV output file
+ """
+
+ user_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The user_id of the user who was sent the message.
+ """
+
+ user_external_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The external_user_id of the user who was sent the message
+ """
+
+ company_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The company ID of the user in relation to the message that was sent. Will return -1 if no company is present.
+ """
+
+ email: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The users email who was sent the message.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The full name of the user receiving the message
+ """
+
+ ruleset_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The id of the message.
+ """
+
+ content_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The specific content that was received. In an A/B test each version has its own Content ID.
+ """
+
+ content_type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Email, Chat, Post etc.
+ """
+
+ content_title: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The title of the content you see in your Intercom workspace.
+ """
+
+ ruleset_version_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ As you edit content we record new versions. This ID can help you determine which version of a piece of content that was received.
+ """
+
+ receipt_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID for this receipt. Will be included with any related stats in other files to identify this specific delivery of a message.
+ """
+
+ received_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ Timestamp for when the receipt was recorded.
+ """
+
+ series_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The id of the series that this content is part of. Will return -1 if not part of a series.
+ """
+
+ series_title: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The title of the series that this content is part of.
+ """
+
+ node_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The id of the series node that this ruleset is associated with. Each block in a series has a corresponding node_id.
+ """
+
+ first_reply: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The first time a user replied to this message if the content was able to receive replies.
+ """
+
+ first_completion: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The first time a user completed this message if the content was able to be completed e.g. Tours, Surveys.
+ """
+
+ first_series_completion: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The first time the series this message was a part of was completed by the user.
+ """
+
+ first_series_disengagement: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The first time the series this message was a part of was disengaged by the user.
+ """
+
+ first_series_exit: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The first time the series this message was a part of was exited by the user.
+ """
+
+ first_goal_success: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The first time the user met this messages associated goal if one exists.
+ """
+
+ first_open: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The first time the user opened this message.
+ """
+
+ first_click: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The first time the series the user clicked on a link within this message.
+ """
+
+ first_dismisall: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The first time the series the user dismissed this message.
+ """
+
+ first_unsubscribe: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The first time the user unsubscribed from this message.
+ """
+
+ first_hard_bounce: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The first time this message hard bounced for this user
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/datetime.py b/src/intercom/unstable/types/datetime.py
new file mode 100644
index 0000000..97bfdac
--- /dev/null
+++ b/src/intercom/unstable/types/datetime.py
@@ -0,0 +1,6 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import datetime as dt
+import typing
+
+Datetime = typing.Union[dt.datetime, int]
diff --git a/src/intercom/unstable/types/deleted_article_object.py b/src/intercom/unstable/types/deleted_article_object.py
new file mode 100644
index 0000000..37a646f
--- /dev/null
+++ b/src/intercom/unstable/types/deleted_article_object.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class DeletedArticleObject(UncheckedBaseModel):
+ """
+ Response returned when an object is deleted
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique identifier for the article which you provided in the URL.
+ """
+
+ object: typing.Optional[typing.Literal["article"]] = pydantic.Field(default=None)
+ """
+ The type of object which was deleted. - article
+ """
+
+ deleted: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the article was deleted successfully or not.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/deleted_collection_object.py b/src/intercom/unstable/types/deleted_collection_object.py
new file mode 100644
index 0000000..a2889b0
--- /dev/null
+++ b/src/intercom/unstable/types/deleted_collection_object.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class DeletedCollectionObject(UncheckedBaseModel):
+ """
+ Response returned when an object is deleted
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique identifier for the collection which you provided in the URL.
+ """
+
+ object: typing.Optional[typing.Literal["collection"]] = pydantic.Field(default=None)
+ """
+ The type of object which was deleted. - `collection`
+ """
+
+ deleted: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the collection was deleted successfully or not.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/deleted_company_object.py b/src/intercom/unstable/types/deleted_company_object.py
new file mode 100644
index 0000000..88701bd
--- /dev/null
+++ b/src/intercom/unstable/types/deleted_company_object.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class DeletedCompanyObject(UncheckedBaseModel):
+ """
+ Response returned when an object is deleted
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique identifier for the company which is given by Intercom.
+ """
+
+ object: typing.Optional[typing.Literal["company"]] = pydantic.Field(default=None)
+ """
+ The type of object which was deleted. - `company`
+ """
+
+ deleted: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the company was deleted successfully or not.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/deleted_object.py b/src/intercom/unstable/types/deleted_object.py
new file mode 100644
index 0000000..8b1c749
--- /dev/null
+++ b/src/intercom/unstable/types/deleted_object.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class DeletedObject(UncheckedBaseModel):
+ """
+ Response returned when an object is deleted
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique identifier for the news item which you provided in the URL.
+ """
+
+ object: typing.Optional[typing.Literal["news-item"]] = pydantic.Field(default=None)
+ """
+ The type of object which was deleted - news-item.
+ """
+
+ deleted: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the news item was deleted successfully or not.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/email_address_header.py b/src/intercom/unstable/types/email_address_header.py
new file mode 100644
index 0000000..7b40706
--- /dev/null
+++ b/src/intercom/unstable/types/email_address_header.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class EmailAddressHeader(UncheckedBaseModel):
+ """
+ Contains data for an email address header for a conversation part that was sent as an email.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of email address header
+ """
+
+ email_address: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The email address
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name associated with the email address
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/email_message_metadata.py b/src/intercom/unstable/types/email_message_metadata.py
new file mode 100644
index 0000000..e3a7ac3
--- /dev/null
+++ b/src/intercom/unstable/types/email_message_metadata.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .email_address_header import EmailAddressHeader
+
+
+class EmailMessageMetadata(UncheckedBaseModel):
+ """
+ Contains metadata if the message was sent as an email
+ """
+
+ subject: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The subject of the email
+ """
+
+ email_address_headers: typing.Optional[typing.List[EmailAddressHeader]] = pydantic.Field(default=None)
+ """
+ A list of an email address headers.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/error.py b/src/intercom/unstable/types/error.py
new file mode 100644
index 0000000..f60dc28
--- /dev/null
+++ b/src/intercom/unstable/types/error.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .error_errors_item import ErrorErrorsItem
+
+
+class Error(UncheckedBaseModel):
+ """
+ The API will return an Error List for a failed request, which will contain one or more Error objects.
+ """
+
+ type: str = pydantic.Field()
+ """
+ The type is error.list
+ """
+
+ request_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+
+ """
+
+ errors: typing.List[ErrorErrorsItem] = pydantic.Field()
+ """
+ An array of one or more error objects
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/error_errors_item.py b/src/intercom/unstable/types/error_errors_item.py
new file mode 100644
index 0000000..c0bc619
--- /dev/null
+++ b/src/intercom/unstable/types/error_errors_item.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class ErrorErrorsItem(UncheckedBaseModel):
+ code: str = pydantic.Field()
+ """
+ A string indicating the kind of error, used to further qualify the HTTP response code
+ """
+
+ message: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Optional. Human readable description of the error.
+ """
+
+ field: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Optional. Used to identify a particular field or query parameter that was in error.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/event_details.py b/src/intercom/unstable/types/event_details.py
new file mode 100644
index 0000000..2bef222
--- /dev/null
+++ b/src/intercom/unstable/types/event_details.py
@@ -0,0 +1,17 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from .conversation_attribute_updated_by_admin import ConversationAttributeUpdatedByAdmin
+from .conversation_attribute_updated_by_workflow import ConversationAttributeUpdatedByWorkflow
+from .custom_action_finished import CustomActionFinished
+from .custom_action_started import CustomActionStarted
+from .operator_workflow_event import OperatorWorkflowEvent
+
+EventDetails = typing.Union[
+ ConversationAttributeUpdatedByWorkflow,
+ ConversationAttributeUpdatedByAdmin,
+ CustomActionStarted,
+ CustomActionFinished,
+ OperatorWorkflowEvent,
+]
diff --git a/src/intercom/unstable/types/file_attribute.py b/src/intercom/unstable/types/file_attribute.py
new file mode 100644
index 0000000..0d9f92d
--- /dev/null
+++ b/src/intercom/unstable/types/file_attribute.py
@@ -0,0 +1,53 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class FileAttribute(UncheckedBaseModel):
+ """
+ The value describing a file upload set for a custom attribute
+ """
+
+ type: typing.Optional[str] = None
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the file
+ """
+
+ url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The url of the file. This is a temporary URL and will expire after 30 minutes.
+ """
+
+ content_type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of file
+ """
+
+ filesize: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The size of the file in bytes
+ """
+
+ width: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The width of the file in pixels, if applicable
+ """
+
+ height: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The height of the file in pixels, if applicable
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/group_content.py b/src/intercom/unstable/types/group_content.py
new file mode 100644
index 0000000..b9661ee
--- /dev/null
+++ b/src/intercom/unstable/types/group_content.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class GroupContent(UncheckedBaseModel):
+ """
+ The Content of a Group.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object - `group_content` .
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the collection or section.
+ """
+
+ description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The description of the collection. Only available for collections.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/group_translated_content.py b/src/intercom/unstable/types/group_translated_content.py
new file mode 100644
index 0000000..2ce3b55
--- /dev/null
+++ b/src/intercom/unstable/types/group_translated_content.py
@@ -0,0 +1,221 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.serialization import FieldMetadata
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .group_content import GroupContent
+
+
+class GroupTranslatedContent(UncheckedBaseModel):
+ """
+ The Translated Content of an Group. The keys are the locale codes and the values are the translated content of the Group.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of object - group_translated_content.
+ """
+
+ ar: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Arabic
+ """
+
+ bg: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Bulgarian
+ """
+
+ bs: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Bosnian
+ """
+
+ ca: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Catalan
+ """
+
+ cs: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Czech
+ """
+
+ da: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Danish
+ """
+
+ de: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in German
+ """
+
+ el: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Greek
+ """
+
+ en: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in English
+ """
+
+ es: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Spanish
+ """
+
+ et: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Estonian
+ """
+
+ fi: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Finnish
+ """
+
+ fr: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in French
+ """
+
+ he: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Hebrew
+ """
+
+ hr: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Croatian
+ """
+
+ hu: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Hungarian
+ """
+
+ id: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Indonesian
+ """
+
+ it: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Italian
+ """
+
+ ja: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Japanese
+ """
+
+ ko: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Korean
+ """
+
+ lt: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Lithuanian
+ """
+
+ lv: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Latvian
+ """
+
+ mn: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Mongolian
+ """
+
+ nb: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Norwegian
+ """
+
+ nl: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Dutch
+ """
+
+ pl: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Polish
+ """
+
+ pt: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Portuguese (Portugal)
+ """
+
+ ro: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Romanian
+ """
+
+ ru: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Russian
+ """
+
+ sl: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Slovenian
+ """
+
+ sr: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Serbian
+ """
+
+ sv: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Swedish
+ """
+
+ tr: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Turkish
+ """
+
+ vi: typing.Optional[GroupContent] = pydantic.Field(default=None)
+ """
+ The content of the group in Vietnamese
+ """
+
+ pt_br: typing_extensions.Annotated[typing.Optional[GroupContent], FieldMetadata(alias="pt-BR")] = pydantic.Field(
+ default=None
+ )
+ """
+ The content of the group in Portuguese (Brazil)
+ """
+
+ zh_cn: typing_extensions.Annotated[typing.Optional[GroupContent], FieldMetadata(alias="zh-CN")] = pydantic.Field(
+ default=None
+ )
+ """
+ The content of the group in Chinese (China)
+ """
+
+ zh_tw: typing_extensions.Annotated[typing.Optional[GroupContent], FieldMetadata(alias="zh-TW")] = pydantic.Field(
+ default=None
+ )
+ """
+ The content of the group in Chinese (Taiwan)
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/intercom_version.py b/src/intercom/unstable/types/intercom_version.py
new file mode 100644
index 0000000..85214bf
--- /dev/null
+++ b/src/intercom/unstable/types/intercom_version.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+IntercomVersion = typing.Union[
+ typing.Literal[
+ "1.0",
+ "1.1",
+ "1.2",
+ "1.3",
+ "1.4",
+ "2.0",
+ "2.1",
+ "2.2",
+ "2.3",
+ "2.4",
+ "2.5",
+ "2.6",
+ "2.7",
+ "2.8",
+ "2.9",
+ "2.10",
+ "2.11",
+ "Unstable",
+ ],
+ typing.Any,
+]
diff --git a/src/intercom/unstable/types/intercom_version_unstable.py b/src/intercom/unstable/types/intercom_version_unstable.py
new file mode 100644
index 0000000..569e4f7
--- /dev/null
+++ b/src/intercom/unstable/types/intercom_version_unstable.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+IntercomVersionUnstable = typing.Literal["unstable"]
diff --git a/src/intercom/unstable/types/linked_object.py b/src/intercom/unstable/types/linked_object.py
new file mode 100644
index 0000000..fdb45ba
--- /dev/null
+++ b/src/intercom/unstable/types/linked_object.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .linked_object_type import LinkedObjectType
+
+
+class LinkedObject(UncheckedBaseModel):
+ """
+ A linked conversation or ticket.
+ """
+
+ type: typing.Optional[LinkedObjectType] = pydantic.Field(default=None)
+ """
+ ticket or conversation
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The ID of the linked object
+ """
+
+ category: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Category of the Linked Ticket Object.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/linked_object_list.py b/src/intercom/unstable/types/linked_object_list.py
new file mode 100644
index 0000000..6650b8b
--- /dev/null
+++ b/src/intercom/unstable/types/linked_object_list.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .linked_object import LinkedObject
+
+
+class LinkedObjectList(UncheckedBaseModel):
+ """
+ An object containing metadata about linked conversations and linked tickets. Up to 1000 can be returned.
+ """
+
+ type: typing.Optional[typing.Literal["list"]] = pydantic.Field(default=None)
+ """
+ Always list.
+ """
+
+ total_count: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The total number of linked objects.
+ """
+
+ has_more: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether or not there are more linked objects than returned.
+ """
+
+ data: typing.Optional[typing.List[LinkedObject]] = pydantic.Field(default=None)
+ """
+ An array containing the linked conversations and linked tickets.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/linked_object_type.py b/src/intercom/unstable/types/linked_object_type.py
new file mode 100644
index 0000000..16749f1
--- /dev/null
+++ b/src/intercom/unstable/types/linked_object_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+LinkedObjectType = typing.Union[typing.Literal["ticket", "conversation"], typing.Any]
diff --git a/src/intercom/unstable/types/multiple_filter_search_request.py b/src/intercom/unstable/types/multiple_filter_search_request.py
new file mode 100644
index 0000000..0b8cf3f
--- /dev/null
+++ b/src/intercom/unstable/types/multiple_filter_search_request.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .multiple_filter_search_request_operator import MultipleFilterSearchRequestOperator
+
+
+class MultipleFilterSearchRequest(UncheckedBaseModel):
+ """
+ Search using Intercoms Search APIs with more than one filter.
+ """
+
+ operator: typing.Optional[MultipleFilterSearchRequestOperator] = pydantic.Field(default=None)
+ """
+ An operator to allow boolean inspection between multiple fields.
+ """
+
+ value: typing.Optional["MultipleFilterSearchRequestValue"] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+from .multiple_filter_search_request_value import MultipleFilterSearchRequestValue # noqa: E402, F401, I001
+
+update_forward_refs(MultipleFilterSearchRequest)
diff --git a/src/intercom/unstable/types/multiple_filter_search_request_operator.py b/src/intercom/unstable/types/multiple_filter_search_request_operator.py
new file mode 100644
index 0000000..38d4659
--- /dev/null
+++ b/src/intercom/unstable/types/multiple_filter_search_request_operator.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+MultipleFilterSearchRequestOperator = typing.Union[typing.Literal["AND", "OR"], typing.Any]
diff --git a/src/intercom/unstable/types/multiple_filter_search_request_value.py b/src/intercom/unstable/types/multiple_filter_search_request_value.py
new file mode 100644
index 0000000..16a7c59
--- /dev/null
+++ b/src/intercom/unstable/types/multiple_filter_search_request_value.py
@@ -0,0 +1,13 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+from .single_filter_search_request import SingleFilterSearchRequest
+
+if typing.TYPE_CHECKING:
+ from .multiple_filter_search_request import MultipleFilterSearchRequest
+MultipleFilterSearchRequestValue = typing.Union[
+ typing.List["MultipleFilterSearchRequest"], typing.List[SingleFilterSearchRequest]
+]
diff --git a/src/intercom/unstable/types/news_item_request.py b/src/intercom/unstable/types/news_item_request.py
new file mode 100644
index 0000000..714fa5b
--- /dev/null
+++ b/src/intercom/unstable/types/news_item_request.py
@@ -0,0 +1,64 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from ..news.types.newsfeed_assignment import NewsfeedAssignment
+from .news_item_request_state import NewsItemRequestState
+
+
+class NewsItemRequest(UncheckedBaseModel):
+ """
+ A News Item is a content type in Intercom enabling you to announce product updates, company news, promotions, events and more with your customers.
+ """
+
+ title: str = pydantic.Field()
+ """
+ The title of the news item.
+ """
+
+ body: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The news item body, which may contain HTML.
+ """
+
+ sender_id: int = pydantic.Field()
+ """
+ The id of the sender of the news item. Must be a teammate on the workspace.
+ """
+
+ state: typing.Optional[NewsItemRequestState] = pydantic.Field(default=None)
+ """
+ News items will not be visible to your users in the assigned newsfeeds until they are set live.
+ """
+
+ deliver_silently: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ When set to `true`, the news item will appear in the messenger newsfeed without showing a notification badge.
+ """
+
+ labels: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
+ """
+ Label names displayed to users to categorize the news item.
+ """
+
+ reactions: typing.Optional[typing.List[typing.Optional[str]]] = pydantic.Field(default=None)
+ """
+ Ordered list of emoji reactions to the news item. When empty, reactions are disabled.
+ """
+
+ newsfeed_assignments: typing.Optional[typing.List[NewsfeedAssignment]] = pydantic.Field(default=None)
+ """
+ A list of newsfeed_assignments to assign to the specified newsfeed.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/news_item_request_state.py b/src/intercom/unstable/types/news_item_request_state.py
new file mode 100644
index 0000000..0c6a233
--- /dev/null
+++ b/src/intercom/unstable/types/news_item_request_state.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+NewsItemRequestState = typing.Union[typing.Literal["draft", "live"], typing.Any]
diff --git a/src/intercom/unstable/types/not_found_error_body.py b/src/intercom/unstable/types/not_found_error_body.py
new file mode 100644
index 0000000..da3b22b
--- /dev/null
+++ b/src/intercom/unstable/types/not_found_error_body.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .not_found_error_body_errors_item import NotFoundErrorBodyErrorsItem
+
+
+class NotFoundErrorBody(UncheckedBaseModel):
+ type: str = pydantic.Field()
+ """
+ The type is error.list
+ """
+
+ request_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+
+ """
+
+ errors: typing.List[NotFoundErrorBodyErrorsItem] = pydantic.Field()
+ """
+ An array of one or more error objects
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/not_found_error_body_errors_item.py b/src/intercom/unstable/types/not_found_error_body_errors_item.py
new file mode 100644
index 0000000..a79982e
--- /dev/null
+++ b/src/intercom/unstable/types/not_found_error_body_errors_item.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class NotFoundErrorBodyErrorsItem(UncheckedBaseModel):
+ code: str = pydantic.Field()
+ """
+ ticket_not_found
+ """
+
+ message: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Ticket not found
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/note_list.py b/src/intercom/unstable/types/note_list.py
new file mode 100644
index 0000000..bf50406
--- /dev/null
+++ b/src/intercom/unstable/types/note_list.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from ..notes.types.note import Note
+from .cursor_pages import CursorPages
+
+
+class NoteList(UncheckedBaseModel):
+ """
+ A paginated list of notes associated with a contact.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ String representing the object's type. Always has the value `list`.
+ """
+
+ data: typing.Optional[typing.List[Note]] = pydantic.Field(default=None)
+ """
+ An array of notes.
+ """
+
+ total_count: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ A count of the total number of notes.
+ """
+
+ pages: typing.Optional[CursorPages] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/open_conversation_request.py b/src/intercom/unstable/types/open_conversation_request.py
new file mode 100644
index 0000000..87fcfb0
--- /dev/null
+++ b/src/intercom/unstable/types/open_conversation_request.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class OpenConversationRequest(UncheckedBaseModel):
+ """
+ Payload of the request to open a conversation
+ """
+
+ admin_id: str = pydantic.Field()
+ """
+ The id of the admin who is performing the action.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/operator_workflow_event.py b/src/intercom/unstable/types/operator_workflow_event.py
new file mode 100644
index 0000000..5eb98f2
--- /dev/null
+++ b/src/intercom/unstable/types/operator_workflow_event.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .operator_workflow_event_event import OperatorWorkflowEventEvent
+from .operator_workflow_event_workflow import OperatorWorkflowEventWorkflow
+
+
+class OperatorWorkflowEvent(UncheckedBaseModel):
+ """
+ Contains details about name of the workflow for conversation part type operator_workflow_event.
+ """
+
+ workflow: typing.Optional[OperatorWorkflowEventWorkflow] = None
+ event: typing.Optional[OperatorWorkflowEventEvent] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/operator_workflow_event_event.py b/src/intercom/unstable/types/operator_workflow_event_event.py
new file mode 100644
index 0000000..7fba320
--- /dev/null
+++ b/src/intercom/unstable/types/operator_workflow_event_event.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class OperatorWorkflowEventEvent(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Type of the workflow event initiated
+ """
+
+ result: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Result of the workflow event
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/operator_workflow_event_workflow.py b/src/intercom/unstable/types/operator_workflow_event_workflow.py
new file mode 100644
index 0000000..874c0cd
--- /dev/null
+++ b/src/intercom/unstable/types/operator_workflow_event_workflow.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class OperatorWorkflowEventWorkflow(UncheckedBaseModel):
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the workflow
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/pages_link.py b/src/intercom/unstable/types/pages_link.py
new file mode 100644
index 0000000..954bde9
--- /dev/null
+++ b/src/intercom/unstable/types/pages_link.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class PagesLink(UncheckedBaseModel):
+ """
+ The majority of list resources in the API are paginated to allow clients to traverse data over multiple requests.
+
+ Their responses are likely to contain a pages object that hosts pagination links which a client can use to paginate through the data without having to construct a query. The link relations for the pages field are as follows.
+ """
+
+ type: typing.Optional[typing.Literal["pages"]] = None
+ page: typing.Optional[int] = None
+ next: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A link to the next page of results. A response that does not contain a next link does not have further data to fetch.
+ """
+
+ per_page: typing.Optional[int] = None
+ total_pages: typing.Optional[int] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/paginated_response.py b/src/intercom/unstable/types/paginated_response.py
new file mode 100644
index 0000000..9c0287c
--- /dev/null
+++ b/src/intercom/unstable/types/paginated_response.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .cursor_pages import CursorPages
+from .paginated_response_data_item import PaginatedResponseDataItem
+from .paginated_response_type import PaginatedResponseType
+
+
+class PaginatedResponse(UncheckedBaseModel):
+ """
+ Paginated Response
+ """
+
+ type: typing.Optional[PaginatedResponseType] = pydantic.Field(default=None)
+ """
+ The type of object
+ """
+
+ pages: typing.Optional[CursorPages] = None
+ total_count: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ A count of the total number of objects.
+ """
+
+ data: typing.Optional[typing.List[PaginatedResponseDataItem]] = pydantic.Field(default=None)
+ """
+ An array of Objects
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/paginated_response_data_item.py b/src/intercom/unstable/types/paginated_response_data_item.py
new file mode 100644
index 0000000..542c89b
--- /dev/null
+++ b/src/intercom/unstable/types/paginated_response_data_item.py
@@ -0,0 +1,61 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+import typing_extensions
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel, UnionMetadata
+from ..news.types.news_item_state import NewsItemState
+from ..news.types.newsfeed_assignment import NewsfeedAssignment
+
+
+class PaginatedResponseDataItem_NewsItem(UncheckedBaseModel):
+ type: typing.Literal["news-item"] = "news-item"
+ id: typing.Optional[str] = None
+ workspace_id: typing.Optional[str] = None
+ title: typing.Optional[str] = None
+ body: typing.Optional[str] = None
+ sender_id: typing.Optional[int] = None
+ state: typing.Optional[NewsItemState] = None
+ newsfeed_assignments: typing.Optional[typing.List[NewsfeedAssignment]] = None
+ labels: typing.Optional[typing.List[typing.Optional[str]]] = None
+ cover_image_url: typing.Optional[str] = None
+ reactions: typing.Optional[typing.List[typing.Optional[str]]] = None
+ deliver_silently: typing.Optional[bool] = None
+ created_at: typing.Optional[int] = None
+ updated_at: typing.Optional[int] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+class PaginatedResponseDataItem_Newsfeed(UncheckedBaseModel):
+ type: typing.Literal["newsfeed"] = "newsfeed"
+ id: typing.Optional[str] = None
+ name: typing.Optional[str] = None
+ created_at: typing.Optional[int] = None
+ updated_at: typing.Optional[int] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+PaginatedResponseDataItem = typing_extensions.Annotated[
+ typing.Union[PaginatedResponseDataItem_NewsItem, PaginatedResponseDataItem_Newsfeed],
+ UnionMetadata(discriminant="type"),
+]
diff --git a/src/intercom/unstable/types/paginated_response_type.py b/src/intercom/unstable/types/paginated_response_type.py
new file mode 100644
index 0000000..04cce50
--- /dev/null
+++ b/src/intercom/unstable/types/paginated_response_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+PaginatedResponseType = typing.Union[typing.Literal["list", "conversation.list"], typing.Any]
diff --git a/src/intercom/unstable/types/part_attachment.py b/src/intercom/unstable/types/part_attachment.py
new file mode 100644
index 0000000..2277f4c
--- /dev/null
+++ b/src/intercom/unstable/types/part_attachment.py
@@ -0,0 +1,57 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class PartAttachment(UncheckedBaseModel):
+ """
+ The file attached to a part
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of attachment
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the attachment
+ """
+
+ url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The URL of the attachment
+ """
+
+ content_type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The content type of the attachment
+ """
+
+ filesize: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The size of the attachment
+ """
+
+ width: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The width of the attachment
+ """
+
+ height: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The height of the attachment
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/phone_switch.py b/src/intercom/unstable/types/phone_switch.py
new file mode 100644
index 0000000..26ed3d4
--- /dev/null
+++ b/src/intercom/unstable/types/phone_switch.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class PhoneSwitch(UncheckedBaseModel):
+ """
+ Phone Switch Response
+ """
+
+ type: typing.Optional[typing.Literal["phone_call_redirect"]] = pydantic.Field(default=None)
+ """
+
+ """
+
+ phone: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Phone number in E.164 format, that has received the SMS to continue the conversation in the Messenger.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/quick_reply_option.py b/src/intercom/unstable/types/quick_reply_option.py
new file mode 100644
index 0000000..bb886ad
--- /dev/null
+++ b/src/intercom/unstable/types/quick_reply_option.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+import typing_extensions
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.serialization import FieldMetadata
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class QuickReplyOption(UncheckedBaseModel):
+ text: str = pydantic.Field()
+ """
+ The text to display in this quick reply option.
+ """
+
+ uuid_: typing_extensions.Annotated[str, FieldMetadata(alias="uuid")] = pydantic.Field()
+ """
+ A unique identifier for this quick reply option. This value will be available within the metadata of the comment conversation part that is created when a user clicks on this reply option.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/recipient.py b/src/intercom/unstable/types/recipient.py
new file mode 100644
index 0000000..f57ee03
--- /dev/null
+++ b/src/intercom/unstable/types/recipient.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .recipient_type import RecipientType
+
+
+class Recipient(UncheckedBaseModel):
+ """
+ A recipient of a message
+ """
+
+ type: RecipientType = pydantic.Field()
+ """
+ The role associated to the contact - `user` or `lead`.
+ """
+
+ id: str = pydantic.Field()
+ """
+ The identifier for the contact which is given by Intercom.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/recipient_type.py b/src/intercom/unstable/types/recipient_type.py
new file mode 100644
index 0000000..f423fd0
--- /dev/null
+++ b/src/intercom/unstable/types/recipient_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+RecipientType = typing.Union[typing.Literal["user", "lead"], typing.Any]
diff --git a/src/intercom/unstable/types/redact_conversation_request.py b/src/intercom/unstable/types/redact_conversation_request.py
new file mode 100644
index 0000000..155d64e
--- /dev/null
+++ b/src/intercom/unstable/types/redact_conversation_request.py
@@ -0,0 +1,46 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+import typing_extensions
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel, UnionMetadata
+
+
+class RedactConversationRequest_ConversationPart(UncheckedBaseModel):
+ type: typing.Literal["conversation_part"] = "conversation_part"
+ conversation_id: str
+ conversation_part_id: str
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+class RedactConversationRequest_Source(UncheckedBaseModel):
+ type: typing.Literal["source"] = "source"
+ conversation_id: str
+ source_id: str
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+RedactConversationRequest = typing_extensions.Annotated[
+ typing.Union[RedactConversationRequest_ConversationPart, RedactConversationRequest_Source],
+ UnionMetadata(discriminant="type"),
+]
diff --git a/src/intercom/unstable/types/redact_conversation_request_conversation_part.py b/src/intercom/unstable/types/redact_conversation_request_conversation_part.py
new file mode 100644
index 0000000..c9323de
--- /dev/null
+++ b/src/intercom/unstable/types/redact_conversation_request_conversation_part.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class RedactConversationRequestConversationPart(UncheckedBaseModel):
+ """
+ Payload of the request to redact a conversation part
+ """
+
+ conversation_id: str = pydantic.Field()
+ """
+ The id of the conversation.
+ """
+
+ conversation_part_id: str = pydantic.Field()
+ """
+ The id of the conversation_part.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/redact_conversation_request_source.py b/src/intercom/unstable/types/redact_conversation_request_source.py
new file mode 100644
index 0000000..0c29755
--- /dev/null
+++ b/src/intercom/unstable/types/redact_conversation_request_source.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class RedactConversationRequestSource(UncheckedBaseModel):
+ """
+ Payload of the request to redact a conversation source
+ """
+
+ conversation_id: str = pydantic.Field()
+ """
+ The id of the conversation.
+ """
+
+ source_id: str = pydantic.Field()
+ """
+ The id of the source.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/reference.py b/src/intercom/unstable/types/reference.py
new file mode 100644
index 0000000..3718aa8
--- /dev/null
+++ b/src/intercom/unstable/types/reference.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class Reference(UncheckedBaseModel):
+ """
+ reference to another object
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/reply_conversation_request_body.py b/src/intercom/unstable/types/reply_conversation_request_body.py
new file mode 100644
index 0000000..f8070ea
--- /dev/null
+++ b/src/intercom/unstable/types/reply_conversation_request_body.py
@@ -0,0 +1,8 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from .admin_reply_conversation_request import AdminReplyConversationRequest
+from .contact_reply_conversation_request import ContactReplyConversationRequest
+
+ReplyConversationRequestBody = typing.Union[ContactReplyConversationRequest, AdminReplyConversationRequest]
diff --git a/src/intercom/unstable/types/search_request.py b/src/intercom/unstable/types/search_request.py
new file mode 100644
index 0000000..f81337c
--- /dev/null
+++ b/src/intercom/unstable/types/search_request.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .search_request_query import SearchRequestQuery
+from .starting_after_paging import StartingAfterPaging
+
+
+class SearchRequest(UncheckedBaseModel):
+ """
+ Search using Intercoms Search APIs.
+ """
+
+ query: SearchRequestQuery
+ pagination: typing.Optional[StartingAfterPaging] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
+
+
+from .multiple_filter_search_request import MultipleFilterSearchRequest # noqa: E402, F401, I001
+
+update_forward_refs(SearchRequest)
diff --git a/src/intercom/unstable/types/search_request_query.py b/src/intercom/unstable/types/search_request_query.py
new file mode 100644
index 0000000..c338cbe
--- /dev/null
+++ b/src/intercom/unstable/types/search_request_query.py
@@ -0,0 +1,8 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from .multiple_filter_search_request import MultipleFilterSearchRequest
+from .single_filter_search_request import SingleFilterSearchRequest
+
+SearchRequestQuery = typing.Union[SingleFilterSearchRequest, MultipleFilterSearchRequest]
diff --git a/src/intercom/unstable/types/segment_list.py b/src/intercom/unstable/types/segment_list.py
new file mode 100644
index 0000000..870b243
--- /dev/null
+++ b/src/intercom/unstable/types/segment_list.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from ..segments.types.segment import Segment
+
+
+class SegmentList(UncheckedBaseModel):
+ """
+ This will return a list of Segment Objects. The result may also have a pages object if the response is paginated.
+ """
+
+ type: typing.Optional[typing.Literal["segment.list"]] = pydantic.Field(default=None)
+ """
+ The type of the object
+ """
+
+ segments: typing.Optional[typing.List[Segment]] = pydantic.Field(default=None)
+ """
+ A list of Segment objects
+ """
+
+ pages: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
+ """
+ A pagination object, which may be empty, indicating no further pages to fetch.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/single_filter_search_request.py b/src/intercom/unstable/types/single_filter_search_request.py
new file mode 100644
index 0000000..94a3e41
--- /dev/null
+++ b/src/intercom/unstable/types/single_filter_search_request.py
@@ -0,0 +1,39 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .single_filter_search_request_operator import SingleFilterSearchRequestOperator
+from .single_filter_search_request_value import SingleFilterSearchRequestValue
+
+
+class SingleFilterSearchRequest(UncheckedBaseModel):
+ """
+ Search using Intercoms Search APIs with a single filter.
+ """
+
+ field: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The accepted field that you want to search on.
+ """
+
+ operator: typing.Optional[SingleFilterSearchRequestOperator] = pydantic.Field(default=None)
+ """
+ The accepted operators you can use to define how you want to search for the value.
+ """
+
+ value: typing.Optional[SingleFilterSearchRequestValue] = pydantic.Field(default=None)
+ """
+ The value that you want to search on.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/single_filter_search_request_operator.py b/src/intercom/unstable/types/single_filter_search_request_operator.py
new file mode 100644
index 0000000..095ff01
--- /dev/null
+++ b/src/intercom/unstable/types/single_filter_search_request_operator.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+SingleFilterSearchRequestOperator = typing.Union[typing.Literal["=", "!=", "IN", "NIN", "<", ">"], typing.Any]
diff --git a/src/intercom/unstable/types/single_filter_search_request_value.py b/src/intercom/unstable/types/single_filter_search_request_value.py
new file mode 100644
index 0000000..fcabc57
--- /dev/null
+++ b/src/intercom/unstable/types/single_filter_search_request_value.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from .single_filter_search_request_value_item import SingleFilterSearchRequestValueItem
+
+SingleFilterSearchRequestValue = typing.Union[str, int, typing.List[SingleFilterSearchRequestValueItem]]
diff --git a/src/intercom/unstable/types/single_filter_search_request_value_item.py b/src/intercom/unstable/types/single_filter_search_request_value_item.py
new file mode 100644
index 0000000..b921bab
--- /dev/null
+++ b/src/intercom/unstable/types/single_filter_search_request_value_item.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+SingleFilterSearchRequestValueItem = typing.Union[str, int]
diff --git a/src/intercom/unstable/types/sla_applied.py b/src/intercom/unstable/types/sla_applied.py
new file mode 100644
index 0000000..7a08050
--- /dev/null
+++ b/src/intercom/unstable/types/sla_applied.py
@@ -0,0 +1,42 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .sla_applied_sla_status import SlaAppliedSlaStatus
+
+
+class SlaApplied(UncheckedBaseModel):
+ """
+ The SLA Applied object contains the details for which SLA has been applied to this conversation.
+ Important: if there are any canceled sla_events for the conversation - meaning an SLA has been manually removed from a conversation, the sla_status will always be returned as null.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ object type
+ """
+
+ sla_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the SLA as given by the teammate when it was created.
+ """
+
+ sla_status: typing.Optional[SlaAppliedSlaStatus] = pydantic.Field(default=None)
+ """
+ SLA statuses:
+ - `hit`: If there’s at least one hit event in the underlying sla_events table, and no “missed” or “canceled” events for the conversation.
+ - `missed`: If there are any missed sla_events for the conversation and no canceled events. If there’s even a single missed sla event, the status will always be missed. A missed status is not applied when the SLA expires, only the next time a teammate replies.
+ - `active`: An SLA has been applied to a conversation, but has not yet been fulfilled. SLA status is active only if there are no “hit, “missed”, or “canceled” events.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/sla_applied_sla_status.py b/src/intercom/unstable/types/sla_applied_sla_status.py
new file mode 100644
index 0000000..c2ad85a
--- /dev/null
+++ b/src/intercom/unstable/types/sla_applied_sla_status.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+SlaAppliedSlaStatus = typing.Union[typing.Literal["hit", "missed", "cancelled", "active"], typing.Any]
diff --git a/src/intercom/unstable/types/snooze_conversation_request.py b/src/intercom/unstable/types/snooze_conversation_request.py
new file mode 100644
index 0000000..15cafd1
--- /dev/null
+++ b/src/intercom/unstable/types/snooze_conversation_request.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class SnoozeConversationRequest(UncheckedBaseModel):
+ """
+ Payload of the request to snooze a conversation
+ """
+
+ admin_id: str = pydantic.Field()
+ """
+ The id of the admin who is performing the action.
+ """
+
+ snoozed_until: int = pydantic.Field()
+ """
+ The time you want the conversation to reopen.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/social_profile.py b/src/intercom/unstable/types/social_profile.py
new file mode 100644
index 0000000..f4473ff
--- /dev/null
+++ b/src/intercom/unstable/types/social_profile.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class SocialProfile(UncheckedBaseModel):
+ """
+ A Social Profile allows you to label your contacts, companies, and conversations and list them using that Social Profile.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ value is "social_profile"
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the Social media profile
+ """
+
+ url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the Social media profile
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/starting_after_paging.py b/src/intercom/unstable/types/starting_after_paging.py
new file mode 100644
index 0000000..708069e
--- /dev/null
+++ b/src/intercom/unstable/types/starting_after_paging.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class StartingAfterPaging(UncheckedBaseModel):
+ per_page: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The number of results to fetch per page.
+ """
+
+ starting_after: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The cursor to use in the next request to get the next page of results.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/subscription_type_list.py b/src/intercom/unstable/types/subscription_type_list.py
new file mode 100644
index 0000000..1a1bbad
--- /dev/null
+++ b/src/intercom/unstable/types/subscription_type_list.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from ..subscription_types.types.subscription_type import SubscriptionType
+
+
+class SubscriptionTypeList(UncheckedBaseModel):
+ """
+ A list of subscription type objects.
+ """
+
+ type: typing.Optional[typing.Literal["list"]] = pydantic.Field(default=None)
+ """
+ The type of the object
+ """
+
+ data: typing.Optional[typing.List[SubscriptionType]] = pydantic.Field(default=None)
+ """
+ A list of subscription type objects associated with the workspace .
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/tag_company_request.py b/src/intercom/unstable/types/tag_company_request.py
new file mode 100644
index 0000000..56b5ef2
--- /dev/null
+++ b/src/intercom/unstable/types/tag_company_request.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .tag_company_request_companies_item import TagCompanyRequestCompaniesItem
+
+
+class TagCompanyRequest(UncheckedBaseModel):
+ """
+ You can tag a single company or a list of companies.
+ """
+
+ name: str = pydantic.Field()
+ """
+ The name of the tag, which will be created if not found.
+ """
+
+ companies: typing.List[TagCompanyRequestCompaniesItem] = pydantic.Field()
+ """
+ The id or company_id of the company can be passed as input parameters.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/tag_company_request_companies_item.py b/src/intercom/unstable/types/tag_company_request_companies_item.py
new file mode 100644
index 0000000..5b6d7d3
--- /dev/null
+++ b/src/intercom/unstable/types/tag_company_request_companies_item.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class TagCompanyRequestCompaniesItem(UncheckedBaseModel):
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Intercom defined id representing the company.
+ """
+
+ company_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The company id you have defined for the company.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/tag_list.py b/src/intercom/unstable/types/tag_list.py
new file mode 100644
index 0000000..07f5af7
--- /dev/null
+++ b/src/intercom/unstable/types/tag_list.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from ..tags.types.tag import Tag
+
+
+class TagList(UncheckedBaseModel):
+ """
+ A list of tags objects in the workspace.
+ """
+
+ type: typing.Optional[typing.Literal["list"]] = pydantic.Field(default=None)
+ """
+ The type of the object
+ """
+
+ data: typing.Optional[typing.List[Tag]] = pydantic.Field(default=None)
+ """
+ A list of tags objects associated with the workspace .
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/tag_multiple_users_request.py b/src/intercom/unstable/types/tag_multiple_users_request.py
new file mode 100644
index 0000000..d95c625
--- /dev/null
+++ b/src/intercom/unstable/types/tag_multiple_users_request.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .tag_multiple_users_request_users_item import TagMultipleUsersRequestUsersItem
+
+
+class TagMultipleUsersRequest(UncheckedBaseModel):
+ """
+ You can tag a list of users.
+ """
+
+ name: str = pydantic.Field()
+ """
+ The name of the tag, which will be created if not found.
+ """
+
+ users: typing.List[TagMultipleUsersRequestUsersItem]
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/tag_multiple_users_request_users_item.py b/src/intercom/unstable/types/tag_multiple_users_request_users_item.py
new file mode 100644
index 0000000..06bc45d
--- /dev/null
+++ b/src/intercom/unstable/types/tag_multiple_users_request_users_item.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class TagMultipleUsersRequestUsersItem(UncheckedBaseModel):
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Intercom defined id representing the user.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/tags.py b/src/intercom/unstable/types/tags.py
new file mode 100644
index 0000000..9cb790b
--- /dev/null
+++ b/src/intercom/unstable/types/tags.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from ..tags.types.tag import Tag
+
+
+class Tags(UncheckedBaseModel):
+ """
+ A list of tags objects associated with a conversation
+ """
+
+ type: typing.Optional[typing.Literal["tag.list"]] = pydantic.Field(default=None)
+ """
+ The type of the object
+ """
+
+ tags: typing.Optional[typing.List[Tag]] = pydantic.Field(default=None)
+ """
+ A list of tags objects associated with the conversation.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/team_list.py b/src/intercom/unstable/types/team_list.py
new file mode 100644
index 0000000..a7f8ce6
--- /dev/null
+++ b/src/intercom/unstable/types/team_list.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from ..teams.types.team import Team
+
+
+class TeamList(UncheckedBaseModel):
+ """
+ This will return a list of team objects for the App.
+ """
+
+ type: typing.Optional[typing.Literal["team.list"]] = pydantic.Field(default=None)
+ """
+ The type of the object
+ """
+
+ teams: typing.Optional[typing.List[Team]] = pydantic.Field(default=None)
+ """
+ A list of team objects
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/team_priority_level.py b/src/intercom/unstable/types/team_priority_level.py
new file mode 100644
index 0000000..1f0dafc
--- /dev/null
+++ b/src/intercom/unstable/types/team_priority_level.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class TeamPriorityLevel(UncheckedBaseModel):
+ """
+ Admin priority levels for teams
+ """
+
+ primary_team_ids: typing.Optional[typing.List[int]] = pydantic.Field(default=None)
+ """
+ The primary team ids for the team
+ """
+
+ secondary_team_ids: typing.Optional[typing.List[int]] = pydantic.Field(default=None)
+ """
+ The secondary team ids for the team
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/ticket_custom_attributes.py b/src/intercom/unstable/types/ticket_custom_attributes.py
new file mode 100644
index 0000000..bc03bf6
--- /dev/null
+++ b/src/intercom/unstable/types/ticket_custom_attributes.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from .ticket_custom_attributes_value import TicketCustomAttributesValue
+
+TicketCustomAttributes = typing.Dict[str, TicketCustomAttributesValue]
diff --git a/src/intercom/unstable/types/ticket_custom_attributes_value.py b/src/intercom/unstable/types/ticket_custom_attributes_value.py
new file mode 100644
index 0000000..ae7a79c
--- /dev/null
+++ b/src/intercom/unstable/types/ticket_custom_attributes_value.py
@@ -0,0 +1,9 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from .file_attribute import FileAttribute
+
+TicketCustomAttributesValue = typing.Union[
+ typing.Optional[str], float, bool, typing.List[typing.Optional[typing.Any]], FileAttribute
+]
diff --git a/src/intercom/unstable/types/ticket_list.py b/src/intercom/unstable/types/ticket_list.py
new file mode 100644
index 0000000..e1d1cba
--- /dev/null
+++ b/src/intercom/unstable/types/ticket_list.py
@@ -0,0 +1,41 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from ..tickets.types.ticket import Ticket
+from .cursor_pages import CursorPages
+
+
+class TicketList(UncheckedBaseModel):
+ """
+ Tickets are how you track requests from your users.
+ """
+
+ type: typing.Optional[typing.Literal["ticket.list"]] = pydantic.Field(default=None)
+ """
+ Always ticket.list
+ """
+
+ tickets: typing.Optional[typing.List[typing.Optional[Ticket]]] = pydantic.Field(default=None)
+ """
+ The list of ticket objects
+ """
+
+ total_count: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ A count of the total number of objects.
+ """
+
+ pages: typing.Optional[CursorPages] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/ticket_part_author.py b/src/intercom/unstable/types/ticket_part_author.py
new file mode 100644
index 0000000..06ba68d
--- /dev/null
+++ b/src/intercom/unstable/types/ticket_part_author.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .ticket_part_author_type import TicketPartAuthorType
+
+
+class TicketPartAuthor(UncheckedBaseModel):
+ """
+ The author that wrote or triggered the part. Can be a bot, admin, team or user.
+ """
+
+ type: typing.Optional[TicketPartAuthorType] = pydantic.Field(default=None)
+ """
+ The type of the author
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The id of the author
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the author
+ """
+
+ email: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The email of the author
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/ticket_part_author_type.py b/src/intercom/unstable/types/ticket_part_author_type.py
new file mode 100644
index 0000000..1c4aa87
--- /dev/null
+++ b/src/intercom/unstable/types/ticket_part_author_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TicketPartAuthorType = typing.Union[typing.Literal["admin", "bot", "team", "user"], typing.Any]
diff --git a/src/intercom/unstable/types/ticket_parts.py b/src/intercom/unstable/types/ticket_parts.py
new file mode 100644
index 0000000..5ea3508
--- /dev/null
+++ b/src/intercom/unstable/types/ticket_parts.py
@@ -0,0 +1,38 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from ..tickets.types.ticket_part import TicketPart
+
+
+class TicketParts(UncheckedBaseModel):
+ """
+ A list of Ticket Part objects for each note and event in the ticket. There is a limit of 500 parts.
+ """
+
+ type: typing.Optional[typing.Literal["ticket_part.list"]] = pydantic.Field(default=None)
+ """
+
+ """
+
+ ticket_parts: typing.Optional[typing.List[TicketPart]] = pydantic.Field(default=None)
+ """
+ A list of Ticket Part objects for each ticket. There is a limit of 500 parts.
+ """
+
+ total_count: typing.Optional[int] = pydantic.Field(default=None)
+ """
+
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/ticket_reply.py b/src/intercom/unstable/types/ticket_reply.py
new file mode 100644
index 0000000..920f567
--- /dev/null
+++ b/src/intercom/unstable/types/ticket_reply.py
@@ -0,0 +1,66 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .part_attachment import PartAttachment
+from .ticket_part_author import TicketPartAuthor
+from .ticket_reply_part_type import TicketReplyPartType
+
+
+class TicketReply(UncheckedBaseModel):
+ """
+ A Ticket Part representing a note, comment, or quick_reply on a ticket
+ """
+
+ type: typing.Optional[typing.Literal["ticket_part"]] = pydantic.Field(default=None)
+ """
+ Always ticket_part
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The id representing the part.
+ """
+
+ part_type: typing.Optional[TicketReplyPartType] = pydantic.Field(default=None)
+ """
+ Type of the part
+ """
+
+ body: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The message body, which may contain HTML.
+ """
+
+ created_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The time the note was created.
+ """
+
+ updated_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The last time the note was updated.
+ """
+
+ author: typing.Optional[TicketPartAuthor] = None
+ attachments: typing.Optional[typing.List[PartAttachment]] = pydantic.Field(default=None)
+ """
+ A list of attachments for the part.
+ """
+
+ redacted: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether or not the ticket part has been redacted.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/ticket_reply_part_type.py b/src/intercom/unstable/types/ticket_reply_part_type.py
new file mode 100644
index 0000000..c7796a4
--- /dev/null
+++ b/src/intercom/unstable/types/ticket_reply_part_type.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TicketReplyPartType = typing.Union[typing.Literal["note", "comment", "quick_reply"], typing.Any]
diff --git a/src/intercom/unstable/types/ticket_request_custom_attributes.py b/src/intercom/unstable/types/ticket_request_custom_attributes.py
new file mode 100644
index 0000000..10adb7d
--- /dev/null
+++ b/src/intercom/unstable/types/ticket_request_custom_attributes.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from .ticket_request_custom_attributes_value import TicketRequestCustomAttributesValue
+
+TicketRequestCustomAttributes = typing.Dict[str, TicketRequestCustomAttributesValue]
diff --git a/src/intercom/unstable/types/ticket_request_custom_attributes_value.py b/src/intercom/unstable/types/ticket_request_custom_attributes_value.py
new file mode 100644
index 0000000..cc59ef4
--- /dev/null
+++ b/src/intercom/unstable/types/ticket_request_custom_attributes_value.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+TicketRequestCustomAttributesValue = typing.Union[
+ typing.Optional[str], float, bool, typing.List[typing.Optional[typing.Any]]
+]
diff --git a/src/intercom/unstable/types/ticket_state_list.py b/src/intercom/unstable/types/ticket_state_list.py
new file mode 100644
index 0000000..34ef9e3
--- /dev/null
+++ b/src/intercom/unstable/types/ticket_state_list.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from ..tickets.types.ticket_state_detailed import TicketStateDetailed
+
+
+class TicketStateList(UncheckedBaseModel):
+ """
+ A list of ticket states associated with a given ticket type.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ String representing the object's type. Always has the value `list`.
+ """
+
+ data: typing.Optional[typing.List[typing.Optional[TicketStateDetailed]]] = pydantic.Field(default=None)
+ """
+ A list of ticket states associated with a given ticket type.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/ticket_type_attribute.py b/src/intercom/unstable/types/ticket_type_attribute.py
new file mode 100644
index 0000000..24e7a8e
--- /dev/null
+++ b/src/intercom/unstable/types/ticket_type_attribute.py
@@ -0,0 +1,107 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class TicketTypeAttribute(UncheckedBaseModel):
+ """
+ Ticket type attribute, used to define each data field to be captured in a ticket.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ String representing the object's type. Always has the value `ticket_type_attribute`.
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The id representing the ticket type attribute.
+ """
+
+ workspace_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The id of the workspace that the ticket type attribute belongs to.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the ticket type attribute
+ """
+
+ description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The description of the ticket type attribute
+ """
+
+ data_type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of the data attribute (allowed values: "string list integer decimal boolean datetime files")
+ """
+
+ input_options: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
+ """
+ Input options for the attribute
+ """
+
+ order: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The order of the attribute against other attributes
+ """
+
+ required_to_create: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the attribute is required or not for teammates.
+ """
+
+ required_to_create_for_contacts: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the attribute is required or not for contacts.
+ """
+
+ visible_on_create: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the attribute is visible or not to teammates.
+ """
+
+ visible_to_contacts: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the attribute is visible or not to contacts.
+ """
+
+ default: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the attribute is built in or not.
+ """
+
+ ticket_type_id: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The id of the ticket type that the attribute belongs to.
+ """
+
+ archived: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the ticket type attribute is archived or not.
+ """
+
+ created_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The date and time the ticket type attribute was created.
+ """
+
+ updated_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The date and time the ticket type attribute was last updated.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/ticket_type_attribute_list.py b/src/intercom/unstable/types/ticket_type_attribute_list.py
new file mode 100644
index 0000000..4578ce7
--- /dev/null
+++ b/src/intercom/unstable/types/ticket_type_attribute_list.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .ticket_type_attribute import TicketTypeAttribute
+
+
+class TicketTypeAttributeList(UncheckedBaseModel):
+ """
+ A list of attributes associated with a given ticket type.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ String representing the object's type. Always has the value `ticket_type_attributes.list`.
+ """
+
+ ticket_type_attributes: typing.Optional[typing.List[typing.Optional[TicketTypeAttribute]]] = pydantic.Field(
+ default=None
+ )
+ """
+ A list of ticket type attributes associated with a given ticket type.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/ticket_type_list.py b/src/intercom/unstable/types/ticket_type_list.py
new file mode 100644
index 0000000..79dd5bf
--- /dev/null
+++ b/src/intercom/unstable/types/ticket_type_list.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from ..tickets.types.ticket_type import TicketType
+
+
+class TicketTypeList(UncheckedBaseModel):
+ """
+ A list of ticket types associated with a given workspace.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ String representing the object's type. Always has the value `list`.
+ """
+
+ data: typing.Optional[typing.List[typing.Optional[TicketType]]] = pydantic.Field(default=None)
+ """
+ A list of ticket_types associated with a given workspace.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/translation.py b/src/intercom/unstable/types/translation.py
new file mode 100644
index 0000000..2b8b3f3
--- /dev/null
+++ b/src/intercom/unstable/types/translation.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class Translation(UncheckedBaseModel):
+ """
+ A translation object contains the localised details of a subscription type.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The localised name of the subscription type.
+ """
+
+ description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The localised description of the subscription type.
+ """
+
+ locale: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The two character identifier for the language of the translation object.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/untag_company_request.py b/src/intercom/unstable/types/untag_company_request.py
new file mode 100644
index 0000000..2bc2f0c
--- /dev/null
+++ b/src/intercom/unstable/types/untag_company_request.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .untag_company_request_companies_item import UntagCompanyRequestCompaniesItem
+
+
+class UntagCompanyRequest(UncheckedBaseModel):
+ """
+ You can tag a single company or a list of companies.
+ """
+
+ name: str = pydantic.Field()
+ """
+ The name of the tag which will be untagged from the company
+ """
+
+ companies: typing.List[UntagCompanyRequestCompaniesItem] = pydantic.Field()
+ """
+ The id or company_id of the company can be passed as input parameters.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/untag_company_request_companies_item.py b/src/intercom/unstable/types/untag_company_request_companies_item.py
new file mode 100644
index 0000000..15dfb32
--- /dev/null
+++ b/src/intercom/unstable/types/untag_company_request_companies_item.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class UntagCompanyRequestCompaniesItem(UncheckedBaseModel):
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Intercom defined id representing the company.
+ """
+
+ company_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The company id you have defined for the company.
+ """
+
+ untag: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Always set to true
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/update_article_request_body.py b/src/intercom/unstable/types/update_article_request_body.py
new file mode 100644
index 0000000..504e124
--- /dev/null
+++ b/src/intercom/unstable/types/update_article_request_body.py
@@ -0,0 +1,61 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .article_translated_content import ArticleTranslatedContent
+from .update_article_request_state import UpdateArticleRequestState
+
+
+class UpdateArticleRequestBody(UncheckedBaseModel):
+ """
+ You can Update an Article
+ """
+
+ title: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The title of the article.For multilingual articles, this will be the title of the default language's content.
+ """
+
+ description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The description of the article. For multilingual articles, this will be the description of the default language's content.
+ """
+
+ body: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The content of the article. For multilingual articles, this will be the body of the default language's content.
+ """
+
+ author_id: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The id of the author of the article. For multilingual articles, this will be the id of the author of the default language's content. Must be a teammate on the help center's workspace.
+ """
+
+ state: typing.Optional[UpdateArticleRequestState] = pydantic.Field(default=None)
+ """
+ Whether the article will be `published` or will be a `draft`. Defaults to draft. For multilingual articles, this will be the state of the default language's content.
+ """
+
+ parent_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The id of the article's parent collection or section. An article without this field stands alone.
+ """
+
+ parent_type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The type of parent, which can either be a `collection` or `section`.
+ """
+
+ translated_content: typing.Optional[ArticleTranslatedContent] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/update_article_request_state.py b/src/intercom/unstable/types/update_article_request_state.py
new file mode 100644
index 0000000..0e220b9
--- /dev/null
+++ b/src/intercom/unstable/types/update_article_request_state.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+UpdateArticleRequestState = typing.Union[typing.Literal["published", "draft"], typing.Any]
diff --git a/src/intercom/unstable/types/update_ticket_type_request_body.py b/src/intercom/unstable/types/update_ticket_type_request_body.py
new file mode 100644
index 0000000..69b7dbb
--- /dev/null
+++ b/src/intercom/unstable/types/update_ticket_type_request_body.py
@@ -0,0 +1,54 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .update_ticket_type_request_category import UpdateTicketTypeRequestCategory
+
+
+class UpdateTicketTypeRequestBody(UncheckedBaseModel):
+ """
+ The request payload for updating a ticket type.
+ You can copy the `icon` property for your ticket type from [Twemoji Cheatsheet](https://twemoji-cheatsheet.vercel.app/)
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the ticket type.
+ """
+
+ description: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The description of the ticket type.
+ """
+
+ category: typing.Optional[UpdateTicketTypeRequestCategory] = pydantic.Field(default=None)
+ """
+ Category of the Ticket Type.
+ """
+
+ icon: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The icon of the ticket type.
+ """
+
+ archived: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ The archived status of the ticket type.
+ """
+
+ is_internal: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the tickets associated with this ticket type are intended for internal use only or will be shared with customers. This is currently a limited attribute.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/update_ticket_type_request_category.py b/src/intercom/unstable/types/update_ticket_type_request_category.py
new file mode 100644
index 0000000..9dd149e
--- /dev/null
+++ b/src/intercom/unstable/types/update_ticket_type_request_category.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+UpdateTicketTypeRequestCategory = typing.Union[typing.Literal["Customer", "Back-office", "Tracker"], typing.Any]
diff --git a/src/intercom/unstable/types/visitor.py b/src/intercom/unstable/types/visitor.py
new file mode 100644
index 0000000..00ed964
--- /dev/null
+++ b/src/intercom/unstable/types/visitor.py
@@ -0,0 +1,169 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .visitor_avatar import VisitorAvatar
+from .visitor_companies import VisitorCompanies
+from .visitor_location_data import VisitorLocationData
+from .visitor_segments import VisitorSegments
+from .visitor_social_profiles import VisitorSocialProfiles
+from .visitor_tags import VisitorTags
+
+
+class Visitor(UncheckedBaseModel):
+ """
+ Visitors are useful for representing anonymous people that have not yet been identified. They usually represent website visitors. Visitors are not visible in Intercom platform. The Visitors resource provides methods to fetch, update, convert and delete.
+ """
+
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Value is 'visitor'
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Intercom defined id representing the Visitor.
+ """
+
+ user_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Automatically generated identifier for the Visitor.
+ """
+
+ anonymous: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Identifies if this visitor is anonymous.
+ """
+
+ email: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The email of the visitor.
+ """
+
+ phone: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The phone number of the visitor.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the visitor.
+ """
+
+ pseudonym: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The pseudonym of the visitor.
+ """
+
+ avatar: typing.Optional[VisitorAvatar] = None
+ app_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The id of the app the visitor is associated with.
+ """
+
+ companies: typing.Optional[VisitorCompanies] = None
+ location_data: typing.Optional[VisitorLocationData] = None
+ las_request_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The time the Lead last recorded making a request.
+ """
+
+ created_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The time the Visitor was added to Intercom.
+ """
+
+ remote_created_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The time the Visitor was added to Intercom.
+ """
+
+ signed_up_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The time the Visitor signed up for your product.
+ """
+
+ updated_at: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The last time the Visitor was updated.
+ """
+
+ session_count: typing.Optional[int] = pydantic.Field(default=None)
+ """
+ The number of sessions the Visitor has had.
+ """
+
+ social_profiles: typing.Optional[VisitorSocialProfiles] = None
+ owner_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The id of the admin that owns the Visitor.
+ """
+
+ unsubscribed_from_emails: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the Visitor is unsubscribed from emails.
+ """
+
+ marked_email_as_spam: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Identifies if this visitor has marked an email as spam.
+ """
+
+ has_hard_bounced: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Identifies if this visitor has had a hard bounce.
+ """
+
+ tags: typing.Optional[VisitorTags] = None
+ segments: typing.Optional[VisitorSegments] = None
+ custom_attributes: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None)
+ """
+ The custom attributes you have set on the Visitor.
+ """
+
+ referrer: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The referer of the visitor.
+ """
+
+ utm_campaign: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The utm_campaign of the visitor.
+ """
+
+ utm_content: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The utm_content of the visitor.
+ """
+
+ utm_medium: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The utm_medium of the visitor.
+ """
+
+ utm_source: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The utm_source of the visitor.
+ """
+
+ utm_term: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The utm_term of the visitor.
+ """
+
+ do_not_track: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Identifies if this visitor has do not track enabled.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/visitor_avatar.py b/src/intercom/unstable/types/visitor_avatar.py
new file mode 100644
index 0000000..9bf0b25
--- /dev/null
+++ b/src/intercom/unstable/types/visitor_avatar.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class VisitorAvatar(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+
+ """
+
+ image_url: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ This object represents the avatar associated with the visitor.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/visitor_companies.py b/src/intercom/unstable/types/visitor_companies.py
new file mode 100644
index 0000000..8fd9189
--- /dev/null
+++ b/src/intercom/unstable/types/visitor_companies.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from ..companies.types.company import Company
+
+
+class VisitorCompanies(UncheckedBaseModel):
+ type: typing.Optional[typing.Literal["company.list"]] = pydantic.Field(default=None)
+ """
+ The type of the object
+ """
+
+ companies: typing.Optional[typing.List[Company]] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/visitor_deleted_object.py b/src/intercom/unstable/types/visitor_deleted_object.py
new file mode 100644
index 0000000..dd6b98e
--- /dev/null
+++ b/src/intercom/unstable/types/visitor_deleted_object.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class VisitorDeletedObject(UncheckedBaseModel):
+ """
+ Response returned when an object is deleted
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The unique identifier for the visitor which is given by Intercom.
+ """
+
+ type: typing.Optional[typing.Literal["visitor"]] = pydantic.Field(default=None)
+ """
+ The type of object which was deleted
+ """
+
+ user_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Automatically generated identifier for the Visitor.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/visitor_location_data.py b/src/intercom/unstable/types/visitor_location_data.py
new file mode 100644
index 0000000..a681956
--- /dev/null
+++ b/src/intercom/unstable/types/visitor_location_data.py
@@ -0,0 +1,58 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class VisitorLocationData(UncheckedBaseModel):
+ type: typing.Optional[str] = pydantic.Field(default=None)
+ """
+
+ """
+
+ city_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The city name of the visitor.
+ """
+
+ continent_code: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The continent code of the visitor.
+ """
+
+ country_code: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The country code of the visitor.
+ """
+
+ country_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The country name of the visitor.
+ """
+
+ postal_code: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The postal code of the visitor.
+ """
+
+ region_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The region name of the visitor.
+ """
+
+ timezone: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The timezone of the visitor.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/visitor_segments.py b/src/intercom/unstable/types/visitor_segments.py
new file mode 100644
index 0000000..2e8bb86
--- /dev/null
+++ b/src/intercom/unstable/types/visitor_segments.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class VisitorSegments(UncheckedBaseModel):
+ type: typing.Optional[typing.Literal["segment.list"]] = pydantic.Field(default=None)
+ """
+ The type of the object
+ """
+
+ segments: typing.Optional[typing.List[str]] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/visitor_social_profiles.py b/src/intercom/unstable/types/visitor_social_profiles.py
new file mode 100644
index 0000000..c8c56be
--- /dev/null
+++ b/src/intercom/unstable/types/visitor_social_profiles.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class VisitorSocialProfiles(UncheckedBaseModel):
+ type: typing.Optional[typing.Literal["social_profile.list"]] = pydantic.Field(default=None)
+ """
+ The type of the object
+ """
+
+ social_profiles: typing.Optional[typing.List[str]] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/visitor_tags.py b/src/intercom/unstable/types/visitor_tags.py
new file mode 100644
index 0000000..160a8e4
--- /dev/null
+++ b/src/intercom/unstable/types/visitor_tags.py
@@ -0,0 +1,26 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .visitor_tags_tags_item import VisitorTagsTagsItem
+
+
+class VisitorTags(UncheckedBaseModel):
+ type: typing.Optional[typing.Literal["tag.list"]] = pydantic.Field(default=None)
+ """
+ The type of the object
+ """
+
+ tags: typing.Optional[typing.List[VisitorTagsTagsItem]] = None
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/visitor_tags_tags_item.py b/src/intercom/unstable/types/visitor_tags_tags_item.py
new file mode 100644
index 0000000..17d5a21
--- /dev/null
+++ b/src/intercom/unstable/types/visitor_tags_tags_item.py
@@ -0,0 +1,33 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class VisitorTagsTagsItem(UncheckedBaseModel):
+ type: typing.Optional[typing.Literal["tag"]] = pydantic.Field(default=None)
+ """
+ The type of the object
+ """
+
+ id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The id of the tag.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The name of the tag.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/whatsapp_message_status_list.py b/src/intercom/unstable/types/whatsapp_message_status_list.py
new file mode 100644
index 0000000..7681a8a
--- /dev/null
+++ b/src/intercom/unstable/types/whatsapp_message_status_list.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .whatsapp_message_status_list_events_item import WhatsappMessageStatusListEventsItem
+from .whatsapp_message_status_list_pages import WhatsappMessageStatusListPages
+
+
+class WhatsappMessageStatusList(UncheckedBaseModel):
+ type: typing.Literal["list"] = "list"
+ ruleset_id: str = pydantic.Field()
+ """
+ The provided ruleset ID
+ """
+
+ pages: WhatsappMessageStatusListPages
+ total_count: int = pydantic.Field()
+ """
+ Total number of events
+ """
+
+ events: typing.List[WhatsappMessageStatusListEventsItem]
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/whatsapp_message_status_list_events_item.py b/src/intercom/unstable/types/whatsapp_message_status_list_events_item.py
new file mode 100644
index 0000000..669f09d
--- /dev/null
+++ b/src/intercom/unstable/types/whatsapp_message_status_list_events_item.py
@@ -0,0 +1,59 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .whatsapp_message_status_list_events_item_status import WhatsappMessageStatusListEventsItemStatus
+
+
+class WhatsappMessageStatusListEventsItem(UncheckedBaseModel):
+ id: str = pydantic.Field()
+ """
+ Event ID
+ """
+
+ conversation_id: str = pydantic.Field()
+ """
+ ID of the conversation
+ """
+
+ status: WhatsappMessageStatusListEventsItemStatus = pydantic.Field()
+ """
+ Current status of the message
+ """
+
+ type: typing.Literal["broadcast_outbound"] = pydantic.Field(default="broadcast_outbound")
+ """
+ Event type
+ """
+
+ created_at: int = pydantic.Field()
+ """
+ Creation timestamp
+ """
+
+ updated_at: int = pydantic.Field()
+ """
+ Last update timestamp
+ """
+
+ whatsapp_message_id: str = pydantic.Field()
+ """
+ WhatsApp's message identifier
+ """
+
+ template_name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Name of the WhatsApp template used
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/whatsapp_message_status_list_events_item_status.py b/src/intercom/unstable/types/whatsapp_message_status_list_events_item_status.py
new file mode 100644
index 0000000..3db079a
--- /dev/null
+++ b/src/intercom/unstable/types/whatsapp_message_status_list_events_item_status.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+WhatsappMessageStatusListEventsItemStatus = typing.Union[
+ typing.Literal["sent", "delivered", "read", "failed"], typing.Any
+]
diff --git a/src/intercom/unstable/types/whatsapp_message_status_list_pages.py b/src/intercom/unstable/types/whatsapp_message_status_list_pages.py
new file mode 100644
index 0000000..123971b
--- /dev/null
+++ b/src/intercom/unstable/types/whatsapp_message_status_list_pages.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+from .whatsapp_message_status_list_pages_next import WhatsappMessageStatusListPagesNext
+
+
+class WhatsappMessageStatusListPages(UncheckedBaseModel):
+ type: typing.Literal["pages"] = "pages"
+ per_page: int = pydantic.Field()
+ """
+ Number of results per page
+ """
+
+ total_pages: int = pydantic.Field()
+ """
+ Total number of pages
+ """
+
+ next: typing.Optional[WhatsappMessageStatusListPagesNext] = pydantic.Field(default=None)
+ """
+ Information for fetching next page (null if no more pages)
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/types/whatsapp_message_status_list_pages_next.py b/src/intercom/unstable/types/whatsapp_message_status_list_pages_next.py
new file mode 100644
index 0000000..5cfc3d9
--- /dev/null
+++ b/src/intercom/unstable/types/whatsapp_message_status_list_pages_next.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class WhatsappMessageStatusListPagesNext(UncheckedBaseModel):
+ """
+ Information for fetching next page (null if no more pages)
+ """
+
+ starting_after: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Cursor for the next page
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/unstable/visitors/__init__.py b/src/intercom/unstable/visitors/__init__.py
new file mode 100644
index 0000000..5cde020
--- /dev/null
+++ b/src/intercom/unstable/visitors/__init__.py
@@ -0,0 +1,4 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
diff --git a/src/intercom/unstable/visitors/client.py b/src/intercom/unstable/visitors/client.py
new file mode 100644
index 0000000..4e086fa
--- /dev/null
+++ b/src/intercom/unstable/visitors/client.py
@@ -0,0 +1,309 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.request_options import RequestOptions
+from ...types.update_visitor_request_one import UpdateVisitorRequestOne
+from ..contacts.types.contact import Contact
+from ..types.visitor import Visitor
+from .raw_client import AsyncRawVisitorsClient, RawVisitorsClient
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class VisitorsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawVisitorsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawVisitorsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawVisitorsClient
+ """
+ return self._raw_client
+
+ def retrieve_visitor_with_user_id(
+ self, *, user_id: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> typing.Optional[Visitor]:
+ """
+ You can fetch the details of a single visitor.
+
+ Parameters
+ ----------
+ user_id : str
+ The user_id of the Visitor you want to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ typing.Optional[Visitor]
+ successful
+
+ Examples
+ --------
+ from intercom import Intercom
+
+ client = Intercom(
+ token="YOUR_TOKEN",
+ )
+ client.unstable.visitors.retrieve_visitor_with_user_id(
+ user_id="user_id",
+ )
+ """
+ _response = self._raw_client.retrieve_visitor_with_user_id(user_id=user_id, request_options=request_options)
+ return _response.data
+
+ def update_visitor(
+ self, *, request: UpdateVisitorRequestOne, request_options: typing.Optional[RequestOptions] = None
+ ) -> typing.Optional[Visitor]:
+ """
+ Sending a PUT request to `/visitors` will result in an update of an existing Visitor.
+
+ **Option 1.** You can update a visitor by passing in the `user_id` of the visitor in the Request body.
+
+ **Option 2.** You can update a visitor by passing in the `id` of the visitor in the Request body.
+
+ Parameters
+ ----------
+ request : UpdateVisitorRequestOne
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ typing.Optional[Visitor]
+ successful
+
+ Examples
+ --------
+ from intercom import Intercom
+
+ client = Intercom(
+ token="YOUR_TOKEN",
+ )
+ client.unstable.visitors.update_visitor(
+ request={"id": "6762f30c1bb69f9f2193bc5e", "name": "Gareth Bale"},
+ )
+ """
+ _response = self._raw_client.update_visitor(request=request, request_options=request_options)
+ return _response.data
+
+ def convert_visitor(
+ self,
+ *,
+ type: str,
+ user: typing.Optional[typing.Any] = OMIT,
+ visitor: typing.Optional[typing.Any] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> Contact:
+ """
+ You can merge a Visitor to a Contact of role type `lead` or `user`.
+
+ > 📘 What happens upon a visitor being converted?
+ >
+ > If the User exists, then the Visitor will be merged into it, the Visitor deleted and the User returned. If the User does not exist, the Visitor will be converted to a User, with the User identifiers replacing it's Visitor identifiers.
+
+ Parameters
+ ----------
+ type : str
+ Represents the role of the Contact model. Accepts `lead` or `user`.
+
+ user : typing.Optional[typing.Any]
+
+ visitor : typing.Optional[typing.Any]
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ Contact
+ successful
+
+ Examples
+ --------
+ from intercom import Intercom
+
+ client = Intercom(
+ token="YOUR_TOKEN",
+ )
+ client.unstable.visitors.convert_visitor(
+ type="user",
+ user={"email": "foo@bar.com"},
+ visitor={"user_id": "3ecf64d0-9ed1-4e9f-88e1-da7d6e6782f3"},
+ )
+ """
+ _response = self._raw_client.convert_visitor(
+ type=type, user=user, visitor=visitor, request_options=request_options
+ )
+ return _response.data
+
+
+class AsyncVisitorsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawVisitorsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawVisitorsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawVisitorsClient
+ """
+ return self._raw_client
+
+ async def retrieve_visitor_with_user_id(
+ self, *, user_id: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> typing.Optional[Visitor]:
+ """
+ You can fetch the details of a single visitor.
+
+ Parameters
+ ----------
+ user_id : str
+ The user_id of the Visitor you want to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ typing.Optional[Visitor]
+ successful
+
+ Examples
+ --------
+ import asyncio
+
+ from intercom import AsyncIntercom
+
+ client = AsyncIntercom(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.unstable.visitors.retrieve_visitor_with_user_id(
+ user_id="user_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.retrieve_visitor_with_user_id(
+ user_id=user_id, request_options=request_options
+ )
+ return _response.data
+
+ async def update_visitor(
+ self, *, request: UpdateVisitorRequestOne, request_options: typing.Optional[RequestOptions] = None
+ ) -> typing.Optional[Visitor]:
+ """
+ Sending a PUT request to `/visitors` will result in an update of an existing Visitor.
+
+ **Option 1.** You can update a visitor by passing in the `user_id` of the visitor in the Request body.
+
+ **Option 2.** You can update a visitor by passing in the `id` of the visitor in the Request body.
+
+ Parameters
+ ----------
+ request : UpdateVisitorRequestOne
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ typing.Optional[Visitor]
+ successful
+
+ Examples
+ --------
+ import asyncio
+
+ from intercom import AsyncIntercom
+
+ client = AsyncIntercom(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.unstable.visitors.update_visitor(
+ request={"id": "6762f30c1bb69f9f2193bc5e", "name": "Gareth Bale"},
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update_visitor(request=request, request_options=request_options)
+ return _response.data
+
+ async def convert_visitor(
+ self,
+ *,
+ type: str,
+ user: typing.Optional[typing.Any] = OMIT,
+ visitor: typing.Optional[typing.Any] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> Contact:
+ """
+ You can merge a Visitor to a Contact of role type `lead` or `user`.
+
+ > 📘 What happens upon a visitor being converted?
+ >
+ > If the User exists, then the Visitor will be merged into it, the Visitor deleted and the User returned. If the User does not exist, the Visitor will be converted to a User, with the User identifiers replacing it's Visitor identifiers.
+
+ Parameters
+ ----------
+ type : str
+ Represents the role of the Contact model. Accepts `lead` or `user`.
+
+ user : typing.Optional[typing.Any]
+
+ visitor : typing.Optional[typing.Any]
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ Contact
+ successful
+
+ Examples
+ --------
+ import asyncio
+
+ from intercom import AsyncIntercom
+
+ client = AsyncIntercom(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.unstable.visitors.convert_visitor(
+ type="user",
+ user={"email": "foo@bar.com"},
+ visitor={"user_id": "3ecf64d0-9ed1-4e9f-88e1-da7d6e6782f3"},
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.convert_visitor(
+ type=type, user=user, visitor=visitor, request_options=request_options
+ )
+ return _response.data
diff --git a/src/intercom/unstable/visitors/raw_client.py b/src/intercom/unstable/visitors/raw_client.py
new file mode 100644
index 0000000..c28c713
--- /dev/null
+++ b/src/intercom/unstable/visitors/raw_client.py
@@ -0,0 +1,447 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ...core.api_error import ApiError
+from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ...core.http_response import AsyncHttpResponse, HttpResponse
+from ...core.request_options import RequestOptions
+from ...core.unchecked_base_model import construct_type
+from ...types.update_visitor_request_one import UpdateVisitorRequestOne
+from ..contacts.types.contact import Contact
+from ..errors.not_found_error import NotFoundError
+from ..errors.unauthorized_error import UnauthorizedError
+from ..types.error import Error
+from ..types.visitor import Visitor
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawVisitorsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def retrieve_visitor_with_user_id(
+ self, *, user_id: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[typing.Optional[Visitor]]:
+ """
+ You can fetch the details of a single visitor.
+
+ Parameters
+ ----------
+ user_id : str
+ The user_id of the Visitor you want to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[typing.Optional[Visitor]]
+ successful
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "visitors",
+ method="GET",
+ params={
+ "user_id": user_id,
+ },
+ request_options=request_options,
+ )
+ try:
+ if _response is None or not _response.text.strip():
+ return HttpResponse(response=_response, data=None)
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ typing.Optional[Visitor],
+ construct_type(
+ type_=typing.Optional[Visitor], # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ if _response.status_code == 401:
+ raise UnauthorizedError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ Error,
+ construct_type(
+ type_=Error, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 404:
+ raise NotFoundError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Optional[typing.Any],
+ construct_type(
+ type_=typing.Optional[typing.Any], # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update_visitor(
+ self, *, request: UpdateVisitorRequestOne, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[typing.Optional[Visitor]]:
+ """
+ Sending a PUT request to `/visitors` will result in an update of an existing Visitor.
+
+ **Option 1.** You can update a visitor by passing in the `user_id` of the visitor in the Request body.
+
+ **Option 2.** You can update a visitor by passing in the `id` of the visitor in the Request body.
+
+ Parameters
+ ----------
+ request : UpdateVisitorRequestOne
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[typing.Optional[Visitor]]
+ successful
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "visitors",
+ method="PUT",
+ json=request,
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if _response is None or not _response.text.strip():
+ return HttpResponse(response=_response, data=None)
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ typing.Optional[Visitor],
+ construct_type(
+ type_=typing.Optional[Visitor], # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ if _response.status_code == 401:
+ raise UnauthorizedError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ Error,
+ construct_type(
+ type_=Error, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 404:
+ raise NotFoundError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Optional[typing.Any],
+ construct_type(
+ type_=typing.Optional[typing.Any], # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def convert_visitor(
+ self,
+ *,
+ type: str,
+ user: typing.Optional[typing.Any] = OMIT,
+ visitor: typing.Optional[typing.Any] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[Contact]:
+ """
+ You can merge a Visitor to a Contact of role type `lead` or `user`.
+
+ > 📘 What happens upon a visitor being converted?
+ >
+ > If the User exists, then the Visitor will be merged into it, the Visitor deleted and the User returned. If the User does not exist, the Visitor will be converted to a User, with the User identifiers replacing it's Visitor identifiers.
+
+ Parameters
+ ----------
+ type : str
+ Represents the role of the Contact model. Accepts `lead` or `user`.
+
+ user : typing.Optional[typing.Any]
+
+ visitor : typing.Optional[typing.Any]
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[Contact]
+ successful
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "visitors/convert",
+ method="POST",
+ json={
+ "type": type,
+ "user": user,
+ "visitor": visitor,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ Contact,
+ construct_type(
+ type_=Contact, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ if _response.status_code == 401:
+ raise UnauthorizedError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ Error,
+ construct_type(
+ type_=Error, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawVisitorsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def retrieve_visitor_with_user_id(
+ self, *, user_id: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[typing.Optional[Visitor]]:
+ """
+ You can fetch the details of a single visitor.
+
+ Parameters
+ ----------
+ user_id : str
+ The user_id of the Visitor you want to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[typing.Optional[Visitor]]
+ successful
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "visitors",
+ method="GET",
+ params={
+ "user_id": user_id,
+ },
+ request_options=request_options,
+ )
+ try:
+ if _response is None or not _response.text.strip():
+ return AsyncHttpResponse(response=_response, data=None)
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ typing.Optional[Visitor],
+ construct_type(
+ type_=typing.Optional[Visitor], # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ if _response.status_code == 401:
+ raise UnauthorizedError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ Error,
+ construct_type(
+ type_=Error, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 404:
+ raise NotFoundError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Optional[typing.Any],
+ construct_type(
+ type_=typing.Optional[typing.Any], # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update_visitor(
+ self, *, request: UpdateVisitorRequestOne, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[typing.Optional[Visitor]]:
+ """
+ Sending a PUT request to `/visitors` will result in an update of an existing Visitor.
+
+ **Option 1.** You can update a visitor by passing in the `user_id` of the visitor in the Request body.
+
+ **Option 2.** You can update a visitor by passing in the `id` of the visitor in the Request body.
+
+ Parameters
+ ----------
+ request : UpdateVisitorRequestOne
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[typing.Optional[Visitor]]
+ successful
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "visitors",
+ method="PUT",
+ json=request,
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if _response is None or not _response.text.strip():
+ return AsyncHttpResponse(response=_response, data=None)
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ typing.Optional[Visitor],
+ construct_type(
+ type_=typing.Optional[Visitor], # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ if _response.status_code == 401:
+ raise UnauthorizedError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ Error,
+ construct_type(
+ type_=Error, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 404:
+ raise NotFoundError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Optional[typing.Any],
+ construct_type(
+ type_=typing.Optional[typing.Any], # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def convert_visitor(
+ self,
+ *,
+ type: str,
+ user: typing.Optional[typing.Any] = OMIT,
+ visitor: typing.Optional[typing.Any] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[Contact]:
+ """
+ You can merge a Visitor to a Contact of role type `lead` or `user`.
+
+ > 📘 What happens upon a visitor being converted?
+ >
+ > If the User exists, then the Visitor will be merged into it, the Visitor deleted and the User returned. If the User does not exist, the Visitor will be converted to a User, with the User identifiers replacing it's Visitor identifiers.
+
+ Parameters
+ ----------
+ type : str
+ Represents the role of the Contact model. Accepts `lead` or `user`.
+
+ user : typing.Optional[typing.Any]
+
+ visitor : typing.Optional[typing.Any]
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[Contact]
+ successful
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "visitors/convert",
+ method="POST",
+ json={
+ "type": type,
+ "user": user,
+ "visitor": visitor,
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ Contact,
+ construct_type(
+ type_=Contact, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ if _response.status_code == 401:
+ raise UnauthorizedError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ Error,
+ construct_type(
+ type_=Error, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/intercom/version.py b/src/intercom/version.py
new file mode 100644
index 0000000..e2dfd2d
--- /dev/null
+++ b/src/intercom/version.py
@@ -0,0 +1,3 @@
+from importlib import metadata
+
+__version__ = metadata.version("intercom-python")
diff --git a/src/intercom/visitors/__init__.py b/src/intercom/visitors/__init__.py
new file mode 100644
index 0000000..c639b64
--- /dev/null
+++ b/src/intercom/visitors/__init__.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
+from .types import (
+ ConvertVisitorRequestUser,
+ ConvertVisitorRequestVisitor,
+ UserWithId,
+ UserWithUserId,
+ VisitorWithEmail,
+ VisitorWithId,
+ VisitorWithUserId,
+)
+
+__all__ = [
+ "ConvertVisitorRequestUser",
+ "ConvertVisitorRequestVisitor",
+ "UserWithId",
+ "UserWithUserId",
+ "VisitorWithEmail",
+ "VisitorWithId",
+ "VisitorWithUserId",
+]
diff --git a/src/intercom/visitors/client.py b/src/intercom/visitors/client.py
new file mode 100644
index 0000000..aca44b6
--- /dev/null
+++ b/src/intercom/visitors/client.py
@@ -0,0 +1,327 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from ..contacts.types.contact import Contact
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.request_options import RequestOptions
+from ..types.update_visitor_request import UpdateVisitorRequest
+from ..types.visitor import Visitor
+from .raw_client import AsyncRawVisitorsClient, RawVisitorsClient
+from .types.convert_visitor_request_user import ConvertVisitorRequestUser
+from .types.convert_visitor_request_visitor import ConvertVisitorRequestVisitor
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class VisitorsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._raw_client = RawVisitorsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> RawVisitorsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ RawVisitorsClient
+ """
+ return self._raw_client
+
+ def find(self, *, user_id: str, request_options: typing.Optional[RequestOptions] = None) -> Visitor:
+ """
+ You can fetch the details of a single visitor.
+
+ Parameters
+ ----------
+ user_id : str
+ The user_id of the Visitor you want to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ Visitor
+ successful
+
+ Examples
+ --------
+ from intercom import Intercom
+
+ client = Intercom(
+ token="YOUR_TOKEN",
+ )
+ client.visitors.find(
+ user_id="user_id",
+ )
+ """
+ _response = self._raw_client.find(user_id=user_id, request_options=request_options)
+ return _response.data
+
+ def update(
+ self, *, request: UpdateVisitorRequest, request_options: typing.Optional[RequestOptions] = None
+ ) -> Visitor:
+ """
+ Sending a PUT request to `/visitors` will result in an update of an existing Visitor.
+
+ **Option 1.** You can update a visitor by passing in the `user_id` of the visitor in the Request body.
+
+ **Option 2.** You can update a visitor by passing in the `id` of the visitor in the Request body.
+
+ Parameters
+ ----------
+ request : UpdateVisitorRequest
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ Visitor
+ successful
+
+ Examples
+ --------
+ from intercom import Intercom, UpdateVisitorRequestWithId
+
+ client = Intercom(
+ token="YOUR_TOKEN",
+ )
+ client.visitors.update(
+ request=UpdateVisitorRequestWithId(
+ id="667d61cc8a68186f43bafe95",
+ name="Gareth Bale",
+ ),
+ )
+ """
+ _response = self._raw_client.update(request=request, request_options=request_options)
+ return _response.data
+
+ def merge_to_contact(
+ self,
+ *,
+ type: str,
+ user: ConvertVisitorRequestUser,
+ visitor: ConvertVisitorRequestVisitor,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> Contact:
+ """
+ You can merge a Visitor to a Contact of role type `lead` or `user`.
+
+ > 📘 What happens upon a visitor being converted?
+ >
+ > If the User exists, then the Visitor will be merged into it, the Visitor deleted and the User returned. If the User does not exist, the Visitor will be converted to a User, with the User identifiers replacing it's Visitor identifiers.
+
+ Parameters
+ ----------
+ type : str
+ Represents the role of the Contact model. Accepts `lead` or `user`.
+
+ user : ConvertVisitorRequestUser
+ The unique identifiers retained after converting or merging.
+
+ visitor : ConvertVisitorRequestVisitor
+ The unique identifiers to convert a single Visitor.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ Contact
+ successful
+
+ Examples
+ --------
+ from intercom import Intercom
+ from intercom.visitors import UserWithId, VisitorWithUserId
+
+ client = Intercom(
+ token="YOUR_TOKEN",
+ )
+ client.visitors.merge_to_contact(
+ type="user",
+ user=UserWithId(
+ id="8a88a590-e1c3-41e2-a502-e0649dbf721c",
+ email="foo@bar.com",
+ ),
+ visitor=VisitorWithUserId(
+ user_id="3ecf64d0-9ed1-4e9f-88e1-da7d6e6782f3",
+ ),
+ )
+ """
+ _response = self._raw_client.merge_to_contact(
+ type=type, user=user, visitor=visitor, request_options=request_options
+ )
+ return _response.data
+
+
+class AsyncVisitorsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawVisitorsClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawVisitorsClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawVisitorsClient
+ """
+ return self._raw_client
+
+ async def find(self, *, user_id: str, request_options: typing.Optional[RequestOptions] = None) -> Visitor:
+ """
+ You can fetch the details of a single visitor.
+
+ Parameters
+ ----------
+ user_id : str
+ The user_id of the Visitor you want to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ Visitor
+ successful
+
+ Examples
+ --------
+ import asyncio
+
+ from intercom import AsyncIntercom
+
+ client = AsyncIntercom(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.visitors.find(
+ user_id="user_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.find(user_id=user_id, request_options=request_options)
+ return _response.data
+
+ async def update(
+ self, *, request: UpdateVisitorRequest, request_options: typing.Optional[RequestOptions] = None
+ ) -> Visitor:
+ """
+ Sending a PUT request to `/visitors` will result in an update of an existing Visitor.
+
+ **Option 1.** You can update a visitor by passing in the `user_id` of the visitor in the Request body.
+
+ **Option 2.** You can update a visitor by passing in the `id` of the visitor in the Request body.
+
+ Parameters
+ ----------
+ request : UpdateVisitorRequest
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ Visitor
+ successful
+
+ Examples
+ --------
+ import asyncio
+
+ from intercom import AsyncIntercom, UpdateVisitorRequestWithId
+
+ client = AsyncIntercom(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.visitors.update(
+ request=UpdateVisitorRequestWithId(
+ id="667d61cc8a68186f43bafe95",
+ name="Gareth Bale",
+ ),
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update(request=request, request_options=request_options)
+ return _response.data
+
+ async def merge_to_contact(
+ self,
+ *,
+ type: str,
+ user: ConvertVisitorRequestUser,
+ visitor: ConvertVisitorRequestVisitor,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> Contact:
+ """
+ You can merge a Visitor to a Contact of role type `lead` or `user`.
+
+ > 📘 What happens upon a visitor being converted?
+ >
+ > If the User exists, then the Visitor will be merged into it, the Visitor deleted and the User returned. If the User does not exist, the Visitor will be converted to a User, with the User identifiers replacing it's Visitor identifiers.
+
+ Parameters
+ ----------
+ type : str
+ Represents the role of the Contact model. Accepts `lead` or `user`.
+
+ user : ConvertVisitorRequestUser
+ The unique identifiers retained after converting or merging.
+
+ visitor : ConvertVisitorRequestVisitor
+ The unique identifiers to convert a single Visitor.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ Contact
+ successful
+
+ Examples
+ --------
+ import asyncio
+
+ from intercom import AsyncIntercom
+ from intercom.visitors import UserWithId, VisitorWithUserId
+
+ client = AsyncIntercom(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.visitors.merge_to_contact(
+ type="user",
+ user=UserWithId(
+ id="8a88a590-e1c3-41e2-a502-e0649dbf721c",
+ email="foo@bar.com",
+ ),
+ visitor=VisitorWithUserId(
+ user_id="3ecf64d0-9ed1-4e9f-88e1-da7d6e6782f3",
+ ),
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.merge_to_contact(
+ type=type, user=user, visitor=visitor, request_options=request_options
+ )
+ return _response.data
diff --git a/src/intercom/visitors/raw_client.py b/src/intercom/visitors/raw_client.py
new file mode 100644
index 0000000..03a4bd0
--- /dev/null
+++ b/src/intercom/visitors/raw_client.py
@@ -0,0 +1,456 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+from json.decoder import JSONDecodeError
+
+from ..contacts.types.contact import Contact
+from ..core.api_error import ApiError
+from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
+from ..core.http_response import AsyncHttpResponse, HttpResponse
+from ..core.request_options import RequestOptions
+from ..core.serialization import convert_and_respect_annotation_metadata
+from ..core.unchecked_base_model import construct_type
+from ..errors.not_found_error import NotFoundError
+from ..errors.unauthorized_error import UnauthorizedError
+from ..types.error import Error
+from ..types.update_visitor_request import UpdateVisitorRequest
+from ..types.visitor import Visitor
+from .types.convert_visitor_request_user import ConvertVisitorRequestUser
+from .types.convert_visitor_request_visitor import ConvertVisitorRequestVisitor
+
+# this is used as the default value for optional parameters
+OMIT = typing.cast(typing.Any, ...)
+
+
+class RawVisitorsClient:
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ def find(self, *, user_id: str, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Visitor]:
+ """
+ You can fetch the details of a single visitor.
+
+ Parameters
+ ----------
+ user_id : str
+ The user_id of the Visitor you want to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[Visitor]
+ successful
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "visitors",
+ method="GET",
+ params={
+ "user_id": user_id,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ Visitor,
+ construct_type(
+ type_=Visitor, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ if _response.status_code == 401:
+ raise UnauthorizedError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ Error,
+ construct_type(
+ type_=Error, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 404:
+ raise NotFoundError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Optional[typing.Any],
+ construct_type(
+ type_=typing.Optional[typing.Any], # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update(
+ self, *, request: UpdateVisitorRequest, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[Visitor]:
+ """
+ Sending a PUT request to `/visitors` will result in an update of an existing Visitor.
+
+ **Option 1.** You can update a visitor by passing in the `user_id` of the visitor in the Request body.
+
+ **Option 2.** You can update a visitor by passing in the `id` of the visitor in the Request body.
+
+ Parameters
+ ----------
+ request : UpdateVisitorRequest
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[Visitor]
+ successful
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "visitors",
+ method="PUT",
+ json=convert_and_respect_annotation_metadata(
+ object_=request, annotation=UpdateVisitorRequest, direction="write"
+ ),
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ Visitor,
+ construct_type(
+ type_=Visitor, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ if _response.status_code == 401:
+ raise UnauthorizedError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ Error,
+ construct_type(
+ type_=Error, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 404:
+ raise NotFoundError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Optional[typing.Any],
+ construct_type(
+ type_=typing.Optional[typing.Any], # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def merge_to_contact(
+ self,
+ *,
+ type: str,
+ user: ConvertVisitorRequestUser,
+ visitor: ConvertVisitorRequestVisitor,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[Contact]:
+ """
+ You can merge a Visitor to a Contact of role type `lead` or `user`.
+
+ > 📘 What happens upon a visitor being converted?
+ >
+ > If the User exists, then the Visitor will be merged into it, the Visitor deleted and the User returned. If the User does not exist, the Visitor will be converted to a User, with the User identifiers replacing it's Visitor identifiers.
+
+ Parameters
+ ----------
+ type : str
+ Represents the role of the Contact model. Accepts `lead` or `user`.
+
+ user : ConvertVisitorRequestUser
+ The unique identifiers retained after converting or merging.
+
+ visitor : ConvertVisitorRequestVisitor
+ The unique identifiers to convert a single Visitor.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[Contact]
+ successful
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "visitors/convert",
+ method="POST",
+ json={
+ "type": type,
+ "user": convert_and_respect_annotation_metadata(
+ object_=user, annotation=ConvertVisitorRequestUser, direction="write"
+ ),
+ "visitor": convert_and_respect_annotation_metadata(
+ object_=visitor, annotation=ConvertVisitorRequestVisitor, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ Contact,
+ construct_type(
+ type_=Contact, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ if _response.status_code == 401:
+ raise UnauthorizedError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ Error,
+ construct_type(
+ type_=Error, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawVisitorsClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def find(
+ self, *, user_id: str, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[Visitor]:
+ """
+ You can fetch the details of a single visitor.
+
+ Parameters
+ ----------
+ user_id : str
+ The user_id of the Visitor you want to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[Visitor]
+ successful
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "visitors",
+ method="GET",
+ params={
+ "user_id": user_id,
+ },
+ request_options=request_options,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ Visitor,
+ construct_type(
+ type_=Visitor, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ if _response.status_code == 401:
+ raise UnauthorizedError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ Error,
+ construct_type(
+ type_=Error, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 404:
+ raise NotFoundError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Optional[typing.Any],
+ construct_type(
+ type_=typing.Optional[typing.Any], # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def update(
+ self, *, request: UpdateVisitorRequest, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[Visitor]:
+ """
+ Sending a PUT request to `/visitors` will result in an update of an existing Visitor.
+
+ **Option 1.** You can update a visitor by passing in the `user_id` of the visitor in the Request body.
+
+ **Option 2.** You can update a visitor by passing in the `id` of the visitor in the Request body.
+
+ Parameters
+ ----------
+ request : UpdateVisitorRequest
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[Visitor]
+ successful
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "visitors",
+ method="PUT",
+ json=convert_and_respect_annotation_metadata(
+ object_=request, annotation=UpdateVisitorRequest, direction="write"
+ ),
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ Visitor,
+ construct_type(
+ type_=Visitor, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ if _response.status_code == 401:
+ raise UnauthorizedError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ Error,
+ construct_type(
+ type_=Error, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ if _response.status_code == 404:
+ raise NotFoundError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ typing.Optional[typing.Any],
+ construct_type(
+ type_=typing.Optional[typing.Any], # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def merge_to_contact(
+ self,
+ *,
+ type: str,
+ user: ConvertVisitorRequestUser,
+ visitor: ConvertVisitorRequestVisitor,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[Contact]:
+ """
+ You can merge a Visitor to a Contact of role type `lead` or `user`.
+
+ > 📘 What happens upon a visitor being converted?
+ >
+ > If the User exists, then the Visitor will be merged into it, the Visitor deleted and the User returned. If the User does not exist, the Visitor will be converted to a User, with the User identifiers replacing it's Visitor identifiers.
+
+ Parameters
+ ----------
+ type : str
+ Represents the role of the Contact model. Accepts `lead` or `user`.
+
+ user : ConvertVisitorRequestUser
+ The unique identifiers retained after converting or merging.
+
+ visitor : ConvertVisitorRequestVisitor
+ The unique identifiers to convert a single Visitor.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[Contact]
+ successful
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "visitors/convert",
+ method="POST",
+ json={
+ "type": type,
+ "user": convert_and_respect_annotation_metadata(
+ object_=user, annotation=ConvertVisitorRequestUser, direction="write"
+ ),
+ "visitor": convert_and_respect_annotation_metadata(
+ object_=visitor, annotation=ConvertVisitorRequestVisitor, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ Contact,
+ construct_type(
+ type_=Contact, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ if _response.status_code == 401:
+ raise UnauthorizedError(
+ headers=dict(_response.headers),
+ body=typing.cast(
+ Error,
+ construct_type(
+ type_=Error, # type: ignore
+ object_=_response.json(),
+ ),
+ ),
+ )
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/intercom/visitors/types/__init__.py b/src/intercom/visitors/types/__init__.py
new file mode 100644
index 0000000..4eab426
--- /dev/null
+++ b/src/intercom/visitors/types/__init__.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# isort: skip_file
+
+from .convert_visitor_request_user import ConvertVisitorRequestUser
+from .convert_visitor_request_visitor import ConvertVisitorRequestVisitor
+from .user_with_id import UserWithId
+from .user_with_user_id import UserWithUserId
+from .visitor_with_email import VisitorWithEmail
+from .visitor_with_id import VisitorWithId
+from .visitor_with_user_id import VisitorWithUserId
+
+__all__ = [
+ "ConvertVisitorRequestUser",
+ "ConvertVisitorRequestVisitor",
+ "UserWithId",
+ "UserWithUserId",
+ "VisitorWithEmail",
+ "VisitorWithId",
+ "VisitorWithUserId",
+]
diff --git a/src/intercom/visitors/types/convert_visitor_request_user.py b/src/intercom/visitors/types/convert_visitor_request_user.py
new file mode 100644
index 0000000..b0812cc
--- /dev/null
+++ b/src/intercom/visitors/types/convert_visitor_request_user.py
@@ -0,0 +1,8 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from .user_with_id import UserWithId
+from .user_with_user_id import UserWithUserId
+
+ConvertVisitorRequestUser = typing.Union[UserWithId, UserWithUserId]
diff --git a/src/intercom/visitors/types/convert_visitor_request_visitor.py b/src/intercom/visitors/types/convert_visitor_request_visitor.py
new file mode 100644
index 0000000..7903e59
--- /dev/null
+++ b/src/intercom/visitors/types/convert_visitor_request_visitor.py
@@ -0,0 +1,9 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from .visitor_with_email import VisitorWithEmail
+from .visitor_with_id import VisitorWithId
+from .visitor_with_user_id import VisitorWithUserId
+
+ConvertVisitorRequestVisitor = typing.Union[VisitorWithId, VisitorWithUserId, VisitorWithEmail]
diff --git a/src/intercom/visitors/types/user_with_id.py b/src/intercom/visitors/types/user_with_id.py
new file mode 100644
index 0000000..972c56e
--- /dev/null
+++ b/src/intercom/visitors/types/user_with_id.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class UserWithId(UncheckedBaseModel):
+ id: str = pydantic.Field()
+ """
+ The unique identifier for the contact which is given by Intercom.
+ """
+
+ email: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The contact's email, retained by default if one is present.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/visitors/types/user_with_user_id.py b/src/intercom/visitors/types/user_with_user_id.py
new file mode 100644
index 0000000..8c8c558
--- /dev/null
+++ b/src/intercom/visitors/types/user_with_user_id.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class UserWithUserId(UncheckedBaseModel):
+ user_id: str = pydantic.Field()
+ """
+ A unique identifier for the contact which is given to Intercom.
+ """
+
+ email: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The contact's email, retained by default if one is present.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/visitors/types/visitor_with_email.py b/src/intercom/visitors/types/visitor_with_email.py
new file mode 100644
index 0000000..5fca354
--- /dev/null
+++ b/src/intercom/visitors/types/visitor_with_email.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class VisitorWithEmail(UncheckedBaseModel):
+ email: str = pydantic.Field()
+ """
+ The visitor's email.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/visitors/types/visitor_with_id.py b/src/intercom/visitors/types/visitor_with_id.py
new file mode 100644
index 0000000..6944949
--- /dev/null
+++ b/src/intercom/visitors/types/visitor_with_id.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class VisitorWithId(UncheckedBaseModel):
+ id: str = pydantic.Field()
+ """
+ The unique identifier for the contact which is given by Intercom.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/intercom/visitors/types/visitor_with_user_id.py b/src/intercom/visitors/types/visitor_with_user_id.py
new file mode 100644
index 0000000..658429b
--- /dev/null
+++ b/src/intercom/visitors/types/visitor_with_user_id.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ...core.pydantic_utilities import IS_PYDANTIC_V2
+from ...core.unchecked_base_model import UncheckedBaseModel
+
+
+class VisitorWithUserId(UncheckedBaseModel):
+ user_id: str = pydantic.Field()
+ """
+ A unique identifier for the contact which is given to Intercom.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/tests/custom/test_client.py b/tests/custom/test_client.py
new file mode 100644
index 0000000..ab04ce6
--- /dev/null
+++ b/tests/custom/test_client.py
@@ -0,0 +1,7 @@
+import pytest
+
+
+# Get started with writing tests with pytest at https://docs.pytest.org
+@pytest.mark.skip(reason="Unimplemented")
+def test_client() -> None:
+ assert True
diff --git a/tests/utils/__init__.py b/tests/utils/__init__.py
new file mode 100644
index 0000000..f3ea265
--- /dev/null
+++ b/tests/utils/__init__.py
@@ -0,0 +1,2 @@
+# This file was auto-generated by Fern from our API Definition.
+
diff --git a/tests/utils/assets/models/__init__.py b/tests/utils/assets/models/__init__.py
new file mode 100644
index 0000000..2cf0126
--- /dev/null
+++ b/tests/utils/assets/models/__init__.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# This file was auto-generated by Fern from our API Definition.
+
+from .circle import CircleParams
+from .object_with_defaults import ObjectWithDefaultsParams
+from .object_with_optional_field import ObjectWithOptionalFieldParams
+from .shape import Shape_CircleParams, Shape_SquareParams, ShapeParams
+from .square import SquareParams
+from .undiscriminated_shape import UndiscriminatedShapeParams
+
+__all__ = [
+ "CircleParams",
+ "ObjectWithDefaultsParams",
+ "ObjectWithOptionalFieldParams",
+ "ShapeParams",
+ "Shape_CircleParams",
+ "Shape_SquareParams",
+ "SquareParams",
+ "UndiscriminatedShapeParams",
+]
diff --git a/tests/utils/assets/models/circle.py b/tests/utils/assets/models/circle.py
new file mode 100644
index 0000000..36a0fd7
--- /dev/null
+++ b/tests/utils/assets/models/circle.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+from intercom.core.serialization import FieldMetadata
+
+
+class CircleParams(typing_extensions.TypedDict):
+ radius_measurement: typing_extensions.Annotated[float, FieldMetadata(alias="radiusMeasurement")]
diff --git a/tests/utils/assets/models/color.py b/tests/utils/assets/models/color.py
new file mode 100644
index 0000000..2aa2c4c
--- /dev/null
+++ b/tests/utils/assets/models/color.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+Color = typing.Union[typing.Literal["red", "blue"], typing.Any]
diff --git a/tests/utils/assets/models/object_with_defaults.py b/tests/utils/assets/models/object_with_defaults.py
new file mode 100644
index 0000000..a977b1d
--- /dev/null
+++ b/tests/utils/assets/models/object_with_defaults.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class ObjectWithDefaultsParams(typing_extensions.TypedDict):
+ """
+ Defines properties with default values and validation rules.
+ """
+
+ decimal: typing_extensions.NotRequired[float]
+ string: typing_extensions.NotRequired[str]
+ required_string: str
diff --git a/tests/utils/assets/models/object_with_optional_field.py b/tests/utils/assets/models/object_with_optional_field.py
new file mode 100644
index 0000000..89983fe
--- /dev/null
+++ b/tests/utils/assets/models/object_with_optional_field.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# This file was auto-generated by Fern from our API Definition.
+
+import datetime as dt
+import typing
+import uuid
+
+import typing_extensions
+from .color import Color
+from .shape import ShapeParams
+from .undiscriminated_shape import UndiscriminatedShapeParams
+
+from intercom.core.serialization import FieldMetadata
+
+
+class ObjectWithOptionalFieldParams(typing_extensions.TypedDict):
+ literal: typing.Literal["lit_one"]
+ string: typing_extensions.NotRequired[str]
+ integer: typing_extensions.NotRequired[int]
+ long_: typing_extensions.NotRequired[typing_extensions.Annotated[int, FieldMetadata(alias="long")]]
+ double: typing_extensions.NotRequired[float]
+ bool_: typing_extensions.NotRequired[typing_extensions.Annotated[bool, FieldMetadata(alias="bool")]]
+ datetime: typing_extensions.NotRequired[dt.datetime]
+ date: typing_extensions.NotRequired[dt.date]
+ uuid_: typing_extensions.NotRequired[typing_extensions.Annotated[uuid.UUID, FieldMetadata(alias="uuid")]]
+ base_64: typing_extensions.NotRequired[typing_extensions.Annotated[str, FieldMetadata(alias="base64")]]
+ list_: typing_extensions.NotRequired[typing_extensions.Annotated[typing.Sequence[str], FieldMetadata(alias="list")]]
+ set_: typing_extensions.NotRequired[typing_extensions.Annotated[typing.Set[str], FieldMetadata(alias="set")]]
+ map_: typing_extensions.NotRequired[typing_extensions.Annotated[typing.Dict[int, str], FieldMetadata(alias="map")]]
+ enum: typing_extensions.NotRequired[Color]
+ union: typing_extensions.NotRequired[ShapeParams]
+ second_union: typing_extensions.NotRequired[ShapeParams]
+ undiscriminated_union: typing_extensions.NotRequired[UndiscriminatedShapeParams]
+ any: typing.Optional[typing.Any]
diff --git a/tests/utils/assets/models/shape.py b/tests/utils/assets/models/shape.py
new file mode 100644
index 0000000..4e484bd
--- /dev/null
+++ b/tests/utils/assets/models/shape.py
@@ -0,0 +1,28 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import typing_extensions
+
+from intercom.core.serialization import FieldMetadata
+
+
+class Base(typing_extensions.TypedDict):
+ id: str
+
+
+class Shape_CircleParams(Base):
+ shape_type: typing_extensions.Annotated[typing.Literal["circle"], FieldMetadata(alias="shapeType")]
+ radius_measurement: typing_extensions.Annotated[float, FieldMetadata(alias="radiusMeasurement")]
+
+
+class Shape_SquareParams(Base):
+ shape_type: typing_extensions.Annotated[typing.Literal["square"], FieldMetadata(alias="shapeType")]
+ length_measurement: typing_extensions.Annotated[float, FieldMetadata(alias="lengthMeasurement")]
+
+
+ShapeParams = typing.Union[Shape_CircleParams, Shape_SquareParams]
diff --git a/tests/utils/assets/models/square.py b/tests/utils/assets/models/square.py
new file mode 100644
index 0000000..f1afcc9
--- /dev/null
+++ b/tests/utils/assets/models/square.py
@@ -0,0 +1,11 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+from intercom.core.serialization import FieldMetadata
+
+
+class SquareParams(typing_extensions.TypedDict):
+ length_measurement: typing_extensions.Annotated[float, FieldMetadata(alias="lengthMeasurement")]
diff --git a/tests/utils/assets/models/undiscriminated_shape.py b/tests/utils/assets/models/undiscriminated_shape.py
new file mode 100644
index 0000000..99f12b3
--- /dev/null
+++ b/tests/utils/assets/models/undiscriminated_shape.py
@@ -0,0 +1,10 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from .circle import CircleParams
+from .square import SquareParams
+
+UndiscriminatedShapeParams = typing.Union[CircleParams, SquareParams]
diff --git a/tests/utils/test_http_client.py b/tests/utils/test_http_client.py
new file mode 100644
index 0000000..72fa507
--- /dev/null
+++ b/tests/utils/test_http_client.py
@@ -0,0 +1,61 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from intercom.core.http_client import get_request_body
+from intercom.core.request_options import RequestOptions
+
+
+def get_request_options() -> RequestOptions:
+ return {"additional_body_parameters": {"see you": "later"}}
+
+
+def test_get_json_request_body() -> None:
+ json_body, data_body = get_request_body(json={"hello": "world"}, data=None, request_options=None, omit=None)
+ assert json_body == {"hello": "world"}
+ assert data_body is None
+
+ json_body_extras, data_body_extras = get_request_body(
+ json={"goodbye": "world"}, data=None, request_options=get_request_options(), omit=None
+ )
+
+ assert json_body_extras == {"goodbye": "world", "see you": "later"}
+ assert data_body_extras is None
+
+
+def test_get_files_request_body() -> None:
+ json_body, data_body = get_request_body(json=None, data={"hello": "world"}, request_options=None, omit=None)
+ assert data_body == {"hello": "world"}
+ assert json_body is None
+
+ json_body_extras, data_body_extras = get_request_body(
+ json=None, data={"goodbye": "world"}, request_options=get_request_options(), omit=None
+ )
+
+ assert data_body_extras == {"goodbye": "world", "see you": "later"}
+ assert json_body_extras is None
+
+
+def test_get_none_request_body() -> None:
+ json_body, data_body = get_request_body(json=None, data=None, request_options=None, omit=None)
+ assert data_body is None
+ assert json_body is None
+
+ json_body_extras, data_body_extras = get_request_body(
+ json=None, data=None, request_options=get_request_options(), omit=None
+ )
+
+ assert json_body_extras == {"see you": "later"}
+ assert data_body_extras is None
+
+
+def test_get_empty_json_request_body() -> None:
+ unrelated_request_options: RequestOptions = {"max_retries": 3}
+ json_body, data_body = get_request_body(json=None, data=None, request_options=unrelated_request_options, omit=None)
+ assert json_body is None
+ assert data_body is None
+
+ json_body_extras, data_body_extras = get_request_body(
+ json={}, data=None, request_options=unrelated_request_options, omit=None
+ )
+
+ assert json_body_extras is None
+ assert data_body_extras is None
diff --git a/tests/utils/test_query_encoding.py b/tests/utils/test_query_encoding.py
new file mode 100644
index 0000000..99b1165
--- /dev/null
+++ b/tests/utils/test_query_encoding.py
@@ -0,0 +1,37 @@
+# This file was auto-generated by Fern from our API Definition.
+
+
+from intercom.core.query_encoder import encode_query
+
+
+def test_query_encoding_deep_objects() -> None:
+ assert encode_query({"hello world": "hello world"}) == [("hello world", "hello world")]
+ assert encode_query({"hello_world": {"hello": "world"}}) == [("hello_world[hello]", "world")]
+ assert encode_query({"hello_world": {"hello": {"world": "today"}, "test": "this"}, "hi": "there"}) == [
+ ("hello_world[hello][world]", "today"),
+ ("hello_world[test]", "this"),
+ ("hi", "there"),
+ ]
+
+
+def test_query_encoding_deep_object_arrays() -> None:
+ assert encode_query({"objects": [{"key": "hello", "value": "world"}, {"key": "foo", "value": "bar"}]}) == [
+ ("objects[key]", "hello"),
+ ("objects[value]", "world"),
+ ("objects[key]", "foo"),
+ ("objects[value]", "bar"),
+ ]
+ assert encode_query(
+ {"users": [{"name": "string", "tags": ["string"]}, {"name": "string2", "tags": ["string2", "string3"]}]}
+ ) == [
+ ("users[name]", "string"),
+ ("users[tags]", "string"),
+ ("users[name]", "string2"),
+ ("users[tags]", "string2"),
+ ("users[tags]", "string3"),
+ ]
+
+
+def test_encode_query_with_none() -> None:
+ encoded = encode_query(None)
+ assert encoded is None
diff --git a/tests/utils/test_serialization.py b/tests/utils/test_serialization.py
new file mode 100644
index 0000000..e506931
--- /dev/null
+++ b/tests/utils/test_serialization.py
@@ -0,0 +1,72 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from typing import Any, List
+
+from .assets.models import ObjectWithOptionalFieldParams, ShapeParams
+
+from intercom.core.serialization import convert_and_respect_annotation_metadata
+
+UNION_TEST: ShapeParams = {"radius_measurement": 1.0, "shape_type": "circle", "id": "1"}
+UNION_TEST_CONVERTED = {"shapeType": "circle", "radiusMeasurement": 1.0, "id": "1"}
+
+
+def test_convert_and_respect_annotation_metadata() -> None:
+ data: ObjectWithOptionalFieldParams = {
+ "string": "string",
+ "long_": 12345,
+ "bool_": True,
+ "literal": "lit_one",
+ "any": "any",
+ }
+ converted = convert_and_respect_annotation_metadata(
+ object_=data, annotation=ObjectWithOptionalFieldParams, direction="write"
+ )
+ assert converted == {"string": "string", "long": 12345, "bool": True, "literal": "lit_one", "any": "any"}
+
+
+def test_convert_and_respect_annotation_metadata_in_list() -> None:
+ data: List[ObjectWithOptionalFieldParams] = [
+ {"string": "string", "long_": 12345, "bool_": True, "literal": "lit_one", "any": "any"},
+ {"string": "another string", "long_": 67890, "list_": [], "literal": "lit_one", "any": "any"},
+ ]
+ converted = convert_and_respect_annotation_metadata(
+ object_=data, annotation=List[ObjectWithOptionalFieldParams], direction="write"
+ )
+
+ assert converted == [
+ {"string": "string", "long": 12345, "bool": True, "literal": "lit_one", "any": "any"},
+ {"string": "another string", "long": 67890, "list": [], "literal": "lit_one", "any": "any"},
+ ]
+
+
+def test_convert_and_respect_annotation_metadata_in_nested_object() -> None:
+ data: ObjectWithOptionalFieldParams = {
+ "string": "string",
+ "long_": 12345,
+ "union": UNION_TEST,
+ "literal": "lit_one",
+ "any": "any",
+ }
+ converted = convert_and_respect_annotation_metadata(
+ object_=data, annotation=ObjectWithOptionalFieldParams, direction="write"
+ )
+
+ assert converted == {
+ "string": "string",
+ "long": 12345,
+ "union": UNION_TEST_CONVERTED,
+ "literal": "lit_one",
+ "any": "any",
+ }
+
+
+def test_convert_and_respect_annotation_metadata_in_union() -> None:
+ converted = convert_and_respect_annotation_metadata(object_=UNION_TEST, annotation=ShapeParams, direction="write")
+
+ assert converted == UNION_TEST_CONVERTED
+
+
+def test_convert_and_respect_annotation_metadata_with_empty_object() -> None:
+ data: Any = {}
+ converted = convert_and_respect_annotation_metadata(object_=data, annotation=ShapeParams, direction="write")
+ assert converted == data