Skip to content

Commit

Permalink
[DE-1091] Release 6.0.0 (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
maciej-nedza authored Dec 13, 2024
1 parent 5231f8d commit f28d454
Show file tree
Hide file tree
Showing 725 changed files with 14,224 additions and 12,947 deletions.
8 changes: 4 additions & 4 deletions AdvancedBilling.Standard/AdvancedBilling.Standard.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Maxio.AdvancedBillingSdk</AssemblyName>
<Version>5.2.0.0</Version>
<Version>6.0.0.0</Version>
<Authors>MaxioSdk</Authors>
<Owners></Owners>
<Product>AdvancedBilling.Standard</Product>
<Copyright>Copyright © 2019</Copyright>
<AssemblyVersion>5.2.0.0</AssemblyVersion>
<FileVersion>5.2.0.0</FileVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<FileVersion>6.0.0.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>
Expand All @@ -32,7 +32,7 @@ Maxio integrates directly into your product, so you can seamlessly manage your p
</PropertyGroup>

<ItemGroup>
<PackageReference Include= "APIMatic.Core" Version= "0.4.*" />
<PackageReference Include="APIMatic.Core" Version= "[0.4.5, 0.5.0)" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<None Include="..\README.md" Pack="true" PackagePath="\"/>
<None Include="..\LICENSE" Pack="true" PackagePath="\"/>
Expand Down
82 changes: 27 additions & 55 deletions AdvancedBilling.Standard/AdvancedBillingClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,23 @@ public sealed class AdvancedBillingClient : IConfiguration
new Dictionary<Environment, Dictionary<Enum, string>>
{
{
Environment.Production, new Dictionary<Enum, string>
Environment.US, new Dictionary<Enum, string>
{
{ Server.Default, "https://{subdomain}.{domain}" },
{ Server.Production, "https://{site}.chargify.com" },
{ Server.Ebb, "https://events.chargify.com/{site}" },
}
},
{
Environment.Environment2, new Dictionary<Enum, string>
Environment.EU, new Dictionary<Enum, string>
{
{ Server.Default, "https://events.chargify.com" },
{ Server.Production, "https://{site}.ebilling.maxio.com" },
{ Server.Ebb, "https://events.chargify.com/{site}" },
}
},
};

private readonly GlobalConfiguration globalConfiguration;
private const string userAgent = "AB SDK DotNet:5.2.0 on OS {os-info}";
private const string userAgent = "AB SDK DotNet:6.0.0 on OS {os-info}";
private readonly HttpCallback httpCallback;
private readonly Lazy<APIExportsController> aPIExports;
private readonly Lazy<AdvanceInvoiceController> advanceInvoice;
Expand Down Expand Up @@ -75,15 +77,13 @@ public sealed class AdvancedBillingClient : IConfiguration

private AdvancedBillingClient(
Environment environment,
string subdomain,
string domain,
string site,
BasicAuthModel basicAuthModel,
HttpCallback httpCallback,
IHttpClientConfiguration httpClientConfiguration)
{
this.Environment = environment;
this.Subdomain = subdomain;
this.Domain = domain;
this.Site = site;
this.httpCallback = httpCallback;
this.HttpClientConfiguration = httpClientConfiguration;
BasicAuthModel = basicAuthModel;
Expand All @@ -94,10 +94,9 @@ private AdvancedBillingClient(
})
.ApiCallback(httpCallback)
.HttpConfiguration(httpClientConfiguration)
.ServerUrls(EnvironmentsMap[environment], Server.Default)
.ServerUrls(EnvironmentsMap[environment], Server.Production)
.Parameters(globalParameter => globalParameter
.Template(templateParameter => templateParameter.Setup("subdomain", this.Subdomain))
.Template(templateParameter => templateParameter.Setup("domain", this.Domain)))
.Template(templateParameter => templateParameter.Setup("site", this.Site)))
.UserAgent(userAgent)
.Build();

