Skip to content

Commit 4b3f183

Browse files
[TASKSCLOUD-935] - Deployed new 25.8 version
1 parent 3970079 commit 4b3f183

File tree

14 files changed

+616
-9
lines changed

14 files changed

+616
-9
lines changed

Aspose.Tasks.Cloud.Sdk.Tests/Aspose.Tasks.Cloud.Sdk.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
<Compile Include="Properties\AssemblyInfo.cs" />
6464
<Compile Include="Recalculation\TestRecalculation.cs" />
6565
<Compile Include="Reports\TestReport.cs" />
66+
<Compile Include="Resources\TestResourceLevel.cs" />
6667
<Compile Include="Resources\TestResources.cs" />
6768
<Compile Include="TaskLinks\TaskLinksTests.cs" />
6869
<Compile Include="Tasks\TestPrimaveraProperties.cs" />
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+

2+
// --------------------------------------------------------------------------------------------------------------------
3+
// <copyright company="Aspose" file="TestResourceLevel.cs">
4+
// Copyright (c) 2025 Aspose.Tasks for Cloud
5+
// </copyright>
6+
// <summary>
7+
// Permission is hereby granted, free of charge, to any person obtaining a copy
8+
// of this software and associated documentation files (the "Software"), to deal
9+
// in the Software without restriction, including without limitation the rights
10+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
// copies of the Software, and to permit persons to whom the Software is
12+
// furnished to do so, subject to the following conditions:
13+
//
14+
// The above copyright notice and this permission notice shall be included in all
15+
// copies or substantial portions of the Software.
16+
//
17+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
// SOFTWARE.
24+
// </summary>
25+
// --------------------------------------------------------------------------------------------------------------------
26+
27+
using Aspose.Tasks.Cloud.Sdk.Model;
28+
using Aspose.Tasks.Cloud.Sdk.Model.Requests;
29+
using Aspose.Tasks.Cloud.Sdk.Tests.Base;
30+
using NUnit.Framework;
31+
using System.Net;
32+
using Task = System.Threading.Tasks.Task;
33+
34+
namespace Aspose.Tasks.Cloud.Sdk.Tests.Tasks
35+
{
36+
[TestFixture]
37+
public class TestResourceLevel : BaseTestContext
38+
{
39+
[Test]
40+
public async Task TestLevelTasks()
41+
{
42+
var remoteName = await UploadFileToStorageAsync("sample.mpp");
43+
44+
var resourceResponse = await TasksApi.LevelTasksAsync(new LevelTasksRequest
45+
{
46+
Name = remoteName,
47+
Folder = this.DataFolder
48+
});
49+
50+
Assert.AreEqual((int)HttpStatusCode.OK, resourceResponse.Code);
51+
Assert.IsNotNull(resourceResponse.AffectedTaskUids);
52+
Assert.AreEqual(2, resourceResponse.AffectedTaskUids.Count);
53+
}
54+
55+
[Test]
56+
public async Task TestLevelTasksWithSpecifiedOptions()
57+
{
58+
var remoteName = await UploadFileToStorageAsync("sample.mpp");
59+
60+
var resourceResponse = await TasksApi.LevelTasksAsync(new LevelTasksRequest
61+
{
62+
Name = remoteName,
63+
Folder = this.DataFolder,
64+
Options = new LevelingOptions
65+
{
66+
LevelingOrder = LevelingOrder.Standard,
67+
ResourceUids = new[] { 2, 999 }
68+
}
69+
});
70+
71+
Assert.AreEqual((int)HttpStatusCode.OK, resourceResponse.Code);
72+
Assert.IsNotNull(resourceResponse.AffectedTaskUids);
73+
Assert.AreEqual(1, resourceResponse.AffectedTaskUids.Count);
74+
}
75+
76+
[Test]
77+
public async Task TestСlearLeveling()
78+
{
79+
var remoteName = await UploadFileToStorageAsync("sample.mpp");
80+
81+
var resourceResponse = await TasksApi.СlearLevelingAsync(new ClearLevelingRequest
82+
{
83+
Name = remoteName,
84+
Folder = this.DataFolder
85+
});
86+
87+
Assert.AreEqual((int)HttpStatusCode.OK, resourceResponse.Code);
88+
}
89+
90+
[Test]
91+
public async Task TestСlearLevelingWithSpecifiedTaskUids()
92+
{
93+
var remoteName = await UploadFileToStorageAsync("sample.mpp");
94+
95+
var resourceResponse = await TasksApi.СlearLevelingAsync(new ClearLevelingRequest
96+
{
97+
Name = remoteName,
98+
Folder = this.DataFolder,
99+
TaskUids = new[] { 24, 9999 }
100+
});
101+
102+
Assert.AreEqual((int)HttpStatusCode.OK, resourceResponse.Code);
103+
}
104+
}
105+
}

