ff-ruby-server-sdk 0.0.2 → 1.0.2.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.run/sdk_test.rb.run.xml +3 -3
  3. data/CHANGELOG.md +12 -2
  4. data/Gemfile +17 -3
  5. data/README.md +155 -7
  6. data/api.yaml +736 -0
  7. data/example/example.rb +100 -3
  8. data/lib/ff/ruby/server/generated/lib/openapi_client/api/client_api.rb +545 -0
  9. data/lib/ff/ruby/server/generated/lib/openapi_client/api/metrics_api.rb +89 -0
  10. data/lib/ff/ruby/server/generated/lib/openapi_client/api_client.rb +390 -0
  11. data/lib/ff/ruby/server/generated/lib/openapi_client/api_error.rb +57 -0
  12. data/lib/ff/ruby/server/generated/lib/openapi_client/configuration.rb +282 -0
  13. data/lib/ff/ruby/server/generated/lib/openapi_client/models/authentication_request.rb +232 -0
  14. data/lib/ff/ruby/server/generated/lib/openapi_client/models/authentication_request_target.rb +250 -0
  15. data/lib/ff/ruby/server/generated/lib/openapi_client/models/authentication_response.rb +223 -0
  16. data/lib/ff/ruby/server/generated/lib/openapi_client/models/clause.rb +281 -0
  17. data/lib/ff/ruby/server/generated/lib/openapi_client/models/distribution.rb +239 -0
  18. data/lib/ff/ruby/server/generated/lib/openapi_client/models/error.rb +237 -0
  19. data/lib/ff/ruby/server/generated/lib/openapi_client/models/evaluation.rb +260 -0
  20. data/lib/ff/ruby/server/generated/lib/openapi_client/models/feature_config.rb +418 -0
  21. data/lib/ff/ruby/server/generated/lib/openapi_client/models/feature_state.rb +37 -0
  22. data/lib/ff/ruby/server/generated/lib/openapi_client/models/key_value.rb +237 -0
  23. data/lib/ff/ruby/server/generated/lib/openapi_client/models/metrics.rb +231 -0
  24. data/lib/ff/ruby/server/generated/lib/openapi_client/models/metrics_data.rb +303 -0
  25. data/lib/ff/ruby/server/generated/lib/openapi_client/models/pagination.rb +274 -0
  26. data/lib/ff/ruby/server/generated/lib/openapi_client/models/prerequisite.rb +239 -0
  27. data/lib/ff/ruby/server/generated/lib/openapi_client/models/segment.rb +320 -0
  28. data/lib/ff/ruby/server/generated/lib/openapi_client/models/serve.rb +227 -0
  29. data/lib/ff/ruby/server/generated/lib/openapi_client/models/serving_rule.rb +267 -0
  30. data/lib/ff/ruby/server/generated/lib/openapi_client/models/tag.rb +233 -0
  31. data/lib/ff/ruby/server/generated/lib/openapi_client/models/target.rb +331 -0
  32. data/lib/ff/ruby/server/generated/lib/openapi_client/models/target_data.rb +253 -0
  33. data/lib/ff/ruby/server/generated/lib/openapi_client/models/target_map.rb +232 -0
  34. data/lib/ff/ruby/server/generated/lib/openapi_client/models/variation.rb +255 -0
  35. data/lib/ff/ruby/server/generated/lib/openapi_client/models/variation_map.rb +245 -0
  36. data/lib/ff/ruby/server/generated/lib/openapi_client/models/weighted_variation.rb +237 -0
  37. data/lib/ff/ruby/server/generated/lib/openapi_client/version.rb +15 -0
  38. data/lib/ff/ruby/server/generated/lib/openapi_client.rb +65 -0
  39. data/lib/ff/ruby/server/sdk/api/auth_service.rb +91 -0
  40. data/lib/ff/ruby/server/sdk/api/cf_client.rb +93 -0
  41. data/lib/ff/ruby/server/sdk/api/client_callback.rb +45 -0
  42. data/lib/ff/ruby/server/sdk/api/config.rb +140 -0
  43. data/lib/ff/ruby/server/sdk/api/config_builder.rb +116 -0
  44. data/lib/ff/ruby/server/sdk/api/default_cache.rb +112 -0
  45. data/lib/ff/ruby/server/sdk/api/evaluation.rb +29 -0
  46. data/lib/ff/ruby/server/sdk/api/evaluator.rb +526 -0
  47. data/lib/ff/ruby/server/sdk/api/file_map_store.rb +60 -0
  48. data/lib/ff/ruby/server/sdk/api/flag_evaluate_callback.rb +13 -0
  49. data/lib/ff/ruby/server/sdk/api/inner_client.rb +311 -0
  50. data/lib/ff/ruby/server/sdk/api/inner_client_flag_evaluate_callback.rb +30 -0
  51. data/lib/ff/ruby/server/sdk/api/inner_client_metrics_callback.rb +33 -0
  52. data/lib/ff/ruby/server/sdk/api/inner_client_repository_callback.rb +44 -0
  53. data/lib/ff/ruby/server/sdk/api/inner_client_updater.rb +63 -0
  54. data/lib/ff/ruby/server/sdk/api/metrics_callback.rb +19 -0
  55. data/lib/ff/ruby/server/sdk/api/metrics_event.rb +16 -0
  56. data/lib/ff/ruby/server/sdk/api/metrics_processor.rb +297 -0
  57. data/lib/ff/ruby/server/sdk/api/operators.rb +20 -0
  58. data/lib/ff/ruby/server/sdk/api/polling_processor.rb +164 -0
  59. data/lib/ff/ruby/server/sdk/api/repository_callback.rb +28 -0
  60. data/lib/ff/ruby/server/sdk/api/storage_repository.rb +263 -0
  61. data/lib/ff/ruby/server/sdk/api/summary_metrics.rb +16 -0
  62. data/lib/ff/ruby/server/sdk/api/update_processor.rb +149 -0
  63. data/lib/ff/ruby/server/sdk/common/cache.rb +27 -0
  64. data/lib/ff/ruby/server/sdk/common/closeable.rb +7 -0
  65. data/lib/ff/ruby/server/sdk/common/destroyable.rb +12 -0
  66. data/lib/ff/ruby/server/sdk/common/repository.rb +45 -0
  67. data/lib/ff/ruby/server/sdk/common/storage.rb +29 -0
  68. data/lib/ff/ruby/server/sdk/connector/connector.rb +44 -0
  69. data/lib/ff/ruby/server/sdk/connector/events.rb +118 -0
  70. data/lib/ff/ruby/server/sdk/connector/harness_connector.rb +236 -0
  71. data/lib/ff/ruby/server/sdk/connector/service.rb +19 -0
  72. data/lib/ff/ruby/server/sdk/connector/updater.rb +32 -0
  73. data/lib/ff/ruby/server/sdk/dto/message.rb +13 -0
  74. data/lib/ff/ruby/server/sdk/dto/target.rb +24 -0
  75. data/lib/ff/ruby/server/sdk/version.rb +2 -1
  76. data/lib/ff/ruby/server/sdk.rb +39 -3
  77. data/openapitools.json +7 -0
  78. data/scripts/install.sh +8 -2
  79. data/scripts/openapi.sh +76 -0
  80. data/scripts/publish.sh +1 -1
  81. data/scripts/sdk_specs.sh +1 -1
  82. metadata +263 -11
  83. data/lib/ff/ruby/server/sdk/cf_client.rb +0 -6
