Skip to content

Commit 6943d13

Browse files
authored
Merge pull request #27 from aspose-pdf-cloud/develop
update to 21.11
2 parents be2fe9b + dffbbdd commit 6943d13

File tree

3 files changed

+52
-4
lines changed

3 files changed

+52
-4
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@ These SDKs are now fully supported. If you have any questions, see any bugs or h
99

1010
Extract Text & Images of a PDF document online https://products.aspose.app/pdf/parser.
1111

12+
## Enhancements in Version 21.11
13+
- A new version of Aspose.PDF Cloud was prepared using the latest version of Aspose.PDF for .NET.
14+
1215
## Installation
1316
```
1417
go get -u github.com/aspose-pdf-cloud/aspose-pdf-cloud-go
1518
```
19+
1620
## Getting Started
1721
Please follow the [installation](#installation) instruction and execute the following Go code:
1822

@@ -30,6 +34,7 @@ Please follow the [installation](#installation) instruction and execute the foll
3034
3135
return pdfAPI.GetDocumentCircleAnnotations(name, args)
3236
```
37+
3338
## Unit Tests
3439
Aspose PDF Cloud SDK includes a suite of unit tests within the "test" subdirectory. These Unit Tests also serves as examples of how to use the Aspose PDF Cloud SDK.
3540

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"] = "21.10.0"
179+
headerParams["x-aspose-client-version"] = "21.11.0"
180180

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

base_test.go

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
package asposepdfcloud
2222

2323
import (
24+
"encoding/json"
2425
"os"
26+
"path/filepath"
2527
)
2628

2729
var BaseTestInstance *BaseTest
@@ -50,15 +52,56 @@ func (bt *BaseTest) GetTestNumber() int {
5052
return bt.TestNumber
5153
}
5254

55+
func getServercredsJson() string {
56+
wd, err := os.Getwd()
57+
if err != nil {
58+
panic(err)
59+
}
60+
dir := filepath.Dir(wd)
61+
for !(dir[len(dir)-1] == filepath.Separator || dir == ".") {
62+
servercreds_json := filepath.Join(dir, "Settings", "servercreds.json")
63+
if _, err := os.Stat(servercreds_json); err == nil {
64+
// fmt.Println(`Settings\servercreds.json found: ` + servercreds_json)
65+
return servercreds_json
66+
}
67+
dir = filepath.Dir(dir)
68+
}
69+
panic(`Settings\servercreds.json not found`)
70+
}
71+
72+
type Creds struct {
73+
AppSID string
74+
AppKey string
75+
}
76+
77+
func getCreds() (appSID, appKey string) {
78+
bbCreds, err := os.ReadFile(getServercredsJson())
79+
if err != nil {
80+
panic(err)
81+
}
82+
var creds Creds
83+
if err := json.Unmarshal(bbCreds, &creds); err != nil {
84+
panic(err)
85+
}
86+
if len(creds.AppSID) == 0 {
87+
panic("no AppSID")
88+
}
89+
if len(creds.AppKey) == 0 {
90+
panic("no AppKey")
91+
}
92+
return creds.AppSID, creds.AppKey
93+
}
94+
5395
func NewBaseTest() *BaseTest {
54-
bt := &BaseTest{
96+
appSID, appKey := getCreds()
97+
bt := BaseTest{
5598
remoteFolder: "TempPdfCloud",
5699
localTestDataFolder: "test_data",
57100
TestNumber: 0,
58101
// Get App key and App SID from https://aspose.cloud
59-
PdfAPI: NewPdfApiService("AppSID", "AppKey", "https://api.aspose.cloud/v3.0"),
102+
PdfAPI: NewPdfApiService(appSID, appKey, "https://api.aspose.cloud/v3.0"),
60103
}
61-
return bt
104+
return &bt
62105
}
63106

64107
func GetBaseTest() *BaseTest {

0 commit comments

Comments
 (0)