Class: Shipeasy::Admin::Generated::ExperimentsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/shipeasy_admin/api/experiments_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ExperimentsApi

Returns a new instance of ExperimentsApi.



19
20
21
# File 'lib/shipeasy_admin/api/experiments_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/shipeasy_admin/api/experiments_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_experiment(create_experiment_request, opts = {}) ⇒ CreateExperimentResponse

Create an experiment Creates a new experiment in draft status. name, universe, and groups are required; everything else has sensible defaults. Returns 409 if name already exists, 422 if the named universe doesn't exist, 403 if a plan-gated option is set (sequential_testing, custom significance_threshold) on a plan that doesn't include it. Use cases - Minimal 50/50name + universe + two equal-weight groups. - Targeted rollout — supply targeting_gate to restrict the eligible audience and allocation_pct to enrol a slice of it. - Multivariant — three or more groups with weights summing to 10000. - Sequential testingsequential_testing: true for Premium plans.

Parameters:

Options Hash (opts):

  • :x_project_id (String)

    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).

Returns:



28
29
30
31
# File 'lib/shipeasy_admin/api/experiments_api.rb', line 28

def create_experiment(create_experiment_request, opts = {})
  data, _status_code, _headers = create_experiment_with_http_info(create_experiment_request, opts)
  data
end

#create_experiment_with_http_info(create_experiment_request, opts = {}) ⇒ Array<(CreateExperimentResponse, Integer, Hash)>

Create an experiment Creates a new experiment in `draft` status. `name`, `universe`, and `groups` are required; everything else has sensible defaults. Returns `409` if `name` already exists, `422` if the named universe doesn't exist, `403` if a plan-gated option is set (`sequential_testing`, custom `significance_threshold`) on a plan that doesn't include it. Use cases - Minimal 50/50 — `name` + `universe` + two equal-weight groups. - Targeted rollout — supply `targeting_gate` to restrict the eligible audience and `allocation_pct` to enrol a slice of it. - Multivariant — three or more groups with weights summing to 10000. - Sequential testing — `sequential_testing: true` for Premium plans.

Parameters:

Options Hash (opts):

  • :x_project_id (String)

    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).

Returns:

  • (Array<(CreateExperimentResponse, Integer, Hash)>)

    CreateExperimentResponse data, response status code and response headers



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/shipeasy_admin/api/experiments_api.rb', line 39

