Client APIs

You can use CMPComapi client instance obtained in Initialisation to access SDK APIs.


Get the current profileID:

NSString *profileID = [client profileID];
let profileId = client.profileID

Check if session is successfully created:

BOOL isSuccessfullyCreated = [client isSessionSuccessfullyCreated];
let isSessionSuccesfullyCreated = client.isSessionSuccessfullyCreated


Accessing services is done by calling methods from the proper group:

Most services use CMPResult object as a return value in completion blocks:

@interface CMPResult<__covariant T> : NSObject

@property (nonatomic, nullable) T object;
@property (nonatomic, nullable) NSError *error;
@property (nonatomic, nullable) NSString *eTag;
@property (nonatomic) NSInteger code;

- (instancetype)init NS_UNAVAILABLE;

- (instancetype)initWithObject:(nullable T)object error:(nullable NSError *)error eTag:(nullable NSString *)eTag code:(NSInteger)code;

open class Result<T> : NSObject where T : AnyObject {

    open var object: T?
    open var error: Error?
    open var eTag: String?
    open var code: Int

    public init(object: T?, error: Error?, eTag: String?, code: Int)

You can get the ETag value from it, as well as an HTTP status code and potential error.