Skip to content

Commit 3ae4be6

Browse files
committed
use consistent account record
1 parent ba53d77 commit 3ae4be6

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

Sources/Firebase/AuthClient.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@ public class AuthClient {
8080
return user
8181
}
8282

83-
public func getUsers() async throws -> [UserRecord] {
83+
public func getUsers() async throws -> [FirebaseUser] {
8484
let response = try await api.makeAuthenticatedPost(endpoint: try api.config.authEndpoint(.query))
8585

8686
let usersResponse: UserList = try api.decodeOrThrow(response: response)
8787
return usersResponse.userInfo
8888
}
8989

90-
public func updateUser(user: UserRecord) async throws {
90+
public func updateUser(user: FirebaseUser) async throws {
9191
let response = try await api.makeAuthenticatedPost(
9292
endpoint: try api.config.authEndpoint(.update),
9393
body: user)

Sources/Firebase/AuthPayloads.swift

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,9 @@ public struct FirebaseErrorResponse: Codable, Error {
1919
}
2020

2121
public struct UserList: Codable {
22-
public let userInfo: [UserRecord]
22+
public let userInfo: [FirebaseUser]
2323
}
2424

25-
public struct UserRecord: Codable {
26-
public let localID: String
27-
public var email, displayName: String?
28-
public let photoURL: String?
29-
public let emailVerified: Bool?
30-
public let providerUserInfo: [ProviderUserInfo]?
31-
public let validSince, lastLoginAt, createdAt, lastRefreshAt: String?
32-
33-
enum CodingKeys: String, CodingKey {
34-
case localID = "localId"
35-
case email, displayName
36-
case photoURL = "photoUrl"
37-
case emailVerified, providerUserInfo, validSince, lastLoginAt, createdAt, lastRefreshAt
38-
}
39-
}
40-
41-
4225
// TODO: This could probably be filled out more.
4326
public struct FirebaseContext: Codable {
4427
enum CodingKeys: String, CodingKey {
@@ -120,10 +103,10 @@ public struct LookupResponse: Codable {
120103

121104
public struct FirebaseUser: Codable {
122105
public let localId: String
123-
public let email: String?
106+
public var email: String?
124107
public let emailVerified: Bool?
125108
public let phoneNumber: String?
126-
public let displayName: String?
109+
public var displayName: String?
127110
public let photoUrl: String?
128111
public let providerUserInfo: [ProviderUserInfo]?
129112
public let passwordHash: String?

0 commit comments

Comments
 (0)