Skip to content

Commit 7a5be7e

Browse files
[TASKSCLOUD-682] - Deployed new 22.12 version.
1 parent 923e820 commit 7a5be7e

File tree

8 files changed

+300
-6
lines changed

8 files changed

+300
-6
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ Feel free to explore the [Developer's Guide](https://docs.aspose.cloud/display/t
3434
XER, XLSX, HTML, XML, TXT, TIF, SVG, PNG, JPEG
3535

3636

37+
## Enhancements in Version 22.12
38+
- Added new ability to read Primavera-specific task's properties.
39+
- Provided the ability to read more document properties.
40+
3741
## Enhancements in Version 20.11
3842
- Support for the batch creation of tasks (i.e. the ability to create multiple tasks in a single *API* call).
3943

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@asposecloud/aspose-tasks-cloud",
3-
"version": "22.8.0",
3+
"version": "22.12.0",
44
"description": "Aspose.Tasks Cloud SDK for Node.js",
55
"homepage": "https://products.aspose.cloud/tasks",
66
"readmeFilename": "README.md",

src/api.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2779,6 +2779,46 @@ export class TasksApi {
27792779
return Promise.resolve(result);
27802780
}
27812781

2782+
/**
2783+
* Get primavera properties for a task with the specified Uid.
2784+
* @param requestObj contains request parameters
2785+
*/
2786+
public async getPrimaveraTaskProperties(requestObj: model.GetPrimaveraTaskPropertiesRequest): Promise<model.TasksIncomingMessage<model.PrimaveraTaskPropertiesResponse>> {
2787+
if (requestObj === null || requestObj === undefined) {
2788+
throw new Error('Required parameter "requestObj" was null or undefined when calling getPrimaveraTaskProperties.');
2789+
}
2790+
2791+
let localVarPath = this.configuration.getApiBaseUrl() + "/tasks/{name}/tasks/{taskUid}/primaveraProperties"
2792+
.replace("{" + "name" + "}", String(requestObj.name))
2793+
.replace("{" + "taskUid" + "}", String(requestObj.taskUid));
2794+
const queryParameters: any = {};
2795+
2796+
// verify required parameter 'requestObj.name' is not null or undefined
2797+
if (requestObj.name === null || requestObj.name === undefined) {
2798+
throw new Error('Required parameter "requestObj.name" was null or undefined when calling getPrimaveraTaskProperties.');
2799+
}
2800+
2801+
// verify required parameter 'requestObj.taskUid' is not null or undefined
2802+
if (requestObj.taskUid === null || requestObj.taskUid === undefined) {
2803+
throw new Error('Required parameter "requestObj.taskUid" was null or undefined when calling getPrimaveraTaskProperties.');
2804+
}
2805+
2806+
localVarPath = addQueryParameterToUrl(localVarPath, queryParameters, "folder", requestObj.folder);
2807+
localVarPath = addQueryParameterToUrl(localVarPath, queryParameters, "storage", requestObj.storage);
2808+
2809+
const requestOptions: request.Options = {
2810+
method: "GET",
2811+
qs: queryParameters,
2812+
uri: localVarPath,
2813+
json: true,
2814+
};
2815+
2816+
const response = await invokeApiMethod(requestOptions, this.configuration);
2817+
const body = ObjectSerializer.deserialize(response.body, "PrimaveraTaskPropertiesResponse");
2818+
const result: model.TasksIncomingMessage<model.PrimaveraTaskPropertiesResponse> = {body, response};
2819+
return Promise.resolve(result);
2820+
}
2821+
27822822
/**
27832823
* Read project task.
27842824
* @param requestObj contains request parameters

src/internal/requestHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ async function invokeApiMethodInternal(requestOptions: request.Options, confgura
106106
//headers
107107
sa.set("User-Agent", "tasks nodejs sdk");
108108
sa.set("x-aspose-client", "nodejs sdk");
109-
sa.set("x-aspose-client-version", "22.8");
109+
sa.set("x-aspose-client-version", "22.12");
110110

111111
if (!requestOptions.headers) {
112112
requestOptions.headers = {};

src/model/model.ts

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2053,6 +2053,129 @@ export enum PresentationFormat {
20532053
ResourceSheet = 'ResourceSheet' as any,
20542054
TaskSheet = 'TaskSheet' as any,
20552055
}
2056+
/**
2057+
* Represents Primavera-specific properties for a task read from Primavera format (XER of P6XML).
2058+
*/
2059+
export class PrimaveraTaskProperties {
2060+
2061+
/**
2062+
* Attribute type map
2063+
*/
2064+
public static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
2065+
{
2066+
name: "sequenceNumber",
2067+
baseName: "sequenceNumber",
2068+
type: "number",
2069+
},
2070+
{
2071+
name: "activityId",
2072+
baseName: "activityId",
2073+
type: "string",
2074+
},
2075+
{
2076+
name: "remainingEarlyFinish",
2077+
baseName: "remainingEarlyFinish",
2078+
type: "Date",
2079+
},
2080+
{
2081+
name: "remainingEarlyStart",
2082+
baseName: "remainingEarlyStart",
2083+
type: "Date",
2084+
},
2085+
{
2086+
name: "remainingLateStart",
2087+
baseName: "remainingLateStart",
2088+
type: "Date",
2089+
},
2090+
{
2091+
name: "remainingLateFinish",
2092+
baseName: "remainingLateFinish",
2093+
type: "Date",
2094+
},
2095+
{
2096+
name: "rawDurationType",
2097+
baseName: "rawDurationType",
2098+
type: "string",
2099+
},
2100+
{
2101+
name: "rawActivityType",
2102+
baseName: "rawActivityType",
2103+
type: "string",
2104+
},
2105+
{
2106+
name: "rawCompletePercentType",
2107+
baseName: "rawCompletePercentType",
2108+
type: "string",
2109+
},
2110+
{
2111+
name: "rawStatus",
2112+
baseName: "rawStatus",
2113+
type: "string",
2114+
} ];
2115+
2116+
/**
2117+
* Returns attribute type map
2118+
*/
2119+
public static getAttributeTypeMap() {
2120+
return PrimaveraTaskProperties.attributeTypeMap;
2121+
}
2122+
2123+
/**
2124+
* The sequence number of the WBS item (summary tasks). It is used to sort summary tasks in Primavera.
2125+
*/
2126+
public sequenceNumber: number;
2127+
2128+
/**
2129+
* Activity id field - a task's unique identifier used by Primavera.
2130+
*/
2131+
public activityId: string;
2132+
2133+
/**
2134+
* Remaining early finish date - the date when the remaining work for the activity is scheduled to be finished.
2135+
*/
2136+
public remainingEarlyFinish: Date;
2137+
2138+
/**
2139+
* Remaining early start date - the date when the remaining work for the activity is scheduled to begin.
2140+
*/
2141+
public remainingEarlyStart: Date;
2142+
2143+
/**
2144+
* Remaining late start date.
2145+
*/
2146+
public remainingLateStart: Date;
2147+
2148+
/**
2149+
* Remaining late finish date.
2150+
*/
2151+
public remainingLateFinish: Date;
2152+
2153+
/**
2154+
* Raw text representation (as in source file) of 'Duration Type' field of the activity.
2155+
*/
2156+
public rawDurationType: string;
2157+
2158+
/**
2159+
* Raw text representation (as in source file) of 'Activity Type' field of the activity.
2160+
*/
2161+
public rawActivityType: string;
2162+
2163+
/**
2164+
* Raw text representation (as in source file) of '% Complete Type' field of the activity.
2165+
*/
2166+
public rawCompletePercentType: string;
2167+
2168+
/**
2169+
* Raw text representation (as in source file) of 'Status' field of the activity.
2170+
*/
2171+
public rawStatus: string;
2172+
2173+
public constructor(init?: Partial<PrimaveraTaskProperties>) {
2174+
2175+
Object.assign(this, init);
2176+
}
2177+
}
2178+
20562179
/**
20572180
* Specifies types of supported probability distributions.
20582181
*/
@@ -7240,6 +7363,39 @@ export class PageCountResponse extends AsposeResponse {
72407363
}
72417364
}
72427365

