ibm_watson 0.12.0 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,6 +23,7 @@ require "concurrent"
23
23
  require "erb"
24
24
  require "json"
25
25
  require_relative "./detailed_response"
26
+ require_relative "./common.rb"
26
27
 
27
28
  require_relative "./watson_service"
28
29
 
@@ -93,7 +94,7 @@ module IBMWatson
93
94
 
94
95
  headers = {
95
96
  }
96
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=natural_language_classifier;service_version=V1;operation_id=classify"
97
+ headers = Common.new.get_default_headers(headers: headers, service_name: "natural_language_classifier", service_version: "V1", operation_id: "classify")
97
98
 
98
99
  data = {
99
100
  "text" => text
@@ -128,7 +129,7 @@ module IBMWatson
128
129
 
129
130
  headers = {
130
131
  }
131
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=natural_language_classifier;service_version=V1;operation_id=classify_collection"
132
+ headers = Common.new.get_default_headers(headers: headers, service_name: "natural_language_classifier", service_version: "V1", operation_id: "classify_collection")
132
133
 
133
134
  data = {
134
135
  "collection" => collection
@@ -174,7 +175,7 @@ module IBMWatson
174
175
 
175
176
  headers = {
176
177
  }
177
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=natural_language_classifier;service_version=V1;operation_id=create_classifier"
178
+ headers = Common.new.get_default_headers(headers: headers, service_name: "natural_language_classifier", service_version: "V1", operation_id: "create_classifier")
178
179
 
179
180
  form_data = {}
180
181
 
@@ -210,7 +211,7 @@ module IBMWatson
210
211
  def list_classifiers
211
212
  headers = {
212
213
  }
213
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=natural_language_classifier;service_version=V1;operation_id=list_classifiers"
214
+ headers = Common.new.get_default_headers(headers: headers, service_name: "natural_language_classifier", service_version: "V1", operation_id: "list_classifiers")
214
215
 
215
216
  method_url = "/v1/classifiers"
216
217
 
@@ -234,7 +235,7 @@ module IBMWatson
234
235
 
235
236
  headers = {
236
237
  }
237
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=natural_language_classifier;service_version=V1;operation_id=get_classifier"
238
+ headers = Common.new.get_default_headers(headers: headers, service_name: "natural_language_classifier", service_version: "V1", operation_id: "get_classifier")
238
239
 
239
240
  method_url = "/v1/classifiers/%s" % [ERB::Util.url_encode(classifier_id)]
240
241
 
@@ -257,7 +258,7 @@ module IBMWatson
257
258
 
258
259
  headers = {
259
260
  }
260
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=natural_language_classifier;service_version=V1;operation_id=delete_classifier"
261
+ headers = Common.new.get_default_headers(headers: headers, service_name: "natural_language_classifier", service_version: "V1", operation_id: "delete_classifier")
261
262
 
262
263
  method_url = "/v1/classifiers/%s" % [ERB::Util.url_encode(classifier_id)]
263
264
 
@@ -28,6 +28,7 @@ require "concurrent"
28
28
  require "erb"
29
29
  require "json"
30
30
  require_relative "./detailed_response"
31
+ require_relative "./common.rb"
31
32
 
32
33
  require_relative "./watson_service"
33
34
 
@@ -138,7 +139,7 @@ module IBMWatson
138
139
 
139
140
  headers = {
140
141
  }
141
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=natural-language-understanding;service_version=V1;operation_id=analyze"
142
+ headers = Common.new.get_default_headers(headers: headers, service_name: "natural-language-understanding", service_version: "V1", operation_id: "analyze")
142
143
 
143
144
  params = {
144
145
  "version" => @version
@@ -183,7 +184,7 @@ module IBMWatson
183
184
  def list_models
184
185
  headers = {
185
186
  }
186
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=natural-language-understanding;service_version=V1;operation_id=list_models"
187
+ headers = Common.new.get_default_headers(headers: headers, service_name: "natural-language-understanding", service_version: "V1", operation_id: "list_models")
187
188
 
188
189
  params = {
189
190
  "version" => @version
@@ -212,7 +213,7 @@ module IBMWatson
212
213
 
213
214
  headers = {
214
215
  }
215
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=natural-language-understanding;service_version=V1;operation_id=delete_model"
216
+ headers = Common.new.get_default_headers(headers: headers, service_name: "natural-language-understanding", service_version: "V1", operation_id: "delete_model")
216
217
 
217
218
  params = {
218
219
  "version" => @version
@@ -39,6 +39,7 @@ require "concurrent"
39
39
  require "erb"
40
40
  require "json"
41
41
  require_relative "./detailed_response"
42
+ require_relative "./common.rb"
42
43
 
43
44
  require_relative "./watson_service"
44
45
 
@@ -198,7 +199,7 @@ module IBMWatson
198
199
  "Content-Language" => content_language,
199
200
  "Accept-Language" => accept_language
200
201
  }
201
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=personality_insights;service_version=V3;operation_id=profile"
202
+ headers = Common.new.get_default_headers(headers: headers, service_name: "personality_insights", service_version: "V3", operation_id: "profile")
202
203
 
203
204
  params = {
204
205
  "version" => @version,
@@ -42,6 +42,7 @@ require "concurrent"
42
42
  require "erb"
43
43
  require "json"
44
44
  require_relative "./detailed_response"
45
+ require_relative "./common.rb"
45
46
 
46
47
  require_relative "./watson_service"
47
48
 
@@ -110,7 +111,7 @@ module IBMWatson
110
111
  def list_models
111
112
  headers = {
112
113
  }
113
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=list_models"
114
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "list_models")
114
115
 
115
116
  method_url = "/v1/models"
116
117
 
@@ -140,7 +141,7 @@ module IBMWatson
140
141
 
141
142
  headers = {
142
143
  }
143
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=get_model"
144
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "get_model")
144
145
 
145
146
  method_url = "/v1/models/%s" % [ERB::Util.url_encode(model_id)]
146
147
 
@@ -378,7 +379,7 @@ module IBMWatson
378
379
  "Content-Type" => content_type
379
380
  }
380
381
  keywords *= "," unless keywords.nil?
381
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=recognize"
382
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "recognize")
382
383
 
383
384
  params = {
384
385
  "model" => model,
@@ -494,7 +495,7 @@ module IBMWatson
494
495
  require_relative("./websocket/speech_to_text_websocket_listener.rb")
495
496
  headers = {
496
497
  }
497
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=discovery;service_version=V1;operation_id=recognize_using_websocket"
498
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "recognize_using_websocket")
498
499
  headers = conn.default_options.headers.to_hash unless conn.default_options.headers.to_hash.empty?
499
500
  if !token_manager.nil?
500
501
  access_token = token_manager.token
@@ -639,7 +640,7 @@ module IBMWatson
639
640
 
640
641
  headers = {
641
642
  }
642
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=register_callback"
643
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "register_callback")
643
644
 