data/example/example.rb CHANGED
@@ -1,4 +1,101 @@
1
- require_relative '../lib/ff/ruby/server/sdk'
1
+ require "logger"
2
+ require "securerandom"
3
+
4
+ require_relative '../lib/ff/ruby/server/sdk/dto/target'
5
+ require_relative '../lib/ff/ruby/server/sdk/api/config'
6
+ require_relative '../lib/ff/ruby/server/sdk/api/cf_client'
7
+ require_relative '../lib/ff/ruby/server/sdk/api/config_builder'
8
+
9
+ flag_b = "flag1"
10
+ flag_n = "flag2"
11
+ flag_s = "flag3"
12
+ flag_j = "flag4"
13
+
14
+ clients = {}
15
+ targets = {}
16
+
17
+ logger = Logger.new(STDOUT)
18
+
19
+ executor = Concurrent::FixedThreadPool.new(100)
20
+
21
+ keys = {
22
+
23
+ # "UAT" => "834b1749-073b-4a97-8424-03893572bab5",
24
+ "Freemium" => "1f3339b4-e004-457a-91f7-9b5ce173eaaf",
25
+ "Non-Freemium" => "a30cf6aa-67f2-4545-8ac7-f86709f4f3a0"
26
+ }
27
+
28
+ keys.each do |name, key|
29
+
30
+ targets[name] = Target.new("ruby_target_" + name)
31
+
32
+ config = ConfigBuilder.new
33
+ .logger(logger)
34
+ .build
35
+ # UAT:
36
+ # .config_url("https://config.feature-flags.uat.harness.io/api/1.0")
37
+ # .event_url("https://event.feature-flags.uat.harness.io/api/1.0")
38
+
39
+ client = CfClient.new(key, config)
40
+
41
+ client.init
42
+
43
+ config.logger.debug "We will wait for the initialization"
44
+
45
+ client.wait_for_initialization
46
+
47
+ config.logger.debug "Initialization is complete"
48
+
49
+ clients[name] = client
50
+ end
51
+
52
+ iterations = 10
53
+
54
+ counted = 0
55
+ count_to = keys.size * iterations
56
+
57
+ logger.debug "To count: " + count_to.to_s
58
+
59
+ keys.each do |name, key|
60
+
61
+ client = clients[name]
62
+ target = targets[name]
63
+
64
+ executor.post do
65
+
66
+ (1..iterations).each do |iteration|
67
+
68
+ logger.debug name + " :: iteration no: " + iteration.to_s
69
+
70
+ bool_result = client.bool_variation(flag_b, target, false)
71
+ number_result = client.number_variation(flag_n, target, -1)
72
+ string_result = client.string_variation(flag_s, target, "unavailable !!!")
73
+ json_result = client.json_variation(flag_j, target, JSON.parse("{}"))
74
+
75
+ logger.debug name + " :: '" + flag_b.to_s + "' has the value of: " + bool_result.to_s
76
+ logger.debug name + " :: '" + flag_n.to_s + "' has the value of: " + number_result.to_s
77
+ logger.debug name + " :: '" + flag_s.to_s + "' has the value of: " + string_result.to_s
78
+ logger.debug name + " :: '" + flag_j.to_s + "' has the value of: " + json_result.to_s
79
+ logger.debug "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
80
+
81
+ counted = counted + 1
82
+
83
+ logger.debug "Counted: " + counted.to_s
84
+
85
+ sleep 10
86
+ end
87
+ end
88
+ end
89
+
90
+ while counted != count_to
91
+
92
+ sleep(1)
93
+ end
94
+
95
+ clients.each do |name, client|
96
+
97
+ logger.debug name + " :: closing"
98
+
99
+ client.close
100
+ end
2
101
 
