From b1b92197c2758c1f121f52cf636033c4b9ba6f42 Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Thu, 6 Jun 2024 16:51:53 +0000 Subject: [PATCH] feat(api): update via SDK Studio --- README.md | 8 ++++---- src/intercom/_client.py | 22 +++++++++++----------- tests/test_client.py | 8 ++++---- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index e7fe8b2f..f6cfa9d2 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,8 @@ from intercom import Intercom client = Intercom( # This is the default and can be omitted access_token=os.environ.get("INTERCOM_ACCESS_TOKEN"), - # or 'production' | 'environment_2'; defaults to "production". - environment="environment_1", + # or 'us' | 'au'; defaults to "us". + environment="eu", ) admin_with_app = client.me.retrieve() @@ -55,8 +55,8 @@ from intercom import AsyncIntercom client = AsyncIntercom( # This is the default and can be omitted access_token=os.environ.get("INTERCOM_ACCESS_TOKEN"), - # or 'production' | 'environment_2'; defaults to "production". - environment="environment_1", + # or 'us' | 'au'; defaults to "us". + environment="eu", ) diff --git a/src/intercom/_client.py b/src/intercom/_client.py index 82c56668..925562a4 100644 --- a/src/intercom/_client.py +++ b/src/intercom/_client.py @@ -46,9 +46,9 @@ ] ENVIRONMENTS: Dict[str, str] = { - "production": "https://api.intercom.io", - "environment_1": "https://api.eu.intercom.io", - "environment_2": "https://api.au.intercom.io", + "us": "https://api.intercom.io", + "eu": "https://api.eu.intercom.io", + "au": "https://api.au.intercom.io", } @@ -82,13 +82,13 @@ class Intercom(SyncAPIClient): # client options access_token: str - _environment: Literal["production", "environment_1", "environment_2"] | NotGiven + _environment: Literal["us", "eu", "au"] | NotGiven def __init__( self, *, access_token: str | None = None, - environment: Literal["production", "environment_1", "environment_2"] | NotGiven = NOT_GIVEN, + environment: Literal["us", "eu", "au"] | NotGiven = NOT_GIVEN, base_url: str | httpx.URL | None | NotGiven = NOT_GIVEN, timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, max_retries: int = DEFAULT_MAX_RETRIES, @@ -139,7 +139,7 @@ def __init__( elif base_url_env is not None: base_url = base_url_env else: - self._environment = environment = "production" + self._environment = environment = "us" try: base_url = ENVIRONMENTS[environment] @@ -207,7 +207,7 @@ def copy( self, *, access_token: str | None = None, - environment: Literal["production", "environment_1", "environment_2"] | None = None, + environment: Literal["us", "eu", "au"] | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, http_client: httpx.Client | None = None, @@ -320,13 +320,13 @@ class AsyncIntercom(AsyncAPIClient): # client options access_token: str - _environment: Literal["production", "environment_1", "environment_2"] | NotGiven + _environment: Literal["us", "eu", "au"] | NotGiven def __init__( self, *, access_token: str | None = None, - environment: Literal["production", "environment_1", "environment_2"] | NotGiven = NOT_GIVEN, + environment: Literal["us", "eu", "au"] | NotGiven = NOT_GIVEN, base_url: str | httpx.URL | None | NotGiven = NOT_GIVEN, timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, max_retries: int = DEFAULT_MAX_RETRIES, @@ -377,7 +377,7 @@ def __init__( elif base_url_env is not None: base_url = base_url_env else: - self._environment = environment = "production" + self._environment = environment = "us" try: base_url = ENVIRONMENTS[environment] @@ -445,7 +445,7 @@ def copy( self, *, access_token: str | None = None, - environment: Literal["production", "environment_1", "environment_2"] | None = None, + environment: Literal["us", "eu", "au"] | None = None, base_url: str | httpx.URL | None = None, timeout: float | Timeout | None | NotGiven = NOT_GIVEN, http_client: httpx.AsyncClient | None = None, diff --git a/tests/test_client.py b/tests/test_client.py index bd0f9145..8b32dd14 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -565,10 +565,10 @@ def test_base_url_env(self) -> None: # explicit environment arg requires explicitness with update_env(INTERCOM_BASE_URL="http://localhost:5000/from/env"): with pytest.raises(ValueError, match=r"you must pass base_url=None"): - Intercom(access_token=access_token, _strict_response_validation=True, environment="production") + Intercom(access_token=access_token, _strict_response_validation=True, environment="us") client = Intercom( - base_url=None, access_token=access_token, _strict_response_validation=True, environment="production" + base_url=None, access_token=access_token, _strict_response_validation=True, environment="us" ) assert str(client.base_url).startswith("https://api.intercom.io") @@ -1276,10 +1276,10 @@ def test_base_url_env(self) -> None: # explicit environment arg requires explicitness with update_env(INTERCOM_BASE_URL="http://localhost:5000/from/env"): with pytest.raises(ValueError, match=r"you must pass base_url=None"): - AsyncIntercom(access_token=access_token, _strict_response_validation=True, environment="production") + AsyncIntercom(access_token=access_token, _strict_response_validation=True, environment="us") client = AsyncIntercom( - base_url=None, access_token=access_token, _strict_response_validation=True, environment="production" + base_url=None, access_token=access_token, _strict_response_validation=True, environment="us" ) assert str(client.base_url).startswith("https://api.intercom.io")