Skip to content

Commit 0c12bc9

Browse files
Merge remote-tracking branch 'origin/master' into release
2 parents c6b28c2 + e8797ef commit 0c12bc9

File tree

738 files changed

+99247
-24
lines changed

Some content is hidden

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

738 files changed

+99247
-24
lines changed

README.md

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Feel free to explore the [Developer's Guide](https://docs.aspose.cloud/display/w
1616
- Add & remove watermarks and protection.
1717
- Read & write access to Document Object Model.
1818

19+
## Enhancements in Version 21.11
20+
21+
22+
1923
## Enhancements in Version 21.10
2024

2125
- Removed 'GraphicsQualityOptions' image save option as it no longer supported.
@@ -204,27 +208,35 @@ Config.json file:
204208
Go code:
205209

206210
```
207-
// Start README example
208-
209-
// init words cloud api
210-
config, _ := models.NewConfiguration(configFilePath)
211-
wordsApi, ctx, _ := api.CreateWordsApi(config)
212-
213-
// upload test.docx to a cloud
214-
// remote.docx is a name in the cloud
215-
file, _ := os.Open(localFilePath)
216-
wordsApi.UploadFile(ctx, file, remotePath, nil)
217-
218-
// get a text for the first paragraph of the first section
219-
options := map[string]interface{}{
220-
"folder": remoteFolder,
221-
}
222-
223-
result, _, _ := wordsApi.GetParagraphs(ctx, remoteName, options)
224-
225-
fmt.Println(result.Paragraphs.ParagraphLinkList[0].Text)
226-
227-
// End README example
211+
// Start README example
212+
213+
// init words cloud api
214+
config, _ := models.NewConfiguration(configFilePath)
215+
wordsApi, ctx, _ := api.CreateWordsApi(config)
216+
217+
// upload test.docx to a cloud
218+
// remote.docx is a name in the cloud
219+
file, _ := os.Open(localFilePath)
220+
uploadRequest := &models.UploadFileRequest{
221+
FileContent: file,
222+
Path: &remotePath,
223+
}
224+
wordsApi.UploadFile(ctx, uploadRequest)
225+
226+
// get a text for the first paragraph of the first section
227+
options := map[string]interface{}{
228+
"folder": remoteFolder,
229+
}
230+
request := &models.GetParagraphsRequest{
231+
Name: &remoteName,
232+
Optionals: options,
233+
}
234+
235+
result, _, _ := wordsApi.GetParagraphs(ctx, request)
236+
237+
fmt.Println(result.Paragraphs.ParagraphLinkList[0].Text)
238+
239+
// End README example
228240
```
229241

230242
[Product Page](https://products.aspose.cloud/words/go) | [Documentation](https://docs.aspose.cloud/display/wordscloud/Home) | [API Reference](https://apireference.aspose.cloud/words/) | [Code Samples](https://github.com/aspose-words-cloud/aspose-words-cloud-go) | [Blog](https://blog.aspose.cloud/category/words/) | [Free Support](https://forum.aspose.cloud/c/words) | [Free Trial](https://dashboard.aspose.cloud/#/apps)

dev/api/api_client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ var (
6565
xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)")
6666
)
6767

68-
// APIClient manages communication with the Aspose.Words for Cloud API Reference API v21.10
68+
// APIClient manages communication with the Aspose.Words for Cloud API Reference API v21.11
6969
// In most cases there should be only one, shared, APIClient.
7070
type APIClient struct {
7171
cfg *models.Configuration

dev/api/models/configuration.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func NewConfiguration(configFilePath string) (pConfig *Configuration, err error)
9494
cfg := Configuration{
9595
BaseUrl: "https://api.aspose.cloud",
9696
DebugMode: false,
97-
DefaultHeader: map[string]string{"x-aspose-client": "go sdk", "x-aspose-client-version": "21.10"},
97+
DefaultHeader: map[string]string{"x-aspose-client": "go sdk", "x-aspose-client-version": "21.11"},
9898
}
9999
err = json.Unmarshal(data, &cfg)
100100

dev/api/words_api.go

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14802,11 +14802,27 @@ func (a *WordsApiService) UploadFile(ctx context.Context, data *models.UploadFil
1480214802
}
1480314803

1480414804

14805+
/* WordsApiService Batch request.
14806+
* @param ctx context.Context for authentication, logging, tracing, etc.
14807+
* @requests to be called as one call.
14808+
@return array of results */
1480514809
/* WordsApiService Batch request.
1480614810
* @param ctx context.Context for authentication, logging, tracing, etc.
1480714811
* @requests to be called as one call.
1480814812
@return array of results */
1480914813
func (a *WordsApiService) Batch(ctx context.Context, requests ...models.BatchPartRequest) ([]interface{}, *http.Response, error) {
14814+
return a.batch(ctx, false, requests)
14815+
}
14816+
14817+
/* WordsApiService Batch request without intermediate results.
14818+
* @param ctx context.Context for authentication, logging, tracing, etc.
14819+
* @requests to be called as one call.
14820+
@return array with one element (a result of last executed request). */
14821+
func (a *WordsApiService) BatchWithoutIntermidiateResults(ctx context.Context, requests ...models.BatchPartRequest) ([]interface{}, *http.Response, error) {
14822+
return a.batch(ctx, true, requests)
14823+
}
14824+
14825+
func (a *WordsApiService) batch(ctx context.Context, withoutIntermediateResults bool, requests []models.BatchPartRequest) ([]interface{}, *http.Response, error) {
1481014826

1481114827
if requests == nil || len(requests) == 0 {
1481214828
return nil, nil, errors.New("The Batch method requires one or more requests.")
@@ -14880,7 +14896,12 @@ func (a *WordsApiService) Batch(ctx context.Context, requests ...models.BatchPar
1488014896
writer.Close()
1488114897
}()
1488214898

14883-
request, err := http.NewRequest("PUT", a.client.cfg.BaseUrl+"/words/batch", reader)
14899+
url := a.client.cfg.BaseUrl+"/words/batch"
14900+
if withoutIntermediateResults {
14901+
url = url + "?displayIntermediateResults=false"
14902+
}
14903+
14904+
request, err := http.NewRequest("PUT", url, reader)
1488414905
if err != nil {
1488514906
return nil, nil, err
1488614907
}

dev/tests/batch_test.go

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,74 @@ func Test_BatchRequest(t *testing.T) {
109109
assert.Equal(t, "Reader", reflect.TypeOf(actual[4]).Elem().Name(), "Validate BuildReportOnline response.")
110110
}
111111

112+
func Test_BatchRequestWithoutIntermediateResults(t *testing.T) {
113+
config := ReadConfiguration(t)
114+
client, ctx := PrepareTest(t, config)
115+
116+
remoteDataFolder := remoteBaseTestDataFolder + "/DocumentElements/Paragraphs"
117+
localFile := "Common/test_multi_pages.docx"
118+
reportingFolder := "DocumentActions/Reporting"
119+
remoteFileName := "TestGetDocumentParagraphByIndex.docx"
120+
121+
localDocumentFile := "ReportTemplate.docx"
122+
localDataFile := reportingFolder + "/ReportData.json"
123+
124+
UploadNextFileToStorage(t, ctx, client, GetLocalFile(localFile), remoteDataFolder+"/"+remoteFileName)
125+
126+
options := map[string]interface{}{
127+
"nodePath": "sections/0",
128+
"folder": remoteDataFolder,
129+
}
130+
131+
request1 := *models.NewBatchPartRequest(&models.GetParagraphsRequest{
132+
Name: ToStringPointer(remoteFileName),
133+
Optionals: options,
134+
})
135+
136+
request2 := *models.NewBatchPartRequest(&models.GetParagraphRequest{
137+
Name: ToStringPointer(remoteFileName),
138+
Index: ToInt32Pointer(0),
139+
Optionals: options,
140+
})
141+
142+
request3 := *models.NewBatchPartRequest(&models.InsertParagraphRequest{
143+
Name: ToStringPointer(remoteFileName),
144+
Paragraph: models.ParagraphInsert{
145+
Text: ToStringPointer("This is a new paragraph for your document"),
146+
},
147+
Optionals: options,
148+
})
149+
150+
request4 := *models.NewBatchPartRequest(&models.DeleteParagraphRequest{
151+
Name: ToStringPointer(remoteFileName),
152+
Index: ToInt32Pointer(0),
153+
Optionals: map[string]interface{}{
154+
"nodePath": "",
155+
"folder": remoteDataFolder,
156+
},
157+
})
158+
159+
templateFile, err := os.Open(GetLocalFile(reportingFolder + "/" + localDocumentFile))
160+
if err != nil {
161+
t.Error(err)
162+
}
163+
164+
request5 := *models.NewBatchPartRequest(&models.BuildReportOnlineRequest{
165+
Template: templateFile,
166+
Data: ToStringPointer(ReadFile(t, localDataFile)),
167+
ReportEngineSettings: models.ReportEngineSettings{
168+
DataSourceType: ToStringPointer("Json"),
169+
DataSourceName: ToStringPointer("persons"),
170+
},
171+
})
172+
173+
actual, _, err := client.WordsApi.BatchWithoutIntermidiateResults(ctx, request1, request2, request3, request4, request5)
174+
175+
assert.Nil(t, err, err)
176+
assert.True(t, len(actual) == 1)
177+
assert.Equal(t, "Reader", reflect.TypeOf(actual[0]).Elem().Name(), "Validate BuildReportOnline response.")
178+
}
179+
112180
func Test_Batch_With_Reversed_Order(t *testing.T) {
113181
config := ReadConfiguration(t)
114182
client, ctx := PrepareTest(t, config)

v2111/.vscode/launch.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Launch",
9+
"type": "go",
10+
"request": "launch",
11+
"mode": "auto",
12+
"program": "${fileDirname}",
13+
"env": {},
14+
"args": []
15+
}
16+
]
17+
}

v2111/LICENSE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2020 Aspose
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)