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.
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of Liferay, Inc. nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package com.wedeploy.api;
import com.wedeploy.api.query.Aggregation;
import com.wedeploy.api.query.Filter;
import com.wedeploy.api.query.Query;
import com.wedeploy.api.realtime.RealTime;
import com.wedeploy.api.sdk.Auth;
import com.wedeploy.api.sdk.ContentType;
import com.wedeploy.api.sdk.Cookie;
import com.wedeploy.api.sdk.MultiMap;
import com.wedeploy.api.sdk.Request;
import com.wedeploy.api.sdk.RequestImpl;
import com.wedeploy.api.sdk.Response;
import com.wedeploy.api.serializer.Serializer;
import com.wedeploy.api.transport.impl.DefaultTransport;
import com.wedeploy.api.transport.impl.Transport;
import com.wedeploy.api.util.Util;
import java.util.ArrayList;
import java.util.Base64;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
/**
* Java client.
*/
public class WeDeploy {
public static String MASTER_TOKEN;
public static final String METHOD_DELETE = "DELETE";
public static final String METHOD_GET = "GET";
public static final String METHOD_HEAD = "HEAD";
public static final String METHOD_OPTION = "OPTION";
public static final String METHOD_PATCH = "PATCH";
public static final String METHOD_POST = "POST";
public static final String METHOD_PUT = "PUT";
/**
* Static factory for creating WeDeploy client.
*/
public static WeDeploy url(String url) {
return new WeDeploy(url);
}
/**
* Main constructor.
*/
public WeDeploy(String url) {
this.url = url;
}
/**
* See {@link Query.Builder}
*/
public WeDeploy aggregate(Aggregation aggregation) {
getOrCreateQuery().aggregate(aggregation);
return this;
}
/**
* See {@link Query.Builder}
*/
public WeDeploy aggregate(String name, String field, String operator) {
return aggregate(Aggregation.of(name, field, operator));
}
/**
* Authenticates with an auth instance.
*/
public WeDeploy auth(Auth auth) {
this.auth = auth;
return this;
}
/**
* Authenticates with token.
*/
public WeDeploy auth(String token) {
auth(Auth.create(token));
return this;
}
public WeDeploy auth(String username, String password) {
auth(Auth.create(username, password));
return this;
}
/**
* Sets the content type header of the request.
*/
public WeDeploy contentType(ContentType contentType) {
header("Content-Type", contentType.toString());
return this;
}
public WeDeploy cookie(Cookie cookie) {
this.cookies.add(cookie);
return this;
}
/**
* See {@link Query.Builder}
*/
public WeDeploy count() {
getOrCreateQuery().count();
return this;
}
/**
* Executes DELETE request.
*/
public Response delete() {
return delete(null);
}
/**
* Executes DELETE request.
*/
public Response delete(final Object body) {
return send(METHOD_DELETE, body);
}
/**
* Executes DELETE request.
*/
public Response delete(final String body) {
return send(METHOD_DELETE, body);
}
/**
* Executes DELETE request asynchronously.
*/
public CompletableFuture deleteAsync() {
return deleteAsync(null);
}
/**
* Serializes object and executes DELETE request asynchronously.
*/
public CompletableFuture deleteAsync(final Object body) {
return sendAsync(METHOD_DELETE, body);
}
/**
* Executes DELETE request asynchronously.
*/
public CompletableFuture deleteAsync(final String body) {
return sendAsync(METHOD_DELETE, body);
}
/**
* See {@link Query.Builder}
*/
public WeDeploy filter(Filter filter) {
getOrCreateQuery().filter(filter);
return this;
}
/**
* See {@link Query.Builder}
*/
public WeDeploy filter(String field, Object value) {
return filter(Filter.field(field, value));
}
/**
* See {@link Query.Builder}
*/
public WeDeploy filter(String field, String operator, Object value) {
return filter(Filter.field(field, operator, value));
}
/**
* Gets the form parameter.
*/
public Object form(String name) {
return forms.get(name);
}
/**
* Sets the form parameter.
*/
public WeDeploy form(String name, Object value) {
forms.set(name, value);
return this;
}
/**
* Returns the form parameter.
*/
public MultiMap