Skip to content

Commit

Permalink
feat: Adds UsageRecord in subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
ahom committed Oct 18, 2021
1 parent 1c532f4 commit 8a2c5eb
Show file tree
Hide file tree
Showing 7 changed files with 161 additions and 86 deletions.
24 changes: 15 additions & 9 deletions models/Subscription.v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
"description": "Souscription Toaztr",
"type": "object",
"properties": {
"source": {
"type": "string",
"description": "Système qui a créé la souscription.",
"enum": [
"STRIPE",
"MANUAL",
"MASTER"
]
},
"type": {
"$ref": "./SubscriptionType.v1.json"
},
Expand All @@ -23,15 +32,6 @@
"format": "date-time",
"description": "Date limite de validité."
},
"source": {
"type": "string",
"description": "Système qui a créé la souscription.",
"enum": [
"STRIPE",
"MANUAL",
"MASTER"
]
},
"scopes": {
"description": "Scopes authorisés pour la souscription.",
"type": "array",
Expand All @@ -50,6 +50,12 @@
"description": "Nombre d'items en utilisation.",
"minimum": 0,
"default": 0
},
"metered_items": {
"type": "array",
"items": {
"$ref": "./SubscriptionMeteredItem.v1.json"
}
}
},
"required": [
Expand Down
26 changes: 26 additions & 0 deletions models/SubscriptionMeteredItem.v1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"type": "object",
"title": "SubscriptionMeteredItem",
"description": "Critères de sélection des appels enregistrés.",
"properties": {
"name": {
"type": "string",
"description": "Nom de l'item"
},
"ref": {
"type": "string",
"description": "Référence de l'item."
},
"paths": {
"type": "array",
"items": {
"$ref": "./SubscriptionMeteredPath.v1.json"
}
}
},
"required": [
"name",
"ref",
"paths"
]
}
18 changes: 18 additions & 0 deletions models/SubscriptionMeteredPath.v1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"type": "object",
"title": "SubscriptionMeteredPath",
"description": "Chemin HTTP.",
"properties": {
"method": {
"$ref": "./SubscriptionRequestLogMethod.v1.json"
},
"path": {
"type": "string",
"description": "Chemin de la resource."
}
},
"required": [
"method",
"path"
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "object",
"title": "RequestLog",
"title": "SubscriptionRequestLog",
"description": "Trace d'une requête.",
"properties": {
"timestamp": {
Expand All @@ -9,13 +9,7 @@
"format": "date-time"
},
"method": {
"description": "Méthode HTTP utilisée.",
"type": "string",
"enum": [
"POST",
"PUT",
"DELETE"
]
"$ref": "./SubscriptionRequestLogMethod.v1.json"
},
"uri": {
"description": "Identifiant unique de la resource.",
Expand Down
10 changes: 10 additions & 0 deletions models/SubscriptionRequestLogMethod.v1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"title": "SubscriptionRequestLogMethod",
"type": "string",
"description": "Méthode HTTP utilisée.",
"enum": [
"POST",
"PUT",
"DELETE"
]
}
25 changes: 25 additions & 0 deletions models/SubscriptionUsageRecord.v1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"title": "SubscriptionUsageRecord",
"description": "Enregistrement de l'utilisation d'une soucription.",
"type": "object",
"properties": {
"timestamp": {
"type": "string",
"format": "date-time",
"description": "Date d'enregistrement."
},
"ref": {
"type": "string",
"description": "Référence de l'item."
},
"count": {
"type": "number",
"description": "Nombre d'appels enregistrés."
}
},
"required": [
"timestamp",
"ref",
"count"
]
}
Loading

0 comments on commit 8a2c5eb

Please sign in to comment.