0

示例代码片段 @ https://github.com/Azure/azure-sdk-for-js/tree/%40azure/communication-identity_1.0.0-beta.4/sdk/communication/communication-chat无法编译。

import { ChatClient, ChatThreadClient } from '@azure/communication-chat';
import { AzureCommunicationTokenCredential } from '@azure/communication-common';

let createChatThreadRequest =
{
    topic: 'Preparation for London conference',
    participants:
        [
            {
                user: { communicationUserId: '<USER_ID_FOR_JACK>' },
                displayName: 'Jack'
            },
            {
                user: { communicationUserId: '<USER_ID_FOR_GEETA>' },
                displayName: 'Geeta'
            }
        ]
};

let createChatThreadResponse = await chatClient.createChatThread(createChatThreadRequest);
let threadId = createChatThreadResponse.chatThread.id;

我的 package.json:

"@azure/communication-identity": "1.0.0-beta.4",
"@azure/communication-calling": "1.0.0-beta.6",
"@azure/communication-chat": "1.0.0-beta.4",
"@azure/communication-common": "1.0.0-beta.5",
"@azure/communication-signaling": "1.0.0-beta.2",

最新尝试:

createChatThreadRequest:
{
    "topic": "Ghost Frog",
    "participants": [
        {
            "user": {
                "communicationUserId": "ey...Ug"
            },
            "displayName": "frog"
        }
    ]
}

POST 错误 400 https://########.communication.azure.com/chat/threads?api-version=2020-11-01-preview3

RestError: {"error":{"code":"BadRequest","message":"发生了一个或多个验证错误。","details":[{"message":"为 Id 提供的值无效。" ,"目标":"参与者[0].Id"}]}}

错误消息正在寻找名为“Id”的属性。该规范不需要 ID。精氨酸。

4

2 回答 2

0

抱歉,您遇到了问题,感谢您与我们联系!

我们团队中的某个人已经测试了您的代码片段和 SDK 版本并进行了编译。你能指定你看到的错误代码吗?这将有助于我们更好地理解问题。谢谢!

于 2021-03-08T23:07:01.910 回答
0

鉴于您使用的是版本1.0.0-beta.4,我可以验证您拥有的代码片段是否正确。

在 JS SDK 的最新版本中,1.0.0-beta.5user属性实际上已重命名为id,但以前的版本仍应按预期工作。

您能否验证最新版本是否适合您?如果提供了无效信息,也可能会出现您看到的错误communicationUserId

鉴于您当前的版本和代码,如果问题仍然存在,我们希望进行调查。

我们尝试在公共预览期间使这些文档保持最新,但如果您遇到问题,请告诉我们:

https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/communication/communication-chat

https://docs.microsoft.com/en-us/azure/communication-services/quickstarts/chat/get-started?pivots=programming-language-javascript

于 2021-03-10T08:30:47.573 回答