io.proximax.xpx.service.remote.RemoteDirectoryLoadApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xpx-java-sdk Show documentation
Show all versions of xpx-java-sdk Show documentation
Proximax P2P File Storage Java SDK (NIS1 Compatible)
/*
* Copyright 2018 ProximaX Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Proximax P2P Storage REST API
* Proximax P2P Storage REST API
*
* OpenAPI spec version: v0.0.1
* Contact: [email protected]
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package io.proximax.xpx.service.remote;
import io.proximax.ApiCallback;
import io.proximax.ApiClient;
import io.proximax.ApiResponse;
import io.proximax.Pair;
import io.proximax.ProgressRequestBody;
import io.proximax.ProgressResponseBody;
import io.proximax.xpx.exceptions.ApiException;
import io.proximax.xpx.service.intf.DirectoryLoadApi;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* The Class RemoteDirectoryLoadApi.
*/
public class RemoteDirectoryLoadApi implements DirectoryLoadApi {
/** The api client. */
private final ApiClient apiClient;
/**
* Instantiates a new remote directory load api.
*
* @param apiClient the api client
*/
public RemoteDirectoryLoadApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Gets the api client.
*
* @return the api client
*/
public ApiClient getApiClient() {
return apiClient;
}
/**
* Build call for loadDirectoryUsingGET.
*
* @param nemHash NEM Txn (Public) linked to the directory (required)
* @param progressListener Progress listener
* @param progressRequestListener Progress request listener
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
*/
public com.squareup.okhttp.Call loadDirectoryUsingGETCall(String nemHash, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/directory/load/{nemHash}/**"
.replaceAll("\\{" + "nemHash" + "\\}", apiClient.escapeString(nemHash.toString()));
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"*/*"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}
String[] localVarAuthNames = new String[] { };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
/**
* Load directory using GET validate before call.
*
* @param nemHash the proximax hash
* @param progressListener the progress listener
* @param progressRequestListener the progress request listener
* @return the com.squareup.okhttp. call
* @throws ApiException the api exception
*/
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call loadDirectoryUsingGETValidateBeforeCall(String nemHash, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'nemHash' is set
if (nemHash == null) {
throw new ApiException("Missing the required parameter 'nemHash' when calling loadDirectoryUsingGET(Async)");
}
com.squareup.okhttp.Call call = loadDirectoryUsingGETCall(nemHash, progressListener, progressRequestListener);
return call;
}
/**
* Loads a Static Content.
* Loads a Static Content.
* @param nemHash NEM Txn (Public) linked to the directory (required)
* @return Object
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public Object loadDirectoryUsingGET(String nemHash) throws ApiException {
ApiResponse