Package com.moesif.api.controllers
Class APIController
- java.lang.Object
-
- com.moesif.api.controllers.BaseController
-
- com.moesif.api.controllers.APIController
-
- All Implemented Interfaces:
IAPIController
public class APIController extends BaseController implements IAPIController
-
-
Field Summary
-
Fields inherited from class com.moesif.api.controllers.BaseController
httpCallBack
-
-
Constructor Summary
Constructors Constructor Description APIController(Configuration config)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description EventModelbuildEventModel(EventRequestModel eventRequestModel, EventResponseModel eventResponseModel, String userId, String companyId, String sessionToken, String apiVersion, Object metadata, String direction)intcalculateWeight(int sampleRate)Map<String,String>createEvent(EventModel body)Add Single API Event CallvoidcreateEventAsync(EventModel body, APICallBack<HttpResponse> callBack)Add Single API Event CallMap<String,String>createEventsBatch(List<EventModel> body)Add multiple API Events in a single batchvoidcreateEventsBatchAsync(List<EventModel> body, APICallBack<HttpResponse> callBack)Add multiple API Events in a single batchvoidcreateEventsBatchAsync(List<EventModel> body, APICallBack<HttpResponse> callBack, boolean useGzip)Add multiple API Events in a single batchHttpResponsegetAppConfig()Get the Application configvoidgetAppConfigAsync(APICallBack<HttpResponse> callBack)Get the Application config asyncBlockedByGovernanceRulesResponsegetBlockedByGovernanceRulesResponse(EventModel eventModel)BlockedByGovernanceRulesResponsegetBlockedByGovernanceRulesResponse(EventModel eventModel, List<GovernanceRulesModel> rules, AppConfigModel appConfig)AppConfigModelgetDefaultAppConfig()HttpResponsegetGovernanceRules()Get the Governance rulesvoidgetGovernanceRulesAsync(APICallBack<HttpResponse> callBack)Get the Governance rulesintgetSampleRateToUse(EventModel eventModel)intgetSampleRateToUse(EventModel eventModel, AppConfigModel appConfigModel)booleanisBlockedByGovernanceRules(EventModel eventModel)Deprecated.booleanisBlockedByGovernanceRules(EventModel eventModel, List<GovernanceRulesModel> rules, AppConfigModel appConfig)Deprecated.AppConfigModelparseAppConfigModel(InputStream jsonTxt)List<GovernanceRulesModel>parseGovernanceRulesModel(InputStream jsonTxt)voidsetHttpRequestRetryHandler(org.apache.http.client.HttpRequestRetryHandler httpRequestRetryHandler)booleanshouldSendSampledEvent(EventModel eventModel)voidupdateCompaniesBatch(List<CompanyModel> body)Update multiple Companies in a single batchvoidupdateCompaniesBatchAsync(List<CompanyModel> body, APICallBack<HttpResponse> callBack)Update multiple Companies in a single batch asyncvoidupdateCompany(CompanyModel body)Update a Single CompanyvoidupdateCompanyAsync(CompanyModel body, APICallBack<HttpResponse> callBack)Update a Single Company asyncvoidupdateSubscription(SubscriptionModel body)Update a Single SubscriptionvoidupdateSubscriptionAsync(SubscriptionModel body, APICallBack<HttpResponse> callBack)Update a Single Subscription asyncvoidupdateSubscriptionsBatch(List<SubscriptionModel> body)Update multiple Subscriptions in a single batchvoidupdateSubscriptionsBatchAsync(List<SubscriptionModel> body, APICallBack<HttpResponse> callBack)Update multiple Subscriptions in a single batch asyncvoidupdateUser(UserModel body)Update a Single UservoidupdateUserAsync(UserModel body, APICallBack<HttpResponse> callBack)Update a Single User asyncvoidupdateUsersBatch(List<UserModel> body)Update multiple Users in a single batchvoidupdateUsersBatchAsync(List<UserModel> body, APICallBack<HttpResponse> callBack)Update multiple Users in a single batch async-
Methods inherited from class com.moesif.api.controllers.BaseController
getClientInstance, getHttpCallBack, setClientInstance, setHttpCallBack, validateResponse
-
-
-
-
Constructor Detail
-
APIController
public APIController(Configuration config)
-
-
Method Detail
-
setHttpRequestRetryHandler
public void setHttpRequestRetryHandler(org.apache.http.client.HttpRequestRetryHandler httpRequestRetryHandler)
-
createEvent
public Map<String,String> createEvent(EventModel body) throws Throwable
Add Single API Event Call- Specified by:
createEventin interfaceIAPIController- Parameters:
body- The event to create- Throws:
Throwable- on error creating event
-
createEventAsync
public void createEventAsync(EventModel body, APICallBack<HttpResponse> callBack) throws com.fasterxml.jackson.core.JsonProcessingException
Add Single API Event Call- Specified by:
createEventAsyncin interfaceIAPIController- Parameters:
body- The event to createcallBack- Called after the HTTP response is received- Throws:
com.fasterxml.jackson.core.JsonProcessingException- on error creating event
-
createEventsBatch
public Map<String,String> createEventsBatch(List<EventModel> body) throws Throwable
Add multiple API Events in a single batch- Specified by:
createEventsBatchin interfaceIAPIController- Parameters:
body- The events to create- Throws:
Throwable- on error creating event
-
createEventsBatchAsync
public void createEventsBatchAsync(List<EventModel> body, APICallBack<HttpResponse> callBack) throws com.fasterxml.jackson.core.JsonProcessingException
Description copied from interface:IAPIControllerAdd multiple API Events in a single batch- Specified by:
createEventsBatchAsyncin interfaceIAPIController- Parameters:
body- The events to createcallBack- Called after the HTTP response is received- Throws:
com.fasterxml.jackson.core.JsonProcessingException- on error creating event
-
createEventsBatchAsync
public void createEventsBatchAsync(List<EventModel> body, APICallBack<HttpResponse> callBack, boolean useGzip) throws com.fasterxml.jackson.core.JsonProcessingException
Add multiple API Events in a single batch- Specified by:
createEventsBatchAsyncin interfaceIAPIController- Parameters:
body- The events to createcallBack- Called after the HTTP response is receiveduseGzip- Option to convert body to gzip type- Throws:
com.fasterxml.jackson.core.JsonProcessingException- on error creating event
-
updateUser
public void updateUser(UserModel body) throws Throwable
Update a Single User- Specified by:
updateUserin interfaceIAPIController- Parameters:
body- The user to update- Throws:
Throwable- on error updating user
-
updateUserAsync
public void updateUserAsync(UserModel body, APICallBack<HttpResponse> callBack) throws com.fasterxml.jackson.core.JsonProcessingException
Update a Single User async- Specified by:
updateUserAsyncin interfaceIAPIController- Parameters:
body- The user to updatecallBack- Called after the HTTP response is received- Throws:
com.fasterxml.jackson.core.JsonProcessingException- on error updating user
-
updateUsersBatch
public void updateUsersBatch(List<UserModel> body) throws Throwable
Update multiple Users in a single batch- Specified by:
updateUsersBatchin interfaceIAPIController- Parameters:
body- The list of users to update- Throws:
Throwable- on error updating users
-
updateUsersBatchAsync
public void updateUsersBatchAsync(List<UserModel> body, APICallBack<HttpResponse> callBack) throws com.fasterxml.jackson.core.JsonProcessingException
Update multiple Users in a single batch async- Specified by:
updateUsersBatchAsyncin interfaceIAPIController- Parameters:
body- The list of users to updatecallBack- Called after the HTTP response is received- Throws:
com.fasterxml.jackson.core.JsonProcessingException- on error updating users
-
updateCompany
public void updateCompany(CompanyModel body) throws Throwable
Update a Single Company- Specified by:
updateCompanyin interfaceIAPIController- Parameters:
body- The company to update- Throws:
Throwable- on error updating a company
-
updateCompanyAsync
public void updateCompanyAsync(CompanyModel body, APICallBack<HttpResponse> callBack) throws com.fasterxml.jackson.core.JsonProcessingException
Update a Single Company async- Specified by:
updateCompanyAsyncin interfaceIAPIController- Parameters:
body- The company to updatecallBack- Called after the HTTP response is received- Throws:
com.fasterxml.jackson.core.JsonProcessingException- on error updating a company
-
updateCompaniesBatch
public void updateCompaniesBatch(List<CompanyModel> body) throws Throwable
Update multiple Companies in a single batch- Specified by:
updateCompaniesBatchin interfaceIAPIController- Parameters:
body- The list of companies to update- Throws:
Throwable- on error updating companies
-
updateCompaniesBatchAsync
public void updateCompaniesBatchAsync(List<CompanyModel> body, APICallBack<HttpResponse> callBack) throws com.fasterxml.jackson.core.JsonProcessingException
Update multiple Companies in a single batch async- Specified by:
updateCompaniesBatchAsyncin interfaceIAPIController- Parameters:
body- The list of companies to updatecallBack- Called after the HTTP response is received- Throws:
com.fasterxml.jackson.core.JsonProcessingException- on error updating companies
-
updateSubscription
public void updateSubscription(SubscriptionModel body) throws Throwable
Update a Single Subscription- Specified by:
updateSubscriptionin interfaceIAPIController- Parameters:
body- The subscriptuon to update- Throws:
Throwable- on error creating event
-
updateSubscriptionAsync
public void updateSubscriptionAsync(SubscriptionModel body, APICallBack<HttpResponse> callBack) throws com.fasterxml.jackson.core.JsonProcessingException
Update a Single Subscription async- Specified by:
updateSubscriptionAsyncin interfaceIAPIController- Parameters:
body- The subscription to updatecallBack- Called after the HTTP response is received- Throws:
com.fasterxml.jackson.core.JsonProcessingException- on error creating event
-
updateSubscriptionsBatch
public void updateSubscriptionsBatch(List<SubscriptionModel> body) throws Throwable
Update multiple Subscriptions in a single batch- Specified by:
updateSubscriptionsBatchin interfaceIAPIController- Parameters:
body- The list of subscriptions to update- Throws:
Throwable- on error creating event
-
updateSubscriptionsBatchAsync
public void updateSubscriptionsBatchAsync(List<SubscriptionModel> body, APICallBack<HttpResponse> callBack) throws com.fasterxml.jackson.core.JsonProcessingException
Update multiple Subscriptions in a single batch async- Specified by:
updateSubscriptionsBatchAsyncin interfaceIAPIController- Parameters:
body- The list of subscriptions to updatecallBack- Called after the HTTP response is received- Throws:
com.fasterxml.jackson.core.JsonProcessingException- on error creating event
-
getAppConfig
public HttpResponse getAppConfig() throws Throwable
Get the Application config- Specified by:
getAppConfigin interfaceIAPIController- Throws:
Throwable- on error getting app config
-
getAppConfigAsync
public void getAppConfigAsync(APICallBack<HttpResponse> callBack) throws com.fasterxml.jackson.core.JsonProcessingException
Get the Application config async- Specified by:
getAppConfigAsyncin interfaceIAPIController- Parameters:
callBack- Called after the HTTP response is received- Throws:
com.fasterxml.jackson.core.JsonProcessingException- on error getting app config
-
getGovernanceRules
public HttpResponse getGovernanceRules() throws Throwable
Get the Governance rules- Specified by:
getGovernanceRulesin interfaceIAPIController- Throws:
Throwable- on error getting app config
-
getGovernanceRulesAsync
public void getGovernanceRulesAsync(APICallBack<HttpResponse> callBack) throws com.fasterxml.jackson.core.JsonProcessingException
Get the Governance rules- Specified by:
getGovernanceRulesAsyncin interfaceIAPIController- Parameters:
callBack- Called after the HTTP response is received- Throws:
com.fasterxml.jackson.core.JsonProcessingException- on error getting app config
-
parseGovernanceRulesModel
public List<GovernanceRulesModel> parseGovernanceRulesModel(InputStream jsonTxt) throws IOException
- Throws:
IOException
-
parseAppConfigModel
public AppConfigModel parseAppConfigModel(InputStream jsonTxt) throws IOException
- Throws:
IOException
-
getDefaultAppConfig
public AppConfigModel getDefaultAppConfig()
-
calculateWeight
public int calculateWeight(int sampleRate)
-
buildEventModel
public EventModel buildEventModel(EventRequestModel eventRequestModel, EventResponseModel eventResponseModel, String userId, String companyId, String sessionToken, String apiVersion, Object metadata, String direction)
-
isBlockedByGovernanceRules
@Deprecated public boolean isBlockedByGovernanceRules(EventModel eventModel)
Deprecated.
-
getBlockedByGovernanceRulesResponse
public BlockedByGovernanceRulesResponse getBlockedByGovernanceRulesResponse(EventModel eventModel)
-
getBlockedByGovernanceRulesResponse
public BlockedByGovernanceRulesResponse getBlockedByGovernanceRulesResponse(EventModel eventModel, List<GovernanceRulesModel> rules, AppConfigModel appConfig)
-
isBlockedByGovernanceRules
@Deprecated public boolean isBlockedByGovernanceRules(EventModel eventModel, List<GovernanceRulesModel> rules, AppConfigModel appConfig)
Deprecated.
-
shouldSendSampledEvent
public boolean shouldSendSampledEvent(EventModel eventModel)
-
getSampleRateToUse
public int getSampleRateToUse(EventModel eventModel)
-
getSampleRateToUse
public int getSampleRateToUse(EventModel eventModel, AppConfigModel appConfigModel)
-
-