Expand Down Expand Up @@ -341,16 +340,10 @@ private AdvancedBillingClient(
public Environment Environment { get; }

/// <summary>
/// Gets Subdomain.
/// Gets Site.
/// The subdomain for your Advanced Billing site.
/// </summary>
public string Subdomain { get; }

/// <summary>
/// Gets Domain.
/// The Advanced Billing server domain.
/// </summary>
public string Domain { get; }
public string Site { get; }

/// <summary>
/// Gets http callback.
Expand All @@ -371,9 +364,9 @@ private AdvancedBillingClient(
/// Gets the URL for a particular alias in the current environment and appends
/// it with template parameters.
/// </summary>
/// <param name="alias">Default value:DEFAULT.</param>
/// <param name="alias">Default value:PRODUCTION.</param>
/// <returns>Returns the baseurl.</returns>
public string GetBaseUri(Server alias = Server.Default)
public string GetBaseUri(Server alias = Server.Production)
{
return globalConfiguration.ServerUrl(alias);
}
Expand All @@ -386,8 +379,7 @@ public Builder ToBuilder()
{
Builder builder = new Builder()
.Environment(this.Environment)
.Subdomain(this.Subdomain)
.Domain(this.Domain)
.Site(this.Site)
.HttpCallback(httpCallback)
.HttpClientConfig(config => config.Build());

Expand All @@ -404,8 +396,7 @@ public override string ToString()
{
return
$"Environment = {this.Environment}, " +
$"Subdomain = {this.Subdomain}, " +
$"Domain = {this.Domain}, " +
$"Site = {this.Site}, " +
$"HttpClientConfiguration = {this.HttpClientConfiguration}, ";
}

Expand All @@ -418,8 +409,7 @@ internal static AdvancedBillingClient CreateFromEnvironment()
var builder = new Builder();

string environment = System.Environment.GetEnvironmentVariable("ADVANCED_BILLING_STANDARD_ENVIRONMENT");
string subdomain = System.Environment.GetEnvironmentVariable("ADVANCED_BILLING_STANDARD_SUBDOMAIN");
string domain = System.Environment.GetEnvironmentVariable("ADVANCED_BILLING_STANDARD_DOMAIN");
string site = System.Environment.GetEnvironmentVariable("ADVANCED_BILLING_STANDARD_SITE");
string basicAuthUserName = System.Environment.GetEnvironmentVariable("ADVANCED_BILLING_STANDARD_BASIC_AUTH_USER_NAME");
string basicAuthPassword = System.Environment.GetEnvironmentVariable("ADVANCED_BILLING_STANDARD_BASIC_AUTH_PASSWORD");

Expand All @@ -428,14 +418,9 @@ internal static AdvancedBillingClient CreateFromEnvironment()
builder.Environment(ApiHelper.JsonDeserialize<Environment>($"\"{environment}\""));
}

if (subdomain != null)
if (site != null)
{
builder.Subdomain(subdomain);
}

if (domain != null)
{
builder.Domain(domain);
builder.Site(site);
}

if (basicAuthUserName != null && basicAuthPassword != null)
Expand All @@ -453,9 +438,8 @@ internal static AdvancedBillingClient CreateFromEnvironment()
/// </summary>
public class Builder
{
private Environment environment = AdvancedBilling.Standard.Environment.Production;
private string subdomain = "subdomain";
private string domain = "chargify.com";
private Environment environment = AdvancedBilling.Standard.Environment.US;
private string site = "subdomain";
private BasicAuthModel basicAuthModel = new BasicAuthModel();
private HttpClientConfiguration.Builder httpClientConfig = new HttpClientConfiguration.Builder();
private HttpCallback httpCallback;
Expand Down Expand Up @@ -488,24 +472,13 @@ public Builder Environment(Environment environment)
}

/// <summary>
/// Sets Subdomain.
/// </summary>
/// <param name="subdomain"> Subdomain. </param>
/// <returns> Builder. </returns>
public Builder Subdomain(string subdomain)
{
this.subdomain = subdomain ?? throw new ArgumentNullException(nameof(subdomain));
return this;
}

/// <summary>
/// Sets Domain.
/// Sets Site.
/// </summary>
/// <param name="domain"> Domain. </param>
/// <param name="site"> Site. </param>
/// <returns> Builder. </returns>
public Builder Domain(string domain)
public Builder Site(string site)
{
this.domain = domain ?? throw new ArgumentNullException(nameof(domain));
this.site = site ?? throw new ArgumentNullException(nameof(site));
return this;
}

Expand Down Expand Up @@ -550,8 +523,7 @@ public AdvancedBillingClient Build()
}
return new AdvancedBillingClient(
environment,
subdomain,
domain,
site,
basicAuthModel,
httpCallback,
httpClientConfig.Build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ public Models.ComponentPricePointResponse CreateComponentPricePoint(
.Body(_bodyParameter => _bodyParameter.Setup(body))
.Template(_template => _template.Setup("component_id", componentId))
.Header(_header => _header.Setup("Content-Type", "application/json"))))
.ResponseHandler(_responseHandler => _responseHandler
.ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorArrayMapResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);

/// <summary>
Expand Down Expand Up @@ -167,6 +169,8 @@ public Models.ComponentPricePointsResponse BulkCreateComponentPricePoints(
.Body(_bodyParameter => _bodyParameter.Setup(body))
.Template(_template => _template.Setup("component_id", componentId).Required())
.Header(_header => _header.Setup("Content-Type", "application/json"))))
.ResponseHandler(_responseHandler => _responseHandler
.ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);

