Skip to content

Commit aa5e75b

Browse files
committed
Release Aspose.Cells.Cloud SDK 20.2
1 parent 993d3d2 commit aa5e75b

30 files changed

+216
-148
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Aspose.Cells Cloud
22
- API version: 3.0
3-
- Package version: 20.1
3+
- Package version: 20.2
44
[Aspose.Cells Cloud](https://products.aspose.cloud/cells) is a true REST API that enables you to perform a wide range of document processing operations including creation, manipulation, conversion and rendering of Excel documents in the cloud.
55

66
Our Cloud SDKs are wrappers around REST API in various programming languages, allowing you to process documents in language of your choice quickly and easily, gaining all benefits of strong types and IDE highlights. This repository contains new generation SDKs for Aspose.Cells Cloud and examples.

TestData/TestImportData.xlsx

10.6 KB
Binary file not shown.

api/swagger.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
swagger: "2.0"
33
info:
4-
version: "20.1"
4+
version: "20.2"
55
title: "Aspose.Cells Cloud SDK APIs."
66
host: "api.aspose.cloud"
77
basePath: "/v3.0"
@@ -1240,6 +1240,8 @@ paths:
12401240
- "Cells"
12411241
summary: "Convert workbook from request content to some format."
12421242
operationId: "CellsWorkbook_PutConvertWorkbook"
1243+
consumes:
1244+
- "multipart/form-data"
12431245
parameters:
12441246
- name: "format"
12451247
in: "query"
@@ -1265,12 +1267,10 @@ paths:
12651267
x-nullable: true
12661268
x-exportParamName: "OutPath"
12671269
x-optionalDataType: "String"
1268-
- in: "body"
1269-
name: "workbook"
1270+
- name: "workbook"
1271+
in: "formData"
12701272
required: true
1271-
schema:
1272-
type: "string"
1273-
format: "binary"
1273+
type: "file"
12741274
x-exportParamName: "Workbook"
12751275
responses:
12761276
200:

api_cells.go

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15445,7 +15445,7 @@ CellsApiService Run tasks
1544515445

1544615446

1544715447
type CellsTaskPostRunTaskOpts struct {
15448-
TaskData string
15448+
TaskData interface{}
1544915449
}
1545015450

1545115451

@@ -15466,7 +15466,7 @@ func (a *CellsApiService) CellsTaskPostRunTask( localVarOptionals *CellsTaskP
1546615466
localVarFormParams := url.Values{}
1546715467

1546815468
// to determine the Content-Type header
15469-
localVarHttpContentTypes := []string{"application/xml"}
15469+
localVarHttpContentTypes := []string{"application/json"}
1547015470

1547115471
// set Content-Type header
1547215472
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
@@ -15475,15 +15475,15 @@ func (a *CellsApiService) CellsTaskPostRunTask( localVarOptionals *CellsTaskP
1547515475
}
1547615476

1547715477
// to determine the Accept header
15478-
localVarHttpHeaderAccepts := []string{"application/xml"}
15478+
localVarHttpHeaderAccepts := []string{"application/json"}
1547915479

1548015480
// set Accept header
1548115481
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
1548215482
if localVarHttpHeaderAccept != "" {
1548315483
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
1548415484
}
1548515485
// body params
15486-
localVarPostBody = localVarOptionals.TaskData
15486+
localVarPostBody = &localVarOptionals.TaskData
1548715487
r, err := a.client.prepareRequest( localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
1548815488
if err != nil {
1548915489
return localVarReturnValue, nil, err
@@ -16725,7 +16725,7 @@ CellsApiService
1672516725

1672616726
type CellsWorkbookPostImportDataOpts struct {
1672716727
Name string
16728-
ImportData string
16728+
ImportData interface{}
1672916729
Folder string
1673016730
Storage string
1673116731
}
@@ -16757,7 +16757,7 @@ func (a *CellsApiService) CellsWorkbookPostImportData( localVarOptionals *Cel
1675716757
localVarQueryParams.Add("storage", parameterToString(localVarOptionals.Storage, ""))
1675816758
}
1675916759
// to determine the Content-Type header
16760-
localVarHttpContentTypes := []string{"application/xml"}
16760+
localVarHttpContentTypes := []string{"application/json"}
1676116761

1676216762
// set Content-Type header
1676316763
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
@@ -16766,7 +16766,7 @@ func (a *CellsApiService) CellsWorkbookPostImportData( localVarOptionals *Cel
1676616766
}
1676716767

1676816768
// to determine the Accept header
16769-
localVarHttpHeaderAccepts := []string{"application/xml"}
16769+
localVarHttpHeaderAccepts := []string{"application/json"}
1677016770

1677116771
// set Accept header
1677216772
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
@@ -17535,21 +17535,20 @@ CellsApiService Convert workbook from request content to some format.
1753517535

1753617536

1753717537
type CellsWorkbookPutConvertWorkbookOpts struct {
17538-
Filename string
17539-
Workbook []byte
17538+
1754017539
Format string
1754117540
Password string
1754217541
OutPath string
1754317542
}
1754417543

1754517544

17546-
func (a *CellsApiService) CellsWorkbookPutConvertWorkbook( localVarOptionals *CellsWorkbookPutConvertWorkbookOpts) ([]byte, *http.Response, error) {
17545+
func (a *CellsApiService) CellsWorkbookPutConvertWorkbook( workbook *os.File , localVarOptionals *CellsWorkbookPutConvertWorkbookOpts) ( []byte, *http.Response, error) {
1754717546
var (
1754817547
localVarHttpMethod = strings.ToUpper("Put")
1754917548
localVarPostBody interface{}
1755017549
localVarFileName string
1755117550
localVarFileBytes []byte
17552-
localVarReturnValue []byte
17551+
localVarReturnValue []byte
1755317552
)
1755417553

1755517554
// create path and map variables
@@ -17572,9 +17571,8 @@ func (a *CellsApiService) CellsWorkbookPutConvertWorkbook( localVarOptionals
1757217571
localVarQueryParams.Add("outPath", parameterToString(localVarOptionals.OutPath, ""))
1757317572
}
1757417573
// to determine the Content-Type header
17575-
// localVarHttpContentTypes := []string{"application/json"}
17576-
// to determine the Content-Type header
17577-
localVarHttpContentTypes := []string{ "multipart/form-data", }
17574+
localVarHttpContentTypes := []string{"multipart/form-data"}
17575+
1757817576
// set Content-Type header
1757917577
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
1758017578
if localVarHttpContentType != "" {
@@ -17589,10 +17587,13 @@ func (a *CellsApiService) CellsWorkbookPutConvertWorkbook( localVarOptionals
1758917587
if localVarHttpHeaderAccept != "" {
1759017588
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
1759117589
}
17592-
// body params
17593-
// localVarPostBody = &localVarOptionals.Workbook
17594-
localVarFileBytes = localVarOptionals.Workbook
17595-
localVarFileName =localVarOptionals.Filename
17590+
var localVarFile (*os.File) = workbook
17591+
if localVarFile != nil {
17592+
fbs, _ := ioutil.ReadAll(localVarFile)
17593+
localVarFileBytes = fbs
17594+
localVarFileName = localVarFile.Name()
17595+
localVarFile.Close()
17596+
}
1759617597
r, err := a.client.prepareRequest( localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
1759717598
if err != nil {
1759817599
return localVarReturnValue, nil, err
@@ -17614,7 +17615,6 @@ func (a *CellsApiService) CellsWorkbookPutConvertWorkbook( localVarOptionals
1761417615
}
1761517616

1761617617
return localVarReturnValue, localVarHttpResponse, err
17617-
// return localVarReturnValue, localVarHttpResponse, err
1761817618
}
1761917619

1762017620
/*
@@ -21797,8 +21797,6 @@ func (a *CellsApiService) DownloadFile( localVarOptionals *DownloadFileOpts)
2179721797
}
2179821798

2179921799
return localVarReturnValue, localVarHttpResponse, err
21800-
21801-
// return localVarReturnValue, localVarHttpResponse, err
2180221800
}
2180321801

2180421802
/*

api_cells_test.go

Lines changed: 78 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5431,7 +5431,63 @@ func TestCellsWorksheetsPutWorksheetFreezePanes(t *testing.T) {
54315431
}
54325432
}
54335433

5434-
func TestCopyFile( t *testing.T) {
5434+
func TestCellsPutConvertWorkbook(t *testing.T) {
5435+
5436+
args := new(CellsWorkbookPutConvertWorkbookOpts)
5437+
args.Format = "PDF"
5438+
// args.OutPath = "book1.xlsx.pdf"
5439+
file, err := os.Open("../TestData/" + GetBook1())
5440+
if err != nil {
5441+
return
5442+
}
5443+
localVarReturnValue, httpResponse, err := GetBaseTest().CellsAPI.CellsWorkbookPutConvertWorkbook(file, args)
5444+
if err != nil {
5445+
t.Error(err)
5446+
} else if httpResponse.StatusCode < 200 || httpResponse.StatusCode > 299 {
5447+
t.Fail()
5448+
} else {
5449+
fmt.Printf("%d\t TestCellsPutConvertWorkbook - %d\n", GetBaseTest().GetTestNumber(), httpResponse.StatusCode)
5450+
file1, err2 := os.Create("../Book1.pdf")
5451+
if err2 != nil {
5452+
return
5453+
}
5454+
if _, err3 := file1.Write(localVarReturnValue); err3 != nil {
5455+
fmt.Println(err3)
5456+
}
5457+
file1.Close()
5458+
}
5459+
}
5460+
5461+
func TestCellsImportData(t *testing.T) {
5462+
name := GetImportData()
5463+
if err := GetBaseTest().UploadFile(name); err != nil {
5464+
t.Error(err)
5465+
}
5466+
5467+
args := new(CellsWorkbookPostImportDataOpts)
5468+
args.Name = GetImportData()
5469+
importIntArrayOption := new(ImportIntArrayOption)
5470+
importIntArrayOption.Data = []int32{1, 2, 3}
5471+
importIntArrayOption.DestinationWorksheet = GetSheet1()
5472+
importIntArrayOption.FirstColumn = 2
5473+
importIntArrayOption.FirstRow = 1
5474+
importIntArrayOption.IsVertical = true
5475+
importIntArrayOption.ImportDataType = "IntArray"
5476+
args.ImportData = &importIntArrayOption
5477+
5478+
args.Folder = GetBaseTest().remoteFolder
5479+
5480+
response, httpResponse, err := GetBaseTest().CellsAPI.CellsWorkbookPostImportData(args)
5481+
if err != nil {
5482+
t.Error(err)
5483+
} else if httpResponse.StatusCode < 200 || httpResponse.StatusCode > 299 {
5484+
t.Fail()
5485+
} else {
5486+
fmt.Printf("%d\tTestCellsImportData - %d\n", GetBaseTest().GetTestNumber(), response.Code)
5487+
}
5488+
}
5489+
5490+
func TestCopyFile(t *testing.T) {
54355491
name := GetBook1()
54365492
if err := GetBaseTest().UploadFile(name); err != nil {
54375493
t.Error(err)
@@ -5475,33 +5531,34 @@ func TestCellsWorksheetsPostWorksheetComment(t *testing.T) {
54755531
}
54765532
}
54775533

5534+
func TestCellsTaskPostRunTasks(t *testing.T) {
5535+
args := new(CellsTaskPostRunTaskOpts)
5536+
cellsTaskData := new(TaskData)
5537+
cellsTaskDescription := new(TaskDescription)
5538+
cellsSplitWorkbookTaskParameter := new(SplitWorkbookTaskParameter)
5539+
cellsSplitWorkbookTaskParameter.DestinationFileFormat = "xlsx"
5540+
cellsSplitWorkbookTaskParameter.SplitNameRule = "sheetname"
5541+
cellsFileSource1 := new(FileSource)
5542+
cellsFileSource1.FilePath = "GoTest"
5543+
cellsFileSource1.FileSourceType = "CloudFileSystem"
5544+
cellsFileSource2 := new(FileSource)
5545+
cellsFileSource2.FilePath = "GoTest/Book1.xlsx"
5546+
cellsFileSource2.FileSourceType = "CloudFileSystem"
5547+
cellsSplitWorkbookTaskParameter.DestinationFilePosition = &cellsFileSource1
5548+
cellsSplitWorkbookTaskParameter.Workbook = &cellsFileSource2
54785549

5479-
func TestCellsWorkbookPutConvertWorkbook(t *testing.T) {
5480-
name := GetBook1()
5481-
if err := GetBaseTest().UploadFile(name); err != nil {
5482-
t.Error(err)
5483-
}
5484-
5485-
args := new(CellsWorkbookPutConvertWorkbookOpts)
5486-
args.Format = "PDF"
5487-
args.Filename = GetBook1()
5488-
args.Workbook = GetWorkbook()
5550+
cellsTaskDescription.TaskParameter = &cellsSplitWorkbookTaskParameter
5551+
cellsTaskDescription.TaskType = "SplitWorkbook"
54895552

5490-
bts, httpResponse, err := GetBaseTest().CellsAPI.CellsWorkbookPutConvertWorkbook(args)
5553+
cellsTaskData.Tasks = []TaskDescription{*cellsTaskDescription}
5554+
args.TaskData = &cellsTaskData
5555+
_, httpResponse, err := GetBaseTest().CellsAPI.CellsTaskPostRunTask(args)
54915556
if err != nil {
54925557
t.Error(err)
54935558
} else if httpResponse.StatusCode < 200 || httpResponse.StatusCode > 299 {
54945559
t.Fail()
54955560
} else {
5496-
fmt.Printf("%d\tTestCellsWorkbookPutConvertWorkbook - %d\n", GetBaseTest().GetTestNumber(), httpResponse.StatusCode)
5497-
}
5498-
5499-
file, err := os.Create("../Book1.pdf")
5500-
if err != nil {
5501-
return
5502-
}
5503-
if _, err = file.Write(bts); err != nil {
5504-
fmt.Println(err)
5561+
fmt.Printf("%d\t TestCellsTaskPostRunTasks - %d\n", GetBaseTest().GetTestNumber(), httpResponse.StatusCode)
55055562
}
55065563
}
55075564

base_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ func GetBaseTest() *BaseTest {
7373
func GetMyDoc() string {
7474
return "myDocument.xlsx"
7575
}
76-
76+
func GetImportData() string {
77+
return "TestImportData.xlsx"
78+
}
7779
func GetBook1() string {
7880
return "Book1.xlsx"
7981
}

client.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ var (
4747
xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)")
4848
)
4949

50-
// APIClient manages communication with the Aspose.Cells Cloud SDK APIs. API v20.1
50+
// APIClient manages communication with the Aspose.Cells Cloud SDK APIs. API v20.2
5151
// In most cases there should be only one, shared, APIClient.
5252
type APIClient struct {
5353
cfg *Configuration
@@ -412,6 +412,13 @@ func (a *APIClient) addAuth(request *http.Request) (err error) {
412412
return err
413413
}
414414
}
415+
now := time.Now()
416+
time_diff := now.Sub( a.cfg.GetAccessTokenTime)
417+
if(time_diff.Minutes() > 1438){
418+
if err := a.RequestOauthToken(); err != nil {
419+
return err
420+
}
421+
}
415422
request.Header.Add("Authorization", "Bearer " + a.cfg.AccessToken)
416423
return nil
417424
}
@@ -434,6 +441,7 @@ func (a *APIClient) RequestOauthToken() (error) {
434441
return err
435442
}
436443
a.cfg.AccessToken = tr.AccessToken
444+
a.cfg.GetAccessTokenTime = time.Now()
437445
return nil
438446
}
439447

configuration.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ package asposecellscloud
2424

2525
import (
2626
"net/http"
27+
"time"
2728
)
2829

2930
// contextKeys are used to identify the type of value in the context.
@@ -72,6 +73,7 @@ type Configuration struct {
7273
AppKey string
7374
AppSid string
7475
AccessToken string
76+
GetAccessTokenTime time.Time
7577
}
7678

7779
func NewConfiguration(appSid string, appKey string, basePath string) *Configuration {

model_convert_task_parameter.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
package asposecellscloud
2424

2525
type ConvertTaskParameter struct {
26-
Workbook *FileSource `json:"Workbook,omitempty" xml:"Workbook"`
27-
SaveOptions *SaveOptions `json:"SaveOptions,omitempty" xml:"SaveOptions"`
28-
DestinationFile string `json:"DestinationFile,omitempty" xml:"DestinationFile"`
26+
Workbook interface{} `json:"Workbook,omitempty" xml:"Workbook"`
27+
SaveOptions interface{} `json:"SaveOptions,omitempty" xml:"SaveOptions"`
28+
DestinationFile string `json:"DestinationFile,omitempty" xml:"DestinationFile"`
2929
}

model_import_batch_data_option.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
package asposecellscloud
2424

2525
type ImportBatchDataOption struct {
26-
Source *FileSource `json:"Source,omitempty" xml:"Source"`
27-
ImportDataType string `json:"ImportDataType,omitempty" xml:"ImportDataType"`
28-
DestinationWorksheet string `json:"DestinationWorksheet,omitempty" xml:"DestinationWorksheet"`
29-
IsInsert bool `json:"IsInsert,omitempty" xml:"IsInsert"`
30-
BatchData []CellValue `json:"BatchData,omitempty" xml:"BatchData"`
26+
Source interface{} `json:"Source,omitempty" xml:"Source"`
27+
ImportDataType string `json:"ImportDataType,omitempty" xml:"ImportDataType"`
28+
DestinationWorksheet string `json:"DestinationWorksheet,omitempty" xml:"DestinationWorksheet"`
29+
IsInsert bool `json:"IsInsert,omitempty" xml:"IsInsert"`
30+
BatchData []CellValue `json:"BatchData,omitempty" xml:"BatchData"`
3131
}

0 commit comments

Comments
 (0)