77import httpx
88
99from ..._types import NOT_GIVEN , Body , Query , Headers , NotGiven
10- from ..._utils import (
11- maybe_transform ,
12- strip_not_given ,
13- async_maybe_transform ,
14- )
10+ from ..._utils import strip_not_given
1511from ..._compat import cached_property
1612from ..._resource import SyncAPIResource , AsyncAPIResource
1713from ..._response import (
2319from ..._base_client import (
2420 make_request_options ,
2521)
26- from ...types .contacts import company_create_params
2722from ...types .shared .company import Company
28- from ...types .contacts .contact_attached_companies import ContactAttachedCompanies
2923
3024__all__ = ["CompaniesResource" , "AsyncCompaniesResource" ]
3125
@@ -39,126 +33,6 @@ def with_raw_response(self) -> CompaniesResourceWithRawResponse:
3933 def with_streaming_response (self ) -> CompaniesResourceWithStreamingResponse :
4034 return CompaniesResourceWithStreamingResponse (self )
4135
42- def create (
43- self ,
44- id : str ,
45- * ,
46- company_id : str ,
47- intercom_version : Literal [
48- "1.0" ,
49- "1.1" ,
50- "1.2" ,
51- "1.3" ,
52- "1.4" ,
53- "2.0" ,
54- "2.1" ,
55- "2.2" ,
56- "2.3" ,
57- "2.4" ,
58- "2.5" ,
59- "2.6" ,
60- "2.7" ,
61- "2.8" ,
62- "2.9" ,
63- "2.10" ,
64- "2.11" ,
65- "Unstable" ,
66- ]
67- | NotGiven = NOT_GIVEN ,
68- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
69- # The extra values given here take precedence over values defined on the client or passed to this method.
70- extra_headers : Headers | None = None ,
71- extra_query : Query | None = None ,
72- extra_body : Body | None = None ,
73- timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
74- ) -> Company :
75- """
76- You can attach a company to a single contact.
77-
78- Args:
79- company_id: The unique identifier for the company which is given by Intercom
80-
81- intercom_version: Intercom API version.By default, it's equal to the version set in the app
82- package.
83-
84- extra_headers: Send extra headers
85-
86- extra_query: Add additional query parameters to the request
87-
88- extra_body: Add additional JSON properties to the request
89-
90- timeout: Override the client-level default timeout for this request, in seconds
91- """
92- if not id :
93- raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
94- extra_headers = {** strip_not_given ({"Intercom-Version" : str (intercom_version )}), ** (extra_headers or {})}
95- return self ._post (
96- f"/contacts/{ id } /companies" ,
97- body = maybe_transform ({"id" : company_id }, company_create_params .CompanyCreateParams ),
98- options = make_request_options (
99- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
100- ),
101- cast_to = Company ,
102- )
103-
104- def list (
105- self ,
106- id : str ,
107- * ,
108- intercom_version : Literal [
109- "1.0" ,
110- "1.1" ,
111- "1.2" ,
112- "1.3" ,
113- "1.4" ,
114- "2.0" ,
115- "2.1" ,
116- "2.2" ,
117- "2.3" ,
118- "2.4" ,
119- "2.5" ,
120- "2.6" ,
121- "2.7" ,
122- "2.8" ,
123- "2.9" ,
124- "2.10" ,
125- "2.11" ,
126- "Unstable" ,
127- ]
128- | NotGiven = NOT_GIVEN ,
129- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
130- # The extra values given here take precedence over values defined on the client or passed to this method.
131- extra_headers : Headers | None = None ,
132- extra_query : Query | None = None ,
133- extra_body : Body | None = None ,
134- timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
135- ) -> ContactAttachedCompanies :
136- """
137- You can fetch a list of companies that are associated to a contact.
138-
139- Args:
140- intercom_version: Intercom API version.By default, it's equal to the version set in the app
141- package.
142-
143- extra_headers: Send extra headers
144-
145- extra_query: Add additional query parameters to the request
146-
147- extra_body: Add additional JSON properties to the request
148-
149- timeout: Override the client-level default timeout for this request, in seconds
150- """
151- if not id :
152- raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
153- extra_headers = {** strip_not_given ({"Intercom-Version" : str (intercom_version )}), ** (extra_headers or {})}
154- return self ._get (
155- f"/contacts/{ id } /companies" ,
156- options = make_request_options (
157- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
158- ),
159- cast_to = ContactAttachedCompanies ,
160- )
161-
16236 def delete (
16337 self ,
16438 id : str ,
@@ -230,126 +104,6 @@ def with_raw_response(self) -> AsyncCompaniesResourceWithRawResponse:
230104 def with_streaming_response (self ) -> AsyncCompaniesResourceWithStreamingResponse :
231105 return AsyncCompaniesResourceWithStreamingResponse (self )
232106
233- async def create (
234- self ,
235- id : str ,
236- * ,
237- company_id : str ,
238- intercom_version : Literal [
239- "1.0" ,
240- "1.1" ,
241- "1.2" ,
242- "1.3" ,
243- "1.4" ,
244- "2.0" ,
245- "2.1" ,
246- "2.2" ,
247- "2.3" ,
248- "2.4" ,
249- "2.5" ,
250- "2.6" ,
251- "2.7" ,
252- "2.8" ,
253- "2.9" ,
254- "2.10" ,
255- "2.11" ,
256- "Unstable" ,
257- ]
258- | NotGiven = NOT_GIVEN ,
259- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
260- # The extra values given here take precedence over values defined on the client or passed to this method.
261- extra_headers : Headers | None = None ,
262- extra_query : Query | None = None ,
263- extra_body : Body | None = None ,
264- timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
265- ) -> Company :
266- """
267- You can attach a company to a single contact.
268-
269- Args:
270- company_id: The unique identifier for the company which is given by Intercom
271-
272- intercom_version: Intercom API version.By default, it's equal to the version set in the app
273- package.
274-
275- extra_headers: Send extra headers
276-
277- extra_query: Add additional query parameters to the request
278-
279- extra_body: Add additional JSON properties to the request
280-
281- timeout: Override the client-level default timeout for this request, in seconds
282- """
283- if not id :
284- raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
285- extra_headers = {** strip_not_given ({"Intercom-Version" : str (intercom_version )}), ** (extra_headers or {})}
286- return await self ._post (
287- f"/contacts/{ id } /companies" ,
288- body = await async_maybe_transform ({"id" : company_id }, company_create_params .CompanyCreateParams ),
289- options = make_request_options (
290- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
291- ),
292- cast_to = Company ,
293- )
294-
295- async def list (
296- self ,
297- id : str ,
298- * ,
299- intercom_version : Literal [
300- "1.0" ,
301- "1.1" ,
302- "1.2" ,
303- "1.3" ,
304- "1.4" ,
305- "2.0" ,
306- "2.1" ,
307- "2.2" ,
308- "2.3" ,
309- "2.4" ,
310- "2.5" ,
311- "2.6" ,
312- "2.7" ,
313- "2.8" ,
314- "2.9" ,
315- "2.10" ,
316- "2.11" ,
317- "Unstable" ,
318- ]
319- | NotGiven = NOT_GIVEN ,
320- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
321- # The extra values given here take precedence over values defined on the client or passed to this method.
322- extra_headers : Headers | None = None ,
323- extra_query : Query | None = None ,
324- extra_body : Body | None = None ,
325- timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
326- ) -> ContactAttachedCompanies :
327- """
328- You can fetch a list of companies that are associated to a contact.
329-
330- Args:
331- intercom_version: Intercom API version.By default, it's equal to the version set in the app
332- package.
333-
334- extra_headers: Send extra headers
335-
336- extra_query: Add additional query parameters to the request
337-
338- extra_body: Add additional JSON properties to the request
339-
340- timeout: Override the client-level default timeout for this request, in seconds
341- """
342- if not id :
343- raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
344- extra_headers = {** strip_not_given ({"Intercom-Version" : str (intercom_version )}), ** (extra_headers or {})}
345- return await self ._get (
346- f"/contacts/{ id } /companies" ,
347- options = make_request_options (
348- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
349- ),
350- cast_to = ContactAttachedCompanies ,
351- )
352-
353107 async def delete (
354108 self ,
355109 id : str ,
@@ -416,12 +170,6 @@ class CompaniesResourceWithRawResponse:
416170 def __init__ (self , companies : CompaniesResource ) -> None :
417171 self ._companies = companies
418172
419- self .create = to_raw_response_wrapper (
420- companies .create ,
421- )
422- self .list = to_raw_response_wrapper (
423- companies .list ,
424- )
425173 self .delete = to_raw_response_wrapper (
426174 companies .delete ,
427175 )
@@ -431,12 +179,6 @@ class AsyncCompaniesResourceWithRawResponse:
431179 def __init__ (self , companies : AsyncCompaniesResource ) -> None :
432180 self ._companies = companies
433181
434- self .create = async_to_raw_response_wrapper (
435- companies .create ,
436- )
437- self .list = async_to_raw_response_wrapper (
438- companies .list ,
439- )
440182 self .delete = async_to_raw_response_wrapper (
441183 companies .delete ,
442184 )
@@ -446,12 +188,6 @@ class CompaniesResourceWithStreamingResponse:
446188 def __init__ (self , companies : CompaniesResource ) -> None :
447189 self ._companies = companies
448190
449- self .create = to_streamed_response_wrapper (
450- companies .create ,
451- )
452- self .list = to_streamed_response_wrapper (
453- companies .list ,
454- )
455191 self .delete = to_streamed_response_wrapper (
456192 companies .delete ,
457193 )
@@ -461,12 +197,6 @@ class AsyncCompaniesResourceWithStreamingResponse:
461197 def __init__ (self , companies : AsyncCompaniesResource ) -> None :
462198 self ._companies = companies
463199
464- self .create = async_to_streamed_response_wrapper (
465- companies .create ,
466- )
467- self .list = async_to_streamed_response_wrapper (
468- companies .list ,
469- )
470200 self .delete = async_to_streamed_response_wrapper (
471201 companies .delete ,
472202 )
0 commit comments