use of com.github.davidmoten.odata.client.StreamUploaderSingleCall in project odata-client by davidmoten.
the class RequestHelper method uploader.
public static Optional<StreamUploaderSingleCall> uploader(ContextPath contextPath, ODataType item, String fieldName, HttpMethod method) {
Preconditions.checkNotNull(fieldName);
String editLink = (String) item.getUnmappedFields().get(fieldName + "@odata.mediaEditLink");
String contentType = (String) item.getUnmappedFields().get(fieldName + "@odata.mediaContentType");
if (editLink == null) {
return Optional.empty();
} else {
// TODO support relative editLink?
Context context = contextPath.context();
if (contentType == null) {
contentType = CONTENT_TYPE_APPLICATION_OCTET_STREAM;
}
Path path = new Path(editLink, contextPath.path().style());
return Optional.of(new StreamUploaderSingleCall(new ContextPath(context, path), contentType, method));
}
}
Aggregations