@epilot/erp-integration-client 0.15.0 → 0.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/openapi.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.0.3",
3
3
  "info": {
4
4
  "title": "ERP Integration API",
5
- "version": "0.17.2",
5
+ "version": "0.22.0",
6
6
  "description": "API for integrating with ERP systems, handling tracking acknowledgments, triggering ERP processes, and processing ERP updates."
7
7
  },
8
8
  "tags": [
@@ -17,12 +17,13 @@
17
17
  {
18
18
  "name": "integrations",
19
19
  "description": "Integration and Use Case management endpoints"
20
+ },
21
+ {
22
+ "name": "monitoring",
23
+ "description": "Monitoring and analytics endpoints"
20
24
  }
21
25
  ],
22
26
  "servers": [
23
- {
24
- "url": "https://erp-integration-api.sls.epilot.io"
25
- },
26
27
  {
27
28
  "url": "https://erp-integration-api.sls.epilot.io"
28
29
  }
@@ -1560,6 +1561,227 @@
1560
1561
  }
1561
1562
  }
1562
1563
  },
1564
+ "/v2/integrations": {
1565
+ "get": {
1566
+ "operationId": "listIntegrationsV2",
1567
+ "summary": "listIntegrationsV2",
1568
+ "description": "Retrieve all integrations with embedded use cases for the authenticated organization",
1569
+ "tags": [
1570
+ "integrations"
1571
+ ],
1572
+ "responses": {
1573
+ "200": {
1574
+ "description": "Successfully retrieved integrations with use cases",
1575
+ "content": {
1576
+ "application/json": {
1577
+ "schema": {
1578
+ "type": "object",
1579
+ "required": [
1580
+ "integrations"
1581
+ ],
1582
+ "properties": {
1583
+ "integrations": {
1584
+ "type": "array",
1585
+ "items": {
1586
+ "$ref": "#/components/schemas/IntegrationWithUseCases"
1587
+ }
1588
+ }
1589
+ }
1590
+ }
1591
+ }
1592
+ }
1593
+ },
1594
+ "401": {
1595
+ "$ref": "#/components/responses/Unauthorized"
1596
+ },
1597
+ "500": {
1598
+ "$ref": "#/components/responses/InternalServerError"
1599
+ }
1600
+ }
1601
+ },
1602
+ "post": {
1603
+ "operationId": "createIntegrationV2",
1604
+ "summary": "createIntegrationV2",
1605
+ "description": "Create a new integration with embedded use cases.\n",
1606
+ "tags": [
1607
+ "integrations"
1608
+ ],
1609
+ "requestBody": {
1610
+ "required": true,
1611
+ "content": {
1612
+ "application/json": {
1613
+ "schema": {
1614
+ "$ref": "#/components/schemas/UpsertIntegrationWithUseCasesRequest"
1615
+ }
1616
+ }
1617
+ }
1618
+ },
1619
+ "responses": {
1620
+ "201": {
1621
+ "description": "Integration created successfully with use cases",
1622
+ "content": {
1623
+ "application/json": {
1624
+ "schema": {
1625
+ "$ref": "#/components/schemas/IntegrationWithUseCases"
1626
+ }
1627
+ }
1628
+ }
1629
+ },
1630
+ "400": {
1631
+ "$ref": "#/components/responses/BadRequest"
1632
+ },
1633
+ "401": {
1634
+ "$ref": "#/components/responses/Unauthorized"
1635
+ },
1636
+ "500": {
1637
+ "$ref": "#/components/responses/InternalServerError"
1638
+ }
1639
+ }
1640
+ }
1641
+ },
1642
+ "/v2/integrations/{integrationId}": {
1643
+ "get": {
1644
+ "operationId": "getIntegrationV2",
1645
+ "summary": "getIntegrationV2",
1646
+ "description": "Retrieve a specific integration with all its embedded use cases",
1647
+ "tags": [
1648
+ "integrations"
1649
+ ],
1650
+ "parameters": [
1651
+ {
1652
+ "name": "integrationId",
1653
+ "in": "path",
1654
+ "required": true,
1655
+ "description": "The integration ID",
1656
+ "schema": {
1657
+ "type": "string",
1658
+ "format": "uuid"
1659
+ }
1660
+ }
1661
+ ],
1662
+ "responses": {
1663
+ "200": {
1664
+ "description": "Successfully retrieved integration with use cases",
1665
+ "content": {
1666
+ "application/json": {
1667
+ "schema": {
1668
+ "$ref": "#/components/schemas/IntegrationWithUseCases"
1669
+ }
1670
+ }
1671
+ }
1672
+ },
1673
+ "401": {
1674
+ "$ref": "#/components/responses/Unauthorized"
1675
+ },
1676
+ "404": {
1677
+ "description": "Integration not found"
1678
+ },
1679
+ "500": {
1680
+ "$ref": "#/components/responses/InternalServerError"
1681
+ }
1682
+ }
1683
+ },
1684
+ "put": {
1685
+ "operationId": "updateIntegrationV2",
1686
+ "summary": "updateIntegrationV2",
1687
+ "description": "Update an existing integration with embedded use cases.\nThe integration must already exist.\nUse cases are updated declaratively:\n- Use cases in the request with matching IDs are updated\n- Use cases in the request without matching IDs are created\n- Existing use cases not in the request are deleted\n",
1688
+ "tags": [
1689
+ "integrations"
1690
+ ],
1691
+ "parameters": [
1692
+ {
1693
+ "name": "integrationId",
1694
+ "in": "path",
1695
+ "required": true,
1696
+ "description": "The integration ID (client-provided)",
1697
+ "schema": {
1698
+ "type": "string",
1699
+ "format": "uuid"
1700
+ }
1701
+ }
1702
+ ],
1703
+ "requestBody": {
1704
+ "required": true,
1705
+ "content": {
1706
+ "application/json": {
1707
+ "schema": {
1708
+ "$ref": "#/components/schemas/UpsertIntegrationWithUseCasesRequest"
1709
+ }
1710
+ }
1711
+ }
1712
+ },
1713
+ "responses": {
1714
+ "200": {
1715
+ "description": "Integration updated successfully with use cases",
1716
+ "content": {
1717
+ "application/json": {
1718
+ "schema": {
1719
+ "$ref": "#/components/schemas/IntegrationWithUseCases"
1720
+ }
1721
+ }
1722
+ }
1723
+ },
1724
+ "400": {
1725
+ "$ref": "#/components/responses/BadRequest"
1726
+ },
1727
+ "401": {
1728
+ "$ref": "#/components/responses/Unauthorized"
1729
+ },
1730
+ "404": {
1731
+ "description": "Integration not found"
1732
+ },
1733
+ "500": {
1734
+ "$ref": "#/components/responses/InternalServerError"
1735
+ }
1736
+ }
1737
+ },
1738
+ "delete": {
1739
+ "operationId": "deleteIntegrationV2",
1740
+ "summary": "deleteIntegrationV2",
1741
+ "description": "Delete an integration and all its use cases",
1742
+ "tags": [
1743
+ "integrations"
1744
+ ],
1745
+ "parameters": [
1746
+ {
1747
+ "name": "integrationId",
1748
+ "in": "path",
1749
+ "required": true,
1750
+ "description": "The integration ID",
1751
+ "schema": {
1752
+ "type": "string",
1753
+ "format": "uuid"
1754
+ }
1755
+ }
1756
+ ],
1757
+ "responses": {
1758
+ "200": {
1759
+ "description": "Integration deleted successfully",
1760
+ "content": {
1761
+ "application/json": {
1762
+ "schema": {
1763
+ "type": "object",
1764
+ "properties": {
1765
+ "message": {
1766
+ "type": "string"
1767
+ }
1768
+ }
1769
+ }
1770
+ }
1771
+ }
1772
+ },
1773
+ "401": {
1774
+ "$ref": "#/components/responses/Unauthorized"
1775
+ },
1776
+ "404": {
1777
+ "description": "Integration not found"
1778
+ },
1779
+ "500": {
1780
+ "$ref": "#/components/responses/InternalServerError"
1781
+ }
1782
+ }
1783
+ }
1784
+ },
1563
1785
  "/v1/integrations/{integrationId}/app-mapping": {
1564
1786
  "put": {
1565
1787
  "operationId": "setIntegrationAppMapping",
@@ -1684,53 +1906,153 @@
1684
1906
  }
1685
1907
  }
