Skip to content

Commit

Permalink
[New] Human Task Resource API (#105)
Browse files Browse the repository at this point in the history
* Human task APIs 

---------

Co-authored-by: Katari.Manikanta <Katari.manikanta@dynamic-wilreless.com>
  • Loading branch information
Mkatari3700 and Katari.Manikanta authored Feb 22, 2024
1 parent 0278918 commit d214c4b
Show file tree
Hide file tree
Showing 17 changed files with 5,476 additions and 153 deletions.
2,830 changes: 2,830 additions & 0 deletions Conductor/Api/HumanTaskResourceApi.cs

Large diffs are not rendered by default.

446 changes: 446 additions & 0 deletions Conductor/Api/IHumanTaskResourceApi.cs

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions Conductor/Client/ApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Text;
using Newtonsoft.Json;
using RestSharp;
using System.Threading.Tasks;

namespace Conductor.Client
{
Expand Down Expand Up @@ -175,6 +176,23 @@ public Object CallApi(
return (Object)response;
}

public async Task<object> CallApiAsync(
String path, RestSharp.Method method, List<KeyValuePair<String, String>> queryParams, Object postBody,
Dictionary<String, String> headerParams, Dictionary<String, String> formParams,
Dictionary<String, FileParameter> fileParams, Dictionary<String, String> pathParams,
String contentType)
{
var request = PrepareRequest(
path, method, queryParams, postBody, headerParams, formParams, fileParams,
pathParams, contentType);

InterceptRequest(request);
var response = await RestClient.ExecuteAsync(request, method);
InterceptResponse(request, response);
FormatHeaders(response);
return (object)response;
}

/// <summary>
/// To combine the header of same key with different value into one.
/// </summary>
Expand Down
14 changes: 14 additions & 0 deletions Conductor/Client/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Conductor.Client
{
/// <summary>
/// Global level constant variables
/// </summary>
public static class Constants
{
public const string KEY_ID = "<REPLACE_WITH_KEY_ID>";
public const string KEY_SECRET = "<REPLACE_WITH_KEY_SECRET>";
public const string OWNER_EMAIL = "<REPLACE_WITH_OWNER_EMAIL>";
public const int REST_CLIENT_REQUEST_TIME_OUT = 20000;

}
}
122 changes: 122 additions & 0 deletions Conductor/Client/Models/HumanTaskAssignment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using System.Text;

namespace Conductor.Client.Models
{
/// <summary>
/// HumanTaskAssignment
/// </summary>
[DataContract]
public partial class HumanTaskAssignment : IEquatable<HumanTaskAssignment>, IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="HumanTaskAssignment" /> class.
/// </summary>
/// <param name="assignee">assignee.</param>
/// <param name="slaMinutes">slaMinutes.</param>
public HumanTaskAssignment(HumanTaskUser assignee = default(HumanTaskUser), long? slaMinutes = default(long?))
{
this.Assignee = assignee;
this.SlaMinutes = slaMinutes;
}

/// <summary>
/// Gets or Sets Assignee
/// </summary>
[DataMember(Name = "assignee", EmitDefaultValue = false)]
public HumanTaskUser Assignee { get; set; }

/// <summary>
/// Gets or Sets SlaMinutes
/// </summary>
[DataMember(Name = "slaMinutes", EmitDefaultValue = false)]
public long? SlaMinutes { get; set; }

/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class HumanTaskAssignment {\n");
sb.Append(" Assignee: ").Append(Assignee).Append("\n");
sb.Append(" SlaMinutes: ").Append(SlaMinutes).Append("\n");
sb.Append("}\n");
return sb.ToString();
}

/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}

/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
{
return this.Equals(input as HumanTaskAssignment);
}

/// <summary>
/// Returns true if HumanTaskAssignment instances are equal
/// </summary>
/// <param name="input">Instance of HumanTaskAssignment to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(HumanTaskAssignment input)
{
if (input == null)
return false;

return
(
this.Assignee == input.Assignee ||
(this.Assignee != null &&
this.Assignee.Equals(input.Assignee))
) &&
(
this.SlaMinutes == input.SlaMinutes ||
(this.SlaMinutes != null &&
this.SlaMinutes.Equals(input.SlaMinutes))
);
}

/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.Assignee != null)
hashCode = hashCode * 59 + this.Assignee.GetHashCode();
if (this.SlaMinutes != null)
hashCode = hashCode * 59 + this.SlaMinutes.GetHashCode();
return hashCode;
}
}

