Skip to content

Commit

Permalink
-Added BatchWebHooks
Browse files Browse the repository at this point in the history
-Enhancements
  • Loading branch information
Brandon's Surface authored and Brandon's Surface committed Jul 14, 2017
1 parent 3e44563 commit 4155f19
Show file tree
Hide file tree
Showing 52 changed files with 186 additions and 69 deletions.
37 changes: 37 additions & 0 deletions MailChimp.Net.Tests/BatchWebHookTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="AuthorizedAppTest.cs" company="Brandon Seydel">
// N/A
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

using System.Linq;
using System.Threading.Tasks;
using MailChimp.Net.Models;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace MailChimp.Net.Tests
{
/// <summary>
/// The api test.
/// </summary>
[TestClass]
public class BatchWebHookTest : MailChimpTest
{
/// <summary>
/// The should_ return_ ap i_ information.
/// </summary>
/// <returns>
/// The <see cref="Task"/>.
/// </returns>
[TestMethod]
public async Task Should_Create_Batch_Webhook()
{

var batches = await this.MailChimpManager.BatchWebHooks.GetAllAsync().ConfigureAwait(false);
Task.WhenAll(batches.ToList().Select(x => this.MailChimpManager.BatchWebHooks.DeleteAsync(x.Id)));

var apiInfo = await this.MailChimpManager.BatchWebHooks.AddAsync("http://asdfasdf.com").ConfigureAwait(false);
Assert.IsNotNull(apiInfo);
}
}
}
1 change: 0 additions & 1 deletion MailChimp.Net.Tests/ListWebhookTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Threading.Tasks;
using FluentAssertions;
using MailChimp.Net.Core;
using MailChimp.Net.Models;
using Microsoft.VisualStudio.TestTools.UnitTesting;

Expand Down
1 change: 1 addition & 0 deletions MailChimp.Net.Tests/MailChimp.Net.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
</Otherwise>
</Choose>
<ItemGroup>
<Compile Include="BatchWebHookTest.cs" />
<Compile Include="ECommerceLogicTest.cs" />
<Compile Include="ApiTest.cs" />
<Compile Include="ConversationTest.cs" />
Expand Down
1 change: 0 additions & 1 deletion MailChimp.Net.Tests/SegmentTest.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MailChimp.Net.Core;
using MailChimp.Net.Models;
Expand Down
2 changes: 0 additions & 2 deletions MailChimp.Net/Core/BaseLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@

using System;
using System.Net.Http;
using System.Reflection;
using System.Security.Cryptography;
using System.Text;
using MailChimp.Net.Interfaces;

#pragma warning disable 1584,1711,1572,1581,1580
Expand Down
1 change: 0 additions & 1 deletion MailChimp.Net/Core/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

using System;
using System.IO;
using System.Net;
using System.Net.Http;
Expand Down
20 changes: 20 additions & 0 deletions MailChimp.Net/Core/Responses/BatchWebHookResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MailChimp.Net.Models;
using Newtonsoft.Json;