7366+
/**
7367+
* PrimaveraProperties response.
7368+
*/
7369+
export class PrimaveraTaskPropertiesResponse extends AsposeResponse {
7370+
7371+
/**
7372+
* Attribute type map
7373+
*/
7374+
public static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
7375+
{
7376+
name: "primaveraProperties",
7377+
baseName: "primaveraProperties",
7378+
type: "PrimaveraTaskProperties",
7379+
} ];
7380+
7381+
/**
7382+
* Returns attribute type map
7383+
*/
7384+
public static getAttributeTypeMap() {
7385+
return super.getAttributeTypeMap().concat(PrimaveraTaskPropertiesResponse.attributeTypeMap);
7386+
}
7387+
7388+
/**
7389+
* PrimaveraTaskProperties DTO
7390+
*/
7391+
public primaveraProperties: PrimaveraTaskProperties;
7392+
7393+
public constructor(init?: Partial<PrimaveraTaskPropertiesResponse>) {
7394+
super(init);
7395+
Object.assign(this, init);
7396+
}
7397+
}
7398+
72437399
/**
72447400
* ProjectIds response
72457401
*/
@@ -7964,6 +8120,7 @@ const typeMap = {
79648120
OutlineCodeItem,
79658121
OutlineMask,
79668122
OutlineValue,
8123+
PrimaveraTaskProperties,
79678124
ProjectInfo,
79688125
ProjectRecalculationResult,
79698126
ProjectServerSaveOptionsDTO,
@@ -8013,6 +8170,7 @@ const typeMap = {
80138170
OutlineCodeItemsResponse,
80148171
OutlineCodeResponse,
80158172
PageCountResponse,
8173+
PrimaveraTaskPropertiesResponse,
80168174
ProjectIdsResponse,
80178175
ProjectList,
80188176
ProjectListResponse,
@@ -10206,6 +10364,35 @@ public fileName: string;
1020610364
}
1020710365
}
1020810366

