User
open class User : NSObject, Credential
extension User: JSONDecodable
extension User : JSONEncodable
extension User: Mappable
Class that represents an User
.
-
Username Key.
Declaration
Swift
@available(*, deprecated, message: "Deprecated in version 3.17.0. Please use User.CodingKeys.username instead") public static let PersistableUsernameKey: String
-
Undocumented
Declaration
Swift
public typealias UserHandler<U> = (U?, Swift.Error?) -> Void where U : User
-
Undocumented
Declaration
Swift
public typealias UsersHandler<U> = ([U]?, Swift.Error?) -> Void where U : User
-
Undocumented
Declaration
Swift
public typealias VoidHandler = (Swift.Error?) -> Void
-
Undocumented
Declaration
Swift
public typealias BoolHandler = (Bool, Swift.Error?) -> Void
-
_id
property of the user.Declaration
Swift
open var userId: String { get }
-
_acl
property of the user.Declaration
Swift
open fileprivate(set) var acl: Acl? { get }
-
_kmd
property of the user.Declaration
Swift
open fileprivate(set) var metadata: UserMetadata? { get }
-
_socialIdentity
property of the user.Declaration
Swift
open fileprivate(set) var socialIdentity: UserSocialIdentity? { get }
-
username
property of the user.Declaration
Swift
open var username: String?
-
email
property of the user.Declaration
Swift
open var email: String?
-
Creates a new
User
taking (optionally) a username and password. If nousername
orpassword
was provided, random values will be generated automatically.Declaration
Swift
@available(*, deprecated, message: "Deprecated in version 3.17.0. Please use User.signup(username:password:user:options:completionHandler:﹚ instead") @discardableResult open class func signup<U: User>( username: String? = nil, password: String? = nil, user: U? = nil, client: Client = Kinvey.sharedClient, completionHandler: UserHandler<U>? = nil ) -> AnyRequest<Swift.Result<U, Swift.Error>>
-
Creates a new
User
taking (optionally) a username and password. If nousername
orpassword
was provided, random values will be generated automatically.Declaration
Swift
@available(*, deprecated, message: "Deprecated in version 3.17.0. Please use User.signup(username:password:user:options:completionHandler:﹚ instead") @discardableResult open class func signup<U: User>( username: String? = nil, password: String? = nil, user: U? = nil, client: Client = Kinvey.sharedClient, completionHandler: ((Swift.Result<U, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<U, Swift.Error>>
-
Creates a new
User
taking (optionally) a username and password. If nousername
orpassword
was provided, random values will be generated automatically.Declaration
Swift
@discardableResult open class func signup<U: User>( username: String? = nil, password: String? = nil, user: U? = nil, options: Options? = nil, completionHandler: ((Swift.Result<U, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<U, Swift.Error>>
-
Deletes a
User
by theuserId
property.Declaration
Swift
@discardableResult open class func destroy( userId: String, hard: Bool = true, options: Options? = nil, completionHandler: ((Swift.Result<Void, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<Void, Swift.Error>>
-
Deletes the
User
.Declaration
Swift
@discardableResult open func destroy( hard: Bool = true, options: Options? = nil, completionHandler: ((Swift.Result<Void, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<Void, Swift.Error>>
-
Sign in a user with a social identity.
Declaration
Swift
@available(*, deprecated, message: "Deprecated in version 3.17.0. Please use User.login(authSource:_:createIfNotExists:options:completionHandler:﹚ instead") @discardableResult open class func login<U: User>( authSource: AuthSource, _ authData: [String : Any], createIfNotExists: Bool = true, authServiceId: String? = nil, client: Client = sharedClient, completionHandler: UserHandler<U>? = nil ) -> AnyRequest<Swift.Result<U, Swift.Error>>
Parameters
authSource
Authentication source enum
authData
Authentication data from the social provider
client
completionHandler
Completion handler to be called once the response returns from the server
-
Sign in a user with a social identity.
Declaration
Swift
@available(*, deprecated, message: "Deprecated in version 3.17.0. Please use User.login(authSource:_:createIfNotExists:options:completionHandler:﹚ instead") @discardableResult open class func login<U: User>( authSource: AuthSource, _ authData: [String : Any], createIfNotExists: Bool = true, authServiceId: String? = nil, client: Client = sharedClient, completionHandler: ((Swift.Result<U, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<U, Swift.Error>>
Parameters
authSource
Authentication source enum
authData
Authentication data from the social provider
client
completionHandler
Completion handler to be called once the response returns from the server
-
Sign in a user with a social identity.
Declaration
Swift
@discardableResult open class func login<U: User>( authSource: AuthSource, _ authData: [String : Any], createIfNotExists: Bool = true, options: Options? = nil, completionHandler: ((Swift.Result<U, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<U, Swift.Error>>
Parameters
authSource
Authentication source enum
authData
Authentication data from the social provider
client
completionHandler
Completion handler to be called once the response returns from the server
-
Sign in a user and set as a current active user.
Declaration
Swift
@available(*, deprecated, message: "Deprecated in version 3.17.0. Please use User.login(username:password:provider:options:completionHandler:﹚ instead") @discardableResult open class func login<U: User>( username: String, password: String, client: Client = sharedClient, completionHandler: UserHandler<U>? = nil ) -> AnyRequest<Swift.Result<U, Swift.Error>>
-
Sends a request to confirm email address to the specified user.
The user must have a valid email set in its
email
field, on the server, for this to work. The user will receive an email with a time-bound link to a verification web page.Declaration
Swift
@available(*, deprecated, message: "Deprecated in version 3.17.0. Please use User.sendEmailConfirmation(forUsername:options:completionHandler:﹚ instead") @discardableResult open class func sendEmailConfirmation( forUsername username: String, client: Client = sharedClient, completionHandler: ((Swift.Result<Void, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<Void, Swift.Error>>
Parameters
username
Username of the user that needs to send the email confirmation
client
completionHandler
Completion handler to be called once the response returns from the server
-
Sends a request to confirm email address to the specified user.
The user must have a valid email set in its
email
field, on the server, for this to work. The user will receive an email with a time-bound link to a verification web page.Declaration
Swift
@discardableResult open class func sendEmailConfirmation( forUsername username: String, options: Options? = nil, completionHandler: ((Swift.Result<Void, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<Void, Swift.Error>>
Parameters
username
Username of the user that needs to send the email confirmation
client
completionHandler
Completion handler to be called once the response returns from the server
-
Sends a request to confirm email address to the user.
The user must have a valid email set in its
email
field, on the server, for this to work. The user will receive an email with a time-bound link to a verification web page.Declaration
Swift
@discardableResult open func sendEmailConfirmation( options: Options? = nil, completionHandler: ((Swift.Result<Void, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<Void, Swift.Error>>
-
Sends an email to the user with a link to reset the password
Declaration
Swift
@available(*, deprecated, message: "Deprecated in version 3.17.0. Please use User.resetPassword(usernameOrEmail:options:completionHandler:﹚ instead") @discardableResult open class func resetPassword( usernameOrEmail: String, client: Client = sharedClient, completionHandler: ((Swift.Result<Void, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<Void, Swift.Error>>
-
Sends an email to the user with a link to reset the password
Declaration
Swift
@discardableResult open class func resetPassword( usernameOrEmail: String, options: Options? = nil, completionHandler: ((Swift.Result<Void, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<Void, Swift.Error>>
-
Sends an email to the user with a link to reset the password.
Declaration
Swift
@discardableResult open func resetPassword( options: Options? = nil, completionHandler: ((Swift.Result<Void, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<Void, Swift.Error>>
-
Changes the password for the current user and automatically updates the session with a new valid session.
Declaration
Swift
@available(*, deprecated, message: "Deprecated in version 3.17.0. Please use User.changePassword(newPassword:options:completionHandler:﹚ instead") @discardableResult open func changePassword<U: User>( newPassword: String, completionHandler: UserHandler<U>? = nil ) -> AnyRequest<Swift.Result<U, Swift.Error>>
-
Changes the password for the current user and automatically updates the session with a new valid session.
Declaration
Swift
@available(*, deprecated, message: "Deprecated in version 3.17.0. Please use User.changePassword(newPassword:options:completionHandler:﹚ instead") @discardableResult open func changePassword<U: User>( newPassword: String, completionHandler: ((Swift.Result<U, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<U, Swift.Error>>
-
Changes the password for the current user and automatically updates the session with a new valid session.
Declaration
Swift
@discardableResult open func changePassword<U: User>( newPassword: String, options: Options? = nil, completionHandler: ((Swift.Result<U, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<U, Swift.Error>>
-
Sends an email with the username associated with the email provided.
Declaration
Swift
@available(*, deprecated, message: "Deprecated in version 3.17.0. Please use User.forgotUsername(email:options:completionHandler:﹚ instead") @discardableResult open class func forgotUsername( email: String, client: Client = sharedClient, completionHandler: ((Swift.Result<Void, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<Void, Swift.Error>>
-
Sends an email with the username associated with the email provided.
Declaration
Swift
@discardableResult open class func forgotUsername( email: String, options: Options? = nil, completionHandler: ((Swift.Result<Void, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<Void, Swift.Error>>
-
Checks if a
username
already exists or not.Declaration
Swift
@available(*, deprecated, message: "Deprecated in version 3.17.0. Please use User.exists(username:options:completionHandler:﹚ instead") @discardableResult open class func exists( username: String, client: Client = sharedClient, completionHandler: BoolHandler? = nil ) -> AnyRequest<Swift.Result<Bool, Swift.Error>>
-
Checks if a
username
already exists or not.Declaration
Swift
@available(*, deprecated, message: "Deprecated in version 3.17.0. Please use User.exists(username:options:completionHandler:﹚ instead") @discardableResult open class func exists( username: String, client: Client = sharedClient, completionHandler: ((Swift.Result<Bool, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<Bool, Swift.Error>>
-
Checks if a
username
already exists or not.Declaration
Swift
@discardableResult open class func exists( username: String, options: Options? = nil, completionHandler: ((Swift.Result<Bool, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<Bool, Swift.Error>>
-
Gets a
User
instance using theuserId
property.Declaration
Swift
@available(*, deprecated, message: "Deprecated in version 3.17.0. Please use User.get(userId:options:completionHandler:﹚ instead") @discardableResult open class func get<U: User>( userId: String, client: Client = sharedClient, completionHandler: UserHandler<U>? = nil ) -> AnyRequest<Swift.Result<U, Swift.Error>>
-
Gets a
User
instance using theuserId
property.Declaration
Swift
@available(*, deprecated, message: "Deprecated in version 3.17.0. Please use User.get(userId:options:completionHandler:﹚ instead") @discardableResult open class func get<U: User>( userId: String, client: Client = sharedClient, completionHandler: ((Swift.Result<U, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<U, Swift.Error>>
-
Gets a
User
instance using theuserId
property.Declaration
Swift
@discardableResult open class func get<U: User>( userId: String, options: Options? = nil, completionHandler: ((Swift.Result<U, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<U, Swift.Error>>
-
Refresh the user’s data.
Declaration
Swift
@discardableResult open func refresh( options: Options? = nil, completionHandler: ((Swift.Result<Void, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<Void, Swift.Error>>
-
Default Constructor.
Declaration
Swift
public init( userId: String? = nil, acl: Acl? = nil, metadata: UserMetadata? = nil, client: Client = sharedClient )
-
Undocumented
Declaration
Swift
public required init(from decoder: Decoder) throws
-
Undocumented
Declaration
Swift
open func encode(to encoder: Encoder) throws
-
Undocumented
Declaration
Swift
open func refresh<UserType>(anotherUser: UserType, refreshCustomProperties: Bool = true) where UserType : User
-
This function is where all variable mappings should occur. It is executed by Mapper during the mapping (serialization and deserialization) process.
Declaration
Swift
@available(*, deprecated, message: "Deprecated in version 3.18.0. Please use Swift.Codable instead") open func mapping(map: Map)
-
Sign out the current active user.
Declaration
Swift
@discardableResult open func logout( options: Options? = nil, completionHandler: ((Swift.Result<Void, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<Void, Swift.Error>>
-
Creates or updates a
User
.Declaration
Swift
@available(*, deprecated, message: "Deprecated in version 3.17.0. Please use User.save(newPassword:options:completionHandler:﹚ instead") @discardableResult open func save<U: User>( newPassword: String? = nil, completionHandler: UserHandler<U>? = nil ) -> AnyRequest<Swift.Result<U, Swift.Error>>
-
Creates or updates a
User
.Declaration
Swift
@discardableResult open func save<U: User>( newPassword: String? = nil, options: Options? = nil, completionHandler: ((Swift.Result<U, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<U, Swift.Error>>
-
This method allows users to do exact queries for other users restricted to the
UserQuery
attributes.Declaration
Swift
@available(*, deprecated, message: "Deprecated in version 3.17.0. Please use User.lookup(_:options:completionHandler:﹚ instead") @discardableResult open func lookup<U: User>( _ userQuery: UserQuery, completionHandler: UsersHandler<U>? = nil ) -> AnyRequest<Swift.Result<[U], Swift.Error>>
-
This method allows users to do exact queries for other users restricted to the
UserQuery
attributes.Declaration
Swift
@discardableResult open func lookup<U: User>( _ userQuery: UserQuery, options: Options? = nil, completionHandler: ((Swift.Result<[U], Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<[U], Swift.Error>>
-
Register the user to start performing realtime / live calls
Declaration
Swift
@discardableResult open func registerForRealtime( options: Options? = nil, completionHandler: ((Swift.Result<Void, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<Void, Swift.Error>>
-
Unregister the user to stop performing realtime / live calls
Declaration
Swift
@discardableResult open func unregisterForRealtime( options: Options? = nil, completionHandler: ((Swift.Result<Void, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<Void, Swift.Error>>
-
Autorization header used for calls that requires a logged
User
.Declaration
Swift
open var authorizationHeader: String? { get }
-
Login with MIC using Automated Authorization Grant Flow. We strongly recommend use Authorization Code Grant Flow instead of Automated Authorization Grant Flow for security reasons.
Declaration
Swift
@available(*, deprecated, message: "Deprecated in version 3.16.0. Please use login(username:password:provider:options:completionHandler:﹚ instead") open class func login<U: User>( redirectURI: URL, username: String, password: String, authServiceId: String? = nil, client: Client = sharedClient, completionHandler: UserHandler<U>? = nil )
-
Login with MIC using Automated Authorization Grant Flow. We strongly recommend use Authorization Code Grant Flow instead of Automated Authorization Grant Flow for security reasons.
Declaration
Swift
@available(*, deprecated, message: "Deprecated in version 3.16.0. Please use login(username:password:provider:options:completionHandler:﹚ instead") open class func login<U: User>( redirectURI: URL, username: String, password: String, authServiceId: String? = nil, client: Client = sharedClient, completionHandler: ((Swift.Result<U, Swift.Error>) -> Void)? = nil )
-
Login with MIC using Automated Authorization Grant Flow. We strongly recommend use Authorization Code Grant Flow instead of Automated Authorization Grant Flow for security reasons.
Declaration
Swift
@available(*, deprecated, message: "Deprecated in version 3.16.0. Please use login(username:password:provider:options:completionHandler:﹚ instead") open class func login<U: User>( redirectURI: URL, username: String, password: String, options: Options? = nil, completionHandler: ((Swift.Result<U, Swift.Error>) -> Void)? = nil )
-
Login with MIC using Automated Authorization Grant Flow. We strongly recommend use Authorization Code Grant Flow instead of Automated Authorization Grant Flow for security reasons.
Declaration
Swift
@discardableResult open class func login<U: User>( username: String, password: String, provider: AuthProvider = .kinvey, options: Options? = nil, completionHandler: ((Swift.Result<U, Swift.Error>) -> Void)? = nil ) -> AnyRequest<Swift.Result<U, Swift.Error>>
-
Performs a login using the MIC Redirect URL that contains a temporary token.
-
presentMICViewController(redirectURI:
micUserInterface: currentViewController: options: completionHandler: ) Presents the MIC View Controller to sign in a user using MIC (Mobile Identity Connect).
-
Undocumented
See moreDeclaration
Swift
public enum CodingKeys : String, CodingKey
-
Undocumented
Declaration
Swift
public class func decode<T>(from data: Data) throws -> T where T : JSONDecodable
-
Undocumented
Declaration
Swift
public class func decodeArray<T>(from data: Data) throws -> [T] where T : JSONDecodable
-
Undocumented
Declaration
Swift
public class func decode<T>(from dictionary: [String : Any]) throws -> T where T : JSONDecodable
-
Undocumented
Declaration
Swift
public func refresh(from dictionary: [String : Any]) throws
-
Undocumented
Declaration
Swift
public func encode() throws -> [String : Any]
-
Undocumented
Declaration
Swift
open override var hash: Int { get }
-
Undocumented
Declaration
Swift
public static func == (lhs: User, rhs: User) -> Bool
-
Undocumented
Declaration
Swift
open override func isEqual(_ object: Any?) -> Bool
-
Undocumented
Declaration
Swift
open override func setValue(_ value: Any?, forUndefinedKey key: String)