Skip to content

Commit

Permalink
Update generated code using latest spec
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-stripe committed Apr 10, 2024
1 parent 0c1549d commit d466310
Show file tree
Hide file tree
Showing 20 changed files with 221 additions and 67 deletions.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v938
v940
2 changes: 1 addition & 1 deletion src/Stripe.net/Constants/ApiVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ namespace Stripe
{
internal class ApiVersion
{
public const string Current = "2023-10-16";
public const string Current = "2024-04-10";
}
}
8 changes: 0 additions & 8 deletions src/Stripe.net/Entities/Invoices/Invoice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -790,14 +790,6 @@ public Quote Quote
[JsonProperty("rendering")]
public InvoiceRendering Rendering { get; set; }

/// <summary>
/// This is a legacy field that will be removed soon. For details about
/// <c>rendering_options</c>, refer to <c>rendering</c> instead. Options for invoice PDF
/// rendering.
/// </summary>
[JsonProperty("rendering_options")]
public InvoiceRenderingOptions RenderingOptions { get; set; }

/// <summary>
/// The details of the cost of shipping, including the ShippingRate applied on the invoice.
/// </summary>
Expand Down
14 changes: 0 additions & 14 deletions src/Stripe.net/Entities/Invoices/InvoiceRenderingOptions.cs

This file was deleted.

46 changes: 46 additions & 0 deletions src/Stripe.net/Entities/ProductFeatures/ProductFeature.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// File generated from our OpenAPI spec
namespace Stripe
{
using Newtonsoft.Json;

/// <summary>
/// A product_feature represents an attachment between a feature and a product. When a
/// product is purchased that has a feature attached, Stripe will create an entitlement to
/// the feature for the purchasing customer.
/// </summary>
public class ProductFeature : StripeEntity<ProductFeature>, IHasId, IHasObject
{
/// <summary>
/// Unique identifier for the object.
/// </summary>
[JsonProperty("id")]
public string Id { get; set; }

/// <summary>
/// String representing the object's type. Objects of the same type share the same value.
/// </summary>
[JsonProperty("object")]
public string Object { get; set; }

/// <summary>
/// Whether this object is deleted or not.
/// </summary>
[JsonProperty("deleted", NullValueHandling = NullValueHandling.Ignore)]
public bool? Deleted { get; set; }

/// <summary>
/// A feature represents a monetizable ability or functionality in your system. Features can
/// be assigned to products, and when those products are purchased, Stripe will create an
/// entitlement to the feature for the purchasing customer.
/// </summary>
[JsonProperty("entitlement_feature")]
public Entitlements.Feature EntitlementFeature { get; set; }

/// <summary>
/// Has the value <c>true</c> if the object exists in live mode or the value <c>false</c> if
/// the object exists in test mode.
/// </summary>
[JsonProperty("livemode")]
public bool Livemode { get; set; }
}
}
14 changes: 7 additions & 7 deletions src/Stripe.net/Entities/Products/Product.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,6 @@ public Price DefaultPrice
[JsonProperty("description")]
public string Description { get; set; }

/// <summary>
/// A list of up to 15 marketing features for this product. These are displayed in <a
/// href="https://stripe.com/docs/payments/checkout/pricing-table">pricing tables</a>.
/// </summary>
[JsonProperty("features")]
public List<ProductFeature> Features { get; set; }

/// <summary>
/// A list of up to 8 URLs of images for this product, meant to be displayable to the
/// customer.
Expand All @@ -116,6 +109,13 @@ public Price DefaultPrice
[JsonProperty("livemode")]
public bool Livemode { get; set; }

/// <summary>
/// A list of up to 15 marketing features for this product. These are displayed in <a
/// href="https://stripe.com/docs/payments/checkout/pricing-table">pricing tables</a>.
/// </summary>
[JsonProperty("marketing_features")]
public List<ProductMarketingFeature> MarketingFeatures { get; set; }

