Skip to content

Commit

Permalink
feat(api): update via SDK Studio
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Jun 21, 2024
1 parent dfd8fba commit cd48024
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ from intercom.types.contacts import ContactAttachedCompanies

Methods:

- <code title="post /contacts/{id}/companies">client.contacts.companies.<a href="./src/intercom/resources/contacts/companies.py">create</a>(\*, path_id, \*\*<a href="src/intercom/types/contacts/company_create_params.py">params</a>) -> <a href="./src/intercom/types/shared/company.py">Company</a></code>
- <code title="post /contacts/{id}/companies">client.contacts.companies.<a href="./src/intercom/resources/contacts/companies.py">create</a>(id, \*\*<a href="src/intercom/types/contacts/company_create_params.py">params</a>) -> <a href="./src/intercom/types/shared/company.py">Company</a></code>
- <code title="get /contacts/{id}/companies">client.contacts.companies.<a href="./src/intercom/resources/contacts/companies.py">list</a>(id) -> <a href="./src/intercom/types/contacts/contact_attached_companies.py">ContactAttachedCompanies</a></code>
- <code title="delete /contacts/{contact_id}/companies/{id}">client.contacts.companies.<a href="./src/intercom/resources/contacts/companies.py">delete</a>(id, \*, contact_id) -> <a href="./src/intercom/types/shared/company.py">Company</a></code>

Expand Down
28 changes: 14 additions & 14 deletions src/intercom/resources/contacts/companies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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.
Expand All @@ -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
),
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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.
Expand All @@ -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
),
Expand Down
4 changes: 1 addition & 3 deletions src/intercom/types/contacts/company_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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[
Expand Down
44 changes: 22 additions & 22 deletions tests/api_resources/contacts/test_companies.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@ 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"])

@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
Expand All @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -179,25 +179,25 @@ 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"])

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

0 comments on commit cd48024

Please sign in to comment.