org.symphonyoss.symphony.agent.api.AttachmentsApi Maven / Gradle / Ivy
The newest version!
package org.symphonyoss.symphony.agent.api;
import org.symphonyoss.symphony.agent.invoker.ApiException;
import org.symphonyoss.symphony.agent.invoker.ApiClient;
import org.symphonyoss.symphony.agent.invoker.Configuration;
import org.symphonyoss.symphony.agent.invoker.Pair;
import javax.ws.rs.core.GenericType;
import org.symphonyoss.symphony.agent.model.AttachmentInfo;
import org.symphonyoss.symphony.agent.model.Error;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2018-03-13T13:44:51.568-04:00")
public class AttachmentsApi {
private ApiClient apiClient;
public AttachmentsApi() {
this(Configuration.getDefaultApiClient());
}
public AttachmentsApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Upload an attachment.
* Upload an attachment to the given stream. The stream can be a chatroom, an IM or a multiparty IM. Once uploaded, you can use this attachment on a message you send in that stream. If the attachment is uploaded then 200 is returned.
* @param sid Stream ID (required)
* @param sessionToken Session authentication token. (required)
* @param keyManagerToken Key Manager authentication token. (required)
* @param file The attachment body. (required)
* @return AttachmentInfo
* @throws ApiException if fails to make API call
*/
public AttachmentInfo v1StreamSidAttachmentCreatePost(String sid, String sessionToken, String keyManagerToken, File file) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'sid' is set
if (sid == null) {
throw new ApiException(400, "Missing the required parameter 'sid' when calling v1StreamSidAttachmentCreatePost");
}
// verify the required parameter 'sessionToken' is set
if (sessionToken == null) {
throw new ApiException(400, "Missing the required parameter 'sessionToken' when calling v1StreamSidAttachmentCreatePost");
}
// verify the required parameter 'keyManagerToken' is set
if (keyManagerToken == null) {
throw new ApiException(400, "Missing the required parameter 'keyManagerToken' when calling v1StreamSidAttachmentCreatePost");
}
// verify the required parameter 'file' is set
if (file == null) {
throw new ApiException(400, "Missing the required parameter 'file' when calling v1StreamSidAttachmentCreatePost");
}
// create path and map variables
String localVarPath = "/v1/stream/{sid}/attachment/create"
.replaceAll("\\{" + "sid" + "\\}", apiClient.escapeString(sid.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
if (sessionToken != null)
localVarHeaderParams.put("sessionToken", apiClient.parameterToString(sessionToken));
if (keyManagerToken != null)
localVarHeaderParams.put("keyManagerToken", apiClient.parameterToString(keyManagerToken));
if (file != null)
localVarFormParams.put("file", file);
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"multipart/form-data"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Download an attachment.
* Downloads the attachment body by the attachment ID, stream ID, and message ID.
* @param sid Stream ID (required)
* @param fileId The attachment ID (Base64-encoded) (required)
* @param messageId The ID of the message containing the attachment (required)
* @param sessionToken Session authentication token. (required)
* @param keyManagerToken Key Manager authentication token. (required)
* @return byte[]
* @throws ApiException if fails to make API call
*/
public byte[] v1StreamSidAttachmentGet(String sid, String fileId, String messageId, String sessionToken, String keyManagerToken) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'sid' is set
if (sid == null) {
throw new ApiException(400, "Missing the required parameter 'sid' when calling v1StreamSidAttachmentGet");
}
// verify the required parameter 'fileId' is set
if (fileId == null) {
throw new ApiException(400, "Missing the required parameter 'fileId' when calling v1StreamSidAttachmentGet");
}
// verify the required parameter 'messageId' is set
if (messageId == null) {
throw new ApiException(400, "Missing the required parameter 'messageId' when calling v1StreamSidAttachmentGet");
}
// verify the required parameter 'sessionToken' is set
if (sessionToken == null) {
throw new ApiException(400, "Missing the required parameter 'sessionToken' when calling v1StreamSidAttachmentGet");
}
// verify the required parameter 'keyManagerToken' is set
if (keyManagerToken == null) {
throw new ApiException(400, "Missing the required parameter 'keyManagerToken' when calling v1StreamSidAttachmentGet");
}
// create path and map variables
String localVarPath = "/v1/stream/{sid}/attachment"
.replaceAll("\\{" + "sid" + "\\}", apiClient.escapeString(sid.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "fileId", fileId));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "messageId", messageId));
if (sessionToken != null)
localVarHeaderParams.put("sessionToken", apiClient.parameterToString(sessionToken));
if (keyManagerToken != null)
localVarHeaderParams.put("keyManagerToken", apiClient.parameterToString(keyManagerToken));
final String[] localVarAccepts = {
"application/octet-stream"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* PROVISIONAL - Upload an attachment.
* Upload an attachment to the given stream. The stream can be a chatroom, an IM or a multiparty IM. Once uploaded, you can use this attachment on a message you send in that stream. If the attachment is uploaded then 200 is returned.
* @param sid Stream ID (required)
* @param sessionToken Session authentication token. (required)
* @param file The attachment body. (required)
* @param keyManagerToken Key Manager authentication token. (optional)
* @return AttachmentInfo
* @throws ApiException if fails to make API call
*/
public AttachmentInfo v3StreamSidAttachmentCreatePost(String sid, String sessionToken, File file, String keyManagerToken) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'sid' is set
if (sid == null) {
throw new ApiException(400, "Missing the required parameter 'sid' when calling v3StreamSidAttachmentCreatePost");
}
// verify the required parameter 'sessionToken' is set
if (sessionToken == null) {
throw new ApiException(400, "Missing the required parameter 'sessionToken' when calling v3StreamSidAttachmentCreatePost");
}
// verify the required parameter 'file' is set
if (file == null) {
throw new ApiException(400, "Missing the required parameter 'file' when calling v3StreamSidAttachmentCreatePost");
}
// create path and map variables
String localVarPath = "/v3/stream/{sid}/attachment/create"
.replaceAll("\\{" + "sid" + "\\}", apiClient.escapeString(sid.toString()));
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarFormParams = new HashMap();
if (sessionToken != null)
localVarHeaderParams.put("sessionToken", apiClient.parameterToString(sessionToken));
if (keyManagerToken != null)
localVarHeaderParams.put("keyManagerToken", apiClient.parameterToString(keyManagerToken));
if (file != null)
localVarFormParams.put("file", file);
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"multipart/form-data"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
GenericType localVarReturnType = new GenericType() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
}