UserServiceDataModel

@objc public class UserServiceDataModel: NSObject

Manages all the UserService manifest configuration data.

  • Bank values are special in that the server sets / gets them as a single bulk operation. As such a game can use the special ‘bank’ key to denote getting / setting all bank values in a single operation with the server.

    Declaration

    Swift

    public static let KEY_TYPE_ALL_BANK = "bank"
  • The shared singleton instance.

    Declaration

    Swift

    public static var instance: UserServiceDataModel
  • Reset the instance, it will need to be reinitialized before it can be used again.

    Declaration

    Swift

    public static func reset() -> Void
  • Undocumented

    Declaration

    Swift

    public private(set) var fetchConfig: [String: [String]] = [:]
  • A flag that is true if the UserServiceDataModel has successfully initialized.

    Declaration

    Swift

    public private(set) var initialized: Bool = false
  • Initialize the service.

    Declaration

    Swift

    public func initialize() -> Promise<Response>

    Return Value

    A Promise<Response> that resolves when successfully initialized. Will fail if there are errors in the manifest ‘userService’ node.

  • Initialize the service with a custom Manifest instance.

    Declaration

    Swift

    public func initialize(manifest: Manifest) -> Promise<Response>

    Return Value

    A Promise<Response> that resolves when successfully initialized. Will fail if there are errors in the manifest ‘userService’ node.

  • Get a [String] of all configuration keys for a given type.

    Declaration

    Swift

    public func getAllItemConfigKeys(type: ItemType) throws -> [String]

    Parameters

    type

    The ItemType to get keys for.

    Return Value

    A [String] who’s contents are all the keys for the type.

  • Get an item config for type / key.

    Declaration

    Swift

    public func getItemConfig<T: IUserServiceItem>(type: ItemType, key: String, value: T.Value? = nil) throws -> T?

    Parameters

    type

    The ItemType.

    key

    The key of the item.

    value

    The optional value to assign into the config when returned.

    Return Value

    IUserServiceItem. Will be nil if the type or key are invalid / don’t exist.

  • Get the ItemType for a given key.

    Throws

    DarkMatterErrorCode.Uninitialized if the service is uninitialized.

    Declaration

    Swift

    public func getItemTypeForKey(key: String) throws -> ItemType?

    Parameters

    key

    The key to check.

    Return Value

    ItemType. nil if the key is invalid or not found.