Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 37
configured_endpoints: 41
26 changes: 24 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,25 @@ Methods:
Types:

```python
from linq.types import Message, MessageEffect, ReplyTo, MessageAddReactionResponse
from linq.types import (
Message,
MessageEffect,
ReplyTo,
MessageCreateResponse,
MessageAddReactionResponse,
MessageUpdateAppCardResponse,
)
```

Methods:

- <code title="post /v3/messages">client.messages.<a href="./src/linq/resources/messages.py">create</a>(\*\*<a href="src/linq/types/message_create_params.py">params</a>) -> <a href="./src/linq/types/message_create_response.py">MessageCreateResponse</a></code>
- <code title="get /v3/messages/{messageId}">client.messages.<a href="./src/linq/resources/messages.py">retrieve</a>(message_id) -> <a href="./src/linq/types/message.py">Message</a></code>
- <code title="patch /v3/messages/{messageId}">client.messages.<a href="./src/linq/resources/messages.py">update</a>(message_id, \*\*<a href="src/linq/types/message_update_params.py">params</a>) -> <a href="./src/linq/types/message.py">Message</a></code>
- <code title="delete /v3/messages/{messageId}">client.messages.<a href="./src/linq/resources/messages.py">delete</a>(message_id) -> None</code>
- <code title="post /v3/messages/{messageId}/reactions">client.messages.<a href="./src/linq/resources/messages.py">add_reaction</a>(message_id, \*\*<a href="src/linq/types/message_add_reaction_params.py">params</a>) -> <a href="./src/linq/types/message_add_reaction_response.py">MessageAddReactionResponse</a></code>
- <code title="get /v3/messages/{messageId}/thread">client.messages.<a href="./src/linq/resources/messages.py">list_messages_thread</a>(message_id, \*\*<a href="src/linq/types/message_list_messages_thread_params.py">params</a>) -> <a href="./src/linq/types/message.py">SyncListMessagesPagination[Message]</a></code>
- <code title="post /v3/messages/{messageId}/update">client.messages.<a href="./src/linq/resources/messages.py">update_app_card</a>(message_id, \*\*<a href="src/linq/types/message_update_app_card_params.py">params</a>) -> <a href="./src/linq/types/message_update_app_card_response.py">MessageUpdateAppCardResponse</a></code>

# Attachments

Expand Down Expand Up @@ -135,13 +144,26 @@ Methods:
Types:

```python
from linq.types import PhoneNumberListResponse
from linq.types import PhoneNumberUpdateResponse, PhoneNumberListResponse
```

Methods:

- <code title="put /v3/phone_numbers/{phoneNumberId}">client.phone_numbers.<a href="./src/linq/resources/phone_numbers.py">update</a>(phone_number_id, \*\*<a href="src/linq/types/phone_number_update_params.py">params</a>) -> <a href="./src/linq/types/phone_number_update_response.py">PhoneNumberUpdateResponse</a></code>
- <code title="get /v3/phone_numbers">client.phone_numbers.<a href="./src/linq/resources/phone_numbers.py">list</a>() -> <a href="./src/linq/types/phone_number_list_response.py">PhoneNumberListResponse</a></code>

# AvailableNumber

Types:

```python
from linq.types import AvailableNumberRetrieveResponse
```

Methods:

- <code title="get /v3/available_number">client.available_number.<a href="./src/linq/resources/available_number.py">retrieve</a>(\*\*<a href="src/linq/types/available_number_retrieve_params.py">params</a>) -> <a href="./src/linq/types/available_number_retrieve_response.py">AvailableNumberRetrieveResponse</a></code>

# WebhookEvents

