azure_cognitiveservices_luisauthoring 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring.rb +142 -0
  4. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/apps.rb +2212 -0
  5. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/azure_accounts.rb +453 -0
  6. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/examples.rb +508 -0
  7. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/features.rb +668 -0
  8. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/luis_authoring_client.rb +167 -0
  9. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb +11482 -0
  10. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/app_version_setting_object.rb +57 -0
  11. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/application_create_object.rb +106 -0
  12. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/application_info_response.rb +158 -0
  13. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/application_publish_object.rb +59 -0
  14. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/application_setting_update_object.rb +47 -0
  15. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/application_settings.rb +58 -0
  16. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/application_update_object.rb +57 -0
  17. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/available_culture.rb +57 -0
  18. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/available_prebuilt_entity_model.rb +68 -0
  19. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/azure_account_info_object.rb +68 -0
  20. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/batch_label_example.rb +70 -0
  21. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/child_entity.rb +57 -0
  22. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/closed_list.rb +85 -0
  23. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/closed_list_entity_extractor.rb +123 -0
  24. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/closed_list_model_create_object.rb +66 -0
  25. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/closed_list_model_patch_object.rb +55 -0
  26. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/closed_list_model_update_object.rb +66 -0
  27. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/collaborators_array.rb +55 -0
  28. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/composite_child_model_create_object.rb +47 -0
  29. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/composite_entity_extractor.rb +123 -0
  30. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/composite_entity_model.rb +65 -0
  31. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/custom_prebuilt_model.rb +125 -0
  32. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/endpoint_info.rb +125 -0
  33. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/enqueue_training_response.rb +58 -0
  34. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/entities_suggestion_example.rb +106 -0
  35. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/entity_extractor.rb +125 -0
  36. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/entity_label.rb +71 -0
  37. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/entity_label_object.rb +71 -0
  38. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/entity_model_info.rb +87 -0
  39. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/entity_prediction.rb +81 -0
  40. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/entity_role.rb +57 -0
  41. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/entity_role_create_object.rb +46 -0
  42. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/entity_role_update_object.rb +46 -0
  43. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/error_response.rb +65 -0
  44. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/example_label_object.rb +78 -0
  45. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/explicit_list_item.rb +57 -0
  46. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/explicit_list_item_create_object.rb +46 -0
  47. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/explicit_list_item_update_object.rb +46 -0
  48. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/feature_info_object.rb +68 -0
  49. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/features_response_object.rb +75 -0
  50. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/hierarchical_child_entity.rb +77 -0
  51. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/hierarchical_child_model_create_object.rb +47 -0
  52. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/hierarchical_child_model_update_object.rb +47 -0
  53. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/hierarchical_entity_extractor.rb +123 -0
  54. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/hierarchical_entity_model.rb +65 -0
  55. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/hierarchical_model.rb +97 -0
  56. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/intent_classifier.rb +89 -0
  57. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/intent_prediction.rb +57 -0
  58. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/intents_suggestion_example.rb +106 -0
  59. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/jsonentity.rb +70 -0
  60. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/jsonmodel_feature.rb +90 -0
  61. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/jsonregex_feature.rb +68 -0
  62. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/jsonutterance.rb +77 -0
  63. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/label_example_response.rb +57 -0
  64. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/label_text_object.rb +57 -0
  65. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/labeled_utterance.rb +148 -0
  66. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/luis_app.rb +318 -0
  67. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/model_create_object.rb +46 -0
  68. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/model_info.rb +83 -0
  69. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/model_info_response.rb +196 -0
  70. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/model_training_details.rb +91 -0
  71. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/model_training_info.rb +58 -0
  72. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/model_update_object.rb +46 -0
  73. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/operation_error.rb +57 -0
  74. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/operation_status.rb +58 -0
  75. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/operation_status_type.rb +17 -0
  76. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/pattern_any.rb +84 -0
  77. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/pattern_any_entity_extractor.rb +123 -0
  78. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/pattern_any_model_create_object.rb +65 -0
  79. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/pattern_any_model_update_object.rb +65 -0
  80. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/pattern_create_object.rb +57 -0
  81. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/pattern_feature_info.rb +70 -0
  82. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/pattern_rule.rb +57 -0
  83. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/pattern_rule_create_object.rb +57 -0
  84. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/pattern_rule_info.rb +68 -0
  85. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/pattern_rule_update_object.rb +68 -0
  86. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/pattern_update_object.rb +70 -0
  87. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/personal_assistants_response.rb +74 -0
  88. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/phrase_list_feature_info.rb +91 -0
  89. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/phraselist_create_object.rb +81 -0
  90. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/phraselist_update_object.rb +94 -0
  91. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/prebuilt_domain.rb +119 -0
  92. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/prebuilt_domain_create_base_object.rb +47 -0
  93. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/prebuilt_domain_create_object.rb +58 -0
  94. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/prebuilt_domain_item.rb +69 -0
  95. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/prebuilt_domain_model_create_object.rb +58 -0
  96. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/prebuilt_domain_object.rb +58 -0
  97. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/prebuilt_entity.rb +65 -0
  98. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/prebuilt_entity_extractor.rb +103 -0
  99. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/production_or_staging_endpoint_info.rb +100 -0
  100. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/publish_setting_update_object.rb +71 -0
  101. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/publish_settings.rb +82 -0
  102. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/regex_entity.rb +76 -0
  103. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/regex_entity_extractor.rb +114 -0
  104. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/regex_model_create_object.rb +57 -0
  105. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/regex_model_update_object.rb +57 -0
  106. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/sub_closed_list.rb +65 -0
  107. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/sub_closed_list_response.rb +70 -0
  108. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/task_update_object.rb +46 -0
  109. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/training_status.rb +17 -0
  110. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/user_access_list.rb +65 -0
  111. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/user_collaborator.rb +47 -0
  112. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/version_info.rb +177 -0
  113. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/word_list_base_update_object.rb +65 -0
  114. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/word_list_object.rb +65 -0
  115. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/module_definition.rb +9 -0
  116. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb +963 -0
  117. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/permissions.rb +427 -0
  118. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/settings.rb +237 -0
  119. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/train.rb +247 -0
  120. data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/versions.rb +854 -0
  121. data/lib/azure_cognitiveservices_luisauthoring.rb +6 -0
  122. data/lib/module_definition.rb +7 -0
  123. data/lib/profiles/latest/luisauthoring_latest_profile_client.rb +38 -0
  124. data/lib/profiles/latest/luisauthoring_module_definition.rb +8 -0
  125. data/lib/profiles/latest/modules/luisauthoring_profile_module.rb +497 -0
  126. data/lib/version.rb +7 -0
  127. metadata +244 -0