/// <summary>
Expand Down Expand Up @@ -219,30 +223,35 @@ public Models.ComponentPricePointResponse UpdateComponentPricePoint(
/// </summary>
/// <param name="componentId">Required parameter: The id or handle of the component. When using the handle, it must be prefixed with `handle:`. Example: `123` for an integer ID, or `handle:example-product-handle` for a string handle..</param>
/// <param name="pricePointId">Required parameter: The id or handle of the price point. When using the handle, it must be prefixed with `handle:`. Example: `123` for an integer ID, or `handle:example-price_point-handle` for a string handle..</param>
/// <param name="currencyPrices">Optional parameter: Include an array of currency price data.</param>
/// <returns>Returns the Models.ComponentPricePointResponse response from the API call.</returns>
public Models.ComponentPricePointResponse ReadComponentPricePoint(
ReadComponentPricePointComponentId componentId,
ReadComponentPricePointPricePointId pricePointId)
=> CoreHelper.RunTask(ReadComponentPricePointAsync(componentId, pricePointId));
ReadComponentPricePointPricePointId pricePointId,
bool? currencyPrices = null)
=> CoreHelper.RunTask(ReadComponentPricePointAsync(componentId, pricePointId, currencyPrices));

/// <summary>
/// Use this endpoint to retrieve details for a specific component price point. You can achieve this by using either the component price point ID or handle.
/// </summary>
/// <param name="componentId">Required parameter: The id or handle of the component. When using the handle, it must be prefixed with `handle:`. Example: `123` for an integer ID, or `handle:example-product-handle` for a string handle..</param>
/// <param name="pricePointId">Required parameter: The id or handle of the price point. When using the handle, it must be prefixed with `handle:`. Example: `123` for an integer ID, or `handle:example-price_point-handle` for a string handle..</param>
/// <param name="currencyPrices">Optional parameter: Include an array of currency price data.</param>
/// <param name="cancellationToken"> cancellationToken. </param>
/// <returns>Returns the Models.ComponentPricePointResponse response from the API call.</returns>
public async Task<Models.ComponentPricePointResponse> ReadComponentPricePointAsync(
ReadComponentPricePointComponentId componentId,
ReadComponentPricePointPricePointId pricePointId,
bool? currencyPrices = null,
CancellationToken cancellationToken = default)
=> await CreateApiCall<Models.ComponentPricePointResponse>()
.RequestBuilder(_requestBuilder => _requestBuilder
.Setup(HttpMethod.Get, "/components/{component_id}/price_points/{price_point_id}.json")
.WithAuth("BasicAuth")
.Parameters(_parameters => _parameters
.Template(_template => _template.Setup("component_id", componentId).Required())
.Template(_template => _template.Setup("price_point_id", pricePointId).Required())))
.Template(_template => _template.Setup("price_point_id", pricePointId).Required())
.Query(_query => _query.Setup("currency_prices", currencyPrices))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);

/// <summary>
Expand Down Expand Up @@ -344,7 +353,7 @@ public Models.ComponentCurrencyPricesResponse CreateCurrencyPrices(
.Template(_template => _template.Setup("price_point_id", pricePointId))
.Header(_header => _header.Setup("Content-Type", "application/json"))))
.ResponseHandler(_responseHandler => _responseHandler
.ErrorCase("422", CreateErrorCase("Unprocessable Entity (WebDAV)", (_reason, _context) => new ErrorArrayMapResponseException(_reason, _context))))
.ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorArrayMapResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);

/// <summary>
Expand Down Expand Up @@ -380,7 +389,7 @@ public Models.ComponentCurrencyPricesResponse UpdateCurrencyPrices(
.Template(_template => _template.Setup("price_point_id", pricePointId))
.Header(_header => _header.Setup("Content-Type", "application/json"))))
.ResponseHandler(_responseHandler => _responseHandler
.ErrorCase("422", CreateErrorCase("Unprocessable Entity (WebDAV)", (_reason, _context) => new ErrorArrayMapResponseException(_reason, _context))))
.ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorArrayMapResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);

/// <summary>
Expand Down
Loading

0 comments on commit f28d454

Please sign in to comment.