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.PublisherUserAccessApi Maven / Gradle / Ivy
package com.tinypass.client.publisher.api;
import com.tinypass.client.common.*;
import com.tinypass.client.publisher.model.Access;
import com.tinypass.client.publisher.model.AccessDTO;
import java.util.Date;
import java.util.*;
import java.math.*;
import java.io.*;
public class PublisherUserAccessApi {
private String basePath = "https://api.piano.io/api/v3";
private String token;
private ApiInvoker apiInvoker = null;
private Map headerParams = new LinkedHashMap();
public PublisherUserAccessApi(String basePath, String token) {
this.basePath = basePath;
this.token = token;
}
public PublisherUserAccessApi(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 checkAccess
*/
public class checkAccessRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public checkAccessRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public checkAccessRequest aid(String aid) {
setQueryParam(this.queryParams, "aid", aid);
return this;
}
public checkAccessRequest uid(String uid) {
setQueryParam(this.queryParams, "uid", uid);
return this;
}
public checkAccessRequest rid(String rid) {
setQueryParam(this.queryParams, "rid", rid);
return this;
}
public checkAccessRequest crossApp(Boolean crossApp) {
setQueryParam(this.queryParams, "cross_app", crossApp);
return this;
}
public AccessDTO execute() throws ApiException{
String path = "/publisher/user/access/check".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "GET", token,
queryParams, null,
headerParams,
formParams,
"",
AccessDTO.class);
}
}
/**
* Helper method to create a new request.
*/
public checkAccessRequest checkAccessRequest(){
return new checkAccessRequest(headerParams);
}
/**
* API Request for grantAccess
*/
public class grantAccessRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public grantAccessRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public grantAccessRequest aid(String aid) {
setQueryParam(this.queryParams, "aid", aid);
return this;
}
public grantAccessRequest rid(String rid) {
setQueryParam(this.queryParams, "rid", rid);
return this;
}
public grantAccessRequest uid(String uid) {
setQueryParam(this.queryParams, "uid", uid);
return this;
}
public grantAccessRequest emails(String emails) {
setQueryParam(this.queryParams, "emails", emails);
return this;
}
public grantAccessRequest expireDate(Long expireDate) {
setQueryParam(this.queryParams, "expire_date", expireDate);
return this;
}
public grantAccessRequest sendEmail(Boolean sendEmail) {
setQueryParam(this.queryParams, "send_email", sendEmail);
return this;
}
public grantAccessRequest url(String url) {
setQueryParam(this.queryParams, "url", url);
return this;
}
public grantAccessRequest message(String message) {
setQueryParam(this.queryParams, "message", message);
return this;
}
public PageList execute() throws ApiException{
String path = "/publisher/user/access/grant".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "GET", token,
queryParams, null,
headerParams,
formParams,
"array",
Access.class);
}
}
/**
* Helper method to create a new request.
*/
public grantAccessRequest grantAccessRequest(){
return new grantAccessRequest(headerParams);
}
/**
* API Request for grantAccessToUsers
*/
public class grantAccessToUsersRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public grantAccessToUsersRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public grantAccessToUsersRequest aid(String aid) {
setQueryParam(this.queryParams, "aid", aid);
return this;
}
public grantAccessToUsersRequest rid(List rid) {
setQueryParam(this.queryParams, "rid", rid);
return this;
}
public grantAccessToUsersRequest emails(List emails) {
setQueryParam(this.queryParams, "emails", emails);
return this;
}
public grantAccessToUsersRequest fileId(String fileId) {
setQueryParam(this.queryParams, "file_id", fileId);
return this;
}
public grantAccessToUsersRequest expireDate(Date expireDate) {
setQueryParam(this.queryParams, "expire_date", expireDate);
return this;
}
public grantAccessToUsersRequest sendEmail(Boolean sendEmail) {
setQueryParam(this.queryParams, "send_email", sendEmail);
return this;
}
public grantAccessToUsersRequest message(String message) {
setQueryParam(this.queryParams, "message", message);
return this;
}
public Integer execute() throws ApiException{
String path = "/publisher/user/access/grantToUsers".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "GET", token,
queryParams, null,
headerParams,
formParams,
"",
Integer.class);
}
}
/**
* Helper method to create a new request.
*/
public grantAccessToUsersRequest grantAccessToUsersRequest(){
return new grantAccessToUsersRequest(headerParams);
}
/**
* API Request for listAccess
*/
public class listAccessRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public listAccessRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public listAccessRequest aid(String aid) {
setQueryParam(this.queryParams, "aid", aid);
return this;
}
public listAccessRequest uid(String uid) {
setQueryParam(this.queryParams, "uid", uid);
return this;
}
public listAccessRequest expandBundled(Boolean expandBundled) {
setQueryParam(this.queryParams, "expand_bundled", expandBundled);
return this;
}
public listAccessRequest offset(Integer offset) {
setQueryParam(this.queryParams, "offset", offset);
return this;
}
public listAccessRequest limit(Integer limit) {
setQueryParam(this.queryParams, "limit", limit);
return this;
}
public listAccessRequest crossApp(Boolean crossApp) {
setQueryParam(this.queryParams, "cross_app", crossApp);
return this;
}
public PageList execute() throws ApiException{
String path = "/publisher/user/access/list".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "GET", token,
queryParams, null,
headerParams,
formParams,
"array",
AccessDTO.class);
}
}
/**
* Helper method to create a new request.
*/
public listAccessRequest listAccessRequest(){
return new listAccessRequest(headerParams);
}
/**
* API Request for revokeAccess
*/
public class revokeAccessRequest implements ApiRequest {
Map headerParams;
Map> queryParams = new HashMap<>();
Map> formParams = new HashMap<>();
Object body = null;
public revokeAccessRequest(Map headerParams) {
this.headerParams = headerParams;
}
public Map> getPreparedFormParams() {
return Collections.unmodifiableMap(formParams);
}
public revokeAccessRequest accessId(String accessId) {
setQueryParam(this.queryParams, "access_id", accessId);
return this;
}
public Access execute() throws ApiException{
String path = "/publisher/user/access/revoke".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "GET", token,
queryParams, null,
headerParams,
formParams,
"",
Access.class);
}
}
/**
* Helper method to create a new request.
*/
public revokeAccessRequest revokeAccessRequest(){
return new revokeAccessRequest(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 accessId(String accessId) {
setQueryParam(this.formParams, "access_id", accessId);
return this;
}
public updateRequest expireDate(Date expireDate) {
setQueryParam(this.formParams, "expire_date", expireDate);
return this;
}
public Access execute() throws ApiException{
String path = "/publisher/user/access/update".replaceAll("\\{format\\}","json");
return getInvoker().invokeAPI(basePath, path, "POST", token,
queryParams, null,
headerParams,
formParams,
"",
Access.class);
}
}
/**
* Helper method to create a new request.
*/
public updateRequest updateRequest(){
return new updateRequest(headerParams);
}
}