UserStorage

PROTOCOL

# UserStorage

@objc public protocol UserStorage

A type representing storage, where already the users will be kept between app launches. By default this SDK uses concrete implementation of the protocol done at SQLiteUserStorage class. Also keep in mind, that this protocol doesn’t provide any data encryption and therefore developers have to implement it by themselves.

# Methods

# loadStorage()

func loadStorage() throws

Loads storage and its data into the memory.

# add(user:)

func add(user: User) throws

Adds a new user to the storage.

  • Parameter user: a user that needs to be added to the storage.

# Parameters

Name Description
user a user that needs to be added to the storage.

# delete(user:)

func delete(user: User) throws

Deletes the user from the storage.

  • Parameter user: a user that needs to be deleted to the storage.

# Parameters

Name Description
user a user that needs to be deleted to the storage.

# update(user:)

func update(user: User) throws

Updates the user in the storage

  • Parameter user: a user that needs to be updated to the storage.

# Parameters

Name Description
user a user that needs to be updated to the storage.

# all()

func all() -> [User]

Get all users written in the storage.

# getUser(by:projectId:)

func getUser(by userId: String, projectId: String) -> User?

Get User object by its user id and project id. If User isn’t present in the storage this method returns nil.

  • Parameters:
    • userId: a user id to be checked in the storage.
    • projectId: a project id to be checked in the storage.

# Parameters

Name Description
userId a user id to be checked in the storage.
projectId a project id to be checked in the storage.