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.PublisherResourceApi Maven / Gradle / Ivy
package com.tinypass.client.publisher.api;
import com.tinypass.client.common.*;
import java.util.Date;
import com.tinypass.client.publisher.model.Resource;
import java.util.*;
import java.math.*;
import java.io.*;
public class PublisherResourceApi {
private String basePath = "https://api.piano.io/api/v3";
private String token;
private ApiInvoker apiInvoker = null;
private Map headerParams = new LinkedHashMap();
public PublisherResourceApi(String basePath, String token) {
this.basePath = basePath;
this.token = token;
}
public PublisherResourceApi(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 attachResourceToFixedBundle
*/
public class attachResourceToFixedBundleRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public attachResourceToFixedBundleRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public attachResourceToFixedBundleRequest aid(String aid) {
setQueryParam(this.queryParams, "aid", aid);
return this;
}
public attachResourceToFixedBundleRequest includedRid(List includedRid) {
setQueryParam(this.queryParams, "included_rid", includedRid);
return this;
}
public attachResourceToFixedBundleRequest bundleRid(String bundleRid) {
setQueryParam(this.queryParams, "bundle_rid", bundleRid);
return this;
}
public void execute() throws ApiException{
String path = "/publisher/resource/attach".replaceAll("\\{format\\}","json");
getInvoker().invokeAPI(basePath, path, "GET", token,
queryParams, null,
headerParams,
formParams,
null,
null);
}
}
/**
* Helper method to create a new request.
*/
public attachResourceToFixedBundleRequest attachResourceToFixedBundleRequest(){
return new attachResourceToFixedBundleRequest(headerParams);
}
/**
* API Request for count
*/
public class countRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public countRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public countRequest aid(String aid) {
setQueryParam(this.queryParams, "aid", aid);
return this;
}
public Long execute() throws ApiException{
String path = "/publisher/resource/count".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "GET", token,
queryParams, null,
headerParams,
formParams,
"",
Long.class);
}
}
/**
* Helper method to create a new request.
*/
public countRequest countRequest(){
return new countRequest(headerParams);
}
/**
* API Request for createResource
*/
public class createResourceRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public createResourceRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public createResourceRequest aid(String aid) {
setQueryParam(this.formParams, "aid", aid);
return this;
}
public createResourceRequest rid(String rid) {
setQueryParam(this.formParams, "rid", rid);
return this;
}
public createResourceRequest name(String name) {
setQueryParam(this.formParams, "name", name);
return this;
}
public createResourceRequest description(String description) {
setQueryParam(this.formParams, "description", description);
return this;
}
public createResourceRequest type(String type) {
setQueryParam(this.formParams, "type", type);
return this;
}
public createResourceRequest imageUrl(String imageUrl) {
setQueryParam(this.formParams, "image_url", imageUrl);
return this;
}
public createResourceRequest bundleType(String bundleType) {
setQueryParam(this.formParams, "bundle_type", bundleType);
return this;
}
public createResourceRequest resourceTagId(List resourceTagId) {
setQueryParam(this.formParams, "resource_tag_id", resourceTagId);
return this;
}
public createResourceRequest publishDate(Date publishDate) {
setQueryParam(this.formParams, "publish_date", publishDate);
return this;
}
public createResourceRequest resourceUrl(String resourceUrl) {
setQueryParam(this.formParams, "resource_url", resourceUrl);
return this;
}
public createResourceRequest externalId(String externalId) {
setQueryParam(this.formParams, "external_id", externalId);
return this;
}
public Resource execute() throws ApiException{
String path = "/publisher/resource/create".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "POST", token,
queryParams, null,
headerParams,
formParams,
"",
Resource.class);
}
}
/**
* Helper method to create a new request.
*/
public createResourceRequest createResourceRequest(){
return new createResourceRequest(headerParams);
}
/**
* API Request for deleteResource
*/
public class deleteResourceRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public deleteResourceRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public deleteResourceRequest aid(String aid) {
setQueryParam(this.formParams, "aid", aid);
return this;
}
public deleteResourceRequest rid(String rid) {
setQueryParam(this.formParams, "rid", rid);
return this;
}
public void execute() throws ApiException{
String path = "/publisher/resource/delete".replaceAll("\\{format\\}","json");
getInvoker().invokeAPI(basePath, path, "POST", token,
queryParams, null,
headerParams,
formParams,
null,
null);
}
}
/**
* Helper method to create a new request.
*/
public deleteResourceRequest deleteResourceRequest(){
return new deleteResourceRequest(headerParams);
}
/**
* API Request for detachResourceFromFixedBundle
*/
public class detachResourceFromFixedBundleRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public detachResourceFromFixedBundleRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public detachResourceFromFixedBundleRequest aid(String aid) {
setQueryParam(this.queryParams, "aid", aid);
return this;
}
public detachResourceFromFixedBundleRequest rid(String rid) {
setQueryParam(this.queryParams, "rid", rid);
return this;
}
public detachResourceFromFixedBundleRequest bundleRid(String bundleRid) {
setQueryParam(this.queryParams, "bundle_rid", bundleRid);
return this;
}
public void execute() throws ApiException{
String path = "/publisher/resource/detach".replaceAll("\\{format\\}","json");
getInvoker().invokeAPI(basePath, path, "GET", token,
queryParams, null,
headerParams,
formParams,
null,
null);
}
}
/**
* Helper method to create a new request.
*/
public detachResourceFromFixedBundleRequest detachResourceFromFixedBundleRequest(){
return new detachResourceFromFixedBundleRequest(headerParams);
}
/**
* API Request for getResource
*/
public class getResourceRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public getResourceRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public getResourceRequest aid(String aid) {
setQueryParam(this.queryParams, "aid", aid);
return this;
}
public getResourceRequest rid(String rid) {
setQueryParam(this.queryParams, "rid", rid);
return this;
}
public Resource execute() throws ApiException{
String path = "/publisher/resource/get".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "GET", token,
queryParams, null,
headerParams,
formParams,
"",
Resource.class);
}
}
/**
* Helper method to create a new request.
*/
public getResourceRequest getResourceRequest(){
return new getResourceRequest(headerParams);
}
/**
* API Request for listBundles
*/
public class listBundlesRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public listBundlesRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public listBundlesRequest aid(String aid) {
setQueryParam(this.queryParams, "aid", aid);
return this;
}
public listBundlesRequest rid(String rid) {
setQueryParam(this.queryParams, "rid", rid);
return this;
}
public listBundlesRequest q(String q) {
setQueryParam(this.queryParams, "q", q);
return this;
}
public listBundlesRequest offset(Integer offset) {
setQueryParam(this.queryParams, "offset", offset);
return this;
}
public listBundlesRequest limit(Integer limit) {
setQueryParam(this.queryParams, "limit", limit);
return this;
}
public listBundlesRequest orderBy(String orderBy) {
setQueryParam(this.queryParams, "order_by", orderBy);
return this;
}
public listBundlesRequest orderDirection(String orderDirection) {
setQueryParam(this.queryParams, "order_direction", orderDirection);
return this;
}
public listBundlesRequest disabled(Boolean disabled) {
setQueryParam(this.queryParams, "disabled", disabled);
return this;
}
public listBundlesRequest type(String type) {
setQueryParam(this.queryParams, "type", type);
return this;
}
public listBundlesRequest bundleType(Integer bundleType) {
setQueryParam(this.queryParams, "bundle_type", bundleType);
return this;
}
public PageList execute() throws ApiException{
String path = "/publisher/resource/bundles".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "GET", token,
queryParams, null,
headerParams,
formParams,
"array",
Resource.class);
}
}
/**
* Helper method to create a new request.
*/
public listBundlesRequest listBundlesRequest(){
return new listBundlesRequest(headerParams);
}
/**
* API Request for listResources
*/
public class listResourcesRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public listResourcesRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public listResourcesRequest aid(String aid) {
setQueryParam(this.queryParams, "aid", aid);
return this;
}
public listResourcesRequest includedTagId(List includedTagId) {
setQueryParam(this.queryParams, "included_tag_id", includedTagId);
return this;
}
public listResourcesRequest excludedRid(List excludedRid) {
setQueryParam(this.queryParams, "excluded_rid", excludedRid);
return this;
}
public listResourcesRequest includedRid(List includedRid) {
setQueryParam(this.queryParams, "included_rid", includedRid);
return this;
}
public listResourcesRequest q(String q) {
setQueryParam(this.queryParams, "q", q);
return this;
}
public listResourcesRequest offset(Integer offset) {
setQueryParam(this.queryParams, "offset", offset);
return this;
}
public listResourcesRequest limit(Integer limit) {
setQueryParam(this.queryParams, "limit", limit);
return this;
}
public listResourcesRequest orderBy(String orderBy) {
setQueryParam(this.queryParams, "order_by", orderBy);
return this;
}
public listResourcesRequest orderDirection(String orderDirection) {
setQueryParam(this.queryParams, "order_direction", orderDirection);
return this;
}
public listResourcesRequest disabled(Boolean disabled) {
setQueryParam(this.queryParams, "disabled", disabled);
return this;
}
public listResourcesRequest type(String type) {
setQueryParam(this.queryParams, "type", type);
return this;
}
public listResourcesRequest bundleType(Integer bundleType) {
setQueryParam(this.queryParams, "bundle_type", bundleType);
return this;
}
public PageList execute() throws ApiException{
String path = "/publisher/resource/list".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "GET", token,
queryParams, null,
headerParams,
formParams,
"array",
Resource.class);
}
}
/**
* Helper method to create a new request.
*/
public listResourcesRequest listResourcesRequest(){
return new listResourcesRequest(headerParams);
}
/**
* API Request for updateResource
*/
public class updateResourceRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public updateResourceRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public updateResourceRequest aid(String aid) {
setQueryParam(this.formParams, "aid", aid);
return this;
}
public updateResourceRequest rid(String rid) {
setQueryParam(this.formParams, "rid", rid);
return this;
}
public updateResourceRequest name(String name) {
setQueryParam(this.formParams, "name", name);
return this;
}
public updateResourceRequest newRid(String newRid) {
setQueryParam(this.formParams, "new_rid", newRid);
return this;
}
public updateResourceRequest imageUrl(String imageUrl) {
setQueryParam(this.formParams, "image_url", imageUrl);
return this;
}
public updateResourceRequest description(String description) {
setQueryParam(this.formParams, "description", description);
return this;
}
public updateResourceRequest disabled(Boolean disabled) {
setQueryParam(this.formParams, "disabled", disabled);
return this;
}
public updateResourceRequest publishDate(Date publishDate) {
setQueryParam(this.formParams, "publish_date", publishDate);
return this;
}
public updateResourceRequest includedRid(List includedRid) {
setQueryParam(this.formParams, "included_rid", includedRid);
return this;
}
public updateResourceRequest fixedBundleRid(List fixedBundleRid) {
setQueryParam(this.formParams, "fixed_bundle_rid", fixedBundleRid);
return this;
}
public updateResourceRequest addTermId(List addTermId) {
setQueryParam(this.formParams, "add_term_id", addTermId);
return this;
}
public updateResourceRequest delTermId(List delTermId) {
setQueryParam(this.formParams, "del_term_id", delTermId);
return this;
}
public updateResourceRequest includedTagId(List includedTagId) {
setQueryParam(this.formParams, "included_tag_id", includedTagId);
return this;
}
public updateResourceRequest includedTagName(List includedTagName) {
setQueryParam(this.formParams, "included_tag_name", includedTagName);
return this;
}
public updateResourceRequest resourceUrl(String resourceUrl) {
setQueryParam(this.formParams, "resource_url", resourceUrl);
return this;
}
public updateResourceRequest externalId(String externalId) {
setQueryParam(this.formParams, "external_id", externalId);
return this;
}
public updateResourceRequest isFbiaResource(Boolean isFbiaResource) {
setQueryParam(this.formParams, "is_fbia_resource", isFbiaResource);
return this;
}
public Resource execute() throws ApiException{
String path = "/publisher/resource/update".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "POST", token,
queryParams, null,
headerParams,
formParams,
"",
Resource.class);
}
}
/**
* Helper method to create a new request.
*/
public updateResourceRequest updateResourceRequest(){
return new updateResourceRequest(headerParams);
}
}