Skip to content

Commit df68529

Browse files
feat(api): api update
1 parent 22921ae commit df68529

File tree

8 files changed

+126
-5
lines changed

8 files changed

+126
-5
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 118
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-5b9152241ebdd0d2f3fd536784f33721d24a5c4a59e75cab366a3dcb36552d3d.yml
3-
openapi_spec_hash: b40061d10bbe1ebab8998bddd1827cf8
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-f2b97a2c3e41f618dc8955ed325092320ff2170a7d7a9a26a31dc235c969b657.yml
3+
openapi_spec_hash: 64548564dc8ce80ef3ad38fc8cb56b30
44
config_hash: dd4343ce95871032ef6e0735a4ca038c

src/Orb.Tests/Services/Invoices/InvoiceServiceTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public async Task Create_Works()
2424
Name = "Line Item Name",
2525
Quantity = 1,
2626
StartDate = DateOnly.Parse("2023-09-22"),
27-
UnitConfig = new("unit_amount"),
27+
UnitConfig = new() { UnitAmount = "unit_amount", Prorated = true },
2828
},
2929
],
3030
}

src/Orb.Tests/Services/Plans/PlanServiceTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public async Task Create_Works()
4747
ItemID = "item_id",
4848
ModelType = ModelType47.Unit,
4949
Name = "Annual fee",
50-
UnitConfig = new("unit_amount"),
50+
UnitConfig = new() { UnitAmount = "unit_amount", Prorated = true },
5151
BillableMetricID = "billable_metric_id",
5252
BilledInAdvance = true,
5353
BillingCycleConfiguration = new()

src/Orb.Tests/Services/Prices/PriceServiceTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public async Task Create_Works()
2121
ItemID = "item_id",
2222
ModelType = Models::ModelType22.Unit,
2323
Name = "Annual fee",
24-
UnitConfig = new("unit_amount"),
24+
UnitConfig = new() { UnitAmount = "unit_amount", Prorated = true },
2525
BillableMetricID = "billable_metric_id",
2626
BilledInAdvance = true,
2727
BillingCycleConfiguration = new()

src/Orb/Models/PriceInterval.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,35 @@ public required long BillingCycleDay
6868
}
6969
}
7070

71+
/// <summary>
72+
/// For in-arrears prices. If true, and the price interval ends mid-cycle, the
73+
/// final line item will be deferred to the next scheduled invoice instead of
74+
/// being billed mid-cycle.
75+
/// </summary>
76+
public required bool CanDeferBilling
77+
{
78+
get
79+
{
80+
if (!this._properties.TryGetValue("can_defer_billing", out JsonElement element))
81+
throw new OrbInvalidDataException(
82+
"'can_defer_billing' cannot be null",
83+
new System::ArgumentOutOfRangeException(
84+
"can_defer_billing",
85+
"Missing required argument"
86+
)
87+
);
88+
89+
return JsonSerializer.Deserialize<bool>(element, ModelBase.SerializerOptions);
90+
}
91+
init
92+
{
93+
this._properties["can_defer_billing"] = JsonSerializer.SerializeToElement(
94+
value,
95+
ModelBase.SerializerOptions
96+
);
97+
}
98+
}
99+
71100
/// <summary>
72101
/// The end of the current billing period. This is an exclusive timestamp, such
73102
/// that the instant returned is exactly the end of the billing period. Set to
@@ -297,6 +326,7 @@ public override void Validate()
297326
{
298327
_ = this.ID;
299328
_ = this.BillingCycleDay;
329+
_ = this.CanDeferBilling;
300330
_ = this.CurrentBillingPeriodEndDate;
301331
_ = this.CurrentBillingPeriodStartDate;
302332
_ = this.EndDate;

src/Orb/Models/Subscriptions/SubscriptionPriceIntervalsParams.cs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,29 @@ out JsonElement element
161161
}
162162
}
163163

