mirror of
https://github.com/we-promise/sure.git
synced 2026-05-08 21:25:00 +00:00
feat(api): expose rule export endpoints (#1602)
* feat(api): expose rule export endpoints * fix(api): tighten rule export contracts * fix(api): document balance sheet auth errors * test(api): align rule API key fixtures * Update docs/api/openapi.yaml Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Juan José Mata <jjmata@jjmata.com> * Quick win Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Juan José Mata <jjmata@jjmata.com> --------- Signed-off-by: Juan José Mata <juanjo.mata@gmail.com> Signed-off-by: Juan José Mata <jjmata@jjmata.com> Co-authored-by: Juan José Mata <juanjo.mata@gmail.com> Co-authored-by: Juan José Mata <jjmata@jjmata.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
@@ -463,6 +463,138 @@ components:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/components/schemas/TagDetail"
|
||||
RuleAction:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- action_type
|
||||
- created_at
|
||||
- updated_at
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
format: uuid
|
||||
action_type:
|
||||
type: string
|
||||
value:
|
||||
type: string
|
||||
nullable: true
|
||||
created_at:
|
||||
type: string
|
||||
format: date-time
|
||||
updated_at:
|
||||
type: string
|
||||
format: date-time
|
||||
RuleCondition:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- condition_type
|
||||
- operator
|
||||
- sub_conditions
|
||||
- created_at
|
||||
- updated_at
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
format: uuid
|
||||
condition_type:
|
||||
type: string
|
||||
operator:
|
||||
type: string
|
||||
value:
|
||||
type: string
|
||||
nullable: true
|
||||
sub_conditions:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/components/schemas/RuleCondition"
|
||||
created_at:
|
||||
type: string
|
||||
format: date-time
|
||||
updated_at:
|
||||
type: string
|
||||
format: date-time
|
||||
Rule:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- resource_type
|
||||
- active
|
||||
- conditions
|
||||
- actions
|
||||
- created_at
|
||||
- updated_at
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
format: uuid
|
||||
name:
|
||||
type: string
|
||||
nullable: true
|
||||
resource_type:
|
||||
type: string
|
||||
enum:
|
||||
- transaction
|
||||
active:
|
||||
type: boolean
|
||||
effective_date:
|
||||
type: string
|
||||
format: date
|
||||
nullable: true
|
||||
conditions:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/components/schemas/RuleCondition"
|
||||
actions:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/components/schemas/RuleAction"
|
||||
created_at:
|
||||
type: string
|
||||
format: date-time
|
||||
updated_at:
|
||||
type: string
|
||||
format: date-time
|
||||
RuleResponse:
|
||||
type: object
|
||||
required:
|
||||
- data
|
||||
properties:
|
||||
data:
|
||||
"$ref": "#/components/schemas/Rule"
|
||||
RuleCollection:
|
||||
type: object
|
||||
required:
|
||||
- data
|
||||
- meta
|
||||
properties:
|
||||
data:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/components/schemas/Rule"
|
||||
meta:
|
||||
type: object
|
||||
required:
|
||||
- current_page
|
||||
- total_pages
|
||||
- total_count
|
||||
- per_page
|
||||
properties:
|
||||
current_page:
|
||||
type: integer
|
||||
next_page:
|
||||
type: integer
|
||||
nullable: true
|
||||
prev_page:
|
||||
type: integer
|
||||
nullable: true
|
||||
total_pages:
|
||||
type: integer
|
||||
total_count:
|
||||
type: integer
|
||||
per_page:
|
||||
type: integer
|
||||
Transfer:
|
||||
type: object
|
||||
required:
|
||||
@@ -2216,6 +2348,105 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
"/api/v1/rules":
|
||||
get:
|
||||
summary: List rules
|
||||
tags:
|
||||
- Rules
|
||||
security:
|
||||
- apiKeyAuth: []
|
||||
parameters:
|
||||
- name: page
|
||||
in: query
|
||||
required: false
|
||||
description: 'Page number (default: 1)'
|
||||
schema:
|
||||
type: integer
|
||||
- name: per_page
|
||||
in: query
|
||||
required: false
|
||||
description: 'Items per page (default: 25, max: 100)'
|
||||
schema:
|
||||
type: integer
|
||||
- name: resource_type
|
||||
in: query
|
||||
required: false
|
||||
description: Filter by rule resource type
|
||||
schema:
|
||||
type: string
|
||||
enum:
|
||||
- transaction
|
||||
- name: active
|
||||
in: query
|
||||
required: false
|
||||
description: Filter by active status
|
||||
schema:
|
||||
type: boolean
|
||||
responses:
|
||||
'200':
|
||||
description: rules listed
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/RuleCollection"
|
||||
'401':
|
||||
description: unauthorized
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
'403':
|
||||
description: forbidden - requires read scope
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
'422':
|
||||
description: unsupported resource type
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
"/api/v1/rules/{id}":
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
description: Rule ID
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
get:
|
||||
summary: Retrieve a rule
|
||||
tags:
|
||||
- Rules
|
||||
security:
|
||||
- apiKeyAuth: []
|
||||
responses:
|
||||
'200':
|
||||
description: rule retrieved
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/RuleResponse"
|
||||
'401':
|
||||
description: unauthorized
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
'403':
|
||||
description: forbidden - requires read scope
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
'404':
|
||||
description: rule not found
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
"/api/v1/tags":
|
||||
get:
|
||||
summary: List tags
|
||||
|
||||
Reference in New Issue
Block a user