Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.0.3 Release #1

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions AdvancedBilling.Standard/AdvancedBilling.Standard.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,32 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>AdvancedBillingStandard</AssemblyName>
<Version>1.0.0.0</Version>

<AssemblyName>Maxio.AdvancedBillingSdk</AssemblyName>
<Version>0.0.3.0</Version>
<Authors>MaxioSdk</Authors>
<Owners></Owners>
<Product>AdvancedBilling.Standard</Product>
<Copyright>Copyright © 2019</Copyright>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<Description>.NET client library for the Maxio Advanced Billing API</Description>
<AssemblyVersion>0.0.3.0</AssemblyVersion>
<FileVersion>0.0.3.0</FileVersion>
<Description>Ultimate billing and pricing flexibility for B2B SaaS.
Maxio integrates directly into your product, so you can seamlessly manage your product catalog, bill customers, and collect payments.</Description>
<LangVersion>7.3</LangVersion>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<PackageId>Maxio.AdvancedBillingSdk</PackageId>
<PackageTags>Maxio;Advanced Billing;Subscription;Payments</PackageTags>
<RepositoryUrl>https://github.com/maxio-com/ab-dotnet-sdk.git</RepositoryUrl>
<PackRepositoryTypeageId>git</PackRepositoryTypeageId>
<PackageProjectUrl>https://www.maxio.com/product/advanced-billing</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include= "APIMatic.Core" Version= "0.3.*" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<None Include="..\README.md" Pack="true" PackagePath="\"/>
<None Include="..\LICENSE" Pack="true" PackagePath="\"/>
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion AdvancedBilling.Standard/AdvancedBillingClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public sealed class AdvancedBillingClient : IConfiguration
};

private readonly GlobalConfiguration globalConfiguration;
private const string userAgent = "AB SDK DotNet:1.0.0 on OS {os-info}";
private const string userAgent = "AB SDK DotNet:0.0.3 on OS {os-info}";
private readonly BasicAuthManager basicAuthManager;
private readonly Lazy<APIExportsController> aPIExports;
private readonly Lazy<AdvanceInvoiceController> advanceInvoice;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace AdvancedBilling.Standard.Controllers
using AdvancedBilling.Standard.Authentication;
using AdvancedBilling.Standard.Exceptions;
using AdvancedBilling.Standard.Http.Client;
using AdvancedBilling.Standard.Models.Containers;
using AdvancedBilling.Standard.Utilities;
using APIMatic.Core;
using APIMatic.Core.Types;
Expand Down Expand Up @@ -578,7 +579,7 @@ public async Task DeletePrepaidUsageAllocationAsync(
/// <returns>Returns the Models.UsageResponse response from the API call.</returns>
public Models.UsageResponse CreateUsage(
int subscriptionId,
int componentId,
CreateUsageComponentId componentId,
Models.CreateUsageRequest body = null)
=> CoreHelper.RunTask(CreateUsageAsync(subscriptionId, componentId, body));

Expand Down Expand Up @@ -627,7 +628,7 @@ public Models.UsageResponse CreateUsage(
/// <returns>Returns the Models.UsageResponse response from the API call.</returns>
public async Task<Models.UsageResponse> CreateUsageAsync(
int subscriptionId,
int componentId,
CreateUsageComponentId componentId,
Models.CreateUsageRequest body = null,
CancellationToken cancellationToken = default)
=> await CreateApiCall<Models.UsageResponse>()
Expand All @@ -637,7 +638,7 @@ public Models.UsageResponse CreateUsage(
.Parameters(_parameters => _parameters
.Body(_bodyParameter => _bodyParameter.Setup(body))
.Template(_template => _template.Setup("subscription_id", subscriptionId))
.Template(_template => _template.Setup("component_id", componentId))
.Template(_template => _template.Setup("component_id", componentId).Required())
.Header(_header => _header.Setup("Content-Type", "application/json"))))
.ResponseHandler(_responseHandler => _responseHandler
.ErrorCase("422", CreateErrorCase("Unprocessable Entity (WebDAV)", (_reason, _context) => new ErrorListResponseException(_reason, _context))))
Expand Down Expand Up @@ -683,11 +684,11 @@ public Models.UsageResponse CreateUsage(
.WithAuth("global")
.Parameters(_parameters => _parameters
.Template(_template => _template.Setup("subscription_id", input.SubscriptionId))
.Template(_template => _template.Setup("component_id", input.ComponentId))
.Template(_template => _template.Setup("component_id", input.ComponentId).Required())
.Query(_query => _query.Setup("since_id", input.SinceId))
.Query(_query => _query.Setup("max_id", input.MaxId))
.Query(_query => _query.Setup("since_date", input.SinceDate))
.Query(_query => _query.Setup("until_date", input.UntilDate))
.Query(_query => _query.Setup("since_date", input.SinceDate.HasValue ? input.SinceDate.Value.ToString("yyyy'-'MM'-'dd") : null))
.Query(_query => _query.Setup("until_date", input.UntilDate.HasValue ? input.UntilDate.Value.ToString("yyyy'-'MM'-'dd") : null))
.Query(_query => _query.Setup("page", input.Page))
.Query(_query => _query.Setup("per_page", input.PerPage))))
.ExecuteAsync(cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,8 @@ public Models.RenewalPreviewResponse PreviewRenewal(
.Body(_bodyParameter => _bodyParameter.Setup(body))
.Template(_template => _template.Setup("subscription_id", subscriptionId))
.Header(_header => _header.Setup("Content-Type", "application/json"))))
.ResponseHandler(_responseHandler => _responseHandler
.ErrorCase("422", CreateErrorCase("Unprocessable Entity (WebDAV)", (_reason, _context) => new ErrorListResponseException(_reason, _context))))
.ExecuteAsync(cancellationToken);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,8 @@ public Models.SubscriptionResponse CreateSubscription(
.Query(_query => _query.Setup("end_datetime", input.EndDatetime.HasValue ? input.EndDatetime.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null))
.Query(_query => _query.Setup("metadata", input.Metadata))
.Query(_query => _query.Setup("direction", (input.Direction.HasValue) ? ApiHelper.JsonSerialize(input.Direction.Value).Trim('\"') : null))
.Query(_query => _query.Setup("sort", (input.Sort.HasValue) ? ApiHelper.JsonSerialize(input.Sort.Value).Trim('\"') : "signup_date"))))
.Query(_query => _query.Setup("sort", (input.Sort.HasValue) ? ApiHelper.JsonSerialize(input.Sort.Value).Trim('\"') : "signup_date"))
.Query(_query => _query.Setup("include[]", input.Include?.Select(a => ApiHelper.JsonSerialize(a).Trim('\"')).ToList()))))
.ExecuteAsync(cancellationToken);

