All Downloads are FREE. Search and download functionalities are using the official Maven repository.
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.AnonAssetsApi Maven / Gradle / Ivy
package com.tinypass.client.anon.api;
import com.tinypass.client.common.*;
import com.tinypass.client.anon.model.ClientConfigurationsDto;
import java.util.*;
import java.math.*;
import java.io.*;
public class AnonAssetsApi {
private String basePath = "https://api.piano.io/api/v3";
private String token;
private ApiInvoker apiInvoker = null;
private Map headerParams = new LinkedHashMap();
public AnonAssetsApi(String basePath, String token) {
this.basePath = basePath;
this.token = token;
}
public AnonAssetsApi(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 clientConfig
*/
public class clientConfigRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public clientConfigRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public clientConfigRequest aid(String aid) {
setQueryParam(this.queryParams, "aid", aid);
return this;
}
public ClientConfigurationsDto execute() throws ApiException{
String path = "/anon/assets/clientConfigurations.js".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "GET", token,
queryParams, null,
headerParams,
formParams,
"",
ClientConfigurationsDto.class);
}
}
/**
* Helper method to create a new request.
*/
public clientConfigRequest clientConfigRequest(){
return new clientConfigRequest(headerParams);
}
/**
* API Request for gaAccount
*/
public class gaAccountRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public gaAccountRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public gaAccountRequest aid(String aid) {
setQueryParam(this.queryParams, "aid", aid);
return this;
}
public String execute() throws ApiException{
String path = "/anon/assets/gaAccount".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "GET", token,
queryParams, null,
headerParams,
formParams,
"",
String.class);
}
}
/**
* Helper method to create a new request.
*/
public gaAccountRequest gaAccountRequest(){
return new gaAccountRequest(headerParams);
}
/**
* API Request for sdkRuntimeConfig
*/
public class sdkRuntimeConfigRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public sdkRuntimeConfigRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public sdkRuntimeConfigRequest aid(String aid) {
setQueryParam(this.queryParams, "aid", aid);
return this;
}
public ClientConfigurationsDto execute() throws ApiException{
String path = "/anon/assets/sdk-runtime-config.js".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "GET", token,
queryParams, null,
headerParams,
formParams,
"",
ClientConfigurationsDto.class);
}
}
/**
* Helper method to create a new request.
*/
public sdkRuntimeConfigRequest sdkRuntimeConfigRequest(){
return new sdkRuntimeConfigRequest(headerParams);
}
}