-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Automation endpoint and multiple fixes. See notes.
- Loading branch information
1 parent
4c89964
commit 1a4cfd4
Showing
7 changed files
with
121 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using EmmaSharp.Models.Automation; | ||
using RestSharp; | ||
using RestSharp.Serializers; | ||
using System.Collections.Generic; | ||
|
||
namespace EmmaSharp | ||
{ | ||
public partial class EmmaApi | ||
{ | ||
#region Automation | ||
|
||
/// <summary> | ||
/// Gets a list of this account’s automation workflows. | ||
/// </summary> | ||
/// <returns>A list of automation workflows in the given account.</returns> | ||
public List<Workflow> GetWorkflows() | ||
{ | ||
var request = new RestRequest(); | ||
request.Resource = "/{accountId}/automation/workflows"; | ||
|
||
return Execute<List<Workflow>>(request); | ||
} | ||
|
||
/// <summary> | ||
/// Gets detailed information about a single workflow. | ||
/// </summary> | ||
/// <param name="workflowId">The ID of the Workflow to return.</param> | ||
/// <returns>A single workflow if one exists</returns> | ||
public Workflow GetWorkflowById(string workflowId) | ||
{ | ||
var request = new RestRequest(); | ||
request.Resource = "/{accountId}/automation/workflows/{workflowId}"; | ||
request.AddUrlSegment("workflowId", workflowId); | ||
|
||
return Execute<Workflow>(request); | ||
} | ||
|
||
/// <summary> | ||
/// Gets the counts of workflows for this account by workflow state. | ||
/// </summary> | ||
/// <returns>Returns counts for the workflow by state ("active", "inactive" and "draft").</returns> | ||
public WorkflowCount GetWorkflowCounts() | ||
{ | ||
var request = new RestRequest(); | ||
request.Resource = "/{accountId}/automation/counts"; | ||
|
||
return Execute<WorkflowCount>(request); | ||
} | ||
|
||
#endregion | ||
} | ||
} |
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,53 @@ | ||
using EmmaSharp.Extensions; | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Runtime.Serialization; | ||
|
||
namespace EmmaSharp.Models.Automation | ||
{ | ||
public class Workflow | ||
{ | ||
[JsonProperty("workflow_id")] | ||
public string WorkflowId { get; set; } | ||
|
||
[JsonProperty("name")] | ||
public string Name { get; set; } | ||
|
||
[JsonProperty("status")] | ||
public WorkflowStatus Status { get; set; } | ||
|
||
[JsonConverter(typeof(EmmaDateConverter))] | ||
[JsonProperty("updated_at")] | ||
public DateTime UpdatedAt { get; set; } | ||
|
||
[JsonConverter(typeof(EmmaDateConverter))] | ||
[JsonProperty("created_at")] | ||
public DateTime CreatedAt { get; set; } | ||
} | ||
|
||
public enum WorkflowStatus | ||
{ | ||
[EnumMember(Value = "active")] | ||
Active, | ||
[EnumMember(Value = "inactive")] | ||
Inactive, | ||
[EnumMember(Value = "draft")] | ||
Draft | ||
} | ||
|
||
public class WorkflowCount | ||
{ | ||
[JsonProperty("account_id")] | ||
public int? AccountId { get; set; } | ||
|
||
[JsonProperty("draft")] | ||
public int Draft { get; set; } | ||
|
||
[JsonProperty("active")] | ||
public int Active { get; set; } | ||
|
||
[JsonProperty("inactive")] | ||
public int Inactive { get; set; } | ||
} | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,12 +1,10 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace EmmaSharp.Models.Members | ||
{ | ||
public class MembersAdd | ||
{ | ||
[JsonProperty("import_id")] | ||
public int ImportId { get; set; } | ||
public long ImportId { get; set; } | ||
} | ||
} |
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