@nasebanal/cli 0.13.0 → 0.15.0

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.
@@ -2,7 +2,7 @@ openapi: 3.0.3
2
2
  info:
3
3
  title: NASEBANAL Account API
4
4
  description: Centralized user and billing management API for NASEBANAL applications. Manages user profiles, per-service subscriptions, and Personal Access Tokens (PAT).
5
- version: 1.8.0
5
+ version: 1.9.0
6
6
  contact:
7
7
  name: NASEBANAL
8
8
  url: https://www.nasebanal.com
@@ -886,6 +886,267 @@ paths:
886
886
  $ref: "#/components/responses/Forbidden"
887
887
  "404":
888
888
  $ref: "#/components/responses/NotFound"
889
+ /api/v1/organizations/{orgId}/sso:
890
+ get:
891
+ tags:
892
+ - SSO
893
+ operationId: getOrganizationSso
894
+ summary: Get the SSO connection
895
+ description: Returns the SSO connection of the organization, or null when none is registered. Requires the caller to be an Org Admin and the organization to hold an active Enterprise subscription.
896
+ parameters:
897
+ - name: orgId
898
+ in: path
899
+ required: true
900
+ schema:
901
+ type: integer
902
+ responses:
903
+ "200":
904
+ description: The SSO connection, or null
905
+ content:
906
+ application/json:
907
+ schema:
908
+ type: object
909
+ required:
910
+ - success
911
+ - data
912
+ properties:
913
+ success:
914
+ type: boolean
915
+ enum:
916
+ - true
917
+ data:
918
+ allOf:
919
+ - $ref: "#/components/schemas/SsoConnection"
920
+ nullable: true
921
+ "401":
922
+ $ref: "#/components/responses/Unauthorized"
923
+ "403":
924
+ $ref: "#/components/responses/Forbidden"
925
+ "404":
926
+ $ref: "#/components/responses/NotFound"
927
+ put:
928
+ tags:
929
+ - SSO
930
+ operationId: putOrganizationSso
931
+ summary: Register or replace the SSO connection
932
+ description: "Creates the connection at the identity platform (turned off, not usable to log in yet) or replaces its IdP settings and domains, and returns the values to register in the IdP and the DNS TXT record to add for each domain. The client secret is write-only: it is never returned. A domain already verified by another organization is refused with 409."
933
+ parameters:
934
+ - name: orgId
935
+ in: path
936
+ required: true
937
+ schema:
938
+ type: integer
939
+ requestBody:
940
+ required: true
941
+ content:
942
+ application/json:
943
+ schema:
944
+ $ref: "#/components/schemas/SsoConnectionInput"
945
+ responses:
946
+ "200":
947
+ description: The connection after the change
948
+ content:
949
+ application/json:
950
+ schema:
951
+ type: object
952
+ required:
953
+ - success
954
+ - data
955
+ properties:
956
+ success:
957
+ type: boolean
958
+ enum:
959
+ - true
960
+ data:
961
+ $ref: "#/components/schemas/SsoConnection"
962
+ "400":
963
+ description: Invalid input
964
+ content:
965
+ application/json:
966
+ schema:
967
+ $ref: "#/components/schemas/Error"
968
+ example:
969
+ success: false
970
+ error:
971
+ code: VALIDATION_ERROR
972
+ message: domains must contain 1 to 5 valid domain names
973
+ "401":
974
+ $ref: "#/components/responses/Unauthorized"
975
+ "403":
976
+ $ref: "#/components/responses/Forbidden"
977
+ "404":
978
+ $ref: "#/components/responses/NotFound"
979
+ "409":
980
+ description: The request conflicts with the current state (domain claimed by another organization, or no verified domain yet)
981
+ content:
982
+ application/json:
983
+ schema:
984
+ $ref: "#/components/schemas/Error"
985
+ example:
986
+ success: false
987
+ error:
988
+ code: SSO_DOMAIN_TAKEN
989
+ message: This domain is already verified by another organization
990
+ "502":
991
+ description: The identity platform refused or failed the call
992
+ content:
993
+ application/json:
994
+ schema:
995
+ $ref: "#/components/schemas/Error"
996
+ example:
997
+ success: false
998
+ error:
999
+ code: SSO_PROVIDER_ERROR
1000
+ message: The identity platform could not complete the request
1001
+ delete:
1002
+ tags:
1003
+ - SSO
1004
+ operationId: deleteOrganizationSso
1005
+ summary: Delete the SSO connection
1006
+ description: Deletes the connection at the identity platform and its domains. People who signed in through it keep their accounts and can use another login method.
1007
+ parameters:
1008
+ - name: orgId
1009
+ in: path
1010
+ required: true
1011
+ schema:
1012
+ type: integer
1013
+ responses:
1014
+ "200":
1015
+ description: The connection was deleted
1016
+ content:
1017
+ application/json:
1018
+ schema:
1019
+ type: object
1020
+ required:
1021
+ - success
1022
+ - data
1023
+ properties:
1024
+ success:
1025
+ type: boolean
1026
+ enum:
1027
+ - true
1028
+ data:
1029
+ type: object
1030
+ properties:
1031
+ success:
1032
+ type: boolean
1033
+ "401":
1034
+ $ref: "#/components/responses/Unauthorized"
1035
+ "403":
1036
+ $ref: "#/components/responses/Forbidden"
1037
+ "404":
1038
+ $ref: "#/components/responses/NotFound"
1039
+ "502":
1040
+ description: The identity platform refused or failed the call
1041
+ content:
1042
+ application/json:
1043
+ schema:
1044
+ $ref: "#/components/schemas/Error"
1045
+ example:
1046
+ success: false
1047
+ error:
1048
+ code: SSO_PROVIDER_ERROR
1049
+ message: The identity platform could not complete the request
1050
+ /api/v1/organizations/{orgId}/sso/verify:
1051
+ post:
1052
+ tags:
1053
+ - SSO
1054
+ operationId: verifyOrganizationSsoDomains
1055
+ summary: Verify the domains
1056
+ description: Looks up the DNS TXT record of every pending domain and marks the ones that match as verified. Safe to call repeatedly.
1057
+ parameters:
1058
+ - name: orgId
1059
+ in: path
1060
+ required: true
1061
+ schema:
1062
+ type: integer
1063
+ responses:
1064
+ "200":
1065
+ description: The connection after the check
1066
+ content:
1067
+ application/json:
1068
+ schema:
1069
+ type: object
1070
+ required:
1071
+ - success
1072
+ - data
1073
+ properties:
1074
+ success:
1075
+ type: boolean
1076
+ enum:
1077
+ - true
1078
+ data:
1079
+ $ref: "#/components/schemas/SsoConnection"
1080
+ "401":
1081
+ $ref: "#/components/responses/Unauthorized"
1082
+ "403":
1083
+ $ref: "#/components/responses/Forbidden"
1084
+ "404":
1085
+ $ref: "#/components/responses/NotFound"
1086
+ /api/v1/organizations/{orgId}/sso/enabled:
1087
+ put:
1088
+ tags:
1089
+ - SSO
1090
+ operationId: setOrganizationSsoEnabled
1091
+ summary: Turn the SSO connection on or off
1092
+ description: Turning it on requires at least one verified domain; otherwise the call is refused with 409. Turning it off stops new logins through the connection and keeps its settings.
1093
+ parameters:
1094
+ - name: orgId
1095
+ in: path
1096
+ required: true
1097
+ schema:
1098
+ type: integer
1099
+ requestBody:
1100
+ required: true
1101
+ content:
1102
+ application/json:
1103
+ schema:
1104
+ $ref: "#/components/schemas/SsoEnabledInput"
1105
+ responses:
1106
+ "200":
1107
+ description: The connection after the change
1108
+ content:
1109
+ application/json:
1110
+ schema:
1111
+ type: object
1112
+ required:
1113
+ - success
1114
+ - data
1115
+ properties:
1116
+ success:
1117
+ type: boolean
1118
+ enum:
1119
+ - true
1120
+ data:
1121
+ $ref: "#/components/schemas/SsoConnection"
1122
+ "401":
1123
+ $ref: "#/components/responses/Unauthorized"
1124
+ "403":
1125
+ $ref: "#/components/responses/Forbidden"
1126
+ "404":
1127
+ $ref: "#/components/responses/NotFound"
1128
+ "409":
1129
+ description: The request conflicts with the current state (domain claimed by another organization, or no verified domain yet)
1130
+ content:
1131
+ application/json:
1132
+ schema:
1133
+ $ref: "#/components/schemas/Error"
1134
+ example:
1135
+ success: false
1136
+ error:
1137
+ code: SSO_NOT_VERIFIED
1138
+ message: Verify at least one domain before turning SSO on
1139
+ "502":
1140
+ description: The identity platform refused or failed the call
1141
+ content:
1142
+ application/json:
1143
+ schema:
1144
+ $ref: "#/components/schemas/Error"
1145
+ example:
1146
+ success: false
1147
+ error:
1148
+ code: SSO_PROVIDER_ERROR
1149
+ message: The identity platform could not complete the request
889
1150
  components:
890
1151
  securitySchemes:
891
1152
  BearerAuth:
@@ -1163,6 +1424,142 @@ components:
1163
1424
  minLength: 1
1164
1425
  maxLength: 200
1165
1426
  example: Acme Metrics Bot
1427
+ SsoConnection:
1428
+ type: object
1429
+ description: An organization's SSO connection. `status` is `pending` until a domain is verified, `disabled` once it is usable but off, and `enabled` when people can log in through it.
1430
+ required:
1431
+ - protocol
1432
+ - status
1433
+ - connection_name
1434
+ - domains
1435
+ - sp
1436
+ properties:
1437
+ protocol:
1438
+ type: string
1439
+ enum:
1440
+ - saml
1441
+ - oidc
1442
+ status:
1443
+ type: string
1444
+ enum:
1445
+ - pending
1446
+ - disabled
1447
+ - enabled
1448
+ connection_name:
1449
+ type: string
1450
+ description: Derived by the server (org-<id>-<protocol>); used as `?connection=` in the login URL.
1451
+ example: org-12-saml
1452
+ domains:
1453
+ type: array
1454
+ items:
1455
+ $ref: "#/components/schemas/SsoDomain"
1456
+ sp:
1457
+ $ref: "#/components/schemas/SsoServiceProviderValues"
1458
+ created_at:
1459
+ type: string
1460
+ format: date-time
1461
+ updated_at:
1462
+ type: string
1463
+ format: date-time
1464
+ SsoServiceProviderValues:
1465
+ type: object
1466
+ description: Values to register in the customer IdP so it trusts NASEBANAL.
1467
+ required:
1468
+ - entity_id
1469
+ - acs_url
1470
+ - redirect_uri
1471
+ properties:
1472
+ entity_id:
1473
+ type: string
1474
+ description: SAML Entity ID / Audience.
1475
+ example: urn:auth0:example-tenant:org-12-saml
1476
+ acs_url:
1477
+ type: string
1478
+ description: SAML Assertion Consumer Service URL.
1479
+ example: https://login.example.com/login/callback?connection=org-12-saml
1480
+ redirect_uri:
1481
+ type: string
1482
+ description: OIDC redirect URI (the same callback URL as `acs_url`).
1483
+ example: https://login.example.com/login/callback
1484
+ SsoDomain:
1485
+ type: object
1486
+ description: A domain whose ownership is proved with a DNS TXT record.
1487
+ required:
1488
+ - domain
1489
+ - verified
1490
+ - txt_record
1491
+ properties:
1492
+ domain:
1493
+ type: string
1494
+ example: example.com
1495
+ verified:
1496
+ type: boolean
1497
+ verified_at:
1498
+ type: string
1499
+ format: date-time
1500
+ nullable: true
1501
+ txt_record:
1502
+ type: object
1503
+ required:
1504
+ - name
1505
+ - value
1506
+ properties:
1507
+ name:
1508
+ type: string
1509
+ example: _nasebanal-verify.example.com
1510
+ value:
1511
+ type: string
1512
+ example: nb-verify=3f9c2a7e51b04d68
1513
+ SsoConnectionInput:
1514
+ type: object
1515
+ description: The IdP settings and domains to register. Give `saml` for protocol `saml`, and `oidc` for protocol `oidc`.
1516
+ required:
1517
+ - protocol
1518
+ - domains
1519
+ properties:
1520
+ protocol:
1521
+ type: string
1522
+ enum:
1523
+ - saml
1524
+ - oidc
1525
+ domains:
1526
+ type: array
1527
+ minItems: 1
1528
+ maxItems: 5
1529
+ items:
1530
+ type: string
1531
+ example: example.com
1532
+ saml:
1533
+ type: object
1534
+ description: IdP metadata. Give either `metadata_url` or `metadata_xml`.
1535
+ properties:
1536
+ metadata_url:
1537
+ type: string
1538
+ format: uri
1539
+ metadata_xml:
1540
+ type: string
1541
+ oidc:
1542
+ type: object
1543
+ required:
1544
+ - issuer
1545
+ - client_id
1546
+ - client_secret
1547
+ properties:
1548
+ issuer:
1549
+ type: string
1550
+ format: uri
1551
+ client_id:
1552
+ type: string
1553
+ client_secret:
1554
+ type: string
1555
+ writeOnly: true
1556
+ SsoEnabledInput:
1557
+ type: object
1558
+ required:
1559
+ - enabled
1560
+ properties:
1561
+ enabled:
1562
+ type: boolean
1166
1563
  Error:
1167
1564
  type: object
1168
1565
  required:
@@ -1272,5 +1669,7 @@ tags:
1272
1669
  description: Personal Access Token management
1273
1670
  - name: Service Accounts
1274
1671
  description: Org-scoped service accounts for Enterprise organizations and their API tokens. Org Admin only.
1672
+ - name: SSO
1673
+ description: "Enterprise single sign-on: an organization admin registers the company IdP (SAML or OIDC) and verifies the email domains. Org Admin only."
1275
1674
  - name: Notifications
1276
1675
  description: In-app notification inbox and mobile push device registration
@@ -47,7 +47,7 @@ info:
47
47
  ```
48
48
 
49
49
  **Note:** The embed displays a snapshot of the data at the time the SNS share was created. To update the data, recreate the SNS share.
50
- version: 1.7.0
50
+ version: 1.8.0
51
51
  license:
52
52
  name: MIT
53
53
  servers:
@@ -1946,6 +1946,129 @@ paths:
1946
1946
  $ref: "#/components/responses/NotFound"
1947
1947
  "500":
1948
1948
  $ref: "#/components/responses/InternalError"
1949
+ /export:
1950
+ get:
1951
+ summary: Take a complete copy of an organization's data
1952
+ description: "Everything the caller may take, as JSON, one section per request: `tags` and `goals` come in one answer, `records` in keyset pages (`after_id`, `limit` up to 1000) that the caller walks until `next_after_id` is null. An organization admin takes every member's rows, a member only their own. Read-only, so an admin of an organization whose Enterprise contract has ended can still take the data away before deleting the organization. Each record and goal carries `tag_name` and `tag_data_type` (how a restore finds the tag)."
1953
+ operationId: exportData
1954
+ tags:
1955
+ - Backup
1956
+ parameters:
1957
+ - name: X-Active-Organization-Id
1958
+ in: header
1959
+ required: true
1960
+ description: "The organization acted on (an organization id). The backup is a feature of organizations (Enterprise): without it the answer is 403 ORGANIZATION_REQUIRED."
1961
+ schema:
1962
+ type: integer
1963
+ minimum: 1
1964
+ - name: section
1965
+ in: query
1966
+ required: true
1967
+ description: Which part to take.
1968
+ schema:
1969
+ type: string
1970
+ enum:
1971
+ - tags
1972
+ - records
1973
+ - goals
1974
+ - name: after_id
1975
+ in: query
1976
+ description: Return the records after this id (the previous page's `next_after_id`); 0 starts at the beginning.
1977
+ schema:
1978
+ type: integer
1979
+ minimum: 0
1980
+ default: 0
1981
+ - name: limit
1982
+ in: query
1983
+ description: Page size for `records` (at most 1000).
1984
+ schema:
1985
+ type: integer
1986
+ minimum: 1
1987
+ maximum: 1000
1988
+ default: 1000
1989
+ responses:
1990
+ "200":
1991
+ description: One section (or page) of the copy
1992
+ content:
1993
+ application/json:
1994
+ schema:
1995
+ type: object
1996
+ properties:
1997
+ success:
1998
+ type: boolean
1999
+ enum:
2000
+ - true
2001
+ data:
2002
+ $ref: "#/components/schemas/RecorderExportPage"
2003
+ "400":
2004
+ $ref: "#/components/responses/ValidationError"
2005
+ "401":
2006
+ $ref: "#/components/responses/Unauthorized"
2007
+ "403":
2008
+ description: No organization selected (ORGANIZATION_REQUIRED) or no access to the organization
2009
+ content:
2010
+ application/json:
2011
+ schema:
2012
+ $ref: "#/components/schemas/ErrorResponse"
2013
+ example:
2014
+ success: false
2015
+ error:
2016
+ code: ORGANIZATION_REQUIRED
2017
+ message: The complete backup is for organizations (Enterprise)
2018
+ "500":
2019
+ $ref: "#/components/responses/InternalError"
2020
+ /import/full:
2021
+ post:
2022
+ summary: Put a complete copy back
2023
+ description: "Restores an exported file (or a part of it: send `tags` and `goals` once and `records` in chunks) into the active organization, owned by the importer. An organization admin only. Whatever the organization already has is left alone and counted, so putting the same file back twice changes nothing the second time; plan limits apply as on every write. Attachments, authorship and ids are not restored (the response counts the records that had an attachment)."
2024
+ operationId: importFull
2025
+ tags:
2026
+ - Backup
2027
+ parameters:
2028
+ - name: X-Active-Organization-Id
2029
+ in: header
2030
+ required: true
2031
+ description: "The organization acted on (an organization id). The backup is a feature of organizations (Enterprise): without it the answer is 403 ORGANIZATION_REQUIRED."
2032
+ schema:
2033
+ type: integer
2034
+ minimum: 1
2035
+ requestBody:
2036
+ required: true
2037
+ content:
2038
+ application/json:
2039
+ schema:
2040
+ $ref: "#/components/schemas/RecorderImportRequest"
2041
+ responses:
2042
+ "200":
2043
+ description: What was created, what was already there and what was skipped
2044
+ content:
2045
+ application/json:
2046
+ schema:
2047
+ type: object
2048
+ properties:
2049
+ success:
2050
+ type: boolean
2051
+ enum:
2052
+ - true
2053
+ data:
2054
+ $ref: "#/components/schemas/RecorderImportResult"
2055
+ "400":
2056
+ $ref: "#/components/responses/ValidationError"
2057
+ "401":
2058
+ $ref: "#/components/responses/Unauthorized"
2059
+ "403":
2060
+ description: Not an organization admin, no organization selected (ORGANIZATION_REQUIRED), or the organization's contract has ended (ORG_READ_ONLY)
2061
+ content:
2062
+ application/json:
2063
+ schema:
2064
+ $ref: "#/components/schemas/ErrorResponse"
2065
+ example:
2066
+ success: false
2067
+ error:
2068
+ code: FORBIDDEN
2069
+ message: The complete backup is for organizations (Enterprise)
2070
+ "500":
2071
+ $ref: "#/components/responses/InternalError"
1949
2072
  components:
1950
2073
  securitySchemes:
1951
2074
  BearerAuth:
@@ -2661,6 +2784,133 @@ components:
2661
2784
  type: object
2662
2785
  description: Additional error details
2663
2786
  additionalProperties: true
2787
+ RecorderExportPage:
2788
+ type: object
2789
+ description: One section of an organization's complete copy.
2790
+ required:
2791
+ - format
2792
+ - version
2793
+ - section
2794
+ - scope
2795
+ - exported_at
2796
+ - items
2797
+ - next_after_id
2798
+ properties:
2799
+ format:
2800
+ type: string
2801
+ enum:
2802
+ - nb-recorder-export
2803
+ version:
2804
+ type: integer
2805
+ enum:
2806
+ - 1
2807
+ section:
2808
+ type: string
2809
+ enum:
2810
+ - tags
2811
+ - records
2812
+ - goals
2813
+ scope:
2814
+ type: object
2815
+ properties:
2816
+ organization_id:
2817
+ type: integer
2818
+ exported_at:
2819
+ type: string
2820
+ format: date-time
2821
+ items:
2822
+ type: array
2823
+ description: The rows of the section, with every column of the table (a column added later is exported at once).
2824
+ items:
2825
+ type: object
2826
+ additionalProperties: true
2827
+ next_after_id:
2828
+ type: integer
2829
+ nullable: true
2830
+ description: Pass it as `after_id` for the next page of `records`; null when there is none (always null for `tags` and `goals`).
2831
+ RecorderImportRequest:
2832
+ type: object
2833
+ description: An exported file, or a part of it. One request takes at most 500 tags, 500 goals and the records limit of the CSV import.
2834
+ required:
2835
+ - format
2836
+ - version
2837
+ properties:
2838
+ format:
2839
+ type: string
2840
+ enum:
2841
+ - nb-recorder-export
2842
+ version:
2843
+ type: integer
2844
+ enum:
2845
+ - 1
2846
+ tags:
2847
+ type: array
2848
+ items:
2849
+ type: object
2850
+ additionalProperties: true
2851
+ records:
2852
+ type: array
2853
+ items:
2854
+ type: object
2855
+ additionalProperties: true
2856
+ goals:
2857
+ type: array
2858
+ items:
2859
+ type: object
2860
+ additionalProperties: true
2861
+ RecorderImportResult:
2862
+ type: object
2863
+ required:
2864
+ - tags_created
2865
+ - tags_existing
2866
+ - tags_skipped
2867
+ - records_created
2868
+ - records_existing
2869
+ - records_skipped
2870
+ - records_with_attachment_not_restored
2871
+ - goals_created
2872
+ - goals_existing
2873
+ - goals_skipped
2874
+ - skipped
2875
+ properties:
2876
+ tags_created:
2877
+ type: integer
2878
+ tags_existing:
2879
+ type: integer
2880
+ tags_skipped:
2881
+ type: integer
2882
+ records_created:
2883
+ type: integer
2884
+ records_existing:
2885
+ type: integer
2886
+ records_skipped:
2887
+ type: integer
2888
+ records_with_attachment_not_restored:
2889
+ type: integer
2890
+ goals_created:
2891
+ type: integer
2892
+ goals_existing:
2893
+ type: integer
2894
+ goals_skipped:
2895
+ type: integer
2896
+ skipped:
2897
+ type: array
2898
+ description: The first rows that were skipped, with the reason (at most 50).
2899
+ items:
2900
+ type: object
2901
+ properties:
2902
+ section:
2903
+ type: string
2904
+ enum:
2905
+ - tags
2906
+ - records
2907
+ - goals
2908
+ index:
2909
+ type: integer
2910
+ reason:
2911
+ type: string
2912
+ skipped_reported:
2913
+ type: integer
2664
2914
  responses:
2665
2915
  ValidationError:
2666
2916
  description: Validation error
@@ -2725,3 +2975,5 @@ tags:
2725
2975
  description: Media file upload and management
2726
2976
  - name: Goals
2727
2977
  description: Goal tracking and management
2978
+ - name: Backup
2979
+ description: Complete backup and restore of an organization (Enterprise)