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.PublisherSubscriptionShareApi Maven / Gradle / Ivy
package com.tinypass.client.publisher.api;
import com.tinypass.client.common.*;
import java.util.Date;
import com.tinypass.client.publisher.model.SharedSubscription;
import java.util.*;
import java.math.*;
import java.io.*;
public class PublisherSubscriptionShareApi {
private String basePath = "https://api.piano.io/api/v3";
private String token;
private ApiInvoker apiInvoker = null;
private Map headerParams = new LinkedHashMap();
public PublisherSubscriptionShareApi(String basePath, String token) {
this.basePath = basePath;
this.token = token;
}
public PublisherSubscriptionShareApi(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 invite
*/
public class inviteRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public inviteRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public inviteRequest aid(String aid) {
setQueryParam(this.formParams, "aid", aid);
return this;
}
public inviteRequest subscriptionId(String subscriptionId) {
setQueryParam(this.formParams, "subscription_id", subscriptionId);
return this;
}
public inviteRequest sharedAccount(String sharedAccount) {
setQueryParam(this.formParams, "shared_account", sharedAccount);
return this;
}
public Boolean execute() throws ApiException{
String path = "/publisher/subscription/share/invite".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "POST", token,
queryParams, null,
headerParams,
formParams,
"",
Boolean.class);
}
}
/**
* Helper method to create a new request.
*/
public inviteRequest inviteRequest(){
return new inviteRequest(headerParams);
}
/**
* 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.formParams, "aid", aid);
return this;
}
public listRequest offset(Integer offset) {
setQueryParam(this.formParams, "offset", offset);
return this;
}
public listRequest limit(Integer limit) {
setQueryParam(this.formParams, "limit", limit);
return this;
}
public listRequest termId(String termId) {
setQueryParam(this.formParams, "term_id", termId);
return this;
}
public listRequest unusedAccessesOnly(Boolean unusedAccessesOnly) {
setQueryParam(this.formParams, "unused_accesses_only", unusedAccessesOnly);
return this;
}
public listRequest status(String status) {
setQueryParam(this.formParams, "status", status);
return this;
}
public listRequest startDate(Date startDate) {
setQueryParam(this.formParams, "start_date", startDate);
return this;
}
public listRequest endDate(Date endDate) {
setQueryParam(this.formParams, "end_date", endDate);
return this;
}
public listRequest selectBy(String selectBy) {
setQueryParam(this.formParams, "select_by", selectBy);
return this;
}
public PageList execute() throws ApiException{
String path = "/publisher/subscription/share/list".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "POST", token,
queryParams, null,
headerParams,
formParams,
"array",
SharedSubscription.class);
}
}
/**
* Helper method to create a new request.
*/
public listRequest listRequest(){
return new listRequest(headerParams);
}
/**
* API Request for resend
*/
public class resendRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public resendRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public resendRequest aid(String aid) {
setQueryParam(this.formParams, "aid", aid);
return this;
}
public resendRequest subscriptionId(String subscriptionId) {
setQueryParam(this.formParams, "subscription_id", subscriptionId);
return this;
}
public resendRequest accountId(String accountId) {
setQueryParam(this.formParams, "account_id", accountId);
return this;
}
public Boolean execute() throws ApiException{
String path = "/publisher/subscription/share/resend".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "POST", token,
queryParams, null,
headerParams,
formParams,
"",
Boolean.class);
}
}
/**
* Helper method to create a new request.
*/
public resendRequest resendRequest(){
return new resendRequest(headerParams);
}
/**
* API Request for revoke
*/
public class revokeRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public revokeRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public revokeRequest aid(String aid) {
setQueryParam(this.formParams, "aid", aid);
return this;
}
public revokeRequest subscriptionId(String subscriptionId) {
setQueryParam(this.formParams, "subscription_id", subscriptionId);
return this;
}
public revokeRequest accountId(String accountId) {
setQueryParam(this.formParams, "account_id", accountId);
return this;
}
public Boolean execute() throws ApiException{
String path = "/publisher/subscription/share/revoke".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "POST", token,
queryParams, null,
headerParams,
formParams,
"",
Boolean.class);
}
}
/**
* Helper method to create a new request.
*/
public revokeRequest revokeRequest(){
return new revokeRequest(headerParams);
}
/**
* API Request for start
*/
public class startRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public startRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public startRequest aid(String aid) {
setQueryParam(this.formParams, "aid", aid);
return this;
}
public startRequest subscriptionId(String subscriptionId) {
setQueryParam(this.formParams, "subscription_id", subscriptionId);
return this;
}
public startRequest sharedAccounts(String sharedAccounts) {
setQueryParam(this.formParams, "shared_accounts", sharedAccounts);
return this;
}
public Boolean execute() throws ApiException{
String path = "/publisher/subscription/share/start".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "POST", token,
queryParams, null,
headerParams,
formParams,
"",
Boolean.class);
}
}
/**
* Helper method to create a new request.
*/
public startRequest startRequest(){
return new startRequest(headerParams);
}
/**
* API Request for stop
*/
public class stopRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public stopRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public stopRequest aid(String aid) {
setQueryParam(this.formParams, "aid", aid);
return this;
}
public stopRequest subscriptionId(String subscriptionId) {
setQueryParam(this.formParams, "subscription_id", subscriptionId);
return this;
}
public Boolean execute() throws ApiException{
String path = "/publisher/subscription/share/stop".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "POST", token,
queryParams, null,
headerParams,
formParams,
"",
Boolean.class);
}
}
/**
* Helper method to create a new request.
*/
public stopRequest stopRequest(){
return new stopRequest(headerParams);
}
/**
* API Request for update
*/
public class updateRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public updateRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public updateRequest aid(String aid) {
setQueryParam(this.formParams, "aid", aid);
return this;
}
public updateRequest subscriptionId(String subscriptionId) {
setQueryParam(this.formParams, "subscription_id", subscriptionId);
return this;
}
public updateRequest sharedAccounts(String sharedAccounts) {
setQueryParam(this.formParams, "shared_accounts", sharedAccounts);
return this;
}
public Boolean execute() throws ApiException{
String path = "/publisher/subscription/share/update".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "POST", token,
queryParams, null,
headerParams,
formParams,
"",
Boolean.class);
}
}
/**
* Helper method to create a new request.
*/
public updateRequest updateRequest(){
return new updateRequest(headerParams);
}
/**
* API Request for validate
*/
public class validateRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public validateRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public validateRequest aid(String aid) {
setQueryParam(this.formParams, "aid", aid);
return this;
}
public validateRequest rid(String rid) {
setQueryParam(this.formParams, "rid", rid);
return this;
}
public validateRequest email(String email) {
setQueryParam(this.formParams, "email", email);
return this;
}
public String execute() throws ApiException{
String path = "/publisher/subscription/share/validate".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "POST", token,
queryParams, null,
headerParams,
formParams,
"",
String.class);
}
}
/**
* Helper method to create a new request.
*/
public validateRequest validateRequest(){
return new validateRequest(headerParams);
}
}