Types:
Expand Down
354 changes: 342 additions & 12 deletions src/linq/_client.py

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions src/linq/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@
WebhookEventsResourceWithStreamingResponse,
AsyncWebhookEventsResourceWithStreamingResponse,
)
from .available_number import (
AvailableNumberResource,
AsyncAvailableNumberResource,
AvailableNumberResourceWithRawResponse,
AsyncAvailableNumberResourceWithRawResponse,
AvailableNumberResourceWithStreamingResponse,
AsyncAvailableNumberResourceWithStreamingResponse,
)
from .webhook_subscriptions import (
WebhookSubscriptionsResource,
AsyncWebhookSubscriptionsResource,
Expand Down Expand Up @@ -105,6 +113,12 @@
"AsyncPhoneNumbersResourceWithRawResponse",
"PhoneNumbersResourceWithStreamingResponse",
"AsyncPhoneNumbersResourceWithStreamingResponse",
"AvailableNumberResource",
"AsyncAvailableNumberResource",
"AvailableNumberResourceWithRawResponse",
"AsyncAvailableNumberResourceWithRawResponse",
"AvailableNumberResourceWithStreamingResponse",
"AsyncAvailableNumberResourceWithStreamingResponse",
"WebhookEventsResource",
"AsyncWebhookEventsResource",
"WebhookEventsResourceWithRawResponse",
Expand Down
4 changes: 2 additions & 2 deletions src/linq/resources/attachments.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class AttachmentsResource(SyncAPIResource):
|---|---|---|
| Attachment bytes | Retained until you `DELETE` | **Auto-removed after 1 day**, also removable via `DELETE` |
| Attachment metadata (id, filename, mime type, size) | Retained until you `DELETE` | Removed alongside the bytes |
| Message body & parts | Retained per message-retention policy | Retained per message-retention policy |
| Message body & parts | Retained per message-retention policy | Retained per message-retention policy — unless the line also has **ephemeral messages** enabled (see the Messages page), in which case the message and its parts are deleted 24 hours after creation |
| Audit log of deletions | Retained per platform retention policy | Retained per platform retention policy |

**In transit:** TLS 1.2+ everywhere. **At rest:** AES-256 (server-side encryption).
Expand Down Expand Up @@ -615,7 +615,7 @@ class AsyncAttachmentsResource(AsyncAPIResource):
|---|---|---|
| Attachment bytes | Retained until you `DELETE` | **Auto-removed after 1 day**, also removable via `DELETE` |
| Attachment metadata (id, filename, mime type, size) | Retained until you `DELETE` | Removed alongside the bytes |
| Message body & parts | Retained per message-retention policy | Retained per message-retention policy |
| Message body & parts | Retained per message-retention policy | Retained per message-retention policy — unless the line also has **ephemeral messages** enabled (see the Messages page), in which case the message and its parts are deleted 24 hours after creation |
| Audit log of deletions | Retained per platform retention policy | Retained per platform retention policy |

**In transit:** TLS 1.2+ everywhere. **At rest:** AES-256 (server-side encryption).
Expand Down
221 changes: 221 additions & 0 deletions src/linq/resources/available_number.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

import httpx

from ..types import available_number_retrieve_params
from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
from .._utils import maybe_transform, async_maybe_transform
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import (
to_raw_response_wrapper,
to_streamed_response_wrapper,
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
from .._base_client import make_request_options
from ..types.available_number_retrieve_response import AvailableNumberRetrieveResponse

__all__ = ["AvailableNumberResource", "AsyncAvailableNumberResource"]


class AvailableNumberResource(SyncAPIResource):
"""Phone Numbers represent the phone numbers assigned to your partner account.

Use the list phone numbers endpoint to discover which phone numbers are available
for sending messages.

When creating chats, listing chats, or sending a voice memo, use one of your assigned phone numbers
in the `from` field.
"""

@cached_property
def with_raw_response(self) -> AvailableNumberResourceWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/linq-team/linq-python#accessing-raw-response-data-eg-headers
"""
return AvailableNumberResourceWithRawResponse(self)

@cached_property
def with_streaming_response(self) -> AvailableNumberResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/linq-team/linq-python#with_streaming_response
"""
return AvailableNumberResourceWithStreamingResponse(self)

def retrieve(
self,
*,
to: SequenceNotStr[str] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AvailableNumberRetrieveResponse:
"""
Returns the best available line (E.164) to send from, applying smart number
assignment. Optionally pass `to` recipients to make the choice "sticky" —
reusing the line an existing chat with those recipients is already on. Without
`to`, the best healthy line is chosen.

This is advisory: it does not reserve the line or change selection state. Pass
the returned `phone_number` as `from` when you create the chat to guarantee the
same line.

Also returns `vcf_url`: a time-limited link to a vCard (`.vcf`) for the chosen
line, carrying its contact card (name/photo) with the chosen number as the
primary `TEL` and the partner's other healthy lines as backups. Share it with
recipients so they can save the line as a contact.

Args:
to: Recipient handles (E.164 or email) the message is destined for. When provided,
an existing chat with these recipients makes the choice sticky. Repeat the
parameter for multiple recipients.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get(
"/v3/available_number",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform({"to": to}, available_number_retrieve_params.AvailableNumberRetrieveParams),
),
cast_to=AvailableNumberRetrieveResponse,
)


class AsyncAvailableNumberResource(AsyncAPIResource):
"""Phone Numbers represent the phone numbers assigned to your partner account.

Use the list phone numbers endpoint to discover which phone numbers are available
for sending messages.

When creating chats, listing chats, or sending a voice memo, use one of your assigned phone numbers
in the `from` field.
"""

@cached_property
def with_raw_response(self) -> AsyncAvailableNumberResourceWithRawResponse:
"""
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/linq-team/linq-python#accessing-raw-response-data-eg-headers
"""
return AsyncAvailableNumberResourceWithRawResponse(self)

@cached_property
def with_streaming_response(self) -> AsyncAvailableNumberResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/linq-team/linq-python#with_streaming_response
"""
return AsyncAvailableNumberResourceWithStreamingResponse(self)

async def retrieve(
self,
*,
to: SequenceNotStr[str] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AvailableNumberRetrieveResponse:
"""
Returns the best available line (E.164) to send from, applying smart number
assignment. Optionally pass `to` recipients to make the choice "sticky" —
reusing the line an existing chat with those recipients is already on. Without
`to`, the best healthy line is chosen.

This is advisory: it does not reserve the line or change selection state. Pass
the returned `phone_number` as `from` when you create the chat to guarantee the
same line.

Also returns `vcf_url`: a time-limited link to a vCard (`.vcf`) for the chosen
line, carrying its contact card (name/photo) with the chosen number as the
primary `TEL` and the partner's other healthy lines as backups. Share it with
recipients so they can save the line as a contact.

Args:
to: Recipient handles (E.164 or email) the message is destined for. When provided,
an existing chat with these recipients makes the choice sticky. Repeat the
parameter for multiple recipients.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._get(
"/v3/available_number",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=await async_maybe_transform(
{"to": to}, available_number_retrieve_params.AvailableNumberRetrieveParams
),
),
cast_to=AvailableNumberRetrieveResponse,
)


class AvailableNumberResourceWithRawResponse:
def __init__(self, available_number: AvailableNumberResource) -> None:
self._available_number = available_number

self.retrieve = to_raw_response_wrapper(
available_number.retrieve,
)


class AsyncAvailableNumberResourceWithRawResponse:
def __init__(self, available_number: AsyncAvailableNumberResource) -> None:
self._available_number = available_number

self.retrieve = async_to_raw_response_wrapper(
available_number.retrieve,
)


class AvailableNumberResourceWithStreamingResponse:
def __init__(self, available_number: AvailableNumberResource) -> None:
self._available_number = available_number

self.retrieve = to_streamed_response_wrapper(
available_number.retrieve,
)


class AsyncAvailableNumberResourceWithStreamingResponse:
def __init__(self, available_number: AsyncAvailableNumberResource) -> None:
self._available_number = available_number

self.retrieve = async_to_streamed_response_wrapper(
available_number.retrieve,
)
Loading
Loading