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.
package com.seeq.api;
import com.seeq.ApiException;
import com.seeq.ApiClient;
import com.seeq.Configuration;
import com.seeq.model.*;
import com.seeq.Pair;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.ProcessingException;
import com.seeq.model.GetChannelsOutputV1;
import com.seeq.model.StatusMessageBase;
import com.seeq.model.SubscriptionInputV1;
import com.seeq.model.SubscriptionUpdateInputV1;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class SubscriptionsApi {
private ApiClient apiClient;
private long retryTimeout = 5_000; // Default of 5 seconds
public SubscriptionsApi() {
this(Configuration.getDefaultApiClient());
}
public SubscriptionsApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public void setRetryTimeout(long retryTimeout) {
this.retryTimeout = retryTimeout;
}
public long getRetryTimeout() {
return this.retryTimeout;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* List channels and their subscriptions
*
* @param offset The pagination offset, the index of the first subscription that will be returned in this page of results (optional, default to 0)
* @param limit The pagination limit, the total number of subscriptions that will be returned in this page of results (optional, default to 40)
* @return GetChannelsOutputV1
* @throws ApiException if fails to make API call
*/
public GetChannelsOutputV1 getChannels(Integer offset, Integer limit) throws ApiException {
ApiClient.ApiResponse localVarResponse = getChannelsWithHttpInfo(offset, limit);
return localVarResponse != null ? localVarResponse.getData() : null;
}
/**
* List channels and their subscriptions
*
* @param offset The pagination offset, the index of the first subscription that will be returned in this page of results (optional, default to 0)
* @param limit The pagination limit, the total number of subscriptions that will be returned in this page of results (optional, default to 40)
* @throws ApiException if fails to make API call
*/
public ApiClient.ApiResponse getChannelsWithHttpInfo(Integer offset, Integer limit) throws ApiException {
Map localVarHeaderParams = new HashMap();
return getChannelsWithHeadersAndHttpInfo(offset, limit, localVarHeaderParams);
}
/**
* List channels and their subscriptions
*
* @param offset The pagination offset, the index of the first subscription that will be returned in this page of results (optional, default to 0)
* @param limit The pagination limit, the total number of subscriptions that will be returned in this page of results (optional, default to 40)
* @param customHeaders a map with custom headers for the HTTP request (required)
* @throws ApiException if fails to make API call
*/
public ApiClient.ApiResponse getChannelsWithHeadersAndHttpInfo(Integer offset, Integer limit, Map customHeaders) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/subscriptions";
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "offset", offset));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
final String[] localVarAccepts = {
"application/vnd.seeq.v1+json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "api_key" };
localVarHeaderParams.putAll(customHeaders);
long apiClientInvocationTime = System.currentTimeMillis();
while(true) {
try {
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPIWithHttpInfo(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
// Possible exceptions:
// ===================
// * ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or
// during conversion of the response entity data to an instance of a particular Java type).
// * ProcessingException - in case the request processing or subsequent I/O operation fails.
// * WebApplicationException - in case the response status code of the response returned by the server is not
// successful and the specified response type is not Response.
// * ApiException for exceptions wrapped by ApiClient. Most likely all WebApplicationException are wrapped
// in ApiException(s)
} catch (ApiException | ProcessingException e) {
if (e instanceof ProcessingException || e instanceof ApiException && ((ApiException) e).getCode() == 504) {
long elapsedTime = System.currentTimeMillis() - apiClientInvocationTime;
if (elapsedTime <= this.retryTimeout && this.retryTimeout != 0) {
continue;
}
}
throw e;
}
} // while
}
/**
* Subscribe to websocket messages published to the specified channel
*
* @param body Data to create the subscription (required)
* @return StatusMessageBase
* @throws ApiException if fails to make API call
*/
public StatusMessageBase subscribe(SubscriptionInputV1 body) throws ApiException {
ApiClient.ApiResponse localVarResponse = subscribeWithHttpInfo(body);
return localVarResponse != null ? localVarResponse.getData() : null;
}
/**
* Subscribe to websocket messages published to the specified channel
*
* @param body Data to create the subscription (required)
* @throws ApiException if fails to make API call
*/
public ApiClient.ApiResponse subscribeWithHttpInfo(SubscriptionInputV1 body) throws ApiException {
Map localVarHeaderParams = new HashMap();
return subscribeWithHeadersAndHttpInfo(body, localVarHeaderParams);
}
/**
* Subscribe to websocket messages published to the specified channel
*
* @param body Data to create the subscription (required)
* @param customHeaders a map with custom headers for the HTTP request (required)
* @throws ApiException if fails to make API call
*/
public ApiClient.ApiResponse subscribeWithHeadersAndHttpInfo(SubscriptionInputV1 body, Map customHeaders) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling subscribe");
}
// create path and map variables
String localVarPath = "/subscriptions";
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/vnd.seeq.v1+json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/vnd.seeq.v1+json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "api_key" };
localVarHeaderParams.putAll(customHeaders);
long apiClientInvocationTime = System.currentTimeMillis();
while(true) {
try {
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPIWithHttpInfo(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
// Possible exceptions:
// ===================
// * ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or
// during conversion of the response entity data to an instance of a particular Java type).
// * ProcessingException - in case the request processing or subsequent I/O operation fails.
// * WebApplicationException - in case the response status code of the response returned by the server is not
// successful and the specified response type is not Response.
// * ApiException for exceptions wrapped by ApiClient. Most likely all WebApplicationException are wrapped
// in ApiException(s)
} catch (ApiException | ProcessingException e) {
if (e instanceof ProcessingException || e instanceof ApiException && ((ApiException) e).getCode() == 504) {
long elapsedTime = System.currentTimeMillis() - apiClientInvocationTime;
if (elapsedTime <= this.retryTimeout && this.retryTimeout != 0) {
continue;
}
}
throw e;
}
} // while
}
/**
* Unsubscribe from the specified channel
*
* @param channelId URI that identifies the channel to delete (required)
* @return StatusMessageBase
* @throws ApiException if fails to make API call
*/
public StatusMessageBase unsubscribe(String channelId) throws ApiException {
ApiClient.ApiResponse localVarResponse = unsubscribeWithHttpInfo(channelId);
return localVarResponse != null ? localVarResponse.getData() : null;
}
/**
* Unsubscribe from the specified channel
*
* @param channelId URI that identifies the channel to delete (required)
* @throws ApiException if fails to make API call
*/
public ApiClient.ApiResponse unsubscribeWithHttpInfo(String channelId) throws ApiException {
Map localVarHeaderParams = new HashMap();
return unsubscribeWithHeadersAndHttpInfo(channelId, localVarHeaderParams);
}
/**
* Unsubscribe from the specified channel
*
* @param channelId URI that identifies the channel to delete (required)
* @param customHeaders a map with custom headers for the HTTP request (required)
* @throws ApiException if fails to make API call
*/
public ApiClient.ApiResponse unsubscribeWithHeadersAndHttpInfo(String channelId, Map customHeaders) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'channelId' is set
if (channelId == null) {
throw new ApiException(400, "Missing the required parameter 'channelId' when calling unsubscribe");
}
// create path and map variables
String localVarPath = "/subscriptions/{channelId}"
.replaceAll("\\{" + "channelId" + "\\}", apiClient.escapeString(channelId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/vnd.seeq.v1+json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "api_key" };
localVarHeaderParams.putAll(customHeaders);
long apiClientInvocationTime = System.currentTimeMillis();
while(true) {
try {
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPIWithHttpInfo(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
// Possible exceptions:
// ===================
// * ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or
// during conversion of the response entity data to an instance of a particular Java type).
// * ProcessingException - in case the request processing or subsequent I/O operation fails.
// * WebApplicationException - in case the response status code of the response returned by the server is not
// successful and the specified response type is not Response.
// * ApiException for exceptions wrapped by ApiClient. Most likely all WebApplicationException are wrapped
// in ApiException(s)
} catch (ApiException | ProcessingException e) {
if (e instanceof ProcessingException || e instanceof ApiException && ((ApiException) e).getCode() == 504) {
long elapsedTime = System.currentTimeMillis() - apiClientInvocationTime;
if (elapsedTime <= this.retryTimeout && this.retryTimeout != 0) {
continue;
}
}
throw e;
}
} // while
}
/**
* Update a subscription associated with the specified channel
*
* @param channelId URI that identifies the channel the subscriber is updating (required)
* @param body Data to update the subscription (required)
* @return StatusMessageBase
* @throws ApiException if fails to make API call
*/
public StatusMessageBase updateSubscription(String channelId, SubscriptionUpdateInputV1 body) throws ApiException {
ApiClient.ApiResponse localVarResponse = updateSubscriptionWithHttpInfo(channelId, body);
return localVarResponse != null ? localVarResponse.getData() : null;
}
/**
* Update a subscription associated with the specified channel
*
* @param channelId URI that identifies the channel the subscriber is updating (required)
* @param body Data to update the subscription (required)
* @throws ApiException if fails to make API call
*/
public ApiClient.ApiResponse updateSubscriptionWithHttpInfo(String channelId, SubscriptionUpdateInputV1 body) throws ApiException {
Map localVarHeaderParams = new HashMap();
return updateSubscriptionWithHeadersAndHttpInfo(channelId, body, localVarHeaderParams);
}
/**
* Update a subscription associated with the specified channel
*
* @param channelId URI that identifies the channel the subscriber is updating (required)
* @param body Data to update the subscription (required)
* @param customHeaders a map with custom headers for the HTTP request (required)
* @throws ApiException if fails to make API call
*/
public ApiClient.ApiResponse updateSubscriptionWithHeadersAndHttpInfo(String channelId, SubscriptionUpdateInputV1 body, Map customHeaders) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'channelId' is set
if (channelId == null) {
throw new ApiException(400, "Missing the required parameter 'channelId' when calling updateSubscription");
}
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling updateSubscription");
}
// create path and map variables
String localVarPath = "/subscriptions/{channelId}"
.replaceAll("\\{" + "channelId" + "\\}", apiClient.escapeString(channelId.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
final String[] localVarAccepts = {
"application/vnd.seeq.v1+json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/vnd.seeq.v1+json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "api_key" };
localVarHeaderParams.putAll(customHeaders);
long apiClientInvocationTime = System.currentTimeMillis();
while(true) {
try {
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPIWithHttpInfo(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
// Possible exceptions:
// ===================
// * ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or
// during conversion of the response entity data to an instance of a particular Java type).
// * ProcessingException - in case the request processing or subsequent I/O operation fails.
// * WebApplicationException - in case the response status code of the response returned by the server is not
// successful and the specified response type is not Response.
// * ApiException for exceptions wrapped by ApiClient. Most likely all WebApplicationException are wrapped
// in ApiException(s)
} catch (ApiException | ProcessingException e) {
if (e instanceof ProcessingException || e instanceof ApiException && ((ApiException) e).getCode() == 504) {
long elapsedTime = System.currentTimeMillis() - apiClientInvocationTime;
if (elapsedTime <= this.retryTimeout && this.retryTimeout != 0) {
continue;
}
}
throw e;
}
} // while
}
}