10367+
/**
10368+
* Request model for getPrimaveraTaskProperties operation.
10369+
*/
10370+
export class GetPrimaveraTaskPropertiesRequest {
10371+
/**
10372+
* The name of the file.
10373+
*/
10374+
public name: string;
10375+
10376+
/**
10377+
* Uid of task to get primavera properties for.
10378+
*/
10379+
public taskUid: number;
10380+
10381+
/**
10382+
* The document folder.
10383+
*/
10384+
public folder: string;
10385+
10386+
/**
10387+
* The document storage.
10388+
*/
10389+
public storage: string;
10390+
10391+
public constructor(init?: Partial<GetPrimaveraTaskPropertiesRequest>) {
10392+
Object.assign(this, init);
10393+
}
10394+
}
10395+
1020910396
/**
1021010397
* Request model for getTask operation.
1021110398
*/

test/documentPropertiesTests.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe("getDocumentProperties function", () => {
4545

4646
const result = await tasksApi.getDocumentProperties(request);
4747
expect(result.response.statusCode).to.equal(200);
48-
expect(result.body.properties.list.length).to.equal(52);
48+
expect(result.body.properties.list.length).to.equal(63);
4949
expect(result.body.properties.list[0].name).to.equal("Title");
5050
expect(result.body.properties.list[0].value).to.equal("Home Move");
5151
});
@@ -195,4 +195,4 @@ describe("postDocumentProperty function", () => {
195195
const result = await tasksApi.getDocumentProperty(request2);
196196
expect(result.body.property).is.null;
197197
});
198-
});
198+
});

test/tasksPrimaveraPropertiesTests.ts

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* MIT License
3+
4+
* Copyright (c) 2022 Aspose Pty Ltd
5+
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
import { expect } from "chai";
26+
import "mocha";
27+
import { GetPrimaveraTaskPropertiesRequest } from "../src";
28+
29+
import * as BaseTest from "./baseTest";
30+
31+
describe("getPrimaveraTaskProperties function", () => {
32+
it("should return response with code 200 and correct data", async () => {
33+
34+
const tasksApi = BaseTest.initializeTasksApi();
35+
const fileName = "p6_multiproject.xml";
36+
const localPath = BaseTest.localBaseTestDataFolder + fileName;
37+
const remotePath = BaseTest.remoteBaseTestDataFolder;
38+
const remoteFullPath = remotePath + "/" + fileName;
39+
40+
await tasksApi.uploadFileToStorage(remoteFullPath, localPath);
41+
42+
const request : GetPrimaveraTaskPropertiesRequest = {
43+
name: fileName,
44+
taskUid: 1,
45+
folder: remotePath,
46+
storage: undefined
47+
}
48+
49+
const result = await tasksApi.getPrimaveraTaskProperties(request);
50+
51+
expect(result.response.statusCode).to.equal(200);
52+
expect(result.body.primaveraProperties.sequenceNumber).to.equal(0);
53+
expect(result.body.primaveraProperties.activityId).to.equal("A1040");
54+
expect(result.body.primaveraProperties.remainingEarlyStart).to.eql(new Date(2000, 9, 12, 8));
55+
expect(result.body.primaveraProperties.remainingEarlyFinish).to.eql(new Date(2000, 9, 12, 17));
56+
expect(result.body.primaveraProperties.remainingLateStart).to.eql(new Date(2000, 9, 12, 8));
57+
expect(result.body.primaveraProperties.remainingLateFinish).to.eql(new Date(2000, 9, 12, 17));
58+
expect(result.body.primaveraProperties.rawDurationType).to.equal("Fixed Units");
59+
expect(result.body.primaveraProperties.rawActivityType).to.equal("Task Dependent");
60+
expect(result.body.primaveraProperties.rawCompletePercentType).to.equal("Units");
61+
expect(result.body.primaveraProperties.rawStatus).to.equal("Not Started");
62+
});
63+
});

0 commit comments

Comments
 (0)