-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1686 from openmeterio/feat/plan-api-typespec
feat: add Plan API to typespec
- Loading branch information
Showing
15 changed files
with
5,191 additions
and
2,268 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
namespace OpenMeter.ProductCatalog; | ||
|
||
/** | ||
* The type of the discount. | ||
*/ | ||
@friendlyName("DiscountType") | ||
enum DiscountType { | ||
percentage: "percentage", | ||
amount: "amount", | ||
usage: "usage", | ||
} | ||
|
||
/** | ||
* A discount on a price. | ||
* One of: percentage, amount, or usage. | ||
*/ | ||
@discriminator("type") | ||
@friendlyName("Discount") | ||
union Discount { | ||
@summary("Percentage discount") | ||
percentage: DiscountPercentage, | ||
|
||
// @summary("Amount discount") | ||
// amount: DiscountAmount, | ||
|
||
// @summary("Usage discount") | ||
// usage: DiscountUsage, | ||
} | ||
|
||
/** | ||
* Percentage discount. | ||
*/ | ||
@friendlyName("DiscountPercentage") | ||
model DiscountPercentage { | ||
/** | ||
* The type of the discount. | ||
*/ | ||
@summary("Type") | ||
type: DiscountType.percentage; | ||
|
||
/** | ||
* The percentage of the discount. | ||
*/ | ||
@summary("Percentage") | ||
@minValue(0) | ||
@maxValue(100) | ||
percentage: float; | ||
} | ||
|
||
// NOTE(chrisgacsal): amount discount is going to be implemented in future releases | ||
// /** | ||
// * Amount discount. | ||
// */ | ||
// @friendlyName("DiscountAmount") | ||
// model DiscountAmount { | ||
// /** | ||
// * The type of the discount. | ||
// */ | ||
// @summary("Type") | ||
// type: DiscountType.amount; | ||
|
||
// /** | ||
// * The amount of the discount. | ||
// */ | ||
// @summary("Amount") | ||
// amount: Money; | ||
// } | ||
|
||
// NOTE(chrisgacsal): usage discount is going to be implemented in future releases | ||
// /** | ||
// * Usage discount. | ||
// */ | ||
// @friendlyName("UsageDiscount") | ||
// model DiscountUsage { | ||
// /** | ||
// * The type of the discount. | ||
// */ | ||
// @summary("Type") | ||
// type: DiscountType.usage; | ||
|
||
// /** | ||
// * The usage discount. | ||
// */ | ||
// @summary("Usage") | ||
// usage: float64; | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import "@typespec/http"; | ||
import "@typespec/openapi"; | ||
import "@typespec/openapi3"; | ||
|
||
import ".."; | ||
|
||
// Package Contents | ||
import "./discounts.tsp"; | ||
import "./plan.tsp"; | ||
import "./prices.tsp"; | ||
import "./ratecards.tsp"; | ||
import "./routes.tsp"; | ||
|
||
namespace OpenMeter.ProductCatalog; |
Oops, something went wrong.