@nasebanal/cli 0.12.0 → 0.14.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.
@@ -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)