Skip to content

Commit

Permalink
Merge pull request #43 from autodesk-platform-services/DAS-219
Browse files Browse the repository at this point in the history
[DAS 219] - Added Regions enum support
  • Loading branch information
sajith-subramanian authored Jun 6, 2024
2 parents 2b282ed + 47321a9 commit 958e181
Show file tree
Hide file tree
Showing 56 changed files with 3,452 additions and 1,703 deletions.
163 changes: 117 additions & 46 deletions issues/source/Http/IssueAttributeDefinitionsApi.gen.cs

Large diffs are not rendered by default.

169 changes: 123 additions & 46 deletions issues/source/Http/IssueAttributeMappingsApi.gen.cs

Large diffs are not rendered by default.

202 changes: 131 additions & 71 deletions issues/source/Http/IssueCommentsApi.gen.cs

Large diffs are not rendered by default.

151 changes: 105 additions & 46 deletions issues/source/Http/IssueRootCauseCategoriesApi.gen.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* APS SDK
*
* The Forge Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering.
* The APS Platform contains an expanding collection of web service components that can be used with Autodesk cloud-based products or your own technologies. Take advantage of Autodesk’s expertise in design and engineering.
*
* Construction.Issues
*
Expand Down Expand Up @@ -31,6 +31,7 @@
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Autodesk.SDKManager;
using System.Collections;

namespace Autodesk.Construction.Issues.Http
{
Expand All @@ -43,13 +44,30 @@ public interface IIssueRootCauseCategoriesApi
/// Your GET endpoint
/// </summary>
/// <remarks>
/// Retrieves a list of supported root cause categories and root causes that you can allocate to an issue. For example, communication and coordination.
///Retrieves a list of supported root cause categories and root causes that you can allocate to an issue. For example, communication and coordination.
/// </remarks>
/// <exception cref="HttpRequestException">Thrown when fails to make API call</exception>
/// <param name="projectId">The ID of the project.</param>/// <param name="xAdsRegion">The region where the bucket residesAcceptable values: &#x60;US&#x60;, &#x60;EMEA&#x60;</param>/// <param name="include">Add ‘include&#x3D;rootcauses’ to add the root causes for each category. (optional)</param>/// <param name="limit">Add limit&#x3D;20 to limit the results count (together with the offset to support pagination). (optional)</param>/// <param name="offset">Add offset&#x3D;20 to get partial results (together with the limit to support pagination) (optional)</param>/// <param name="filterUpdatedAt">Retrieves root cause categories updated at the specified date and time, in one of the following URL-encoded formats: YYYY-MM-DDThh:mm:ss.sz or YYYY-MM-DD. Separate multiple values with commas. (optional)</param>
/// <returns>Task of ApiResponse<IssueRootCause></returns>

System.Threading.Tasks.Task<ApiResponse<IssueRootCause>> GetRootCauseCategoriesAsync (string projectId,XAdsRegion xAdsRegion, string include= default(string), int? limit= default(int?), int? offset= default(int?), string filterUpdatedAt= default(string), string accessToken = null, bool throwOnError = true);
/// <param name="projectId">
///The ID of the project.
/// </param>
/// <param name="xAdsRegion">
/// (optional)
/// </param>
/// <param name="include">
///Add ‘include=rootcauses’ to add the root causes for each category. (optional)
/// </param>
/// <param name="limit">
///Add limit=20 to limit the results count (together with the offset to support pagination). (optional)
/// </param>
/// <param name="offset">
///Add offset=20 to get partial results (together with the limit to support pagination) (optional)
/// </param>
/// <param name="filterUpdatedAt">
///Retrieves root cause categories updated at the specified date and time, in one of the following URL-encoded formats: YYYY-MM-DDThh:mm:ss.sz or YYYY-MM-DD. Separate multiple values with commas. (optional)
/// </param>
/// <returns>Task of ApiResponse&lt;IssueRootCause&gt;</returns>

System.Threading.Tasks.Task<ApiResponse<IssueRootCause>> GetRootCauseCategoriesAsync(string projectId, Region? xAdsRegion = null, string include = default(string), int? limit = default(int?), int? offset = default(int?), string filterUpdatedAt = default(string), string accessToken = null, bool throwOnError = true);
}

