Skip to content

Commit 8e26f49

Browse files
OrriMandarinChibiBlasphem
authored andcommitted
feat(api): add AI description endpoint for scenario iteration rules
- Introduced a new endpoint `/scenario-iteration-rules/{ruleId}/ai-description` to retrieve the AI description for a specific scenario iteration rule. - Added `ScenarioIterationRuleAiDescriptionDto` schema to define the response structure. - Updated TypeScript definitions to include the new API functionality.
1 parent 3cc5696 commit 8e26f49

4 files changed

Lines changed: 69 additions & 3 deletions

File tree

packages/marble-api/openapis/marblecore-api.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ paths:
221221
$ref: ./marblecore-api/scenario-iteration-rules.yml#/~1scenario-iteration-rules
222222
/scenario-iteration-rules/{ruleId}:
223223
$ref: ./marblecore-api/scenario-iteration-rules.yml#/~1scenario-iteration-rules~1{ruleId}
224+
/scenario-iteration-rules/{ruleId}/ai-description:
225+
$ref: ./marblecore-api/scenario-iteration-rules.yml#/~1scenario-iteration-rules~1{ruleId}~1ai-description
224226

225227
# SCENARIO PUBLICATIONS
226228

packages/marble-api/openapis/marblecore-api/_schemas.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ ScenarioIterationRuleDto:
253253
$ref: scenario-iteration-rules.yml#/components/schemas/ScenarioIterationRuleDto
254254
ScenarioValidationDto:
255255
$ref: scenario-iterations.yml#/components/schemas/ScenarioValidationDto
256+
ScenarioIterationRuleAiDescriptionDto:
257+
$ref: scenario-iteration-rules.yml#/components/schemas/ScenarioIterationRuleAiDescriptionDto
256258

257259
# SCREENINGS
258260

packages/marble-api/openapis/marblecore-api/scenario-iteration-rules.yml

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
- bearerAuth: []
7474
parameters:
7575
- name: ruleId
76-
description: ID of the rule that need to be fetched
76+
description: ID of the rule that needs to be fetched
7777
in: path
7878
required: true
7979
schema:
@@ -106,7 +106,7 @@
106106
- bearerAuth: []
107107
parameters:
108108
- name: ruleId
109-
description: ID of the rule that need to be updated
109+
description: ID of the rule that needs to be updated
110110
in: path
111111
required: true
112112
schema:
@@ -146,7 +146,7 @@
146146
- bearerAuth: []
147147
parameters:
148148
- name: ruleId
149-
description: ID of the rule that need to be delete
149+
description: ID of the rule that needs to be delete
150150
in: path
151151
required: true
152152
schema:
@@ -162,6 +162,36 @@
162162
'404':
163163
$ref: 'components.yml#/responses/404'
164164

165+
/scenario-iteration-rules/{ruleId}/ai-description:
166+
get:
167+
tags:
168+
- Scenario Iteration Rules
169+
summary: Get AI description for a scenario iteration rule
170+
operationId: getScenarioIterationRuleAiDescription
171+
security:
172+
- bearerAuth: []
173+
parameters:
174+
- name: ruleId
175+
description: ID of the rule that needs to be fetched
176+
in: path
177+
required: true
178+
schema:
179+
type: string
180+
format: uuid
181+
responses:
182+
'200':
183+
description: The AI description for the scenario iteration rule corresponding to the provided `ruleId`
184+
content:
185+
application/json:
186+
schema:
187+
$ref: '#/components/schemas/ScenarioIterationRuleAiDescriptionDto'
188+
'401':
189+
$ref: 'components.yml#/responses/401'
190+
'403':
191+
$ref: 'components.yml#/responses/403'
192+
'404':
193+
$ref: 'components.yml#/responses/404'
194+
165195
components:
166196
schemas:
167197
ScenarioIterationRuleDto:
@@ -245,3 +275,11 @@ components:
245275
- $ref: 'ast.yml#/components/schemas/NodeDto'
246276
score_modifier:
247277
type: integer
278+
ScenarioIterationRuleAiDescriptionDto:
279+
type: object
280+
properties:
281+
description:
282+
description: The AI description for the scenario iteration rule
283+
type: string
284+
required:
285+
- description

packages/marble-api/src/generated/marblecore-api.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,10 @@ export type UpdateScenarioIterationRuleBodyDto = {
960960
formula_ast_expression?: (NodeDto) | null;
961961
score_modifier?: number;
962962
};
963+
export type ScenarioIterationRuleAiDescriptionDto = {
964+
/** The AI description for the scenario iteration rule */
965+
description: string;
966+
};
963967
export type PublicationAction = "publish" | "unpublish";
964968
export type ScenarioPublication = {
965969
id: string;
@@ -3294,6 +3298,26 @@ export function deleteScenarioIterationRule(ruleId: string, opts?: Oazapfts.Requ
32943298
method: "DELETE"
32953299
}));
32963300
}
3301+
/**
3302+
* Get AI description for a scenario iteration rule
3303+
*/
3304+
export function getScenarioIterationRuleAiDescription(ruleId: string, opts?: Oazapfts.RequestOpts) {
3305+
return oazapfts.ok(oazapfts.fetchJson<{
3306+
status: 200;
3307+
data: ScenarioIterationRuleAiDescriptionDto;
3308+
} | {
3309+
status: 401;
3310+
data: string;
3311+
} | {
3312+
status: 403;
3313+
data: string;
3314+
} | {
3315+
status: 404;
3316+
data: string;
3317+
}>(`/scenario-iteration-rules/${encodeURIComponent(ruleId)}/ai-description`, {
3318+
...opts
3319+
}));
3320+
}
32973321
/**
32983322
* List scenario publications
32993323
*/

0 commit comments

Comments
 (0)