Skip to content

Commit 6801ea0

Browse files
Merge branch 'master' into release
2 parents 5e7ed32 + ca5c0df commit 6801ea0

File tree

593 files changed

+4039
-3917
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

593 files changed

+4039
-3917
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ This repository contains Aspose.Words Cloud SDK for Java source code. This SDK a
1313
* Watermarks and protection
1414
* Full read & write access to Document Object Model, including sections, paragraphs, text, images, tables, headers/footers and many others
1515

16+
## Enhancements in Version 22.10
17+
18+
- Added 'CacheHeaderFooterShapes' property for PdfSaveOptionsData class.
19+
- FileReference structure has been added that allows to determine how the document will be accessed: from the remote storage, or loaded directly in the request.
20+
- The 'AppendDocument' and 'AppendDocumentOnline' methods takes a 'FileReference' instead of an 'href' property.
21+
- Added property 'StartingNumber' for 'PageNumbers' class.
22+
- Added property 'GlobalCultureName' for 'FieldOptions' class.
23+
24+
1625
## Enhancements in Version 22.9
1726

1827
- CompressDocument method now can handle images.
@@ -242,7 +251,7 @@ Add this dependency to your project's POM:
242251
<dependency>
243252
<groupId>com.aspose</groupId>
244253
<artifactId>aspose-words-cloud</artifactId>
245-
<version>22.9.0</version>
254+
<version>22.10.0</version>
246255
</dependency>
247256
</dependencies>
248257
```

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<artifactId>aspose-words-cloud</artifactId>
55
<packaging>jar</packaging>
66
<name>AsposeWordsCloud</name>
7-
<version>22.9.0</version>
7+
<version>22.10.0</version>
88
<url>https://www.aspose.cloud/</url>
99
<description>Aspose Words Java SDK</description>
1010
<scm>

src/main/java/com/aspose/words/cloud/ApiClient.java

Lines changed: 55 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
package com.aspose.words.cloud;
2929

30+
import com.aspose.words.cloud.model.*;
3031
import com.aspose.words.cloud.model.requests.*;
3132
import com.squareup.okhttp.*;
3233
import com.squareup.okhttp.internal.http.HttpMethod;
@@ -58,7 +59,7 @@ public class ApiClient {
5859
private String apiVersion = "v4.0";
5960
private String baseUrl = "https://api.aspose.cloud";
6061
private String basePath = baseUrl + "/" + apiVersion;
61-
private String clientVersion = "22.9";
62+
private String clientVersion = "22.10";
6263
private boolean debugging = false;
6364
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
6465
private String tempFolderPath = null;
@@ -686,27 +687,24 @@ else if (returnType.equals(String.class)) {
686687
* class and the request Content-Type.
687688
*
688689
* @param obj The Java object
689-
* @param contentType The request Content-Type
690690
* @return The serialized request body
691691
* @throws ApiException If fail to serialize the given object
692692
*/
693-
public RequestBody serialize(Object obj, String contentType) throws ApiException {
694-
if (obj instanceof byte[]) {
695-
// Binary (byte array) body parameter support.
696-
return RequestBody.create(MediaType.parse(contentType), (byte[]) obj);
697-
}
698-
else if (isJsonMime(contentType)) {
699-
String content;
700-
if (obj != null) {
701-
content = json.serialize(obj);
702-
}
703-
else {
704-
content = null;
705-
}
706-
return RequestBody.create(MediaType.parse(contentType), content);
707-
}
693+
public RequestBody serialize(Object obj) throws ApiException {
694+
if (obj instanceof RequestBody) {
695+
return (RequestBody) obj;
696+
}
697+
else if (obj instanceof byte[]) {
698+
return RequestBody.create(MediaType.parse("application/octet-stream"), (byte[]) obj);
699+
}
700+
else if (obj instanceof ModelIfc) {
701+
return RequestBody.create(MediaType.parse("application/json"), json.serialize(obj));
702+
}
703+
else if (obj instanceof String) {
704+
return RequestBody.create(MediaType.parse("text/plain"), (String) obj);
705+
}
708706
else {
709-
throw new ApiException("Content type \"" + contentType + "\" is not supported");
707+
throw new ApiException("Unsupported object type to serialize.");
710708
}
711709
}
712710

@@ -812,54 +810,46 @@ public Call buildCall(Request request) {
812810
* @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE"
813811
* @param queryParams The query parameters
814812
* @param collectionQueryParams The collection query parameters
815-
* @param body The request body object
816813
* @param headerParams The header parameters
817814
* @param formParams The form parameters
815+
* @param filesContentParams The file content parameters
818816
* @param addAuthHeaders The authentications to apply
819817
* @param progressRequestListener Progress request listener
820818
* @return The HTTP request
821819
* @throws ApiException If fail to serialize the request body object
822820
* @throws IOException If fail to serialize the request body object
823821
*/
824-
public Request buildRequest(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, Boolean addAuthHeaders, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException, IOException {
822+
public Request buildRequest(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Map<String, String> headerParams, Map<String, Object> formParams, List<FileReference> filesContentParams, Boolean addAuthHeaders, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException, IOException {
825823
if (addAuthHeaders) {
826824
addOAuthAuthentication(headerParams);
827825
}
828826

829-
String contentType = (String) headerParams.get("Content-Type");
830-
// ensuring a default content type
831-
if (contentType == null) {
832-
contentType = "application/json";
833-
}
827+
RequestBody reqBody = null;
828+
if (HttpMethod.permitsRequestBody(method)) {
829+
String contentType = headerParams.get("Content-Type");
830+
int partsCount = formParams.size() + filesContentParams.size();
831+
if ("application/x-www-form-urlencoded".equals(contentType)) {
832+
reqBody = buildRequestBodyFormEncoding(formParams);
833+
}
834+
else if (partsCount == 0) {
835+
if (!"DELETE".equals(method)) {
836+
reqBody = RequestBody.create(MediaType.parse("none"), "");
837+
}
838+
}
839+
else if (partsCount == 1) {
840+
Object part = formParams.values().toArray()[0];
841+
if (part != null) {
842+
reqBody = serialize(part);
843+
}
844+
}
845+
else if (partsCount > 1) {
846+
String boundary = UUID.randomUUID().toString();
847+
reqBody = buildRequestBodyMultipart(formParams, filesContentParams, boundary);
848+
}
834849

835-
RequestBody reqBody;
836-
if (!HttpMethod.permitsRequestBody(method)) {
837-
reqBody = null;
838-
}
839-
else if (body instanceof RequestBody) {
840-
reqBody = (RequestBody) body;
841-
}
842-
else if ("application/x-www-form-urlencoded".equals(contentType)) {
843-
reqBody = buildRequestBodyFormEncoding(formParams);
844-
}
845-
else if ("multipart/form-data".equals(contentType)) {
846-
String boundary = UUID.randomUUID().toString();
847-
contentType += "; boundary=" + boundary;
848-
headerParams.put("Content-Type", contentType);
849-
reqBody = buildRequestBodyMultipart(formParams, boundary);
850-
}
851-
else if (body == null) {
852-
if ("DELETE".equals(method)) {
853-
// allow calling DELETE without sending a request body
854-
reqBody = null;
855-
}
856-
else {
857-
// use an empty request body (for POST, PUT and PATCH)
858-
reqBody = RequestBody.create(MediaType.parse(contentType), "");
850+
if (reqBody != null && reqBody.contentType() != null && !headerParams.containsKey("Content-Type")) {
851+
headerParams.put("Content-Type", reqBody.contentType().toString());
859852
}
860-
}
861-
else {
862-
reqBody = serialize(body, contentType);
863853
}
864854

865855
final String url = buildUrl(path, queryParams, collectionQueryParams);
@@ -967,27 +957,26 @@ public RequestBody buildRequestBodyFormEncoding(Map<String, Object> formParams)
967957
* which could contain text fields and file fields.
968958
*
969959
* @param formParams Form parameters in the form of Map
960+
* @param fileParams Form parameters of additional files
961+
* @param boundary Boundary string
970962
* @throws IOException If fail to serialize the request body object
963+
* @throws ApiException If fail to serialize the request body object
971964
* @return RequestBody
972965
*/
973-
public RequestBody buildRequestBodyMultipart(Map<String, Object> formParams, String boundary) throws IOException {
966+
public RequestBody buildRequestBodyMultipart(Map<String, Object> formParams, List<FileReference> fileParams, String boundary) throws IOException, ApiException {
974967
MultipartBuilder mpBuilder = new MultipartBuilder(boundary).type(MultipartBuilder.FORM);
975968
if (formParams.isEmpty()) {
976969
Headers partHeaders = Headers.of("Content-Disposition", "form-data");
977970
mpBuilder.addPart(partHeaders, RequestBody.create(MediaType.parse("none"), new byte[] {}));
978971
}
979972
else {
980973
for (Entry<String, Object> param : formParams.entrySet()) {
981-
if (param.getValue() instanceof byte[]) {
982-
byte[] file = (byte[]) param.getValue();
983-
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + param.getKey() + "\"");
984-
MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
985-
mpBuilder.addPart(partHeaders, RequestBody.create(mediaType, file));
986-
}
987-
else {
988-
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"");
989-
mpBuilder.addPart(partHeaders, RequestBody.create(null, parameterToString(param.getValue())));
990-
}
974+
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"");
975+
mpBuilder.addPart(partHeaders, serialize(param.getValue()));
976+
}
977+
for (FileReference param : fileParams) {
978+
Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getReference() + "\"");
979+
mpBuilder.addPart(partHeaders, RequestBody.create(MediaType.parse("application/octet-stream"), param.getContent()));
991980
}
992981
}
993982
return mpBuilder.build();
@@ -1078,14 +1067,15 @@ public Request buildBatchRequest(BatchPartRequest[] requests, Boolean displayInt
10781067

10791068
RequestBody requestBody = builder.build();
10801069
Map<String, String> headers = new HashMap<>();
1081-
headers.put("Content-Type", requestBody.contentType().toString());
1070+
Map<String, Object> formData = new HashMap<>();
1071+
formData.put("Body", requestBody);
10821072

10831073
String url = "/words/batch";
10841074
if (!displayIntermediateResults) {
10851075
url += "?displayIntermediateResults=false";
10861076
}
10871077

1088-
return buildRequest(url, "PUT", new ArrayList<>(), new ArrayList<>(), requestBody, headers, new HashMap<>(), true, null);
1078+
return buildRequest(url, "PUT", new ArrayList<>(), new ArrayList<>(), headers, formData, new ArrayList<>(), true, null);
10891079
}
10901080

10911081
/**

src/main/java/com/aspose/words/cloud/model/ApiError.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
* Api error.
4747
*/
4848
@ApiModel(description = "Api error.")
49-
public class ApiError {
49+
public class ApiError implements ModelIfc {
5050
@SerializedName("Code")
5151
protected String code;
5252

@@ -164,6 +164,15 @@ public ApiError() {
164164
this.message = null;
165165
}
166166

167+
/*
168+
* Gets files content.
169+
*
170+
* @param resultFilesContent List<FileReference> instance.
171+
*/
172+
@Override
173+
public void getFilesContent(List<FileReference> resultFilesContent) {
174+
}
175+
167176
@Override
168177
public boolean equals(java.lang.Object o) {
169178
if (this == o) {

src/main/java/com/aspose/words/cloud/model/AvailableFontsResponse.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,15 @@ public AvailableFontsResponse() {
146146
this.systemFonts = null;
147147
}
148148

149+
/*
150+
* Gets files content.
151+
*
152+
* @param resultFilesContent List<FileReference> instance.
153+
*/
154+
@Override
155+
public void getFilesContent(List<FileReference> resultFilesContent) {
156+
}
157+
149158
@Override
150159
public boolean equals(java.lang.Object o) {
151160
if (this == o) {

src/main/java/com/aspose/words/cloud/model/BaseEntry.java

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,33 +43,46 @@
4343
import io.swagger.annotations.ApiModelProperty;
4444

4545
/**
46-
* Represents a entry which will be appended to the original resource document.
46+
* Represents a base class for document which will be appended to the original resource document.
4747
*/
48-
@ApiModel(description = "Represents a entry which will be appended to the original resource document.")
49-
public class BaseEntry {
50-
@SerializedName("Href")
51-
protected String href;
48+
@ApiModel(description = "Represents a base class for document which will be appended to the original resource document.")
49+
public abstract class BaseEntry implements ModelIfc {
50+
@SerializedName("FileReference")
51+
protected FileReference fileReference;
5252
/**
53-
* Gets or sets the path to entry to append at the server.
54-
* @return href
53+
* Gets or sets the file reference.
54+
* @return fileReference
5555
**/
56-
@ApiModelProperty(value = "Gets or sets the path to entry to append at the server.")
57-
public String getHref() {
58-
return href;
56+
@ApiModelProperty(value = "Gets or sets the file reference.")
57+
public FileReference getFileReference() {
58+
return fileReference;
5959
}
6060

61-
public BaseEntry href(String href) {
62-
this.href = href;
61+
public BaseEntry fileReference(FileReference fileReference) {
62+
this.fileReference = fileReference;
6363
return this;
6464
}
6565

66-
public void setHref(String href) {
67-
this.href = href;
66+
public void setFileReference(FileReference fileReference) {
67+
this.fileReference = fileReference;
6868
}
6969

7070

7171
public BaseEntry() {
72-
this.href = null;
72+
this.fileReference = null;
73+
}
74+
75+
/*
76+
* Gets files content.
77+
*
78+
* @param resultFilesContent List<FileReference> instance.
79+
*/
80+
@Override
81+
public void getFilesContent(List<FileReference> resultFilesContent) {
82+
if (this.fileReference != null) {
83+
this.fileReference.getFilesContent(resultFilesContent);
84+
}
85+
7386
}
7487

7588
@Override
@@ -83,19 +96,19 @@ public boolean equals(java.lang.Object o) {
8396

8497
BaseEntry baseEntry = (BaseEntry) o;
8598
return
86-
Objects.equals(this.href, baseEntry.href);
99+
Objects.equals(this.fileReference, baseEntry.fileReference);
87100
}
88101

89102
@Override
90103
public int hashCode() {
91-
return Objects.hash(href);
104+
return Objects.hash(fileReference);
92105
}
93106

94107
@Override
95108
public String toString() {
96109
StringBuilder sb = new StringBuilder();
97110
sb.append("class BaseEntry {\n");
98-
sb.append(" href: ").append(toIndentedString(getHref())).append("\n");
111+
sb.append(" fileReference: ").append(toIndentedString(getFileReference())).append("\n");
99112
sb.append("}");
100113
return sb.toString();
101114
}

src/main/java/com/aspose/words/cloud/model/BaseEntryList.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,20 @@
4646
* Represents a list of entries which will be appended to the original resource entry.
4747
*/
4848
@ApiModel(description = "Represents a list of entries which will be appended to the original resource entry.")
49-
public abstract class BaseEntryList {
49+
public abstract class BaseEntryList implements ModelIfc {
5050

5151
public BaseEntryList() {
5252
}
5353

54+
/*
55+
* Gets files content.
56+
*
57+
* @param resultFilesContent List<FileReference> instance.
58+
*/
59+
@Override
60+
public void getFilesContent(List<FileReference> resultFilesContent) {
61+
}
62+
5463
@Override
5564
public boolean equals(java.lang.Object o) {
5665
if (this == o) {

0 commit comments

Comments
 (0)