164+
/// <summary>
165+
/// If true, ending an in-arrears price interval mid-cycle will defer billing
166+
/// the final line itemuntil the next scheduled invoice. If false, it will be
167+
/// billed on its end date. If not provided, behaviorwill follow account default.
168+
/// </summary>
169+
public bool? CanDeferBilling
170+
{
171+
get
172+
{
173+
if (!this._bodyProperties.TryGetValue("can_defer_billing", out JsonElement element))
174+
return null;
175+
176+
return JsonSerializer.Deserialize<bool?>(element, ModelBase.SerializerOptions);
177+
}
178+
init
179+
{
180+
this._bodyProperties["can_defer_billing"] = JsonSerializer.SerializeToElement(
181+
value,
182+
ModelBase.SerializerOptions
183+
);
184+
}
185+
}
186+
164187
/// <summary>
165188
/// A list of price intervals to edit on the subscription.
166189
/// </summary>
@@ -8335,6 +8358,29 @@ public long? BillingCycleDay
83358358
}
83368359
}
83378360

8361+
/// <summary>
8362+
/// If true, ending an in-arrears price interval mid-cycle will defer billing
8363+
/// the final line itemuntil the next scheduled invoice. If false, it will be
8364+
/// billed on its end date. If not provided, behaviorwill follow account default.
8365+
/// </summary>
8366+
public bool? CanDeferBilling
8367+
{
8368+
get
8369+
{
8370+
if (!this._properties.TryGetValue("can_defer_billing", out JsonElement element))
8371+
return null;
8372+
8373+
return JsonSerializer.Deserialize<bool?>(element, ModelBase.SerializerOptions);
8374+
}
8375+
init
8376+
{
8377+
this._properties["can_defer_billing"] = JsonSerializer.SerializeToElement(
8378+
value,
8379+
ModelBase.SerializerOptions
8380+
);
8381+
}
8382+
}
8383+
83388384
/// <summary>
83398385
/// The updated end date of this price interval. If not specified, the end date
83408386
/// will not be updated.
@@ -8463,6 +8509,7 @@ public override void Validate()
84638509
{
84648510
_ = this.PriceIntervalID;
84658511
_ = this.BillingCycleDay;
8512+
_ = this.CanDeferBilling;
84668513
this.EndDate?.Validate();
84678514
_ = this.Filter;
84688515
foreach (var item in this.FixedFeeQuantityTransitions ?? [])

src/Orb/Models/TieredConfig.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,34 @@ public required List<Tier26> Tiers
4343
}
4444
}
4545

46+
/// <summary>
47+
/// If true, subtotals from this price are prorated based on the service period
48+
/// </summary>
49+
public bool? Prorated
50+
{
51+
get
52+
{
53+
if (!this._properties.TryGetValue("prorated", out JsonElement element))
54+
return null;
55+
56+
return JsonSerializer.Deserialize<bool?>(element, ModelBase.SerializerOptions);
57+
}
58+
init
59+
{
60+
this._properties["prorated"] = JsonSerializer.SerializeToElement(
61+
value,
62+
ModelBase.SerializerOptions
63+
);
64+
}
65+
}
66+
4667
public override void Validate()
4768
{
4869
foreach (var item in this.Tiers)
4970
{
5071
item.Validate();
5172
}
73+
_ = this.Prorated;
5274
}
5375

5476
public TieredConfig() { }

src/Orb/Models/UnitConfig.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,31 @@ public required string UnitAmount
4646
}
4747
}
4848

49+
/// <summary>
50+
/// If true, subtotals from this price are prorated based on the service period
51+
/// </summary>
52+
public bool? Prorated
53+
{
54+
get
55+
{
56+
if (!this._properties.TryGetValue("prorated", out JsonElement element))
57+
return null;
58+
59+
return JsonSerializer.Deserialize<bool?>(element, ModelBase.SerializerOptions);
60+
}
61+
init
62+
{
63+
this._properties["prorated"] = JsonSerializer.SerializeToElement(
64+
value,
65+
ModelBase.SerializerOptions
66+
);
67+
}
68+
}
69+
4970
public override void Validate()
5071
{
5172
_ = this.UnitAmount;
73+
_ = this.Prorated;
5274
}
5375

5476
public UnitConfig() { }

0 commit comments

Comments
 (0)