@@ -0,0 +1,508 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::CognitiveServices::LuisAuthoring::V2_0
7
+ #
8
+ # Examples
9
+ #
10
+ class Examples
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Examples class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [LuisAuthoringClient] reference to the LuisAuthoringClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Adds a labeled example to the application.
26
+ #
27
+ # @param app_id The application ID.
28
+ # @param version_id [String] The version ID.
29
+ # @param example_label_object [ExampleLabelObject] An example label with the
30
+ # expected intent and entities.
31
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
+ # will be added to the HTTP request.
33
+ #
34
+ # @return [LabelExampleResponse] operation results.
35
+ #
36
+ def add(app_id, version_id, example_label_object, custom_headers:nil)
37
+ response = add_async(app_id, version_id, example_label_object, custom_headers:custom_headers).value!
38
+ response.body unless response.nil?
39
+ end
40
+
41
+ #
42
+ # Adds a labeled example to the application.
43
+ #
44
+ # @param app_id The application ID.
45
+ # @param version_id [String] The version ID.
46
+ # @param example_label_object [ExampleLabelObject] An example label with the
47
+ # expected intent and entities.
48
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
49
+ # will be added to the HTTP request.
50
+ #
51
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
52
+ #
53
+ def add_with_http_info(app_id, version_id, example_label_object, custom_headers:nil)
54
+ add_async(app_id, version_id, example_label_object, custom_headers:custom_headers).value!
55
+ end
56
+
57
+ #
58
+ # Adds a labeled example to the application.
59
+ #
60
+ # @param app_id The application ID.
61
+ # @param version_id [String] The version ID.
62
+ # @param example_label_object [ExampleLabelObject] An example label with the
63
+ # expected intent and entities.
64
+ # @param [Hash{String => String}] A hash of custom headers that will be added
65
+ # to the HTTP request.
66
+ #
67
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
68
+ #
69
+ def add_async(app_id, version_id, example_label_object, custom_headers:nil)
70
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
71
+ fail ArgumentError, 'app_id is nil' if app_id.nil?
72
+ fail ArgumentError, 'version_id is nil' if version_id.nil?
73
+ fail ArgumentError, 'example_label_object is nil' if example_label_object.nil?
74
+
75
+
76
+ request_headers = {}
77
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
78
+
79
+ # Set Headers
80
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
81
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
82
+
83
+ # Serialize Request
84
+ request_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::ExampleLabelObject.mapper()
85
+ request_content = @client.serialize(request_mapper, example_label_object)
86
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
87
+
88
+ path_template = 'apps/{appId}/versions/{versionId}/example'
89
+
90
+ request_url = @base_url || @client.base_url
91
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
92
+
93
+ options = {
94
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
95
+ path_params: {'appId' => app_id,'versionId' => version_id},
96
+ body: request_content,
97
+ headers: request_headers.merge(custom_headers || {}),
98
+ base_url: request_url
99
+ }
100
+ promise = @client.make_request_async(:post, path_template, options)
101
+
102
+ promise = promise.then do |result|
103
+ http_response = result.response
104
+ status_code = http_response.status
105
+ response_content = http_response.body
106
+ unless status_code == 201
107
+ error_model = JSON.load(response_content)
108
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
109
+ end
110
+
111
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
112
+ # Deserialize Response
113
+ if status_code == 201
114
+ begin
115
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
116
+ result_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::LabelExampleResponse.mapper()
117
+ result.body = @client.deserialize(result_mapper, parsed_response)
118
+ rescue Exception => e
119
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
120
+ end
121
+ end
122
+
123
+ result
124
+ end
125
+
126
+ promise.execute
127
+ end
128
+
129
+ #
130
+ # Adds a batch of labeled examples to the application.
131
+ #
132
+ # @param app_id The application ID.
133
+ # @param version_id [String] The version ID.
134
+ # @param example_label_object_array [Array<ExampleLabelObject>] Array of
135
+ # examples.
136
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
137
+ # will be added to the HTTP request.
138
+ #
139
+ # @return [Array] operation results.
140
+ #
141
+ def batch(app_id, version_id, example_label_object_array, custom_headers:nil)
142
+ response = batch_async(app_id, version_id, example_label_object_array, custom_headers:custom_headers).value!
143
+ response.body unless response.nil?
144
+ end
145
+
146
+ #
147
+ # Adds a batch of labeled examples to the application.
148
+ #
149
+ # @param app_id The application ID.
150
+ # @param version_id [String] The version ID.
151
+ # @param example_label_object_array [Array<ExampleLabelObject>] Array of
152
+ # examples.
153
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
154
+ # will be added to the HTTP request.
155
+ #
156
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
157
+ #
158
+ def batch_with_http_info(app_id, version_id, example_label_object_array, custom_headers:nil)
159
+ batch_async(app_id, version_id, example_label_object_array, custom_headers:custom_headers).value!
160
+ end
161
+
162
+ #
163
+ # Adds a batch of labeled examples to the application.
164
+ #
165
+ # @param app_id The application ID.
166
+ # @param version_id [String] The version ID.
167
+ # @param example_label_object_array [Array<ExampleLabelObject>] Array of
168
+ # examples.
169
+ # @param [Hash{String => String}] A hash of custom headers that will be added
170
+ # to the HTTP request.
171
+ #
172
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
173
+ #
174
+ def batch_async(app_id, version_id, example_label_object_array, custom_headers:nil)
175
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
176
+ fail ArgumentError, 'app_id is nil' if app_id.nil?
177
+ fail ArgumentError, 'version_id is nil' if version_id.nil?
178
+ fail ArgumentError, 'example_label_object_array is nil' if example_label_object_array.nil?
179
+
180
+
181
+ request_headers = {}
182
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
183
+
184
+ # Set Headers
185
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
186
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
187
+
188
+ # Serialize Request
189
+ request_mapper = {
190
+ client_side_validation: true,
191
+ required: true,
192
+ serialized_name: 'exampleLabelObjectArray',
193
+ type: {
194
+ name: 'Sequence',
195
+ element: {
196
+ client_side_validation: true,
197
+ required: false,
198
+ serialized_name: 'ExampleLabelObjectElementType',
199
+ type: {
200
+ name: 'Composite',
201
+ class_name: 'ExampleLabelObject'
202
+ }
203
+ }
204
+ }
205
+ }
206
+ request_content = @client.serialize(request_mapper, example_label_object_array)
207
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
208
+
209
+ path_template = 'apps/{appId}/versions/{versionId}/examples'
210
+
211
+ request_url = @base_url || @client.base_url
212
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
213
+
214
+ options = {
215
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
216
+ path_params: {'appId' => app_id,'versionId' => version_id},
217
+ body: request_content,
218
+ headers: request_headers.merge(custom_headers || {}),
219
+ base_url: request_url
220
+ }
221
+ promise = @client.make_request_async(:post, path_template, options)
222
+
223
+ promise = promise.then do |result|
224
+ http_response = result.response
225
+ status_code = http_response.status
226
+ response_content = http_response.body
227
+ unless status_code == 201 || status_code == 207
228
+ error_model = JSON.load(response_content)
229
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
230
+ end
231
+
232
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
233
+ # Deserialize Response
234
+ if status_code == 201
235
+ begin
236
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
237
+ result_mapper = {
238
+ client_side_validation: true,
239
+ required: false,
240
+ serialized_name: 'parsed_response',
241
+ type: {
242
+ name: 'Sequence',
243
+ element: {
244
+ client_side_validation: true,
245
+ required: false,
246
+ serialized_name: 'BatchLabelExampleElementType',
247
+ type: {
248
+ name: 'Composite',
249
+ class_name: 'BatchLabelExample'
250
+ }
251
+ }
252
+ }
253
+ }
254
+ result.body = @client.deserialize(result_mapper, parsed_response)
255
+ rescue Exception => e
256
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
257
+ end
258
+ end
259
+ # Deserialize Response
260
+ if status_code == 207
261
+ begin
262
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
263
+ result_mapper = {
264
+ client_side_validation: true,
265
+ required: false,
266
+ serialized_name: 'parsed_response',
267
+ type: {
268
+ name: 'Sequence',
269
+ element: {
270
+ client_side_validation: true,
271
+ required: false,
272
+ serialized_name: 'BatchLabelExampleElementType',
273
+ type: {
274
+ name: 'Composite',
275
+ class_name: 'BatchLabelExample'
276
+ }
277
+ }
278
+ }
279
+ }
280
+ result.body = @client.deserialize(result_mapper, parsed_response)
281
+ rescue Exception => e
282
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
283
+ end
284
+ end
285
+
286
+ result
287
+ end
288
+
289
+ promise.execute
290
+ end
291
+
292
+ #
293
+ # Returns examples to be reviewed.
294
+ #
295
+ # @param app_id The application ID.
296
+ # @param version_id [String] The version ID.
297
+ # @param skip [Integer] The number of entries to skip. Default value is 0.
298
+ # @param take [Integer] The number of entries to return. Maximum page size is
299
+ # 500. Default is 100.
300
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
301
+ # will be added to the HTTP request.
302
+ #
303
+ # @return [Array] operation results.
304
+ #
305
+ def list(app_id, version_id, skip:0, take:100, custom_headers:nil)
306
+ response = list_async(app_id, version_id, skip:skip, take:take, custom_headers:custom_headers).value!
307
+ response.body unless response.nil?
308
+ end
309
+
310
+ #
311
+ # Returns examples to be reviewed.
312
+ #
313
+ # @param app_id The application ID.
314
+ # @param version_id [String] The version ID.
315
+ # @param skip [Integer] The number of entries to skip. Default value is 0.
316
+ # @param take [Integer] The number of entries to return. Maximum page size is
317
+ # 500. Default is 100.
318
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
319
+ # will be added to the HTTP request.
320
+ #
321
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
322
+ #
323
+ def list_with_http_info(app_id, version_id, skip:0, take:100, custom_headers:nil)
324
+ list_async(app_id, version_id, skip:skip, take:take, custom_headers:custom_headers).value!
325
+ end
326
+
327
+ #
328
+ # Returns examples to be reviewed.
329
+ #
330
+ # @param app_id The application ID.
331
+ # @param version_id [String] The version ID.
332
+ # @param skip [Integer] The number of entries to skip. Default value is 0.
333
+ # @param take [Integer] The number of entries to return. Maximum page size is
334
+ # 500. Default is 100.
335
+ # @param [Hash{String => String}] A hash of custom headers that will be added
336
+ # to the HTTP request.
337
+ #
338
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
339
+ #
340
+ def list_async(app_id, version_id, skip:0, take:100, custom_headers:nil)
341
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
342
+ fail ArgumentError, 'app_id is nil' if app_id.nil?
343
+ fail ArgumentError, 'version_id is nil' if version_id.nil?
344
+ fail ArgumentError, "'skip' should satisfy the constraint - 'InclusiveMinimum': '0'" if !skip.nil? && skip < 0
345
+ fail ArgumentError, "'take' should satisfy the constraint - 'InclusiveMaximum': '500'" if !take.nil? && take > 500
346
+ fail ArgumentError, "'take' should satisfy the constraint - 'InclusiveMinimum': '0'" if !take.nil? && take < 0
347
+
348
+
349
+ request_headers = {}
350
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
351
+
352
+ # Set Headers
353
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
354
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
355
+ path_template = 'apps/{appId}/versions/{versionId}/examples'
356
+
357
+ request_url = @base_url || @client.base_url
358
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
359
+
360
+ options = {
361
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
362
+ path_params: {'appId' => app_id,'versionId' => version_id},
363
+ query_params: {'skip' => skip,'take' => take},
364
+ headers: request_headers.merge(custom_headers || {}),
365
+ base_url: request_url
366
+ }
367
+ promise = @client.make_request_async(:get, path_template, options)
368
+
369
+ promise = promise.then do |result|
370
+ http_response = result.response
371
+ status_code = http_response.status
372
+ response_content = http_response.body
373
+ unless status_code == 200
374
+ error_model = JSON.load(response_content)
375
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
376
+ end
377
+
378
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
379
+ # Deserialize Response
380
+ if status_code == 200
381
+ begin
382
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
383
+ result_mapper = {
384
+ client_side_validation: true,
385
+ required: false,
386
+ serialized_name: 'parsed_response',
387
+ type: {
388
+ name: 'Sequence',
389
+ element: {
390
+ client_side_validation: true,
391
+ required: false,
392
+ serialized_name: 'LabeledUtteranceElementType',
393
+ type: {
394
+ name: 'Composite',
395
+ class_name: 'LabeledUtterance'
396
+ }
397
+ }
398
+ }
399
+ }
400
+ result.body = @client.deserialize(result_mapper, parsed_response)
401
+ rescue Exception => e
402
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
403
+ end
404
+ end
405
+
406
+ result
407
+ end
408
+
409
+ promise.execute
410
+ end
411
+
412
+ #
413
+ # Deletes the labeled example with the specified ID.
414
+ #
415
+ # @param app_id The application ID.
416
+ # @param version_id [String] The version ID.
417
+ # @param example_id [Integer] The example ID.
418
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
419
+ # will be added to the HTTP request.
420
+ #
421
+ # @return [OperationStatus] operation results.
422
+ #
423
+ def delete(app_id, version_id, example_id, custom_headers:nil)
424
+ response = delete_async(app_id, version_id, example_id, custom_headers:custom_headers).value!
425
+ response.body unless response.nil?
426
+ end
427
+
428
+ #
429
+ # Deletes the labeled example with the specified ID.
430
+ #
431
+ # @param app_id The application ID.
432
+ # @param version_id [String] The version ID.
433
+ # @param example_id [Integer] The example ID.
434
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
435
+ # will be added to the HTTP request.
436
+ #
437
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
438
+ #
439
+ def delete_with_http_info(app_id, version_id, example_id, custom_headers:nil)
440
+ delete_async(app_id, version_id, example_id, custom_headers:custom_headers).value!
441
+ end
442
+
443
+ #
444
+ # Deletes the labeled example with the specified ID.
445
+ #
446
+ # @param app_id The application ID.
447
+ # @param version_id [String] The version ID.
448
+ # @param example_id [Integer] The example ID.
449
+ # @param [Hash{String => String}] A hash of custom headers that will be added
450
+ # to the HTTP request.
451
+ #
452
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
453
+ #
454
+ def delete_async(app_id, version_id, example_id, custom_headers:nil)
455
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
456
+ fail ArgumentError, 'app_id is nil' if app_id.nil?
457
+ fail ArgumentError, 'version_id is nil' if version_id.nil?
458
+ fail ArgumentError, 'example_id is nil' if example_id.nil?
459
+
460
+
461
+ request_headers = {}
462
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
463
+
464
+ # Set Headers
465
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
466
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
467
+ path_template = 'apps/{appId}/versions/{versionId}/examples/{exampleId}'
468
+
469
+ request_url = @base_url || @client.base_url
470
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
471
+
472
+ options = {
473
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
474
+ path_params: {'appId' => app_id,'versionId' => version_id,'exampleId' => example_id},
475
+ headers: request_headers.merge(custom_headers || {}),
476
+ base_url: request_url
477
+ }
478
+ promise = @client.make_request_async(:delete, path_template, options)
479
+
480
+ promise = promise.then do |result|
481
+ http_response = result.response
482
+ status_code = http_response.status
483
+ response_content = http_response.body
484
+ unless status_code == 200
485
+ error_model = JSON.load(response_content)
486
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
487
+ end
488
+
489
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
490
+ # Deserialize Response
491
+ if status_code == 200
492
+ begin
493
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
494
+ result_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::OperationStatus.mapper()
495
+ result.body = @client.deserialize(result_mapper, parsed_response)
496
+ rescue Exception => e
497
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
498
+ end
499
+ end
500
+
501
+ result
502
+ end
503
+
504
+ promise.execute
505
+ end
506
+
507
+ end
508
+ end