/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
}
191 changes: 191 additions & 0 deletions Conductor/Client/Models/HumanTaskDefinition.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace Conductor.Client.Models
{
/// <summary>
/// HumanTaskDefinition
/// </summary>
[DataContract]
public partial class HumanTaskDefinition : IEquatable<HumanTaskDefinition>, IValidatableObject
{
/// <summary>
/// Defines AssignmentCompletionStrategy
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum AssignmentCompletionStrategyEnum
{
/// <summary>
/// Enum LEAVEOPEN for value: LEAVE_OPEN
/// </summary>
[EnumMember(Value = "LEAVE_OPEN")]
LEAVEOPEN = 1,
/// <summary>
/// Enum TERMINATE for value: TERMINATE
/// </summary>
[EnumMember(Value = "TERMINATE")]
TERMINATE = 2
}
/// <summary>
/// Gets or Sets AssignmentCompletionStrategy
/// </summary>
[DataMember(Name = "assignmentCompletionStrategy", EmitDefaultValue = false)]
public AssignmentCompletionStrategyEnum? AssignmentCompletionStrategy { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="HumanTaskDefinition" /> class.
/// </summary>
/// <param name="assignmentCompletionStrategy">assignmentCompletionStrategy.</param>
/// <param name="assignments">assignments.</param>
/// <param name="displayName">displayName.</param>
/// <param name="taskTriggers">taskTriggers.</param>
/// <param name="userFormTemplate">userFormTemplate.</param>
public HumanTaskDefinition(AssignmentCompletionStrategyEnum? assignmentCompletionStrategy = default(AssignmentCompletionStrategyEnum?), List<HumanTaskAssignment> assignments = default(List<HumanTaskAssignment>), string displayName = default(string), List<HumanTaskTrigger> taskTriggers = default(List<HumanTaskTrigger>), UserFormTemplate userFormTemplate = default(UserFormTemplate))
{
this.AssignmentCompletionStrategy = assignmentCompletionStrategy;
this.Assignments = assignments;
this.DisplayName = displayName;
this.TaskTriggers = taskTriggers;
this.UserFormTemplate = userFormTemplate;
}


/// <summary>
/// Gets or Sets Assignments
/// </summary>
[DataMember(Name = "assignments", EmitDefaultValue = false)]
public List<HumanTaskAssignment> Assignments { get; set; }

/// <summary>
/// Gets or Sets DisplayName
/// </summary>
[DataMember(Name = "displayName", EmitDefaultValue = false)]
public string DisplayName { get; set; }

/// <summary>
/// Gets or Sets TaskTriggers
/// </summary>
[DataMember(Name = "taskTriggers", EmitDefaultValue = false)]
public List<HumanTaskTrigger> TaskTriggers { get; set; }

/// <summary>
/// Gets or Sets UserFormTemplate
/// </summary>
[DataMember(Name = "userFormTemplate", EmitDefaultValue = false)]
public UserFormTemplate UserFormTemplate { get; set; }

/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("class HumanTaskDefinition {\n");
sb.Append(" AssignmentCompletionStrategy: ").Append(AssignmentCompletionStrategy).Append("\n");
sb.Append(" Assignments: ").Append(Assignments).Append("\n");
sb.Append(" DisplayName: ").Append(DisplayName).Append("\n");
sb.Append(" TaskTriggers: ").Append(TaskTriggers).Append("\n");
sb.Append(" UserFormTemplate: ").Append(UserFormTemplate).Append("\n");
sb.Append("}\n");
return sb.ToString();
}

/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return JsonConvert.SerializeObject(this, Formatting.Indented);
}

/// <summary>
/// Returns true if objects are equal
/// </summary>
/// <param name="input">Object to be compared</param>
/// <returns>Boolean</returns>
public override bool Equals(object input)
{
return this.Equals(input as HumanTaskDefinition);
}

/// <summary>
/// Returns true if HumanTaskDefinition instances are equal
/// </summary>
/// <param name="input">Instance of HumanTaskDefinition to be compared</param>
/// <returns>Boolean</returns>
public bool Equals(HumanTaskDefinition input)
{
if (input == null)
return false;

return
(
this.AssignmentCompletionStrategy == input.AssignmentCompletionStrategy ||
(this.AssignmentCompletionStrategy != null &&
this.AssignmentCompletionStrategy.Equals(input.AssignmentCompletionStrategy))
) &&
(
this.Assignments == input.Assignments ||
this.Assignments != null &&
input.Assignments != null &&
this.Assignments.SequenceEqual(input.Assignments)
) &&
(
this.DisplayName == input.DisplayName ||
(this.DisplayName != null &&
this.DisplayName.Equals(input.DisplayName))
) &&
(
this.TaskTriggers == input.TaskTriggers ||
this.TaskTriggers != null &&
input.TaskTriggers != null &&
this.TaskTriggers.SequenceEqual(input.TaskTriggers)
) &&
(
this.UserFormTemplate == input.UserFormTemplate ||
(this.UserFormTemplate != null &&
this.UserFormTemplate.Equals(input.UserFormTemplate))
);
}

/// <summary>
/// Gets the hash code
/// </summary>
/// <returns>Hash code</returns>
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.AssignmentCompletionStrategy != null)
hashCode = hashCode * 59 + this.AssignmentCompletionStrategy.GetHashCode();
if (this.Assignments != null)
hashCode = hashCode * 59 + this.Assignments.GetHashCode();
if (this.DisplayName != null)
hashCode = hashCode * 59 + this.DisplayName.GetHashCode();
if (this.TaskTriggers != null)
hashCode = hashCode * 59 + this.TaskTriggers.GetHashCode();
if (this.UserFormTemplate != null)
hashCode = hashCode * 59 + this.UserFormTemplate.GetHashCode();
return hashCode;
}
}

/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
}
Loading

0 comments on commit d214c4b

Please sign in to comment.