-
Notifications
You must be signed in to change notification settings - Fork 3
DEVEXP-794: Conversation API - Messages (E2E - delete/get/update) #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v2.0
Are you sure you want to change the base?
Conversation
sinch/domains/conversation/api/v1/internal/messages_endpoints.py
Outdated
Show resolved
Hide resolved
sinch/domains/conversation/models/v1/messages/types/text_message_field_internal.py
Outdated
Show resolved
Hide resolved
sinch/domains/conversation/models/v1/messages/internal/get_message_request.py
Outdated
Show resolved
Hide resolved
| description="Integer representing the total amount of the transaction.", | ||
| ) | ||
| order: PaymentOrderInternal = Field(..., description="The payment order.") | ||
| payment_settings: Optional[PaymentSettingsInternal] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may change: PaymentSettingsInternal may not be a oneOf anymore and should support a data structure such as
"payment_settings": {
"dynamic_pix": {
"code": "1234",
"merchant_name": "Test merchant",
"key": "asdf@example.com",
"key_type": "EMAIL"
},
"payment_link": {
"uri": "https://www.example.com/payment_link"
}
},
Check MR https://gitlab.com/sinch/sinch-projects/enterprise-and-messaging/documentation/developer-experience/oas-documentation/-/merge_requests/521/diffs#e8e382f867c6543f76cefa09122b39e962ba074b for details
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Removed the Union, and implemented a Pydantic class with the 3 payment options.
sinch/domains/conversation/models/v1/messages/categories/template/template_reference_field.py
Show resolved
Hide resolved
.../conversation/models/v1/messages/response/shared/channel_specific_contact_message_message.py
Outdated
Show resolved
Hide resolved
sinch/domains/conversation/models/v1/messages/internal/app_message_internal.py
Outdated
Show resolved
Hide resolved
sinch/domains/conversation/models/v1/messages/shared/reason_code.py
Outdated
Show resolved
Hide resolved
| def build_url(self, sinch) -> str: | ||
| if not self.ENDPOINT_URL: | ||
| raise NotImplementedError( | ||
| "ENDPOINT_URL must be defined in the subclass." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the error message will contains information about Conversation domain raising the issue ?
Without more context "ENDPOINT_URL must be defined in the subclass" won't help user to locate what is wrong/how to fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added info in the message
| # For Union types, try to validate against each type in the Union sequentially | ||
| # This handles cases where TypeAdapter might not be fully defined | ||
| union_args = get_args(response_model) | ||
| last_error = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems this variable is not used (last_error)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the missing implementation
| AppMessageConversationMessageInternal, | ||
| ContactMessageConversationMessageInternal, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of public model name contains the Internal suffix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Models renamed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, due to API complexity, it could be useful to triage the classes into dedicated directories (vs flatten all files in same one)
It will simplify namespace ease of use/access
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still pending. I’ve completed the refactor of messages/shared. The next step is refactoring messages/response/shared, which we can discuss tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Created a directory categories/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File, or part of file, is already existing from Numbers and SMS:
- https://github.com/sinch/sinch-sdk-python/blob/feat/conversation-messages/sinch/domains/sms/models/v1/internal/base/base_model_configuration.py
- https://github.com/sinch/sinch-sdk-python/blob/feat/conversation-messages/sinch/domains/numbers/models/v1/internal/base/base_model_configuration.py
Is it possible/does it have sense to define common content them once ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, to place it under core. I will address in this ticket with proper unit tests
| :param messages_source: Specifies the message source for which the request will be processed. Used for | ||
| operations on messages in Dispatch Mode. For more information, | ||
| see [Processing Modes](https://developers.sinch.com/docs/conversation/processing-modes/). | ||
| (optional) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, comment should reflect the default value in use when not set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| ..., | ||
| description="The title is shown close to the button that leads to open a user calendar.", | ||
| ) | ||
| event_start: StrictStr = Field( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
datetime in place of string ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| event_start: StrictStr = Field( | ||
| ..., description="The timestamp defines start of a calendar event." | ||
| ) | ||
| event_end: StrictStr = Field( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
datetimein place of string ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| default=None, | ||
| description="Unique ID of the Facebook catalog being used by the business.", | ||
| ) | ||
| expiration_time: Optional[StrictStr] = Field( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
datetime in place of string ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
No description provided.