/// <summary>
Expand All @@ -72,75 +90,114 @@ public IssueRootCauseCategoriesApi(SDKManager.SDKManager sdkManager)
}
private void SetQueryParameter(string name, object value, Dictionary<string, object> dictionary)
{
if(value is Enum)
if (value is Enum)
{
var type = value.GetType();
var memberInfos = type.GetMember(value.ToString());
var enumValueMemberInfo = memberInfos.FirstOrDefault(m => m.DeclaringType == type);
var valueAttributes = enumValueMemberInfo.GetCustomAttributes(typeof(EnumMemberAttribute), false);
if(valueAttributes.Length > 0)
if (valueAttributes.Length > 0)
{
dictionary.Add(name, ((EnumMemberAttribute)valueAttributes[0]).Value);
}
}
else if(value is int)
else if (value is int)
{
if((int)value > 0)
if ((int)value > 0)
{
dictionary.Add(name, value);
}
}
else if (value is IList)
{
if (value is List<string>)
{
value = String.Join(",",(List<string>)value);
dictionary.Add(name, value);
}
else
{
List<string>newlist = new List<string>();
foreach ( var x in (IList)value)
{
var type = x.GetType();
var memberInfos = type.GetMember(x.ToString());
var enumValueMemberInfo = memberInfos.FirstOrDefault(m => m.DeclaringType == type);
var valueAttributes = enumValueMemberInfo.GetCustomAttributes(typeof(EnumMemberAttribute), false);
newlist.Add(((EnumMemberAttribute)valueAttributes[0]).Value);
}
string joinedString = String.Join(",", newlist);
dictionary.Add(name, joinedString);
}
}
else
{
if(value != null)
if (value != null)
{
dictionary.Add(name, value);
}
}
}
private void SetHeader(string baseName, object value, HttpRequestMessage req)
{
if(value is DateTime)
if (value is DateTime)
{
if ((DateTime)value != DateTime.MinValue)
{
if((DateTime)value != DateTime.MinValue)
req.Headers.TryAddWithoutValidation(baseName, LocalMarshalling.ParameterToString(value)); // header parameter
}
}
else
{
if (value != null)
{
if (!string.Equals(baseName, "Content-Range"))
{
req.Headers.TryAddWithoutValidation(baseName, LocalMarshalling.ParameterToString(value)); // header parameter
}
}
else
{
if (value != null)
else
{
if(!string.Equals(baseName, "Content-Range"))
{
req.Headers.TryAddWithoutValidation(baseName, LocalMarshalling.ParameterToString(value)); // header parameter
}
else
{
req.Content.Headers.Add(baseName, LocalMarshalling.ParameterToString(value));
}
req.Content.Headers.Add(baseName, LocalMarshalling.ParameterToString(value));
}
}
}

}

/// <summary>
/// Gets or sets the ApsConfiguration object
/// </summary>
/// <value>An instance of the ForgeService</value>
public ForgeService Service {get; set;}
public ForgeService Service { get; set; }

/// <summary>
/// Your GET endpoint
/// </summary>
/// <remarks>
/// Retrieves a list of supported root cause categories and root causes that you can allocate to an issue. For example, communication and coordination.
///Retrieves a list of supported root cause categories and root causes that you can allocate to an issue. For example, communication and coordination.
/// </remarks>
/// <exception cref="HttpRequestException">Thrown when fails to make API call</exception>
/// <param name="projectId">The ID of the project.</param>/// <param name="xAdsRegion">The region where the bucket residesAcceptable values: &#x60;US&#x60;, &#x60;EMEA&#x60;</param>/// <param name="include">Add ‘include&#x3D;rootcauses’ to add the root causes for each category. (optional)</param>/// <param name="limit">Add limit&#x3D;20 to limit the results count (together with the offset to support pagination). (optional)</param>/// <param name="offset">Add offset&#x3D;20 to get partial results (together with the limit to support pagination) (optional)</param>/// <param name="filterUpdatedAt">Retrieves root cause categories updated at the specified date and time, in one of the following URL-encoded formats: YYYY-MM-DDThh:mm:ss.sz or YYYY-MM-DD. Separate multiple values with commas. (optional)</param>
/// <returns>Task of ApiResponse<IssueRootCause></returns>

public async System.Threading.Tasks.Task<ApiResponse<IssueRootCause>> GetRootCauseCategoriesAsync (string projectId, XAdsRegion xAdsRegion,string include= default(string),int? limit= default(int?),int? offset= default(int?),string filterUpdatedAt= default(string), string accessToken = null, bool throwOnError = true)
/// <param name="projectId">
///The ID of the project.
/// </param>
/// <param name="xAdsRegion">
/// (optional)
/// </param>
/// <param name="include">
///Add ‘include=rootcauses’ to add the root causes for each category. (optional)
/// </param>
/// <param name="limit">
///Add limit=20 to limit the results count (together with the offset to support pagination). (optional)
/// </param>
/// <param name="offset">
///Add offset=20 to get partial results (together with the limit to support pagination) (optional)
/// </param>
/// <param name="filterUpdatedAt">
///Retrieves root cause categories updated at the specified date and time, in one of the following URL-encoded formats: YYYY-MM-DDThh:mm:ss.sz or YYYY-MM-DD. Separate multiple values with commas. (optional)
/// </param>
/// <returns>Task of ApiResponse&lt;IssueRootCause&gt;></returns>

