shipeasy-sdk 2.1.0 → 2.3.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.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -0
  3. data/docs/skill/SKILL.md +6 -2
  4. data/lib/generators/shipeasy/install/USAGE +24 -0
  5. data/lib/generators/shipeasy/install/install_generator.rb +86 -0
  6. data/lib/generators/shipeasy/install/templates/initializer.rb.tt +41 -0
  7. data/lib/shipeasy/admin.rb +85 -0
  8. data/lib/shipeasy/sdk/version.rb +1 -1
  9. data/lib/shipeasy_admin/api/alert_rules_api.rb +292 -0
  10. data/lib/shipeasy_admin/api/attributes_api.rb +82 -0
  11. data/lib/shipeasy_admin/api/configs_api.rb +680 -0
  12. data/lib/shipeasy_admin/api/events_api.rb +438 -0
  13. data/lib/shipeasy_admin/api/experiments_api.rb +727 -0
  14. data/lib/shipeasy_admin/api/gates_api.rb +438 -0
  15. data/lib/shipeasy_admin/api/i18n_api.rb +507 -0
  16. data/lib/shipeasy_admin/api/killswitches_api.rb +526 -0
  17. data/lib/shipeasy_admin/api/metrics_api.rb +281 -0
  18. data/lib/shipeasy_admin/api/ops_api.rb +525 -0
  19. data/lib/shipeasy_admin/api/projects_api.rb +153 -0
  20. data/lib/shipeasy_admin/api/universes_api.rb +306 -0
  21. data/lib/shipeasy_admin/api_client.rb +441 -0
  22. data/lib/shipeasy_admin/api_error.rb +58 -0
  23. data/lib/shipeasy_admin/api_model_base.rb +88 -0
  24. data/lib/shipeasy_admin/configuration.rb +397 -0
  25. data/lib/shipeasy_admin/models/approve_event_request.rb +198 -0
  26. data/lib/shipeasy_admin/models/approve_event_response.rb +166 -0
  27. data/lib/shipeasy_admin/models/create_alert_rule_request.rb +408 -0
  28. data/lib/shipeasy_admin/models/create_alert_rule_response.rb +165 -0
  29. data/lib/shipeasy_admin/models/create_config_request.rb +280 -0
  30. data/lib/shipeasy_admin/models/create_config_response.rb +201 -0
  31. data/lib/shipeasy_admin/models/create_event_request.rb +253 -0
  32. data/lib/shipeasy_admin/models/create_event_response.rb +193 -0
  33. data/lib/shipeasy_admin/models/create_experiment_request.rb +869 -0
  34. data/lib/shipeasy_admin/models/create_experiment_request_goal_metric.rb +336 -0
  35. data/lib/shipeasy_admin/models/create_experiment_response.rb +212 -0
  36. data/lib/shipeasy_admin/models/create_gate_request.rb +529 -0
  37. data/lib/shipeasy_admin/models/create_gate_response.rb +212 -0
  38. data/lib/shipeasy_admin/models/create_i18n_profile_request.rb +188 -0
  39. data/lib/shipeasy_admin/models/create_i18n_profile_response.rb +193 -0
  40. data/lib/shipeasy_admin/models/create_killswitch_request.rb +263 -0
  41. data/lib/shipeasy_admin/models/create_killswitch_response.rb +201 -0
  42. data/lib/shipeasy_admin/models/create_metric_request.rb +415 -0
  43. data/lib/shipeasy_admin/models/create_metric_response.rb +193 -0
  44. data/lib/shipeasy_admin/models/create_ops_item_request.rb +287 -0
  45. data/lib/shipeasy_admin/models/create_ops_item_response.rb +177 -0
  46. data/lib/shipeasy_admin/models/create_universe_request.rb +289 -0
  47. data/lib/shipeasy_admin/models/create_universe_response.rb +212 -0
  48. data/lib/shipeasy_admin/models/delete_alert_rule_response.rb +188 -0
  49. data/lib/shipeasy_admin/models/delete_config_response.rb +188 -0
  50. data/lib/shipeasy_admin/models/delete_event_response.rb +189 -0
  51. data/lib/shipeasy_admin/models/delete_experiment_response.rb +188 -0
  52. data/lib/shipeasy_admin/models/delete_gate_response.rb +188 -0
  53. data/lib/shipeasy_admin/models/delete_killswitch_response.rb +188 -0
  54. data/lib/shipeasy_admin/models/delete_metric_response.rb +189 -0
  55. data/lib/shipeasy_admin/models/delete_universe_response.rb +188 -0
  56. data/lib/shipeasy_admin/models/disable_gate_response.rb +190 -0
  57. data/lib/shipeasy_admin/models/discard_config_draft_request.rb +190 -0
  58. data/lib/shipeasy_admin/models/discard_config_draft_response.rb +188 -0
  59. data/lib/shipeasy_admin/models/enable_gate_response.rb +190 -0
  60. data/lib/shipeasy_admin/models/error_response.rb +185 -0
  61. data/lib/shipeasy_admin/models/get_config_response.rb +351 -0
  62. data/lib/shipeasy_admin/models/get_current_project_response.rb +606 -0
  63. data/lib/shipeasy_admin/models/get_current_project_response_module_translations.rb +104 -0
  64. data/lib/shipeasy_admin/models/get_event_response.rb +344 -0
  65. data/lib/shipeasy_admin/models/get_experiment_response.rb +688 -0
  66. data/lib/shipeasy_admin/models/get_experiment_results_response.rb +243 -0
  67. data/lib/shipeasy_admin/models/get_experiment_results_response_experiment.rb +248 -0
  68. data/lib/shipeasy_admin/models/get_experiment_results_response_results_inner.rb +252 -0
  69. data/lib/shipeasy_admin/models/get_experiment_timeseries_response.rb +192 -0
  70. data/lib/shipeasy_admin/models/get_experiment_timeseries_response_experiment.rb +261 -0
  71. data/lib/shipeasy_admin/models/get_experiment_timeseries_response_series_inner.rb +278 -0
  72. data/lib/shipeasy_admin/models/get_killswitch_response.rb +270 -0
  73. data/lib/shipeasy_admin/models/get_metric_response.rb +378 -0
  74. data/lib/shipeasy_admin/models/get_ops_item_response.rb +349 -0
  75. data/lib/shipeasy_admin/models/link_pr_to_ops_item_request.rb +186 -0
  76. data/lib/shipeasy_admin/models/link_pr_to_ops_item_response.rb +166 -0
  77. data/lib/shipeasy_admin/models/list_alert_rules_response_inner.rb +478 -0
  78. data/lib/shipeasy_admin/models/list_alert_rules_response_inner_notify.rb +177 -0
  79. data/lib/shipeasy_admin/models/list_alert_rules_response_inner_notify_slack_channel.rb +211 -0
  80. data/lib/shipeasy_admin/models/list_attributes_response_inner.rb +176 -0
  81. data/lib/shipeasy_admin/models/list_config_activity_response_inner.rb +280 -0
  82. data/lib/shipeasy_admin/models/list_configs_response.rb +178 -0
  83. data/lib/shipeasy_admin/models/list_configs_response_data_inner.rb +351 -0
  84. data/lib/shipeasy_admin/models/list_configs_response_data_inner_drafts_value.rb +237 -0
  85. data/lib/shipeasy_admin/models/list_configs_response_data_inner_envs_value.rb +237 -0
  86. data/lib/shipeasy_admin/models/list_events_response_inner.rb +344 -0
  87. data/lib/shipeasy_admin/models/list_events_response_inner_properties_inner.rb +289 -0
  88. data/lib/shipeasy_admin/models/list_experiments_response.rb +178 -0
  89. data/lib/shipeasy_admin/models/list_experiments_response_data_inner.rb +688 -0
  90. data/lib/shipeasy_admin/models/list_experiments_response_data_inner_groups_inner.rb +258 -0
  91. data/lib/shipeasy_admin/models/list_gates_response.rb +178 -0
  92. data/lib/shipeasy_admin/models/list_gates_response_data_inner.rb +395 -0
  93. data/lib/shipeasy_admin/models/list_gates_response_data_inner_enabled.rb +104 -0
  94. data/lib/shipeasy_admin/models/list_gates_response_data_inner_rules_inner.rb +238 -0
  95. data/lib/shipeasy_admin/models/list_gates_response_data_inner_stack_inner.rb +105 -0
  96. data/lib/shipeasy_admin/models/list_gates_response_data_inner_stack_inner_one_of.rb +375 -0
  97. data/lib/shipeasy_admin/models/list_gates_response_data_inner_stack_inner_one_of1.rb +331 -0
  98. data/lib/shipeasy_admin/models/list_gates_response_data_inner_stack_inner_one_of_ramp.rb +319 -0
  99. data/lib/shipeasy_admin/models/list_i18n_drafts_response_inner.rb +272 -0
  100. data/lib/shipeasy_admin/models/list_i18n_keys_response.rb +195 -0
  101. data/lib/shipeasy_admin/models/list_i18n_keys_response_keys_inner.rb +284 -0
  102. data/lib/shipeasy_admin/models/list_i18n_profiles_response_inner.rb +224 -0
  103. data/lib/shipeasy_admin/models/list_killswitches_response.rb +178 -0
  104. data/lib/shipeasy_admin/models/list_killswitches_response_data_inner.rb +270 -0
  105. data/lib/shipeasy_admin/models/list_killswitches_response_data_inner_envs_value.rb +248 -0
  106. data/lib/shipeasy_admin/models/list_metrics_response_inner.rb +378 -0
  107. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir.rb +295 -0
  108. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg.rb +113 -0
  109. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of.rb +188 -0
  110. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of1.rb +188 -0
  111. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of2.rb +188 -0
  112. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of3.rb +188 -0
  113. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of4.rb +188 -0
  114. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of5.rb +188 -0
  115. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of6.rb +188 -0
  116. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of7.rb +217 -0
  117. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of8.rb +233 -0
  118. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of9.rb +240 -0
  119. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of9_numerator.rb +266 -0
  120. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_agg_one_of9_numerator_filters_inner.rb +264 -0
  121. data/lib/shipeasy_admin/models/list_metrics_response_inner_query_ir_group_by.rb +228 -0
  122. data/lib/shipeasy_admin/models/list_ops_items_response_inner.rb +349 -0
  123. data/lib/shipeasy_admin/models/list_slack_channels_response.rb +195 -0
  124. data/lib/shipeasy_admin/models/list_slack_channels_response_channels_inner.rb +203 -0
  125. data/lib/shipeasy_admin/models/list_universes_response.rb +178 -0
  126. data/lib/shipeasy_admin/models/list_universes_response_data_inner.rb +305 -0
  127. data/lib/shipeasy_admin/models/notify_ops_request.rb +261 -0
  128. data/lib/shipeasy_admin/models/notify_ops_response.rb +193 -0
  129. data/lib/shipeasy_admin/models/publish_config_draft_request.rb +190 -0
  130. data/lib/shipeasy_admin/models/publish_config_draft_response.rb +260 -0
  131. data/lib/shipeasy_admin/models/publish_i18n_profile_request.rb +149 -0
  132. data/lib/shipeasy_admin/models/publish_i18n_profile_response.rb +404 -0
  133. data/lib/shipeasy_admin/models/push_i18n_keys_request.rb +205 -0
  134. data/lib/shipeasy_admin/models/push_i18n_keys_request_keys_inner.rb +192 -0
  135. data/lib/shipeasy_admin/models/push_i18n_keys_response.rb +261 -0
  136. data/lib/shipeasy_admin/models/reanalyze_experiment_response.rb +214 -0
  137. data/lib/shipeasy_admin/models/save_config_draft_request.rb +202 -0
  138. data/lib/shipeasy_admin/models/save_config_draft_response.rb +286 -0
  139. data/lib/shipeasy_admin/models/set_experiment_metrics_request.rb +168 -0
  140. data/lib/shipeasy_admin/models/set_experiment_metrics_request_metrics_inner.rb +216 -0
  141. data/lib/shipeasy_admin/models/set_experiment_metrics_response.rb +179 -0
  142. data/lib/shipeasy_admin/models/set_experiment_metrics_response_metrics_inner.rb +201 -0
  143. data/lib/shipeasy_admin/models/set_experiment_status_request.rb +190 -0
  144. data/lib/shipeasy_admin/models/set_experiment_status_response.rb +214 -0
  145. data/lib/shipeasy_admin/models/set_killswitch_switch_request.rb +264 -0
  146. data/lib/shipeasy_admin/models/set_killswitch_switch_response.rb +288 -0
  147. data/lib/shipeasy_admin/models/unset_killswitch_switch_request.rb +237 -0
  148. data/lib/shipeasy_admin/models/unset_killswitch_switch_response.rb +289 -0
  149. data/lib/shipeasy_admin/models/update_alert_rule_request.rb +306 -0
  150. data/lib/shipeasy_admin/models/update_alert_rule_response.rb +165 -0
  151. data/lib/shipeasy_admin/models/update_config_request.rb +198 -0
  152. data/lib/shipeasy_admin/models/update_config_response.rb +165 -0
  153. data/lib/shipeasy_admin/models/update_event_request.rb +198 -0
  154. data/lib/shipeasy_admin/models/update_event_response.rb +166 -0
  155. data/lib/shipeasy_admin/models/update_experiment_request.rb +746 -0
  156. data/lib/shipeasy_admin/models/update_experiment_response.rb +165 -0
  157. data/lib/shipeasy_admin/models/update_gate_request.rb +403 -0
  158. data/lib/shipeasy_admin/models/update_gate_response.rb +166 -0
  159. data/lib/shipeasy_admin/models/update_i18n_key_request.rb +176 -0
  160. data/lib/shipeasy_admin/models/update_i18n_key_response.rb +166 -0
  161. data/lib/shipeasy_admin/models/update_killswitch_request.rb +224 -0
  162. data/lib/shipeasy_admin/models/update_killswitch_response.rb +165 -0
  163. data/lib/shipeasy_admin/models/update_ops_item_request.rb +205 -0
  164. data/lib/shipeasy_admin/models/update_ops_item_response.rb +166 -0
  165. data/lib/shipeasy_admin/models/update_universe_request.rb +213 -0
  166. data/lib/shipeasy_admin/models/update_universe_response.rb +165 -0
  167. data/lib/shipeasy_admin/models/upsert_project_request.rb +222 -0
  168. data/lib/shipeasy_admin/models/upsert_project_response.rb +260 -0
  169. data/lib/shipeasy_admin/version.rb +15 -0
  170. data/lib/shipeasy_admin.rb +196 -0
  171. metadata +230 -2
