QuantaCorp Objective-C SDK
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"
#import "QCAsyncScanStatus.h"
@interface QCApiSession : NSObject
@property (nonatomic) QCApiToken *token;
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithBaseURI:(NSURL *)baseUri
withClient:(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);
typedef void(^QCApiSessionAsyncScanStatusBlock)(QCAsyncScanStatus *scanStatus, NSError *error);
- (void)authenticateWithUsername:(NSString *)username
andPassword:(NSString *)password
withCallback:(QCApiSessionTokenBlock)callback;
- (void)authenticateWithRefreshToken:(NSString *)refreshToken
withCallback:(QCApiSessionTokenBlock)callback;
- (void)authenticateWithJWT:(NSString *)jwt
withCallback:(QCApiSessionTokenBlock)callback;
- (void)createBody:(QCCreateBodyDTO *)body
withCallback:(QCApiSessionIdentifierBlock)callback;
- (void)createAsyncScanForProject:(NSNumber *)projectId
andBody:(NSNumber *)bodyId
withCallback:(QCApiSessionIdentifierBlock)callback;
- (void)uploadFrontPicture:(QCPicture *)picture
forAsyncScan:(NSNumber *)scanId
withCallback:(QCApiSessionSuccessBlock)callback;
- (void)uploadSidePicture:(QCPicture *)picture
forAsyncScan:(NSNumber *)scanId
withCallback:(QCApiSessionSuccessBlock)callback;
- (void)createCallbacks:(NSDictionary *)callbacks
forAysncScan:(NSNumber *)scanId
withCallback:(QCApiSessionSuccessBlock)callback;
- (void)processAsyncScan:(NSNumber *)scanId
withCallback:(QCApiSessionSuccessBlock)callback;
- (void)getAsyncScanStatus:(NSNumber *)scanId
withCallback:(QCApiSessionAsyncScanStatusBlock)callback;
@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
QCAsyncScanStatus
//
// QCAsyncScanStatus.h
// QuantaCorp
//
// Created by Thomas De Wilde on 19/04/2022.
//
#import <Foundation/Foundation.h>
#import "QCAsyncScanStatusDTO.h"
#import "QCImageResolutionType.h"
#import "QCImageStatusType.h"
#import "QCMatchingStatusType.h"
#import "QCScanStatusType.h"
@interface QCAsyncScanStatus : NSObject
- (instancetype)initWithDTO:(QCAsyncScanStatusDTO *)dto;
@property NSNumber *scanId;
@property QCImageResolutionType frontImageResolutionType;
@property QCImageResolutionType sideImageResolutionType;
@property QCImageStatusType frontImageSegmentationStatusType;
@property QCImageStatusType sideImageSegmentationStatusType;
@property QCImageStatusType frontImageSegmentationRefinementStatusType;
@property QCImageStatusType sideImageSegmentationRefinementStatusType;
@property QCMatchingStatusType matchingStatusType;
@property QCScanStatusType scanStatusType;
@end
QCAsyncScanStatusDTO
//
// QCAsyncScanStatusDTO.h
// QuantaCorp
//
// Created by Thomas De Wilde on 14/04/2022.
//
#import <Foundation/Foundation.h>
#import "QCJsonSerializableObject.h"
@interface QCAsyncScanStatusDTO : NSObject <QCJsonSerializableObject>
- (instancetype)initWithJsonDictionary:(NSDictionary *)dictionary;
@property NSNumber *scanId;
@property NSString *frontImageResolutionType;
@property NSString *sideImageResolutionType;
@property NSString *frontImageSegmentationStatusType;
@property NSString *sideImageSegmentationStatusType;
@property NSString *frontImageSegmentationRefinementStatusType;
@property NSString *sideImageSegmentationRefinementStatusType;
@property NSString *matchingStatusType;
@property NSString *scanStatusType;
@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
QCErrorDomain
//
// QCErrorDomain.h
// QuantaCorp
//
// Created by Thomas De Wilde on 08/10/2021.
//
#import <Foundation/Foundation.h>
extern NSErrorDomain const QCApiErrorDomain;
extern NSErrorDomain const QCScanErrorDomain;
QCGender
//
// QCGender.h
// QuantaCorp
//
// Created by Thomas De Wilde on 10/10/2021.
//
typedef NS_ENUM(NSUInteger, QCGender) {
QCGenderUnknown,
QCGenderFemale,
QCGenderMale
};
QCImageResolutionType
//
// QCImageResolutionType.h
// QuantaCorp
//
// Created by Thomas De Wilde on 19/04/2022.
//
typedef NS_ENUM(NSUInteger, QCImageResolutionType) {
QCImageResolutionTypeResolutionPending,
QCImageResolutionTypeLowResolution,
QCImageResolutionTypeHighResolution
};
QCImageStatusType
//
// QCImageStatusType.h
// QuantaCorp
//
// Created by Thomas De Wilde on 19/04/2022.
//
typedef NS_ENUM(NSUInteger, QCImageStatusType) {
QCImageStatusTypePendingImageUpload,
QCImageStatusTypePendingImageSegmentation,
QCImageStatusTypePendingSegmentationRefinement,
QCImageStatusTypeSuccess,
QCImageStatusTypeFailureDuringSegmentation,
QCImageStatusTypeFailureDuringRefinement,
QCImageStatusTypeRefinementServiceNotAvailable,
QCImageStatusTypeResolutionTooLowForSegmentationRefinement
};
QCJsonSerializableObject
//
// QCJsonSerializableObject.h
// QuantaCorp
//
// Created by Thomas De Wilde on 16/09/2021.
//
#import <Foundation/Foundation.h>
@protocol QCJsonSerializableObject
- (NSDictionary *)toJsonDictionary;
@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;
@property (readonly) BOOL discarded;
- (BOOL)discard;
@end
QCScanConfiguration
//
// QCScanConfiguration.h
// QuantaCorp
//
// Created by Thomas De Wilde on 08/10/2021.
//
#import <Foundation/Foundation.h>
#import "QCGender.h"
@interface QCScanConfiguration : NSObject
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithGender:(QCGender)gender
withHeight:(NSNumber *)height;
@property QCGender personGender;
@property NSNumber *personHeight;
@property NSNumber *personWeight;
@end
QCScanController
//
// QCScanController.h
// QuantaCorp
//
// Created by Thomas De Wilde on 30/09/2021.
//
#import <UIKit/UIKit.h>
#import <CoreMotion/CoreMotion.h>
#import <AVFoundation/AVFoundation.h>
#import "QCScanDelegate.h"
#import "QCScanConfiguration.h"
@interface QCScanController : NSObject
@property (weak) CMMotionManager *motionManager;
@property (weak) id<QCScanDelegate> delegate;
@property (readonly) QCScanConfiguration *configuration;
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithMotionManager:(CMMotionManager *)motionManager
withScanDelegate:(id<QCScanDelegate>)scanDelegate;
typedef void(^QCScanControllerSuccessBlock)(BOOL success, NSError *error);
- (void)presentScanView:(QCScanConfiguration *)configuration
parent:(UIViewController *)parent
animated:(BOOL)animated
completion:(QCScanControllerSuccessBlock)completion;
- (void)dismissScanView;
@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>
@required
- (void)didCancelScanCapture:(NSError *)reason;
- (void)didFailScanCapture:(NSError *)error;
- (void)didCaptureFrontPicture:(QCPicture *)picture;
- (void)didCaptureSidePicture:(QCPicture *)picture;
@optional
- (void)scanViewWillAppear;
- (void)scanViewWillDisappear;
@end
QCScanError
//
// QCScanError.h
// QuantaCorp
//
// Created by Thomas De Wilde on 04/10/2021.
//
typedef NS_ENUM(NSUInteger, QCScanError) {
QCScanErrorCameraUsageNotAuthorized,
QCScanErrorBadInputDevice,
QCScanErrorBadOutputDevice,
QCScanErrorUnsupportedSessionPreset,
QCScanErrorFailedToPrepareCapture,
QCScanErrorFailedToCapture,
QCScanErrorFailedToProcessCapturedData
};
QCScanStatusType
//
// QCScanStatusType.h
// QuantaCorp
//
// Created by Thomas De Wilde on 19/04/2022.
//
typedef NS_ENUM(NSUInteger, QCScanStatusType) {
QCScanStatusTypePendingImages,
QCScanStatusTypePendingSegmentation,
QCScanStatusTypePendingSegmentationRefinement,
QCScanStatusTypePendingMatching,
QCScanStatusTypeFailureInResponder,
QCScanStatusTypeFailureInMatcher,
QCScanStatusTypeSuccess
};