644
645
  params = {
645
646
  "callback_url" => callback_url,
@@ -674,7 +675,7 @@ module IBMWatson
674
675
 
675
676
  headers = {
676
677
  }
677
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=unregister_callback"
678
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "unregister_callback")
678
679
 
679
680
  params = {
680
681
  "callback_url" => callback_url
@@ -958,7 +959,7 @@ module IBMWatson
958
959
  headers = {
959
960
  "Content-Type" => content_type
960
961
  }
961
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=create_job"
962
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "create_job")
962
963
 
963
964
  params = {
964
965
  "model" => model,
@@ -1018,7 +1019,7 @@ module IBMWatson
1018
1019
  def check_jobs
1019
1020
  headers = {
1020
1021
  }
1021
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=check_jobs"
1022
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "check_jobs")
1022
1023
 
1023
1024
  method_url = "/v1/recognitions"
1024
1025
 
@@ -1057,7 +1058,7 @@ module IBMWatson
1057
1058
 
1058
1059
  headers = {
1059
1060
  }
1060
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=check_job"
1061
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "check_job")
1061
1062
 
1062
1063
  method_url = "/v1/recognitions/%s" % [ERB::Util.url_encode(id)]
1063
1064
 
@@ -1090,7 +1091,7 @@ module IBMWatson
1090
1091
 