/// <summary>
Expand Down Expand Up @@ -1186,7 +1187,7 @@ public async Task OverrideSubscriptionAsync(
.Header(_header => _header.Setup("Content-Type", "application/json"))))
.ResponseHandler(_responseHandler => _responseHandler
.ErrorCase("400", CreateErrorCase("Bad Request", (_reason, _context) => new ApiException(_reason, _context)))
.ErrorCase("422", CreateErrorCase("Unprocessable Entity (WebDAV)", (_reason, _context) => new ApiException(_reason, _context))))
.ErrorCase("422", CreateErrorCase("Unprocessable Entity (WebDAV)", (_reason, _context) => new SingleErrorResponseErrorException(_reason, _context))))
.ExecuteAsync(cancellationToken);

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ public SubscriptionAddCouponErrorException(string reason, HttpContext context)
[JsonProperty("codes", NullValueHandling = NullValueHandling.Ignore)]
public List<string> Codes { get; set; }

/// <summary>
/// Gets or sets CouponCode.
/// </summary>
[JsonProperty("coupon_code", NullValueHandling = NullValueHandling.Ignore)]
public List<string> CouponCode { get; set; }

/// <summary>
/// Gets or sets CouponCodes.
/// </summary>
Expand Down
7 changes: 4 additions & 3 deletions AdvancedBilling.Standard/Models/ComponentAllocationChange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace AdvancedBilling.Standard.Models
using System.Threading.Tasks;
using APIMatic.Core.Utilities.Converters;
using AdvancedBilling.Standard;
using AdvancedBilling.Standard.Models.Containers;
using AdvancedBilling.Standard.Utilities;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
Expand Down Expand Up @@ -45,7 +46,7 @@ public ComponentAllocationChange(
string componentHandle,
string memo,
int allocationId,
int? allocatedQuantity = null)
ComponentAllocationChangeAllocatedQuantity allocatedQuantity = null)
{
this.PreviousAllocation = previousAllocation;
this.NewAllocation = newAllocation;
Expand Down Expand Up @@ -104,7 +105,7 @@ public ComponentAllocationChange(
/// Gets or sets AllocatedQuantity.
/// </summary>
[JsonProperty("allocated_quantity", NullValueHandling = NullValueHandling.Ignore)]
public int? AllocatedQuantity { get; set; }
public ComponentAllocationChangeAllocatedQuantity AllocatedQuantity { get; set; }

/// <inheritdoc/>
public override string ToString()
Expand Down Expand Up @@ -149,7 +150,7 @@ protected void ToString(List<string> toStringOutput)
toStringOutput.Add($"this.ComponentHandle = {(this.ComponentHandle == null ? "null" : this.ComponentHandle)}");
toStringOutput.Add($"this.Memo = {(this.Memo == null ? "null" : this.Memo)}");
toStringOutput.Add($"this.AllocationId = {this.AllocationId}");
toStringOutput.Add($"this.AllocatedQuantity = {(this.AllocatedQuantity == null ? "null" : this.AllocatedQuantity.ToString())}");
toStringOutput.Add($"AllocatedQuantity = {(this.AllocatedQuantity == null ? "null" : this.AllocatedQuantity.ToString())}");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
using APIMatic.Core.Utilities.Converters;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;

namespace AdvancedBilling.Standard.Models.Containers
{
/// <summary>
/// This is a container class for one-of types.
/// </summary>
[JsonConverter(
typeof(UnionTypeConverter<ComponentAllocationChangeAllocatedQuantity>),
new Type[] {
typeof(NumberCase),
typeof(MStringCase)
},
true
)]
public abstract class ComponentAllocationChangeAllocatedQuantity
{
/// <summary>
/// This is Number case.
/// </summary>
/// <returns>
/// The ComponentAllocationChangeAllocatedQuantity instance, wrapping the provided int value.
/// </returns>
public static ComponentAllocationChangeAllocatedQuantity FromNumber(int number)
{
return new NumberCase().Set(number);
}

/// <summary>
/// This is String case.
/// </summary>
/// <returns>
/// The ComponentAllocationChangeAllocatedQuantity instance, wrapping the provided string value.
/// </returns>
public static ComponentAllocationChangeAllocatedQuantity FromString(string mString)
{
return new MStringCase().Set(mString);
}

/// <summary>
/// Method to match from the provided one-of cases. Here parameters
/// represents the callback functions for one-of type cases. All
/// callback functions must have the same return type T. This typeparam T
/// represents the type that will be returned after applying the selected
/// callback function.
/// </summary>
/// <typeparam name="T"></typeparam>
public abstract T Match<T>(Func<int, T> number, Func<string, T> mString);

[JsonConverter(typeof(UnionTypeCaseConverter<NumberCase, int>), JTokenType.Integer)]
private sealed class NumberCase : ComponentAllocationChangeAllocatedQuantity, ICaseValue<NumberCase, int>
{
public int _value;

public override T Match<T>(Func<int, T> number, Func<string, T> mString)
{
return number(_value);
}

public NumberCase Set(int value)
{
_value = value;
return this;
}

public int Get()
{
return _value;
}

public override string ToString()
{
return _value.ToString();
}
}

[JsonConverter(typeof(UnionTypeCaseConverter<MStringCase, string>), JTokenType.String, JTokenType.Null)]
private sealed class MStringCase : ComponentAllocationChangeAllocatedQuantity, ICaseValue<MStringCase, string>
{
public string _value;

public override T Match<T>(Func<int, T> number, Func<string, T> mString)
{
return mString(_value);
}

public MStringCase Set(string value)
{
_value = value;
return this;
}

public string Get()
{
return _value;
}

public override string ToString()
{
return _value?.ToString();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
using APIMatic.Core.Utilities.Converters;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;

namespace AdvancedBilling.Standard.Models.Containers
{
/// <summary>
/// This is a container class for one-of types.
/// </summary>
[JsonConverter(
typeof(UnionTypeConverter<CreateSubscriptionComponentAllocatedQuantity>),
new Type[] {
typeof(NumberCase),
typeof(MStringCase)
},
true
)]
public abstract class CreateSubscriptionComponentAllocatedQuantity
{
/// <summary>
/// This is Number case.
/// </summary>
/// <returns>
/// The CreateSubscriptionComponentAllocatedQuantity instance, wrapping the provided int value.
/// </returns>
public static CreateSubscriptionComponentAllocatedQuantity FromNumber(int number)
{
return new NumberCase().Set(number);
}

/// <summary>
/// This is String case.
/// </summary>
/// <returns>
/// The CreateSubscriptionComponentAllocatedQuantity instance, wrapping the provided string value.
/// </returns>
public static CreateSubscriptionComponentAllocatedQuantity FromString(string mString)
{
return new MStringCase().Set(mString);
}

/// <summary>
/// Method to match from the provided one-of cases. Here parameters
/// represents the callback functions for one-of type cases. All
/// callback functions must have the same return type T. This typeparam T
/// represents the type that will be returned after applying the selected
/// callback function.
/// </summary>
/// <typeparam name="T"></typeparam>
public abstract T Match<T>(Func<int, T> number, Func<string, T> mString);

[JsonConverter(typeof(UnionTypeCaseConverter<NumberCase, int>), JTokenType.Integer)]
private sealed class NumberCase : CreateSubscriptionComponentAllocatedQuantity, ICaseValue<NumberCase, int>
{
public int _value;

public override T Match<T>(Func<int, T> number, Func<string, T> mString)
{
return number(_value);
}

public NumberCase Set(int value)
{
_value = value;
return this;
}

public int Get()
{
return _value;
}

public override string ToString()
{
return _value.ToString();
}
}

[JsonConverter(typeof(UnionTypeCaseConverter<MStringCase, string>), JTokenType.String, JTokenType.Null)]
private sealed class MStringCase : CreateSubscriptionComponentAllocatedQuantity, ICaseValue<MStringCase, string>
{
public string _value;

public override T Match<T>(Func<int, T> number, Func<string, T> mString)
{
return mString(_value);
}

public MStringCase Set(string value)
{
_value = value;
return this;
}

public string Get()
{
return _value;
}

public override string ToString()
{
return _value?.ToString();
}
}
}
}
Loading