@@ -0,0 +1,680 @@
1
+ =begin
2
+ #Shipeasy Admin API
3
+
4
+ #REST API for managing feature gates, experiments, configs, universes, and killswitches in a Shipeasy project. Authenticate with an admin SDK key (`Authorization: Bearer sdk_admin_…`) and scope every request to a project via the `X-Project-Id` header. Mint admin keys via `POST /api/admin/keys` with `type: \"admin\"`. Keys expire after 90 days; rotate with the `revoke` action.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.23.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Shipeasy::Admin::Generated
16
+ class ConfigsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create a dynamic config
23
+ # Creates a new config with the given `schema`. The initial `value` (or an empty object) is published as version 1 on **every** env. Returns `409` if `name` already exists in the project, `400` if `value` doesn't validate against `schema`. **Use cases** - **Minimal create** — `name` + `schema`. Initial value defaults to `{}`. - **Seeded create** — supply a flat `value` to publish the same object on every env. - **Per-env seed** — supply a `{ env: value }` map for different per-env starting values.
24
+ # @param create_config_request [CreateConfigRequest]
25
+ # @param [Hash] opts the optional parameters
26
+ # @option opts [String] :x_project_id Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).
27
+ # @return [CreateConfigResponse]
28
+ def create_config(create_config_request, opts = {})
29
+ data, _status_code, _headers = create_config_with_http_info(create_config_request, opts)
30
+ data
31
+ end
32
+
33
+ # Create a dynamic config
34
+ # Creates a new config with the given `schema`. The initial `value` (or an empty object) is published as version 1 on **every** env. Returns `409` if `name` already exists in the project, `400` if `value` doesn't validate against `schema`. **Use cases** - **Minimal create** — `name` + `schema`. Initial value defaults to `{}`. - **Seeded create** — supply a flat `value` to publish the same object on every env. - **Per-env seed** — supply a `{ env: value }` map for different per-env starting values.
35
+ # @param create_config_request [CreateConfigRequest]
36
+ # @param [Hash] opts the optional parameters
37
+ # @option opts [String] :x_project_id Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).
38
+ # @return [Array<(CreateConfigResponse, Integer, Hash)>] CreateConfigResponse data, response status code and response headers
39
+ def create_config_with_http_info(create_config_request, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: ConfigsApi.create_config ...'
42
+ end
43
+ # verify the required parameter 'create_config_request' is set
44
+ if @api_client.config.client_side_validation && create_config_request.nil?
45
+ fail ArgumentError, "Missing the required parameter 'create_config_request' when calling ConfigsApi.create_config"
46
+ end
47
+ # resource path
48
+ local_var_path = '/api/admin/configs'
49
+
50
+ # query parameters
51
+ query_params = opts[:query_params] || {}
52
+
53
+ # header parameters
54
+ header_params = opts[:header_params] || {}
55
+ # HTTP header 'Accept' (if needed)
56
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
57
+ # HTTP header 'Content-Type'
58
+ content_type = @api_client.select_header_content_type(['application/json'])
59
+ if !content_type.nil?
60
+ header_params['Content-Type'] = content_type
61
+ end
62
+ header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?
63
+
64
+ # form parameters
65
+ form_params = opts[:form_params] || {}
66
+
67
+ # http body (model)
68
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_config_request)
69
+
70
+ # return_type
71
+ return_type = opts[:debug_return_type] || 'CreateConfigResponse'
72
+
73
+ # auth_names
74
+ auth_names = opts[:debug_auth_names] || ['bearerSdkKey']
75
+
76
+ new_options = opts.merge(
77
+ :operation => :"ConfigsApi.create_config",
78
+ :header_params => header_params,
79
+ :query_params => query_params,
80
+ :form_params => form_params,
81
+ :body => post_body,
82
+ :auth_names => auth_names,
83
+ :return_type => return_type
84
+ )
85
+
86
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
87
+ if @api_client.config.debugging
88
+ @api_client.config.logger.debug "API called: ConfigsApi#create_config\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
89
+ end
90
+ return data, status_code, headers
91
+ end
92
+
93
+ # Delete a dynamic config
94
+ # Soft-deletes the config and rebuilds the project's flags KV blob. **Use case:** Tear down a config after its consumers have stopped reading it.
95
+ # @param id [String] Stable opaque config id (&#x60;cfg_…&#x60;) or the config&#39;s &#x60;name&#x60;.
96
+ # @param [Hash] opts the optional parameters
97
+ # @option opts [String] :x_project_id Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).
98
+ # @return [DeleteConfigResponse]
99
+ def delete_config(id, opts = {})
100
+ data, _status_code, _headers = delete_config_with_http_info(id, opts)
101
+ data
102
+ end
103
+
104
+ # Delete a dynamic config
105
+ # Soft-deletes the config and rebuilds the project&#39;s flags KV blob. **Use case:** Tear down a config after its consumers have stopped reading it.
106
+ # @param id [String] Stable opaque config id (&#x60;cfg_…&#x60;) or the config&#39;s &#x60;name&#x60;.
107
+ # @param [Hash] opts the optional parameters
108
+ # @option opts [String] :x_project_id Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).
109
+ # @return [Array<(DeleteConfigResponse, Integer, Hash)>] DeleteConfigResponse data, response status code and response headers
110
+ def delete_config_with_http_info(id, opts = {})
111
+ if @api_client.config.debugging
112
+ @api_client.config.logger.debug 'Calling API: ConfigsApi.delete_config ...'
113
+ end
114
+ # verify the required parameter 'id' is set
115
+ if @api_client.config.client_side_validation && id.nil?
116
+ fail ArgumentError, "Missing the required parameter 'id' when calling ConfigsApi.delete_config"
117
+ end
118
+ # resource path
119
+ local_var_path = '/api/admin/configs/{id}'.sub('{id}', CGI.escape(id.to_s))
120
+
121
+ # query parameters
122
+ query_params = opts[:query_params] || {}
123
+
124
+ # header parameters
125
+ header_params = opts[:header_params] || {}
126
+ # HTTP header 'Accept' (if needed)
127
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
128
+ header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?
129
+
130
+ # form parameters
131
+ form_params = opts[:form_params] || {}
132
+
133
+ # http body (model)
134
+ post_body = opts[:debug_body]
135
+
136
+ # return_type
137
+ return_type = opts[:debug_return_type] || 'DeleteConfigResponse'
138
+
139
+ # auth_names
140
+ auth_names = opts[:debug_auth_names] || ['bearerSdkKey']
141
+
142
+ new_options = opts.merge(
143
+ :operation => :"ConfigsApi.delete_config",
144
+ :header_params => header_params,
145
+ :query_params => query_params,
146
+ :form_params => form_params,
147
+ :body => post_body,
148
+ :auth_names => auth_names,
149
+ :return_type => return_type
150
+ )
151
+
152
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
153
+ if @api_client.config.debugging
154
+ @api_client.config.logger.debug "API called: ConfigsApi#delete_config\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
155
+ end
156
+ return data, status_code, headers
157
+ end
158
+
159
+ # Discard a draft
160
+ # Drops the in-flight draft on one env. Published values are unaffected. **Use case:** Abandon an in-progress draft after deciding not to ship it.
161
+ # @param id [String] Stable opaque config id (&#x60;cfg_…&#x60;) or the config&#39;s &#x60;name&#x60;.
162
+ # @param discard_config_draft_request [DiscardConfigDraftRequest]
163
+ # @param [Hash] opts the optional parameters
164
+ # @option opts [String] :x_project_id Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).
165
+ # @return [DiscardConfigDraftResponse]
166
+ def discard_config_draft(id, discard_config_draft_request, opts = {})
167
+ data, _status_code, _headers = discard_config_draft_with_http_info(id, discard_config_draft_request, opts)
168
+ data
169
+ end
170
+
171
+ # Discard a draft
172
+ # Drops the in-flight draft on one env. Published values are unaffected. **Use case:** Abandon an in-progress draft after deciding not to ship it.
173
+ # @param id [String] Stable opaque config id (&#x60;cfg_…&#x60;) or the config&#39;s &#x60;name&#x60;.
174
+ # @param discard_config_draft_request [DiscardConfigDraftRequest]
175
+ # @param [Hash] opts the optional parameters
176
+ # @option opts [String] :x_project_id Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).
177
+ # @return [Array<(DiscardConfigDraftResponse, Integer, Hash)>] DiscardConfigDraftResponse data, response status code and response headers
178
+ def discard_config_draft_with_http_info(id, discard_config_draft_request, opts = {})
179
+ if @api_client.config.debugging
180
+ @api_client.config.logger.debug 'Calling API: ConfigsApi.discard_config_draft ...'
181
+ end
182
+ # verify the required parameter 'id' is set
183
+ if @api_client.config.client_side_validation && id.nil?
184
+ fail ArgumentError, "Missing the required parameter 'id' when calling ConfigsApi.discard_config_draft"
185
+ end
186
+ # verify the required parameter 'discard_config_draft_request' is set
187
+ if @api_client.config.client_side_validation && discard_config_draft_request.nil?
188
+ fail ArgumentError, "Missing the required parameter 'discard_config_draft_request' when calling ConfigsApi.discard_config_draft"
189
+ end
190
+ # resource path
191
+ local_var_path = '/api/admin/configs/{id}/drafts'.sub('{id}', CGI.escape(id.to_s))
192
+
193
+ # query parameters
194
+ query_params = opts[:query_params] || {}
195
+
196
+ # header parameters
197
+ header_params = opts[:header_params] || {}
198
+ # HTTP header 'Accept' (if needed)
199
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
200
+ # HTTP header 'Content-Type'
201
+ content_type = @api_client.select_header_content_type(['application/json'])
202
+ if !content_type.nil?
203
+ header_params['Content-Type'] = content_type
204
+ end
205
+ header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?
206
+
207
+ # form parameters
208
+ form_params = opts[:form_params] || {}
209
+
210
+ # http body (model)
211
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(discard_config_draft_request)
212
+
213
+ # return_type
214
+ return_type = opts[:debug_return_type] || 'DiscardConfigDraftResponse'
215
+
216
+ # auth_names
217
+ auth_names = opts[:debug_auth_names] || ['bearerSdkKey']
218
+
219
+ new_options = opts.merge(
220
+ :operation => :"ConfigsApi.discard_config_draft",
221
+ :header_params => header_params,
222
+ :query_params => query_params,
223
+ :form_params => form_params,
224
+ :body => post_body,
225
+ :auth_names => auth_names,
226
+ :return_type => return_type
227
+ )
228
+
229
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
230
+ if @api_client.config.debugging
231
+ @api_client.config.logger.debug "API called: ConfigsApi#discard_config_draft\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
232
+ end
233
+ return data, status_code, headers
234
+ end
235
+
236
+ # Get one config
237
+ # Returns config metadata plus the latest published values per env and any active draft values. Use this to fetch the JSON the editor renders. **Use case:** Fetch one config's current published values and any in-flight drafts.
238
+ # @param id [String] Stable opaque config id (&#x60;cfg_…&#x60;) or the config&#39;s &#x60;name&#x60;.
239
+ # @param [Hash] opts the optional parameters
240
+ # @option opts [String] :x_project_id Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).
241
+ # @return [GetConfigResponse]
242
+ def get_config(id, opts = {})
243
+ data, _status_code, _headers = get_config_with_http_info(id, opts)
244
+ data
245
+ end
246
+
247
+ # Get one config
248
+ # Returns config metadata plus the latest published values per env and any active draft values. Use this to fetch the JSON the editor renders. **Use case:** Fetch one config&#39;s current published values and any in-flight drafts.
249
+ # @param id [String] Stable opaque config id (&#x60;cfg_…&#x60;) or the config&#39;s &#x60;name&#x60;.
250
+ # @param [Hash] opts the optional parameters
251
+ # @option opts [String] :x_project_id Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).
252
+ # @return [Array<(GetConfigResponse, Integer, Hash)>] GetConfigResponse data, response status code and response headers
253
+ def get_config_with_http_info(id, opts = {})
254
+ if @api_client.config.debugging
255
+ @api_client.config.logger.debug 'Calling API: ConfigsApi.get_config ...'
256
+ end
257
+ # resource path
258
+ local_var_path = '/api/admin/configs/{id}'.sub('{id}', CGI.escape(id.to_s))
259
+
260
+ # query parameters
261
+ query_params = opts[:query_params] || {}
262
+
263
+ # header parameters
264
+ header_params = opts[:header_params] || {}
265
+ # HTTP header 'Accept' (if needed)
266
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
267
+ header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?
268
+
269
+ # form parameters
270
+ form_params = opts[:form_params] || {}
271
+
272
+ # http body (model)
273
+ post_body = opts[:debug_body]
274
+
275
+ # return_type
276
+ return_type = opts[:debug_return_type] || 'GetConfigResponse'
277
+
278
+ # auth_names
279
+ auth_names = opts[:debug_auth_names] || ['bearerSdkKey']
280
+
281
+ new_options = opts.merge(
282
+ :operation => :"ConfigsApi.get_config",
283
+ :header_params => header_params,
284
+ :query_params => query_params,
285
+ :form_params => form_params,
286
+ :body => post_body,
287
+ :auth_names => auth_names,
288
+ :return_type => return_type
289
+ )
290
+
291
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
292
+ if @api_client.config.debugging
293
+ @api_client.config.logger.debug "API called: ConfigsApi#get_config\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
294
+ end
295
+ return data, status_code, headers
296
+ end
297
+
298
+ # List config activity
299
+ # Returns recent audit rows for one config (create, update, draft.save, publish, delete) ordered newest first. Use the `limit` query parameter to cap the result (1–100, default 20). **Use case:** Render the activity panel in the config editor or drive a slack notification on publish events.
300
+ # @param id [String] Stable opaque config id (&#x60;cfg_…&#x60;) or the config&#39;s &#x60;name&#x60;.
301
+ # @param [Hash] opts the optional parameters
302
+ # @option opts [String] :x_project_id Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).
303
+ # @option opts [Integer] :limit Max rows to return (1–100). Defaults to 20. (default to 20)
304
+ # @return [Array<ListConfigActivityResponseInner>]
305
+ def list_config_activity(id, opts = {})
306
+ data, _status_code, _headers = list_config_activity_with_http_info(id, opts)
307
+ data
308
+ end
309
+
310
+ # List config activity
311
+ # Returns recent audit rows for one config (create, update, draft.save, publish, delete) ordered newest first. Use the &#x60;limit&#x60; query parameter to cap the result (1–100, default 20). **Use case:** Render the activity panel in the config editor or drive a slack notification on publish events.
312
+ # @param id [String] Stable opaque config id (&#x60;cfg_…&#x60;) or the config&#39;s &#x60;name&#x60;.
313
+ # @param [Hash] opts the optional parameters
314
+ # @option opts [String] :x_project_id Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).
315
+ # @option opts [Integer] :limit Max rows to return (1–100). Defaults to 20. (default to 20)
316
+ # @return [Array<(Array<ListConfigActivityResponseInner>, Integer, Hash)>] Array<ListConfigActivityResponseInner> data, response status code and response headers
317
+ def list_config_activity_with_http_info(id, opts = {})
318
+ if @api_client.config.debugging
319
+ @api_client.config.logger.debug 'Calling API: ConfigsApi.list_config_activity ...'
320
+ end
321
+ # verify the required parameter 'id' is set
322
+ if @api_client.config.client_side_validation && id.nil?
323
+ fail ArgumentError, "Missing the required parameter 'id' when calling ConfigsApi.list_config_activity"
324
+ end
325
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
326
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ConfigsApi.list_config_activity, must be smaller than or equal to 100.'
327
+ end
328
+
329
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
330
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ConfigsApi.list_config_activity, must be greater than or equal to 1.'
331
+ end
332
+
333
+ # resource path
334
+ local_var_path = '/api/admin/configs/{id}/activity'.sub('{id}', CGI.escape(id.to_s))
335
+
336
+ # query parameters
337
+ query_params = opts[:query_params] || {}
338
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
339
+
340
+ # header parameters
341
+ header_params = opts[:header_params] || {}
342
+ # HTTP header 'Accept' (if needed)
343
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
344
+ header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?
345
+
346
+ # form parameters
347
+ form_params = opts[:form_params] || {}
348
+
349
+ # http body (model)
350
+ post_body = opts[:debug_body]
351
+
352
+ # return_type
353
+ return_type = opts[:debug_return_type] || 'Array<ListConfigActivityResponseInner>'
354
+
355
+ # auth_names
356
+ auth_names = opts[:debug_auth_names] || ['bearerSdkKey']
357
+
358
+ new_options = opts.merge(
359
+ :operation => :"ConfigsApi.list_config_activity",
360
+ :header_params => header_params,
361
+ :query_params => query_params,
362
+ :form_params => form_params,
363
+ :body => post_body,
364
+ :auth_names => auth_names,
365
+ :return_type => return_type
366
+ )
367
+
368
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
369
+ if @api_client.config.debugging
370
+ @api_client.config.logger.debug "API called: ConfigsApi#list_config_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
371
+ end
372
+ return data, status_code, headers
373
+ end
374
+
375
+ # List dynamic configs
376
+ # Returns a single page of configs ordered by `updated_at desc, id desc`. Each row includes the latest published `version` per env and any active drafts. **Use case:** Snapshot every config in the project — e.g. CI check that asserts no env is stuck on a stale default or that every config has a published value on prod.
377
+ # @param [Hash] opts the optional parameters
378
+ # @option opts [String] :x_project_id Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).
379
+ # @option opts [Integer] :limit Page size (1–500). Defaults to 100. (default to 100)
380
+ # @option opts [String] :cursor Opaque cursor returned in the previous page&#39;s &#x60;next_cursor&#x60;. Omit for the first page.
381
+ # @return [ListConfigsResponse]
382
+ def list_configs(opts = {})
383
+ data, _status_code, _headers = list_configs_with_http_info(opts)
384
+ data
385
+ end
386
+
387
+ # List dynamic configs
388
+ # Returns a single page of configs ordered by &#x60;updated_at desc, id desc&#x60;. Each row includes the latest published &#x60;version&#x60; per env and any active drafts. **Use case:** Snapshot every config in the project — e.g. CI check that asserts no env is stuck on a stale default or that every config has a published value on prod.
389
+ # @param [Hash] opts the optional parameters
390
+ # @option opts [String] :x_project_id Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).
391
+ # @option opts [Integer] :limit Page size (1–500). Defaults to 100. (default to 100)
392
+ # @option opts [String] :cursor Opaque cursor returned in the previous page&#39;s &#x60;next_cursor&#x60;. Omit for the first page.
393
+ # @return [Array<(ListConfigsResponse, Integer, Hash)>] ListConfigsResponse data, response status code and response headers
394
+ def list_configs_with_http_info(opts = {})
395
+ if @api_client.config.debugging
396
+ @api_client.config.logger.debug 'Calling API: ConfigsApi.list_configs ...'
397
+ end
398
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500
399
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ConfigsApi.list_configs, must be smaller than or equal to 500.'
400
+ end
401
+
402
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
403
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ConfigsApi.list_configs, must be greater than or equal to 1.'
404
+ end
405
+
406
+ # resource path
407
+ local_var_path = '/api/admin/configs'
408
+
409
+ # query parameters
410
+ query_params = opts[:query_params] || {}
411
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
412
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
413
+
414
+ # header parameters
415
+ header_params = opts[:header_params] || {}
416
+ # HTTP header 'Accept' (if needed)
417
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
418
+ header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?
419
+
420
+ # form parameters
421
+ form_params = opts[:form_params] || {}
422
+
423
+ # http body (model)
424
+ post_body = opts[:debug_body]
425
+
426
+ # return_type
427
+ return_type = opts[:debug_return_type] || 'ListConfigsResponse'
428
+
429
+ # auth_names
430
+ auth_names = opts[:debug_auth_names] || ['bearerSdkKey']
431
+
432
+ new_options = opts.merge(
433
+ :operation => :"ConfigsApi.list_configs",
434
+ :header_params => header_params,
435
+ :query_params => query_params,
436
+ :form_params => form_params,
437
+ :body => post_body,
438
+ :auth_names => auth_names,
439
+ :return_type => return_type
440
+ )
441
+
442
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
443
+ if @api_client.config.debugging
444
+ @api_client.config.logger.debug "API called: ConfigsApi#list_configs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
445
+ end
446
+ return data, status_code, headers
447
+ end
448
+
449
+ # Publish a draft
450
+ # Promotes the staged draft on one env to a new published version. The draft must still validate against the current schema. Returns `404` if there is no draft for the given env. **Use case:** Ship a staged change once you've validated it on a lower env.
451
+ # @param id [String] Stable opaque config id (&#x60;cfg_…&#x60;) or the config&#39;s &#x60;name&#x60;.
452
+ # @param publish_config_draft_request [PublishConfigDraftRequest]
453
+ # @param [Hash] opts the optional parameters
454
+ # @option opts [String] :x_project_id Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).
455
+ # @return [PublishConfigDraftResponse]
456
+ def publish_config_draft(id, publish_config_draft_request, opts = {})
457
+ data, _status_code, _headers = publish_config_draft_with_http_info(id, publish_config_draft_request, opts)
458
+ data
459
+ end
460
+
461
+ # Publish a draft
462
+ # Promotes the staged draft on one env to a new published version. The draft must still validate against the current schema. Returns &#x60;404&#x60; if there is no draft for the given env. **Use case:** Ship a staged change once you&#39;ve validated it on a lower env.
463
+ # @param id [String] Stable opaque config id (&#x60;cfg_…&#x60;) or the config&#39;s &#x60;name&#x60;.
464
+ # @param publish_config_draft_request [PublishConfigDraftRequest]
465
+ # @param [Hash] opts the optional parameters
466
+ # @option opts [String] :x_project_id Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).
467
+ # @return [Array<(PublishConfigDraftResponse, Integer, Hash)>] PublishConfigDraftResponse data, response status code and response headers
468
+ def publish_config_draft_with_http_info(id, publish_config_draft_request, opts = {})
469
+ if @api_client.config.debugging
470
+ @api_client.config.logger.debug 'Calling API: ConfigsApi.publish_config_draft ...'
471
+ end
472
+ # verify the required parameter 'id' is set
473
+ if @api_client.config.client_side_validation && id.nil?
474
+ fail ArgumentError, "Missing the required parameter 'id' when calling ConfigsApi.publish_config_draft"
475
+ end
476
+ # verify the required parameter 'publish_config_draft_request' is set
477
+ if @api_client.config.client_side_validation && publish_config_draft_request.nil?
478
+ fail ArgumentError, "Missing the required parameter 'publish_config_draft_request' when calling ConfigsApi.publish_config_draft"
479
+ end
480
+ # resource path
481
+ local_var_path = '/api/admin/configs/{id}/publish'.sub('{id}', CGI.escape(id.to_s))
482
+
483
+ # query parameters
484
+ query_params = opts[:query_params] || {}
485
+
486
+ # header parameters
487
+ header_params = opts[:header_params] || {}
488
+ # HTTP header 'Accept' (if needed)
489
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
490
+ # HTTP header 'Content-Type'
491
+ content_type = @api_client.select_header_content_type(['application/json'])
492
+ if !content_type.nil?
493
+ header_params['Content-Type'] = content_type
494
+ end
495
+ header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?
496
+
497
+ # form parameters
498
+ form_params = opts[:form_params] || {}
499
+
500
+ # http body (model)
501
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(publish_config_draft_request)
502
+
503
+ # return_type
504
+ return_type = opts[:debug_return_type] || 'PublishConfigDraftResponse'
505
+
506
+ # auth_names
507
+ auth_names = opts[:debug_auth_names] || ['bearerSdkKey']
508
+
509
+ new_options = opts.merge(
510
+ :operation => :"ConfigsApi.publish_config_draft",
511
+ :header_params => header_params,
512
+ :query_params => query_params,
513
+ :form_params => form_params,
514
+ :body => post_body,
515
+ :auth_names => auth_names,
516
+ :return_type => return_type
517
+ )
518
+
519
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
520
+ if @api_client.config.debugging
521
+ @api_client.config.logger.debug "API called: ConfigsApi#publish_config_draft\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
522
+ end
523
+ return data, status_code, headers
524
+ end
525
+
526
+ # Save a draft value
527
+ # Stages a value for one env without publishing. The draft is validated against the config's current schema and stored alongside the `baseVersion` it was forked from. Saving over an existing draft overwrites it. Use `POST /{id}/publish` to promote it to a new published version. **Use case:** Iterate on a config value on dev without affecting prod — preview in staging, then publish.
528
+ # @param id [String] Stable opaque config id (&#x60;cfg_…&#x60;) or the config&#39;s &#x60;name&#x60;.
529
+ # @param save_config_draft_request [SaveConfigDraftRequest]
530
+ # @param [Hash] opts the optional parameters
531
+ # @option opts [String] :x_project_id Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).
532
+ # @return [SaveConfigDraftResponse]
533
+ def save_config_draft(id, save_config_draft_request, opts = {})
534
+ data, _status_code, _headers = save_config_draft_with_http_info(id, save_config_draft_request, opts)
535
+ data
536
+ end
537
+
538
+ # Save a draft value
539
+ # Stages a value for one env without publishing. The draft is validated against the config&#39;s current schema and stored alongside the &#x60;baseVersion&#x60; it was forked from. Saving over an existing draft overwrites it. Use &#x60;POST /{id}/publish&#x60; to promote it to a new published version. **Use case:** Iterate on a config value on dev without affecting prod — preview in staging, then publish.
540
+ # @param id [String] Stable opaque config id (&#x60;cfg_…&#x60;) or the config&#39;s &#x60;name&#x60;.
541
+ # @param save_config_draft_request [SaveConfigDraftRequest]
542
+ # @param [Hash] opts the optional parameters
543
+ # @option opts [String] :x_project_id Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).
544
+ # @return [Array<(SaveConfigDraftResponse, Integer, Hash)>] SaveConfigDraftResponse data, response status code and response headers
545
+ def save_config_draft_with_http_info(id, save_config_draft_request, opts = {})
546
+ if @api_client.config.debugging
547
+ @api_client.config.logger.debug 'Calling API: ConfigsApi.save_config_draft ...'
548
+ end
549
+ # verify the required parameter 'id' is set
550
+ if @api_client.config.client_side_validation && id.nil?
551
+ fail ArgumentError, "Missing the required parameter 'id' when calling ConfigsApi.save_config_draft"
552
+ end
553
+ # verify the required parameter 'save_config_draft_request' is set
554
+ if @api_client.config.client_side_validation && save_config_draft_request.nil?
555
+ fail ArgumentError, "Missing the required parameter 'save_config_draft_request' when calling ConfigsApi.save_config_draft"
556
+ end
557
+ # resource path
558
+ local_var_path = '/api/admin/configs/{id}/drafts'.sub('{id}', CGI.escape(id.to_s))
559
+
560
+ # query parameters
561
+ query_params = opts[:query_params] || {}
562
+
563
+ # header parameters
564
+ header_params = opts[:header_params] || {}
565
+ # HTTP header 'Accept' (if needed)
566
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
567
+ # HTTP header 'Content-Type'
568
+ content_type = @api_client.select_header_content_type(['application/json'])
569
+ if !content_type.nil?
570
+ header_params['Content-Type'] = content_type
571
+ end
572
+ header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?
573
+
574
+ # form parameters
575
+ form_params = opts[:form_params] || {}
576
+
577
+ # http body (model)
578
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(save_config_draft_request)
579
+
580
+ # return_type
581
+ return_type = opts[:debug_return_type] || 'SaveConfigDraftResponse'
582
+
583
+ # auth_names
584
+ auth_names = opts[:debug_auth_names] || ['bearerSdkKey']
585
+
586
+ new_options = opts.merge(
587
+ :operation => :"ConfigsApi.save_config_draft",
588
+ :header_params => header_params,
589
+ :query_params => query_params,
590
+ :form_params => form_params,
591
+ :body => post_body,
592
+ :auth_names => auth_names,
593
+ :return_type => return_type
594
+ )
595
+
596
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
597
+ if @api_client.config.debugging
598
+ @api_client.config.logger.debug "API called: ConfigsApi#save_config_draft\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
599
+ end
600
+ return data, status_code, headers
601
+ end
602
+
603
+ # Update a dynamic config
604
+ # Partial update. When `value` is supplied it is **republished on every env** (new version per env). When `schema` is supplied it replaces the current schema; every existing value is re-validated. For env-scoped edits, use the draft/publish flow (`PUT /{id}/drafts` then `POST /{id}/publish`) instead. **Use cases** - **Republish flat value** — `{ \"value\": {…} }` sets the same value on every env. - **Schema migration** — `{ \"schema\": {…} }` replaces the schema; existing values are re-validated. - **Env-scoped edits** — use `PUT /{id}/drafts` + `POST /{id}/publish` instead of PATCH.
605
+ # @param id [String] Stable opaque config id (&#x60;cfg_…&#x60;) or the config&#39;s &#x60;name&#x60;.
606
+ # @param update_config_request [UpdateConfigRequest]
607
+ # @param [Hash] opts the optional parameters
608
+ # @option opts [String] :x_project_id Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).
609
+ # @return [UpdateConfigResponse]
610
+ def update_config(id, update_config_request, opts = {})
611
+ data, _status_code, _headers = update_config_with_http_info(id, update_config_request, opts)
612
+ data
613
+ end
614
+
615
+ # Update a dynamic config
616
+ # Partial update. When &#x60;value&#x60; is supplied it is **republished on every env** (new version per env). When &#x60;schema&#x60; is supplied it replaces the current schema; every existing value is re-validated. For env-scoped edits, use the draft/publish flow (&#x60;PUT /{id}/drafts&#x60; then &#x60;POST /{id}/publish&#x60;) instead. **Use cases** - **Republish flat value** — &#x60;{ \&quot;value\&quot;: {…} }&#x60; sets the same value on every env. - **Schema migration** — &#x60;{ \&quot;schema\&quot;: {…} }&#x60; replaces the schema; existing values are re-validated. - **Env-scoped edits** — use &#x60;PUT /{id}/drafts&#x60; + &#x60;POST /{id}/publish&#x60; instead of PATCH.
617
+ # @param id [String] Stable opaque config id (&#x60;cfg_…&#x60;) or the config&#39;s &#x60;name&#x60;.
618
+ # @param update_config_request [UpdateConfigRequest]
619
+ # @param [Hash] opts the optional parameters
620
+ # @option opts [String] :x_project_id Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).
621
+ # @return [Array<(UpdateConfigResponse, Integer, Hash)>] UpdateConfigResponse data, response status code and response headers
622
+ def update_config_with_http_info(id, update_config_request, opts = {})
623
+ if @api_client.config.debugging
624
+ @api_client.config.logger.debug 'Calling API: ConfigsApi.update_config ...'
625
+ end
626
+ # verify the required parameter 'id' is set
627
+ if @api_client.config.client_side_validation && id.nil?
628
+ fail ArgumentError, "Missing the required parameter 'id' when calling ConfigsApi.update_config"
629
+ end
630
+ # verify the required parameter 'update_config_request' is set
631
+ if @api_client.config.client_side_validation && update_config_request.nil?
632
+ fail ArgumentError, "Missing the required parameter 'update_config_request' when calling ConfigsApi.update_config"
633
+ end
634
+ # resource path
635
+ local_var_path = '/api/admin/configs/{id}'.sub('{id}', CGI.escape(id.to_s))
636
+
637
+ # query parameters
638
+ query_params = opts[:query_params] || {}
639
+
640
+ # header parameters
641
+ header_params = opts[:header_params] || {}
642
+ # HTTP header 'Accept' (if needed)
643
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
644
+ # HTTP header 'Content-Type'
645
+ content_type = @api_client.select_header_content_type(['application/json'])
646
+ if !content_type.nil?
647
+ header_params['Content-Type'] = content_type
648
+ end
649
+ header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?
650
+
651
+ # form parameters
652
+ form_params = opts[:form_params] || {}
653
+
654
+ # http body (model)
655
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_config_request)
656
+
657
+ # return_type
658
+ return_type = opts[:debug_return_type] || 'UpdateConfigResponse'
659
+
660
+ # auth_names
661
+ auth_names = opts[:debug_auth_names] || ['bearerSdkKey']
662
+
663
+ new_options = opts.merge(
664
+ :operation => :"ConfigsApi.update_config",
665
+ :header_params => header_params,
666
+ :query_params => query_params,
667
+ :form_params => form_params,
668
+ :body => post_body,
669
+ :auth_names => auth_names,
670
+ :return_type => return_type
671
+ )
672
+
673
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
674
+ if @api_client.config.debugging
675
+ @api_client.config.logger.debug "API called: ConfigsApi#update_config\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
676
+ end
677
+ return data, status_code, headers
678
+ end
679
+ end
680
+ end