Skip to content

Commit 386b882

Browse files
modify endpoint for decisions
1 parent e334b95 commit 386b882

3 files changed

Lines changed: 39 additions & 88 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ paths:
5757
/credentials:
5858
$ref: ./marblecore-api/authorization.yml#/~1credentials
5959

60-
/decisions/with-ranks: # For ordering, should go down within decisions
61-
$ref: ./marblecore-api/decisions.yml#/~1decisions~1with-ranks
60+
/decisions: # For ordering, should go down within decisions
61+
$ref: ./marblecore-api/decisions.yml#/~1decisions
6262

6363
# ANNOTATIONS
6464

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

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/decisions/with-ranks:
1+
/decisions:
22
get:
33
tags:
44
- Decisions
@@ -114,31 +114,6 @@
114114
$ref: 'components.yml#/responses/401'
115115
'403':
116116
$ref: 'components.yml#/responses/403'
117-
post:
118-
tags:
119-
- Decisions
120-
summary: Create a decision
121-
operationId: createDecision
122-
security:
123-
- bearerAuth: []
124-
requestBody:
125-
description: 'Payload object used to be trigger the decision engine'
126-
content:
127-
application/json:
128-
schema:
129-
$ref: '#/components/schemas/CreateDecisionBody'
130-
required: true
131-
responses:
132-
'200':
133-
description: The decision corresponding to the provided payload
134-
content:
135-
application/json:
136-
schema:
137-
$ref: '#/components/schemas/DecisionDetailDto'
138-
'401':
139-
$ref: 'components.yml#/responses/401'
140-
'403':
141-
$ref: 'components.yml#/responses/403'
142117
/decisions/{decisionId}:
143118
get:
144119
tags:

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

