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,438 @@
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 GatesApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create a feature gate
23
+ # Creates a new gate. Default `enabled: true` at the supplied `rollout_pct` (`0` = fully dark). Only `name` is required. Request fields use snake_case (`owner_email`); the GET response returns camelCase (`ownerEmail`, `groupName`). Returns `409` if `name` already exists in the project (case-sensitive). **Use cases** - **Dark create + ramp later** — `{ \"name\": \"checkout_v2\" }` at 0% rollout. Ramp via PATCH after deploy validation. - **Targeted rollout** — supply `rules` to gate the caller (e.g. only `plan = pro` users) plus a `rollout_pct` to bucket within that audience. - **Gatekeeper stack** — supply `stack` instead of `rules`/`rollout_pct` for `internal ∪ beta ∪ public` fall-through. Stack entries evaluated top-to-bottom; first match wins. - **Dashboard metadata** — populate `title`, `description`, `folder`, `group`, `owner_email` so the admin UI is self-documenting from day one. - **Disabled on create** — pre-provision with `enabled: false` for a future launch; flip on with `POST /{id}/enable` at go-live.
24
+ # @param create_gate_request [CreateGateRequest]
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 [CreateGateResponse]
28
+ def create_gate(create_gate_request, opts = {})
29
+ data, _status_code, _headers = create_gate_with_http_info(create_gate_request, opts)
30
+ data
31
+ end
32
+
33
+ # Create a feature gate
34
+ # Creates a new gate. Default `enabled: true` at the supplied `rollout_pct` (`0` = fully dark). Only `name` is required. Request fields use snake_case (`owner_email`); the GET response returns camelCase (`ownerEmail`, `groupName`). Returns `409` if `name` already exists in the project (case-sensitive). **Use cases** - **Dark create + ramp later** — `{ \"name\": \"checkout_v2\" }` at 0% rollout. Ramp via PATCH after deploy validation. - **Targeted rollout** — supply `rules` to gate the caller (e.g. only `plan = pro` users) plus a `rollout_pct` to bucket within that audience. - **Gatekeeper stack** — supply `stack` instead of `rules`/`rollout_pct` for `internal ∪ beta ∪ public` fall-through. Stack entries evaluated top-to-bottom; first match wins. - **Dashboard metadata** — populate `title`, `description`, `folder`, `group`, `owner_email` so the admin UI is self-documenting from day one. - **Disabled on create** — pre-provision with `enabled: false` for a future launch; flip on with `POST /{id}/enable` at go-live.
35
+ # @param create_gate_request [CreateGateRequest]
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<(CreateGateResponse, Integer, Hash)>] CreateGateResponse data, response status code and response headers
39
+ def create_gate_with_http_info(create_gate_request, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: GatesApi.create_gate ...'
42
+ end
43
+ # verify the required parameter 'create_gate_request' is set
44
+ if @api_client.config.client_side_validation && create_gate_request.nil?
45
+ fail ArgumentError, "Missing the required parameter 'create_gate_request' when calling GatesApi.create_gate"
46
+ end
47
+ # resource path
48
+ local_var_path = '/api/admin/gates'
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_gate_request)
69
+
70
+ # return_type
71
+ return_type = opts[:debug_return_type] || 'CreateGateResponse'
72
+
73
+ # auth_names
74
+ auth_names = opts[:debug_auth_names] || ['bearerSdkKey']
75
+
76
+ new_options = opts.merge(
77
+ :operation => :"GatesApi.create_gate",
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: GatesApi#create_gate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
89
+ end
90
+ return data, status_code, headers
91
+ end
92
+
93
+ # Delete a feature gate
94
+ # Soft-deletes the gate. Returns 409 if the gate is still referenced by a running experiment as a targeting gate — stop the experiment first. **Use case:** Tear down a gate after a feature has fully shipped and the rollout flag is no longer needed.
95
+ # @param id [String] Stable opaque gate id (&#x60;gat_…&#x60;) or the gate&#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 [DeleteGateResponse]
99
+ def delete_gate(id, opts = {})
100
+ data, _status_code, _headers = delete_gate_with_http_info(id, opts)
101
+ data
102
+ end
103
+
104
+ # Delete a feature gate
105
+ # Soft-deletes the gate. Returns 409 if the gate is still referenced by a running experiment as a targeting gate — stop the experiment first. **Use case:** Tear down a gate after a feature has fully shipped and the rollout flag is no longer needed.
106
+ # @param id [String] Stable opaque gate id (&#x60;gat_…&#x60;) or the gate&#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<(DeleteGateResponse, Integer, Hash)>] DeleteGateResponse data, response status code and response headers
110
+ def delete_gate_with_http_info(id, opts = {})
111
+ if @api_client.config.debugging
112
+ @api_client.config.logger.debug 'Calling API: GatesApi.delete_gate ...'
113
+ end
114
+ # resource path
115
+ local_var_path = '/api/admin/gates/{id}'.sub('{id}', CGI.escape(id.to_s))
116
+
117
+ # query parameters
118
+ query_params = opts[:query_params] || {}
119
+
120
+ # header parameters
121
+ header_params = opts[:header_params] || {}
122
+ # HTTP header 'Accept' (if needed)
123
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
124
+ header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?
125
+
126
+ # form parameters
127
+ form_params = opts[:form_params] || {}
128
+
129
+ # http body (model)
130
+ post_body = opts[:debug_body]
131
+
132
+ # return_type
133
+ return_type = opts[:debug_return_type] || 'DeleteGateResponse'
134
+
135
+ # auth_names
136
+ auth_names = opts[:debug_auth_names] || ['bearerSdkKey']
137
+
138
+ new_options = opts.merge(
139
+ :operation => :"GatesApi.delete_gate",
140
+ :header_params => header_params,
141
+ :query_params => query_params,
142
+ :form_params => form_params,
143
+ :body => post_body,
144
+ :auth_names => auth_names,
145
+ :return_type => return_type
146
+ )
147
+
148
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
149
+ if @api_client.config.debugging
150
+ @api_client.config.logger.debug "API called: GatesApi#delete_gate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
151
+ end
152
+ return data, status_code, headers
153
+ end
154
+
155
+ # Disable a gate
156
+ # Sets `enabled: false` so the gate evaluates to `false` for every caller, regardless of `rollout_pct` or `rules`. Use as a quick kill switch. **Use case:** Flip a gate off in production without redeploying — the canonical kill-switch flow.
157
+ # @param id [String] Stable opaque gate id (&#x60;gat_…&#x60;) or the gate&#39;s &#x60;name&#x60;.
158
+ # @param [Hash] opts the optional parameters
159
+ # @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).
160
+ # @return [DisableGateResponse]
161
+ def disable_gate(id, opts = {})
162
+ data, _status_code, _headers = disable_gate_with_http_info(id, opts)
163
+ data
164
+ end
165
+
166
+ # Disable a gate
167
+ # Sets &#x60;enabled: false&#x60; so the gate evaluates to &#x60;false&#x60; for every caller, regardless of &#x60;rollout_pct&#x60; or &#x60;rules&#x60;. Use as a quick kill switch. **Use case:** Flip a gate off in production without redeploying — the canonical kill-switch flow.
168
+ # @param id [String] Stable opaque gate id (&#x60;gat_…&#x60;) or the gate&#39;s &#x60;name&#x60;.
169
+ # @param [Hash] opts the optional parameters
170
+ # @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).
171
+ # @return [Array<(DisableGateResponse, Integer, Hash)>] DisableGateResponse data, response status code and response headers
172
+ def disable_gate_with_http_info(id, opts = {})
173
+ if @api_client.config.debugging
174
+ @api_client.config.logger.debug 'Calling API: GatesApi.disable_gate ...'
175
+ end
176
+ # verify the required parameter 'id' is set
177
+ if @api_client.config.client_side_validation && id.nil?
178
+ fail ArgumentError, "Missing the required parameter 'id' when calling GatesApi.disable_gate"
179
+ end
180
+ # resource path
181
+ local_var_path = '/api/admin/gates/{id}/disable'.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] || 'DisableGateResponse'
200
+
201
+ # auth_names
202
+ auth_names = opts[:debug_auth_names] || ['bearerSdkKey']
203
+
204
+ new_options = opts.merge(
205
+ :operation => :"GatesApi.disable_gate",
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(:POST, local_var_path, new_options)
215
+ if @api_client.config.debugging
216
+ @api_client.config.logger.debug "API called: GatesApi#disable_gate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
217
+ end
218
+ return data, status_code, headers
219
+ end
220
+
221
+ # Enable a gate
222
+ # Sets `enabled: true`. The current `rollout_pct` is preserved. **Use case:** Re-enable a previously disabled gate without re-issuing a full update.
223
+ # @param id [String] Stable opaque gate id (&#x60;gat_…&#x60;) or the gate&#39;s &#x60;name&#x60;.
224
+ # @param [Hash] opts the optional parameters
225
+ # @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).
226
+ # @return [EnableGateResponse]
227
+ def enable_gate(id, opts = {})
228
+ data, _status_code, _headers = enable_gate_with_http_info(id, opts)
229
+ data
230
+ end
231
+
232
+ # Enable a gate
233
+ # Sets &#x60;enabled: true&#x60;. The current &#x60;rollout_pct&#x60; is preserved. **Use case:** Re-enable a previously disabled gate without re-issuing a full update.
234
+ # @param id [String] Stable opaque gate id (&#x60;gat_…&#x60;) or the gate&#39;s &#x60;name&#x60;.
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
+ # @return [Array<(EnableGateResponse, Integer, Hash)>] EnableGateResponse data, response status code and response headers
238
+ def enable_gate_with_http_info(id, opts = {})
239
+ if @api_client.config.debugging
240
+ @api_client.config.logger.debug 'Calling API: GatesApi.enable_gate ...'
241
+ end
242
+ # verify the required parameter 'id' is set
243
+ if @api_client.config.client_side_validation && id.nil?
244
+ fail ArgumentError, "Missing the required parameter 'id' when calling GatesApi.enable_gate"
245
+ end
246
+ # resource path
247
+ local_var_path = '/api/admin/gates/{id}/enable'.sub('{id}', CGI.escape(id.to_s))
248
+
249
+ # query parameters
250
+ query_params = opts[:query_params] || {}
251
+
252
+ # header parameters
253
+ header_params = opts[:header_params] || {}
254
+ # HTTP header 'Accept' (if needed)
255
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
256
+ header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?
257
+
258
+ # form parameters
259
+ form_params = opts[:form_params] || {}
260
+
261
+ # http body (model)
262
+ post_body = opts[:debug_body]
263
+
264
+ # return_type
265
+ return_type = opts[:debug_return_type] || 'EnableGateResponse'
266
+
267
+ # auth_names
268
+ auth_names = opts[:debug_auth_names] || ['bearerSdkKey']
269
+
270
+ new_options = opts.merge(
271
+ :operation => :"GatesApi.enable_gate",
272
+ :header_params => header_params,
273
+ :query_params => query_params,
274
+ :form_params => form_params,
275
+ :body => post_body,
276
+ :auth_names => auth_names,
277
+ :return_type => return_type
278
+ )
279
+
280
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
281
+ if @api_client.config.debugging
282
+ @api_client.config.logger.debug "API called: GatesApi#enable_gate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
283
+ end
284
+ return data, status_code, headers
285
+ end
286
+
287
+ # List feature gates
288
+ # Returns a single page of gates ordered by `updated_at desc, id desc`. Use the `cursor` query parameter to paginate. **Use case:** Snapshot every gate in the project — for example to render an admin overview or to drive a CI check that asserts no gate is left at 100% in staging.
289
+ # @param [Hash] opts the optional parameters
290
+ # @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).
291
+ # @option opts [Integer] :limit Page size (1–500). Defaults to 100. (default to 100)
292
+ # @option opts [String] :cursor Opaque cursor returned in the previous page&#39;s &#x60;next_cursor&#x60;. Omit for the first page.
293
+ # @return [ListGatesResponse]
294
+ def list_gates(opts = {})
295
+ data, _status_code, _headers = list_gates_with_http_info(opts)
296
+ data
297
+ end
298
+
299
+ # List feature gates
300
+ # Returns a single page of gates ordered by &#x60;updated_at desc, id desc&#x60;. Use the &#x60;cursor&#x60; query parameter to paginate. **Use case:** Snapshot every gate in the project — for example to render an admin overview or to drive a CI check that asserts no gate is left at 100% in staging.
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 Page size (1–500). Defaults to 100. (default to 100)
304
+ # @option opts [String] :cursor Opaque cursor returned in the previous page&#39;s &#x60;next_cursor&#x60;. Omit for the first page.
305
+ # @return [Array<(ListGatesResponse, Integer, Hash)>] ListGatesResponse data, response status code and response headers
306
+ def list_gates_with_http_info(opts = {})
307
+ if @api_client.config.debugging
308
+ @api_client.config.logger.debug 'Calling API: GatesApi.list_gates ...'
309
+ end
310
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500
311
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling GatesApi.list_gates, must be smaller than or equal to 500.'
312
+ end
313
+
314
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
315
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling GatesApi.list_gates, must be greater than or equal to 1.'
316
+ end
317
+
318
+ # resource path
319
+ local_var_path = '/api/admin/gates'
320
+
321
+ # query parameters
322
+ query_params = opts[:query_params] || {}
323
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
324
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
325
+
326
+ # header parameters
327
+ header_params = opts[:header_params] || {}
328
+ # HTTP header 'Accept' (if needed)
329
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
330
+ header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?
331
+
332
+ # form parameters
333
+ form_params = opts[:form_params] || {}
334
+
335
+ # http body (model)
336
+ post_body = opts[:debug_body]
337
+
338
+ # return_type
339
+ return_type = opts[:debug_return_type] || 'ListGatesResponse'
340
+
341
+ # auth_names
342
+ auth_names = opts[:debug_auth_names] || ['bearerSdkKey']
343
+
344
+ new_options = opts.merge(
345
+ :operation => :"GatesApi.list_gates",
346
+ :header_params => header_params,
347
+ :query_params => query_params,
348
+ :form_params => form_params,
349
+ :body => post_body,
350
+ :auth_names => auth_names,
351
+ :return_type => return_type
352
+ )
353
+
354
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
355
+ if @api_client.config.debugging
356
+ @api_client.config.logger.debug "API called: GatesApi#list_gates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
357
+ end
358
+ return data, status_code, headers
359
+ end
360
+
361
+ # Update a feature gate
362
+ # Partial update — only supplied fields change. Array fields (`rules`, `stack`) **replace** wholesale; there is no merge or append. `name` and the gate id are immutable. The response carries only `{ id }` — re-fetch via `GET /api/admin/gates` for the new row. **Use cases** - **Ramp rollout** — `{ \"rollout_pct\": 5000 }` for 50%. Basis points (0–10000); `100` = 1%. - **Kill switch** — `{ \"enabled\": false }`. Forces evaluation to `false` for every caller regardless of rules/rollout. Re-enable with `POST /{id}/enable` or `{ \"enabled\": true }`. - **Modify a rule's `in` set** — send the full new `rules` array. To add `'GB'` to `['US','CA']`: `{ \"rules\": [{ \"attr\": \"country\", \"op\": \"in\", \"value\": [\"US\",\"CA\",\"GB\"] }] }`. No per-rule patch endpoint. - **Add targeting from scratch** — `{ \"rules\": [{ \"attr\": \"email\", \"op\": \"regex\", \"value\": \"@acme\\\\.com$\" }] }`. - **Switch to gatekeeper stack** — send a non-null `stack`. To revert to flat eval, send `{ \"stack\": null }`. - **Update metadata** — any subset of `title`, `description`, `folder`, `group`, `owner_email`.
363
+ # @param id [String] Stable opaque gate id (&#x60;gat_…&#x60;) or the gate&#39;s &#x60;name&#x60;.
364
+ # @param update_gate_request [UpdateGateRequest]
365
+ # @param [Hash] opts the optional parameters
366
+ # @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).
367
+ # @return [UpdateGateResponse]
368
+ def update_gate(id, update_gate_request, opts = {})
369
+ data, _status_code, _headers = update_gate_with_http_info(id, update_gate_request, opts)
370
+ data
371
+ end
372
+
373
+ # Update a feature gate
374
+ # Partial update — only supplied fields change. Array fields (&#x60;rules&#x60;, &#x60;stack&#x60;) **replace** wholesale; there is no merge or append. &#x60;name&#x60; and the gate id are immutable. The response carries only &#x60;{ id }&#x60; — re-fetch via &#x60;GET /api/admin/gates&#x60; for the new row. **Use cases** - **Ramp rollout** — &#x60;{ \&quot;rollout_pct\&quot;: 5000 }&#x60; for 50%. Basis points (0–10000); &#x60;100&#x60; &#x3D; 1%. - **Kill switch** — &#x60;{ \&quot;enabled\&quot;: false }&#x60;. Forces evaluation to &#x60;false&#x60; for every caller regardless of rules/rollout. Re-enable with &#x60;POST /{id}/enable&#x60; or &#x60;{ \&quot;enabled\&quot;: true }&#x60;. - **Modify a rule&#39;s &#x60;in&#x60; set** — send the full new &#x60;rules&#x60; array. To add &#x60;&#39;GB&#39;&#x60; to &#x60;[&#39;US&#39;,&#39;CA&#39;]&#x60;: &#x60;{ \&quot;rules\&quot;: [{ \&quot;attr\&quot;: \&quot;country\&quot;, \&quot;op\&quot;: \&quot;in\&quot;, \&quot;value\&quot;: [\&quot;US\&quot;,\&quot;CA\&quot;,\&quot;GB\&quot;] }] }&#x60;. No per-rule patch endpoint. - **Add targeting from scratch** — &#x60;{ \&quot;rules\&quot;: [{ \&quot;attr\&quot;: \&quot;email\&quot;, \&quot;op\&quot;: \&quot;regex\&quot;, \&quot;value\&quot;: \&quot;@acme\\\\.com$\&quot; }] }&#x60;. - **Switch to gatekeeper stack** — send a non-null &#x60;stack&#x60;. To revert to flat eval, send &#x60;{ \&quot;stack\&quot;: null }&#x60;. - **Update metadata** — any subset of &#x60;title&#x60;, &#x60;description&#x60;, &#x60;folder&#x60;, &#x60;group&#x60;, &#x60;owner_email&#x60;.
375
+ # @param id [String] Stable opaque gate id (&#x60;gat_…&#x60;) or the gate&#39;s &#x60;name&#x60;.
376
+ # @param update_gate_request [UpdateGateRequest]
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
+ # @return [Array<(UpdateGateResponse, Integer, Hash)>] UpdateGateResponse data, response status code and response headers
380
+ def update_gate_with_http_info(id, update_gate_request, opts = {})
381
+ if @api_client.config.debugging
382
+ @api_client.config.logger.debug 'Calling API: GatesApi.update_gate ...'
383
+ end
384
+ # verify the required parameter 'id' is set
385
+ if @api_client.config.client_side_validation && id.nil?
386
+ fail ArgumentError, "Missing the required parameter 'id' when calling GatesApi.update_gate"
387
+ end
388
+ # verify the required parameter 'update_gate_request' is set
389
+ if @api_client.config.client_side_validation && update_gate_request.nil?
390
+ fail ArgumentError, "Missing the required parameter 'update_gate_request' when calling GatesApi.update_gate"
391
+ end
392
+ # resource path
393
+ local_var_path = '/api/admin/gates/{id}'.sub('{id}', CGI.escape(id.to_s))
394
+
395
+ # query parameters
396
+ query_params = opts[:query_params] || {}
397
+
398
+ # header parameters
399
+ header_params = opts[:header_params] || {}
400
+ # HTTP header 'Accept' (if needed)
401
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
402
+ # HTTP header 'Content-Type'
403
+ content_type = @api_client.select_header_content_type(['application/json'])
404
+ if !content_type.nil?
405
+ header_params['Content-Type'] = content_type
406
+ end
407
+ header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?
408
+
409
+ # form parameters
410
+ form_params = opts[:form_params] || {}
411
+
412
+ # http body (model)
413
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_gate_request)
414
+
415
+ # return_type
416
+ return_type = opts[:debug_return_type] || 'UpdateGateResponse'
417
+
418
+ # auth_names
419
+ auth_names = opts[:debug_auth_names] || ['bearerSdkKey']
420
+
421
+ new_options = opts.merge(
422
+ :operation => :"GatesApi.update_gate",
423
+ :header_params => header_params,
424
+ :query_params => query_params,
425
+ :form_params => form_params,
426
+ :body => post_body,
427
+ :auth_names => auth_names,
428
+ :return_type => return_type
429
+ )
430
+
431
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
432
+ if @api_client.config.debugging
433
+ @api_client.config.logger.debug "API called: GatesApi#update_gate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
434
+ end
435
+ return data, status_code, headers
436
+ end
437
+ end
438
+ end