Skip to content
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

ACS Chat: Changes for API version: 2020-11-01-preview3 #15455

Conversation

Leoaqr
Copy link
Contributor

@Leoaqr Leoaqr commented Nov 19, 2020

Several changes required by 2020-11-01-preview3 of the API:

  • Rename Thread Members to Participants
  • Rename function UpdateThread to UpdateTopic
  • Rename ReadReceipt to ChatMessageReadReceipt in model
  • Return message id (string) instead of SendMessageResult (object) when calling send_message
  • Add a convenience method add_participant for adding 1 participant
  • Add failed participants check in response header in create_thread function

Leo Li and others added 7 commits November 16, 2020 15:24
* Add failed participant check in response header for create_thread method
* New convention method add_participant(thread_participant: ChatThreadParticipant) - sync and async
Copy link
Member

@fangchen0601 fangchen0601 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. please make sure unit test and live test passed locally. and upload recorded yaml files if needed.

@@ -0,0 +1,8 @@
# ------------------------------------------------------------------------
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the _shared folder is shared between all service SDKs, like SMS SDK has the same folder and same files/methods. Which means adding one method/module to this folder, other teams must do the same.
So I suggest:

  1. Talk to Tural to ask if above is the same case, if yes, ask if this will become a common method that other teams will use, if yes, then your PR is good
  2. If this module and method is only for Chat team, suggest move it to azure/communication/chat/_util.py after talked to Tural.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback.
Currently, I don't commit the test files in order to reduce the unnecessary review workload. Yes, I will run and upload new test files after review.

For the helper file in shared folder, what do you think? @turalf

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this file is specific to the chat module. If that is the case please keep this file outside of the _shared folder.
Also it seems that this method is used only in 1 file. If you are not planning to use it somewhere else in the future, better to keep in that file.

@Leoaqr Leoaqr force-pushed the feature/communication-chat-preview3 branch from 4b1f836 to a0e2210 Compare November 20, 2020 00:12
@Leoaqr Leoaqr changed the base branch from master to feature/communication-chat-preview3 November 20, 2020 00:16
Copy link
Contributor

@turalf turalf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure to add recording files after running live tests locally, once they are available

@@ -0,0 +1,8 @@
# ------------------------------------------------------------------------
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this file is specific to the chat module. If that is the case please keep this file outside of the _shared folder.
Also it seems that this method is used only in 1 file. If you are not planning to use it somewhere else in the future, better to keep in that file.

@Leoaqr Leoaqr force-pushed the feature/communication-chat-preview3 branch from 9d0e425 to 914bbfe Compare November 26, 2020 01:48
@Leoaqr Leoaqr closed this Nov 26, 2020
@Leoaqr Leoaqr reopened this Nov 26, 2020
Copy link
Contributor

@turalf turalf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@Leoaqr Leoaqr merged commit b8c15b2 into Azure:feature/communication-chat-preview3 Nov 30, 2020
:return: SendChatMessageResult, or the result of cls(response)
:rtype: ~azure.communication.chat.SendChatMessageResult
:return: str, or the result of cls(response)
:rtype: str
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should not have been made - could we fix it before the next release goes out?
Instead we should use something like this:
return { 'id': send_chat_message_result.id }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will change accordingly in the next iteration

@@ -113,7 +113,7 @@ def thread_id(self):
return self._thread_id