Lines changed: 36 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -95,46 +95,6 @@ export type DecisionDto = {
9595
trigger_object_type: string;
9696
scheduled_execution_id?: string;
9797
};
98-
export type CreateDecisionBody = {
99-
scenario_id: string;
100-
trigger_object: object;
101-
object_type: string;
102-
};
103-
export type ConstantDto = ((string | null) | (number | null) | (boolean | null) | (ConstantDto[] | null) | ({
104-
[key: string]: ConstantDto;
105-
} | null)) | null;
106-
export type EvaluationErrorCodeDto = "UNEXPECTED_ERROR" | "UNDEFINED_FUNCTION" | "WRONG_NUMBER_OF_ARGUMENTS" | "MISSING_NAMED_ARGUMENT" | "ARGUMENTS_MUST_BE_INT_OR_FLOAT" | "ARGUMENTS_MUST_BE_INT_FLOAT_OR_TIME" | "ARGUMENT_MUST_BE_INTEGER" | "ARGUMENT_MUST_BE_STRING" | "ARGUMENT_MUST_BE_BOOLEAN" | "ARGUMENT_MUST_BE_LIST" | "ARGUMENT_MUST_BE_CONVERTIBLE_TO_DURATION" | "ARGUMENT_MUST_BE_TIME" | "ARGUMENT_REQUIRED" | "ARGUMENT_INVALID_TYPE" | "LIST_NOT_FOUND" | "DATABASE_ACCESS_NOT_FOUND" | "PAYLOAD_FIELD_NOT_FOUND" | "NULL_FIELD_READ" | "NO_ROWS_READ" | "DIVISION_BY_ZERO" | "PAYLOAD_FIELD_NOT_FOUND" | "RUNTIME_EXPRESSION_ERROR";
107-
export type EvaluationErrorDto = {
108-
error: EvaluationErrorCodeDto;
109-
message: string;
110-
argument_index?: number;
111-
argument_name?: string;
112-
};
113-
export type NodeEvaluationDto = {
114-
return_value: {
115-
value?: ConstantDto;
116-
is_omitted: boolean;
117-
};
118-
errors: EvaluationErrorDto[] | null;
119-
children?: NodeEvaluationDto[];
120-
named_children?: {
121-
[key: string]: NodeEvaluationDto;
122-
};
123-
skipped?: boolean;
124-
};
125-
export type RuleExecutionDto = {
126-
error?: Error;
127-
description: string;
128-
name: string;
129-
outcome: "hit" | "no_hit" | "snoozed" | "error";
130-
result: boolean;
131-
rule_id: string;
132-
score_modifier: number;
133-
rule_evaluation?: NodeEvaluationDto;
134-
};
135-
export type DecisionDetailDto = DecisionDto & {
136-
rules: RuleExecutionDto[];
137-
};
13898
export type ComponentsSchemasTagEntityAnnotationDtoAllOf0 = {
13999
id: string;
140100
case_id: string;
@@ -508,6 +468,41 @@ export type ScheduledExecutionDto = {
508468
started_at: string;
509469
status: "pending" | "processing" | "success" | "failure" | "partial_failure";
510470
};
471+
export type ConstantDto = ((string | null) | (number | null) | (boolean | null) | (ConstantDto[] | null) | ({
472+
[key: string]: ConstantDto;
473+
} | null)) | null;
474+
export type EvaluationErrorCodeDto = "UNEXPECTED_ERROR" | "UNDEFINED_FUNCTION" | "WRONG_NUMBER_OF_ARGUMENTS" | "MISSING_NAMED_ARGUMENT" | "ARGUMENTS_MUST_BE_INT_OR_FLOAT" | "ARGUMENTS_MUST_BE_INT_FLOAT_OR_TIME" | "ARGUMENT_MUST_BE_INTEGER" | "ARGUMENT_MUST_BE_STRING" | "ARGUMENT_MUST_BE_BOOLEAN" | "ARGUMENT_MUST_BE_LIST" | "ARGUMENT_MUST_BE_CONVERTIBLE_TO_DURATION" | "ARGUMENT_MUST_BE_TIME" | "ARGUMENT_REQUIRED" | "ARGUMENT_INVALID_TYPE" | "LIST_NOT_FOUND" | "DATABASE_ACCESS_NOT_FOUND" | "PAYLOAD_FIELD_NOT_FOUND" | "NULL_FIELD_READ" | "NO_ROWS_READ" | "DIVISION_BY_ZERO" | "PAYLOAD_FIELD_NOT_FOUND" | "RUNTIME_EXPRESSION_ERROR";
475+
export type EvaluationErrorDto = {
476+
error: EvaluationErrorCodeDto;
477+
message: string;
478+
argument_index?: number;
479+
argument_name?: string;
480+
};
481+
export type NodeEvaluationDto = {
482+
return_value: {
483+
value?: ConstantDto;
484+
is_omitted: boolean;
485+
};
486+
errors: EvaluationErrorDto[] | null;
487+
children?: NodeEvaluationDto[];
488+
named_children?: {
489+
[key: string]: NodeEvaluationDto;
490+
};
491+
skipped?: boolean;
492+
};
493+
export type RuleExecutionDto = {
494+
error?: Error;
495+
description: string;
496+
name: string;
497+
outcome: "hit" | "no_hit" | "snoozed" | "error";
498+
result: boolean;
499+
rule_id: string;
500+
score_modifier: number;
501+
rule_evaluation?: NodeEvaluationDto;
502+
};
503+
export type DecisionDetailDto = DecisionDto & {
504+
rules: RuleExecutionDto[];
505+
};
511506
export type RuleSnoozeDto = {
512507
id: string;
513508
pivot_value: string;
@@ -1419,7 +1414,7 @@ export function listDecisions({ caseId, endDate, hasCase, outcome, pivotValue, s
14191414
} | {
14201415
status: 403;
14211416
data: string;
1422-
}>(`/decisions/with-ranks${QS.query(QS.explode({
1417+
}>(`/decisions${QS.query(QS.explode({
14231418
"case_id[]": caseId,
14241419
end_date: endDate,
14251420
has_case: hasCase,
@@ -1439,25 +1434,6 @@ export function listDecisions({ caseId, endDate, hasCase, outcome, pivotValue, s
14391434
...opts
14401435
}));
14411436
}
1442-
/**
1443-
* Create a decision
1444-
*/
1445-
export function createDecision(createDecisionBody: CreateDecisionBody, opts?: Oazapfts.RequestOpts) {
1446-
return oazapfts.ok(oazapfts.fetchJson<{
1447-
status: 200;
1448-
data: DecisionDetailDto;
1449-
} | {
1450-
status: 401;
1451-
data: string;
1452-
} | {
1453-
status: 403;
1454-
data: string;
1455-
}>("/decisions/with-ranks", oazapfts.json({
1456-
...opts,
1457-
method: "POST",
1458-
body: createDecisionBody
1459-
})));
1460-
}
14611437
/**
14621438
* Get an annotation by ID
14631439
*/

0 commit comments

Comments
 (0)