diff --git a/.stats.yml b/.stats.yml index 242b9a58..827af96f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 108 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/intercom%2Fintercom-52f67643df9a7d7b1390beca7892a18bd840aaedd848c5f8ee79d9fd9a666c99.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/intercom%2Fintercom-74554ca4b1e947254782b93352448c7a35a528fc0f88e9686e91f77e682b1669.yml diff --git a/api.md b/api.md index 6e762acc..e73b9103 100644 --- a/api.md +++ b/api.md @@ -181,7 +181,7 @@ from intercom.types.contacts import ContactAttachedCompanies Methods: -- client.contacts.companies.create(\*, path_id, \*\*params) -> Company +- client.contacts.companies.create(id, \*\*params) -> Company - client.contacts.companies.list(id) -> ContactAttachedCompanies - client.contacts.companies.delete(id, \*, contact_id) -> Company diff --git a/src/intercom/resources/contacts/companies.py b/src/intercom/resources/contacts/companies.py index 2dd505b0..1ec415c2 100644 --- a/src/intercom/resources/contacts/companies.py +++ b/src/intercom/resources/contacts/companies.py @@ -41,9 +41,9 @@ def with_streaming_response(self) -> CompaniesResourceWithStreamingResponse: def create( self, + id: str, *, - path_id: str, - body_id: str, + company_id: str, intercom_version: Literal[ "1.0", "1.1", @@ -76,7 +76,7 @@ def create( You can attach a company to a single contact. Args: - body_id: The unique identifier for the company which is given by Intercom + company_id: The unique identifier for the company which is given by Intercom intercom_version: Intercom API version.By default, it's equal to the version set in the app package. @@ -89,12 +89,12 @@ def create( timeout: Override the client-level default timeout for this request, in seconds """ - if not path_id: - raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") extra_headers = {**strip_not_given({"Intercom-Version": str(intercom_version)}), **(extra_headers or {})} return self._post( - f"/contacts/{path_id}/companies", - body=maybe_transform({"id": body_id}, company_create_params.CompanyCreateParams), + f"/contacts/{id}/companies", + body=maybe_transform({"id": company_id}, company_create_params.CompanyCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -232,9 +232,9 @@ def with_streaming_response(self) -> AsyncCompaniesResourceWithStreamingResponse async def create( self, + id: str, *, - path_id: str, - body_id: str, + company_id: str, intercom_version: Literal[ "1.0", "1.1", @@ -267,7 +267,7 @@ async def create( You can attach a company to a single contact. Args: - body_id: The unique identifier for the company which is given by Intercom + company_id: The unique identifier for the company which is given by Intercom intercom_version: Intercom API version.By default, it's equal to the version set in the app package. @@ -280,12 +280,12 @@ async def create( timeout: Override the client-level default timeout for this request, in seconds """ - if not path_id: - raise ValueError(f"Expected a non-empty value for `path_id` but received {path_id!r}") + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") extra_headers = {**strip_not_given({"Intercom-Version": str(intercom_version)}), **(extra_headers or {})} return await self._post( - f"/contacts/{path_id}/companies", - body=await async_maybe_transform({"id": body_id}, company_create_params.CompanyCreateParams), + f"/contacts/{id}/companies", + body=await async_maybe_transform({"id": company_id}, company_create_params.CompanyCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/intercom/types/contacts/company_create_params.py b/src/intercom/types/contacts/company_create_params.py index ed0798fe..07039ede 100644 --- a/src/intercom/types/contacts/company_create_params.py +++ b/src/intercom/types/contacts/company_create_params.py @@ -10,9 +10,7 @@ class CompanyCreateParams(TypedDict, total=False): - path_id: Required[Annotated[str, PropertyInfo(alias="id")]] - - body_id: Required[Annotated[str, PropertyInfo(alias="id")]] + company_id: Required[Annotated[str, PropertyInfo(alias="id")]] """The unique identifier for the company which is given by Intercom""" intercom_version: Annotated[ diff --git a/tests/api_resources/contacts/test_companies.py b/tests/api_resources/contacts/test_companies.py index 42973b16..4e07c35e 100644 --- a/tests/api_resources/contacts/test_companies.py +++ b/tests/api_resources/contacts/test_companies.py @@ -21,16 +21,16 @@ class TestCompanies: @parametrize def test_method_create(self, client: Intercom) -> None: company = client.contacts.companies.create( - path_id="string", - body_id="6657add46abd0167d9419cd2", + "string", + company_id="6657add46abd0167d9419cd2", ) assert_matches_type(Company, company, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Intercom) -> None: company = client.contacts.companies.create( - path_id="string", - body_id="6657add46abd0167d9419cd2", + "string", + company_id="6657add46abd0167d9419cd2", intercom_version="2.11", ) assert_matches_type(Company, company, path=["response"]) @@ -38,8 +38,8 @@ def test_method_create_with_all_params(self, client: Intercom) -> None: @parametrize def test_raw_response_create(self, client: Intercom) -> None: response = client.contacts.companies.with_raw_response.create( - path_id="string", - body_id="6657add46abd0167d9419cd2", + "string", + company_id="6657add46abd0167d9419cd2", ) assert response.is_closed is True @@ -50,8 +50,8 @@ def test_raw_response_create(self, client: Intercom) -> None: @parametrize def test_streaming_response_create(self, client: Intercom) -> None: with client.contacts.companies.with_streaming_response.create( - path_id="string", - body_id="6657add46abd0167d9419cd2", + "string", + company_id="6657add46abd0167d9419cd2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -63,10 +63,10 @@ def test_streaming_response_create(self, client: Intercom) -> None: @parametrize def test_path_params_create(self, client: Intercom) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): client.contacts.companies.with_raw_response.create( - path_id="", - body_id="", + "", + company_id="", ) @parametrize @@ -179,16 +179,16 @@ class TestAsyncCompanies: @parametrize async def test_method_create(self, async_client: AsyncIntercom) -> None: company = await async_client.contacts.companies.create( - path_id="string", - body_id="6657add46abd0167d9419cd2", + "string", + company_id="6657add46abd0167d9419cd2", ) assert_matches_type(Company, company, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncIntercom) -> None: company = await async_client.contacts.companies.create( - path_id="string", - body_id="6657add46abd0167d9419cd2", + "string", + company_id="6657add46abd0167d9419cd2", intercom_version="2.11", ) assert_matches_type(Company, company, path=["response"]) @@ -196,8 +196,8 @@ async def test_method_create_with_all_params(self, async_client: AsyncIntercom) @parametrize async def test_raw_response_create(self, async_client: AsyncIntercom) -> None: response = await async_client.contacts.companies.with_raw_response.create( - path_id="string", - body_id="6657add46abd0167d9419cd2", + "string", + company_id="6657add46abd0167d9419cd2", ) assert response.is_closed is True @@ -208,8 +208,8 @@ async def test_raw_response_create(self, async_client: AsyncIntercom) -> None: @parametrize async def test_streaming_response_create(self, async_client: AsyncIntercom) -> None: async with async_client.contacts.companies.with_streaming_response.create( - path_id="string", - body_id="6657add46abd0167d9419cd2", + "string", + company_id="6657add46abd0167d9419cd2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -221,10 +221,10 @@ async def test_streaming_response_create(self, async_client: AsyncIntercom) -> N @parametrize async def test_path_params_create(self, async_client: AsyncIntercom) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `path_id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): await async_client.contacts.companies.with_raw_response.create( - path_id="", - body_id="", + "", + company_id="", ) @parametrize