QuantaCorp Objective-C SDK
QCScanController
//
// QCScanController.h
// QuantaCorp
//
// Created by Thomas De Wilde on 30/09/2021.
//
#import <UIKit/UIKit.h>
#import <CoreMotion/CoreMotion.h>
#import "QCScanDelegate.h"
extern NSErrorDomain const QCScanErrorDomain;
@interface QCScanController : NSObject
@property (weak) CMMotionManager *motionManager;
@property (weak) id <QCScanDelegate> delegate;
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithMotionManager:(CMMotionManager *)motionManager
withScanDelegate:(id <QCScanDelegate>)scanDelegate;
- (void)presentScanView:(UIViewController *)parent
animated:(BOOL)animated
completion:(void (^ __nullable)(void))completion;
- (void)dismissScanView;
@end
QCApiSession
//
// QCApiSession.h
// QuantaCorp
//
// Created by Thomas De Wilde on 14/09/2021.
//
#import <Foundation/Foundation.h>
#import "QCApiToken.h"
#import "QCCreateBodyDTO.h"
#import "QCPicture.h"
extern NSErrorDomain const QCApiErrorDomain;
@interface QCApiSession : NSObject
@property (nonatomic) QCApiToken *token;
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithClient:(NSString *)client
andSecret:(NSString *)secret;
typedef void(^QCApiSessionTokenBlock)(QCApiToken *token, NSError *error);
typedef void(^QCApiSessionIdentifierBlock)(NSNumber *identifier, NSError *error);
typedef void(^QCApiSessionSuccessBlock)(BOOL success, NSError *error);
- (void)authenticateWithUsername:(NSString *)username
andPassword:(NSString *)password
withCallback:(QCApiSessionTokenBlock)callback;
- (void)authenticateWithRefreshToken:(NSString *)refreshToken
withCallback:(QCApiSessionTokenBlock)callback;
- (void)createBody:(QCCreateBodyDTO *)body
withCallback:(QCApiSessionIdentifierBlock)callback;
- (void)createScanForProject:(NSNumber *)projectId
andBody:(NSNumber *)bodyId
withFrontPicture:(QCPicture *)frontPicture
andSidePicture:(QCPicture *)sidePicture
withCallback:(QCApiSessionIdentifierBlock)callback;
- (void)createCallbacks:(NSDictionary *)callbacks
forScan:(NSNumber *)scanId
withCallback:(QCApiSessionSuccessBlock)callback;
@end
QCScanDelegate
//
// QCScanDelegate.h
// QuantaCorp
//
// Created by Thomas De Wilde on 28/09/2021.
//
#import <Foundation/Foundation.h>
#import "QCPicture.h"
#import "QCScanError.h"
@protocol QCScanDelegate <NSObject>
@optional
- (void)scanViewWillAppear;
- (void)scanViewWillDisappear;
@required
- (void)didCancelScanCapture:(QCScanError *)reason;
- (void)didCaptureFrontPicture:(QCPicture *)picture;
- (void)didCaptureSidePicture:(QCPicture *)picture;
@end
QCApiToken
//
// QCApiToken.h
// QuantaCorp
//
// Created by Thomas De Wilde on 14/09/2021.
//
#import <Foundation/Foundation.h>
#import "QCJsonSerializableObject.h"
@interface QCApiToken : NSObject
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithAccessToken:(NSString *)accessToken
refreshToken:(NSString *)refreshToken
expiresIn:(NSTimeInterval)seconds
tokenType:(NSString *)tokenType;
- (instancetype)initWithAccessToken:(NSString *)accessToken
refreshToken:(NSString *)refreshToken
expirationDate:(NSDate *)expirationDate
tokenType:(NSString *)tokenType;
@property (readonly) NSString *accessToken;
@property (readonly) NSString *tokenType;
@property (readonly) NSDate *expirationDate;
@property (readonly) NSString *refreshToken;
@property (readonly) BOOL isExpired;
@end
QCCreateBodyDTO
//
// QCCreateBodyDTO.h
// QuantaCorp
//
// Created by Thomas De Wilde on 16/09/2021.
//
#import <Foundation/Foundation.h>
#import "QCJsonSerializableObject.h"
@interface QCCreateBodyDTO : NSObject <QCJsonSerializableObject>
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithCompany:(NSNumber *)companyId
withProject:(NSNumber *)projectId
withAlias:(NSString *)alias
withGender:(NSString *)gender
withHeight:(NSNumber *)height;
@property NSString *alias;
@property NSString *firstName;
@property NSString *lastName;
@property NSString *crmId;
@property NSNumber *userId;
@property NSNumber *companyId;
@property NSNumber *height;
@property NSNumber *weight;
@property NSString *gender;
@property NSString *notes;
@property NSNumber *linkToProject;
@property NSDictionary *custom1;
@property NSDictionary *custom2;
@property NSDictionary *custom3;
@property NSDictionary *custom4;
@property NSDictionary *custom5;
@property NSDictionary *custom6;
@property NSDictionary *custom7;
@property NSDictionary *custom8;
@property NSDictionary *custom9;
@property NSDictionary *custom10;
@end
QCPicture
//
// QCPicture.h
// QuantaCorp
//
// Created by Thomas De Wilde on 16/09/2021.
//
#import <Foundation/Foundation.h>
@interface QCPicture : NSObject
@property NSURL *location;
@property NSDictionary *metadata;
@property (readonly) NSData *png;
@end
QCScanError
//
// QCScanError.h
// QuantaCorp
//
// Created by Thomas De Wilde on 04/10/2021.
//
typedef NS_ENUM(NSUInteger, QCScanError) {
QCScanErrorBadInputDevice,
QCScanErrorBadOutputDevice
};