1091
1092
  headers = {
1092
1093
  }
1093
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=delete_job"
1094
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "delete_job")
1094
1095
 
1095
1096
  method_url = "/v1/recognitions/%s" % [ERB::Util.url_encode(id)]
1096
1097
 
@@ -1149,7 +1150,7 @@ module IBMWatson
1149
1150
 
1150
1151
  headers = {
1151
1152
  }
1152
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=create_language_model"
1153
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "create_language_model")
1153
1154
 
1154
1155
  data = {
1155
1156
  "name" => name,
@@ -1188,7 +1189,7 @@ module IBMWatson
1188
1189
  def list_language_models(language: nil)
1189
1190
  headers = {
1190
1191
  }
1191
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=list_language_models"
1192
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "list_language_models")
1192
1193
 
1193
1194
  params = {
1194
1195
  "language" => language
@@ -1223,7 +1224,7 @@ module IBMWatson
1223
1224
 
1224
1225
  headers = {
1225
1226
  }
1226
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=get_language_model"
1227
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "get_language_model")
1227
1228
 
1228
1229
  method_url = "/v1/customizations/%s" % [ERB::Util.url_encode(customization_id)]
1229
1230
 
@@ -1255,7 +1256,7 @@ module IBMWatson
1255
1256
 
1256
1257
  headers = {
1257
1258
  }
1258
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=delete_language_model"
1259
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "delete_language_model")
1259
1260
 
1260
1261
  method_url = "/v1/customizations/%s" % [ERB::Util.url_encode(customization_id)]
1261
1262
 
@@ -1331,7 +1332,7 @@ module IBMWatson
1331
1332
 
1332
1333
  headers = {
1333
1334
  }
1334
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=train_language_model"
1335
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "train_language_model")
1335
1336
 
1336
1337
  params = {
1337
1338
  "word_type_to_add" => word_type_to_add,
@@ -1371,7 +1372,7 @@ module IBMWatson
1371
1372
 
1372
1373
  headers = {
1373
1374
  }
1374
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=reset_language_model"
1375
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "reset_language_model")
1375
1376
 
1376
1377
  method_url = "/v1/customizations/%s/reset" % [ERB::Util.url_encode(customization_id)]
1377
1378
 
@@ -1414,7 +1415,7 @@ module IBMWatson
1414
1415
 
1415
1416
  headers = {
1416
1417
  }
1417
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=upgrade_language_model"
1418
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "upgrade_language_model")
1418
1419
 
1419
1420
  method_url = "/v1/customizations/%s/upgrade_model" % [ERB::Util.url_encode(customization_id)]
1420
1421
 
@@ -1449,7 +1450,7 @@ module IBMWatson
1449
1450
 
1450
1451
  headers = {
1451
1452
  }
1452
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=list_corpora"
1453
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "list_corpora")
1453
1454
 
1454
1455
  method_url = "/v1/customizations/%s/corpora" % [ERB::Util.url_encode(customization_id)]
1455
1456
 
@@ -1548,7 +1549,7 @@ module IBMWatson
1548
1549
 
1549
1550
  headers = {
1550
1551
  }
1551
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=add_corpus"
1552
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "add_corpus")
1552
1553
 
1553
1554
  params = {
1554
1555
  "allow_overwrite" => allow_overwrite
@@ -1597,7 +1598,7 @@ module IBMWatson
1597
1598
 
1598
1599
  headers = {
1599
1600
  }
1600
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=get_corpus"
1601
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "get_corpus")
1601
1602
 
1602
1603
  method_url = "/v1/customizations/%s/corpora/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(corpus_name)]
1603
1604
 
@@ -1636,7 +1637,7 @@ module IBMWatson
1636
1637
 
1637
1638
  headers = {
1638
1639
  }
1639
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=delete_corpus"
1640
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "delete_corpus")
1640
1641
 
1641
1642
  method_url = "/v1/customizations/%s/corpora/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(corpus_name)]
1642
1643
 
@@ -1686,7 +1687,7 @@ module IBMWatson
1686
1687
 
1687
1688
  headers = {
1688
1689
  }
