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,526 @@
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 KillswitchesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create a killswitch
23
+ # Creates a new killswitch with `value` (default `false`) applied to **every** env at version 1. Returns `409` if `name` already exists in the project. **Use cases** - **Untripped create** — `{ \"name\": \"payments.checkout\" }`. Provision the kill ahead of an incident. - **Pre-tripped** — `{ \"value\": true }` to ship the killswitch already engaged. - **With switches** — seed `switches` to carve out per-region/per-tenant kills from day one.
24
+ # @param create_killswitch_request [CreateKillswitchRequest]
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 [CreateKillswitchResponse]
28
+ def create_killswitch(create_killswitch_request, opts = {})
29
+ data, _status_code, _headers = create_killswitch_with_http_info(create_killswitch_request, opts)
30
+ data
31
+ end
32
+
33
+ # Create a killswitch
34
+ # Creates a new killswitch with `value` (default `false`) applied to **every** env at version 1. Returns `409` if `name` already exists in the project. **Use cases** - **Untripped create** — `{ \"name\": \"payments.checkout\" }`. Provision the kill ahead of an incident. - **Pre-tripped** — `{ \"value\": true }` to ship the killswitch already engaged. - **With switches** — seed `switches` to carve out per-region/per-tenant kills from day one.
35
+ # @param create_killswitch_request [CreateKillswitchRequest]
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<(CreateKillswitchResponse, Integer, Hash)>] CreateKillswitchResponse data, response status code and response headers
39
+ def create_killswitch_with_http_info(create_killswitch_request, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: KillswitchesApi.create_killswitch ...'
42
+ end
43
+ # verify the required parameter 'create_killswitch_request' is set
44
+ if @api_client.config.client_side_validation && create_killswitch_request.nil?
45
+ fail ArgumentError, "Missing the required parameter 'create_killswitch_request' when calling KillswitchesApi.create_killswitch"
46
+ end
47
+ # resource path
48
+ local_var_path = '/api/admin/killswitches'
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_killswitch_request)
69
+
70
+ # return_type
71
+ return_type = opts[:debug_return_type] || 'CreateKillswitchResponse'
72
+
73
+ # auth_names
74
+ auth_names = opts[:debug_auth_names] || ['bearerSdkKey']
75
+
76
+ new_options = opts.merge(
77
+ :operation => :"KillswitchesApi.create_killswitch",
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: KillswitchesApi#create_killswitch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
89
+ end
90
+ return data, status_code, headers
91
+ end
92
+
93
+ # Delete a killswitch
94
+ # Soft-deletes the killswitch and rebuilds the project's flags KV blob so SDKs stop seeing it. **Use case:** Tear down a killswitch after the feature it protected has been removed.
95
+ # @param id [String] Stable opaque killswitch id (&#x60;ksw_…&#x60;) or the killswitch&#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 [DeleteKillswitchResponse]
99
+ def delete_killswitch(id, opts = {})
100
+ data, _status_code, _headers = delete_killswitch_with_http_info(id, opts)
101
+ data
102
+ end
103
+
104
+ # Delete a killswitch
105
+ # Soft-deletes the killswitch and rebuilds the project&#39;s flags KV blob so SDKs stop seeing it. **Use case:** Tear down a killswitch after the feature it protected has been removed.
106
+ # @param id [String] Stable opaque killswitch id (&#x60;ksw_…&#x60;) or the killswitch&#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<(DeleteKillswitchResponse, Integer, Hash)>] DeleteKillswitchResponse data, response status code and response headers
110
+ def delete_killswitch_with_http_info(id, opts = {})
111
+ if @api_client.config.debugging
112
+ @api_client.config.logger.debug 'Calling API: KillswitchesApi.delete_killswitch ...'
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 KillswitchesApi.delete_killswitch"
117
+ end
118
+ # resource path
119
+ local_var_path = '/api/admin/killswitches/{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] || 'DeleteKillswitchResponse'
138
+
139
+ # auth_names
140
+ auth_names = opts[:debug_auth_names] || ['bearerSdkKey']
141
+
142
+ new_options = opts.merge(
143
+ :operation => :"KillswitchesApi.delete_killswitch",
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: KillswitchesApi#delete_killswitch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
155
+ end
156
+ return data, status_code, headers
157
+ end
158
+
159
+ # Get one killswitch
160
+ # Returns the killswitch metadata plus the latest published `value`/`switches`/`version` per env. **Use case:** Fetch the current state of one killswitch — e.g. to verify a trip propagated before declaring an incident mitigated.
161
+ # @param id [String] Stable opaque killswitch id (&#x60;ksw_…&#x60;) or the killswitch&#39;s &#x60;name&#x60;.
162
+ # @param [Hash] opts the optional parameters
163
+ # @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).
164
+ # @return [GetKillswitchResponse]
165
+ def get_killswitch(id, opts = {})
166
+ data, _status_code, _headers = get_killswitch_with_http_info(id, opts)
167
+ data
168
+ end
169
+
170
+ # Get one killswitch
171
+ # Returns the killswitch metadata plus the latest published &#x60;value&#x60;/&#x60;switches&#x60;/&#x60;version&#x60; per env. **Use case:** Fetch the current state of one killswitch — e.g. to verify a trip propagated before declaring an incident mitigated.
172
+ # @param id [String] Stable opaque killswitch id (&#x60;ksw_…&#x60;) or the killswitch&#39;s &#x60;name&#x60;.
173
+ # @param [Hash] opts the optional parameters
174
+ # @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).
175
+ # @return [Array<(GetKillswitchResponse, Integer, Hash)>] GetKillswitchResponse data, response status code and response headers
176
+ def get_killswitch_with_http_info(id, opts = {})
177
+ if @api_client.config.debugging
178
+ @api_client.config.logger.debug 'Calling API: KillswitchesApi.get_killswitch ...'
179
+ end
180
+ # resource path
181
+ local_var_path = '/api/admin/killswitches/{id}'.sub('{id}', CGI.escape(id.to_s))
182
+
183
+ # query parameters
184
+ query_params = opts[:query_params] || {}
185
+
186
+ # header parameters
187
+ header_params = opts[:header_params] || {}
188
+ # HTTP header 'Accept' (if needed)
189
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
190
+ header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?
191
+
192
+ # form parameters
193
+ form_params = opts[:form_params] || {}
194
+
195
+ # http body (model)
196
+ post_body = opts[:debug_body]
197
+
198
+ # return_type
199
+ return_type = opts[:debug_return_type] || 'GetKillswitchResponse'
200
+
201
+ # auth_names
202
+ auth_names = opts[:debug_auth_names] || ['bearerSdkKey']
203
+
204
+ new_options = opts.merge(
205
+ :operation => :"KillswitchesApi.get_killswitch",
206
+ :header_params => header_params,
207
+ :query_params => query_params,
208
+ :form_params => form_params,
209
+ :body => post_body,
210
+ :auth_names => auth_names,
211
+ :return_type => return_type
212
+ )
213
+
214
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
215
+ if @api_client.config.debugging
216
+ @api_client.config.logger.debug "API called: KillswitchesApi#get_killswitch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
217
+ end
218
+ return data, status_code, headers
219
+ end
220
+
221
+ # List killswitches
222
+ # Returns a single page of killswitches ordered by `updated_at desc, id desc`. Each row includes the latest published `value`/`switches`/`version` per env. **Use case:** Snapshot every killswitch in the project — e.g. to render an incident-response runbook listing every kill and its current trip state.
223
+ # @param [Hash] opts the optional parameters
224
+ # @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).
225
+ # @option opts [Integer] :limit Page size (1–500). Defaults to 100. (default to 100)
226
+ # @option opts [String] :cursor Opaque cursor returned in the previous page&#39;s &#x60;next_cursor&#x60;. Omit for the first page.
227
+ # @return [ListKillswitchesResponse]
228
+ def list_killswitches(opts = {})
229
+ data, _status_code, _headers = list_killswitches_with_http_info(opts)
230
+ data
231
+ end
232
+
233
+ # List killswitches
234
+ # Returns a single page of killswitches ordered by &#x60;updated_at desc, id desc&#x60;. Each row includes the latest published &#x60;value&#x60;/&#x60;switches&#x60;/&#x60;version&#x60; per env. **Use case:** Snapshot every killswitch in the project — e.g. to render an incident-response runbook listing every kill and its current trip state.
235
+ # @param [Hash] opts the optional parameters
236
+ # @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).
237
+ # @option opts [Integer] :limit Page size (1–500). Defaults to 100. (default to 100)
238
+ # @option opts [String] :cursor Opaque cursor returned in the previous page&#39;s &#x60;next_cursor&#x60;. Omit for the first page.
239
+ # @return [Array<(ListKillswitchesResponse, Integer, Hash)>] ListKillswitchesResponse data, response status code and response headers
240
+ def list_killswitches_with_http_info(opts = {})
241
+ if @api_client.config.debugging
242
+ @api_client.config.logger.debug 'Calling API: KillswitchesApi.list_killswitches ...'
243
+ end
244
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500
245
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling KillswitchesApi.list_killswitches, must be smaller than or equal to 500.'
246
+ end
247
+
248
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
249
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling KillswitchesApi.list_killswitches, must be greater than or equal to 1.'
250
+ end
251
+
252
+ # resource path
253
+ local_var_path = '/api/admin/killswitches'
254
+
255
+ # query parameters
256
+ query_params = opts[:query_params] || {}
257
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
258
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
259
+
260
+ # header parameters
261
+ header_params = opts[:header_params] || {}
262
+ # HTTP header 'Accept' (if needed)
263
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
264
+ header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?
265
+
266
+ # form parameters
267
+ form_params = opts[:form_params] || {}
268
+
269
+ # http body (model)
270
+ post_body = opts[:debug_body]
271
+
272
+ # return_type
273
+ return_type = opts[:debug_return_type] || 'ListKillswitchesResponse'
274
+
275
+ # auth_names
276
+ auth_names = opts[:debug_auth_names] || ['bearerSdkKey']
277
+
278
+ new_options = opts.merge(
279
+ :operation => :"KillswitchesApi.list_killswitches",
280
+ :header_params => header_params,
281
+ :query_params => query_params,
282
+ :form_params => form_params,
283
+ :body => post_body,
284
+ :auth_names => auth_names,
285
+ :return_type => return_type
286
+ )
287
+
288
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
289
+ if @api_client.config.debugging
290
+ @api_client.config.logger.debug "API called: KillswitchesApi#list_killswitches\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
291
+ end
292
+ return data, status_code, headers
293
+ end
294
+
295
+ # Set one switch entry
296
+ # Sets or updates a single `switchKey` on a single `env`. Publishes one new version on that env only — other envs untouched. Use this for surgical per-env, per-key flips during incident response (e.g. trip `eu_region` on prod without touching the flat `value` or other envs). **Use cases** - **Trip a region** — `{ \"env\": \"prod\", \"switchKey\": \"eu_region\", \"value\": true }`. - **Untrip without removing** — same payload with `value: false`. To remove the entry entirely use `DELETE /{id}/switch`.
297
+ # @param id [String] Stable opaque killswitch id (&#x60;ksw_…&#x60;) or the killswitch&#39;s &#x60;name&#x60;.
298
+ # @param set_killswitch_switch_request [SetKillswitchSwitchRequest]
299
+ # @param [Hash] opts the optional parameters
300
+ # @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).
301
+ # @return [SetKillswitchSwitchResponse]
302
+ def set_killswitch_switch(id, set_killswitch_switch_request, opts = {})
303
+ data, _status_code, _headers = set_killswitch_switch_with_http_info(id, set_killswitch_switch_request, opts)
304
+ data
305
+ end
306
+
307
+ # Set one switch entry
308
+ # Sets or updates a single &#x60;switchKey&#x60; on a single &#x60;env&#x60;. Publishes one new version on that env only — other envs untouched. Use this for surgical per-env, per-key flips during incident response (e.g. trip &#x60;eu_region&#x60; on prod without touching the flat &#x60;value&#x60; or other envs). **Use cases** - **Trip a region** — &#x60;{ \&quot;env\&quot;: \&quot;prod\&quot;, \&quot;switchKey\&quot;: \&quot;eu_region\&quot;, \&quot;value\&quot;: true }&#x60;. - **Untrip without removing** — same payload with &#x60;value: false&#x60;. To remove the entry entirely use &#x60;DELETE /{id}/switch&#x60;.
309
+ # @param id [String] Stable opaque killswitch id (&#x60;ksw_…&#x60;) or the killswitch&#39;s &#x60;name&#x60;.
310
+ # @param set_killswitch_switch_request [SetKillswitchSwitchRequest]
311
+ # @param [Hash] opts the optional parameters
312
+ # @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).
313
+ # @return [Array<(SetKillswitchSwitchResponse, Integer, Hash)>] SetKillswitchSwitchResponse data, response status code and response headers
314
+ def set_killswitch_switch_with_http_info(id, set_killswitch_switch_request, opts = {})
315
+ if @api_client.config.debugging
316
+ @api_client.config.logger.debug 'Calling API: KillswitchesApi.set_killswitch_switch ...'
317
+ end
318
+ # verify the required parameter 'id' is set
319
+ if @api_client.config.client_side_validation && id.nil?
320
+ fail ArgumentError, "Missing the required parameter 'id' when calling KillswitchesApi.set_killswitch_switch"
321
+ end
322
+ # verify the required parameter 'set_killswitch_switch_request' is set
323
+ if @api_client.config.client_side_validation && set_killswitch_switch_request.nil?
324
+ fail ArgumentError, "Missing the required parameter 'set_killswitch_switch_request' when calling KillswitchesApi.set_killswitch_switch"
325
+ end
326
+ # resource path
327
+ local_var_path = '/api/admin/killswitches/{id}/switch'.sub('{id}', CGI.escape(id.to_s))
328
+
329
+ # query parameters
330
+ query_params = opts[:query_params] || {}
331
+
332
+ # header parameters
333
+ header_params = opts[:header_params] || {}
334
+ # HTTP header 'Accept' (if needed)
335
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
336
+ # HTTP header 'Content-Type'
337
+ content_type = @api_client.select_header_content_type(['application/json'])
338
+ if !content_type.nil?
339
+ header_params['Content-Type'] = content_type
340
+ end
341
+ header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?
342
+
343
+ # form parameters
344
+ form_params = opts[:form_params] || {}
345
+
346
+ # http body (model)
347
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(set_killswitch_switch_request)
348
+
349
+ # return_type
350
+ return_type = opts[:debug_return_type] || 'SetKillswitchSwitchResponse'
351
+
352
+ # auth_names
353
+ auth_names = opts[:debug_auth_names] || ['bearerSdkKey']
354
+
355
+ new_options = opts.merge(
356
+ :operation => :"KillswitchesApi.set_killswitch_switch",
357
+ :header_params => header_params,
358
+ :query_params => query_params,
359
+ :form_params => form_params,
360
+ :body => post_body,
361
+ :auth_names => auth_names,
362
+ :return_type => return_type
363
+ )
364
+
365
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
366
+ if @api_client.config.debugging
367
+ @api_client.config.logger.debug "API called: KillswitchesApi#set_killswitch_switch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
368
+ end
369
+ return data, status_code, headers
370
+ end
371
+
372
+ # Remove one switch entry
373
+ # Removes a single `switchKey` from the `switches` map on a single `env`. Publishes a new version on that env. Returns `{ removed: false }` if the entry didn't exist (idempotent no-op). **Use case:** Clean up a per-region override after the incident is resolved so the flat `value` governs again.
374
+ # @param id [String] Stable opaque killswitch id (&#x60;ksw_…&#x60;) or the killswitch&#39;s &#x60;name&#x60;.
375
+ # @param unset_killswitch_switch_request [UnsetKillswitchSwitchRequest]
376
+ # @param [Hash] opts the optional parameters
377
+ # @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).
378
+ # @return [UnsetKillswitchSwitchResponse]
379
+ def unset_killswitch_switch(id, unset_killswitch_switch_request, opts = {})
380
+ data, _status_code, _headers = unset_killswitch_switch_with_http_info(id, unset_killswitch_switch_request, opts)
381
+ data
382
+ end
383
+
384
+ # Remove one switch entry
385
+ # Removes a single &#x60;switchKey&#x60; from the &#x60;switches&#x60; map on a single &#x60;env&#x60;. Publishes a new version on that env. Returns &#x60;{ removed: false }&#x60; if the entry didn&#39;t exist (idempotent no-op). **Use case:** Clean up a per-region override after the incident is resolved so the flat &#x60;value&#x60; governs again.
386
+ # @param id [String] Stable opaque killswitch id (&#x60;ksw_…&#x60;) or the killswitch&#39;s &#x60;name&#x60;.
387
+ # @param unset_killswitch_switch_request [UnsetKillswitchSwitchRequest]
388
+ # @param [Hash] opts the optional parameters
389
+ # @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).
390
+ # @return [Array<(UnsetKillswitchSwitchResponse, Integer, Hash)>] UnsetKillswitchSwitchResponse data, response status code and response headers
391
+ def unset_killswitch_switch_with_http_info(id, unset_killswitch_switch_request, opts = {})
392
+ if @api_client.config.debugging
393
+ @api_client.config.logger.debug 'Calling API: KillswitchesApi.unset_killswitch_switch ...'
394
+ end
395
+ # verify the required parameter 'id' is set
396
+ if @api_client.config.client_side_validation && id.nil?
397
+ fail ArgumentError, "Missing the required parameter 'id' when calling KillswitchesApi.unset_killswitch_switch"
398
+ end
399
+ # verify the required parameter 'unset_killswitch_switch_request' is set
400
+ if @api_client.config.client_side_validation && unset_killswitch_switch_request.nil?
401
+ fail ArgumentError, "Missing the required parameter 'unset_killswitch_switch_request' when calling KillswitchesApi.unset_killswitch_switch"
402
+ end
403
+ # resource path
404
+ local_var_path = '/api/admin/killswitches/{id}/switch'.sub('{id}', CGI.escape(id.to_s))
405
+
406
+ # query parameters
407
+ query_params = opts[:query_params] || {}
408
+
409
+ # header parameters
410
+ header_params = opts[:header_params] || {}
411
+ # HTTP header 'Accept' (if needed)
412
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
413
+ # HTTP header 'Content-Type'
414
+ content_type = @api_client.select_header_content_type(['application/json'])
415
+ if !content_type.nil?
416
+ header_params['Content-Type'] = content_type
417
+ end
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] || @api_client.object_to_http_body(unset_killswitch_switch_request)
425
+
426
+ # return_type
427
+ return_type = opts[:debug_return_type] || 'UnsetKillswitchSwitchResponse'
428
+
429
+ # auth_names
430
+ auth_names = opts[:debug_auth_names] || ['bearerSdkKey']
431
+
432
+ new_options = opts.merge(
433
+ :operation => :"KillswitchesApi.unset_killswitch_switch",
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(:DELETE, local_var_path, new_options)
443
+ if @api_client.config.debugging
444
+ @api_client.config.logger.debug "API called: KillswitchesApi#unset_killswitch_switch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
445
+ end
446
+ return data, status_code, headers
447
+ end
448
+
449
+ # Update a killswitch
450
+ # Partial update applied to **every** env. Setting `value`/`switches` publishes a new version per env. Description-only patches don't bump versions. To change a single switch on a single env, use `PUT /{id}/switch` instead. **Use cases** - **Trip everywhere** — `{ \"value\": true }`. Kills the feature across dev/stage/prod in one call. - **Untrip everywhere** — `{ \"value\": false }`. - **Replace switches** — send the full new map; per-key edits use `PUT /{id}/switch`. - **Update description** — metadata-only patches don't bump versions.
451
+ # @param id [String] Stable opaque killswitch id (&#x60;ksw_…&#x60;) or the killswitch&#39;s &#x60;name&#x60;.
452
+ # @param update_killswitch_request [UpdateKillswitchRequest]
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 [UpdateKillswitchResponse]
456
+ def update_killswitch(id, update_killswitch_request, opts = {})
457
+ data, _status_code, _headers = update_killswitch_with_http_info(id, update_killswitch_request, opts)
458
+ data
459
+ end
460
+
461
+ # Update a killswitch
462
+ # Partial update applied to **every** env. Setting &#x60;value&#x60;/&#x60;switches&#x60; publishes a new version per env. Description-only patches don&#39;t bump versions. To change a single switch on a single env, use &#x60;PUT /{id}/switch&#x60; instead. **Use cases** - **Trip everywhere** — &#x60;{ \&quot;value\&quot;: true }&#x60;. Kills the feature across dev/stage/prod in one call. - **Untrip everywhere** — &#x60;{ \&quot;value\&quot;: false }&#x60;. - **Replace switches** — send the full new map; per-key edits use &#x60;PUT /{id}/switch&#x60;. - **Update description** — metadata-only patches don&#39;t bump versions.
463
+ # @param id [String] Stable opaque killswitch id (&#x60;ksw_…&#x60;) or the killswitch&#39;s &#x60;name&#x60;.
464
+ # @param update_killswitch_request [UpdateKillswitchRequest]
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<(UpdateKillswitchResponse, Integer, Hash)>] UpdateKillswitchResponse data, response status code and response headers
468
+ def update_killswitch_with_http_info(id, update_killswitch_request, opts = {})
469
+ if @api_client.config.debugging
470
+ @api_client.config.logger.debug 'Calling API: KillswitchesApi.update_killswitch ...'
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 KillswitchesApi.update_killswitch"
475
+ end
476
+ # verify the required parameter 'update_killswitch_request' is set
477
+ if @api_client.config.client_side_validation && update_killswitch_request.nil?
478
+ fail ArgumentError, "Missing the required parameter 'update_killswitch_request' when calling KillswitchesApi.update_killswitch"
479
+ end
480
+ # resource path
481
+ local_var_path = '/api/admin/killswitches/{id}'.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(update_killswitch_request)
502
+
503
+ # return_type
504
+ return_type = opts[:debug_return_type] || 'UpdateKillswitchResponse'
505
+
506
+ # auth_names
507
+ auth_names = opts[:debug_auth_names] || ['bearerSdkKey']
508
+
509
+ new_options = opts.merge(
510
+ :operation => :"KillswitchesApi.update_killswitch",
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(:PATCH, local_var_path, new_options)
520
+ if @api_client.config.debugging
521
+ @api_client.config.logger.debug "API called: KillswitchesApi#update_killswitch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
522
+ end
523
+ return data, status_code, headers
524
+ end
525
+ end
526
+ end