Skip to content

Commit 51a28ef

Browse files
feat(api): manual updates
Send name change
1 parent d6fd62b commit 51a28ef

9 files changed

Lines changed: 65 additions & 65 deletions

File tree

‎.stats.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 75
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier%2Fcourier-9edfa04d0cd081138f4834ed9b8d45403d7ee75a5f02f8eecc8e45575df21bb8.yml
33
openapi_spec_hash: 195e8cd1061046ffc3009f50262d92b2
4-
config_hash: 95eeff6eb3e84bae51819c372640d9ae
4+
config_hash: d99e176269a6a45a76f40d093dbdf91d

‎README.md‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ client = Courier(
3535
api_key=os.environ.get("COURIER_API_KEY"), # This is the default and can be omitted
3636
)
3737

38-
response = client.send.send_message(
38+
response = client.send.message(
3939
message={
4040
"content": {
4141
"elements": [{}],
@@ -66,7 +66,7 @@ client = AsyncCourier(
6666

6767

6868
async def main() -> None:
69-
response = await client.send.send_message(
69+
response = await client.send.message(
7070
message={
7171
"content": {
7272
"elements": [{}],
@@ -106,7 +106,7 @@ async def main() -> None:
106106
api_key="My API Key",
107107
http_client=DefaultAioHttpClient(),
108108
) as client:
109-
response = await client.send.send_message(
109+
response = await client.send.message(
110110
message={
111111
"content": {
112112
"elements": [{}],
@@ -167,7 +167,7 @@ from courier import Courier
167167
client = Courier()
168168

169169
try:
170-
client.send.send_message(
170+
client.send.message(
171171
message={
172172
"content": {
173173
"elements": [{}],
@@ -217,7 +217,7 @@ client = Courier(
217217
)
218218

219219
# Or, configure per-request:
220-
client.with_options(max_retries=5).send.send_message(
220+
client.with_options(max_retries=5).send.message(
221221
message={
222222
"content": {
223223
"elements": [{}],
@@ -247,7 +247,7 @@ client = Courier(
247247
)
248248

249249
# Override per-request:
250-
client.with_options(timeout=5.0).send.send_message(
250+
client.with_options(timeout=5.0).send.message(
251251
message={
252252
"content": {
253253
"elements": [{}],
@@ -295,7 +295,7 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
295295
from courier import Courier
296296

297297
client = Courier()
298-
response = client.send.with_raw_response.send_message(
298+
response = client.send.with_raw_response.message(
299299
message={
300300
"content": {
301301
"elements": [{}],
@@ -305,7 +305,7 @@ response = client.send.with_raw_response.send_message(
305305
)
306306
print(response.headers.get('X-My-Header'))
307307

308-
send = response.parse() # get the object that `send.send_message()` would have returned
308+
send = response.parse() # get the object that `send.message()` would have returned
309309
print(send.request_id)
310310
```
311311

@@ -320,7 +320,7 @@ The above interface eagerly reads the full response body when you make the reque
320320
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
321321

322322
```python
323-
with client.send.with_streaming_response.send_message(
323+
with client.send.with_streaming_response.message(
324324
message={
325325
"content": {
326326
"elements": [{}],

‎api.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ from courier.types import (
1717
RoutingMethod,
1818
SlackBaseProperties,
1919
Utm,
20-
SendSendMessageResponse,
20+
SendMessageResponse,
2121
)
2222
```
2323

2424
Methods:
2525

26-
- <code title="post /send">client.send.<a href="./src/courier/resources/send.py">send_message</a>(\*\*<a href="src/courier/types/send_send_message_params.py">params</a>) -> <a href="./src/courier/types/send_send_message_response.py">SendSendMessageResponse</a></code>
26+
- <code title="post /send">client.send.<a href="./src/courier/resources/send.py">message</a>(\*\*<a href="src/courier/types/send_message_params.py">params</a>) -> <a href="./src/courier/types/send_message_response.py">SendMessageResponse</a></code>
2727

2828
# Audiences
2929

‎src/courier/resources/send.py‎

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import httpx
66

7-
from ..types import send_send_message_params
7+
from ..types import send_message_params
88
from .._types import Body, Query, Headers, NotGiven, not_given
99
from .._utils import maybe_transform, async_maybe_transform
1010
from .._compat import cached_property
@@ -17,7 +17,7 @@
1717
)
1818
from .._base_client import make_request_options
1919
from ..types.message_param import MessageParam
20-
from ..types.send_send_message_response import SendSendMessageResponse
20+
from ..types.send_message_response import SendMessageResponse
2121

2222
__all__ = ["SendResource", "AsyncSendResource"]
2323

@@ -42,7 +42,7 @@ def with_streaming_response(self) -> SendResourceWithStreamingResponse:
4242
"""
4343
return SendResourceWithStreamingResponse(self)
4444

45-
def send_message(
45+
def message(
4646
self,
4747
*,
4848
message: MessageParam,
@@ -52,7 +52,7 @@ def send_message(
5252
extra_query: Query | None = None,
5353
extra_body: Body | None = None,
5454
timeout: float | httpx.Timeout | None | NotGiven = not_given,
55-
) -> SendSendMessageResponse:
55+
) -> SendMessageResponse:
5656
"""
5757
Use the send API to send a message to one or more recipients.
5858
@@ -69,11 +69,11 @@ def send_message(
6969
"""
7070
return self._post(
7171
"/send",
72-
body=maybe_transform({"message": message}, send_send_message_params.SendSendMessageParams),
72+
body=maybe_transform({"message": message}, send_message_params.SendMessageParams),
7373
options=make_request_options(
7474
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
7575
),
76-
cast_to=SendSendMessageResponse,
76+
cast_to=SendMessageResponse,
7777
)
7878

7979

@@ -97,7 +97,7 @@ def with_streaming_response(self) -> AsyncSendResourceWithStreamingResponse:
9797
"""
9898
return AsyncSendResourceWithStreamingResponse(self)
9999

100-
async def send_message(
100+
async def message(
101101
self,
102102
*,
103103
message: MessageParam,
@@ -107,7 +107,7 @@ async def send_message(
107107
extra_query: Query | None = None,
108108
extra_body: Body | None = None,
109109
timeout: float | httpx.Timeout | None | NotGiven = not_given,
110-
) -> SendSendMessageResponse:
110+
) -> SendMessageResponse:
111111
"""
112112
Use the send API to send a message to one or more recipients.
113113
@@ -124,45 +124,45 @@ async def send_message(
124124
"""
125125
return await self._post(
126126
"/send",
127-
body=await async_maybe_transform({"message": message}, send_send_message_params.SendSendMessageParams),
127+
body=await async_maybe_transform({"message": message}, send_message_params.SendMessageParams),
128128
options=make_request_options(
129129
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
130130
),
131-
cast_to=SendSendMessageResponse,
131+
cast_to=SendMessageResponse,
132132
)
133133

134134

135135
class SendResourceWithRawResponse:
136136
def __init__(self, send: SendResource) -> None:
137137
self._send = send
138138

139-
self.send_message = to_raw_response_wrapper(
140-
send.send_message,
139+
self.message = to_raw_response_wrapper(
140+
send.message,
141141
)
142142

143143

144144
class AsyncSendResourceWithRawResponse:
145145
def __init__(self, send: AsyncSendResource) -> None:
146146
self._send = send
147147

148-
self.send_message = async_to_raw_response_wrapper(
149-
send.send_message,
148+
self.message = async_to_raw_response_wrapper(
149+
send.message,
150150
)
151151

152152

153153
class SendResourceWithStreamingResponse:
154154
def __init__(self, send: SendResource) -> None:
155155
self._send = send
156156

157-
self.send_message = to_streamed_response_wrapper(
158-
send.send_message,
157+
self.message = to_streamed_response_wrapper(
158+
send.message,
159159
)
160160

161161

162162
class AsyncSendResourceWithStreamingResponse:
163163
def __init__(self, send: AsyncSendResource) -> None:
164164
self._send = send
165165

166-
self.send_message = async_to_streamed_response_wrapper(
167-
send.send_message,
166+
self.message = async_to_streamed_response_wrapper(
167+
send.message,
168168
)

‎src/courier/types/__init__.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
from .default_preferences import DefaultPreferences as DefaultPreferences
5252
from .filter_config_param import FilterConfigParam as FilterConfigParam
5353
from .message_list_params import MessageListParams as MessageListParams
54+
from .send_message_params import SendMessageParams as SendMessageParams
5455
from .audience_list_params import AudienceListParams as AudienceListParams
5556
from .brand_settings_param import BrandSettingsParam as BrandSettingsParam
5657
from .brand_snippets_param import BrandSnippetsParam as BrandSnippetsParam
@@ -66,6 +67,7 @@
6667
from .message_list_response import MessageListResponse as MessageListResponse
6768
from .profile_create_params import ProfileCreateParams as ProfileCreateParams
6869
from .profile_update_params import ProfileUpdateParams as ProfileUpdateParams
70+
from .send_message_response import SendMessageResponse as SendMessageResponse
6971
from .audience_list_response import AudienceListResponse as AudienceListResponse
7072
from .audience_update_params import AudienceUpdateParams as AudienceUpdateParams
7173
from .bulk_create_job_params import BulkCreateJobParams as BulkCreateJobParams
@@ -84,7 +86,6 @@
8486
from .notification_get_content import NotificationGetContent as NotificationGetContent
8587
from .notification_list_params import NotificationListParams as NotificationListParams
8688
from .profile_replace_response import ProfileReplaceResponse as ProfileReplaceResponse
87-
from .send_send_message_params import SendSendMessageParams as SendSendMessageParams
8889
from .tenant_list_users_params import TenantListUsersParams as TenantListUsersParams
8990
from .audit_event_list_response import AuditEventListResponse as AuditEventListResponse
9091
from .auth_issue_token_response import AuthIssueTokenResponse as AuthIssueTokenResponse
@@ -100,7 +101,6 @@
100101
from .inbound_track_event_params import InboundTrackEventParams as InboundTrackEventParams
101102
from .nested_filter_config_param import NestedFilterConfigParam as NestedFilterConfigParam
102103
from .notification_list_response import NotificationListResponse as NotificationListResponse
103-
from .send_send_message_response import SendSendMessageResponse as SendSendMessageResponse
104104
from .tenant_list_users_response import TenantListUsersResponse as TenantListUsersResponse
105105
from .slack_base_properties_param import SlackBasePropertiesParam as SlackBasePropertiesParam
106106
from .audience_list_members_params import AudienceListMembersParams as AudienceListMembersParams

src/courier/types/send_send_message_params.py renamed to src/courier/types/send_message_params.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
from typing_extensions import Required, TypedDict
66

7-
__all__ = ["SendSendMessageParams"]
7+
__all__ = ["SendMessageParams"]
88

99

10-
class SendSendMessageParams(TypedDict, total=False):
10+
class SendMessageParams(TypedDict, total=False):
1111
message: Required["MessageParam"]
1212
"""Defines the message to be delivered"""
1313

src/courier/types/send_send_message_response.py renamed to src/courier/types/send_message_response.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
from .._models import BaseModel
66

7-
__all__ = ["SendSendMessageResponse"]
7+
__all__ = ["SendMessageResponse"]
88

99

10-
class SendSendMessageResponse(BaseModel):
10+
class SendMessageResponse(BaseModel):
1111
request_id: str = FieldInfo(alias="requestId")
1212
"""
1313
A successful call to `POST /send` returns a `202` status code along with a

‎tests/api_resources/test_send.py‎

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from courier import Courier, AsyncCourier
1111
from tests.utils import assert_matches_type
12-
from courier.types import SendSendMessageResponse
12+
from courier.types import SendMessageResponse
1313

1414
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
1515

@@ -19,21 +19,21 @@ class TestSend:
1919

2020
@pytest.mark.skip(reason="Prism tests are disabled")
2121
@parametrize
22-
def test_method_send_message(self, client: Courier) -> None:
23-
send = client.send.send_message(
22+
def test_method_message(self, client: Courier) -> None:
23+
send = client.send.message(
2424
message={
2525
"content": {
2626
"elements": [{}],
2727
"version": "version",
2828
}
2929
},
3030
)
31-
assert_matches_type(SendSendMessageResponse, send, path=["response"])
31+
assert_matches_type(SendMessageResponse, send, path=["response"])
3232

3333
@pytest.mark.skip(reason="Prism tests are disabled")
3434
@parametrize
35-
def test_raw_response_send_message(self, client: Courier) -> None:
36-
response = client.send.with_raw_response.send_message(
35+
def test_raw_response_message(self, client: Courier) -> None:
36+
response = client.send.with_raw_response.message(
3737
message={
3838
"content": {
3939
"elements": [{}],
@@ -45,12 +45,12 @@ def test_raw_response_send_message(self, client: Courier) -> None:
4545
assert response.is_closed is True
4646
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
4747
send = response.parse()
48-
assert_matches_type(SendSendMessageResponse, send, path=["response"])
48+
assert_matches_type(SendMessageResponse, send, path=["response"])
4949

5050
@pytest.mark.skip(reason="Prism tests are disabled")
5151
@parametrize
52-
def test_streaming_response_send_message(self, client: Courier) -> None:
53-
with client.send.with_streaming_response.send_message(
52+
def test_streaming_response_message(self, client: Courier) -> None:
53+
with client.send.with_streaming_response.message(
5454
message={
5555
"content": {
5656
"elements": [{}],
@@ -62,7 +62,7 @@ def test_streaming_response_send_message(self, client: Courier) -> None:
6262
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
6363

6464
send = response.parse()
65-
assert_matches_type(SendSendMessageResponse, send, path=["response"])
65+
assert_matches_type(SendMessageResponse, send, path=["response"])
6666

6767
assert cast(Any, response.is_closed) is True
6868

@@ -74,21 +74,21 @@ class TestAsyncSend:
7474

7575
@pytest.mark.skip(reason="Prism tests are disabled")
7676
@parametrize
77-
async def test_method_send_message(self, async_client: AsyncCourier) -> None:
78-
send = await async_client.send.send_message(
77+
async def test_method_message(self, async_client: AsyncCourier) -> None:
78+
send = await async_client.send.message(
7979
message={
8080
"content": {
8181
"elements": [{}],
8282
"version": "version",
8383
}
8484
},
8585
)
86-
assert_matches_type(SendSendMessageResponse, send, path=["response"])
86+
assert_matches_type(SendMessageResponse, send, path=["response"])
8787

8888
@pytest.mark.skip(reason="Prism tests are disabled")
8989
@parametrize
90-
async def test_raw_response_send_message(self, async_client: AsyncCourier) -> None:
91-
response = await async_client.send.with_raw_response.send_message(
90+
async def test_raw_response_message(self, async_client: AsyncCourier) -> None:
91+
response = await async_client.send.with_raw_response.message(
9292
message={
9393
"content": {
9494
"elements": [{}],
@@ -100,12 +100,12 @@ async def test_raw_response_send_message(self, async_client: AsyncCourier) -> No
100100
assert response.is_closed is True
101101
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
102102
send = await response.parse()
103-
assert_matches_type(SendSendMessageResponse, send, path=["response"])
103+
assert_matches_type(SendMessageResponse, send, path=["response"])
104104

105105
@pytest.mark.skip(reason="Prism tests are disabled")
106106
@parametrize
107-
async def test_streaming_response_send_message(self, async_client: AsyncCourier) -> None:
108-
async with async_client.send.with_streaming_response.send_message(
107+
async def test_streaming_response_message(self, async_client: AsyncCourier) -> None:
108+
async with async_client.send.with_streaming_response.message(
109109
message={
110110
"content": {
111111
"elements": [{}],
@@ -117,6 +117,6 @@ async def test_streaming_response_send_message(self, async_client: AsyncCourier)
117117
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
118118

119119
send = await response.parse()
120-
assert_matches_type(SendSendMessageResponse, send, path=["response"])
120+
assert_matches_type(SendMessageResponse, send, path=["response"])
121121

122122
assert cast(Any, response.is_closed) is True

0 commit comments

Comments
 (0)