in sdk/communication/AzureCommunicationChat/Source/Signaling/Events/ChatEvent.swift [660:695]
init(from request: TrouterRequest) throws {
guard let requestJsonData = request.body.data(using: .utf8) else {
throw AzureError.client("Unable to convert request body to Data.")
}
let chatThreadPropertiesUpdatedPayload: ChatThreadPropertiesUpdatedPayload = try JSONDecoder()
.decode(ChatThreadPropertiesUpdatedPayload.self, from: requestJsonData)
guard let updatedByJsonData = chatThreadPropertiesUpdatedPayload.editedBy.data(using: .utf8) else {
throw AzureError.client("Unable to convert payload editedBy to Data.")
}
let updatedByPayload: ChatParticipantPayload = try JSONDecoder()
.decode(ChatParticipantPayload.self, from: updatedByJsonData)
let updatedBy =
SignalingChatParticipant(
id: createCommunicationIdentifier(fromRawId: updatedByPayload.participantId),
displayName: updatedByPayload.displayName
)
guard let propertiesJsonData = chatThreadPropertiesUpdatedPayload.properties.data(using: .utf8) else {
throw AzureError.client("Unable to convert payload properties Data.")
}
let propertiesPayload: ChatThreadPropertiesPayload = try JSONDecoder()
.decode(ChatThreadPropertiesPayload.self, from: propertiesJsonData)
let properties = SignalingChatThreadProperties(topic: propertiesPayload.topic)
self.properties = properties
self.updatedOn = Iso8601Date(string: chatThreadPropertiesUpdatedPayload.editTime)
self.updatedBy = updatedBy
super.init(
threadId: chatThreadPropertiesUpdatedPayload.threadId,
version: chatThreadPropertiesUpdatedPayload.version
)
}