Aspose.Tasks.Cloud.Sdk.Tests/Vba/VbaTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ public async Task TestGetVbaProject()
4949
Assert.IsNotNull(vbaResponse.VbaProject);
5050
Assert.IsNotNull(vbaResponse.VbaProject.Modules);
5151

52-
Assert.AreEqual(7, vbaResponse.VbaProject.Modules.Count);
53-
Assert.AreEqual("Module1", vbaResponse.VbaProject.Modules[0].Name);
54-
Assert.IsTrue(vbaResponse.VbaProject.Modules[0].SourceCode.StartsWith("Type MEMORYSTATUS"));
52+
Assert.AreEqual(8, vbaResponse.VbaProject.Modules.Count);
53+
Assert.AreEqual("Module1", vbaResponse.VbaProject.Modules[1].Name);
54+
Assert.IsTrue(vbaResponse.VbaProject.Modules[1].SourceCode.StartsWith("Type MEMORYSTATUS"));
5555
}
5656
}
5757
}

Aspose.Tasks.Cloud.Sdk/Api/TasksApi.cs

Lines changed: 107 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,18 @@
2323
// </summary>
2424
// --------------------------------------------------------------------------------------------------------------------
2525

26+
using Aspose.Tasks.Cloud.Sdk.RequestHandlers;
2627
using System;
2728
using System.Collections.Generic;
2829
using System.IO;
29-
using Aspose.Tasks.Cloud.Sdk.RequestHandlers;
3030

