Skip to content

Commit f174e52

Browse files
authored
Merge pull request #44 from aspose-pdf-cloud/develop
update to 23.4.0
2 parents 7cb470d + e1a19f5 commit f174e52

11 files changed

+370
-661
lines changed

README.md

Lines changed: 4 additions & 654 deletions
Large diffs are not rendered by default.

api_client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func (c *APIClient) prepareRequest (
176176

177177
// set custom header
178178
headerParams["x-aspose-client"] = "go sdk"
179-
headerParams["x-aspose-client-version"] = "23.3.0"
179+
headerParams["x-aspose-client-version"] = "23.4.0"
180180

181181
// Detect postBody type and post.
182182
if postBody != nil {

base_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,11 @@ type BaseTest struct {
3737

3838
func (bt *BaseTest) UploadFile(name string) (err error) {
3939
args := make(map[string]interface{})
40-
41-
file, err := os.Open(bt.localTestDataFolder + "/" + name)
40+
file, err := os.Open(filepath.Join(bt.localTestDataFolder, name))
4241
if err != nil {
4342
return err
4443
}
45-
46-
_, _, err = GetBaseTest().PdfAPI.UploadFile(GetBaseTest().remoteFolder+"/"+name, file, args)
44+
_, _, err = GetBaseTest().PdfAPI.UploadFile(filepath.Join(GetBaseTest().remoteFolder, name), file, args)
4745
return err
4846
}
4947

docs/OrganizeDocumentData.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# OrganizeDocumentData
2+
Data for document organizing.
3+
4+
## Properties
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**Path** | **string** | Full filename of the document for organizing. | [default to null]
8+
**Pages** | **string** | 1-based page numbers of the document that make up the resulting document. | [default to null]
9+
10+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)[[View Source]](../organize_document_data.go)
11+
12+

docs/OrganizeDocumentRequest.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# OrganizeDocumentRequest
2+
Documents data for organizing.
3+
4+
## Properties
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**List** | [**[]OrganizeDocumentData**](OrganizeDocumentData.md) | List of document data for organizing. | [default to null]
8+
9+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)[[View Source]](../organize_document_request.go)
10+
11+

docs/PdfApi.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ Method | HTTP request | Description
214214
[**PostListBoxFields**](PdfApi.md#PostListBoxFields) | **Post** /pdf/{name}/fields/listbox | Add document listbox fields.
215215
[**PostMovePage**](PdfApi.md#PostMovePage) | **Post** /pdf/{name}/pages/{pageNumber}/movePage | Move page to new position.
216216
[**PostOptimizeDocument**](PdfApi.md#PostOptimizeDocument) | **Post** /pdf/{name}/optimize | Optimize document.
217+
[**PostOrganizeDocument**](PdfApi.md#PostOrganizeDocument) | **Post** /pdf/{name}/organize | Merge selected pages of a document.
218+
[**PostOrganizeDocuments**](PdfApi.md#PostOrganizeDocuments) | **Post** /pdf/organize | Merge selected pages of different documents.
217219
[**PostPageCaretAnnotations**](PdfApi.md#PostPageCaretAnnotations) | **Post** /pdf/{name}/pages/{pageNumber}/annotations/caret | Add document page caret annotations.
218220
[**PostPageCertify**](PdfApi.md#PostPageCertify) | **Post** /pdf/{name}/pages/{pageNumber}/certify | Certify document page.
219221
[**PostPageCircleAnnotations**](PdfApi.md#PostPageCircleAnnotations) | **Post** /pdf/{name}/pages/{pageNumber}/annotations/circle | Add document page circle annotations.
@@ -7291,6 +7293,73 @@ Name | Type | Description | Notes
72917293

72927294
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
72937295

7296+
# **PostOrganizeDocument**
7297+
> AsposeResponse PostOrganizeDocument(name, pages, outPath, optional)
7298+
Merge selected pages of a document.
7299+
7300+
### Required Parameters
7301+
7302+
Name | Type | Description | Notes
7303+
------------- | ------------- | ------------- | -------------
7304+
**name** | **string**| The original document name. |
7305+
**pages** | **string**| 1-based page numbers of the source document that make up the resulting document. |
7306+
**outPath** | **string**| Full filename of the resulting document. |
7307+
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
7308+
7309+
### Optional Parameters
7310+
Optional parameters are passed through a map[string]interface{}.
7311+
7312+
Name | Type | Description | Notes
7313+
------------- | ------------- | ------------- | -------------
7314+
**name** | **string**| The original document name. |
7315+
**pages** | **string**| 1-based page numbers of the source document that make up the resulting document. |
7316+
**outPath** | **string**| Full filename of the resulting document. |
7317+
**storage** | **string**| The documents storage. |
7318+
**folder** | **string**| The source document folder. |
7319+
7320+
### Return type
7321+
7322+
[**AsposeResponse**](AsposeResponse.md)
7323+
7324+
### HTTP request headers
7325+
7326+
- **Content-Type**: application/json
7327+
- **Accept**: application/json
7328+
7329+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
7330+
7331+
# **PostOrganizeDocuments**
7332+
> AsposeResponse PostOrganizeDocuments(organizeDocuments, outPath, optional)
7333+
Merge selected pages of different documents.
7334+
7335+
### Required Parameters
7336+
7337+
Name | Type | Description | Notes
7338+
------------- | ------------- | ------------- | -------------
7339+
**organizeDocuments** | [**OrganizeDocumentRequest**](OrganizeDocumentRequest.md)| Array of OrganizeDocumentData to make up the resulting document. |
7340+
**outPath** | **string**| Full filename of the resulting document. |
7341+
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
7342+
7343+
### Optional Parameters
7344+
Optional parameters are passed through a map[string]interface{}.
7345+
7346+
Name | Type | Description | Notes
7347+
------------- | ------------- | ------------- | -------------
7348+
**organizeDocuments** | [**OrganizeDocumentRequest**](OrganizeDocumentRequest.md)| Array of OrganizeDocumentData to make up the resulting document. |
7349+
**outPath** | **string**| Full filename of the resulting document. |
7350+
**storage** | **string**| The documents storage. |
7351+
7352+
### Return type
7353+
7354+
[**AsposeResponse**](AsposeResponse.md)
7355+
7356+
### HTTP request headers
7357+
7358+
- **Content-Type**: application/json
7359+
- **Accept**: application/json
7360+
7361+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
7362+
72947363
# **PostPageCaretAnnotations**
72957364
> AsposeResponse PostPageCaretAnnotations(name, pageNumber, annotations, optional)
72967365
Add document page caret annotations.

document_test.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ package asposepdfcloud
2323
import (
2424
"encoding/base64"
2525
"fmt"
26+
"path/filepath"
2627
"testing"
2728
)
2829

@@ -256,3 +257,50 @@ func TestPutDocumentDisplayProperties(t *testing.T) {
256257
fmt.Printf("%d\tTestPutDocumentDisplayProperties - %d\n", GetBaseTest().GetTestNumber(), response.Code)
257258
}
258259
}
260+
261+
func TestPostOrganizeDocument(t *testing.T) {
262+
name := "4pages.pdf"
263+
if err := GetBaseTest().UploadFile(name); err != nil {
264+
t.Error(err)
265+
}
266+
args := map[string]interface{}{
267+
"folder": GetBaseTest().remoteFolder,
268+
}
269+
response, httpResponse, err := GetBaseTest().PdfAPI.PostOrganizeDocument(
270+
name, "1,4-2", filepath.Join(GetBaseTest().remoteFolder, name), args)
271+
if err != nil {
272+
t.Error(err)
273+
} else if httpResponse.StatusCode < 200 || httpResponse.StatusCode > 299 {
274+
t.Fail()
275+
} else {
276+
fmt.Printf("%d\tTestPostOrganizeDocument - %db\n", GetBaseTest().GetTestNumber(), response.Code)
277+
}
278+
}
279+
280+
func TestPostOrganizeDocuments(t *testing.T) {
281+
name1 := "4pages.pdf"
282+
if err := GetBaseTest().UploadFile(name1); err != nil {
283+
t.Error(err)
284+
}
285+
name2 := "marketing.pdf"
286+
if err := GetBaseTest().UploadFile(name2); err != nil {
287+
t.Error(err)
288+
}
289+
request := OrganizeDocumentRequest{
290+
List: []OrganizeDocumentData{
291+
{Path: filepath.Join(GetBaseTest().remoteFolder, name1), Pages: "4-2"},
292+
{Path: filepath.Join(GetBaseTest().remoteFolder, name2), Pages: "2"},
293+
{Path: filepath.Join(GetBaseTest().remoteFolder, name1), Pages: "3,1"},
294+
},
295+
}
296+
args := make(map[string]interface{})
297+
response, httpResponse, err := GetBaseTest().PdfAPI.PostOrganizeDocuments(
298+
request, filepath.Join(GetBaseTest().remoteFolder, "OrganizeMany.pdf"), args)
299+
if err != nil {
300+
t.Error(err)
301+
} else if httpResponse.StatusCode < 200 || httpResponse.StatusCode > 299 {
302+
t.Fail()
303+
} else {
304+
fmt.Printf("%d\tTestPostOrganizeDocuments - %db\n", GetBaseTest().GetTestNumber(), response.Code)
305+
}
306+
}

organize_document_data.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
*
3+
* Copyright (c) 2023 Aspose.PDF Cloud
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
* The above copyright notice and this permission notice shall be included in all
11+
* copies or substantial portions of the Software.
12+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18+
* SOFTWARE.
19+
*
20+
*/
21+
22+
package asposepdfcloud
23+
24+
// Data for document organizing.
25+
type OrganizeDocumentData struct {
26+
// Full filename of the document for organizing.
27+
Path string `json:"Path"`
28+
// 1-based page numbers of the document that make up the resulting document.
29+
Pages string `json:"Pages"`
30+
}

organize_document_request.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
*
3+
* Copyright (c) 2023 Aspose.PDF Cloud
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
* The above copyright notice and this permission notice shall be included in all
11+
* copies or substantial portions of the Software.
12+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18+
* SOFTWARE.
19+
*
20+
*/
21+
22+
package asposepdfcloud
23+
24+
// Documents data for organizing.
25+
type OrganizeDocumentRequest struct {
26+
// List of document data for organizing.
27+
List []OrganizeDocumentData `json:"List"`
28+
}

page_range.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@
2222
package asposepdfcloud
2323

2424
type PageRange struct {
25-
From int32 `json:"from,omitempty"`
26-
To int32 `json:"to,omitempty"`
25+
From int32 `json:"From,omitempty"`
26+
To int32 `json:"To,omitempty"`
2727
}

0 commit comments

Comments
 (0)