Documentation
Quick Start
MimiCoreKit is the gateway to Mimi services; providing access to key functionality such as authentication, personalization and test management. It handles all aspects of communication with the Mimi API, providing a robust framework that can be used to integrate an app into the Mimi eco-system.
Key Features
- Robust and powerful communication framework; handling networking, caching and data models.
- Authentication services for Mimi accounts and features.
- Personalization service to provide preset data for sound personalization.
- Processing interface for audio processing communication over a centralized medium.
Basics
Access to MimiCore
is provided through a singelton instance.
import MimiCoreKit
let core = MimiCore.shared
To start using MimiCore
you are required to have a valid API Key and API Secret.
core.start(credentials: .client(id: "YOUR_CLIENT_ID", secret: "YOUR_CLIENT_SECRET"),
delegate: self)
You are also required to provide a MimiCoreDelegate
when starting MimiCore. This delegate is responsible for receiving and handling critical events from MimiCore that may occur.
MimiCore utilizes a layer of controllers to provide access to the raw Mimi services and data:
.auth: MimiAuthController
- Access to authentication functions and data..test: MimiTestController
- Access to test management and submission..processing: MimiProcessingController
- Access to the centralized processing interface and data..configuration: MimiConfigurationController
- Access to remote configuration data.
These controllers are all available at the root level of MimiCore
.
For example to authenticate a user anonymously:
core.auth.authenticate(route: .anonymously) { (result) in
switch result {
case .success(let user):
print("Success:\(user)")
case .failure(let reason):
print("Failed: \(reason)")
}
}
Many controllers also provide observables, which can be used to observe events that occur within MimiCore
. For example, to observe to events that occur in the MimiAuthController
:
class AuthObservable: MimiAuthControllerObservable {
init() {
core.auth.observable.addObserver(self)
}
func authController(_ controller: MimiAuthController, didUpdate currentUser: MimiUser?, error: MimiCoreError?) {
// User has been updated.
}
}
Debugging
MimiCore
provides detailed logging should you require to debug an issue. By default this is disabled with the exception of critical messages. This can be accessed via MimiCore.log
.
import MimiCoreKit
MimiCore.shared.log.levels = [.all] // Defaults to .none
The following values are available for log levels: .none, .debug, .info, .warning, .error, .all
-
MimiCore is the gateway to Mimi services; providing access to key functionality such as authentication, personalization and test management. It handles all aspects of communication with the Mimi API, providing a robust framework that can be used to integrate an app into the Mimi eco-system.
Declaration
Swift
public final class MimiCore
-
Methods that you are required to respond to as a MimiCore user.
Declaration
Swift
public protocol MimiCoreDelegate : AnyObject
-
Result of an API call.
- success: Result was a success, including requested data.
- failure: Result was a failure, including error.
Declaration
Swift
public typealias MimiCoreResult<DataType> = Result<DataType, MimiCoreError>
-
MimiCore error
- configuration: A configuration error has occurred in MimiCore.
- client: A client error occurred, with details if available.
- server: A server error occurred, with details if available.
- data: A data error occurred, with details if available.
- processing: An error occurred with processing communication.
- processingHandler: An internal error occurred in a processing handler.
- unknown: An unknown error occurred.
- unserviceable: Version of MimiCore is unserviceable and unsupported.
Declaration
Swift
public enum MimiCoreError : Error
extension MimiCoreError: Equatable
extension MimiCoreError: CustomDebugStringConvertible
-
Details of a MimiCoreError.
Declaration
Swift
public struct MimiCoreErrorDetails : Codable
extension MimiCoreErrorDetails: CustomDebugStringConvertible