3131
namespace Aspose.Tasks.Cloud.Sdk
3232
{
3333
using Aspose.Tasks.Cloud.Sdk.Model;
3434
using Aspose.Tasks.Cloud.Sdk.Model.Requests;
3535
using System.Net;
3636
using System.Text.RegularExpressions;
37+
using System.Threading.Tasks;
3738

3839
/// <summary>
3940
/// Aspose.Tasks for Cloud API.
@@ -2861,7 +2862,111 @@ public AssignmentResponse PutAssignment(PutAssignmentRequest request)
28612862
null);
28622863
if (response != null)
28632864
{
2864-
return (AssignmentResponse) SerializationHelper.Deserialize(response, typeof(AssignmentResponse));
2865+
return (AssignmentResponse)SerializationHelper.Deserialize(response, typeof(AssignmentResponse));
2866+
}
2867+
2868+
return null;
2869+
}
2870+
catch (ApiException ex)
2871+
{
2872+
if (ex.HttpStatusCode == HttpStatusCode.NotFound)
2873+
{
2874+
return null;
2875+
}
2876+
2877+
throw;
2878+
}
2879+
}
2880+
2881+
/// <summary>
2882+
/// Levels tasks for project’s resources. If request body is empty, all project's resources with default leveling options will be leveled.
2883+
/// </summary>
2884+
/// <param name="request">Request. <see cref="LevelTasksRequest" /></param>
2885+
/// <returns><see cref="LevelingResponse"/></returns>
2886+
public LevelingResponse LevelTasks(LevelTasksRequest request)
2887+
{
2888+
// verify the required parameter 'name' is set
2889+
if (request.Name == null)
2890+
{
2891+
throw new ApiException("Missing required parameter 'name' when calling PutAssignment",
2892+
StatusCodes.ErrorInvalidInputData);
2893+
}
2894+
2895+
// create path and map variables
2896+
var resourcePath =
2897+
UnescapePath(this.configuration.GetApiRootUrl() + "/tasks/{name}/resourceLevel");
2898+
resourcePath = UrlHelper.AddPathParameter(resourcePath, "name", request.Name);
2899+
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "storage", request.Storage);
2900+
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "folder", request.Folder);
2901+
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "fileName", request.FileName);
2902+
string body = null;
2903+
if (request.Options != null)
2904+
{
2905+
body = SerializationHelper.Serialize(request.Options);
2906+
}
2907+
try
2908+
{
2909+
var response = this.apiInvoker.InvokeApi(
2910+
resourcePath,
2911+
"PUT",
2912+
body,
2913+
null,
2914+
null);
2915+
if (response != null)
2916+
{
2917+
return (LevelingResponse)SerializationHelper.Deserialize(response, typeof(LevelingResponse));
2918+
}
2919+
2920+
return null;
2921+
}
2922+
catch (ApiException ex)
2923+
{
2924+
if (ex.HttpStatusCode == HttpStatusCode.NotFound)
2925+
{
2926+
return null;
2927+
}
2928+
2929+
throw;
2930+
}
2931+
}
2932+
2933+
/// <summary>
2934+
/// Clears leveling delays that was previously added to the project during resource leveling. If request body is empty, all leveling delays will be cleared.
2935+
/// </summary>
2936+
/// <param name="request">Request. <see cref="ClearLevelingRequest" /></param>
2937+
/// <returns><see cref="AsposeResponse"/></returns>
2938+
public AsposeResponse ÑlearLeveling(ClearLevelingRequest request)
2939+
{
2940+
// verify the required parameter 'name' is set
2941+
if (request.Name == null)
2942+
{
2943+
throw new ApiException("Missing required parameter 'name' when calling PutAssignment",
2944+
StatusCodes.ErrorInvalidInputData);
2945+
}
2946+
2947+
// create path and map variables
2948+
var resourcePath =
2949+
UnescapePath(this.configuration.GetApiRootUrl() + "/tasks/{name}/resourceLevel");
2950+
resourcePath = UrlHelper.AddPathParameter(resourcePath, "name", request.Name);
2951+
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "storage", request.Storage);
2952+
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "folder", request.Folder);
2953+
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "fileName", request.FileName);
2954+
string body = null;
2955+
if (request.TaskUids != null)
2956+
{
2957+
body = SerializationHelper.Serialize(request.TaskUids);
2958+
}
2959+
try
2960+
{
2961+
var response = this.apiInvoker.InvokeApi(
2962+
resourcePath,
2963+
"DELETE",
2964+
body,
2965+
null,
2966+
null);
2967+
if (response != null)
2968+
{
2969+
return (AsposeResponse)SerializationHelper.Deserialize(response, typeof(AsposeResponse));
28652970
}
28662971

28672972
return null;

Aspose.Tasks.Cloud.Sdk/Api/TasksApiAsync.cs

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2816,6 +2816,110 @@ public async Task<AssignmentResponse> PutAssignmentAsync(PutAssignmentRequest re
28162816
}
28172817
}
28182818

2819+
/// <summary>
2820+
/// Levels tasks for project’s resources. If request body is empty, all project's resources with default leveling options will be leveled.
2821+
/// </summary>
2822+
/// <param name="request">Request. <see cref="LevelTasksRequest" /></param>
2823+
/// <returns><see cref="LevelingResponse"/></returns>
2824+
public async Task<LevelingResponse> LevelTasksAsync(LevelTasksRequest request)
2825+
{
2826+
// verify the required parameter 'name' is set
2827+
if (request.Name == null)
2828+
{
2829+
throw new ApiException("Missing required parameter 'name' when calling PutAssignment",
2830+
StatusCodes.ErrorInvalidInputData);
2831+
}
2832+
2833+
// create path and map variables
2834+
var resourcePath =
2835+
UnescapePath(this.configuration.GetApiRootUrl() + "/tasks/{name}/resourceLevel");
2836+
resourcePath = UrlHelper.AddPathParameter(resourcePath, "name", request.Name);
2837+
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "storage", request.Storage);
2838+
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "folder", request.Folder);
2839+
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "fileName", request.FileName);
2840+
string body = null;
2841+
if (request.Options != null)
2842+
{
2843+
body = SerializationHelper.Serialize(request.Options);
2844+
}
2845+
try
2846+
{
2847+
var response = await this.apiInvoker.InvokeApiAsync(
2848+
resourcePath,
2849+
"PUT",
2850+
body,
2851+
null,
2852+
null);
2853+
if (response != null)
2854+
{
2855+
return (LevelingResponse)SerializationHelper.Deserialize(response, typeof(LevelingResponse));
2856+
}
2857+
2858+
return null;
2859+
}
2860+
catch (ApiException ex)
2861+
{
2862+
if (ex.HttpStatusCode == HttpStatusCode.NotFound)
2863+
{
2864+
return null;
2865+
}
2866+
2867+
throw;
2868+
}
2869+
}
2870+
2871+
/// <summary>
2872+
/// Clears leveling delays that was previously added to the project during resource leveling. If request body is empty, all leveling delays will be cleared.
2873+
/// </summary>
2874+
/// <param name="request">Request. <see cref="ClearLevelingRequest" /></param>
2875+
/// <returns><see cref="AsposeResponse"/></returns>
2876+
public async Task<AsposeResponse> ÑlearLevelingAsync(ClearLevelingRequest request)
2877+
{
2878+
// verify the required parameter 'name' is set
2879+
if (request.Name == null)
2880+
{
2881+
throw new ApiException("Missing required parameter 'name' when calling PutAssignment",
2882+
StatusCodes.ErrorInvalidInputData);
2883+
}
2884+
2885+
// create path and map variables
2886+
var resourcePath =
2887+
UnescapePath(this.configuration.GetApiRootUrl() + "/tasks/{name}/resourceLevel");
2888+
resourcePath = UrlHelper.AddPathParameter(resourcePath, "name", request.Name);
2889+
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "storage", request.Storage);
2890+
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "folder", request.Folder);
2891+
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "fileName", request.FileName);
2892+
string body = null;
2893+
if (request.TaskUids != null)
2894+
{
2895+
body = SerializationHelper.Serialize(request.TaskUids);
2896+
}
2897+
try
2898+
{
2899+
var response = await this.apiInvoker.InvokeApiAsync(
2900+
resourcePath,
2901+
"DELETE",
2902+
body,
2903+
null,
2904+
null);
2905+
if (response != null)
2906+
{
2907+
return (AsposeResponse)SerializationHelper.Deserialize(response, typeof(AsposeResponse));
2908+
}
2909+
2910+
return null;
2911+
}
2912+
catch (ApiException ex)
2913+
{
2914+
if (ex.HttpStatusCode == HttpStatusCode.NotFound)
2915+
{
2916+
return null;
2917+
}
2918+
2919+
throw;
2920+
}
2921+
}
2922+
28192923
/// <summary>
28202924
/// Edits an existing project calendar.
28212925
/// </summary>

Aspose.Tasks.Cloud.Sdk/Aspose.Tasks.Cloud.Sdk.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@
145145
<Compile Include="Model\Field.cs" />
146146
<Compile Include="Model\ImportedProjectType.cs" />
147147
<Compile Include="Model\ItemType.cs" />
148+
<Compile Include="Model\LevelingOptions.cs" />
149+
<Compile Include="Model\LevelingOrder.cs" />
150+
<Compile Include="Model\LevelingResponse.cs" />
148151
<Compile Include="Model\Link.cs" />
149152
<Compile Include="Model\LinkElement.cs" />
150153
<Compile Include="Model\MaskType.cs" />
@@ -187,6 +190,7 @@
187190
<Compile Include="Model\RecurringInfo.cs" />
188191
<Compile Include="Model\RecurringInfoResponse.cs" />
189192
<Compile Include="Model\ReportType.cs" />
193+
<Compile Include="Model\Requests\ClearLevelingRequest.cs" />
190194
<Compile Include="Model\Requests\CreateNewProjectRequest.cs" />
191195
<Compile Include="Model\Requests\CreateTableTextStyleRequest.cs" />
192196
<Compile Include="Model\Requests\DeleteAssignmentRequest.cs" />
@@ -237,6 +241,7 @@
237241
<Compile Include="Model\Requests\GetVbaProjectRequest.cs" />
238242
<Compile Include="Model\Requests\GetViewsRequest.cs" />
239243
<Compile Include="Model\Requests\GetWbsDefinitionRequest.cs" />
244+
<Compile Include="Model\Requests\LevelTasksRequest.cs" />
240245
<Compile Include="Model\Requests\PostAssignmentRequest.cs" />
241246
<Compile Include="Model\Requests\PostCalendarExceptionRequest.cs" />
242247
<Compile Include="Model\Requests\PostCalendarRequest.cs" />

0 commit comments

Comments
 (0)