public async System.Threading.Tasks.Task<ApiResponse<IssueRootCause>> GetRootCauseCategoriesAsync(string projectId, Region? xAdsRegion = null, string include = default(string), int? limit = default(int?), int? offset = default(int?), string filterUpdatedAt = default(string), string accessToken = null, bool throwOnError = true)
{
logger.LogInformation("Entered into GetRootCauseCategoriesAsync ");
using (var request = new HttpRequestMessage())
Expand All @@ -159,43 +216,43 @@ private void SetHeader(string baseName, object value, HttpRequestMessage req)
);

request.Headers.TryAddWithoutValidation("Accept", "application/json");
request.Headers.TryAddWithoutValidation("User-Agent", "APS SDK/CONSTRUCTION.ISSUES/C#/0.0.1");
if(!string.IsNullOrEmpty(accessToken))
request.Headers.TryAddWithoutValidation("User-Agent", "APS SDK/CONSTRUCTION.ISSUES/C#/1.0.0-beta1");
if (!string.IsNullOrEmpty(accessToken))
{
request.Headers.TryAddWithoutValidation("Authorization", $"Bearer {accessToken}");
}



SetHeader("x-ads-region", (xAdsRegion.ToString().ToLowerInvariant()), request);
SetHeader("x-ads-region", xAdsRegion, request);

// tell the underlying pipeline what scope we'd like to use
// if (scopes == null)
// {
// TBD:Naren FORCE-4027 - If accessToken is null, acquire auth token using auth SDK, with defined scope.
// request.Properties.Add(ForgeApsConfiguration.ScopeKey.ToString(), "");
// TBD:Naren FORCE-4027 - If accessToken is null, acquire auth token using auth SDK, with defined scope.
// request.Properties.Add(ForgeApsConfiguration.ScopeKey.ToString(), "");
// }
// else
// {
// request.Properties.Add(ForgeApsConfiguration.ScopeKey.ToString(), scopes);
// request.Properties.Add(ForgeApsConfiguration.ScopeKey.ToString(), scopes);
// }
// if (scopes == null)
// {
// TBD:Naren FORCE-4027 - If accessToken is null, acquire auth token using auth SDK, with defined scope.
// request.Properties.Add(ForgeApsConfiguration.ScopeKey.ToString(), "");
// TBD:Naren FORCE-4027 - If accessToken is null, acquire auth token using auth SDK, with defined scope.
// request.Properties.Add(ForgeApsConfiguration.ScopeKey.ToString(), "");
// }
// else
// {
// request.Properties.Add(ForgeApsConfiguration.ScopeKey.ToString(), scopes);
// request.Properties.Add(ForgeApsConfiguration.ScopeKey.ToString(), scopes);
// }
// if (scopes == null)
// {
// TBD:Naren FORCE-4027 - If accessToken is null, acquire auth token using auth SDK, with defined scope.
// request.Properties.Add(ForgeApsConfiguration.ScopeKey.ToString(), "");
// TBD:Naren FORCE-4027 - If accessToken is null, acquire auth token using auth SDK, with defined scope.
// request.Properties.Add(ForgeApsConfiguration.ScopeKey.ToString(), "");
// }
// else
// {
// request.Properties.Add(ForgeApsConfiguration.ScopeKey.ToString(), scopes);
// request.Properties.Add(ForgeApsConfiguration.ScopeKey.ToString(), scopes);
// }

request.Method = new HttpMethod("GET");
Expand All @@ -207,9 +264,11 @@ private void SetHeader(string baseName, object value, HttpRequestMessage req)
{
try
{
await response.EnsureSuccessStatusCodeAsync();
} catch (HttpRequestException ex) {
throw new ConstructionissuesApiException(ex.Message, response, ex);
await response.EnsureSuccessStatusCodeAsync();
}
catch (HttpRequestException ex)
{
throw new ConstructionissuesApiException(ex.Message, response, ex);
}
}
else if (!response.IsSuccessStatusCode)
Expand Down
Loading

0 comments on commit 958e181

Please sign in to comment.