Class: Shipeasy::Admin::Generated::FlagsApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ FlagsApi

Returns a new instance of FlagsApi.



19
20
21
# File 'lib/shipeasy_admin/api/flags_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/flags_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#add_to_gate_whitelist(id, add_to_gate_whitelist_request, opts = {}) ⇒ GateWhitelist

Add entries to a gate's whitelist Adds identities to the gate's whitelist, creating the block if the gate doesn't have one yet. Entries already on the list are skipped, so the call is idempotent and safe to retry. Adding to a gate that already has a whitelist keyed on the other attribute is rejected (409) rather than silently re-keying the entries already there — use PUT to switch attr deliberately. Use case: Let one more customer into a private beta without reading the current list first.

Parameters:

  • id (String)

    Stable opaque gate id (`gate_…`) or the gate's `name`.

  • add_to_gate_whitelist_request (AddToGateWhitelistRequest)
  • 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:



29
30
31
32
# File 'lib/shipeasy_admin/api/flags_api.rb', line 29

def add_to_gate_whitelist(id, add_to_gate_whitelist_request, opts = {})
  data, _status_code, _headers = add_to_gate_whitelist_with_http_info(id, add_to_gate_whitelist_request, opts)
  data
end

#add_to_gate_whitelist_with_http_info(id, add_to_gate_whitelist_request, opts = {}) ⇒ Array<(GateWhitelist, Integer, Hash)>

Add entries to a gate's whitelist Adds identities to the gate's whitelist, creating the block if the gate doesn't have one yet. Entries already on the list are skipped, so the call is idempotent and safe to retry. Adding to a gate that already has a whitelist keyed on the other attribute is rejected (409) rather than silently re-keying the entries already there — use `PUT` to switch `attr` deliberately. Use case: Let one more customer into a private beta without reading the current list first.

Parameters:

  • id (String)

    Stable opaque gate id (`gate_…`) or the gate's `name`.

  • add_to_gate_whitelist_request (AddToGateWhitelistRequest)
  • 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<(GateWhitelist, Integer, Hash)>)

    GateWhitelist data, response status code and response headers



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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/shipeasy_admin/api/flags_api.rb', line 41

