com.ziqni.admin.sdk.api.TranslationsApiWs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ziqni-admin-sdk Show documentation
Show all versions of ziqni-admin-sdk Show documentation
ZIQNI Admin SDK Java Client
/*
* ZIQNI Admin API
* Ziqni Application Services are used to manage and configure spaces. Change log: 2024-02-27 Added rewards reduced to the LeaderboardEntry response
*
* The version of the OpenAPI document: 3.0.17
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.ziqni.admin.sdk.api;
import com.ziqni.admin.sdk.streaming.StreamingClient;
import com.ziqni.admin.sdk.streaming.handlers.EventHandler;
import com.ziqni.admin.sdk.streaming.handlers.CallbackConsumer;
import com.ziqni.admin.sdk.ApiException;
import com.ziqni.admin.sdk.streaming.stomp.StompHeaders;
import com.ziqni.admin.sdk.model.CreateTranslationRequest;
import com.ziqni.admin.sdk.model.ModelApiResponse;
import com.ziqni.admin.sdk.model.QueryRequest;
import com.ziqni.admin.sdk.model.TranslationResponse;
import com.ziqni.admin.sdk.model.UpdateTranslationRequest;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ziqni.admin.sdk.model.*;
import java.time.Duration;
import java.util.*;
//asyncNative:true
import java.util.concurrent.CompletableFuture;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.util.function.BiConsumer;
public class TranslationsApiWs {
private final Duration memberVarReadTimeout;
private final StreamingClient streamingClient;
public TranslationsApiWs(StreamingClient streamingClient, Duration readTimeout) {
this.streamingClient = streamingClient;
this.memberVarReadTimeout = readTimeout;
}
/**
* creating a translation
* Create a new Translation in the Ziqni system
* @param createTranslationRequest (required)
* @return CompletableFuture<ModelApiResponse>
*/
public CompletableFuture createTranslations(List createTranslationRequest) {
var request = new HashMap();
request.put("body",createTranslationRequest);
CompletableFuture result = this.streamingClient.sendWithApiCallback("/aapi/createTranslations", request);
return result;
}
/**
*
* Delete the Translations for a given identifier specified
* @param id The unique identifiers of the resources (optional
* @return CompletableFuture<ModelApiResponse>
*/
public CompletableFuture deleteTranslations(List id) {
var request = new HashMap();
var queryParam = new HashMap();
queryParam.put("id", id);
request.put("query",queryParam);
CompletableFuture result = this.streamingClient.sendWithApiCallback("/aapi/deleteTranslations", request);
return result;
}
/**
* Delete translations by query
* Delete a Translation or a list of Translations from Ziqni by unique Translation ID's or any other POST body parameters using the POST method
* @param body Delete a Translation or a list of Translations from Ziqni by unique Translation ID's or any other POST body parameters using the POST method (optional)
* @return CompletableFuture<ModelApiResponse>
*/
public CompletableFuture deleteTranslationsByQuery(QueryRequest body) {
var request = new HashMap();
request.put("body",body);
CompletableFuture result = this.streamingClient.sendWithApiCallback("/aapi/deleteTranslationsByQuery", request);
return result;
}
/**
*
* Returns a list of translations. This assumes that rules have first been created during achievement, competition or contest setup. The id is the ID of the entity the translations describe
* @param id The unique identifiers of the resources (optional
* @param limit Limit the returned total records found (optional)
* @param skip Skip the returned records found and return the next batch of records (optional)
* @return CompletableFuture<TranslationResponse>
*/
public CompletableFuture getTranslations(List id, Integer limit, Integer skip) {
var request = new HashMap();
var queryParam = new HashMap();
queryParam.put("id", id);
queryParam.put("limit", limit);
queryParam.put("skip", skip);
request.put("query",queryParam);
CompletableFuture result = this.streamingClient.sendWithApiCallback("/aapi/getTranslations", request);
return result;
}
/**
*
* Returns a list of Translations. This assumes that translations have first been uploaded via a POST request or web console
* @param refIds The reference ids of the resources (optional
* @param limit Limit the returned total records found (optional)
* @param skip Skip the returned records found and return the next batch of records (optional)
* @return CompletableFuture<TranslationResponse>
*/
public CompletableFuture getTranslationsByEntityId(List refIds, Integer limit, Integer skip) {
var request = new HashMap();
var queryParam = new HashMap();
queryParam.put("refIds", refIds);
queryParam.put("limit", limit);
queryParam.put("skip", skip);
request.put("query",queryParam);
CompletableFuture result = this.streamingClient.sendWithApiCallback("/aapi/getTranslationsByEntityId", request);
return result;
}
/**
*
* Retrieve a Translation or a list of Translations from Ziqni by unique Translation ID's or any other POST body parameters using the POST method
* @param body Retrieve a Translation or a list of Translations from Ziqni by unique Translation ID's or any other Post body parameters using the POST method (optional)
* @return CompletableFuture<TranslationResponse>
*/
public CompletableFuture getTranslationsByQuery(QueryRequest body) {
var request = new HashMap();
request.put("body",body);
CompletableFuture result = this.streamingClient.sendWithApiCallback("/aapi/getTranslationsByQuery", request);
return result;
}
/**
*
* Update existing translations
* @param body Update Translations. (required)
* @return CompletableFuture<ModelApiResponse>
*/
public CompletableFuture updateTranslations(List body) {
var request = new HashMap();
request.put("body",body);
CompletableFuture result = this.streamingClient.sendWithApiCallback("/aapi/updateTranslations", request);
return result;
}
private ApiException getApiException(String operationId, HttpResponse response) {
String message = formatExceptionMessage(operationId, response.statusCode(), response.body());
return new ApiException(response.statusCode(), message, response.headers(), response.body());
}
private String formatExceptionMessage(String operationId, int statusCode, String body) {
if (body == null || body.isEmpty()) {
body = "[no body]";
}
return operationId + " call failed with: " + statusCode + " - " + body;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy