-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release 119 - Enable custom HTTP client (#42)
* Enable custom HTTP client * Update for release 119 * Added documentation
- Loading branch information
Showing
23 changed files
with
429 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/*** | ||
* ProjectManager API for C# | ||
* | ||
* (c) 2023-2024 ProjectManager.com, Inc. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author ProjectManager.com <[email protected]> | ||
* @copyright 2023-2024 ProjectManager.com, Inc. | ||
* @link https://github.com/projectmgr/projectmanager-sdk-csharp | ||
*/ | ||
|
||
|
||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
using ProjectManager.SDK.Interfaces; | ||
using ProjectManager.SDK.Models; | ||
|
||
|
||
namespace ProjectManager.SDK.Clients | ||
{ | ||
/// <summary> | ||
/// API methods related to ProjectVersion | ||
/// </summary> | ||
public class ProjectVersionClient : IProjectVersionClient | ||
{ | ||
private readonly ProjectManagerClient _client; | ||
|
||
/// <summary> | ||
/// Constructor | ||
/// </summary> | ||
public ProjectVersionClient(ProjectManagerClient client) | ||
{ | ||
_client = client; | ||
} | ||
|
||
/// <summary> | ||
/// Returns projects versions including version, user who made changes | ||
/// </summary> | ||
/// <param name="projectId">The unique identifier of the Project</param> | ||
public async Task<AstroResult<ProjectVersionDto[]>> RetrieveProjectVersions(Guid projectId) | ||
{ | ||
var url = $"/api/data/projects/{projectId}/versions"; | ||
return await _client.Request<ProjectVersionDto[]>(HttpMethod.Get, url, null); | ||
} | ||
|
||
/// <summary> | ||
/// Exports and returns project version as an MS Project XML attachment | ||
/// </summary> | ||
/// <param name="projectChangeId">Project change Guid</param> | ||
public async Task<AstroResult<byte[]>> DownloadMSProjectXml(Guid projectChangeId) | ||
{ | ||
var url = $"/api/data/projects/{projectChangeId}/version/download"; | ||
return await _client.Request<byte[]>(HttpMethod.Get, url, null); | ||
} | ||
|
||
/// <summary> | ||
/// Restores a Project to the state it was in at a specific Version in time. | ||
/// | ||
/// If successful, all changes made to the Project since this Version will be undone and the Project will | ||
/// return to its former state. | ||
/// </summary> | ||
/// <param name="projectId">The unique identifier of the Project to restore</param> | ||
/// <param name="version">The version number to restore to</param> | ||
public async Task<AstroResult<string>> RestoreProjectVersion(Guid projectId, int version) | ||
{ | ||
var url = $"/api/data/projects/{projectId}/version/{version}/restore"; | ||
return await _client.Request<string>(HttpMethod.Post, url, null); | ||
} | ||
|
||
/// <summary> | ||
/// Create a Copy of a Project as of a specific Version, optionally moving it to a new Timezone. | ||
/// </summary> | ||
/// <param name="projectId">The unique identifier of the Project to copy</param> | ||
/// <param name="version">The version number of the Project to copy</param> | ||
/// <param name="timezoneOffset">If specified, sets the default timezone of the newly copied Project to this specified timezone</param> | ||
public async Task<AstroResult<string>> CopyProjectVersion(Guid projectId, int version, int? timezoneOffset = null) | ||
{ | ||
var url = $"/api/data/projects/{projectId}/version/{version}/copy"; | ||
var options = new Dictionary<string, object>(); | ||
if (timezoneOffset != null) { options["timezoneOffset"] = timezoneOffset; } | ||
return await _client.Request<string>(HttpMethod.Post, url, options); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/*** | ||
* ProjectManager API for C# | ||
* | ||
* (c) 2023-2024 ProjectManager.com, Inc. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author ProjectManager.com <[email protected]> | ||
* @copyright 2023-2024 ProjectManager.com, Inc. | ||
* @link https://github.com/projectmgr/projectmanager-sdk-csharp | ||
*/ | ||
|
||
|
||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
using ProjectManager.SDK.Interfaces; | ||
using ProjectManager.SDK.Models; | ||
|
||
|
||
namespace ProjectManager.SDK.Clients | ||
{ | ||
/// <summary> | ||
/// API methods related to Risk | ||
/// </summary> | ||
public class RiskClient : IRiskClient | ||
{ | ||
private readonly ProjectManagerClient _client; | ||
|
||
/// <summary> | ||
/// Constructor | ||
/// </summary> | ||
public RiskClient(ProjectManagerClient client) | ||
{ | ||
_client = client; | ||
} | ||
|
||
/// <summary> | ||
/// Initiates a new Export action for Risks. | ||
/// | ||
/// Returns the identifier of this Risk Export. | ||
/// </summary> | ||
/// <param name="projectId">The unique identifier of the Project for which to export Risks</param> | ||
/// <param name="body">The settings to use for this export action</param> | ||
public async Task<AstroResult<ExportDto>> CreateRiskExport(Guid projectId, RiskExportSettingsDto body) | ||
{ | ||
var url = $"/api/data/projects/{projectId}/risks/export"; | ||
return await _client.RequestWithBody<ExportDto>(HttpMethod.Post, url, null, body); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
* @author ProjectManager.com <[email protected]> | ||
* | ||
* @copyright 2023-2024 ProjectManager.com, Inc. | ||
* @version 117.0.4438 | ||
* @version 119.0.4625 | ||
* @link https://github.com/projectmgr/projectmanager-sdk-csharp | ||
*/ | ||
|
||
|
@@ -120,6 +120,10 @@ public interface IProjectManagerClient | |
/// </summary> | ||
IProjectTemplateClient ProjectTemplate { get; } | ||
/// <summary> | ||
/// API methods related to ProjectVersion | ||
/// </summary> | ||
IProjectVersionClient ProjectVersion { get; } | ||
/// <summary> | ||
/// API methods related to Resource | ||
/// </summary> | ||
IResourceClient Resource { get; } | ||
|
@@ -132,6 +136,10 @@ public interface IProjectManagerClient | |
/// </summary> | ||
IResourceTeamClient ResourceTeam { get; } | ||
/// <summary> | ||
/// API methods related to Risk | ||
/// </summary> | ||
IRiskClient Risk { get; } | ||
/// <summary> | ||
/// API methods related to Tag | ||
/// </summary> | ||
ITagClient Tag { get; } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/*** | ||
* ProjectManager API for C# | ||
* | ||
* (c) 2023-2024 ProjectManager.com, Inc. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author ProjectManager.com <[email protected]> | ||
* @copyright 2023-2024 ProjectManager.com, Inc. | ||
* @link https://github.com/projectmgr/projectmanager-sdk-csharp | ||
*/ | ||
|
||
|
||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using ProjectManager.SDK.Models; | ||
|
||
|
||
namespace ProjectManager.SDK.Interfaces | ||
{ | ||
/// <summary> | ||
/// API methods related to ProjectVersion | ||
/// </summary> | ||
public interface IProjectVersionClient | ||
{ | ||
|
||
/// <summary> | ||
/// Returns projects versions including version, user who made changes | ||
/// </summary> | ||
/// <param name="projectId">The unique identifier of the Project</param> | ||
Task<AstroResult<ProjectVersionDto[]>> RetrieveProjectVersions(Guid projectId); | ||
|
||
/// <summary> | ||
/// Exports and returns project version as an MS Project XML attachment | ||
/// </summary> | ||
/// <param name="projectChangeId">Project change Guid</param> | ||
Task<AstroResult<byte[]>> DownloadMSProjectXml(Guid projectChangeId); | ||
|
||
/// <summary> | ||
/// Restores a Project to the state it was in at a specific Version in time. | ||
/// | ||
/// If successful, all changes made to the Project since this Version will be undone and the Project will | ||
/// return to its former state. | ||
/// </summary> | ||
/// <param name="projectId">The unique identifier of the Project to restore</param> | ||
/// <param name="version">The version number to restore to</param> | ||
Task<AstroResult<string>> RestoreProjectVersion(Guid projectId, int version); | ||
|
||
/// <summary> | ||
/// Create a Copy of a Project as of a specific Version, optionally moving it to a new Timezone. | ||
/// </summary> | ||
/// <param name="projectId">The unique identifier of the Project to copy</param> | ||
/// <param name="version">The version number of the Project to copy</param> | ||
/// <param name="timezoneOffset">If specified, sets the default timezone of the newly copied Project to this specified timezone</param> | ||
Task<AstroResult<string>> CopyProjectVersion(Guid projectId, int version, int? timezoneOffset = null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/*** | ||
* ProjectManager API for C# | ||
* | ||
* (c) 2023-2024 ProjectManager.com, Inc. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author ProjectManager.com <[email protected]> | ||
* @copyright 2023-2024 ProjectManager.com, Inc. | ||
* @link https://github.com/projectmgr/projectmanager-sdk-csharp | ||
*/ | ||
|
||
|
||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using ProjectManager.SDK.Models; | ||
|
||
|
||
namespace ProjectManager.SDK.Interfaces | ||
{ | ||
/// <summary> | ||
/// API methods related to Risk | ||
/// </summary> | ||
public interface IRiskClient | ||
{ | ||
|
||
/// <summary> | ||
/// Initiates a new Export action for Risks. | ||
/// | ||
/// Returns the identifier of this Risk Export. | ||
/// </summary> | ||
/// <param name="projectId">The unique identifier of the Project for which to export Risks</param> | ||
/// <param name="body">The settings to use for this export action</param> | ||
Task<AstroResult<ExportDto>> CreateRiskExport(Guid projectId, RiskExportSettingsDto body); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.