Skip to content

Commit 5354e9d

Browse files
[TASKSCLOUD-445] - Deployed new 20.11 version.
1 parent 24dd035 commit 5354e9d

10 files changed

+232
-34
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
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": "20.8.0",
3+
"version": "20.11.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: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,12 @@ export class TasksApi {
4343
* @param appSID App SID.
4444
* @param appKey App key.
4545
* @param baseUrl Base api Url.
46+
* @param authUrl Auth Url.
4647
* @param debugMode A value indicating whether debug mode. In debug mode all requests and responses are logged to console.
4748
* @param version API version.
4849
*/
49-
constructor(appSID: string, appKey: string, baseUrl?: string, debugMode?: boolean) {
50-
this.configuration = new Configuration(appSID, appKey, baseUrl, debugMode);
50+
constructor(appSID: string, appKey: string, baseUrl?: string, authUrl?: string, debugMode?: boolean) {
51+
this.configuration = new Configuration(appSID, appKey, baseUrl, authUrl, debugMode);
5152
}
5253

5354
/**
@@ -3078,7 +3079,53 @@ export class TasksApi {
30783079
}
30793080

30803081
/**
3081-
* Move one task to another parent task
3082+
* Create multiple tasks by single request.
3083+
* @param requestObj contains request parameters
3084+
*/
3085+
public async postTasks(requestObj: model.PostTasksRequest): Promise<model.TasksIncomingMessage<model.TaskItemsResponse>> {
3086+
if (requestObj === null || requestObj === undefined) {
3087+
throw new Error('Required parameter "requestObj" was null or undefined when calling postTasks.');
3088+
}
3089+
3090+
let localVarPath = this.configuration.getApiBaseUrl() + "/tasks/{name}/tasks/batch"
3091+
.replace("{" + "name" + "}", String(requestObj.name));
3092+
const queryParameters: any = {};
3093+
3094+
// verify required parameter 'requestObj.name' is not null or undefined
3095+
if (requestObj.name === null || requestObj.name === undefined) {
3096+
throw new Error('Required parameter "requestObj.name" was null or undefined when calling postTasks.');
3097+
}
3098+
3099+
// verify required parameter 'requestObj.requests' is not null or undefined
3100+
if (requestObj.requests === null || requestObj.requests === undefined) {
3101+
throw new Error('Required parameter "requestObj.requests" was null or undefined when calling postTasks.');
3102+
}
3103+
3104+
localVarPath = addQueryParameterToUrl(localVarPath, queryParameters, "fileName", requestObj.fileName);
3105+
localVarPath = addQueryParameterToUrl(localVarPath, queryParameters, "storage", requestObj.storage);
3106+
localVarPath = addQueryParameterToUrl(localVarPath, queryParameters, "folder", requestObj.folder);
3107+
3108+
let requestBody : any;
3109+
if(requestObj.requests) {
3110+
requestBody = ObjectSerializer.serialize(requestObj.requests, requestObj.requests.constructor.name === "Object" ? "Array<TaskCreationRequest>" : requestObj.requests.constructor.name);
3111+
}
3112+
3113+
const requestOptions: request.Options = {
3114+
method: "POST",
3115+
qs: queryParameters,
3116+
uri: localVarPath,
3117+
json: true,
3118+
body: requestBody,
3119+
};
3120+
3121+
const response = await invokeApiMethod(requestOptions, this.configuration);
3122+
const body = ObjectSerializer.deserialize(response.body, "TaskItemsResponse");
3123+
const result: model.TasksIncomingMessage<model.TaskItemsResponse> = {body, response};
3124+
return Promise.resolve(result);
3125+
}
3126+
3127+
/**
3128+
* Move one task to another parent task.
30823129
* @param requestObj contains request parameters
30833130
*/
30843131
public async putMoveTask(requestObj: model.PutMoveTaskRequest): Promise<model.TasksIncomingMessage<model.AsposeResponse>> {

src/internal/auth.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,17 @@ export class OAuth implements IAuthentication {
7373
}
7474

7575
private async _requestToken(configuration: Configuration): Promise<void> {
76+
let uri: string;
77+
if (configuration.authUrl) {
78+
uri = configuration.authUrl;
79+
} else {
80+
uri = configuration.baseUrl + "/connect/token";
81+
}
82+
7683
const requestOptions: request.Options = {
7784
method: "POST",
7885
json: true,
79-
uri: configuration.baseUrl + "/connect/token",
86+
uri,
8087
form: {
8188
grant_type: "client_credentials",
8289
client_id: configuration.appSID,

src/internal/configuration.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,25 @@ export class Configuration {
4949
*/
5050
public baseUrl: string = defaultBasePath;
5151

52+
/**
53+
* Auth Url.
54+
*/
55+
public authUrl: string;
56+
5257
/**
5358
* Gets or sets a value indicating whether debug mode. In debug mode all requests and responses are logged to console.
5459
*/
5560
public debugMode: boolean;
5661

57-
constructor(appSID: string, appKey: string, baseUrl?: string, debugMode?: boolean) {
62+
constructor(appSID: string, appKey: string, baseUrl?: string, authUrl?: string, debugMode?: boolean) {
5863
if (baseUrl) {
5964
this.baseUrl = baseUrl;
6065
}
6166

67+
if (authUrl) {
68+
this.authUrl = authUrl;
69+
}
70+
6271
if (!appKey || !appKey.trim()) {
6372
throw new Error("appKey parameter must be non-empty string");
6473
}

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", "20.8");
109+
sa.set("x-aspose-client-version", "20.11");
110110

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

src/model/model.ts

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5338,6 +5338,56 @@ export class Task {
53385338
}
53395339
}
53405340

5341+
export class TaskCreationRequest {
5342+
5343+
/**
5344+
* Attribute type map
5345+
*/
5346+
public static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
5347+
{
5348+
name: "taskName",
5349+
baseName: "taskName",
5350+
type: "string",
5351+
},
5352+
{
5353+
name: "parentTaskUid",
5354+
baseName: "parentTaskUid",
5355+
type: "number",
5356+
},
5357+
{
5358+
name: "beforeTaskId",
5359+
baseName: "beforeTaskId",
5360+
type: "number",
5361+
} ];
5362+
5363+
/**
5364+
* Returns attribute type map
5365+
*/
5366+
public static getAttributeTypeMap() {
5367+
return TaskCreationRequest.attributeTypeMap;
5368+
}
5369+
5370+
/**
5371+
* The name for the new task.
5372+
*/
5373+
public taskName: string;
5374+
5375+
/**
5376+
* Uid for parent task.
5377+
*/
5378+
public parentTaskUid: number;
5379+
5380+
/**
5381+
* Id of task before which new task will be inserted.
5382+
*/
5383+
public beforeTaskId: number;
5384+
5385+
public constructor(init?: Partial<TaskCreationRequest>) {
5386+
5387+
Object.assign(this, init);
5388+
}
5389+
}
5390+
53415391
/**
53425392
* A task's brief info
53435393
*/
@@ -7865,6 +7915,7 @@ const typeMap = {
78657915
StorageExist,
78667916
StorageFile,
78677917
Task,
7918+
TaskCreationRequest,
78687919
TaskItem,
78697920
TaskLink,
78707921
TimephasedData,
@@ -9090,7 +9141,7 @@ public name: string;
90909141
public guid: string;
90919142

90929143
/**
9093-
* The URL of PWA (Project Web Access) API of Project Online.
9144+
* The URL of PWA (Project Web Access) API of Project Online
90949145
*/
90959146
public siteUrl: string;
90969147

@@ -10339,6 +10390,40 @@ public folder: string;
1033910390
}
1034010391
}
1034110392

10393+
/**
10394+
* Request model for postTasks operation.
10395+
*/
10396+
export class PostTasksRequest {
10397+
/**
10398+
* The name of the file.
10399+
*/
10400+
public name: string;
10401+
10402+
/**
10403+
* Requests to create tasks.
10404+
*/
10405+
public requests: Array<TaskCreationRequest>;
10406+
10407+
/**
10408+
* The name of the project document to save changes to.
10409+
*/
10410+
public fileName: string;
10411+
10412+
/**
10413+
* The document storage.
10414+
*/
10415+
public storage: string;
10416+
10417+
/**
10418+
* The document folder.
10419+
*/
10420+
public folder: string;
10421+
10422+
public constructor(init?: Partial<PostTasksRequest>) {
10423+
Object.assign(this, init);
10424+
}
10425+
}
10426+
1034210427
/**
1034310428
* Request model for putMoveTask operation.
1034410429
*/

test/assignmentsTests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ describe("putAssignment function", () => {
301301
expect(result2.body.assignment).not.undefined.and.not.null;
302302
expect(result2.body.assignment.uid).to.equal(modifiedAssignment.uid);
303303
expect(result2.body.assignment.vac).to.equal(modifiedAssignment.vac);
304-
expect(result2.body.assignment.cost).to.equal(modifiedAssignment.cost);
304+
expect(result2.body.assignment.cost).to.not.equal(modifiedAssignment.cost, "Calculated fields must be overwritten");
305305
expect(result2.body.assignment.start).to.eql(modifiedAssignment.start);
306306
expect(result2.body.assignment.finish).to.eql(modifiedAssignment.finish);
307307
expect(result2.body.assignment.work).to.equal("80.00:00:00");

test/baseTest.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ after(async function () {
4040
*/
4141
export function initializeTasksApi(debugMode?: boolean) {
4242
const config = require("../../testConfig.json");
43-
const tasksApi = new TestTasksApi(config.AppSid, config.AppKey, config.BaseUrl, debugMode);
43+
const tasksApi = new TestTasksApi(config.AppSid, config.AppKey, config.BaseUrl, config.AuthUrl, debugMode);
4444
apiInstance = tasksApi;
4545
return tasksApi;
4646
}
@@ -55,8 +55,13 @@ export function getTimeOnly(arg :Date): Date {
5555

5656
export function convertArrayBufferToStrings(buffer: ArrayBuffer): string[] {
5757
const uintArray = new Uint8Array(buffer);
58-
const string = String.fromCharCode.apply(this, uintArray);
59-
return string.split("\r\n")
58+
const string = String.fromCharCode.apply(this, uintArray);
59+
if(string.indexOf("\r\n") >= 0)
60+
{
61+
return string.split("\r\n");
62+
} else {
63+
return string.split("\n");
64+
}
6065
}
6166

6267
/**
@@ -67,10 +72,11 @@ export class TestTasksApi extends TasksApi {
6772
* @param appSID App SID.
6873
* @param appKey App key.
6974
* @param baseUrl Base api Url.
75+
* @param authUrl Auth api Url.
7076
* @param debugMode A value indicating whether debug mode. In debug mode all requests and responses are logged to console.
7177
*/
72-
constructor(appSID: string, appKey: string, baseUrl?: string, debugMode?: boolean) {
73-
super(appSID, appKey, baseUrl, debugMode);
78+
constructor(appSID: string, appKey: string, baseUrl?: string, authUrl?: string, debugMode?: boolean) {
79+
super(appSID, appKey, baseUrl, authUrl, debugMode);
7480
}
7581

7682
/**

0 commit comments

Comments
 (0)