/// <summary>
/// Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can
/// attach to an object. This can be useful for storing additional information about the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace Stripe
{
using Newtonsoft.Json;

public class ProductFeatureOptions : INestedOptions
public class ProductMarketingFeature : StripeEntity<ProductMarketingFeature>
{
/// <summary>
/// The marketing feature name. Up to 80 characters long.
Expand Down
1 change: 1 addition & 0 deletions src/Stripe.net/Infrastructure/Public/StripeTypeRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public static class StripeTypeRegistry
{ "platform_tax_fee", typeof(PlatformTaxFee) },
{ "price", typeof(Price) },
{ "product", typeof(Product) },
{ "product_feature", typeof(ProductFeature) },
{ "promotion_code", typeof(PromotionCode) },
{ "quote", typeof(Quote) },
{
Expand Down
10 changes: 1 addition & 9 deletions src/Stripe.net/Services/Invoices/InvoiceCreateOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,7 @@ public class InvoiceCreateOptions : BaseOptions, IHasMetadata
/// customer-facing surfaces such as PDF and Hosted Invoice Page.
/// </summary>
[JsonProperty("rendering")]
public InvoiceRenderingOptionsOptions Rendering { get; set; }

/// <summary>
/// This is a legacy field that will be removed soon. For details about
/// <c>rendering_options</c>, refer to <c>rendering</c> instead. Options for invoice PDF
/// rendering.
/// </summary>
[JsonProperty("rendering_options")]
public InvoiceRenderingOptionsOptions RenderingOptions { get; set; }
public InvoiceRenderingOptions Rendering { get; set; }

/// <summary>
/// Settings for the cost of shipping for this invoice.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace Stripe
{
using Newtonsoft.Json;

public class InvoiceRenderingOptionsOptions : INestedOptions
public class InvoiceRenderingOptions : INestedOptions
{
/// <summary>
/// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.
Expand Down
10 changes: 1 addition & 9 deletions src/Stripe.net/Services/Invoices/InvoiceUpdateOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,7 @@ public class InvoiceUpdateOptions : BaseOptions, IHasMetadata
/// customer-facing surfaces such as PDF and Hosted Invoice Page.
/// </summary>
[JsonProperty("rendering")]
public InvoiceRenderingOptionsOptions Rendering { get; set; }

/// <summary>
/// This is a legacy field that will be removed soon. For details about
/// <c>rendering_options</c>, refer to <c>rendering</c> instead. Options for invoice PDF
/// rendering.
/// </summary>
[JsonProperty("rendering_options")]
public InvoiceRenderingOptionsOptions RenderingOptions { get; set; }
public InvoiceRenderingOptions Rendering { get; set; }

/// <summary>
/// Settings for the cost of shipping for this invoice.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// File generated from our OpenAPI spec
namespace Stripe
{
using Newtonsoft.Json;

public class ProductFeatureCreateOptions : BaseOptions
{
/// <summary>
/// The ID of the <a href="docs/api/entitlements/feature">Feature</a> object attached to
/// this product.
/// </summary>
[JsonProperty("entitlement_feature")]
public string EntitlementFeature { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// File generated from our OpenAPI spec
namespace Stripe
{
public class ProductFeatureDeleteOptions : BaseOptions
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// File generated from our OpenAPI spec
namespace Stripe
{
public class ProductFeatureGetOptions : BaseOptions
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// File generated from our OpenAPI spec
namespace Stripe
{
public class ProductFeatureListOptions : ListOptions
{
}
}
108 changes: 108 additions & 0 deletions src/Stripe.net/Services/ProductFeatures/ProductFeatureService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
// File generated from our OpenAPI spec
namespace Stripe
{
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;

public class ProductFeatureService : ServiceNested<ProductFeature>,
INestedCreatable<ProductFeature, ProductFeatureCreateOptions>,
INestedDeletable<ProductFeature, ProductFeatureDeleteOptions>,
INestedListable<ProductFeature, ProductFeatureListOptions>,
INestedRetrievable<ProductFeature, ProductFeatureGetOptions>
{
public ProductFeatureService()
{
}

public ProductFeatureService(IStripeClient client)
: base(client)
{
}

[Obsolete("This member is deprecated and will be removed in a future release")]
public override string BasePath => "/v1/products/{PARENT_ID}/features";

/// <summary>
/// <p>Creates a product_feature, which represents a feature attachment to a product</p>.
/// </summary>
public virtual ProductFeature Create(string parentId, ProductFeatureCreateOptions options = null, RequestOptions requestOptions = null)
{
return this.Request<ProductFeature>(HttpMethod.Post, $"/v1/products/{parentId}/features", options, requestOptions);
}

/// <summary>
/// <p>Creates a product_feature, which represents a feature attachment to a product</p>.
/// </summary>
public virtual Task<ProductFeature> CreateAsync(string parentId, ProductFeatureCreateOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return this.RequestAsync<ProductFeature>(HttpMethod.Post, $"/v1/products/{parentId}/features", options, requestOptions, cancellationToken);
}

/// <summary>
/// <p>Deletes the feature attachment to a product</p>.
/// </summary>
public virtual ProductFeature Delete(string parentId, string id, ProductFeatureDeleteOptions options = null, RequestOptions requestOptions = null)
{
return this.Request<ProductFeature>(HttpMethod.Delete, $"/v1/products/{parentId}/features/{id}", options, requestOptions);
}

/// <summary>
/// <p>Deletes the feature attachment to a product</p>.
/// </summary>
public virtual Task<ProductFeature> DeleteAsync(string parentId, string id, ProductFeatureDeleteOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return this.RequestAsync<ProductFeature>(HttpMethod.Delete, $"/v1/products/{parentId}/features/{id}", options, requestOptions, cancellationToken);
}

/// <summary>
/// <p>Retrieves a product_feature, which represents a feature attachment to a product</p>.
/// </summary>
public virtual ProductFeature Get(string parentId, string id, ProductFeatureGetOptions options = null, RequestOptions requestOptions = null)
{
return this.Request<ProductFeature>(HttpMethod.Get, $"/v1/products/{parentId}/features/{id}", options, requestOptions);
}

/// <summary>
/// <p>Retrieves a product_feature, which represents a feature attachment to a product</p>.
/// </summary>
public virtual Task<ProductFeature> GetAsync(string parentId, string id, ProductFeatureGetOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return this.RequestAsync<ProductFeature>(HttpMethod.Get, $"/v1/products/{parentId}/features/{id}", options, requestOptions, cancellationToken);
}

/// <summary>
/// <p>Retrieve a list of features for a product</p>.
/// </summary>
public virtual StripeList<ProductFeature> List(string parentId, ProductFeatureListOptions options = null, RequestOptions requestOptions = null)
{
return this.Request<StripeList<ProductFeature>>(HttpMethod.Get, $"/v1/products/{parentId}/features", options, requestOptions);
}

/// <summary>
/// <p>Retrieve a list of features for a product</p>.
/// </summary>
public virtual Task<StripeList<ProductFeature>> ListAsync(string parentId, ProductFeatureListOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return this.RequestAsync<StripeList<ProductFeature>>(HttpMethod.Get, $"/v1/products/{parentId}/features", options, requestOptions, cancellationToken);
}

/// <summary>
/// <p>Retrieve a list of features for a product</p>.
/// </summary>
public virtual IEnumerable<ProductFeature> ListAutoPaging(string parentId, ProductFeatureListOptions options = null, RequestOptions requestOptions = null)
{
return this.ListRequestAutoPaging<ProductFeature>($"/v1/products/{parentId}/features", options, requestOptions);
}

/// <summary>
/// <p>Retrieve a list of features for a product</p>.
/// </summary>
public virtual IAsyncEnumerable<ProductFeature> ListAutoPagingAsync(string parentId, ProductFeatureListOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
{
return this.ListRequestAutoPagingAsync<ProductFeature>($"/v1/products/{parentId}/features", options, requestOptions, cancellationToken);
}
}
}
14 changes: 7 additions & 7 deletions src/Stripe.net/Services/Products/ProductCreateOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@ public class ProductCreateOptions : BaseOptions, IHasId, IHasMetadata
[JsonProperty("description")]
public string Description { get; set; }

/// <summary>
/// A list of up to 15 marketing features for this product. These are displayed in <a
/// href="https://stripe.com/docs/payments/checkout/pricing-table">pricing tables</a>.
/// </summary>
[JsonProperty("features")]
public List<ProductFeatureOptions> Features { get; set; }

/// <summary>
/// An identifier will be randomly generated by Stripe. You can optionally override this ID,
/// but the ID must be unique across all products in your Stripe account.
Expand All @@ -48,6 +41,13 @@ public class ProductCreateOptions : BaseOptions, IHasId, IHasMetadata
[JsonProperty("images")]
public List<string> Images { get; set; }

/// <summary>
/// A list of up to 15 marketing features for this product. These are displayed in <a
/// href="https://stripe.com/docs/payments/checkout/pricing-table">pricing tables</a>.
/// </summary>
[JsonProperty("marketing_features")]
public List<ProductMarketingFeatureOptions> MarketingFeatures { get; set; }

/// <summary>
/// Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can
/// attach to an object. This can be useful for storing additional information about the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace Stripe
{
using Newtonsoft.Json;

public class ProductFeature : StripeEntity<ProductFeature>
public class ProductMarketingFeatureOptions : INestedOptions
{
/// <summary>
/// The marketing feature name. Up to 80 characters long.
Expand Down
14 changes: 7 additions & 7 deletions src/Stripe.net/Services/Products/ProductUpdateOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ public class ProductUpdateOptions : BaseOptions, IHasMetadata
[JsonProperty("description")]
public string Description { get; set; }

/// <summary>
/// A list of up to 15 marketing features for this product. These are displayed in <a
/// href="https://stripe.com/docs/payments/checkout/pricing-table">pricing tables</a>.
/// </summary>
[JsonProperty("features")]
public List<ProductFeatureOptions> Features { get; set; }

/// <summary>
/// A list of up to 8 URLs of images for this product, meant to be displayable to the
/// customer.
/// </summary>
[JsonProperty("images")]
public List<string> Images { get; set; }

/// <summary>
/// A list of up to 15 marketing features for this product. These are displayed in <a
/// href="https://stripe.com/docs/payments/checkout/pricing-table">pricing tables</a>.
/// </summary>
[JsonProperty("marketing_features")]
public List<ProductMarketingFeatureOptions> MarketingFeatures { get; set; }

/// <summary>
/// Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can
/// attach to an object. This can be useful for storing additional information about the
Expand Down
Loading

0 comments on commit d466310

Please sign in to comment.