3
- client = CfClient.new
4
- client.hello
@@ -0,0 +1,545 @@
1
+ =begin
2
+ #Harness feature flag service client apis
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: cf@harness.io
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.1
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module OpenapiClient
16
+ class ClientApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Authenticate with the admin server.
23
+ # Used to retrieve all target segments for certain account id.
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [AuthenticationRequest] :authentication_request
26
+ # @return [AuthenticationResponse]
27
+ def authenticate(opts = {})
28
+ data, _status_code, _headers = authenticate_with_http_info(opts)
29
+ data
30
+ end
31
+
32
+ # Authenticate with the admin server.
33
+ # Used to retrieve all target segments for certain account id.
34
+ # @param [Hash] opts the optional parameters
35
+ # @option opts [AuthenticationRequest] :authentication_request
36
+ # @return [Array<(AuthenticationResponse, Integer, Hash)>] AuthenticationResponse data, response status code and response headers
37
+ def authenticate_with_http_info(opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: ClientApi.authenticate ...'
40
+ end
41
+ # resource path
42
+ local_var_path = '/client/auth'
43
+
44
+ # query parameters
45
+ query_params = opts[:query_params] || {}
46
+
47
+ # header parameters
48
+ header_params = opts[:header_params] || {}
49
+ # HTTP header 'Accept' (if needed)
50
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
51
+ # HTTP header 'Content-Type'
52
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
53
+
54
+ # form parameters
55
+ form_params = opts[:form_params] || {}
56
+
57
+ # http body (model)
58
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'authentication_request'])
59
+
60
+ # return_type
61
+ return_type = opts[:debug_return_type] || 'AuthenticationResponse'
62
+
63
+ # auth_names
64
+ auth_names = opts[:debug_auth_names] || []
65
+
66
+ new_options = opts.merge(
67
+ :operation => :"ClientApi.authenticate",
68
+ :header_params => header_params,
69
+ :query_params => query_params,
70
+ :form_params => form_params,
71
+ :body => post_body,
72
+ :auth_names => auth_names,
73
+ :return_type => return_type
74
+ )
75
+
76
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
77
+ if @api_client.config.debugging
78
+ @api_client.config.logger.debug "API called: ClientApi#authenticate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
79
+ end
80
+ return data, status_code, headers
81
+ end
82
+
83
+ # Retrieve all segments.
84
+ # Used to retrieve all segments for certain account id.
85
+ # @param environment_uuid [String] Unique identifier for the environment object in the API.
86
+ # @param [Hash] opts the optional parameters
87
+ # @return [Array<Segment>]
88
+ def get_all_segments(environment_uuid, opts = {})
89
+ data, _status_code, _headers = get_all_segments_with_http_info(environment_uuid, opts)
90
+ data
91
+ end
92
+
93
+ # Retrieve all segments.
94
+ # Used to retrieve all segments for certain account id.
95
+ # @param environment_uuid [String] Unique identifier for the environment object in the API.
96
+ # @param [Hash] opts the optional parameters
97
+ # @return [Array<(Array<Segment>, Integer, Hash)>] Array<Segment> data, response status code and response headers
98
+ def get_all_segments_with_http_info(environment_uuid, opts = {})
99
+ if @api_client.config.debugging
100
+ @api_client.config.logger.debug 'Calling API: ClientApi.get_all_segments ...'
101
+ end
102
+ # verify the required parameter 'environment_uuid' is set
103
+ if @api_client.config.client_side_validation && environment_uuid.nil?
104
+ fail ArgumentError, "Missing the required parameter 'environment_uuid' when calling ClientApi.get_all_segments"
105
+ end
106
+ # resource path
107
+ local_var_path = '/client/env/{environmentUUID}/target-segments'.sub('{' + 'environmentUUID' + '}', CGI.escape(environment_uuid.to_s))
108
+
109
+ # query parameters
110
+ query_params = opts[:query_params] || {}
111
+
112
+ # header parameters
113
+ header_params = opts[:header_params] || {}
114
+ # HTTP header 'Accept' (if needed)
115
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
116
+
117
+ # form parameters
118
+ form_params = opts[:form_params] || {}
119
+
120
+ # http body (model)
121
+ post_body = opts[:debug_body]
122
+
123
+ # return_type
124
+ return_type = opts[:debug_return_type] || 'Array<Segment>'
125
+
126
+ # auth_names
127
+ auth_names = opts[:debug_auth_names] || ['BearerAuth']
128
+
129
+ new_options = opts.merge(
130
+ :operation => :"ClientApi.get_all_segments",
131
+ :header_params => header_params,
132
+ :query_params => query_params,
133
+ :form_params => form_params,
134
+ :body => post_body,
135
+ :auth_names => auth_names,
136
+ :return_type => return_type
137
+ )
138
+
139
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
140
+ if @api_client.config.debugging
141
+ @api_client.config.logger.debug "API called: ClientApi#get_all_segments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
142
+ end
143
+ return data, status_code, headers
144
+ end
145
+
146
+ # Get feature evaluations for target
147
+ # @param environment_uuid [String] Unique identifier for the environment object in the API.
148
+ # @param feature [String] Unique identifier for the flag object in the API.
149
+ # @param target [String] Unique identifier for the target object in the API.
150
+ # @param [Hash] opts the optional parameters
151
+ # @return [Evaluation]
152
+ def get_evaluation_by_identifier(environment_uuid, feature, target, opts = {})
153
+ data, _status_code, _headers = get_evaluation_by_identifier_with_http_info(environment_uuid, feature, target, opts)
154
+ data
155
+ end
156
+
157
+ # Get feature evaluations for target
158
+ # @param environment_uuid [String] Unique identifier for the environment object in the API.
159
+ # @param feature [String] Unique identifier for the flag object in the API.
160
+ # @param target [String] Unique identifier for the target object in the API.
161
+ # @param [Hash] opts the optional parameters
162
+ # @return [Array<(Evaluation, Integer, Hash)>] Evaluation data, response status code and response headers
163
+ def get_evaluation_by_identifier_with_http_info(environment_uuid, feature, target, opts = {})
164
+ if @api_client.config.debugging
165
+ @api_client.config.logger.debug 'Calling API: ClientApi.get_evaluation_by_identifier ...'
166
+ end
167
+ # verify the required parameter 'environment_uuid' is set
168
+ if @api_client.config.client_side_validation && environment_uuid.nil?
169
+ fail ArgumentError, "Missing the required parameter 'environment_uuid' when calling ClientApi.get_evaluation_by_identifier"
170
+ end
171
+ # verify the required parameter 'feature' is set
172
+ if @api_client.config.client_side_validation && feature.nil?
173
+ fail ArgumentError, "Missing the required parameter 'feature' when calling ClientApi.get_evaluation_by_identifier"
174
+ end
175
+ # verify the required parameter 'target' is set
176
+ if @api_client.config.client_side_validation && target.nil?
177
+ fail ArgumentError, "Missing the required parameter 'target' when calling ClientApi.get_evaluation_by_identifier"
178
+ end
179
+ # resource path
180
+ local_var_path = '/client/env/{environmentUUID}/target/{target}/evaluations/{feature}'.sub('{' + 'environmentUUID' + '}', CGI.escape(environment_uuid.to_s)).sub('{' + 'feature' + '}', CGI.escape(feature.to_s)).sub('{' + 'target' + '}', CGI.escape(target.to_s))
181
+
182
+ # query parameters
183
+ query_params = opts[:query_params] || {}
184
+
185
+ # header parameters
186
+ header_params = opts[:header_params] || {}
187
+ # HTTP header 'Accept' (if needed)
188
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
189
+
190
+ # form parameters
191
+ form_params = opts[:form_params] || {}
192
+
193
+ # http body (model)
194
+ post_body = opts[:debug_body]
195
+
196
+ # return_type
197
+ return_type = opts[:debug_return_type] || 'Evaluation'
198
+
199
+ # auth_names
200
+ auth_names = opts[:debug_auth_names] || ['BearerAuth']
201
+
202
+ new_options = opts.merge(
203
+ :operation => :"ClientApi.get_evaluation_by_identifier",
204
+ :header_params => header_params,
205
+ :query_params => query_params,
206
+ :form_params => form_params,
207
+ :body => post_body,
208
+ :auth_names => auth_names,
209
+ :return_type => return_type
210
+ )
211
+
212
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
213
+ if @api_client.config.debugging
214
+ @api_client.config.logger.debug "API called: ClientApi#get_evaluation_by_identifier\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
215
+ end
216
+ return data, status_code, headers
217
+ end
218
+
219
+ # Get feature evaluations for target
220
+ # @param environment_uuid [String] Unique identifier for the environment object in the API.
221
+ # @param target [String] Unique identifier for the target object in the API.
222
+ # @param [Hash] opts the optional parameters
223
+ # @return [Pagination]
224
+ def get_evaluations(environment_uuid, target, opts = {})
225
+ data, _status_code, _headers = get_evaluations_with_http_info(environment_uuid, target, opts)
226
+ data
227
+ end
228
+
229
+ # Get feature evaluations for target
230
+ # @param environment_uuid [String] Unique identifier for the environment object in the API.
231
+ # @param target [String] Unique identifier for the target object in the API.
232
+ # @param [Hash] opts the optional parameters
233
+ # @return [Array<(Pagination, Integer, Hash)>] Pagination data, response status code and response headers
234
+ def get_evaluations_with_http_info(environment_uuid, target, opts = {})
235
+ if @api_client.config.debugging
236
+ @api_client.config.logger.debug 'Calling API: ClientApi.get_evaluations ...'
237
+ end
238
+ # verify the required parameter 'environment_uuid' is set
239
+ if @api_client.config.client_side_validation && environment_uuid.nil?
240
+ fail ArgumentError, "Missing the required parameter 'environment_uuid' when calling ClientApi.get_evaluations"
241
+ end
242
+ # verify the required parameter 'target' is set
243
+ if @api_client.config.client_side_validation && target.nil?
244
+ fail ArgumentError, "Missing the required parameter 'target' when calling ClientApi.get_evaluations"
245
+ end
246
+ # resource path
247
+ local_var_path = '/client/env/{environmentUUID}/target/{target}/evaluations'.sub('{' + 'environmentUUID' + '}', CGI.escape(environment_uuid.to_s)).sub('{' + 'target' + '}', CGI.escape(target.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'])
256
+
257
+ # form parameters
258
+ form_params = opts[:form_params] || {}
259
+
260
+ # http body (model)
261
+ post_body = opts[:debug_body]
262
+
263
+ # return_type
264
+ return_type = opts[:debug_return_type] || 'Pagination'
265
+
266
+ # auth_names
267
+ auth_names = opts[:debug_auth_names] || ['BearerAuth']
268
+
269
+ new_options = opts.merge(
270
+ :operation => :"ClientApi.get_evaluations",
271
+ :header_params => header_params,
272
+ :query_params => query_params,
273
+ :form_params => form_params,
274
+ :body => post_body,
275
+ :auth_names => auth_names,
276
+ :return_type => return_type
277
+ )
278
+
279
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
280
+ if @api_client.config.debugging
281
+ @api_client.config.logger.debug "API called: ClientApi#get_evaluations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
282
+ end
283
+ return data, status_code, headers
284
+ end
285
+
286
+ # Get all feature flags activations
287
+ # All feature flags with activations in project environment
288
+ # @param environment_uuid [String] Unique identifier for the environment object in the API.
289
+ # @param [Hash] opts the optional parameters
290
+ # @return [Array<FeatureConfig>]
291
+ def get_feature_config(environment_uuid, opts = {})
292
+ data, _status_code, _headers = get_feature_config_with_http_info(environment_uuid, opts)
293
+ data
294
+ end
295
+
296
+ # Get all feature flags activations
297
+ # All feature flags with activations in project environment
298
+ # @param environment_uuid [String] Unique identifier for the environment object in the API.
299
+ # @param [Hash] opts the optional parameters
300
+ # @return [Array<(Array<FeatureConfig>, Integer, Hash)>] Array<FeatureConfig> data, response status code and response headers
301
+ def get_feature_config_with_http_info(environment_uuid, opts = {})
302
+ if @api_client.config.debugging
303
+ @api_client.config.logger.debug 'Calling API: ClientApi.get_feature_config ...'
304
+ end
305
+ # verify the required parameter 'environment_uuid' is set
306
+ if @api_client.config.client_side_validation && environment_uuid.nil?
307
+ fail ArgumentError, "Missing the required parameter 'environment_uuid' when calling ClientApi.get_feature_config"
308
+ end
309
+ # resource path
310
+ local_var_path = '/client/env/{environmentUUID}/feature-configs'.sub('{' + 'environmentUUID' + '}', CGI.escape(environment_uuid.to_s))
311
+
312
+ # query parameters
313
+ query_params = opts[:query_params] || {}
314
+
315
+ # header parameters
316
+ header_params = opts[:header_params] || {}
317
+ # HTTP header 'Accept' (if needed)
318
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
319
+
320
+ # form parameters
321
+ form_params = opts[:form_params] || {}
322
+
323
+ # http body (model)
324
+ post_body = opts[:debug_body]
325
+
326
+ # return_type
327
+ return_type = opts[:debug_return_type] || 'Array<FeatureConfig>'
328
+
329
+ # auth_names
330
+ auth_names = opts[:debug_auth_names] || ['BearerAuth']
331
+
332
+ new_options = opts.merge(
333
+ :operation => :"ClientApi.get_feature_config",
334
+ :header_params => header_params,
335
+ :query_params => query_params,
336
+ :form_params => form_params,
337
+ :body => post_body,
338
+ :auth_names => auth_names,
339
+ :return_type => return_type
340
+ )
341
+
342
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
343
+ if @api_client.config.debugging
344
+ @api_client.config.logger.debug "API called: ClientApi#get_feature_config\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
345
+ end
346
+ return data, status_code, headers
347
+ end
348
+
349
+ # Get feature config
350
+ # @param identifier [String] Unique identifier for the flag object in the API.
351
+ # @param environment_uuid [String] Unique identifier for the environment object in the API.
352
+ # @param [Hash] opts the optional parameters
353
+ # @return [FeatureConfig]
354
+ def get_feature_config_by_identifier(identifier, environment_uuid, opts = {})
355
+ data, _status_code, _headers = get_feature_config_by_identifier_with_http_info(identifier, environment_uuid, opts)
356
+ data
357
+ end
358
+
359
+ # Get feature config
360
+ # @param identifier [String] Unique identifier for the flag object in the API.
361
+ # @param environment_uuid [String] Unique identifier for the environment object in the API.
362
+ # @param [Hash] opts the optional parameters
363
+ # @return [Array<(FeatureConfig, Integer, Hash)>] FeatureConfig data, response status code and response headers
364
+ def get_feature_config_by_identifier_with_http_info(identifier, environment_uuid, opts = {})
365
+ if @api_client.config.debugging
366
+ @api_client.config.logger.debug 'Calling API: ClientApi.get_feature_config_by_identifier ...'
367
+ end
368
+ # verify the required parameter 'identifier' is set
369
+ if @api_client.config.client_side_validation && identifier.nil?
370
+ fail ArgumentError, "Missing the required parameter 'identifier' when calling ClientApi.get_feature_config_by_identifier"
371
+ end
372
+ # verify the required parameter 'environment_uuid' is set
373
+ if @api_client.config.client_side_validation && environment_uuid.nil?
374
+ fail ArgumentError, "Missing the required parameter 'environment_uuid' when calling ClientApi.get_feature_config_by_identifier"
375
+ end
376
+ # resource path
377
+ local_var_path = '/client/env/{environmentUUID}/feature-configs/{identifier}'.sub('{' + 'identifier' + '}', CGI.escape(identifier.to_s)).sub('{' + 'environmentUUID' + '}', CGI.escape(environment_uuid.to_s))
378
+
379
+ # query parameters
380
+ query_params = opts[:query_params] || {}
381
+
382
+ # header parameters
383
+ header_params = opts[:header_params] || {}
384
+ # HTTP header 'Accept' (if needed)
385
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
386
+
387
+ # form parameters
388
+ form_params = opts[:form_params] || {}
389
+
390
+ # http body (model)
391
+ post_body = opts[:debug_body]
392
+
393
+ # return_type
394
+ return_type = opts[:debug_return_type] || 'FeatureConfig'
395
+
396
+ # auth_names
397
+ auth_names = opts[:debug_auth_names] || ['BearerAuth']
398
+
399
+ new_options = opts.merge(
400
+ :operation => :"ClientApi.get_feature_config_by_identifier",
401
+ :header_params => header_params,
402
+ :query_params => query_params,
403
+ :form_params => form_params,
404
+ :body => post_body,
405
+ :auth_names => auth_names,
406
+ :return_type => return_type
407
+ )
408
+
409
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
410
+ if @api_client.config.debugging
411
+ @api_client.config.logger.debug "API called: ClientApi#get_feature_config_by_identifier\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
412
+ end
413
+ return data, status_code, headers
414
+ end
415
+
416
+ # Retrieve a segment by identifier
417
+ # Used to retrieve a segment for a certain account id by identifier
418
+ # @param identifier [String] Unique identifier for the segment object in the API
419
+ # @param environment_uuid [String] Unique identifier for the environment object in the API
420
+ # @param [Hash] opts the optional parameters
421
+ # @return [Segment]
422
+ def get_segment_by_identifier(identifier, environment_uuid, opts = {})
423
+ data, _status_code, _headers = get_segment_by_identifier_with_http_info(identifier, environment_uuid, opts)
424
+ data
425
+ end
426
+
427
+ # Retrieve a segment by identifier
428
+ # Used to retrieve a segment for a certain account id by identifier
429
+ # @param identifier [String] Unique identifier for the segment object in the API
430
+ # @param environment_uuid [String] Unique identifier for the environment object in the API
431
+ # @param [Hash] opts the optional parameters
432
+ # @return [Array<(Segment, Integer, Hash)>] Segment data, response status code and response headers
433
+ def get_segment_by_identifier_with_http_info(identifier, environment_uuid, opts = {})
434
+ if @api_client.config.debugging
435
+ @api_client.config.logger.debug 'Calling API: ClientApi.get_segment_by_identifier ...'
436
+ end
437
+ # verify the required parameter 'identifier' is set
438
+ if @api_client.config.client_side_validation && identifier.nil?
439
+ fail ArgumentError, "Missing the required parameter 'identifier' when calling ClientApi.get_segment_by_identifier"
440
+ end
441
+ # verify the required parameter 'environment_uuid' is set
442
+ if @api_client.config.client_side_validation && environment_uuid.nil?
443
+ fail ArgumentError, "Missing the required parameter 'environment_uuid' when calling ClientApi.get_segment_by_identifier"
444
+ end
445
+ # resource path
446
+ local_var_path = '/client/env/{environmentUUID}/target-segments/{identifier}'.sub('{' + 'identifier' + '}', CGI.escape(identifier.to_s)).sub('{' + 'environmentUUID' + '}', CGI.escape(environment_uuid.to_s))
447
+
448
+ # query parameters
449
+ query_params = opts[:query_params] || {}
450
+
451
+ # header parameters
452
+ header_params = opts[:header_params] || {}
453
+ # HTTP header 'Accept' (if needed)
454
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
455
+
456
+ # form parameters
457
+ form_params = opts[:form_params] || {}
458
+
459
+ # http body (model)
460
+ post_body = opts[:debug_body]
461
+
462
+ # return_type
463
+ return_type = opts[:debug_return_type] || 'Segment'
464
+
465
+ # auth_names
466
+ auth_names = opts[:debug_auth_names] || ['BearerAuth']
467
+
468
+ new_options = opts.merge(
469
+ :operation => :"ClientApi.get_segment_by_identifier",
470
+ :header_params => header_params,
471
+ :query_params => query_params,
472
+ :form_params => form_params,
473
+ :body => post_body,
474
+ :auth_names => auth_names,
475
+ :return_type => return_type
476
+ )
477
+
478
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
479
+ if @api_client.config.debugging
480
+ @api_client.config.logger.debug "API called: ClientApi#get_segment_by_identifier\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
481
+ end
482
+ return data, status_code, headers
483
+ end
484
+
485
+ # Stream endpoint.
486
+ # @param api_key [String]
487
+ # @param [Hash] opts the optional parameters
488
+ # @return [nil]
489
+ def stream(api_key, opts = {})
490
+ stream_with_http_info(api_key, opts)
491
+ nil
492
+ end
493
+
494
+ # Stream endpoint.
495
+ # @param api_key [String]
496
+ # @param [Hash] opts the optional parameters
497
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
498
+ def stream_with_http_info(api_key, opts = {})
499
+ if @api_client.config.debugging
500
+ @api_client.config.logger.debug 'Calling API: ClientApi.stream ...'
501
+ end
502
+ # verify the required parameter 'api_key' is set
503
+ if @api_client.config.client_side_validation && api_key.nil?
504
+ fail ArgumentError, "Missing the required parameter 'api_key' when calling ClientApi.stream"
505
+ end
506
+ # resource path
507
+ local_var_path = '/stream'
508
+
509
+ # query parameters
510
+ query_params = opts[:query_params] || {}
511
+
512
+ # header parameters
513
+ header_params = opts[:header_params] || {}
514
+ header_params[:'API-Key'] = api_key
515
+
516
+ # form parameters
517
+ form_params = opts[:form_params] || {}
518
+
519
+ # http body (model)
520
+ post_body = opts[:debug_body]
521
+
522
+ # return_type
523
+ return_type = opts[:debug_return_type]
524
+
525
+ # auth_names
526
+ auth_names = opts[:debug_auth_names] || ['BearerAuth']
527
+
528
+ new_options = opts.merge(
529
+ :operation => :"ClientApi.stream",
530
+ :header_params => header_params,
531
+ :query_params => query_params,
532
+ :form_params => form_params,
533
+ :body => post_body,
534
+ :auth_names => auth_names,
535
+ :return_type => return_type
536
+ )
537
+
538
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
539
+ if @api_client.config.debugging
540
+ @api_client.config.logger.debug "API called: ClientApi#stream\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
541
+ end
542
+ return data, status_code, headers
543
+ end
544
+ end
545
+ end