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.publisher.api.PublisherLicensingNotificationRuleApi Maven / Gradle / Ivy
package com.tinypass.client.publisher.api;
import com.tinypass.client.common.*;
import com.tinypass.client.publisher.model.LicenseeNotificationRule;
import java.util.*;
import java.math.*;
import java.io.*;
public class PublisherLicensingNotificationRuleApi {
private String basePath = "https://api.piano.io/api/v3";
private String token;
private ApiInvoker apiInvoker = null;
private Map headerParams = new LinkedHashMap();
public PublisherLicensingNotificationRuleApi(String basePath, String token) {
this.basePath = basePath;
this.token = token;
}
public PublisherLicensingNotificationRuleApi(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 archiveLicenseeNotificationRule
*/
public class archiveLicenseeNotificationRuleRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public archiveLicenseeNotificationRuleRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public archiveLicenseeNotificationRuleRequest aid(String aid) {
setQueryParam(this.formParams, "aid", aid);
return this;
}
public archiveLicenseeNotificationRuleRequest licenseeId(String licenseeId) {
setQueryParam(this.formParams, "licensee_id", licenseeId);
return this;
}
public archiveLicenseeNotificationRuleRequest notificationRuleId(String notificationRuleId) {
setQueryParam(this.formParams, "notification_rule_id", notificationRuleId);
return this;
}
public void execute() throws ApiException{
String path = "/publisher/licensing/notificationRule/archive".replaceAll("\\{format\\}","json");
getInvoker().invokeAPI(basePath, path, "POST", token,
queryParams, null,
headerParams,
formParams,
null,
null);
}
}
/**
* Helper method to create a new request.
*/
public archiveLicenseeNotificationRuleRequest archiveLicenseeNotificationRuleRequest(){
return new archiveLicenseeNotificationRuleRequest(headerParams);
}
/**
* API Request for createLicenseeNotificationRule
*/
public class createLicenseeNotificationRuleRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public createLicenseeNotificationRuleRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public createLicenseeNotificationRuleRequest aid(String aid) {
setQueryParam(this.formParams, "aid", aid);
return this;
}
public createLicenseeNotificationRuleRequest licenseeId(String licenseeId) {
setQueryParam(this.formParams, "licensee_id", licenseeId);
return this;
}
public createLicenseeNotificationRuleRequest contractIdList(String contractIdList) {
setQueryParam(this.formParams, "contract_id_list", contractIdList);
return this;
}
public createLicenseeNotificationRuleRequest isForAllContracts(Boolean isForAllContracts) {
setQueryParam(this.formParams, "is_for_all_contracts", isForAllContracts);
return this;
}
public createLicenseeNotificationRuleRequest parameter(String parameter) {
setQueryParam(this.formParams, "parameter", parameter);
return this;
}
public createLicenseeNotificationRuleRequest condition(String condition) {
setQueryParam(this.formParams, "condition", condition);
return this;
}
public createLicenseeNotificationRuleRequest conditionValue(Integer conditionValue) {
setQueryParam(this.formParams, "condition_value", conditionValue);
return this;
}
public LicenseeNotificationRule execute() throws ApiException{
String path = "/publisher/licensing/notificationRule/create".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "POST", token,
queryParams, null,
headerParams,
formParams,
"",
LicenseeNotificationRule.class);
}
}
/**
* Helper method to create a new request.
*/
public createLicenseeNotificationRuleRequest createLicenseeNotificationRuleRequest(){
return new createLicenseeNotificationRuleRequest(headerParams);
}
/**
* API Request for getNotificationRulesList
*/
public class getNotificationRulesListRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public getNotificationRulesListRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public getNotificationRulesListRequest aid(String aid) {
setQueryParam(this.queryParams, "aid", aid);
return this;
}
public getNotificationRulesListRequest licenseeId(String licenseeId) {
setQueryParam(this.queryParams, "licensee_id", licenseeId);
return this;
}
public PageList execute() throws ApiException{
String path = "/publisher/licensing/notificationRule/list".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "GET", token,
queryParams, null,
headerParams,
formParams,
"array",
LicenseeNotificationRule.class);
}
}
/**
* Helper method to create a new request.
*/
public getNotificationRulesListRequest getNotificationRulesListRequest(){
return new getNotificationRulesListRequest(headerParams);
}
/**
* API Request for updateLicenseeNotificationRule
*/
public class updateLicenseeNotificationRuleRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public updateLicenseeNotificationRuleRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public updateLicenseeNotificationRuleRequest aid(String aid) {
setQueryParam(this.formParams, "aid", aid);
return this;
}
public updateLicenseeNotificationRuleRequest licenseeId(String licenseeId) {
setQueryParam(this.formParams, "licensee_id", licenseeId);
return this;
}
public updateLicenseeNotificationRuleRequest contractIdList(String contractIdList) {
setQueryParam(this.formParams, "contract_id_list", contractIdList);
return this;
}
public updateLicenseeNotificationRuleRequest notificationRuleId(String notificationRuleId) {
setQueryParam(this.formParams, "notification_rule_id", notificationRuleId);
return this;
}
public updateLicenseeNotificationRuleRequest isForAllContracts(Boolean isForAllContracts) {
setQueryParam(this.formParams, "is_for_all_contracts", isForAllContracts);
return this;
}
public updateLicenseeNotificationRuleRequest parameter(String parameter) {
setQueryParam(this.formParams, "parameter", parameter);
return this;
}
public updateLicenseeNotificationRuleRequest condition(String condition) {
setQueryParam(this.formParams, "condition", condition);
return this;
}
public updateLicenseeNotificationRuleRequest conditionValue(Integer conditionValue) {
setQueryParam(this.formParams, "condition_value", conditionValue);
return this;
}
public LicenseeNotificationRule execute() throws ApiException{
String path = "/publisher/licensing/notificationRule/update".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "POST", token,
queryParams, null,
headerParams,
formParams,
"",
LicenseeNotificationRule.class);
}
}
/**
* Helper method to create a new request.
*/
public updateLicenseeNotificationRuleRequest updateLicenseeNotificationRuleRequest(){
return new updateLicenseeNotificationRuleRequest(headerParams);
}
}