Skip to content

Commit 7d125b5

Browse files
Merge remote-tracking branch 'origin/master' into release
2 parents 0c12bc9 + f11ba74 commit 7d125b5

File tree

763 files changed

+100369
-37
lines changed

Some content is hidden

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

763 files changed

+100369
-37
lines changed

README.md

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ 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.12
20+
21+
- Added FieldOptions parameter to mail merge operations
22+
- Added timeout parameter to api configuration
23+
24+
1925
## Enhancements in Version 21.11
2026

2127

@@ -208,35 +214,27 @@ Config.json file:
208214
Go code:
209215

210216
```
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
217+
// Start README example
218+
219+
// init words cloud api
220+
config, _ := models.NewConfiguration(configFilePath)
221+
wordsApi, ctx, _ := api.CreateWordsApi(config)
222+
223+
// upload test.docx to a cloud
224+
// remote.docx is a name in the cloud
225+
file, _ := os.Open(localFilePath)
226+
wordsApi.UploadFile(ctx, file, remotePath, nil)
227+
228+
// get a text for the first paragraph of the first section
229+
options := map[string]interface{}{
230+
"folder": remoteFolder,
231+
}
232+
233+
result, _, _ := wordsApi.GetParagraphs(ctx, remoteName, options)
234+
235+
fmt.Println(result.Paragraphs.ParagraphLinkList[0].Text)
236+
237+
// End README example
240238
```
241239

242240
[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)

Scripts/RunTestsStandalone.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
cd dev
22
go get -u github.com/jstemmer/go-junit-report
3-
go test ./tests/... -v -timeout 20m 2>&1 | go-junit-report > ../testReport.xml
3+
go test ./tests/... -v -timeout 1h 2>&1 | go-junit-report > ../testReport.xml

dev/api/api_client.go

Lines changed: 5 additions & 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.11
68+
// APIClient manages communication with the Aspose.Words for Cloud API Reference API v21.12
6969
// In most cases there should be only one, shared, APIClient.
7070
type APIClient struct {
7171
cfg *models.Configuration
@@ -90,6 +90,10 @@ func NewAPIClient(cfg *models.Configuration) (client *APIClient, err error) {
9090
return nil, errors.New("ClientId must be non-empty string")
9191
}
9292

93+
if cfg.Timeout == 0 {
94+
cfg.HttpClient.Timeout = cfg.Timeout
95+
}
96+
9397
if cfg.ClientSecret == "" {
9498
return nil, errors.New("ClientSecret must be non-empty string")
9599
}

dev/api/models/configuration.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
"net/http"
3434
"net/url"
3535
"path"
36+
"time"
3637
)
3738

3839
// contextKeys are used to identify the type of value in the context.
@@ -81,6 +82,7 @@ type Configuration struct {
8182
DebugMode bool `json:"DebugMode,omitempty"`
8283
DefaultHeader map[string]string `json:"DefaultHeader,omitempty"`
8384
HttpClient *http.Client
85+
Timeout time.Duration
8486
}
8587

