Skip to content

Commit

Permalink
v6.4. Replaced ApplicableProductList and ApplicableProduct. Added lis…
Browse files Browse the repository at this point in the history
…ting Promotion Tiers (#36)

Refactored filters
  • Loading branch information
bandraszyk authored Feb 3, 2019
1 parent cca889a commit b09b1d3
Show file tree
Hide file tree
Showing 31 changed files with 127 additions and 91 deletions.
Binary file modified lib/net2.0/Voucherify.Client.dll
Binary file not shown.
Binary file modified lib/net2.0/Voucherify.dll
Binary file not shown.
Binary file modified lib/net3.5/Voucherify.Client.dll
Binary file not shown.
Binary file modified lib/net3.5/Voucherify.dll
Binary file not shown.
Binary file modified lib/net4.0/Voucherify.Client.dll
Binary file not shown.
Binary file modified lib/net4.0/Voucherify.dll
Binary file not shown.
Binary file modified lib/net4.5/Voucherify.Client.dll
Binary file not shown.
Binary file modified lib/net4.5/Voucherify.dll
Binary file not shown.
Binary file modified lib/netstandard2.0/Voucherify.Client.dll
Binary file not shown.
Binary file modified lib/netstandard2.0/Voucherify.dll
Binary file not shown.
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,8 @@ Bug reports and pull requests are welcome through [GitHub Issues](https://github

## Changelog


- **2019-02-03** - `6.4.0` - Replaced ApplicableProductList and ApplicableProduct. Added listing Promotion Tiers method.
- **2019-01-29** - `6.3.0` - Reorganized Delete methods with force option for: Voucher, Campaign, Product and Sku
- **2019-01-28** - `6.2.0` - Added ApplicableTo property to Validation class
- **2019-01-25** - `6.1.0` - Extended OrderItem OrderItemProduct OrderItemSKU. Improved QuerySerializer
Expand Down
5 changes: 5 additions & 0 deletions src/Voucherify/ApiEndpoints/Promotions.Async.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ public Promotions(Api api) : base(api)
{
}

public async Task<DataModel.PromotionTierList> List(DataModel.Queries.PromotionTiersFilter filter)
{
UriBuilder uriBuilder = UriBuilderExtension.WithQuery(this.client.GetUriBuilder("/promotions/tiers"), filter);
return await this.client.DoGetRequest<DataModel.PromotionTierList>(uriBuilder.Uri).ConfigureAwait(false);
}

public async Task<DataModel.PromotionTier> Get(string promotionTierId)
{
Expand Down
7 changes: 7 additions & 0 deletions src/Voucherify/ApiEndpoints/Promotions.Callback.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#if VOUCHERIFYSERVER && !APIASYNC
using System;
using Voucherify.Core.Communication;
using Voucherify.Core.Extensions;

namespace Voucherify.ApiEndpoints
{
Expand All @@ -10,6 +11,12 @@ public Promotions(Api api) : base(api)
{
}

public void List(DataModel.Queries.PromotionTiersFilter filter, Action<ApiResponse<DataModel.PromotionTierList>> callback)
{
UriBuilder uriBuilder = UriBuilderExtension.WithQuery(this.client.GetUriBuilder("/promotions/tiers"), filter);
this.client.DoGetRequest<DataModel.PromotionTierList>(uriBuilder.Uri, callback);
}

public void Get(string promotionTierId, Action<ApiResponse<DataModel.PromotionTier>> callback)
{
UriBuilder uriBuilder = this.client.GetUriBuilder(string.Format("/promotions/tiers/{0}", Uri.EscapeDataString(promotionTierId)));
Expand Down
26 changes: 20 additions & 6 deletions src/Voucherify/Client/Api.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,21 @@ public Client.ApiEndpoints.Validations Validations
}
}

private Client.ApiEndpoints.Promotions promotions;

public Client.ApiEndpoints.Promotions Promotions
{
get
{
if (promotions == null)
{
promotions = new ApiEndpoints.Promotions(this);
}

return promotions;
}
}

public Api(string appId, string appToken, string origin)
{
if (string.IsNullOrEmpty(appToken))
Expand Down Expand Up @@ -98,6 +113,7 @@ public Api WithSSL()
this.validations = null;
this.redemptions = null;
this.events = null;
this.promotions = null;
return this;
}

Expand All @@ -107,20 +123,17 @@ public Api WithoutSSL()
this.validations = null;
this.redemptions = null;
this.events = null;
this.promotions = null;
return this;
}

public Api WithEndpoint(string endpoint)
{
this.Endpoint = endpoint;
this.Endpoint = endpoint ?? Core.Constants.EndpointApi;
this.validations = null;
this.redemptions = null;
this.events = null;

if (endpoint == null)
{
this.Endpoint = Core.Constants.EndpointApi;
}
this.promotions = null;

return this;
}
Expand All @@ -132,6 +145,7 @@ public Api WithVersion(ApiVersion apiVersion)
this.validations = null;
this.redemptions = null;
this.events = null;
this.promotions = null;

return this;
}
Expand Down
22 changes: 22 additions & 0 deletions src/Voucherify/Client/ApiEndpoints/Promotions.Async.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#if VOUCHERIFYCLIENT && APIASYNC
using System;
using System.Threading.Tasks;
using Voucherify.Core.Communication;
using Voucherify.Core.Extensions;

namespace Voucherify.Client.ApiEndpoints
{
public class Promotions : EndpointBase
{
public Promotions(Api api) : base(api)
{
}

public async Task<DataModel.PromotionTierList> List(DataModel.Queries.PromotionTiersFilter filter)
{
UriBuilder uriBuilder = UriBuilderExtension.WithQuery(this.client.GetUriBuilder("/promotions/tiers"), filter);
return await this.client.DoGetRequest<DataModel.PromotionTierList>(uriBuilder.Uri).ConfigureAwait(false);
}
}
}
#endif
21 changes: 21 additions & 0 deletions src/Voucherify/Client/ApiEndpoints/Promotions.Callback.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#if VOUCHERIFYCLIENT && !APIASYNC
using System;
using Voucherify.Core.Communication;
using Voucherify.Core.Extensions;

namespace Voucherify.Client.ApiEndpoints
{
public class Promotions : EndpointBase
{
public Promotions(Api api) : base(api)
{
}

public void List(DataModel.Queries.PromotionTiersFilter filter, Action<ApiResponse<DataModel.PromotionTierList>> callback)
{
UriBuilder uriBuilder = UriBuilderExtension.WithQuery(this.client.GetUriBuilder("/promotions/tiers"), filter);
this.client.DoGetRequest<DataModel.PromotionTierList>(uriBuilder.Uri, callback);
}
}
}
#endif
15 changes: 15 additions & 0 deletions src/Voucherify/Core/DataModel/PageFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Newtonsoft.Json;
using System;

namespace Voucherify.Core.DataModel
{
[JsonObject]
public class PageFilter
{
[JsonProperty(PropertyName = "limit")]
public int? Limit { get; set; }

[JsonProperty(PropertyName = "page")]
public int? Page { get; set; }
}
}
21 changes: 0 additions & 21 deletions src/Voucherify/DataModel/ApplicableProduct.cs

This file was deleted.

22 changes: 0 additions & 22 deletions src/Voucherify/DataModel/ApplicableProductList.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/Voucherify/DataModel/PromotionTierList.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if VOUCHERIFYSERVER
#if VOUCHERIFYSERVER || VOUCHERIFYCLIENT
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
Expand Down
7 changes: 1 addition & 6 deletions src/Voucherify/DataModel/Queries/CampaignFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@
namespace Voucherify.DataModel.Queries
{
[JsonObject]
public class CampaignFilter
public class CampaignFilter : Core.DataModel.PageFilter
{
[JsonProperty(PropertyName = "limit")]
public int? Limit { get; set; }

[JsonProperty(PropertyName = "page")]
public int? Page { get; set; }
}
}
#endif
8 changes: 1 addition & 7 deletions src/Voucherify/DataModel/Queries/CustomerFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@
namespace Voucherify.DataModel.Queries
{
[JsonObject]
public class CustomerFilter
public class CustomerFilter : Core.DataModel.PageFilter
{
[JsonProperty(PropertyName = "limit")]
public int? Limit { get; set; }

[JsonProperty(PropertyName = "page")]
public int? Page { get; set; }

[JsonProperty(PropertyName = "email")]
public string Email { get; set; }

Expand Down
7 changes: 1 addition & 6 deletions src/Voucherify/DataModel/Queries/OrderFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@
namespace Voucherify.DataModel.Queries
{
[JsonObject]
public class OrderFilter
public class OrderFilter : Core.DataModel.PageFilter
{
[JsonProperty(PropertyName = "limit")]
public int? Limit { get; set; }

[JsonProperty(PropertyName = "page")]
public int? Page { get; set; }
}
}
#endif
7 changes: 1 addition & 6 deletions src/Voucherify/DataModel/Queries/ProductFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@
namespace Voucherify.DataModel.Queries
{
[JsonObject]
public class ProductFilter
public class ProductFilter : Core.DataModel.PageFilter
{
[JsonProperty(PropertyName = "limit")]
public int? Limit { get; set; }

[JsonProperty(PropertyName = "page")]
public int? Page { get; set; }
}
}
#endif
15 changes: 15 additions & 0 deletions src/Voucherify/DataModel/Queries/PromotionTiersFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#if VOUCHERIFYSERVER || VOUCHERIFYCLIENT
using Newtonsoft.Json;
using System;
using System.Collections.Generic;

namespace Voucherify.DataModel.Queries
{
[JsonObject]
public class PromotionTiersFilter : Core.DataModel.PageFilter
{
[JsonProperty(PropertyName = "is_available")]
public bool? IsAvailable { get; set; }
}
}
#endif
5 changes: 1 addition & 4 deletions src/Voucherify/DataModel/Queries/RedemptionsFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
namespace Voucherify.DataModel.Queries
{
[JsonObject]
public class RedemptionsFilter
public class RedemptionsFilter : Core.DataModel.PageFilter
{
[JsonProperty(PropertyName = "limit")]
public int? Limit { get; set; }

[JsonProperty(PropertyName = "start_date")]
public DateTime? StartDate { get; set; }

Expand Down
8 changes: 1 addition & 7 deletions src/Voucherify/DataModel/Queries/VouchersFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,8 @@
namespace Voucherify.DataModel.Queries
{
[JsonObject]
public class VouchersFilter
public class VouchersFilter : Core.DataModel.PageFilter
{
[JsonProperty(PropertyName = "limit")]
public int? Limit { get; set; }

[JsonProperty(PropertyName = "page")]
public int? Page { get; set; }

[JsonProperty(PropertyName = "campaign")]
public string Campaign { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion src/Voucherify/DataModel/Voucher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class Voucher : ApiObject
public Metadata Metadata { get; private set; }

[JsonProperty(PropertyName = "applicable_to")]
public ApplicableProductList ApplicableTo { get; private set; }
public VoucherSubjectList ApplicableTo { get; private set; }

public Voucher()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Voucherify/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@

[assembly: ComVisible(false)]

[assembly: AssemblyVersion("6.3.0.0")]
[assembly: AssemblyFileVersion("6.3.0.0")]
[assembly: AssemblyVersion("6.4.0.0")]
[assembly: AssemblyFileVersion("6.4.0.0")]
6 changes: 5 additions & 1 deletion src/Voucherify/Voucherify.Client.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package >
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>Voucherify.Client</id>
<version>6.3.0.0</version>
<version>6.4.0.0</version>
<title>Voucherify.Client</title>
<authors>Rspective</authors>
<owners>Rspective</owners>
Expand All @@ -11,6 +11,10 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>.Net SDK for Voucherify - coupons, vouchers, promo codes - http://www.voucherify.io</description>
<releaseNotes>
2019-02-03: 6.4.0:
- Replaced ApplicableProductList with correct VoucherSubjectList and ApplicableProduct with VoucherSubject.
- Added listing Promotion Tiers method to server and client side api.

2019-01-29: 6.3.0:
- Reorganized Delete methods with force option for: Voucher, Campaign, Product and Sku

Expand Down
6 changes: 5 additions & 1 deletion src/Voucherify/Voucherify.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package >
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>Voucherify</id>
<version>6.3.0.0</version>
<version>6.4.0.0</version>
<title>Voucherify</title>
<authors>Rspective</authors>
<owners>Rspective</owners>
Expand All @@ -11,6 +11,10 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>.Net SDK for Voucherify - coupons, vouchers, promo codes - http://www.voucherify.io</description>
<releaseNotes>
2019-02-03: 6.4.0:
- Replaced ApplicableProductList with correct VoucherSubjectList and ApplicableProduct with VoucherSubject.
- Added listing Promotion Tiers method to server and client side api.

2019-01-29: 6.3.0:
- Reorganized Delete methods with force option for: Voucher, Campaign, Product and Sku

Expand Down

0 comments on commit b09b1d3

Please sign in to comment.