de.id4i.api.AliasApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of id4i-api-client Show documentation
Show all versions of id4i-api-client Show documentation
The ID4i API is an HTTP API that allows developer to implement applications on top of http://id4i.de. This provides for automating GUID creation and object registration, working with Collections of GUIDs and Routing.
The newest version!
/*
* ID4i API
* ID4i HTTP API
*
* OpenAPI spec version: 0.9.7
* 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 de.id4i.api;
import de.id4i.ApiCallback;
import de.id4i.ApiClient;
import de.id4i.ApiException;
import de.id4i.ApiResponse;
import de.id4i.Configuration;
import de.id4i.Pair;
import de.id4i.ProgressRequestBody;
import de.id4i.ProgressResponseBody;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import de.id4i.api.model.ApiError;
import de.id4i.api.model.GuidAlias;
import de.id4i.api.model.PaginatedResponseOfGuid;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class AliasApi {
private ApiClient apiClient;
public AliasApi() {
this(Configuration.getDefaultApiClient());
}
public AliasApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Build call for addGuidAlias
* @param id4n The GUID or Collection to operate on (required)
* @param aliasType Alias type, see the corresponding API model (required)
* @param alias The alias to add or update (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 addGuidAliasCall(String id4n, String aliasType, GuidAlias alias, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = alias;
// create path and map variables
String localVarPath = "/api/v1/id4ns/{id4n}/alias/{aliasType}"
.replaceAll("\\{" + "id4n" + "\\}", apiClient.escapeString(id4n.toString()))
.replaceAll("\\{" + "aliasType" + "\\}", apiClient.escapeString(aliasType.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/xml", "application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/xml", "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[] { "Authorization" };
return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call addGuidAliasValidateBeforeCall(String id4n, String aliasType, GuidAlias alias, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'id4n' is set
if (id4n == null) {
throw new ApiException("Missing the required parameter 'id4n' when calling addGuidAlias(Async)");
}
// verify the required parameter 'aliasType' is set
if (aliasType == null) {
throw new ApiException("Missing the required parameter 'aliasType' when calling addGuidAlias(Async)");
}
// verify the required parameter 'alias' is set
if (alias == null) {
throw new ApiException("Missing the required parameter 'alias' when calling addGuidAlias(Async)");
}
com.squareup.okhttp.Call call = addGuidAliasCall(id4n, aliasType, alias, progressListener, progressRequestListener);
return call;
}
/**
* Add alias for GUID or Collection
* Adds or replaces aliases for single ID4ns (alias type item and mapp) or groups of ID4ns (alias types gtin, ean and article)
* @param id4n The GUID or Collection to operate on (required)
* @param aliasType Alias type, see the corresponding API model (required)
* @param alias The alias to add or update (required)
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public void addGuidAlias(String id4n, String aliasType, GuidAlias alias) throws ApiException {
addGuidAliasWithHttpInfo(id4n, aliasType, alias);
}
/**
* Add alias for GUID or Collection
* Adds or replaces aliases for single ID4ns (alias type item and mapp) or groups of ID4ns (alias types gtin, ean and article)
* @param id4n The GUID or Collection to operate on (required)
* @param aliasType Alias type, see the corresponding API model (required)
* @param alias The alias to add or update (required)
* @return ApiResponse<Void>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse addGuidAliasWithHttpInfo(String id4n, String aliasType, GuidAlias alias) throws ApiException {
com.squareup.okhttp.Call call = addGuidAliasValidateBeforeCall(id4n, aliasType, alias, null, null);
return apiClient.execute(call);
}
/**
* Add alias for GUID or Collection (asynchronously)
* Adds or replaces aliases for single ID4ns (alias type item and mapp) or groups of ID4ns (alias types gtin, ean and article)
* @param id4n The GUID or Collection to operate on (required)
* @param aliasType Alias type, see the corresponding API model (required)
* @param alias The alias to add or update (required)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call addGuidAliasAsync(String id4n, String aliasType, GuidAlias alias, final ApiCallback callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = addGuidAliasValidateBeforeCall(id4n, aliasType, alias, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback);
return call;
}
/**
* Build call for getGuidAliasTypes
* @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 getGuidAliasTypesCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/api/v1/search/guids/aliases/types";
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/xml", "application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/xml", "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[] { "Authorization" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call getGuidAliasTypesValidateBeforeCall(final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
com.squareup.okhttp.Call call = getGuidAliasTypesCall(progressListener, progressRequestListener);
return call;
}
/**
* List all supported alias types
* Retrieve this list to find out all alias types to use with alias search and change operations
* @return List<String>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public List getGuidAliasTypes() throws ApiException {
ApiResponse> resp = getGuidAliasTypesWithHttpInfo();
return resp.getData();
}
/**
* List all supported alias types
* Retrieve this list to find out all alias types to use with alias search and change operations
* @return ApiResponse<List<String>>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public ApiResponse> getGuidAliasTypesWithHttpInfo() throws ApiException {
com.squareup.okhttp.Call call = getGuidAliasTypesValidateBeforeCall(null, null);
Type localVarReturnType = new TypeToken>(){}.getType();
return apiClient.execute(call, localVarReturnType);
}
/**
* List all supported alias types (asynchronously)
* Retrieve this list to find out all alias types to use with alias search and change operations
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/
public com.squareup.okhttp.Call getGuidAliasTypesAsync(final ApiCallback> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = getGuidAliasTypesValidateBeforeCall(progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
}
/**
* Build call for getGuidAliases
* @param id4n The GUID or Collection to operate on (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 getGuidAliasesCall(String id4n, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/api/v1/id4ns/{id4n}/alias"
.replaceAll("\\{" + "id4n" + "\\}", apiClient.escapeString(id4n.toString()));
List localVarQueryParams = new ArrayList();
List localVarCollectionQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/xml", "application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept);
final String[] localVarContentTypes = {
"application/xml", "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[] { "Authorization" };
return apiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
}
@SuppressWarnings("rawtypes")
private com.squareup.okhttp.Call getGuidAliasesValidateBeforeCall(String id4n, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
// verify the required parameter 'id4n' is set
if (id4n == null) {
throw new ApiException("Missing the required parameter 'id4n' when calling getGuidAliases(Async)");
}
com.squareup.okhttp.Call call = getGuidAliasesCall(id4n, progressListener, progressRequestListener);
return call;
}
/**
* Get all aliases for the given GUID or Collection.
* Looks up the alias for each alias type (group and single) and returns a map of all aliases found.
* @param id4n The GUID or Collection to operate on (required)
* @return Map<String, String>
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/
public Map getGuidAliases(String id4n) throws ApiException {
ApiResponse
© 2015 - 2025 Weber Informatics LLC | Privacy Policy