8688
func NewConfiguration(configFilePath string) (pConfig *Configuration, err error) {
@@ -94,7 +96,7 @@ func NewConfiguration(configFilePath string) (pConfig *Configuration, err error)
9496
cfg := Configuration{
9597
BaseUrl: "https://api.aspose.cloud",
9698
DebugMode: false,
97-
DefaultHeader: map[string]string{"x-aspose-client": "go sdk", "x-aspose-client-version": "21.11"},
99+
DefaultHeader: map[string]string{"x-aspose-client": "go sdk", "x-aspose-client-version": "21.12"},
98100
}
99101
err = json.Unmarshal(data, &cfg)
100102

dev/api/models/execute_mail_merge_online_request.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ type ExecuteMailMergeOnlineRequest struct {
4141
// File with mailmerge data.
4242
Data io.ReadCloser
4343
/* optional (nil or map[string]interface{}) with one or more of key / value pairs:
44+
key: "options" value: (IFieldOptions) Field options.
4445
key: "withRegions" value: (*bool) The flag indicating whether to execute Mail Merge operation with regions.
4546
key: "cleanup" value: (*string) The cleanup options.
4647
key: "documentFileName" value: (*string) The filename of the output document, that will be used when the resulting document has a dynamic field {filename}. If it is not set, the "template" will be used instead. */
@@ -128,6 +129,11 @@ func (data *ExecuteMailMergeOnlineRequest) CreateRequestData() (RequestData, err
128129
}
129130

130131

132+
if localVarTempParam, localVarOk := data.Optionals["options"].(FieldOptions); localVarOk {
133+
result.FormParams = append(result.FormParams, NewTextFormParamContainer("Options", parameterToString(localVarTempParam, "")))
134+
}
135+
136+
131137

132138
return result, nil
133139
}

dev/api/models/execute_mail_merge_request.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ type ExecuteMailMergeRequest struct {
4141
Name *string
4242
/* optional (nil or map[string]interface{}) with one or more of key / value pairs:
4343
key: "data" value: (*string) Mail merge data.
44+
key: "options" value: (IFieldOptions) Field options.
4445
key: "folder" value: (*string) Original document folder.
4546
key: "storage" value: (*string) Original document storage.
4647
key: "loadEncoding" value: (*string) Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML.
@@ -175,6 +176,11 @@ func (data *ExecuteMailMergeRequest) CreateRequestData() (RequestData, error) {
175176
}
176177

177178

179+
if localVarTempParam, localVarOk := data.Optionals["options"].(FieldOptions); localVarOk {
180+
result.FormParams = append(result.FormParams, NewTextFormParamContainer("Options", parameterToString(localVarTempParam, "")))
181+
}
182+
183+
178184

179185
return result, nil
180186
}

dev/api/models/field_options.go

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/*
2+
* --------------------------------------------------------------------------------
3+
* <copyright company="Aspose" file="field_options.go">
4+
* Copyright (c) 2021 Aspose.Words for Cloud
5+
* </copyright>
6+
* <summary>
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in all
15+
* copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
* SOFTWARE.
24+
* </summary>
25+
* --------------------------------------------------------------------------------
26+
*/
27+
28+
package models
29+
30+
// DTO for field options.
31+
type FieldOptionsResult struct {
32+
// DTO for field options.
33+
BuiltInTemplatesPaths []string `json:"BuiltInTemplatesPaths,omitempty"`
34+
35+
// DTO for field options.
36+
CurrentUser UserInformationResult `json:"CurrentUser,omitempty"`
37+
38+
// DTO for field options.
39+
CustomTocStyleSeparator string `json:"CustomTocStyleSeparator,omitempty"`
40+
41+
// DTO for field options.
42+
DefaultDocumentAuthor string `json:"DefaultDocumentAuthor,omitempty"`
43+
44+
// DTO for field options.
45+
FieldIndexFormat string `json:"FieldIndexFormat,omitempty"`
46+
47+
// DTO for field options.
48+
FieldUpdateCultureSource string `json:"FieldUpdateCultureSource,omitempty"`
49+
50+
// DTO for field options.
51+
FileName string `json:"FileName,omitempty"`
52+
53+
// DTO for field options.
54+
IsBidiTextSupportedOnUpdate bool `json:"IsBidiTextSupportedOnUpdate,omitempty"`
55+
56+
// DTO for field options.
57+
LegacyNumberFormat bool `json:"LegacyNumberFormat,omitempty"`
58+
59+
// DTO for field options.
60+
PreProcessCultureName string `json:"PreProcessCultureName,omitempty"`
61+
62+
// DTO for field options.
63+
TemplateName string `json:"TemplateName,omitempty"`
64+
65+
// DTO for field options.
66+
UseInvariantCultureNumberFormat bool `json:"UseInvariantCultureNumberFormat,omitempty"`
67+
}
68+
69+
type FieldOptions struct {
70+
// DTO for field options.
71+
BuiltInTemplatesPaths []string `json:"BuiltInTemplatesPaths,omitempty"`
72+
73+
// DTO for field options.
74+
CurrentUser IUserInformation `json:"CurrentUser,omitempty"`
75+
76+
// DTO for field options.
77+
CustomTocStyleSeparator *string `json:"CustomTocStyleSeparator,omitempty"`
78+
79+
// DTO for field options.
80+
DefaultDocumentAuthor *string `json:"DefaultDocumentAuthor,omitempty"`
81+
82+
// DTO for field options.
83+
FieldIndexFormat *string `json:"FieldIndexFormat,omitempty"`
84+
85+
// DTO for field options.
86+
FieldUpdateCultureSource *string `json:"FieldUpdateCultureSource,omitempty"`
87+
88+
// DTO for field options.
89+
FileName *string `json:"FileName,omitempty"`
90+
91+
// DTO for field options.
92+
IsBidiTextSupportedOnUpdate *bool `json:"IsBidiTextSupportedOnUpdate,omitempty"`
93+
94+
// DTO for field options.
95+
LegacyNumberFormat *bool `json:"LegacyNumberFormat,omitempty"`
96+
97+
// DTO for field options.
98+
PreProcessCultureName *string `json:"PreProcessCultureName,omitempty"`
99+
100+
// DTO for field options.
101+
TemplateName *string `json:"TemplateName,omitempty"`
102+
103+
// DTO for field options.
104+
UseInvariantCultureNumberFormat *bool `json:"UseInvariantCultureNumberFormat,omitempty"`
105+
}
106+
107+
type IFieldOptions interface {
108+
IsFieldOptions() bool
109+
}
110+
func (FieldOptions) IsFieldOptions() bool {
111+
return true
112+
}
113+
114+

dev/api/models/get_info_request.go

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/*
2+
* --------------------------------------------------------------------------------
3+
* <copyright company="Aspose" file="get_info_request.go">
4+
* Copyright (c) 2021 Aspose.Words for Cloud
5+
* </copyright>
6+
* <summary>
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in all
15+
* copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
* SOFTWARE.
24+
* </summary>
25+
* --------------------------------------------------------------------------------
26+
*/
27+
28+
package models
29+
30+
import (
31+
"net/url"
32+
"strings"
33+
"io"
34+
"encoding/json"
35+
)
36+
37+
// GetInfoRequest contains request data for WordsApiService.GetInfo method.
38+
type GetInfoRequest struct {
39+
}
40+
41+
42+
func (data *GetInfoRequest) CreateRequestData() (RequestData, error) {
43+
44+
var result RequestData
45+
46+
result.Method = strings.ToUpper("get")
47+
48+
// create path and map variables
49+
result.Path = "/words/info"
50+
51+
result.Path = strings.Replace(result.Path, "/<nil>", "", -1)
52+
result.Path = strings.Replace(result.Path, "//", "/", -1)
53+
54+
result.HeaderParams = make(map[string]string)
55+
result.QueryParams = url.Values{}
56+
result.FormParams = make([]FormParamContainer, 0)
57+
58+
59+
60+
// to determine the Content-Type header
61+
localVarHttpContentTypes := []string{ "application/xml", "application/json", }
62+
63+
// set Content-Type header
64+
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
65+
if localVarHttpContentType != "" {
66+
result.HeaderParams["Content-Type"] = localVarHttpContentType
67+
}
68+
69+
// to determine the Accept header
70+
localVarHttpHeaderAccepts := []string{
71+
"application/xml",
72+
"application/json",
73+
}
74+
75+
// set Accept header
76+
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
77+
if localVarHttpHeaderAccept != "" {
78+
result.HeaderParams["Accept"] = localVarHttpHeaderAccept
79+
}
80+
81+
82+
83+
84+
return result, nil
85+
}
86+
87+
func (data *GetInfoRequest) CreateResponse(reader io.Reader, boundary string) (response interface{}, err error) {
88+
var successPayload InfoResponse
89+
if err = json.NewDecoder(reader).Decode(&successPayload); err != nil {
90+
return nil, err
91+
}
92+
93+
return successPayload, err
94+
}

0 commit comments

Comments
 (0)