Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.tinypass.client.anon.api.ConversionApi Maven / Gradle / Ivy
package com.tinypass.client.anon.api;
import com.tinypass.client.common.*;
import java.math.BigDecimal;
import com.tinypass.client.anon.model.TermConversion;
import java.util.*;
import java.math.*;
import java.io.*;
public class ConversionApi {
private String basePath = "https://api.piano.io/api/v3";
private String token;
private ApiInvoker apiInvoker = null;
private Map headerParams = new LinkedHashMap();
public ConversionApi(String basePath, String token) {
this.basePath = basePath;
this.token = token;
}
public ConversionApi(String basePath, String token, ApiInvoker invoker, Map headerParams) {
this(basePath, token);
this.apiInvoker = invoker;
this.headerParams = headerParams;
}
public ApiInvoker getInvoker() {
if(apiInvoker == null) apiInvoker = ApiInvoker.getInstance();
return apiInvoker;
}
public void setApiToken(String token){
this.token = token;
}
public void setBasePath(String basePath) {
this.basePath = basePath;
}
public String getBasePath() {
return basePath;
}
public String toQueryParam(Object arg) {
if(arg == null)
return null;
if (arg instanceof Date) {
Date date = (Date) arg;
long epochTime = date.getTime() / 1000;
return String.valueOf(epochTime);
} else {
return String.valueOf(arg);
}
}
public void setQueryParam(Map> params, String paramName, Object value) {
List currentValues = params.computeIfAbsent(paramName, k -> new ArrayList<>());
if (value instanceof List) {
List values = (List) value;
values.forEach(o -> addQueryParam(currentValues, o));
} else {
addQueryParam(currentValues, value);
}
}
private void addQueryParam(List currentValues, Object value) {
String v = toQueryParam(value);
if (v != null)
currentValues.add(v);
}
/**
* API Request for list
*/
public class listRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public listRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public listRequest aid(String aid) {
setQueryParam(this.queryParams, "aid", aid);
return this;
}
public listRequest userToken(String userToken) {
setQueryParam(this.queryParams, "user_token", userToken);
return this;
}
public listRequest userProvider(String userProvider) {
setQueryParam(this.queryParams, "user_provider", userProvider);
return this;
}
public listRequest userRef(String userRef) {
setQueryParam(this.queryParams, "user_ref", userRef);
return this;
}
public listRequest offset(Integer offset) {
setQueryParam(this.queryParams, "offset", offset);
return this;
}
public listRequest limit(Integer limit) {
setQueryParam(this.queryParams, "limit", limit);
return this;
}
public PageList execute() throws ApiException{
String path = "/conversion/list".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "GET", token,
queryParams, null,
headerParams,
formParams,
"array",
TermConversion.class);
}
}
/**
* Helper method to create a new request.
*/
public listRequest listRequest(){
return new listRequest(headerParams);
}
/**
* API Request for logConversion
*/
public class logConversionRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public logConversionRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public logConversionRequest trackingId(String trackingId) {
setQueryParam(this.formParams, "tracking_id", trackingId);
return this;
}
public logConversionRequest termId(String termId) {
setQueryParam(this.formParams, "term_id", termId);
return this;
}
public logConversionRequest termName(String termName) {
setQueryParam(this.formParams, "term_name", termName);
return this;
}
public logConversionRequest stepNumber(Integer stepNumber) {
setQueryParam(this.formParams, "step_number", stepNumber);
return this;
}
public logConversionRequest conversionCategory(String conversionCategory) {
setQueryParam(this.formParams, "conversion_category", conversionCategory);
return this;
}
public logConversionRequest amount(BigDecimal amount) {
setQueryParam(this.formParams, "amount", amount);
return this;
}
public logConversionRequest currency(String currency) {
setQueryParam(this.formParams, "currency", currency);
return this;
}
public logConversionRequest customParams(String customParams) {
setQueryParam(this.formParams, "custom_params", customParams);
return this;
}
public logConversionRequest browserId(String browserId) {
setQueryParam(this.formParams, "browser_id", browserId);
return this;
}
public logConversionRequest pageTitle(String pageTitle) {
setQueryParam(this.formParams, "page_title", pageTitle);
return this;
}
public logConversionRequest url(String url) {
setQueryParam(this.formParams, "url", url);
return this;
}
public logConversionRequest referer(String referer) {
setQueryParam(this.formParams, "referer", referer);
return this;
}
public logConversionRequest contentAuthor(String contentAuthor) {
setQueryParam(this.formParams, "content_author", contentAuthor);
return this;
}
public logConversionRequest contentCreated(String contentCreated) {
setQueryParam(this.formParams, "content_created", contentCreated);
return this;
}
public logConversionRequest contentSection(String contentSection) {
setQueryParam(this.formParams, "content_section", contentSection);
return this;
}
public logConversionRequest contentType(String contentType) {
setQueryParam(this.formParams, "content_type", contentType);
return this;
}
public logConversionRequest tags(List tags) {
setQueryParam(this.formParams, "tags", tags);
return this;
}
public logConversionRequest previousUserSegments(String previousUserSegments) {
setQueryParam(this.formParams, "previous_user_segments", previousUserSegments);
return this;
}
public logConversionRequest userState(String userState) {
setQueryParam(this.formParams, "user_state", userState);
return this;
}
public logConversionRequest cookieConsents(String cookieConsents) {
setQueryParam(this.formParams, "cookie_consents", cookieConsents);
return this;
}
public void execute() throws ApiException{
String path = "/conversion/log".replaceAll("\\{format\\}","json");
getInvoker().invokeAPI(basePath, path, "POST", token,
queryParams, null,
headerParams,
formParams,
null,
null);
}
}
/**
* Helper method to create a new request.
*/
public logConversionRequest logConversionRequest(){
return new logConversionRequest(headerParams);
}
/**
* API Request for logFunnelStep
*/
public class logFunnelStepRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public logFunnelStepRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public logFunnelStepRequest trackingId(String trackingId) {
setQueryParam(this.formParams, "tracking_id", trackingId);
return this;
}
public logFunnelStepRequest stepNumber(Integer stepNumber) {
setQueryParam(this.formParams, "step_number", stepNumber);
return this;
}
public logFunnelStepRequest stepName(String stepName) {
setQueryParam(this.formParams, "step_name", stepName);
return this;
}
public logFunnelStepRequest customParams(String customParams) {
setQueryParam(this.formParams, "custom_params", customParams);
return this;
}
public logFunnelStepRequest browserId(String browserId) {
setQueryParam(this.formParams, "browser_id", browserId);
return this;
}
public logFunnelStepRequest pageTitle(String pageTitle) {
setQueryParam(this.formParams, "page_title", pageTitle);
return this;
}
public logFunnelStepRequest url(String url) {
setQueryParam(this.formParams, "url", url);
return this;
}
public logFunnelStepRequest referer(String referer) {
setQueryParam(this.formParams, "referer", referer);
return this;
}
public logFunnelStepRequest contentAuthor(String contentAuthor) {
setQueryParam(this.formParams, "content_author", contentAuthor);
return this;
}
public logFunnelStepRequest contentCreated(String contentCreated) {
setQueryParam(this.formParams, "content_created", contentCreated);
return this;
}
public logFunnelStepRequest contentSection(String contentSection) {
setQueryParam(this.formParams, "content_section", contentSection);
return this;
}
public logFunnelStepRequest contentType(String contentType) {
setQueryParam(this.formParams, "content_type", contentType);
return this;
}
public logFunnelStepRequest tags(List tags) {
setQueryParam(this.formParams, "tags", tags);
return this;
}
public logFunnelStepRequest previousUserSegments(String previousUserSegments) {
setQueryParam(this.formParams, "previous_user_segments", previousUserSegments);
return this;
}
public logFunnelStepRequest userState(String userState) {
setQueryParam(this.formParams, "user_state", userState);
return this;
}
public logFunnelStepRequest cookieConsents(String cookieConsents) {
setQueryParam(this.formParams, "cookie_consents", cookieConsents);
return this;
}
public void execute() throws ApiException{
String path = "/conversion/logFunnelStep".replaceAll("\\{format\\}","json");
getInvoker().invokeAPI(basePath, path, "POST", token,
queryParams, null,
headerParams,
formParams,
null,
null);
}
}
/**
* Helper method to create a new request.
*/
public logFunnelStepRequest logFunnelStepRequest(){
return new logFunnelStepRequest(headerParams);
}
/**
* API Request for logMicroConversion
*/
public class logMicroConversionRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public logMicroConversionRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public logMicroConversionRequest trackingId(String trackingId) {
setQueryParam(this.formParams, "tracking_id", trackingId);
return this;
}
public logMicroConversionRequest eventGroupId(String eventGroupId) {
setQueryParam(this.formParams, "event_group_id", eventGroupId);
return this;
}
public logMicroConversionRequest customParams(String customParams) {
setQueryParam(this.formParams, "custom_params", customParams);
return this;
}
public logMicroConversionRequest browserId(String browserId) {
setQueryParam(this.formParams, "browser_id", browserId);
return this;
}
public logMicroConversionRequest pageTitle(String pageTitle) {
setQueryParam(this.formParams, "page_title", pageTitle);
return this;
}
public logMicroConversionRequest url(String url) {
setQueryParam(this.formParams, "url", url);
return this;
}
public logMicroConversionRequest referer(String referer) {
setQueryParam(this.formParams, "referer", referer);
return this;
}
public logMicroConversionRequest contentAuthor(String contentAuthor) {
setQueryParam(this.formParams, "content_author", contentAuthor);
return this;
}
public logMicroConversionRequest contentCreated(String contentCreated) {
setQueryParam(this.formParams, "content_created", contentCreated);
return this;
}
public logMicroConversionRequest contentSection(String contentSection) {
setQueryParam(this.formParams, "content_section", contentSection);
return this;
}
public logMicroConversionRequest contentType(String contentType) {
setQueryParam(this.formParams, "content_type", contentType);
return this;
}
public logMicroConversionRequest tags(List tags) {
setQueryParam(this.formParams, "tags", tags);
return this;
}
public logMicroConversionRequest previousUserSegments(String previousUserSegments) {
setQueryParam(this.formParams, "previous_user_segments", previousUserSegments);
return this;
}
public logMicroConversionRequest userState(String userState) {
setQueryParam(this.formParams, "user_state", userState);
return this;
}
public logMicroConversionRequest cookieConsents(String cookieConsents) {
setQueryParam(this.formParams, "cookie_consents", cookieConsents);
return this;
}
public void execute() throws ApiException{
String path = "/conversion/logMicroConversion".replaceAll("\\{format\\}","json");
getInvoker().invokeAPI(basePath, path, "POST", token,
queryParams, null,
headerParams,
formParams,
null,
null);
}
}
/**
* Helper method to create a new request.
*/
public logMicroConversionRequest logMicroConversionRequest(){
return new logMicroConversionRequest(headerParams);
}
}