def create_experiment_with_http_info(create_experiment_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsApi.create_experiment ...'
  end
  # verify the required parameter 'create_experiment_request' is set
  if @api_client.config.client_side_validation && create_experiment_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_experiment_request' when calling ExperimentsApi.create_experiment"
  end
  # resource path
  local_var_path = '/api/admin/experiments'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_experiment_request)

  # return_type
  return_type = opts[:debug_return_type] || 'CreateExperimentResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerSdkKey']

  new_options = opts.merge(
    :operation => :"ExperimentsApi.create_experiment",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsApi#create_experiment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_experiment(id, opts = {}) ⇒ DeleteExperimentResponse

Delete an experiment Archives the experiment (soft-delete via status transition). Returns 409 if the experiment is still running — stop it first. Use case: Tear down an experiment after the analysis is signed off.

Parameters:

  • id (String)

    Stable opaque experiment id (`exp_…`) or the experiment's `name`.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    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).

Returns:



99
100
101
102
# File 'lib/shipeasy_admin/api/experiments_api.rb', line 99

def delete_experiment(id, opts = {})
  data, _status_code, _headers = delete_experiment_with_http_info(id, opts)
  data
end

#delete_experiment_with_http_info(id, opts = {}) ⇒ Array<(DeleteExperimentResponse, Integer, Hash)>

Delete an experiment Archives the experiment (soft-delete via status transition). Returns `409` if the experiment is still `running` — stop it first. Use case: Tear down an experiment after the analysis is signed off.

Parameters:

  • id (String)

    Stable opaque experiment id (`exp_…`) or the experiment's `name`.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    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).

Returns:

  • (Array<(DeleteExperimentResponse, Integer, Hash)>)

    DeleteExperimentResponse data, response status code and response headers



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/shipeasy_admin/api/experiments_api.rb', line 110

def delete_experiment_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsApi.delete_experiment ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ExperimentsApi.delete_experiment"
  end
  # resource path
  local_var_path = '/api/admin/experiments/{id}'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DeleteExperimentResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerSdkKey']

  new_options = opts.merge(
    :operation => :"ExperimentsApi.delete_experiment",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsApi#delete_experiment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_experiment(id, opts = {}) ⇒ GetExperimentResponse

Get one experiment Returns the full experiment row including groups, params, allocation, and lifecycle timestamps. Use case: Fetch one experiment to render the detail page or to inspect its current allocation and group weights.

Parameters:

  • id (String)

    Stable opaque experiment id (`exp_…`) or the experiment's `name`.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    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).

Returns:



165
166
167
168
# File 'lib/shipeasy_admin/api/experiments_api.rb', line 165

def get_experiment(id, opts = {})
  data, _status_code, _headers = get_experiment_with_http_info(id, opts)
  data
end

#get_experiment_results(id, opts = {}) ⇒ GetExperimentResultsResponse

Get analysis results Returns the latest analysis output for the experiment — one row per metric/group/day, including sample size, mean, % delta vs. control, p-value, and a sample-ratio mismatch flag. Use case: Render the results table on the experiment detail page or drive an automated decision once a goal metric reaches significance.

Parameters:

  • id (String)

    Stable opaque experiment id (`exp_…`) or the experiment's `name`.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    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).

Returns:



227
228
229
230
# File 'lib/shipeasy_admin/api/experiments_api.rb', line 227

def get_experiment_results(id, opts = {})
  data, _status_code, _headers = get_experiment_results_with_http_info(id, opts)
  data
end

#get_experiment_results_with_http_info(id, opts = {}) ⇒ Array<(GetExperimentResultsResponse, Integer, Hash)>

Get analysis results Returns the latest analysis output for the experiment — one row per metric/group/day, including sample size, mean, % delta vs. control, p-value, and a sample-ratio mismatch flag. Use case: Render the results table on the experiment detail page or drive an automated decision once a `goal` metric reaches significance.

Parameters:

  • id (String)

    Stable opaque experiment id (`exp_…`) or the experiment's `name`.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    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).

Returns:



238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/shipeasy_admin/api/experiments_api.rb', line 238

def get_experiment_results_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsApi.get_experiment_results ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ExperimentsApi.get_experiment_results"
  end
  # resource path
  local_var_path = '/api/admin/experiments/{id}/results'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetExperimentResultsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerSdkKey']

  new_options = opts.merge(
    :operation => :"ExperimentsApi.get_experiment_results",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsApi#get_experiment_results\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_experiment_timeseries(id, opts = {}) ⇒ GetExperimentTimeseriesResponse

Get analysis timeseries Same row shape as /results, but returns every daily slice rather than the latest. Filter to a single metric with the metric query parameter. Use case: Drive a chart of metric movement over the experiment runtime, or sanity-check the lift is monotonic before deciding.

Parameters:

  • id (String)

    Stable opaque experiment id (`exp_…`) or the experiment's `name`.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    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).

  • :metric (String)

    Optional metric name to filter the series.

Returns:



294
295
296
297
# File 'lib/shipeasy_admin/api/experiments_api.rb', line 294

def get_experiment_timeseries(id, opts = {})
  data, _status_code, _headers = get_experiment_timeseries_with_http_info(id, opts)
  data
end

#get_experiment_timeseries_with_http_info(id, opts = {}) ⇒ Array<(GetExperimentTimeseriesResponse, Integer, Hash)>

Get analysis timeseries Same row shape as `/results`, but returns every daily slice rather than the latest. Filter to a single metric with the `metric` query parameter. Use case: Drive a chart of metric movement over the experiment runtime, or sanity-check the lift is monotonic before deciding.

Parameters:

  • id (String)

    Stable opaque experiment id (`exp_…`) or the experiment's `name`.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    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).

  • :metric (String)

    Optional metric name to filter the series.

Returns:



306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
# File 'lib/shipeasy_admin/api/experiments_api.rb', line 306

def get_experiment_timeseries_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsApi.get_experiment_timeseries ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ExperimentsApi.get_experiment_timeseries"
  end
  # resource path
  local_var_path = '/api/admin/experiments/{id}/timeseries'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'metric'] = opts[:'metric'] if !opts[:'metric'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetExperimentTimeseriesResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerSdkKey']

  new_options = opts.merge(
    :operation => :"ExperimentsApi.get_experiment_timeseries",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsApi#get_experiment_timeseries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_experiment_with_http_info(id, opts = {}) ⇒ Array<(GetExperimentResponse, Integer, Hash)>

Get one experiment Returns the full experiment row including groups, params, allocation, and lifecycle timestamps. Use case: Fetch one experiment to render the detail page or to inspect its current allocation and group weights.

Parameters:

  • id (String)

    Stable opaque experiment id (`exp_…`) or the experiment's `name`.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    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).

Returns:

  • (Array<(GetExperimentResponse, Integer, Hash)>)

    GetExperimentResponse data, response status code and response headers



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/shipeasy_admin/api/experiments_api.rb', line 176

def get_experiment_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsApi.get_experiment ...'
  end
  # resource path
  local_var_path = '/api/admin/experiments/{id}'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetExperimentResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerSdkKey']

  new_options = opts.merge(
    :operation => :"ExperimentsApi.get_experiment",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsApi#get_experiment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_experiments(opts = {}) ⇒ ListExperimentsResponse

List experiments Returns a single page of non-archived experiments ordered by updated_at desc, id desc. Use the cursor query parameter to paginate. Use case: Snapshot every active experiment in the project — e.g. render an overview dashboard or drive a CI check that no experiment has been running past its min_runtime_days.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    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).

  • :limit (Integer)

    Page size (1–500). Defaults to 100. (default to 100)

  • :cursor (String)

    Opaque cursor returned in the previous page's `next_cursor`. Omit for the first page.

Returns:



363
364
365
366
# File 'lib/shipeasy_admin/api/experiments_api.rb', line 363

def list_experiments(opts = {})
  data, _status_code, _headers = list_experiments_with_http_info(opts)
  data
end

#list_experiments_with_http_info(opts = {}) ⇒ Array<(ListExperimentsResponse, Integer, Hash)>

List experiments Returns a single page of non-archived experiments ordered by `updated_at desc, id desc`. Use the `cursor` query parameter to paginate. Use case: Snapshot every active experiment in the project — e.g. render an overview dashboard or drive a CI check that no experiment has been running past its `min_runtime_days`.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    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).

  • :limit (Integer)

    Page size (1–500). Defaults to 100. (default to 100)

  • :cursor (String)

    Opaque cursor returned in the previous page's `next_cursor`. Omit for the first page.

Returns:

  • (Array<(ListExperimentsResponse, Integer, Hash)>)

    ListExperimentsResponse data, response status code and response headers



375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
# File 'lib/shipeasy_admin/api/experiments_api.rb', line 375

def list_experiments_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsApi.list_experiments ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 500
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ExperimentsApi.list_experiments, must be smaller than or equal to 500.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ExperimentsApi.list_experiments, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/api/admin/experiments'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListExperimentsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerSdkKey']

  new_options = opts.merge(
    :operation => :"ExperimentsApi.list_experiments",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsApi#list_experiments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#reanalyze_experiment(id, opts = {}) ⇒ ReanalyzeExperimentResponse

Re-queue analysis Requeues the daily analysis pass for this experiment outside the normal cron cadence. Useful after attaching a new metric or correcting an event taxonomy. The job runs asynchronously. Use case: Force-refresh results after wiring up a new metric without waiting for the next nightly cron tick.

Parameters:

  • id (String)

    Stable opaque experiment id (`exp_…`) or the experiment's `name`.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    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).

Returns:



436
437
438
439
# File 'lib/shipeasy_admin/api/experiments_api.rb', line 436

def reanalyze_experiment(id, opts = {})
  data, _status_code, _headers = reanalyze_experiment_with_http_info(id, opts)
  data
end

#reanalyze_experiment_with_http_info(id, opts = {}) ⇒ Array<(ReanalyzeExperimentResponse, Integer, Hash)>

Re-queue analysis Requeues the daily analysis pass for this experiment outside the normal cron cadence. Useful after attaching a new metric or correcting an event taxonomy. The job runs asynchronously. Use case: Force-refresh results after wiring up a new metric without waiting for the next nightly cron tick.

Parameters:

  • id (String)

    Stable opaque experiment id (`exp_…`) or the experiment's `name`.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    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).

Returns:

  • (Array<(ReanalyzeExperimentResponse, Integer, Hash)>)

    ReanalyzeExperimentResponse data, response status code and response headers



447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
# File 'lib/shipeasy_admin/api/experiments_api.rb', line 447

def reanalyze_experiment_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsApi.reanalyze_experiment ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ExperimentsApi.reanalyze_experiment"
  end
  # resource path
  local_var_path = '/api/admin/experiments/{id}/reanalyze'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ReanalyzeExperimentResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerSdkKey']

  new_options = opts.merge(
    :operation => :"ExperimentsApi.reanalyze_experiment",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsApi#reanalyze_experiment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#set_experiment_metrics(id, set_experiment_metrics_request, opts = {}) ⇒ SetExperimentMetricsResponse

Attach metrics Replaces the experiment's metric attachments wholesale. Each entry pairs an existing metric_id with a role (goal / guardrail / secondary). Returns 422 if any metric_id doesn't exist in the project. Pass { metrics: [] } to detach everything. Use cases - Standard setup — one goal, one or two guardrail, optional secondary metrics for diagnostics. - Detach all — send { \"metrics\": [] } before archiving.

Parameters:

  • id (String)

    Stable opaque experiment id (`exp_…`) or the experiment's `name`.

  • set_experiment_metrics_request (SetExperimentMetricsRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    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).

Returns:



503
504
505
506
# File 'lib/shipeasy_admin/api/experiments_api.rb', line 503

def set_experiment_metrics(id, set_experiment_metrics_request, opts = {})
  data, _status_code, _headers = set_experiment_metrics_with_http_info(id, set_experiment_metrics_request, opts)
  data
end

#set_experiment_metrics_with_http_info(id, set_experiment_metrics_request, opts = {}) ⇒ Array<(SetExperimentMetricsResponse, Integer, Hash)>

Attach metrics Replaces the experiment's metric attachments wholesale. Each entry pairs an existing `metric_id` with a `role` (`goal` / `guardrail` / `secondary`). Returns `422` if any `metric_id` doesn't exist in the project. Pass `{ metrics: [] }` to detach everything. Use cases - Standard setup — one `goal`, one or two `guardrail`, optional `secondary` metrics for diagnostics. - Detach all — send `{ &quot;metrics&quot;: [] }` before archiving.

Parameters:

  • id (String)

    Stable opaque experiment id (`exp_…`) or the experiment's `name`.

  • set_experiment_metrics_request (SetExperimentMetricsRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    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).

Returns:



515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
# File 'lib/shipeasy_admin/api/experiments_api.rb', line 515

def set_experiment_metrics_with_http_info(id, set_experiment_metrics_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsApi.set_experiment_metrics ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ExperimentsApi.set_experiment_metrics"
  end
  # verify the required parameter 'set_experiment_metrics_request' is set
  if @api_client.config.client_side_validation && set_experiment_metrics_request.nil?
    fail ArgumentError, "Missing the required parameter 'set_experiment_metrics_request' when calling ExperimentsApi.set_experiment_metrics"
  end
  # resource path
  local_var_path = '/api/admin/experiments/{id}/metrics'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(set_experiment_metrics_request)

  # return_type
  return_type = opts[:debug_return_type] || 'SetExperimentMetricsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerSdkKey']

  new_options = opts.merge(
    :operation => :"ExperimentsApi.set_experiment_metrics",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsApi#set_experiment_metrics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#set_experiment_status(id, set_experiment_status_request, opts = {}) ⇒ SetExperimentStatusResponse

Transition experiment status Drives the experiment lifecycle. Allowed transitions: - draft → running — starts allocation. Bumps the startedAt timestamp. - running → stopped — halts allocation. Existing exposures stay in the dataset. - stopped → archived — soft-delete. - draft → archived — discard an unstarted experiment. - archived → draft — restore a soft-deleted experiment so it can be re-completed and started. Allowed only if it never started; one that already ran must be cloned instead. Restarting an archived experiment directly is not allowed — restore it to draft first. Returns 409 on illegal transitions and 429 if the plan's experiments_running limit is exceeded on → running. Use cases - Start{ \"status\": \"running\" } after wiring up the SDK and verifying targeting on staging. - Stop{ \"status\": \"stopped\" } once the experiment hits its min_runtime_days and conclusive results land. - Archive{ \"status\": \"archived\" } to soft-delete after sign-off.

Parameters:

  • id (String)

    Stable opaque experiment id (`exp_…`) or the experiment's `name`.

  • set_experiment_status_request (SetExperimentStatusRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    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).

Returns:



580
581
582
583
# File 'lib/shipeasy_admin/api/experiments_api.rb', line 580

def set_experiment_status(id, set_experiment_status_request, opts = {})
  data, _status_code, _headers = set_experiment_status_with_http_info(id, set_experiment_status_request, opts)
  data
end

#set_experiment_status_with_http_info(id, set_experiment_status_request, opts = {}) ⇒ Array<(SetExperimentStatusResponse, Integer, Hash)>

Transition experiment status Drives the experiment lifecycle. Allowed transitions: - `draft → running` — starts allocation. Bumps the `startedAt` timestamp. - `running → stopped` — halts allocation. Existing exposures stay in the dataset. - `stopped → archived` — soft-delete. - `draft → archived` — discard an unstarted experiment. - `archived → draft` — restore a soft-deleted experiment so it can be re-completed and started. Allowed only if it never started; one that already ran must be cloned instead. Restarting an `archived` experiment directly is not allowed — restore it to `draft` first. Returns `409` on illegal transitions and `429` if the plan's `experiments_running` limit is exceeded on `→ running`. Use cases - Start — `{ &quot;status&quot;: &quot;running&quot; }` after wiring up the SDK and verifying targeting on staging. - Stop — `{ &quot;status&quot;: &quot;stopped&quot; }` once the experiment hits its `min_runtime_days` and conclusive results land. - Archive — `{ &quot;status&quot;: &quot;archived&quot; }` to soft-delete after sign-off.

Parameters:

  • id (String)

    Stable opaque experiment id (`exp_…`) or the experiment's `name`.

  • set_experiment_status_request (SetExperimentStatusRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    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).

Returns:

  • (Array<(SetExperimentStatusResponse, Integer, Hash)>)

    SetExperimentStatusResponse data, response status code and response headers



592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
# File 'lib/shipeasy_admin/api/experiments_api.rb', line 592

def set_experiment_status_with_http_info(id, set_experiment_status_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsApi.set_experiment_status ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ExperimentsApi.set_experiment_status"
  end
  # verify the required parameter 'set_experiment_status_request' is set
  if @api_client.config.client_side_validation && set_experiment_status_request.nil?
    fail ArgumentError, "Missing the required parameter 'set_experiment_status_request' when calling ExperimentsApi.set_experiment_status"
  end
  # resource path
  local_var_path = '/api/admin/experiments/{id}/status'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(set_experiment_status_request)

  # return_type
  return_type = opts[:debug_return_type] || 'SetExperimentStatusResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerSdkKey']

  new_options = opts.merge(
    :operation => :"ExperimentsApi.set_experiment_status",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsApi#set_experiment_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_experiment(id, update_experiment_request, opts = {}) ⇒ UpdateExperimentResponse

Update an experiment Partial update. allocation_pct, groups, salt, universe, params are immutable while running — returns 409 if you try. Stop the experiment first. Editing groups while in draft is fine; weights must still sum to 10000. Use cases - Update metadatadescription, tag, targeting_gate editable any time. - Ramp before launch — set allocation_pct while still in draft. - Tighten significancesignificance_threshold (Pro+). - Rewire groups — replace groups wholesale while in draft; immutable once running.

Parameters:

  • id (String)

    Stable opaque experiment id (`exp_…`) or the experiment's `name`.

  • update_experiment_request (UpdateExperimentRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    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).

Returns:



657
658
659
660
# File 'lib/shipeasy_admin/api/experiments_api.rb', line 657

def update_experiment(id, update_experiment_request, opts = {})
  data, _status_code, _headers = update_experiment_with_http_info(id, update_experiment_request, opts)
  data
end

#update_experiment_with_http_info(id, update_experiment_request, opts = {}) ⇒ Array<(UpdateExperimentResponse, Integer, Hash)>

Update an experiment Partial update. `allocation_pct`, `groups`, `salt`, `universe`, `params` are immutable while running — returns `409` if you try. Stop the experiment first. Editing `groups` while in `draft` is fine; weights must still sum to 10000. Use cases - Update metadata — `description`, `tag`, `targeting_gate` editable any time. - Ramp before launch — set `allocation_pct` while still in `draft`. - Tighten significance — `significance_threshold` (Pro+). - Rewire groups — replace `groups` wholesale while in `draft`; immutable once running.

Parameters:

  • id (String)

    Stable opaque experiment id (`exp_…`) or the experiment's `name`.

  • update_experiment_request (UpdateExperimentRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_project_id (String)

    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).

Returns:

  • (Array<(UpdateExperimentResponse, Integer, Hash)>)

    UpdateExperimentResponse data, response status code and response headers



669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
# File 'lib/shipeasy_admin/api/experiments_api.rb', line 669

def update_experiment_with_http_info(id, update_experiment_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ExperimentsApi.update_experiment ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling ExperimentsApi.update_experiment"
  end
  # verify the required parameter 'update_experiment_request' is set
  if @api_client.config.client_side_validation && update_experiment_request.nil?
    fail ArgumentError, "Missing the required parameter 'update_experiment_request' when calling ExperimentsApi.update_experiment"
  end
  # resource path
  local_var_path = '/api/admin/experiments/{id}'.sub('{id}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'X-Project-Id'] = opts[:'x_project_id'] if !opts[:'x_project_id'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(update_experiment_request)

  # return_type
  return_type = opts[:debug_return_type] || 'UpdateExperimentResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerSdkKey']

  new_options = opts.merge(
    :operation => :"ExperimentsApi.update_experiment",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ExperimentsApi#update_experiment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end