Accela SDK for iOS  V3.2
 All Classes Functions Properties Pages
AccelaMobile.h
1 
33 #import <Foundation/Foundation.h>
34 
35 #import "AMLogger.h"
36 #import "AMRequest.h"
37 #import "AMUtility.h"
38 #import "AMLoginView.h"
39 #import "AMRequestURL.h"
40 #import "AMError.h"
41 
42 //Default host
43 #define AM_DEFAULT_OAUTH_HOST @"https://auth.accela.com"
44 #define AM_DEFAULT_API_HOST @"https://apis.accela.com"
45 
46 //Time for request timeout: seconds
47 #define AM_TIMEOUT 60
48 
49 @protocol AMSessionDelegate;
50 @protocol AMProgressDelegate;
51 @protocol AMLoginDialogDelegate;
52 
53 extern NSString *AccelaMobileVersion;
54 
55 typedef enum
56 {
57  ENVIRONMENT_PROD = 1,
58  ENVIRONMENT_DEV = 2,
59  ENVIRONMENT_STAGE = 3,
60  ENVIRONMENT_CONFIG = 4,
61  ENVIRONMENT_SUPP = 5,
62  ENVIRONMENT_TEST = 6
63 }ENVIRONMENT_TYPE;
64 
65 @interface AMParameter : NSObject {
66  NSString *operationKey;
67  NSMutableDictionary *body;
68  NSMutableDictionary *criteria;
69  NSMutableArray *elements;
70 }
71 
77 - (id)initWithKey: (NSString *) key;
78 
86 - (NSData*)toData;
87 
93 @property (nonatomic,retain) NSString *operationKey;
94 
100 @property (nonatomic,retain) NSMutableDictionary *body;
101 
107 @property (nonatomic,retain) NSMutableDictionary *criteria;
108 
114 @property (nonatomic,retain) NSMutableArray *elements;
115 
116 @end
117 
122 @interface AccelaMobile : NSObject<AMRequestDelegate>
123 {
124  id<AMSessionDelegate> _sessionDelegate;
125 
126  NSString *_appId;
127 
128  NSDictionary *_userProfile;
129 }
130 
136 @property(nonatomic, assign) id<AMSessionDelegate> sessionDelegate;
143 @property (nonatomic, retain) NSString *amClientId;
150 @property (nonatomic, retain) NSString *amClientSecret;
157 @property (nonatomic,readonly) NSString *amAuthHost;
164 @property (nonatomic,readonly) NSString *amApiHost;
166 
172 @property (nonatomic, retain) NSDictionary *userProfile;
180 @property (nonatomic, retain) NSDictionary *httpHeaders;
187 @property(nonatomic,setter = setEnvType:) ENVIRONMENT_TYPE amEnvironmentType;
194 @property (nonatomic, setter = setAmIsRemember:, getter = getAmIsRemember) BOOL amIsRemember;
207 - (id)initWithAppId: (NSString *)appId withAppSecret:(NSString *)appSecret;
208 
224 - (id)initWithAppId: (NSString *)appId withAppSecret:(NSString *)appSecret withAuthHost:(NSString *)authHost withApiHost:(NSString *)apiHost;
225 
240 - (id)initWithAppId: (NSString *)appId withAppSecret:(NSString *)appSecret andDelegate:(id<AMSessionDelegate>)delegate;
241 
259 - (id)initWithAppId: (NSString *)appId withAppSecret:(NSString *)appSecret andDelegate:(id<AMSessionDelegate>)delegate withAuthHost:(NSString *)authHost withApiHost:(NSString *)apiHost;
260 
276 - (void)authorize:(NSArray *) permissions;
277 
294 - (void)authorize:(NSArray *) permissions withAgency:(NSString *) agency;
295 
307 -(BOOL) handleOpenURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation;
308 
314 - (void)handleDidBecomeActive;
315 
330 - (void)authenticate: (NSString *)agency user: (NSString *)user password: (NSString *)password loginDialogDelegate: (id<AMLoginDialogDelegate>) loginDialogDelegate NS_DEPRECATED_IOS(2_0, 5_0);
331 
341 - (void) authorizeAgencyApp:(NSArray *)permissions NS_DEPRECATED_IOS(2_0, 5_0);
342 
343 
359 - (void)authorize2:(NSArray *) permissions;
360 
361 
362 
379 - (void)authorize2:(NSArray *) permissions withAgency:(NSString *) agency;
380 
381 
389 - (BOOL)isSessionValid;
390 
396 - (void)logout;
397 
411 - (id)fetchWithPath: (NSString *)servicePath urlParams: (NSDictionary *)params error: (AMErrorBlock)errorBlock;
412 
433 - (id)fetchWithPath: (NSString *)servicePath
434  urlParams: (NSMutableDictionary *)params
435  httpMethod: (HTTP_METHOD)httpMethod
436  data: (NSData *)data
437  error: (AMErrorBlock)errorBlock;
438 
454 - (AMRequest*)requestWithPath: (NSString *)servicePath
455  urlParams: (NSDictionary *)params
456  requestDelegate: (id<AMRequestDelegate>)requestDelegate;
457 
473 - (AMRequest*)requestWithPath: (NSString *)servicePath
474  urlParams: (NSDictionary *)params
475  httpMethod: (HTTP_METHOD)httpMethod
476  data: (NSData *)data
477  requestDelegate: (id<AMRequestDelegate>)requestDelegate;
478 
495 -(AMRequest*)requestWithPath:(NSString *) servicePath
496  urlParams:(NSDictionary *)params
497  httpMethod:(HTTP_METHOD) httpMethod
498  data:(NSString *) data
499  attachments:(NSDictionary *) attachments
500  requestDelegate:(id<AMRequestDelegate>) requestDelegate;
501 
517 - (AMRequest*)uploadAttachment: (NSString *)servicePath
518  urlParams: (NSDictionary *)params
519  attachment: (NSDictionary *)fileInformation
520  requestDelegate: (id<AMRequestDelegate>)requestDelegate;
521 
537 - (AMRequest*)downloadAttachment: (NSString *)servicePath
538  urlParams: (NSDictionary *)params
539  localPath: (NSString *)localFile
540  requestDelegate: (id<AMRequestDelegate>)requestDelegate;
541 
558 -(AMRequest*)downloadAttachment:(NSString *)servicePath
559  urlParams: (NSDictionary *)params
560  httpMethod:(HTTP_METHOD) httpMethod
561  postData:(NSString *) data
562  localPath: (NSString *)localFile
563  requestDelegate:(id<AMRequestDelegate>) requestDelegate;
564 
570 +(AccelaMobile *) defaultInstance;
571 
572 @end
573 
581 @protocol AMSessionDelegate<NSObject>
583 @optional
584 
592 -(void)amDidLogin:(int) grantType;
593 
599 -(void)amDidCancelLogin;
600 
606 -(void)amDidLoginFailure:(AMError *)error;
607 
615 -(BOOL)amDidSessionInvalid:(AMError *)error;
616 
622 -(void)amDidLogout;
623 
624 @end
625 
626 
627 
628 
636 @protocol AMLoginDialogDelegate <NSObject>
638 @optional
639 
648 - (void)amDialogLogin;
649 
657 - (void)amDialogNotLogin: (BOOL)cancelled;
658 
666 - (void)amDialogLoginFailure:(AMError *)error;
667 
668 @end
Definition: AccelaMobile.h:582
NSMutableDictionary * criteria
Definition: AccelaMobile.h:68
Definition: AMError.h:27
NSMutableArray * elements
Definition: AccelaMobile.h:69
Definition: AccelaMobile.h:122
Definition: AMRequest.h:42
Definition: AccelaMobile.h:637
NSString * operationKey
Definition: AccelaMobile.h:66
NSMutableDictionary * body
Definition: AccelaMobile.h:67
Definition: AccelaMobile.h:65
Definition: AMRequest.h:282