1686
1908
  }
1687
- }
1688
- },
1689
- "components": {
1690
- "securitySchemes": {
1691
- "EpilotAuth": {
1692
- "type": "http",
1693
- "scheme": "bearer",
1694
- "description": "Authorization header with epilot OAuth2 bearer token",
1695
- "bearerFormat": "JWT"
1696
- }
1697
1909
  },
1698
- "schemas": {
1699
- "ErrorResponseBase": {
1700
- "type": "object",
1701
- "properties": {
1702
- "code": {
1703
- "type": "string",
1704
- "description": "Computer-readable error code"
1705
- },
1706
- "message": {
1707
- "type": "string",
1708
- "description": "Error message"
1910
+ "/v1/integrations/{integrationId}/monitoring/events": {
1911
+ "post": {
1912
+ "operationId": "queryMonitoringEvents",
1913
+ "summary": "queryMonitoringEvents",
1914
+ "description": "Query ERP sync monitoring events for a specific integration.\nReturns detailed information about inbound/outbound sync events,\nincluding success rates, error breakdowns, and processing metrics.\n",
1915
+ "tags": [
1916
+ "monitoring",
1917
+ "integrations"
1918
+ ],
1919
+ "parameters": [
1920
+ {
1921
+ "name": "integrationId",
1922
+ "in": "path",
1923
+ "required": true,
1924
+ "description": "The integration ID",
1925
+ "schema": {
1926
+ "type": "string",
1927
+ "format": "uuid"
1928
+ }
1709
1929
  }
1710
- }
1711
- },
1712
- "ErpEvent": {
1713
- "type": "object",
1714
- "required": [
1715
- "event_type",
1716
- "object_type",
1717
- "timestamp",
1718
- "format",
1719
- "payload"
1720
1930
  ],
1721
- "properties": {
1722
- "event_type": {
1723
- "type": "string",
1724
- "enum": [
1725
- "CREATE",
1726
- "UPDATE",
1727
- "DELETE"
1728
- ],
1729
- "description": "Type of event (create, update, delete)"
1730
- },
1731
- "object_type": {
1732
- "type": "string",
1733
- "description": "Type of the object being updated (business_partner, contract_account, etc.)"
1931
+ "requestBody": {
1932
+ "required": true,
1933
+ "content": {
1934
+ "application/json": {
1935
+ "schema": {
1936
+ "$ref": "#/components/schemas/QueryMonitoringEventsRequest"
1937
+ }
1938
+ }
1939
+ }
1940
+ },
1941
+ "responses": {
1942
+ "200": {
1943
+ "$ref": "#/components/responses/QueryMonitoringEventsResponse"
1944
+ },
1945
+ "400": {
1946
+ "$ref": "#/components/responses/BadRequest"
1947
+ },
1948
+ "401": {
1949
+ "$ref": "#/components/responses/Unauthorized"
1950
+ },
1951
+ "404": {
1952
+ "$ref": "#/components/responses/NotFound"
1953
+ },
1954
+ "500": {
1955
+ "$ref": "#/components/responses/InternalServerError"
1956
+ }
1957
+ }
1958
+ }
1959
+ },
1960
+ "/v1/integrations/{integrationId}/monitoring/stats": {
1961
+ "post": {
1962
+ "operationId": "getMonitoringStats",
1963
+ "summary": "getMonitoringStats",
1964
+ "description": "Get aggregated statistics for ERP sync monitoring events for a specific integration.\nReturns summary metrics like total events, success/error counts,\nand breakdowns by use case, direction, and sync type.\n",
1965
+ "tags": [
1966
+ "monitoring",
1967
+ "integrations"
1968
+ ],
1969
+ "parameters": [
1970
+ {
1971
+ "name": "integrationId",
1972
+ "in": "path",
1973
+ "required": true,
1974
+ "description": "The integration ID",
1975
+ "schema": {
1976
+ "type": "string",
1977
+ "format": "uuid"
1978
+ }
1979
+ }
1980
+ ],
1981
+ "requestBody": {
1982
+ "required": true,
1983
+ "content": {
1984
+ "application/json": {
1985
+ "schema": {
1986
+ "$ref": "#/components/schemas/GetMonitoringStatsRequest"
1987
+ }
1988
+ }
1989
+ }
1990
+ },
1991
+ "responses": {
1992
+ "200": {
1993
+ "$ref": "#/components/responses/GetMonitoringStatsResponse"
1994
+ },
1995
+ "400": {
1996
+ "$ref": "#/components/responses/BadRequest"
1997
+ },
1998
+ "401": {
1999
+ "$ref": "#/components/responses/Unauthorized"
2000
+ },
2001
+ "404": {
2002
+ "$ref": "#/components/responses/NotFound"
2003
+ },
2004
+ "500": {
2005
+ "$ref": "#/components/responses/InternalServerError"
2006
+ }
2007
+ }
2008
+ }
2009
+ }
2010
+ },
2011
+ "components": {
2012
+ "securitySchemes": {
2013
+ "EpilotAuth": {
2014
+ "type": "http",
2015
+ "scheme": "bearer",
2016
+ "description": "Authorization header with epilot OAuth2 bearer token",
2017
+ "bearerFormat": "JWT"
2018
+ }
2019
+ },
2020
+ "schemas": {
2021
+ "ErrorResponseBase": {
2022
+ "type": "object",
2023
+ "properties": {
2024
+ "code": {
2025
+ "type": "string",
2026
+ "description": "Computer-readable error code"
2027
+ },
2028
+ "message": {
2029
+ "type": "string",
2030
+ "description": "Error message"
2031
+ }
2032
+ }
2033
+ },
2034
+ "ErpEvent": {
2035
+ "type": "object",
2036
+ "required": [
2037
+ "event_type",
2038
+ "object_type",
2039
+ "timestamp",
2040
+ "format",
2041
+ "payload"
2042
+ ],
2043
+ "properties": {
2044
+ "event_type": {
2045
+ "type": "string",
2046
+ "enum": [
2047
+ "CREATE",
2048
+ "UPDATE",
2049
+ "DELETE"
2050
+ ],
2051
+ "description": "Type of event (create, update, delete)"
2052
+ },
2053
+ "object_type": {
2054
+ "type": "string",
2055
+ "description": "Type of the object being updated (business_partner, contract_account, etc.). Corresponds to \"Event Name\" from the integration UI."
1734
2056
  },
1735
2057
  "timestamp": {
1736
2058
  "type": "string",
@@ -2016,7 +2338,7 @@
2016
2338
  }
2017
2339
  }
2018
2340
  },
2019
- "UseCase": {
2341
+ "UseCaseBase": {
2020
2342
  "type": "object",
2021
2343
  "required": [
2022
2344
  "id",
@@ -2051,8 +2373,7 @@
2051
2373
  "description": "Use case type"
2052
2374
  },
2053
2375
  "enabled": {
2054
- "type": "boolean",
2055
- "description": "Whether the use case is enabled"
2376
+ "type": "boolean"
2056
2377
  },
2057
2378
  "change_description": {
2058
2379
  "type": "string",
@@ -2069,8 +2390,60 @@
2069
2390
  "format": "date-time",
2070
2391
  "description": "ISO-8601 timestamp when the use case was last updated"
2071
2392
  }
2072
- },
2073
- "anyOf": [
2393
+ }
2394
+ },
2395
+ "InboundUseCase": {
2396
+ "allOf": [
2397
+ {
2398
+ "$ref": "#/components/schemas/UseCaseBase"
2399
+ },
2400
+ {
2401
+ "type": "object",
2402
+ "required": [
2403
+ "type"
2404
+ ],
2405
+ "properties": {
2406
+ "type": {
2407
+ "type": "string",
2408
+ "enum": [
2409
+ "inbound"
2410
+ ],
2411
+ "description": "Use case type"
2412
+ },
2413
+ "configuration": {
2414
+ "$ref": "#/components/schemas/InboundIntegrationEventConfiguration"
2415
+ }
2416
+ }
2417
+ }
2418
+ ]
2419
+ },
2420
+ "OutboundUseCase": {
2421
+ "allOf": [
2422
+ {
2423
+ "$ref": "#/components/schemas/UseCaseBase"
2424
+ },
2425
+ {
2426
+ "type": "object",
2427
+ "required": [
2428
+ "type"
2429
+ ],
2430
+ "properties": {
2431
+ "type": {
2432
+ "type": "string",
2433
+ "enum": [
2434
+ "outbound"
2435
+ ],
2436
+ "description": "Use case type"
2437
+ },
2438
+ "configuration": {
2439
+ "$ref": "#/components/schemas/OutboundIntegrationEventConfiguration"
2440
+ }
2441
+ }
2442
+ }
2443
+ ]
2444
+ },
2445
+ "UseCase": {
2446
+ "oneOf": [
2074
2447
  {
2075
2448
  "$ref": "#/components/schemas/InboundUseCase"
2076
2449
  },
@@ -2086,42 +2459,6 @@
2086
2459
  }
2087
2460
  }
2088
2461
  },
2089
- "InboundUseCase": {
2090
- "type": "object",
2091
- "required": [
2092
- "type"
2093
- ],
2094
- "properties": {
2095
- "type": {
2096
- "type": "string",
2097
- "enum": [
2098
- "inbound"
2099
- ],
2100
- "description": "Use case type"
2101
- },
2102
- "configuration": {
2103
- "$ref": "#/components/schemas/InboundIntegrationEventConfiguration"
2104
- }
2105
- }
2106
- },
2107
- "OutboundUseCase": {
2108
- "type": "object",
2109
- "required": [
2110
- "type"
2111
- ],
2112
- "properties": {
2113
- "type": {
2114
- "type": "string",
2115
- "enum": [
2116
- "outbound"
2117
- ],
2118
- "description": "Use case type"
2119
- },
2120
- "configuration": {
2121
- "$ref": "#/components/schemas/OutboundIntegrationEventConfiguration"
2122
- }
2123
- }
2124
- },
2125
2462
  "CreateUseCaseRequest": {
2126
2463
  "oneOf": [
2127
2464
  {
@@ -2777,14 +3114,13 @@
2777
3114
  "IntegrationMeterReading": {
2778
3115
  "type": "object",
2779
3116
  "required": [
2780
- "jsonataExpression",
2781
3117
  "meter",
2782
3118
  "fields"
2783
3119
  ],
2784
3120
  "properties": {
2785
3121
  "jsonataExpression": {
2786
3122
  "type": "string",
2787
- "description": "JSONata expression to extract meter reading items from the event data"
3123
+ "description": "Optional JSONata expression to extract meter reading items from the event data.\nIf not provided, the entire payload is used as the reading data.\nUseful when you need to extract an array of readings from a nested structure (e.g., \"$.readings\").\n"
2788
3124
  },
2789
3125
  "reading_matching": {
2790
3126
  "type": "string",
@@ -3050,34 +3386,206 @@
3050
3386
  ],
3051
3387
  "description": "Type hint for repeatable fields that require special search handling.\nThese fields are stored as arrays of objects (e.g., email: [{ email: \"value\" }]).\n"
3052
3388
  },
3053
- "ReplayEventsRequest": {
3389
+ "IntegrationWithUseCases": {
3054
3390
  "type": "object",
3391
+ "description": "Integration with embedded use cases for atomic CRUD operations",
3055
3392
  "required": [
3056
- "event_ids"
3393
+ "id",
3394
+ "orgId",
3395
+ "name",
3396
+ "use_cases",
3397
+ "created_at",
3398
+ "updated_at"
3057
3399
  ],
3058
3400
  "properties": {
3059
- "event_ids": {
3401
+ "id": {
3402
+ "type": "string",
3403
+ "format": "uuid",
3404
+ "description": "Unique identifier for the integration"
3405
+ },
3406
+ "orgId": {
3407
+ "type": "string",
3408
+ "description": "Organization ID"
3409
+ },
3410
+ "name": {
3411
+ "type": "string",
3412
+ "description": "Integration name"
3413
+ },
3414
+ "description": {
3415
+ "type": "string",
3416
+ "description": "Optional description of the integration"
3417
+ },
3418
+ "use_cases": {
3060
3419
  "type": "array",
3420
+ "description": "All use cases belonging to this integration",
3061
3421
  "items": {
3062
- "type": "string"
3063
- },
3064
- "minItems": 1,
3065
- "maxItems": 100,
3066
- "description": "List of event IDs to replay. Maximum 100 events per request."
3422
+ "$ref": "#/components/schemas/UseCase"
3423
+ }
3424
+ },
3425
+ "created_at": {
3426
+ "type": "string",
3427
+ "format": "date-time",
3428
+ "description": "ISO-8601 timestamp when the integration was created"
3429
+ },
3430
+ "updated_at": {
3431
+ "type": "string",
3432
+ "format": "date-time",
3433
+ "description": "ISO-8601 timestamp when the integration was last updated"
3067
3434
  }
3068
3435
  }
3069
3436
  },
3070
- "QueryEventsRequest": {
3437
+ "UpsertIntegrationWithUseCasesRequest": {
3071
3438
  "type": "object",
3439
+ "description": "Request to create or update an integration with embedded use cases (upsert).\nThis is a declarative operation - the request represents the desired state.\n",
3440
+ "required": [
3441
+ "name"
3442
+ ],
3072
3443
  "properties": {
3073
- "event_id": {
3444
+ "name": {
3074
3445
  "type": "string",
3075
- "description": "Filter by event ID"
3446
+ "minLength": 1,
3447
+ "maxLength": 255,
3448
+ "description": "Integration name"
3076
3449
  },
3077
- "event_type": {
3450
+ "description": {
3078
3451
  "type": "string",
3079
- "enum": [
3080
- "CREATE",
3452
+ "maxLength": 1000,
3453
+ "description": "Optional description of the integration"
3454
+ },
3455
+ "use_cases": {
3456
+ "type": "array",
3457
+ "description": "Full list of use cases (declarative). This replaces ALL existing use cases.\n- Use cases with an `id` field matching an existing use case will be updated\n- Use cases without an `id` or with a non-matching `id` will be created\n- Existing use cases not in this list will be deleted\n",
3458
+ "items": {
3459
+ "$ref": "#/components/schemas/EmbeddedUseCaseRequest"
3460
+ }
3461
+ }
3462
+ }
3463
+ },
3464
+ "EmbeddedUseCaseRequest": {
3465
+ "oneOf": [
3466
+ {
3467
+ "$ref": "#/components/schemas/EmbeddedInboundUseCaseRequest"
3468
+ },
3469
+ {
3470
+ "$ref": "#/components/schemas/EmbeddedOutboundUseCaseRequest"
3471
+ }
3472
+ ],
3473
+ "discriminator": {
3474
+ "propertyName": "type",
3475
+ "mapping": {
3476
+ "inbound": "#/components/schemas/EmbeddedInboundUseCaseRequest",
3477
+ "outbound": "#/components/schemas/EmbeddedOutboundUseCaseRequest"
3478
+ }
3479
+ }
3480
+ },
3481
+ "EmbeddedUseCaseRequestBase": {
3482
+ "type": "object",
3483
+ "required": [
3484
+ "name",
3485
+ "type",
3486
+ "enabled"
3487
+ ],
3488
+ "properties": {
3489
+ "id": {
3490
+ "type": "string",
3491
+ "format": "uuid",
3492
+ "description": "Optional use case ID for update matching.\n- If provided and matches an existing use case, that use case is updated\n- If provided but no match, a new use case with this ID is created\n- If omitted, a new use case with auto-generated ID is created\n"
3493
+ },
3494
+ "name": {
3495
+ "type": "string",
3496
+ "minLength": 1,
3497
+ "maxLength": 255,
3498
+ "description": "Use case name"
3499
+ },
3500
+ "enabled": {
3501
+ "type": "boolean",
3502
+ "description": "Whether the use case is enabled"
3503
+ },
3504
+ "change_description": {
3505
+ "type": "string",
3506
+ "maxLength": 2000,
3507
+ "description": "Optional description of this change (like a commit message)"
3508
+ }
3509
+ }
3510
+ },
3511
+ "EmbeddedInboundUseCaseRequest": {
3512
+ "allOf": [
3513
+ {
3514
+ "$ref": "#/components/schemas/EmbeddedUseCaseRequestBase"
3515
+ },
3516
+ {
3517
+ "type": "object",
3518
+ "required": [
3519
+ "type"
3520
+ ],
3521
+ "properties": {
3522
+ "type": {
3523
+ "type": "string",
3524
+ "enum": [
3525
+ "inbound"
3526
+ ],
3527
+ "description": "Use case type"
3528
+ },
3529
+ "configuration": {
3530
+ "$ref": "#/components/schemas/InboundIntegrationEventConfiguration"
3531
+ }
3532
+ }
3533
+ }
3534
+ ]
3535
+ },
3536
+ "EmbeddedOutboundUseCaseRequest": {
3537
+ "allOf": [
3538
+ {
3539
+ "$ref": "#/components/schemas/EmbeddedUseCaseRequestBase"
3540
+ },
3541
+ {
3542
+ "type": "object",
3543
+ "required": [
3544
+ "type"
3545
+ ],
3546
+ "properties": {
3547
+ "type": {
3548
+ "type": "string",
3549
+ "enum": [
3550
+ "outbound"
3551
+ ],
3552
+ "description": "Use case type"
3553
+ },
3554
+ "configuration": {
3555
+ "$ref": "#/components/schemas/OutboundIntegrationEventConfiguration"
3556
+ }
3557
+ }
3558
+ }
3559
+ ]
3560
+ },
3561
+ "ReplayEventsRequest": {
3562
+ "type": "object",
3563
+ "required": [
3564
+ "event_ids"
3565
+ ],
3566
+ "properties": {
3567
+ "event_ids": {
3568
+ "type": "array",
3569
+ "items": {
3570
+ "type": "string"
3571
+ },
3572
+ "minItems": 1,
3573
+ "maxItems": 100,
3574
+ "description": "List of event IDs to replay. Maximum 100 events per request."
3575
+ }
3576
+ }
3577
+ },
3578
+ "QueryEventsRequest": {
3579
+ "type": "object",
3580
+ "properties": {
3581
+ "event_id": {
3582
+ "type": "string",
3583
+ "description": "Filter by event ID"
3584
+ },
3585
+ "event_type": {
3586
+ "type": "string",
3587
+ "enum": [
3588
+ "CREATE",
3081
3589
  "UPDATE",
3082
3590
  "DELETE"
3083
3591
  ],
@@ -3117,6 +3625,334 @@
3117
3625
  }
3118
3626
  }
3119
3627
  }
3628
+ },
3629
+ "QueryMonitoringEventsRequest": {
3630
+ "type": "object",
3631
+ "properties": {
3632
+ "use_case_id": {
3633
+ "type": "string",
3634
+ "format": "uuid",
3635
+ "description": "Filter by use case ID"
3636
+ },
3637
+ "direction": {
3638
+ "type": "string",
3639
+ "enum": [
3640
+ "inbound",
3641
+ "outbound"
3642
+ ],
3643
+ "description": "Filter by sync direction"
3644
+ },
3645
+ "event_type": {
3646
+ "type": "string",
3647
+ "enum": [
3648
+ "CREATE",
3649
+ "UPDATE",
3650
+ "DELETE",
3651
+ "TRIGGER"
3652
+ ],
3653
+ "description": "Filter by event type"
3654
+ },
3655
+ "sync_type": {
3656
+ "type": "string",
3657
+ "enum": [
3658
+ "entity",
3659
+ "meter_reading",
3660
+ "webhook"
3661
+ ],
3662
+ "description": "Filter by sync type"
3663
+ },
3664
+ "status": {
3665
+ "type": "string",
3666
+ "enum": [
3667
+ "success",
3668
+ "error",
3669
+ "skipped"
3670
+ ],
3671
+ "description": "Filter by processing status"
3672
+ },
3673
+ "error_category": {
3674
+ "type": "string",
3675
+ "enum": [
3676
+ "validation",
3677
+ "configuration",
3678
+ "downstream_api",
3679
+ "timeout",
3680
+ "system",
3681
+ "webhook_delivery"
3682
+ ],
3683
+ "description": "Filter by error category (only applicable when status=error)"
3684
+ },
3685
+ "correlation_id": {
3686
+ "type": "string",
3687
+ "description": "Filter by correlation ID"
3688
+ },
3689
+ "object_type": {
3690
+ "type": "string",
3691
+ "description": "Filter by object type (e.g., 'contract', 'meter')"
3692
+ },
3693
+ "event_id": {
3694
+ "type": "string",
3695
+ "description": "Filter by event ID to find a specific event"
3696
+ },
3697
+ "from_date": {
3698
+ "type": "string",
3699
+ "format": "date-time",
3700
+ "description": "Filter events from this date (inclusive)",
3701
+ "example": "2025-01-01T00:00:00Z"
3702
+ },
3703
+ "to_date": {
3704
+ "type": "string",
3705
+ "format": "date-time",
3706
+ "description": "Filter events until this date (inclusive)",
3707
+ "example": "2025-01-31T23:59:59Z"
3708
+ },
3709
+ "limit": {
3710
+ "type": "integer",
3711
+ "description": "Maximum number of results to return",
3712
+ "example": 50,
3713
+ "default": 50,
3714
+ "minimum": 1,
3715
+ "maximum": 100
3716
+ },
3717
+ "cursor": {
3718
+ "type": "object",
3719
+ "description": "Cursor for pagination",
3720
+ "properties": {
3721
+ "completed_at": {
3722
+ "type": "string",
3723
+ "format": "date-time",
3724
+ "description": "Timestamp from the last event in the previous page"
3725
+ },
3726
+ "event_id": {
3727
+ "type": "string",
3728
+ "description": "Event ID from the last event in the previous page"
3729
+ }
3730
+ }
3731
+ }
3732
+ }
3733
+ },
3734
+ "GetMonitoringStatsRequest": {
3735
+ "type": "object",
3736
+ "properties": {
3737
+ "use_case_id": {
3738
+ "type": "string",
3739
+ "format": "uuid",
3740
+ "description": "Filter by use case ID"
3741
+ },
3742
+ "direction": {
3743
+ "type": "string",
3744
+ "enum": [
3745
+ "inbound",
3746
+ "outbound"
3747
+ ],
3748
+ "description": "Filter by sync direction"
3749
+ },
3750
+ "from_date": {
3751
+ "type": "string",
3752
+ "format": "date-time",
3753
+ "description": "Start date for statistics period (inclusive)",
3754
+ "example": "2025-01-01T00:00:00Z"
3755
+ },
3756
+ "to_date": {
3757
+ "type": "string",
3758
+ "format": "date-time",
3759
+ "description": "End date for statistics period (inclusive)",
3760
+ "example": "2025-01-31T23:59:59Z"
3761
+ },
3762
+ "group_by": {
3763
+ "type": "array",
3764
+ "items": {
3765
+ "type": "string",
3766
+ "enum": [
3767
+ "direction",
3768
+ "use_case_id",
3769
+ "sync_type",
3770
+ "status",
3771
+ "error_category",
3772
+ "object_type",
3773
+ "date"
3774
+ ]
3775
+ },
3776
+ "description": "Fields to group statistics by",
3777
+ "example": [
3778
+ "direction",
3779
+ "status"
3780
+ ]
3781
+ }
3782
+ }
3783
+ },
3784
+ "MonitoringEvent": {
3785
+ "type": "object",
3786
+ "required": [
3787
+ "org_id",
3788
+ "event_id",
3789
+ "direction",
3790
+ "event_type",
3791
+ "object_type",
3792
+ "sync_type",
3793
+ "status",
3794
+ "received_at",
3795
+ "completed_at"
3796
+ ],
3797
+ "properties": {
3798
+ "org_id": {
3799
+ "type": "string",
3800
+ "description": "Organization ID"
3801
+ },
3802
+ "event_id": {
3803
+ "type": "string",
3804
+ "description": "Unique event identifier"
3805
+ },
3806
+ "correlation_id": {
3807
+ "type": "string",
3808
+ "nullable": true,
3809
+ "description": "Correlation ID for tracing related events"
3810
+ },
3811
+ "integration_id": {
3812
+ "type": "string",
3813
+ "nullable": true,
3814
+ "description": "Integration ID"
3815
+ },
3816
+ "use_case_id": {
3817
+ "type": "string",
3818
+ "nullable": true,
3819
+ "description": "Use case ID"
3820
+ },
3821
+ "direction": {
3822
+ "type": "string",
3823
+ "enum": [
3824
+ "inbound",
3825
+ "outbound"
3826
+ ],
3827
+ "description": "Sync direction"
3828
+ },
3829
+ "event_type": {
3830
+ "type": "string",
3831
+ "enum": [
3832
+ "CREATE",
3833
+ "UPDATE",
3834
+ "DELETE",
3835
+ "TRIGGER"
3836
+ ],
3837
+ "description": "Type of event"
3838
+ },
3839
+ "object_type": {
3840
+ "type": "string",
3841
+ "description": "Type of object being synced (e.g., 'contract', 'meter')"
3842
+ },
3843
+ "sync_type": {
3844
+ "type": "string",
3845
+ "enum": [
3846
+ "entity",
3847
+ "meter_reading",
3848
+ "webhook"
3849
+ ],
3850
+ "description": "Type of sync operation"
3851
+ },
3852
+ "status": {
3853
+ "type": "string",
3854
+ "enum": [
3855
+ "success",
3856
+ "error",
3857
+ "skipped"
3858
+ ],
3859
+ "description": "Processing status"
3860
+ },
3861
+ "error_code": {
3862
+ "type": "string",
3863
+ "nullable": true,
3864
+ "description": "Error code (when status=error)"
3865
+ },
3866
+ "error_message": {
3867
+ "type": "string",
3868
+ "nullable": true,
3869
+ "description": "Error message (when status=error)"
3870
+ },
3871
+ "error_category": {
3872
+ "type": "string",
3873
+ "nullable": true,
3874
+ "enum": [
3875
+ "validation",
3876
+ "configuration",
3877
+ "downstream_api",
3878
+ "timeout",
3879
+ "system",
3880
+ "webhook_delivery"
3881
+ ],
3882
+ "description": "Error category (when status=error)"
3883
+ },
3884
+ "processing_duration_ms": {
3885
+ "type": "integer",
3886
+ "nullable": true,
3887
+ "description": "Processing duration in milliseconds"
3888
+ },
3889
+ "target_url": {
3890
+ "type": "string",
3891
+ "nullable": true,
3892
+ "description": "Target URL for outbound requests"
3893
+ },
3894
+ "http_status_code": {
3895
+ "type": "integer",
3896
+ "nullable": true,
3897
+ "description": "HTTP status code from target (outbound only)"
3898
+ },
3899
+ "received_at": {
3900
+ "type": "string",
3901
+ "format": "date-time",
3902
+ "description": "When the event was received"
3903
+ },
3904
+ "completed_at": {
3905
+ "type": "string",
3906
+ "format": "date-time",
3907
+ "description": "When processing completed"
3908
+ }
3909
+ }
3910
+ },
3911
+ "MonitoringStats": {
3912
+ "type": "object",
3913
+ "required": [
3914
+ "total_events",
3915
+ "success_count",
3916
+ "error_count",
3917
+ "skipped_count"
3918
+ ],
3919
+ "properties": {
3920
+ "total_events": {
3921
+ "type": "integer",
3922
+ "description": "Total number of events in the period"
3923
+ },
3924
+ "success_count": {
3925
+ "type": "integer",
3926
+ "description": "Number of successful events"
3927
+ },
3928
+ "error_count": {
3929
+ "type": "integer",
3930
+ "description": "Number of failed events"
3931
+ },
3932
+ "skipped_count": {
3933
+ "type": "integer",
3934
+ "description": "Number of skipped events"
3935
+ },
3936
+ "success_rate": {
3937
+ "type": "number",
3938
+ "format": "float",
3939
+ "description": "Success rate as percentage (0-100)"
3940
+ },
3941
+ "last_error_at": {
3942
+ "type": "string",
3943
+ "format": "date-time",
3944
+ "nullable": true,
3945
+ "description": "Timestamp of the most recent error"
3946
+ },
3947
+ "breakdown": {
3948
+ "type": "array",
3949
+ "description": "Statistics breakdown by requested group_by fields",
3950
+ "items": {
3951
+ "type": "object",
3952
+ "additionalProperties": true
3953
+ }
3954
+ }
3955
+ }
3120
3956
  }
3121
3957
  },
3122
3958
  "responses": {
@@ -3160,6 +3996,53 @@
3160
3996
  }
3161
3997
  }
3162
3998
  },
3999
+ "QueryMonitoringEventsResponse": {
4000
+ "description": "Monitoring events queried successfully",
4001
+ "content": {
4002
+ "application/json": {
4003
+ "schema": {
4004
+ "type": "object",
4005
+ "properties": {
4006
+ "data": {
4007
+ "type": "array",
4008
+ "items": {
4009
+ "$ref": "#/components/schemas/MonitoringEvent"
4010
+ },
4011
+ "description": "List of monitoring events"
4012
+ },
4013
+ "next_cursor": {
4014
+ "type": "object",
4015
+ "nullable": true,
4016
+ "description": "Cursor to fetch the next page. Null if no more results.",
4017
+ "properties": {
4018
+ "completed_at": {
4019
+ "type": "string",
4020
+ "format": "date-time"
4021
+ },
4022
+ "event_id": {
4023
+ "type": "string"
4024
+ }
4025
+ }
4026
+ },
4027
+ "has_more": {
4028
+ "type": "boolean",
4029
+ "description": "Indicates if more results are available"
4030
+ }
4031
+ }
4032
+ }
4033
+ }
4034
+ }
4035
+ },
4036
+ "GetMonitoringStatsResponse": {
4037
+ "description": "Monitoring statistics retrieved successfully",
4038
+ "content": {
4039
+ "application/json": {
4040
+ "schema": {
4041
+ "$ref": "#/components/schemas/MonitoringStats"
4042
+ }
4043
+ }
4044
+ }
4045
+ },
3163
4046
  "ReplayEventsResponse": {
3164
4047
  "description": "Events replay initiated",
3165
4048
  "content": {