namespace MailChimp.Net.Core
{
public class BatchWebHookResponse
{
[JsonProperty("webhooks")]
public IEnumerable<BatchWebHook> WebHooks { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
[JsonProperty("_links")]
public IEnumerable<Link> Links { get; set; }
}
}
2 changes: 0 additions & 2 deletions MailChimp.Net/Interfaces/IAbuseReportLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

namespace MailChimp.Net.Interfaces
{
using System;

/// <summary>
/// The AbuseReportLogic interface.
/// </summary>
Expand Down
1 change: 0 additions & 1 deletion MailChimp.Net/Interfaces/IActivityLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Threading.Tasks;

Expand Down
2 changes: 0 additions & 2 deletions MailChimp.Net/Interfaces/IAuthorizedAppLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

namespace MailChimp.Net.Interfaces
{
using System;

/// <summary>
/// The AuthorizedAppLogic interface.
/// </summary>
Expand Down
1 change: 0 additions & 1 deletion MailChimp.Net/Interfaces/IAutomationEmailLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace MailChimp.Net.Interfaces
{
using System;

using Core;

Expand Down
1 change: 0 additions & 1 deletion MailChimp.Net/Interfaces/IAutomationEmailQueueLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace MailChimp.Net.Interfaces
{
using System;

using Core;

Expand Down
1 change: 0 additions & 1 deletion MailChimp.Net/Interfaces/IAutomationLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Threading.Tasks;

Expand Down
1 change: 0 additions & 1 deletion MailChimp.Net/Interfaces/IAutomationSubscriberLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace MailChimp.Net.Interfaces
{
using System;

using Core;

Expand Down
16 changes: 16 additions & 0 deletions MailChimp.Net/Interfaces/IBatchWebhookLogic.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using MailChimp.Net.Core;
using MailChimp.Net.Models;

namespace MailChimp.Net.Interfaces
{
public interface IBatchWebHookLogic
{
Task DeleteAsync(string batchWebHookId);
Task<BatchWebHook> UpdateAsync(string batchWebHookId, string url);
Task<BatchWebHook> AddAsync(string url);
Task<BatchWebHookResponse> GetResponseAsync(QueryableBaseRequest request = null);
Task<IEnumerable<BatchWebHook>> GetAllAsync(QueryableBaseRequest request = null);
}
}
2 changes: 0 additions & 2 deletions MailChimp.Net/Interfaces/IClientLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

namespace MailChimp.Net.Interfaces
{
using System;

/// <summary>
/// The ClientLogic interface.
/// </summary>
Expand Down
2 changes: 0 additions & 2 deletions MailChimp.Net/Interfaces/IConversationLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

namespace MailChimp.Net.Interfaces
{
using System;

/// <summary>
/// The ConversationLogic interface.
/// </summary>
Expand Down
2 changes: 0 additions & 2 deletions MailChimp.Net/Interfaces/IFeedbackLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

namespace MailChimp.Net.Interfaces
{
using System;

/// <summary>
/// The FeedbackLogic interface.
/// </summary>
Expand Down
2 changes: 0 additions & 2 deletions MailChimp.Net/Interfaces/IGrowthHistoryLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

namespace MailChimp.Net.Interfaces
{
using System;

/// <summary>
/// The GrowthHistoryLogic interface.
/// </summary>
Expand Down
2 changes: 0 additions & 2 deletions MailChimp.Net/Interfaces/IInterestCategoryLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

namespace MailChimp.Net.Interfaces
{
using System;

/// <summary>
/// The InterestCategoryLogic interface.
/// </summary>
Expand Down
2 changes: 0 additions & 2 deletions MailChimp.Net/Interfaces/IInterestLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

namespace MailChimp.Net.Interfaces
{
using System;

/// <summary>
/// The InterestLogic interface.
/// </summary>
Expand Down
2 changes: 0 additions & 2 deletions MailChimp.Net/Interfaces/IListLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

namespace MailChimp.Net.Interfaces
{
using System;

/// <summary>
/// The ListLogic interface.
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions MailChimp.Net/Interfaces/IMailChimpManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,11 @@ public interface IMailChimpManager
/// Gets othe batch logic layer to talk to Mail Chimp
/// </summary>
IBatchLogic Batches { get; }

/// <summary>
/// Gets or Sets batch web hooks
/// </summary>
IBatchWebHookLogic BatchWebHooks { get; }

}
}
10 changes: 4 additions & 6 deletions MailChimp.Net/Interfaces/IMemberLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@

namespace MailChimp.Net.Interfaces
{
using System;

/// <summary>
/// The MemberLogic interface.
/// </summary>
public interface IMemberLogic
/// <summary>
/// The MemberLogic interface.
/// </summary>
public interface IMemberLogic
{
/// <summary>
/// The add or update async.
Expand Down
2 changes: 0 additions & 2 deletions MailChimp.Net/Interfaces/ITemplateFolderLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

namespace MailChimp.Net.Interfaces
{
using System;

/// <summary>
/// The TemplateFolderLogic interface.
/// </summary>
Expand Down
1 change: 0 additions & 1 deletion MailChimp.Net/Interfaces/ITemplateLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using MailChimp.Net.Core;
Expand Down
1 change: 0 additions & 1 deletion MailChimp.Net/Logic/AbuseReportLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using static System.Net.Http.HttpContentExtensions;
using System.Threading.Tasks;
Expand Down
1 change: 0 additions & 1 deletion MailChimp.Net/Logic/ActivityLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using static System.Net.Http.HttpContentExtensions;
using System.Threading.Tasks;
Expand Down
1 change: 0 additions & 1 deletion MailChimp.Net/Logic/ApiLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

using System;
using static System.Net.Http.HttpContentExtensions;
using System.Threading.Tasks;

Expand Down
1 change: 0 additions & 1 deletion MailChimp.Net/Logic/AuthorizedAppLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;

using System.Threading.Tasks;
Expand Down
1 change: 0 additions & 1 deletion MailChimp.Net/Logic/AutomationEmailLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using static System.Net.Http.HttpContentExtensions;
using System.Threading.Tasks;
Expand Down
1 change: 0 additions & 1 deletion MailChimp.Net/Logic/AutomationEmailQueueLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using static System.Net.Http.HttpContentExtensions;
using System.Threading.Tasks;
Expand Down
1 change: 0 additions & 1 deletion MailChimp.Net/Logic/AutomationLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using static System.Net.Http.HttpContentExtensions;
using System.Threading.Tasks;
Expand Down
1 change: 0 additions & 1 deletion MailChimp.Net/Logic/AutomationSubscriberLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using static System.Net.Http.HttpContentExtensions;
using System.Threading.Tasks;
Expand Down
Loading

0 comments on commit 4155f19

Please sign in to comment.