linq-python 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- linq/__init__.py +102 -0
- linq/_base_client.py +2149 -0
- linq/_client.py +2479 -0
- linq/_compat.py +226 -0
- linq/_constants.py +14 -0
- linq/_exceptions.py +108 -0
- linq/_files.py +123 -0
- linq/_models.py +878 -0
- linq/_qs.py +153 -0
- linq/_resource.py +43 -0
- linq/_response.py +833 -0
- linq/_streaming.py +338 -0
- linq/_types.py +271 -0
- linq/_utils/__init__.py +65 -0
- linq/_utils/_compat.py +45 -0
- linq/_utils/_datetime_parse.py +136 -0
- linq/_utils/_json.py +35 -0
- linq/_utils/_logs.py +25 -0
- linq/_utils/_path.py +127 -0
- linq/_utils/_proxy.py +65 -0
- linq/_utils/_reflection.py +42 -0
- linq/_utils/_resources_proxy.py +24 -0
- linq/_utils/_streams.py +12 -0
- linq/_utils/_sync.py +58 -0
- linq/_utils/_transform.py +457 -0
- linq/_utils/_typing.py +156 -0
- linq/_utils/_utils.py +421 -0
- linq/_version.py +4 -0
- linq/lib/.keep +4 -0
- linq/pagination.py +95 -0
- linq/py.typed +0 -0
- linq/resources/__init__.py +134 -0
- linq/resources/attachments.py +589 -0
- linq/resources/capability.py +297 -0
- linq/resources/chats/__init__.py +61 -0
- linq/resources/chats/chats.py +1492 -0
- linq/resources/chats/messages.py +416 -0
- linq/resources/chats/participants.py +322 -0
- linq/resources/chats/typing.py +299 -0
- linq/resources/contact_card.py +472 -0
- linq/resources/messages.py +686 -0
- linq/resources/phone_numbers.py +163 -0
- linq/resources/phonenumbers.py +165 -0
- linq/resources/webhook_events.py +319 -0
- linq/resources/webhook_subscriptions.py +776 -0
- linq/resources/webhooks.py +34 -0
- linq/types/__init__.py +90 -0
- linq/types/attachment_create_params.py +42 -0
- linq/types/attachment_create_response.py +44 -0
- linq/types/attachment_retrieve_response.py +55 -0
- linq/types/capability_check_RCS_params.py +20 -0
- linq/types/capability_check_i_message_params.py +20 -0
- linq/types/chat.py +44 -0
- linq/types/chat_create_params.py +33 -0
- linq/types/chat_create_response.py +44 -0
- linq/types/chat_created_webhook_event.py +87 -0
- linq/types/chat_group_icon_update_failed_webhook_event.py +65 -0
- linq/types/chat_group_icon_updated_webhook_event.py +66 -0
- linq/types/chat_group_name_update_failed_webhook_event.py +65 -0
- linq/types/chat_group_name_updated_webhook_event.py +66 -0
- linq/types/chat_leave_chat_response.py +15 -0
- linq/types/chat_list_chats_params.py +36 -0
- linq/types/chat_send_voicememo_params.py +23 -0
- linq/types/chat_send_voicememo_response.py +79 -0
- linq/types/chat_typing_indicator_started_webhook_event.py +52 -0
- linq/types/chat_typing_indicator_stopped_webhook_event.py +52 -0
- linq/types/chat_update_params.py +15 -0
- linq/types/chat_update_response.py +13 -0
- linq/types/chats/__init__.py +12 -0
- linq/types/chats/message_list_params.py +15 -0
- linq/types/chats/message_send_params.py +18 -0
- linq/types/chats/message_send_response.py +16 -0
- linq/types/chats/participant_add_params.py +12 -0
- linq/types/chats/participant_add_response.py +15 -0
- linq/types/chats/participant_remove_params.py +12 -0
- linq/types/chats/participant_remove_response.py +15 -0
- linq/types/chats/sent_message.py +69 -0
- linq/types/contact_card_create_params.py +24 -0
- linq/types/contact_card_retrieve_params.py +15 -0
- linq/types/contact_card_retrieve_response.py +23 -0
- linq/types/contact_card_update_params.py +21 -0
- linq/types/events_webhook_event.py +50 -0
- linq/types/handle_check_response.py +13 -0
- linq/types/link_part_param.py +22 -0
- linq/types/media_part_param.py +54 -0
- linq/types/message.py +87 -0
- linq/types/message_add_reaction_params.py +32 -0
- linq/types/message_add_reaction_response.py +15 -0
- linq/types/message_content_param.py +82 -0
- linq/types/message_delivered_webhook_event.py +65 -0
- linq/types/message_edited_webhook_event.py +100 -0
- linq/types/message_effect.py +23 -0
- linq/types/message_effect_param.py +22 -0
- linq/types/message_event_v2.py +116 -0
- linq/types/message_failed_webhook_event.py +72 -0
- linq/types/message_list_messages_thread_params.py +18 -0
- linq/types/message_read_webhook_event.py +65 -0
- linq/types/message_received_webhook_event.py +65 -0
- linq/types/message_sent_webhook_event.py +65 -0
- linq/types/message_update_params.py +15 -0
- linq/types/participant_added_webhook_event.py +66 -0
- linq/types/participant_removed_webhook_event.py +66 -0
- linq/types/phone_number_list_response.py +20 -0
- linq/types/phone_number_status_updated_webhook_event.py +82 -0
- linq/types/phonenumber_list_response.py +39 -0
- linq/types/reaction_added_webhook_event.py +46 -0
- linq/types/reaction_event_base.py +85 -0
- linq/types/reaction_removed_webhook_event.py +46 -0
- linq/types/reply_to.py +21 -0
- linq/types/reply_to_param.py +21 -0
- linq/types/schemas_media_part_response.py +29 -0
- linq/types/schemas_message_effect.py +18 -0
- linq/types/schemas_text_part_response.py +22 -0
- linq/types/set_contact_card.py +24 -0
- linq/types/shared/__init__.py +9 -0
- linq/types/shared/chat_handle.py +33 -0
- linq/types/shared/media_part_response.py +34 -0
- linq/types/shared/reaction.py +56 -0
- linq/types/shared/reaction_type.py +7 -0
- linq/types/shared/service_type.py +7 -0
- linq/types/shared/text_decoration.py +23 -0
- linq/types/shared/text_part_response.py +26 -0
- linq/types/shared_params/__init__.py +5 -0
- linq/types/shared_params/reaction_type.py +9 -0
- linq/types/shared_params/service_type.py +9 -0
- linq/types/shared_params/text_decoration.py +23 -0
- linq/types/supported_content_type.py +60 -0
- linq/types/text_part_param.py +44 -0
- linq/types/webhook_event_list_response.py +17 -0
- linq/types/webhook_event_type.py +33 -0
- linq/types/webhook_subscription.py +35 -0
- linq/types/webhook_subscription_create_params.py +27 -0
- linq/types/webhook_subscription_create_response.py +46 -0
- linq/types/webhook_subscription_list_response.py +13 -0
- linq/types/webhook_subscription_update_params.py +30 -0
- linq_python-0.1.0.dist-info/METADATA +572 -0
- linq_python-0.1.0.dist-info/RECORD +139 -0
- linq_python-0.1.0.dist-info/WHEEL +4 -0
- linq_python-0.1.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ..types import contact_card_create_params, contact_card_update_params, contact_card_retrieve_params
|
|
8
|
+
from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
9
|
+
from .._utils import maybe_transform, async_maybe_transform
|
|
10
|
+
from .._compat import cached_property
|
|
11
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
12
|
+
from .._response import (
|
|
13
|
+
to_raw_response_wrapper,
|
|
14
|
+
to_streamed_response_wrapper,
|
|
15
|
+
async_to_raw_response_wrapper,
|
|
16
|
+
async_to_streamed_response_wrapper,
|
|
17
|
+
)
|
|
18
|
+
from .._base_client import make_request_options
|
|
19
|
+
from ..types.set_contact_card import SetContactCard
|
|
20
|
+
from ..types.contact_card_retrieve_response import ContactCardRetrieveResponse
|
|
21
|
+
|
|
22
|
+
__all__ = ["ContactCardResource", "AsyncContactCardResource"]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ContactCardResource(SyncAPIResource):
|
|
26
|
+
"""
|
|
27
|
+
Contact Card lets you set and share your contact information (name and profile photo) with chat participants via iMessage Name and Photo Sharing.
|
|
28
|
+
|
|
29
|
+
Use `POST /v3/contact_card` to create or update a card for a phone number.
|
|
30
|
+
Use `PATCH /v3/contact_card` to update an existing active card.
|
|
31
|
+
Use `GET /v3/contact_card` to retrieve the active card(s) for your partner account.
|
|
32
|
+
|
|
33
|
+
**Sharing behavior:** Sharing may not take effect in every chat due to limitations outside our control. We recommend calling the share endpoint once per day, after the first outbound activity.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
@cached_property
|
|
37
|
+
def with_raw_response(self) -> ContactCardResourceWithRawResponse:
|
|
38
|
+
"""
|
|
39
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
40
|
+
the raw response object instead of the parsed content.
|
|
41
|
+
|
|
42
|
+
For more information, see https://www.github.com/linq-team/linq-python#accessing-raw-response-data-eg-headers
|
|
43
|
+
"""
|
|
44
|
+
return ContactCardResourceWithRawResponse(self)
|
|
45
|
+
|
|
46
|
+
@cached_property
|
|
47
|
+
def with_streaming_response(self) -> ContactCardResourceWithStreamingResponse:
|
|
48
|
+
"""
|
|
49
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
50
|
+
|
|
51
|
+
For more information, see https://www.github.com/linq-team/linq-python#with_streaming_response
|
|
52
|
+
"""
|
|
53
|
+
return ContactCardResourceWithStreamingResponse(self)
|
|
54
|
+
|
|
55
|
+
def create(
|
|
56
|
+
self,
|
|
57
|
+
*,
|
|
58
|
+
first_name: str,
|
|
59
|
+
phone_number: str,
|
|
60
|
+
image_url: str | Omit = omit,
|
|
61
|
+
last_name: str | Omit = omit,
|
|
62
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
63
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
64
|
+
extra_headers: Headers | None = None,
|
|
65
|
+
extra_query: Query | None = None,
|
|
66
|
+
extra_body: Body | None = None,
|
|
67
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
68
|
+
) -> SetContactCard:
|
|
69
|
+
"""Creates a contact card for a phone number.
|
|
70
|
+
|
|
71
|
+
This endpoint is intended for
|
|
72
|
+
initial, one-time setup only.
|
|
73
|
+
|
|
74
|
+
The contact card is stored in an inactive state first. Once it's applied
|
|
75
|
+
successfully, it is activated and `is_active` is returned as `true`. On failure,
|
|
76
|
+
`is_active` is `false`.
|
|
77
|
+
|
|
78
|
+
**Note:** To update an existing contact card after setup, use
|
|
79
|
+
`PATCH /v3/contact_card` instead.
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
first_name: First name for the contact card. Required.
|
|
83
|
+
|
|
84
|
+
phone_number: E.164 phone number to associate the contact card with
|
|
85
|
+
|
|
86
|
+
image_url: URL of the profile image to rehost on the CDN. Only re-uploaded when a new value
|
|
87
|
+
is provided.
|
|
88
|
+
|
|
89
|
+
last_name: Last name for the contact card. Optional.
|
|
90
|
+
|
|
91
|
+
extra_headers: Send extra headers
|
|
92
|
+
|
|
93
|
+
extra_query: Add additional query parameters to the request
|
|
94
|
+
|
|
95
|
+
extra_body: Add additional JSON properties to the request
|
|
96
|
+
|
|
97
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
98
|
+
"""
|
|
99
|
+
return self._post(
|
|
100
|
+
"/v3/contact_card",
|
|
101
|
+
body=maybe_transform(
|
|
102
|
+
{
|
|
103
|
+
"first_name": first_name,
|
|
104
|
+
"phone_number": phone_number,
|
|
105
|
+
"image_url": image_url,
|
|
106
|
+
"last_name": last_name,
|
|
107
|
+
},
|
|
108
|
+
contact_card_create_params.ContactCardCreateParams,
|
|
109
|
+
),
|
|
110
|
+
options=make_request_options(
|
|
111
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
112
|
+
),
|
|
113
|
+
cast_to=SetContactCard,
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
def retrieve(
|
|
117
|
+
self,
|
|
118
|
+
*,
|
|
119
|
+
phone_number: str | Omit = omit,
|
|
120
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
121
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
122
|
+
extra_headers: Headers | None = None,
|
|
123
|
+
extra_query: Query | None = None,
|
|
124
|
+
extra_body: Body | None = None,
|
|
125
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
126
|
+
) -> ContactCardRetrieveResponse:
|
|
127
|
+
"""
|
|
128
|
+
Returns the contact card for a specific phone number, or all contact cards for
|
|
129
|
+
the authenticated partner if no `phone_number` is provided.
|
|
130
|
+
|
|
131
|
+
Args:
|
|
132
|
+
phone_number: E.164 phone number to filter by. If omitted, all my cards for the partner are
|
|
133
|
+
returned.
|
|
134
|
+
|
|
135
|
+
extra_headers: Send extra headers
|
|
136
|
+
|
|
137
|
+
extra_query: Add additional query parameters to the request
|
|
138
|
+
|
|
139
|
+
extra_body: Add additional JSON properties to the request
|
|
140
|
+
|
|
141
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
142
|
+
"""
|
|
143
|
+
return self._get(
|
|
144
|
+
"/v3/contact_card",
|
|
145
|
+
options=make_request_options(
|
|
146
|
+
extra_headers=extra_headers,
|
|
147
|
+
extra_query=extra_query,
|
|
148
|
+
extra_body=extra_body,
|
|
149
|
+
timeout=timeout,
|
|
150
|
+
query=maybe_transform(
|
|
151
|
+
{"phone_number": phone_number}, contact_card_retrieve_params.ContactCardRetrieveParams
|
|
152
|
+
),
|
|
153
|
+
),
|
|
154
|
+
cast_to=ContactCardRetrieveResponse,
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
def update(
|
|
158
|
+
self,
|
|
159
|
+
*,
|
|
160
|
+
phone_number: str,
|
|
161
|
+
first_name: str | Omit = omit,
|
|
162
|
+
image_url: str | Omit = omit,
|
|
163
|
+
last_name: str | Omit = omit,
|
|
164
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
165
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
166
|
+
extra_headers: Headers | None = None,
|
|
167
|
+
extra_query: Query | None = None,
|
|
168
|
+
extra_body: Body | None = None,
|
|
169
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
170
|
+
) -> SetContactCard:
|
|
171
|
+
"""
|
|
172
|
+
Partially updates an existing active contact card for a phone number.
|
|
173
|
+
|
|
174
|
+
Fetches the current active contact card and merges the provided fields. Only
|
|
175
|
+
fields present in the request body are updated; omitted fields retain their
|
|
176
|
+
existing values.
|
|
177
|
+
|
|
178
|
+
Requires an active contact card to exist for the phone number.
|
|
179
|
+
|
|
180
|
+
Args:
|
|
181
|
+
phone_number: E.164 phone number of the contact card to update
|
|
182
|
+
|
|
183
|
+
first_name: Updated first name. If omitted, the existing value is kept.
|
|
184
|
+
|
|
185
|
+
image_url: Updated profile image URL. If omitted, the existing image is kept.
|
|
186
|
+
|
|
187
|
+
last_name: Updated last name. If omitted, the existing value is kept.
|
|
188
|
+
|
|
189
|
+
extra_headers: Send extra headers
|
|
190
|
+
|
|
191
|
+
extra_query: Add additional query parameters to the request
|
|
192
|
+
|
|
193
|
+
extra_body: Add additional JSON properties to the request
|
|
194
|
+
|
|
195
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
196
|
+
"""
|
|
197
|
+
return self._patch(
|
|
198
|
+
"/v3/contact_card",
|
|
199
|
+
body=maybe_transform(
|
|
200
|
+
{
|
|
201
|
+
"first_name": first_name,
|
|
202
|
+
"image_url": image_url,
|
|
203
|
+
"last_name": last_name,
|
|
204
|
+
},
|
|
205
|
+
contact_card_update_params.ContactCardUpdateParams,
|
|
206
|
+
),
|
|
207
|
+
options=make_request_options(
|
|
208
|
+
extra_headers=extra_headers,
|
|
209
|
+
extra_query=extra_query,
|
|
210
|
+
extra_body=extra_body,
|
|
211
|
+
timeout=timeout,
|
|
212
|
+
query=maybe_transform(
|
|
213
|
+
{"phone_number": phone_number}, contact_card_update_params.ContactCardUpdateParams
|
|
214
|
+
),
|
|
215
|
+
),
|
|
216
|
+
cast_to=SetContactCard,
|
|
217
|
+
)
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
class AsyncContactCardResource(AsyncAPIResource):
|
|
221
|
+
"""
|
|
222
|
+
Contact Card lets you set and share your contact information (name and profile photo) with chat participants via iMessage Name and Photo Sharing.
|
|
223
|
+
|
|
224
|
+
Use `POST /v3/contact_card` to create or update a card for a phone number.
|
|
225
|
+
Use `PATCH /v3/contact_card` to update an existing active card.
|
|
226
|
+
Use `GET /v3/contact_card` to retrieve the active card(s) for your partner account.
|
|
227
|
+
|
|
228
|
+
**Sharing behavior:** Sharing may not take effect in every chat due to limitations outside our control. We recommend calling the share endpoint once per day, after the first outbound activity.
|
|
229
|
+
"""
|
|
230
|
+
|
|
231
|
+
@cached_property
|
|
232
|
+
def with_raw_response(self) -> AsyncContactCardResourceWithRawResponse:
|
|
233
|
+
"""
|
|
234
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
235
|
+
the raw response object instead of the parsed content.
|
|
236
|
+
|
|
237
|
+
For more information, see https://www.github.com/linq-team/linq-python#accessing-raw-response-data-eg-headers
|
|
238
|
+
"""
|
|
239
|
+
return AsyncContactCardResourceWithRawResponse(self)
|
|
240
|
+
|
|
241
|
+
@cached_property
|
|
242
|
+
def with_streaming_response(self) -> AsyncContactCardResourceWithStreamingResponse:
|
|
243
|
+
"""
|
|
244
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
245
|
+
|
|
246
|
+
For more information, see https://www.github.com/linq-team/linq-python#with_streaming_response
|
|
247
|
+
"""
|
|
248
|
+
return AsyncContactCardResourceWithStreamingResponse(self)
|
|
249
|
+
|
|
250
|
+
async def create(
|
|
251
|
+
self,
|
|
252
|
+
*,
|
|
253
|
+
first_name: str,
|
|
254
|
+
phone_number: str,
|
|
255
|
+
image_url: str | Omit = omit,
|
|
256
|
+
last_name: str | Omit = omit,
|
|
257
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
258
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
259
|
+
extra_headers: Headers | None = None,
|
|
260
|
+
extra_query: Query | None = None,
|
|
261
|
+
extra_body: Body | None = None,
|
|
262
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
263
|
+
) -> SetContactCard:
|
|
264
|
+
"""Creates a contact card for a phone number.
|
|
265
|
+
|
|
266
|
+
This endpoint is intended for
|
|
267
|
+
initial, one-time setup only.
|
|
268
|
+
|
|
269
|
+
The contact card is stored in an inactive state first. Once it's applied
|
|
270
|
+
successfully, it is activated and `is_active` is returned as `true`. On failure,
|
|
271
|
+
`is_active` is `false`.
|
|
272
|
+
|
|
273
|
+
**Note:** To update an existing contact card after setup, use
|
|
274
|
+
`PATCH /v3/contact_card` instead.
|
|
275
|
+
|
|
276
|
+
Args:
|
|
277
|
+
first_name: First name for the contact card. Required.
|
|
278
|
+
|
|
279
|
+
phone_number: E.164 phone number to associate the contact card with
|
|
280
|
+
|
|
281
|
+
image_url: URL of the profile image to rehost on the CDN. Only re-uploaded when a new value
|
|
282
|
+
is provided.
|
|
283
|
+
|
|
284
|
+
last_name: Last name for the contact card. Optional.
|
|
285
|
+
|
|
286
|
+
extra_headers: Send extra headers
|
|
287
|
+
|
|
288
|
+
extra_query: Add additional query parameters to the request
|
|
289
|
+
|
|
290
|
+
extra_body: Add additional JSON properties to the request
|
|
291
|
+
|
|
292
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
293
|
+
"""
|
|
294
|
+
return await self._post(
|
|
295
|
+
"/v3/contact_card",
|
|
296
|
+
body=await async_maybe_transform(
|
|
297
|
+
{
|
|
298
|
+
"first_name": first_name,
|
|
299
|
+
"phone_number": phone_number,
|
|
300
|
+
"image_url": image_url,
|
|
301
|
+
"last_name": last_name,
|
|
302
|
+
},
|
|
303
|
+
contact_card_create_params.ContactCardCreateParams,
|
|
304
|
+
),
|
|
305
|
+
options=make_request_options(
|
|
306
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
307
|
+
),
|
|
308
|
+
cast_to=SetContactCard,
|
|
309
|
+
)
|
|
310
|
+
|
|
311
|
+
async def retrieve(
|
|
312
|
+
self,
|
|
313
|
+
*,
|
|
314
|
+
phone_number: str | Omit = omit,
|
|
315
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
316
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
317
|
+
extra_headers: Headers | None = None,
|
|
318
|
+
extra_query: Query | None = None,
|
|
319
|
+
extra_body: Body | None = None,
|
|
320
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
321
|
+
) -> ContactCardRetrieveResponse:
|
|
322
|
+
"""
|
|
323
|
+
Returns the contact card for a specific phone number, or all contact cards for
|
|
324
|
+
the authenticated partner if no `phone_number` is provided.
|
|
325
|
+
|
|
326
|
+
Args:
|
|
327
|
+
phone_number: E.164 phone number to filter by. If omitted, all my cards for the partner are
|
|
328
|
+
returned.
|
|
329
|
+
|
|
330
|
+
extra_headers: Send extra headers
|
|
331
|
+
|
|
332
|
+
extra_query: Add additional query parameters to the request
|
|
333
|
+
|
|
334
|
+
extra_body: Add additional JSON properties to the request
|
|
335
|
+
|
|
336
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
337
|
+
"""
|
|
338
|
+
return await self._get(
|
|
339
|
+
"/v3/contact_card",
|
|
340
|
+
options=make_request_options(
|
|
341
|
+
extra_headers=extra_headers,
|
|
342
|
+
extra_query=extra_query,
|
|
343
|
+
extra_body=extra_body,
|
|
344
|
+
timeout=timeout,
|
|
345
|
+
query=await async_maybe_transform(
|
|
346
|
+
{"phone_number": phone_number}, contact_card_retrieve_params.ContactCardRetrieveParams
|
|
347
|
+
),
|
|
348
|
+
),
|
|
349
|
+
cast_to=ContactCardRetrieveResponse,
|
|
350
|
+
)
|
|
351
|
+
|
|
352
|
+
async def update(
|
|
353
|
+
self,
|
|
354
|
+
*,
|
|
355
|
+
phone_number: str,
|
|
356
|
+
first_name: str | Omit = omit,
|
|
357
|
+
image_url: str | Omit = omit,
|
|
358
|
+
last_name: str | Omit = omit,
|
|
359
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
360
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
361
|
+
extra_headers: Headers | None = None,
|
|
362
|
+
extra_query: Query | None = None,
|
|
363
|
+
extra_body: Body | None = None,
|
|
364
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
365
|
+
) -> SetContactCard:
|
|
366
|
+
"""
|
|
367
|
+
Partially updates an existing active contact card for a phone number.
|
|
368
|
+
|
|
369
|
+
Fetches the current active contact card and merges the provided fields. Only
|
|
370
|
+
fields present in the request body are updated; omitted fields retain their
|
|
371
|
+
existing values.
|
|
372
|
+
|
|
373
|
+
Requires an active contact card to exist for the phone number.
|
|
374
|
+
|
|
375
|
+
Args:
|
|
376
|
+
phone_number: E.164 phone number of the contact card to update
|
|
377
|
+
|
|
378
|
+
first_name: Updated first name. If omitted, the existing value is kept.
|
|
379
|
+
|
|
380
|
+
image_url: Updated profile image URL. If omitted, the existing image is kept.
|
|
381
|
+
|
|
382
|
+
last_name: Updated last name. If omitted, the existing value is kept.
|
|
383
|
+
|
|
384
|
+
extra_headers: Send extra headers
|
|
385
|
+
|
|
386
|
+
extra_query: Add additional query parameters to the request
|
|
387
|
+
|
|
388
|
+
extra_body: Add additional JSON properties to the request
|
|
389
|
+
|
|
390
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
391
|
+
"""
|
|
392
|
+
return await self._patch(
|
|
393
|
+
"/v3/contact_card",
|
|
394
|
+
body=await async_maybe_transform(
|
|
395
|
+
{
|
|
396
|
+
"first_name": first_name,
|
|
397
|
+
"image_url": image_url,
|
|
398
|
+
"last_name": last_name,
|
|
399
|
+
},
|
|
400
|
+
contact_card_update_params.ContactCardUpdateParams,
|
|
401
|
+
),
|
|
402
|
+
options=make_request_options(
|
|
403
|
+
extra_headers=extra_headers,
|
|
404
|
+
extra_query=extra_query,
|
|
405
|
+
extra_body=extra_body,
|
|
406
|
+
timeout=timeout,
|
|
407
|
+
query=await async_maybe_transform(
|
|
408
|
+
{"phone_number": phone_number}, contact_card_update_params.ContactCardUpdateParams
|
|
409
|
+
),
|
|
410
|
+
),
|
|
411
|
+
cast_to=SetContactCard,
|
|
412
|
+
)
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
class ContactCardResourceWithRawResponse:
|
|
416
|
+
def __init__(self, contact_card: ContactCardResource) -> None:
|
|
417
|
+
self._contact_card = contact_card
|
|
418
|
+
|
|
419
|
+
self.create = to_raw_response_wrapper(
|
|
420
|
+
contact_card.create,
|
|
421
|
+
)
|
|
422
|
+
self.retrieve = to_raw_response_wrapper(
|
|
423
|
+
contact_card.retrieve,
|
|
424
|
+
)
|
|
425
|
+
self.update = to_raw_response_wrapper(
|
|
426
|
+
contact_card.update,
|
|
427
|
+
)
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
class AsyncContactCardResourceWithRawResponse:
|
|
431
|
+
def __init__(self, contact_card: AsyncContactCardResource) -> None:
|
|
432
|
+
self._contact_card = contact_card
|
|
433
|
+
|
|
434
|
+
self.create = async_to_raw_response_wrapper(
|
|
435
|
+
contact_card.create,
|
|
436
|
+
)
|
|
437
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
438
|
+
contact_card.retrieve,
|
|
439
|
+
)
|
|
440
|
+
self.update = async_to_raw_response_wrapper(
|
|
441
|
+
contact_card.update,
|
|
442
|
+
)
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
class ContactCardResourceWithStreamingResponse:
|
|
446
|
+
def __init__(self, contact_card: ContactCardResource) -> None:
|
|
447
|
+
self._contact_card = contact_card
|
|
448
|
+
|
|
449
|
+
self.create = to_streamed_response_wrapper(
|
|
450
|
+
contact_card.create,
|
|
451
|
+
)
|
|
452
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
453
|
+
contact_card.retrieve,
|
|
454
|
+
)
|
|
455
|
+
self.update = to_streamed_response_wrapper(
|
|
456
|
+
contact_card.update,
|
|
457
|
+
)
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
class AsyncContactCardResourceWithStreamingResponse:
|
|
461
|
+
def __init__(self, contact_card: AsyncContactCardResource) -> None:
|
|
462
|
+
self._contact_card = contact_card
|
|
463
|
+
|
|
464
|
+
self.create = async_to_streamed_response_wrapper(
|
|
465
|
+
contact_card.create,
|
|
466
|
+
)
|
|
467
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
468
|
+
contact_card.retrieve,
|
|
469
|
+
)
|
|
470
|
+
self.update = async_to_streamed_response_wrapper(
|
|
471
|
+
contact_card.update,
|
|
472
|
+
)
|