Skip to content

Commit d2b0505

Browse files
committed
Change login response to FullUserIdentifier
1 parent 99fa533 commit d2b0505

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Sources/MatrixClient/API/Auth/Login.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ extension MatrixLoginRequest: MatrixRequest {
309309

310310
public struct MatrixLogin: MatrixResponse {
311311
public init(
312-
userId: MatrixUserIdentifier? = nil,
312+
userId: MatrixFullUserIdentifier? = nil,
313313
accessToken: String? = nil,
314314
homeServer: String? = nil,
315315
deviceId: String? = nil,
@@ -323,7 +323,7 @@ public struct MatrixLogin: MatrixResponse {
323323
}
324324

325325
/// The fully-qualified Matrix ID that has been registered.
326-
public var userId: MatrixUserIdentifier?
326+
public var userId: MatrixFullUserIdentifier?
327327

328328
/// An access token for the account. This access token can then be used to authorise other requests.
329329
public var accessToken: String?

Sources/MatrixClient/UserIdentifier.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import Foundation
99

10-
public protocol MatrixUserIdentifierProtocol: Equatable, Comparable, Hashable {
10+
public protocol MatrixUserIdentifierProtocol: Equatable, Comparable, Hashable, CustomStringConvertible {
1111
var localpart: String { get set }
1212

1313
init?(string: String)
@@ -148,6 +148,10 @@ public struct MatrixUserIdentifier: RawRepresentable, MatrixUserIdentifierProtoc
148148
return nil
149149
}
150150

151+
public var description: String {
152+
rawValue
153+
}
154+
151155
// MARK: static variables
152156

153157
static let allowedLocalCharacters = CharacterSet(charactersIn: "1234567890abcdefghijklmnopqrstuvwxyz-.=_/")
@@ -209,6 +213,10 @@ public struct MatrixFullUserIdentifier: RawRepresentable, MatrixUserIdentifierPr
209213
"@\(localpart):\(domain)"
210214
}
211215

216+
public var description: String {
217+
FQMXID
218+
}
219+
212220
public var id: String {
213221
FQMXID
214222
}

0 commit comments

Comments
 (0)