1689
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=list_words"
1690
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "list_words")
1690
1691
 
1691
1692
  params = {
1692
1693
  "word_type" => word_type,
@@ -1777,7 +1778,7 @@ module IBMWatson
1777
1778
 
1778
1779
  headers = {
1779
1780
  }
1780
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=add_words"
1781
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "add_words")
1781
1782
 
1782
1783
  data = {
1783
1784
  "words" => words
@@ -1870,7 +1871,7 @@ module IBMWatson
1870
1871
 
1871
1872
  headers = {
1872
1873
  }
1873
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=add_word"
1874
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "add_word")
1874
1875
 
1875
1876
  data = {
1876
1877
  "word" => word,
@@ -1913,7 +1914,7 @@ module IBMWatson
1913
1914
 
1914
1915
  headers = {
1915
1916
  }
1916
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=get_word"
1917
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "get_word")
1917
1918
 
1918
1919
  method_url = "/v1/customizations/%s/words/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(word_name)]
1919
1920
 
@@ -1953,7 +1954,7 @@ module IBMWatson
1953
1954
 
1954
1955
  headers = {
1955
1956
  }
1956
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=delete_word"
1957
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "delete_word")
1957
1958
 
1958
1959
  method_url = "/v1/customizations/%s/words/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(word_name)]
1959
1960
 
@@ -1988,7 +1989,7 @@ module IBMWatson
1988
1989
 
1989
1990
  headers = {
1990
1991
  }
1991
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=list_grammars"
1992
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "list_grammars")
1992
1993
 
1993
1994
  method_url = "/v1/customizations/%s/grammars" % [ERB::Util.url_encode(customization_id)]
1994
1995
 
@@ -2082,7 +2083,7 @@ module IBMWatson
2082
2083
  headers = {
2083
2084
  "Content-Type" => content_type
2084
2085
  }
2085
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=add_grammar"
2086
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "add_grammar")
2086
2087
 
2087
2088
  params = {
2088
2089
  "allow_overwrite" => allow_overwrite
@@ -2125,7 +2126,7 @@ module IBMWatson
2125
2126
 
2126
2127
  headers = {
2127
2128
  }
2128
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=get_grammar"
2129
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "get_grammar")
2129
2130
 
2130
2131
  method_url = "/v1/customizations/%s/grammars/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(grammar_name)]
2131
2132
 
@@ -2163,7 +2164,7 @@ module IBMWatson
2163
2164
 
2164
2165
  headers = {
2165
2166
  }
2166
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=delete_grammar"
2167
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "delete_grammar")
2167
2168
 
2168
2169
  method_url = "/v1/customizations/%s/grammars/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(grammar_name)]
2169
2170
 
@@ -2211,7 +2212,7 @@ module IBMWatson
2211
2212
 
2212
2213
  headers = {
2213
2214
  }
2214
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=create_acoustic_model"
2215
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "create_acoustic_model")
2215
2216
 
2216
2217
  data = {
2217
2218
  "name" => name,
@@ -2249,7 +2250,7 @@ module IBMWatson
2249
2250
  def list_acoustic_models(language: nil)
2250
2251
  headers = {
2251
2252
  }
2252
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=list_acoustic_models"
2253
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "list_acoustic_models")
2253
2254
 
2254
2255
  params = {
2255
2256
  "language" => language
@@ -2284,7 +2285,7 @@ module IBMWatson
2284
2285
 
2285
2286
  headers = {
2286
2287
  }
2287
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=get_acoustic_model"
2288
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "get_acoustic_model")
2288
2289
 
2289
2290
  method_url = "/v1/acoustic_customizations/%s" % [ERB::Util.url_encode(customization_id)]
2290
2291
 
@@ -2316,7 +2317,7 @@ module IBMWatson
2316
2317
 
2317
2318
  headers = {
2318
2319
  }
2319
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=delete_acoustic_model"
2320
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "delete_acoustic_model")
2320
2321
 
2321
2322
  method_url = "/v1/acoustic_customizations/%s" % [ERB::Util.url_encode(customization_id)]
2322
2323
 
@@ -2390,7 +2391,7 @@ module IBMWatson
2390
2391
 
2391
2392
  headers = {
2392
2393
  }
2393
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=train_acoustic_model"
2394
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "train_acoustic_model")
2394
2395
 
2395
2396
  params = {
2396
2397
  "custom_language_model_id" => custom_language_model_id
@@ -2428,7 +2429,7 @@ module IBMWatson
2428
2429
 
2429
2430
  headers = {
2430
2431
  }
2431
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=reset_acoustic_model"
2432
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "reset_acoustic_model")
2432
2433
 
2433
2434
  method_url = "/v1/acoustic_customizations/%s/reset" % [ERB::Util.url_encode(customization_id)]
2434
2435
 
@@ -2488,7 +2489,7 @@ module IBMWatson
2488
2489
 
2489
2490
  headers = {
2490
2491
  }
2491
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=upgrade_acoustic_model"
2492
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "upgrade_acoustic_model")
2492
2493
 
2493
2494
  params = {
2494
2495
  "custom_language_model_id" => custom_language_model_id,
@@ -2531,7 +2532,7 @@ module IBMWatson
2531
2532
 
2532
2533
  headers = {
2533
2534
  }
2534
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=list_audio"
2535
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "list_audio")
2535
2536
 
2536
2537
  method_url = "/v1/acoustic_customizations/%s/audio" % [ERB::Util.url_encode(customization_id)]
2537
2538
 
@@ -2684,7 +2685,7 @@ module IBMWatson
2684
2685
  "Content-Type" => content_type,
2685
2686
  "Contained-Content-Type" => contained_content_type
2686
2687
  }
2687
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=add_audio"
2688
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "add_audio")
2688
2689
 
2689
2690
  params = {
2690
2691
  "allow_overwrite" => allow_overwrite
@@ -2743,7 +2744,7 @@ module IBMWatson
2743
2744
 
2744
2745
  headers = {
2745
2746
  }
2746
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=get_audio"
2747
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "get_audio")
2747
2748
 
2748
2749
  method_url = "/v1/acoustic_customizations/%s/audio/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(audio_name)]
2749
2750
 
@@ -2781,7 +2782,7 @@ module IBMWatson
2781
2782
 
2782
2783
  headers = {
2783
2784
  }
2784
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=delete_audio"
2785
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "delete_audio")
2785
2786
 
2786
2787
  method_url = "/v1/acoustic_customizations/%s/audio/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(audio_name)]
2787
2788
 
@@ -2818,7 +2819,7 @@ module IBMWatson
2818
2819
 
2819
2820
  headers = {
2820
2821
  }
2821
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=speech_to_text;service_version=V1;operation_id=delete_user_data"
2822
+ headers = Common.new.get_default_headers(headers: headers, service_name: "speech_to_text", service_version: "V1", operation_id: "delete_user_data")
2822
2823
 
2823
2824
  params = {
2824
2825
  "customer_id" => customer_id
@@ -37,6 +37,7 @@ require "concurrent"
37
37
  require "erb"
38
38
  require "json"
39
39
  require_relative "./detailed_response"
40
+ require_relative "./common.rb"
40
41
 
41
42
  require_relative "./watson_service"
42
43
 
@@ -105,7 +106,7 @@ module IBMWatson
105
106
  def list_voices
106
107
  headers = {
107
108
  }
108
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=text_to_speech;service_version=V1;operation_id=list_voices"
109
+ headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "list_voices")
109
110
 
110
111
  method_url = "/v1/voices"
111
112
 
@@ -139,7 +140,7 @@ module IBMWatson
139
140
 
140
141
  headers = {
141
142
  }
142
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=text_to_speech;service_version=V1;operation_id=get_voice"
143
+ headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "get_voice")
143
144
 
144
145
  params = {
145
146
  "customization_id" => customization_id
@@ -269,7 +270,7 @@ module IBMWatson
269
270
  headers = {
270
271
  "Accept" => accept
271
272
  }
272
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=text_to_speech;service_version=V1;operation_id=synthesize"
273
+ headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "synthesize")
273
274
 
274
275
  params = {
275
276
  "voice" => voice,
@@ -327,7 +328,7 @@ module IBMWatson
327
328
 
328
329
  headers = {
329
330
  }
330
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=text_to_speech;service_version=V1;operation_id=get_pronunciation"
331
+ headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "get_pronunciation")
331
332
 
332
333
  params = {
333
334
  "text" => text,
@@ -374,7 +375,7 @@ module IBMWatson
374
375
 
375
376
  headers = {
376
377
  }
377
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=text_to_speech;service_version=V1;operation_id=create_voice_model"
378
+ headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "create_voice_model")
378
379
 
379
380
  data = {
380
381
  "name" => name,
@@ -415,7 +416,7 @@ module IBMWatson
415
416
  def list_voice_models(language: nil)
416
417
  headers = {
417
418
  }
418
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=text_to_speech;service_version=V1;operation_id=list_voice_models"
419
+ headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "list_voice_models")
419
420
 
420
421
  params = {
421
422
  "language" => language
@@ -480,7 +481,7 @@ module IBMWatson
480
481
 
481
482
  headers = {
482
483
  }
483
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=text_to_speech;service_version=V1;operation_id=update_voice_model"
484
+ headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "update_voice_model")
484
485
 
485
486
  data = {
486
487
  "name" => name,
@@ -521,7 +522,7 @@ module IBMWatson
521
522
 
522
523
  headers = {
523
524
  }
524
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=text_to_speech;service_version=V1;operation_id=get_voice_model"
525
+ headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "get_voice_model")
525
526
 
526
527
  method_url = "/v1/customizations/%s" % [ERB::Util.url_encode(customization_id)]
527
528
 
@@ -553,7 +554,7 @@ module IBMWatson
553
554
 
554
555
  headers = {
555
556
  }
556
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=text_to_speech;service_version=V1;operation_id=delete_voice_model"
557
+ headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "delete_voice_model")
557
558
 
558
559
  method_url = "/v1/customizations/%s" % [ERB::Util.url_encode(customization_id)]
559
560
 
@@ -620,7 +621,7 @@ module IBMWatson
620
621
 
621
622
  headers = {
622
623
  }
623
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=text_to_speech;service_version=V1;operation_id=add_words"
624
+ headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "add_words")
624
625
 
625
626
  data = {
626
627
  "words" => words
@@ -659,7 +660,7 @@ module IBMWatson
659
660
 
660
661
  headers = {
661
662
  }
662
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=text_to_speech;service_version=V1;operation_id=list_words"
663
+ headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "list_words")
663
664
 
664
665
  method_url = "/v1/customizations/%s/words" % [ERB::Util.url_encode(customization_id)]
665
666
 
@@ -728,7 +729,7 @@ module IBMWatson
728
729
 
729
730
  headers = {
730
731
  }
731
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=text_to_speech;service_version=V1;operation_id=add_word"
732
+ headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "add_word")
732
733
 
733
734
  data = {
734
735
  "translation" => translation,
@@ -770,7 +771,7 @@ module IBMWatson
770
771
 
771
772
  headers = {
772
773
  }
773
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=text_to_speech;service_version=V1;operation_id=get_word"
774
+ headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "get_word")
774
775
 
775
776
  method_url = "/v1/customizations/%s/words/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(word)]
776
777
 
@@ -806,7 +807,7 @@ module IBMWatson
806
807
 
807
808
  headers = {
808
809
  }
809
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=text_to_speech;service_version=V1;operation_id=delete_word"
810
+ headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "delete_word")
810
811
 
811
812
  method_url = "/v1/customizations/%s/words/%s" % [ERB::Util.url_encode(customization_id), ERB::Util.url_encode(word)]
812
813
 
@@ -843,7 +844,7 @@ module IBMWatson
843
844
 
844
845
  headers = {
845
846
  }
846
- headers["X-IBMCloud-SDK-Analytics"] = "service_name=text_to_speech;service_version=V1;operation_id=delete_user_data"
847
+ headers = Common.new.get_default_headers(headers: headers, service_name: "text_to_speech", service_version: "V1", operation_id: "delete_user_data")
847
848
 
848
849
  params = {
849
850
  "customer_id" => customer_id