Skip to content

Commit 847df22

Browse files
committed
test message models
1 parent 989be78 commit 847df22

22 files changed

+1165
-73
lines changed
Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,12 @@
1-
# from .enums import ChannelType, Locale
2-
# from .errors import VerifyError
3-
# from .requests import (
4-
# EmailChannel,
5-
# SilentAuthChannel,
6-
# SmsChannel,
7-
# VerifyRequest,
8-
# VoiceChannel,
9-
# WhatsappChannel,
10-
# )
11-
# from .responses import CheckCodeResponse, StartVerificationResponse
12-
# from .verify_v2 import VerifyV2
1+
from . import models
2+
from .enums import ChannelType, EncodingType, MessageType, WebhookVersion
3+
from .messages import Messages
134

14-
# __all__ = [
15-
# 'VerifyV2',
16-
# 'VerifyError',
17-
# 'ChannelType',
18-
# 'CheckCodeResponse',
19-
# 'Locale',
20-
# 'VerifyRequest',
21-
# 'SilentAuthChannel',
22-
# 'SmsChannel',
23-
# 'WhatsappChannel',
24-
# 'VoiceChannel',
25-
# 'EmailChannel',
26-
# 'StartVerificationResponse',
27-
# ]
5+
__all__ = [
6+
'models',
7+
'Messages',
8+
'ChannelType',
9+
'MessageType',
10+
'WebhookVersion',
11+
'EncodingType',
12+
]

messages/src/vonage_messages/errors.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

messages/src/vonage_messages/messages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from pydantic import validate_call
22
from vonage_http_client.http_client import HttpClient
33

4-
from .models.sms import BaseMessage
4+
from .models import BaseMessage
55
from .responses import MessageUuid
66

77

@@ -22,7 +22,7 @@ def send(self, message: BaseMessage) -> MessageUuid:
2222
"""Send a message using Vonage's Messages API.
2323
2424
Args:
25-
message (Message): The message to be sent.
25+
message (BaseMessage): The message to be sent.
2626
2727
Returns:
2828
MessageUuid: The unique identifier of the sent message.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
python_sources()
1+
python_sources(name='models')

messages/src/vonage_messages/models/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .message import BaseMessage
1+
from .base_message import BaseMessage
22
from .messenger import (
33
MessengerAudio,
44
MessengerFile,

messages/src/vonage_messages/models/messenger.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from pydantic import BaseModel, Field, model_validator
44

55
from ..enums import ChannelType, MessageType
6-
from .message import BaseMessage
6+
from .base_message import BaseMessage
77

88

99
class MessengerResource(BaseModel):
@@ -30,24 +30,24 @@ class BaseMessenger(BaseMessage):
3030

3131
class MessengerText(BaseMessenger):
3232
text: str = Field(..., max_length=640)
33-
type: MessageType = MessageType.TEXT
33+
message_type: MessageType = MessageType.TEXT
3434

3535

3636
class MessengerImage(BaseMessenger):
3737
image: MessengerResource
38-
type: MessageType = MessageType.IMAGE
38+
message_type: MessageType = MessageType.IMAGE
3939

4040

4141
class MessengerAudio(BaseMessenger):
4242
audio: MessengerResource
43-
type: MessageType = MessageType.AUDIO
43+
message_type: MessageType = MessageType.AUDIO
4444

4545

4646
class MessengerVideo(BaseMessenger):
4747
video: MessengerResource
48-
type: MessageType = MessageType.VIDEO
48+
message_type: MessageType = MessageType.VIDEO
4949

5050

5151
class MessengerFile(BaseMessenger):
5252
file: MessengerResource
53-
type: MessageType = MessageType.FILE
53+
message_type: MessageType = MessageType.FILE

messages/src/vonage_messages/models/mms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from vonage_utils.types.phone_number import PhoneNumber
55

66
from ..enums import ChannelType, MessageType
7-
from .message import BaseMessage
7+
from .base_message import BaseMessage
88

99

1010
class MmsResource(BaseModel):

messages/src/vonage_messages/models/sms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from vonage_utils.types.phone_number import PhoneNumber
55

66
from ..enums import ChannelType, EncodingType, MessageType
7-
from .message import BaseMessage
7+
from .base_message import BaseMessage
88

99

1010
class SmsOptions(BaseModel):

messages/src/vonage_messages/models/viber.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from pydantic import BaseModel, Field, field_validator
44

55
from ..enums import ChannelType, MessageType
6-
from .message import BaseMessage
6+
from .base_message import BaseMessage
77

88

99
class ViberAction(BaseModel):
@@ -77,7 +77,7 @@ def validate_file_size(cls, value):
7777

7878
class ViberVideo(BaseViber):
7979
video: ViberVideoResource
80-
viber_service: Optional[ViberVideoOptions] = None
80+
viber_service: ViberVideoOptions
8181
message_type: MessageType = MessageType.VIDEO
8282

8383

0 commit comments

Comments
 (0)