@distributed_trace
def update_thread(
def update_topic(
self,
topic=None, # type: Optional[str]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are updating the topic- the topic parameter should no longer be optional.

participant, reason = invalid_participant_and_reason.split(',', 1)
errors.append('participant ' + participant + ' failed to join thread '
+ create_chat_thread_result.id + ' return statue code ' + reason)
raise ValueError(errors)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be a ValueError

Leoaqr added a commit to Leoaqr/azure-sdk-for-python that referenced this pull request Dec 4, 2020
Several changes required by `2020-11-01-preview3` of the API:

- Rename `Thread Members` to `Participants`
- Rename function `UpdateThread` to `UpdateTopic` 
- Rename `ReadReceipt` to `ChatMessageReadReceipt` in model
- Return message id (string) instead of SendMessageResult (object) when calling `send_message`
- Add a convenience method `add_participant` for adding 1 participant
- Add failed participants check in response header in `create_thread` function

Misc:

- Add updated test record files

Co-authored-by: Leo Li <jixli@microsoft.com>
Co-authored-by: Rajarshi Sarkar <73562869+sarkar-rajarshi@users.noreply.github.com>
sarkar-rajarshi added a commit that referenced this pull request Feb 2, 2021
* ACS Chat: Changes for API version: 2020-11-01-preview3 (#15455)

Several changes required by `2020-11-01-preview3` of the API:

- Rename `Thread Members` to `Participants`
- Rename function `UpdateThread` to `UpdateTopic`
- Rename `ReadReceipt` to `ChatMessageReadReceipt` in model
- Return message id (string) instead of SendMessageResult (object) when calling `send_message`
- Add a convenience method `add_participant` for adding 1 participant
- Add failed participants check in response header in `create_thread` function

Misc:

- Add updated test record files

Co-authored-by: Leo Li <jixli@microsoft.com>
Co-authored-by: Rajarshi Sarkar <73562869+sarkar-rajarshi@users.noreply.github.com>

* Update ACS Chat Python SDK align with swagger changes (#15640)

- Seperate AzureCommunicationChatServiceOperationsMixin into ChatOperations and ChatThreadOperations
- Move invalid participants into errors object in reponse body

Co-authored-by: Leo Li <jixli@microsoft.com>

* Communication chat - paginated results for participants and readreceipts (#15682)

* Failed participant check + single member add
* Add failed participant check in response header for create_thread method
* New convention method add_participant(thread_participant: ChatThreadParticipant) - sync and async

* Add empty line at the end of files

* Enable pagination for list participants

* Enable pagination for read receipts

* conflicts resolved after merge with upstream

* update README.md

* e2e test fix

* bkp commit

* updated e2e tests

* adding test recording

Co-authored-by: Leo Li <jixli@microsoft.com>

* Updated swagger changes (#16390)

* Updated swagger changes
- Generate new models from swagger
- ChatMessage.content -> ChatMessageContent instead of 'str'
- Remove ChatMessagePriority
- Introduce ChatMessageType
- Add tests around ChatMessageType deserialization
- Generate a repeatability ID by default
- Add some test scenarios around repeatability ID
- Update all relevant tests
- Update sample code
- Record new test sessions

* Rebase with master
- Use CommunicationUserIdentifier

* pylint fixes

Co-authored-by: Jixing (Leo) Li <lijixing3377@gmail.com>
Co-authored-by: Leo Li <jixli@microsoft.com>
juancamilor pushed a commit that referenced this pull request Feb 5, 2021
* Rsarkar/chat preview3 rebased (#16463)

* ACS Chat: Changes for API version: 2020-11-01-preview3 (#15455)

Several changes required by `2020-11-01-preview3` of the API:

- Rename `Thread Members` to `Participants`
- Rename function `UpdateThread` to `UpdateTopic`
- Rename `ReadReceipt` to `ChatMessageReadReceipt` in model
- Return message id (string) instead of SendMessageResult (object) when calling `send_message`
- Add a convenience method `add_participant` for adding 1 participant
- Add failed participants check in response header in `create_thread` function

Misc:

- Add updated test record files

Co-authored-by: Leo Li <jixli@microsoft.com>
Co-authored-by: Rajarshi Sarkar <73562869+sarkar-rajarshi@users.noreply.github.com>

* Update ACS Chat Python SDK align with swagger changes (#15640)

- Seperate AzureCommunicationChatServiceOperationsMixin into ChatOperations and ChatThreadOperations
- Move invalid participants into errors object in reponse body

Co-authored-by: Leo Li <jixli@microsoft.com>

* Communication chat - paginated results for participants and readreceipts (#15682)

* Failed participant check + single member add
* Add failed participant check in response header for create_thread method
* New convention method add_participant(thread_participant: ChatThreadParticipant) - sync and async

* Add empty line at the end of files

* Enable pagination for list participants

* Enable pagination for read receipts

* conflicts resolved after merge with upstream

* update README.md

* e2e test fix

* bkp commit

* updated e2e tests

* adding test recording

Co-authored-by: Leo Li <jixli@microsoft.com>

* Updated swagger changes (#16390)

* Updated swagger changes
- Generate new models from swagger
- ChatMessage.content -> ChatMessageContent instead of 'str'
- Remove ChatMessagePriority
- Introduce ChatMessageType
- Add tests around ChatMessageType deserialization
- Generate a repeatability ID by default
- Add some test scenarios around repeatability ID
- Update all relevant tests
- Update sample code
- Record new test sessions

* Rebase with master
- Use CommunicationUserIdentifier

* pylint fixes

Co-authored-by: Jixing (Leo) Li <lijixing3377@gmail.com>
Co-authored-by: Leo Li <jixli@microsoft.com>

* Apiview changes (#16560)

* apiview fixes
- Add missing type hints
- return ItemPaged or AsyncItemPaged instead of full classpath

Co-authored-by: Jixing (Leo) Li <lijixing3377@gmail.com>
Co-authored-by: Leo Li <jixli@microsoft.com>
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this pull request Aug 2, 2021
signalr: adding the missing `Trace` value (Azure#15455)

Fixes Azure#14923
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants