@@ -37,6 +37,15 @@ public enum ConnectionCredentials {
3737 /// - SeeAlso: [Room Configuration Documentation](https://docs.livekit.io/home/get-started/authentication/#room-configuration) for more info.
3838 let roomConfiguration : RoomConfiguration ?
3939
40+ // enum CodingKeys: String, CodingKey {
41+ // case roomName = "room_name"
42+ // case participantName = "participant_name"
43+ // case participantIdentity = "participant_identity"
44+ // case participantMetadata = "participant_metadata"
45+ // case participantAttributes = "participant_attributes"
46+ // case roomConfiguration = "room_configuration"
47+ // }
48+
4049 public init (
4150 roomName: String ? = nil ,
4251 participantName: String ? = nil ,
@@ -57,12 +66,17 @@ public enum ConnectionCredentials {
5766 /// Response containing the credentials needed to connect to a room.
5867 public struct Response : Decodable , Sendable {
5968 /// The WebSocket URL for the LiveKit server.
60- let serverUrl : URL
69+ let serverURL : URL
6170 /// The JWT token containing participant permissions and metadata.
6271 let participantToken : String
6372
64- public init ( serverUrl: URL , participantToken: String ) {
65- self . serverUrl = serverUrl
73+ enum CodingKeys : String , CodingKey {
74+ case serverURL = " serverUrl "
75+ case participantToken
76+ }
77+
78+ public init ( serverURL: URL , participantToken: String ) {
79+ self . serverURL = serverURL
6680 self . participantToken = participantToken
6781 }
6882 }
@@ -117,11 +131,11 @@ public extension TokenServer {
117131 let ( data, response) = try await URLSession . shared. data ( for: urlRequest)
118132
119133 guard let httpResponse = response as? HTTPURLResponse else {
120- throw LiveKitError ( . network, message: " Error generating token from sandbox token server, no response " )
134+ throw LiveKitError ( . network, message: " Error generating token from the token server, no response " )
121135 }
122136
123137 guard ( 200 ... 299 ) . contains ( httpResponse. statusCode) else {
124- throw LiveKitError ( . network, message: " Error generating token from sandbox token server, received \( httpResponse) " )
138+ throw LiveKitError ( . network, message: " Error generating token from the token server, received \( httpResponse) " )
125139 }
126140
127141 return try JSONDecoder ( ) . decode ( ConnectionCredentials . Response. self, from: data)
0 commit comments