def add_to_gate_whitelist_with_http_info(id, add_to_gate_whitelist_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlagsApi.add_to_gate_whitelist ...'
  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 FlagsApi.add_to_gate_whitelist"
  end
  if @api_client.config.client_side_validation && id.to_s.length > 128
    fail ArgumentError, 'invalid value for "id" when calling FlagsApi.add_to_gate_whitelist, the character length must be smaller than or equal to 128.'
  end

  if @api_client.config.client_side_validation && id.to_s.length < 1
    fail ArgumentError, 'invalid value for "id" when calling FlagsApi.add_to_gate_whitelist, the character length must be greater than or equal to 1.'
  end

  # verify the required parameter 'add_to_gate_whitelist_request' is set
  if @api_client.config.client_side_validation && add_to_gate_whitelist_request.nil?
    fail ArgumentError, "Missing the required parameter 'add_to_gate_whitelist_request' when calling FlagsApi.add_to_gate_whitelist"
  end
  # resource path
  local_var_path = '/api/admin/gates/{id}/whitelist'.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(add_to_gate_whitelist_request)

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

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

  new_options = opts.merge(
    :operation => :"FlagsApi.add_to_gate_whitelist",
    :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: FlagsApi#add_to_gate_whitelist\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_gate_whitelist(id, opts = {}) ⇒ GateWhitelist

Read a gate's whitelist Returns the gate's whitelist — the always-first allowlist that admits the listed identities before any targeting rule or percentage rollout is evaluated. A gate with no whitelist returns entries: [] (and the default attr), never a 404 — so a caller can read-then-write without special-casing the empty gate. Use case: Check whether an account is already let through before adding it.

Parameters:

  • id (String)

    Stable opaque gate id (`gate_…`) or the gate'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:



113
114
115
116
# File 'lib/shipeasy_admin/api/flags_api.rb', line 113

def get_gate_whitelist(id, opts = {})
  data, _status_code, _headers = get_gate_whitelist_with_http_info(id, opts)
  data
end

#get_gate_whitelist_with_http_info(id, opts = {}) ⇒ Array<(GateWhitelist, Integer, Hash)>

Read a gate's whitelist Returns the gate's whitelist — the always-first allowlist that admits the listed identities before any targeting rule or percentage rollout is evaluated. A gate with no whitelist returns `entries: []` (and the default `attr`), never a 404 — so a caller can read-then-write without special-casing the empty gate. Use case: Check whether an account is already let through before adding it.

Parameters:

  • id (String)

    Stable opaque gate id (`gate_…`) or the gate'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<(GateWhitelist, Integer, Hash)>)

    GateWhitelist data, response status code and response headers



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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/shipeasy_admin/api/flags_api.rb', line 124

def get_gate_whitelist_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlagsApi.get_gate_whitelist ...'
  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 FlagsApi.get_gate_whitelist"
  end
  if @api_client.config.client_side_validation && id.to_s.length > 128
    fail ArgumentError, 'invalid value for "id" when calling FlagsApi.get_gate_whitelist, the character length must be smaller than or equal to 128.'
  end

  if @api_client.config.client_side_validation && id.to_s.length < 1
    fail ArgumentError, 'invalid value for "id" when calling FlagsApi.get_gate_whitelist, the character length must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/api/admin/gates/{id}/whitelist'.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] || 'GateWhitelist'

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

  new_options = opts.merge(
    :operation => :"FlagsApi.get_gate_whitelist",
    :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: FlagsApi#get_gate_whitelist\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#remove_from_gate_whitelist(id, remove_from_gate_whitelist_request, opts = {}) ⇒ GateWhitelist

Remove entries from a gate's whitelist Removes identities from the gate's whitelist. Entries that aren't on the list are skipped, so the call is idempotent. Removing the last entry leaves an empty whitelist block in place; to drop the block itself use PUT with entries: []. Use case: Revoke one beta tester's access without touching anyone else's.

Parameters:

  • id (String)

    Stable opaque gate id (`gate_…`) or the gate's `name`.

  • remove_from_gate_whitelist_request (RemoveFromGateWhitelistRequest)
  • 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:



188
189
190
191
# File 'lib/shipeasy_admin/api/flags_api.rb', line 188

def remove_from_gate_whitelist(id, remove_from_gate_whitelist_request, opts = {})
  data, _status_code, _headers = remove_from_gate_whitelist_with_http_info(id, remove_from_gate_whitelist_request, opts)
  data
end

#remove_from_gate_whitelist_with_http_info(id, remove_from_gate_whitelist_request, opts = {}) ⇒ Array<(GateWhitelist, Integer, Hash)>

Remove entries from a gate's whitelist Removes identities from the gate's whitelist. Entries that aren't on the list are skipped, so the call is idempotent. Removing the last entry leaves an empty whitelist block in place; to drop the block itself use `PUT` with `entries: []`. Use case: Revoke one beta tester's access without touching anyone else's.

Parameters:

  • id (String)

    Stable opaque gate id (`gate_…`) or the gate's `name`.

  • remove_from_gate_whitelist_request (RemoveFromGateWhitelistRequest)
  • 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<(GateWhitelist, Integer, Hash)>)

    GateWhitelist data, response status code and response headers



200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
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
# File 'lib/shipeasy_admin/api/flags_api.rb', line 200

def remove_from_gate_whitelist_with_http_info(id, remove_from_gate_whitelist_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlagsApi.remove_from_gate_whitelist ...'
  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 FlagsApi.remove_from_gate_whitelist"
  end
  if @api_client.config.client_side_validation && id.to_s.length > 128
    fail ArgumentError, 'invalid value for "id" when calling FlagsApi.remove_from_gate_whitelist, the character length must be smaller than or equal to 128.'
  end

  if @api_client.config.client_side_validation && id.to_s.length < 1
    fail ArgumentError, 'invalid value for "id" when calling FlagsApi.remove_from_gate_whitelist, the character length must be greater than or equal to 1.'
  end

  # verify the required parameter 'remove_from_gate_whitelist_request' is set
  if @api_client.config.client_side_validation && remove_from_gate_whitelist_request.nil?
    fail ArgumentError, "Missing the required parameter 'remove_from_gate_whitelist_request' when calling FlagsApi.remove_from_gate_whitelist"
  end
  # resource path
  local_var_path = '/api/admin/gates/{id}/whitelist'.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(remove_from_gate_whitelist_request)

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

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

  new_options = opts.merge(
    :operation => :"FlagsApi.remove_from_gate_whitelist",
    :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: FlagsApi#remove_from_gate_whitelist\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#set_gate_whitelist(id, set_gate_whitelist_request, opts = {}) ⇒ GateWhitelist

Replace a gate's whitelist Replaces the gate's whole whitelist with entries, creating the block if the gate didn't have one. Idempotent — the same call twice leaves the same list. This is the only whitelist call that can switch attr (emailuser_id) or clear the block: entries: [] removes the whitelist from the gate entirely. Use cases - Pin an exact list{ \"entries\": [\"alice@acme.dev\", \"bob@acme.dev\"] }. - Switch to user ids{ \"attr\": \"user_id\", \"entries\": [\"usr_123\"] }. - Drop the whitelist{ \"entries\": [] }.

Parameters:

  • id (String)

    Stable opaque gate id (`gate_…`) or the gate's `name`.

  • set_gate_whitelist_request (SetGateWhitelistRequest)
  • 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:



273
274
275
276
# File 'lib/shipeasy_admin/api/flags_api.rb', line 273

def set_gate_whitelist(id, set_gate_whitelist_request, opts = {})
  data, _status_code, _headers = set_gate_whitelist_with_http_info(id, set_gate_whitelist_request, opts)
  data
end

#set_gate_whitelist_with_http_info(id, set_gate_whitelist_request, opts = {}) ⇒ Array<(GateWhitelist, Integer, Hash)>

Replace a gate's whitelist Replaces the gate's whole whitelist with `entries`, creating the block if the gate didn't have one. Idempotent — the same call twice leaves the same list. This is the only whitelist call that can switch `attr` (`email` ⇄ `user_id`) or clear the block: `entries: []` removes the whitelist from the gate entirely. Use cases - Pin an exact list — `{ &quot;entries&quot;: [&quot;alice@acme.dev&quot;, &quot;bob@acme.dev&quot;] }`. - Switch to user ids — `{ &quot;attr&quot;: &quot;user_id&quot;, &quot;entries&quot;: [&quot;usr_123&quot;] }`. - Drop the whitelist — `{ &quot;entries&quot;: [] }`.

Parameters:

  • id (String)

    Stable opaque gate id (`gate_…`) or the gate's `name`.

  • set_gate_whitelist_request (SetGateWhitelistRequest)
  • 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<(GateWhitelist, Integer, Hash)>)

    GateWhitelist data, response status code and response headers



285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
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
# File 'lib/shipeasy_admin/api/flags_api.rb', line 285

def set_gate_whitelist_with_http_info(id, set_gate_whitelist_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FlagsApi.set_gate_whitelist ...'
  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 FlagsApi.set_gate_whitelist"
  end
  if @api_client.config.client_side_validation && id.to_s.length > 128
    fail ArgumentError, 'invalid value for "id" when calling FlagsApi.set_gate_whitelist, the character length must be smaller than or equal to 128.'
  end

  if @api_client.config.client_side_validation && id.to_s.length < 1
    fail ArgumentError, 'invalid value for "id" when calling FlagsApi.set_gate_whitelist, the character length must be greater than or equal to 1.'
  end

  # verify the required parameter 'set_gate_whitelist_request' is set
  if @api_client.config.client_side_validation && set_gate_whitelist_request.nil?
    fail ArgumentError, "Missing the required parameter 'set_gate_whitelist_request' when calling FlagsApi.set_gate_whitelist"
  end
  # resource path
  local_var_path = '/api/admin/gates/{id}/whitelist'.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_gate_whitelist_request)

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

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

  new_options = opts.merge(
    :operation => :"FlagsApi.set_gate_whitelist",
    :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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FlagsApi#set_gate_whitelist\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end