azure_cognitiveservices_luisauthoring 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring.rb +142 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/apps.rb +2212 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/azure_accounts.rb +453 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/examples.rb +508 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/features.rb +668 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/luis_authoring_client.rb +167 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/model.rb +11482 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/app_version_setting_object.rb +57 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/application_create_object.rb +106 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/application_info_response.rb +158 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/application_publish_object.rb +59 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/application_setting_update_object.rb +47 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/application_settings.rb +58 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/application_update_object.rb +57 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/available_culture.rb +57 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/available_prebuilt_entity_model.rb +68 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/azure_account_info_object.rb +68 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/batch_label_example.rb +70 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/child_entity.rb +57 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/closed_list.rb +85 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/closed_list_entity_extractor.rb +123 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/closed_list_model_create_object.rb +66 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/closed_list_model_patch_object.rb +55 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/closed_list_model_update_object.rb +66 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/collaborators_array.rb +55 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/composite_child_model_create_object.rb +47 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/composite_entity_extractor.rb +123 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/composite_entity_model.rb +65 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/custom_prebuilt_model.rb +125 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/endpoint_info.rb +125 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/enqueue_training_response.rb +58 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/entities_suggestion_example.rb +106 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/entity_extractor.rb +125 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/entity_label.rb +71 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/entity_label_object.rb +71 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/entity_model_info.rb +87 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/entity_prediction.rb +81 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/entity_role.rb +57 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/entity_role_create_object.rb +46 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/entity_role_update_object.rb +46 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/error_response.rb +65 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/example_label_object.rb +78 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/explicit_list_item.rb +57 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/explicit_list_item_create_object.rb +46 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/explicit_list_item_update_object.rb +46 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/feature_info_object.rb +68 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/features_response_object.rb +75 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/hierarchical_child_entity.rb +77 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/hierarchical_child_model_create_object.rb +47 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/hierarchical_child_model_update_object.rb +47 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/hierarchical_entity_extractor.rb +123 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/hierarchical_entity_model.rb +65 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/hierarchical_model.rb +97 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/intent_classifier.rb +89 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/intent_prediction.rb +57 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/intents_suggestion_example.rb +106 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/jsonentity.rb +70 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/jsonmodel_feature.rb +90 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/jsonregex_feature.rb +68 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/jsonutterance.rb +77 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/label_example_response.rb +57 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/label_text_object.rb +57 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/labeled_utterance.rb +148 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/luis_app.rb +318 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/model_create_object.rb +46 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/model_info.rb +83 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/model_info_response.rb +196 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/model_training_details.rb +91 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/model_training_info.rb +58 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/model_update_object.rb +46 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/operation_error.rb +57 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/operation_status.rb +58 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/operation_status_type.rb +17 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/pattern_any.rb +84 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/pattern_any_entity_extractor.rb +123 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/pattern_any_model_create_object.rb +65 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/pattern_any_model_update_object.rb +65 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/pattern_create_object.rb +57 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/pattern_feature_info.rb +70 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/pattern_rule.rb +57 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/pattern_rule_create_object.rb +57 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/pattern_rule_info.rb +68 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/pattern_rule_update_object.rb +68 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/pattern_update_object.rb +70 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/personal_assistants_response.rb +74 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/phrase_list_feature_info.rb +91 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/phraselist_create_object.rb +81 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/phraselist_update_object.rb +94 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/prebuilt_domain.rb +119 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/prebuilt_domain_create_base_object.rb +47 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/prebuilt_domain_create_object.rb +58 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/prebuilt_domain_item.rb +69 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/prebuilt_domain_model_create_object.rb +58 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/prebuilt_domain_object.rb +58 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/prebuilt_entity.rb +65 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/prebuilt_entity_extractor.rb +103 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/production_or_staging_endpoint_info.rb +100 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/publish_setting_update_object.rb +71 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/publish_settings.rb +82 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/regex_entity.rb +76 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/regex_entity_extractor.rb +114 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/regex_model_create_object.rb +57 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/regex_model_update_object.rb +57 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/sub_closed_list.rb +65 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/sub_closed_list_response.rb +70 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/task_update_object.rb +46 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/training_status.rb +17 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/user_access_list.rb +65 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/user_collaborator.rb +47 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/version_info.rb +177 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/word_list_base_update_object.rb +65 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/models/word_list_object.rb +65 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/module_definition.rb +9 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb +963 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/permissions.rb +427 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/settings.rb +237 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/train.rb +247 -0
- data/lib/2.0/generated/azure_cognitiveservices_luisauthoring/versions.rb +854 -0
- data/lib/azure_cognitiveservices_luisauthoring.rb +6 -0
- data/lib/module_definition.rb +7 -0
- data/lib/profiles/latest/luisauthoring_latest_profile_client.rb +38 -0
- data/lib/profiles/latest/luisauthoring_module_definition.rb +8 -0
- data/lib/profiles/latest/modules/luisauthoring_profile_module.rb +497 -0
- data/lib/version.rb +7 -0
- metadata +244 -0
@@ -0,0 +1,247 @@
|
|
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
|
+
# Train
|
9
|
+
#
|
10
|
+
class Train
|
11
|
+
include MsRestAzure
|
12
|
+
|
13
|
+
#
|
14
|
+
# Creates and initializes a new instance of the Train 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
|
+
# Sends a training request for a version of a specified LUIS app. This POST
|
26
|
+
# request initiates a request asynchronously. To determine whether the training
|
27
|
+
# request is successful, submit a GET request to get training status. Note: The
|
28
|
+
# application version is not fully trained unless all the models (intents and
|
29
|
+
# entities) are trained successfully or are up to date. To verify training
|
30
|
+
# success, get the training status at least once after training is complete.
|
31
|
+
#
|
32
|
+
# @param app_id The application ID.
|
33
|
+
# @param version_id [String] The version ID.
|
34
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
35
|
+
# will be added to the HTTP request.
|
36
|
+
#
|
37
|
+
# @return [EnqueueTrainingResponse] operation results.
|
38
|
+
#
|
39
|
+
def train_version(app_id, version_id, custom_headers:nil)
|
40
|
+
response = train_version_async(app_id, version_id, custom_headers:custom_headers).value!
|
41
|
+
response.body unless response.nil?
|
42
|
+
end
|
43
|
+
|
44
|
+
#
|
45
|
+
# Sends a training request for a version of a specified LUIS app. This POST
|
46
|
+
# request initiates a request asynchronously. To determine whether the training
|
47
|
+
# request is successful, submit a GET request to get training status. Note: The
|
48
|
+
# application version is not fully trained unless all the models (intents and
|
49
|
+
# entities) are trained successfully or are up to date. To verify training
|
50
|
+
# success, get the training status at least once after training is complete.
|
51
|
+
#
|
52
|
+
# @param app_id The application ID.
|
53
|
+
# @param version_id [String] The version ID.
|
54
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
55
|
+
# will be added to the HTTP request.
|
56
|
+
#
|
57
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
58
|
+
#
|
59
|
+
def train_version_with_http_info(app_id, version_id, custom_headers:nil)
|
60
|
+
train_version_async(app_id, version_id, custom_headers:custom_headers).value!
|
61
|
+
end
|
62
|
+
|
63
|
+
#
|
64
|
+
# Sends a training request for a version of a specified LUIS app. This POST
|
65
|
+
# request initiates a request asynchronously. To determine whether the training
|
66
|
+
# request is successful, submit a GET request to get training status. Note: The
|
67
|
+
# application version is not fully trained unless all the models (intents and
|
68
|
+
# entities) are trained successfully or are up to date. To verify training
|
69
|
+
# success, get the training status at least once after training is complete.
|
70
|
+
#
|
71
|
+
# @param app_id The application ID.
|
72
|
+
# @param version_id [String] The version ID.
|
73
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
74
|
+
# to the HTTP request.
|
75
|
+
#
|
76
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
77
|
+
#
|
78
|
+
def train_version_async(app_id, version_id, custom_headers:nil)
|
79
|
+
fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
|
80
|
+
fail ArgumentError, 'app_id is nil' if app_id.nil?
|
81
|
+
fail ArgumentError, 'version_id is nil' if version_id.nil?
|
82
|
+
|
83
|
+
|
84
|
+
request_headers = {}
|
85
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
86
|
+
|
87
|
+
# Set Headers
|
88
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
89
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
90
|
+
path_template = 'apps/{appId}/versions/{versionId}/train'
|
91
|
+
|
92
|
+
request_url = @base_url || @client.base_url
|
93
|
+
request_url = request_url.gsub('{Endpoint}', @client.endpoint)
|
94
|
+
|
95
|
+
options = {
|
96
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
97
|
+
path_params: {'appId' => app_id,'versionId' => version_id},
|
98
|
+
headers: request_headers.merge(custom_headers || {}),
|
99
|
+
base_url: request_url
|
100
|
+
}
|
101
|
+
promise = @client.make_request_async(:post, path_template, options)
|
102
|
+
|
103
|
+
promise = promise.then do |result|
|
104
|
+
http_response = result.response
|
105
|
+
status_code = http_response.status
|
106
|
+
response_content = http_response.body
|
107
|
+
unless status_code == 202
|
108
|
+
error_model = JSON.load(response_content)
|
109
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
110
|
+
end
|
111
|
+
|
112
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
113
|
+
# Deserialize Response
|
114
|
+
if status_code == 202
|
115
|
+
begin
|
116
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
117
|
+
result_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::EnqueueTrainingResponse.mapper()
|
118
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
119
|
+
rescue Exception => e
|
120
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
result
|
125
|
+
end
|
126
|
+
|
127
|
+
promise.execute
|
128
|
+
end
|
129
|
+
|
130
|
+
#
|
131
|
+
# Gets the training status of all models (intents and entities) for the
|
132
|
+
# specified LUIS app. You must call the train API to train the LUIS app before
|
133
|
+
# you call this API to get training status. "appID" specifies the LUIS app ID.
|
134
|
+
# "versionId" specifies the version number of the LUIS app. For example, "0.1".
|
135
|
+
#
|
136
|
+
# @param app_id The application ID.
|
137
|
+
# @param version_id [String] The version ID.
|
138
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
139
|
+
# will be added to the HTTP request.
|
140
|
+
#
|
141
|
+
# @return [Array] operation results.
|
142
|
+
#
|
143
|
+
def get_status(app_id, version_id, custom_headers:nil)
|
144
|
+
response = get_status_async(app_id, version_id, custom_headers:custom_headers).value!
|
145
|
+
response.body unless response.nil?
|
146
|
+
end
|
147
|
+
|
148
|
+
#
|
149
|
+
# Gets the training status of all models (intents and entities) for the
|
150
|
+
# specified LUIS app. You must call the train API to train the LUIS app before
|
151
|
+
# you call this API to get training status. "appID" specifies the LUIS app ID.
|
152
|
+
# "versionId" specifies the version number of the LUIS app. For example, "0.1".
|
153
|
+
#
|
154
|
+
# @param app_id The application ID.
|
155
|
+
# @param version_id [String] The version ID.
|
156
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
157
|
+
# will be added to the HTTP request.
|
158
|
+
#
|
159
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
160
|
+
#
|
161
|
+
def get_status_with_http_info(app_id, version_id, custom_headers:nil)
|
162
|
+
get_status_async(app_id, version_id, custom_headers:custom_headers).value!
|
163
|
+
end
|
164
|
+
|
165
|
+
#
|
166
|
+
# Gets the training status of all models (intents and entities) for the
|
167
|
+
# specified LUIS app. You must call the train API to train the LUIS app before
|
168
|
+
# you call this API to get training status. "appID" specifies the LUIS app ID.
|
169
|
+
# "versionId" specifies the version number of the LUIS app. For example, "0.1".
|
170
|
+
#
|
171
|
+
# @param app_id The application ID.
|
172
|
+
# @param version_id [String] The version ID.
|
173
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
174
|
+
# to the HTTP request.
|
175
|
+
#
|
176
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
177
|
+
#
|
178
|
+
def get_status_async(app_id, version_id, custom_headers:nil)
|
179
|
+
fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
|
180
|
+
fail ArgumentError, 'app_id is nil' if app_id.nil?
|
181
|
+
fail ArgumentError, 'version_id is nil' if version_id.nil?
|
182
|
+
|
183
|
+
|
184
|
+
request_headers = {}
|
185
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
186
|
+
|
187
|
+
# Set Headers
|
188
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
189
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
190
|
+
path_template = 'apps/{appId}/versions/{versionId}/train'
|
191
|
+
|
192
|
+
request_url = @base_url || @client.base_url
|
193
|
+
request_url = request_url.gsub('{Endpoint}', @client.endpoint)
|
194
|
+
|
195
|
+
options = {
|
196
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
197
|
+
path_params: {'appId' => app_id,'versionId' => version_id},
|
198
|
+
headers: request_headers.merge(custom_headers || {}),
|
199
|
+
base_url: request_url
|
200
|
+
}
|
201
|
+
promise = @client.make_request_async(:get, path_template, options)
|
202
|
+
|
203
|
+
promise = promise.then do |result|
|
204
|
+
http_response = result.response
|
205
|
+
status_code = http_response.status
|
206
|
+
response_content = http_response.body
|
207
|
+
unless status_code == 200
|
208
|
+
error_model = JSON.load(response_content)
|
209
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
210
|
+
end
|
211
|
+
|
212
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
213
|
+
# Deserialize Response
|
214
|
+
if status_code == 200
|
215
|
+
begin
|
216
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
217
|
+
result_mapper = {
|
218
|
+
client_side_validation: true,
|
219
|
+
required: false,
|
220
|
+
serialized_name: 'parsed_response',
|
221
|
+
type: {
|
222
|
+
name: 'Sequence',
|
223
|
+
element: {
|
224
|
+
client_side_validation: true,
|
225
|
+
required: false,
|
226
|
+
serialized_name: 'ModelTrainingInfoElementType',
|
227
|
+
type: {
|
228
|
+
name: 'Composite',
|
229
|
+
class_name: 'ModelTrainingInfo'
|
230
|
+
}
|
231
|
+
}
|
232
|
+
}
|
233
|
+
}
|
234
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
235
|
+
rescue Exception => e
|
236
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
result
|
241
|
+
end
|
242
|
+
|
243
|
+
promise.execute
|
244
|
+
end
|
245
|
+
|
246
|
+
end
|
247
|
+
end
|
@@ -0,0 +1,854 @@
|
|
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
|
+
# Versions
|
9
|
+
#
|
10
|
+
class Versions
|
11
|
+
include MsRestAzure
|
12
|
+
|
13
|
+
#
|
14
|
+
# Creates and initializes a new instance of the Versions 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
|
+
# Creates a new version using the current snapshot of the selected application
|
26
|
+
# version.
|
27
|
+
#
|
28
|
+
# @param app_id The application ID.
|
29
|
+
# @param version_id [String] The version ID.
|
30
|
+
# @param version_clone_object [TaskUpdateObject] A model containing the new
|
31
|
+
# version ID.
|
32
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
33
|
+
# will be added to the HTTP request.
|
34
|
+
#
|
35
|
+
# @return [String] operation results.
|
36
|
+
#
|
37
|
+
def clone(app_id, version_id, version_clone_object:nil, custom_headers:nil)
|
38
|
+
response = clone_async(app_id, version_id, version_clone_object:version_clone_object, custom_headers:custom_headers).value!
|
39
|
+
response.body unless response.nil?
|
40
|
+
end
|
41
|
+
|
42
|
+
#
|
43
|
+
# Creates a new version using the current snapshot of the selected application
|
44
|
+
# version.
|
45
|
+
#
|
46
|
+
# @param app_id The application ID.
|
47
|
+
# @param version_id [String] The version ID.
|
48
|
+
# @param version_clone_object [TaskUpdateObject] A model containing the new
|
49
|
+
# version ID.
|
50
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
51
|
+
# will be added to the HTTP request.
|
52
|
+
#
|
53
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
54
|
+
#
|
55
|
+
def clone_with_http_info(app_id, version_id, version_clone_object:nil, custom_headers:nil)
|
56
|
+
clone_async(app_id, version_id, version_clone_object:version_clone_object, custom_headers:custom_headers).value!
|
57
|
+
end
|
58
|
+
|
59
|
+
#
|
60
|
+
# Creates a new version using the current snapshot of the selected application
|
61
|
+
# version.
|
62
|
+
#
|
63
|
+
# @param app_id The application ID.
|
64
|
+
# @param version_id [String] The version ID.
|
65
|
+
# @param version_clone_object [TaskUpdateObject] A model containing the new
|
66
|
+
# version ID.
|
67
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
68
|
+
# to the HTTP request.
|
69
|
+
#
|
70
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
71
|
+
#
|
72
|
+
def clone_async(app_id, version_id, version_clone_object:nil, custom_headers:nil)
|
73
|
+
fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
|
74
|
+
fail ArgumentError, 'app_id is nil' if app_id.nil?
|
75
|
+
fail ArgumentError, 'version_id is nil' if version_id.nil?
|
76
|
+
|
77
|
+
|
78
|
+
request_headers = {}
|
79
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
80
|
+
|
81
|
+
# Set Headers
|
82
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
83
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
84
|
+
|
85
|
+
# Serialize Request
|
86
|
+
request_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::TaskUpdateObject.mapper()
|
87
|
+
request_content = @client.serialize(request_mapper, version_clone_object)
|
88
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
89
|
+
|
90
|
+
path_template = 'apps/{appId}/versions/{versionId}/clone'
|
91
|
+
|
92
|
+
request_url = @base_url || @client.base_url
|
93
|
+
request_url = request_url.gsub('{Endpoint}', @client.endpoint)
|
94
|
+
|
95
|
+
options = {
|
96
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
97
|
+
path_params: {'appId' => app_id,'versionId' => version_id},
|
98
|
+
body: request_content,
|
99
|
+
headers: request_headers.merge(custom_headers || {}),
|
100
|
+
base_url: request_url
|
101
|
+
}
|
102
|
+
promise = @client.make_request_async(:post, path_template, options)
|
103
|
+
|
104
|
+
promise = promise.then do |result|
|
105
|
+
http_response = result.response
|
106
|
+
status_code = http_response.status
|
107
|
+
response_content = http_response.body
|
108
|
+
unless status_code == 201
|
109
|
+
error_model = JSON.load(response_content)
|
110
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
111
|
+
end
|
112
|
+
|
113
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
114
|
+
# Deserialize Response
|
115
|
+
if status_code == 201
|
116
|
+
begin
|
117
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
118
|
+
result_mapper = {
|
119
|
+
client_side_validation: true,
|
120
|
+
required: false,
|
121
|
+
serialized_name: 'parsed_response',
|
122
|
+
type: {
|
123
|
+
name: 'String'
|
124
|
+
}
|
125
|
+
}
|
126
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
127
|
+
rescue Exception => e
|
128
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
result
|
133
|
+
end
|
134
|
+
|
135
|
+
promise.execute
|
136
|
+
end
|
137
|
+
|
138
|
+
#
|
139
|
+
# Gets the application versions info.
|
140
|
+
#
|
141
|
+
# @param app_id The application ID.
|
142
|
+
# @param skip [Integer] The number of entries to skip. Default value is 0.
|
143
|
+
# @param take [Integer] The number of entries to return. Maximum page size is
|
144
|
+
# 500. Default is 100.
|
145
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
146
|
+
# will be added to the HTTP request.
|
147
|
+
#
|
148
|
+
# @return [Array] operation results.
|
149
|
+
#
|
150
|
+
def list(app_id, skip:0, take:100, custom_headers:nil)
|
151
|
+
response = list_async(app_id, skip:skip, take:take, custom_headers:custom_headers).value!
|
152
|
+
response.body unless response.nil?
|
153
|
+
end
|
154
|
+
|
155
|
+
#
|
156
|
+
# Gets the application versions info.
|
157
|
+
#
|
158
|
+
# @param app_id The application ID.
|
159
|
+
# @param skip [Integer] The number of entries to skip. Default value is 0.
|
160
|
+
# @param take [Integer] The number of entries to return. Maximum page size is
|
161
|
+
# 500. Default is 100.
|
162
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
163
|
+
# will be added to the HTTP request.
|
164
|
+
#
|
165
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
166
|
+
#
|
167
|
+
def list_with_http_info(app_id, skip:0, take:100, custom_headers:nil)
|
168
|
+
list_async(app_id, skip:skip, take:take, custom_headers:custom_headers).value!
|
169
|
+
end
|
170
|
+
|
171
|
+
#
|
172
|
+
# Gets the application versions info.
|
173
|
+
#
|
174
|
+
# @param app_id The application ID.
|
175
|
+
# @param skip [Integer] The number of entries to skip. Default value is 0.
|
176
|
+
# @param take [Integer] The number of entries to return. Maximum page size is
|
177
|
+
# 500. Default is 100.
|
178
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
179
|
+
# to the HTTP request.
|
180
|
+
#
|
181
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
182
|
+
#
|
183
|
+
def list_async(app_id, skip:0, take:100, custom_headers:nil)
|
184
|
+
fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
|
185
|
+
fail ArgumentError, 'app_id is nil' if app_id.nil?
|
186
|
+
fail ArgumentError, "'skip' should satisfy the constraint - 'InclusiveMinimum': '0'" if !skip.nil? && skip < 0
|
187
|
+
fail ArgumentError, "'take' should satisfy the constraint - 'InclusiveMaximum': '500'" if !take.nil? && take > 500
|
188
|
+
fail ArgumentError, "'take' should satisfy the constraint - 'InclusiveMinimum': '0'" if !take.nil? && take < 0
|
189
|
+
|
190
|
+
|
191
|
+
request_headers = {}
|
192
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
193
|
+
|
194
|
+
# Set Headers
|
195
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
196
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
197
|
+
path_template = 'apps/{appId}/versions'
|
198
|
+
|
199
|
+
request_url = @base_url || @client.base_url
|
200
|
+
request_url = request_url.gsub('{Endpoint}', @client.endpoint)
|
201
|
+
|
202
|
+
options = {
|
203
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
204
|
+
path_params: {'appId' => app_id},
|
205
|
+
query_params: {'skip' => skip,'take' => take},
|
206
|
+
headers: request_headers.merge(custom_headers || {}),
|
207
|
+
base_url: request_url
|
208
|
+
}
|
209
|
+
promise = @client.make_request_async(:get, path_template, options)
|
210
|
+
|
211
|
+
promise = promise.then do |result|
|
212
|
+
http_response = result.response
|
213
|
+
status_code = http_response.status
|
214
|
+
response_content = http_response.body
|
215
|
+
unless status_code == 200
|
216
|
+
error_model = JSON.load(response_content)
|
217
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
218
|
+
end
|
219
|
+
|
220
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
221
|
+
# Deserialize Response
|
222
|
+
if status_code == 200
|
223
|
+
begin
|
224
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
225
|
+
result_mapper = {
|
226
|
+
client_side_validation: true,
|
227
|
+
required: false,
|
228
|
+
serialized_name: 'parsed_response',
|
229
|
+
type: {
|
230
|
+
name: 'Sequence',
|
231
|
+
element: {
|
232
|
+
client_side_validation: true,
|
233
|
+
required: false,
|
234
|
+
serialized_name: 'VersionInfoElementType',
|
235
|
+
type: {
|
236
|
+
name: 'Composite',
|
237
|
+
class_name: 'VersionInfo'
|
238
|
+
}
|
239
|
+
}
|
240
|
+
}
|
241
|
+
}
|
242
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
243
|
+
rescue Exception => e
|
244
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
result
|
249
|
+
end
|
250
|
+
|
251
|
+
promise.execute
|
252
|
+
end
|
253
|
+
|
254
|
+
#
|
255
|
+
# Gets the version info.
|
256
|
+
#
|
257
|
+
# @param app_id The application ID.
|
258
|
+
# @param version_id [String] The version ID.
|
259
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
260
|
+
# will be added to the HTTP request.
|
261
|
+
#
|
262
|
+
# @return [VersionInfo] operation results.
|
263
|
+
#
|
264
|
+
def get(app_id, version_id, custom_headers:nil)
|
265
|
+
response = get_async(app_id, version_id, custom_headers:custom_headers).value!
|
266
|
+
response.body unless response.nil?
|
267
|
+
end
|
268
|
+
|
269
|
+
#
|
270
|
+
# Gets the version info.
|
271
|
+
#
|
272
|
+
# @param app_id The application ID.
|
273
|
+
# @param version_id [String] The version ID.
|
274
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
275
|
+
# will be added to the HTTP request.
|
276
|
+
#
|
277
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
278
|
+
#
|
279
|
+
def get_with_http_info(app_id, version_id, custom_headers:nil)
|
280
|
+
get_async(app_id, version_id, custom_headers:custom_headers).value!
|
281
|
+
end
|
282
|
+
|
283
|
+
#
|
284
|
+
# Gets the version info.
|
285
|
+
#
|
286
|
+
# @param app_id The application ID.
|
287
|
+
# @param version_id [String] The version ID.
|
288
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
289
|
+
# to the HTTP request.
|
290
|
+
#
|
291
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
292
|
+
#
|
293
|
+
def get_async(app_id, version_id, custom_headers:nil)
|
294
|
+
fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
|
295
|
+
fail ArgumentError, 'app_id is nil' if app_id.nil?
|
296
|
+
fail ArgumentError, 'version_id is nil' if version_id.nil?
|
297
|
+
|
298
|
+
|
299
|
+
request_headers = {}
|
300
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
301
|
+
|
302
|
+
# Set Headers
|
303
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
304
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
305
|
+
path_template = 'apps/{appId}/versions/{versionId}/'
|
306
|
+
|
307
|
+
request_url = @base_url || @client.base_url
|
308
|
+
request_url = request_url.gsub('{Endpoint}', @client.endpoint)
|
309
|
+
|
310
|
+
options = {
|
311
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
312
|
+
path_params: {'appId' => app_id,'versionId' => version_id},
|
313
|
+
headers: request_headers.merge(custom_headers || {}),
|
314
|
+
base_url: request_url
|
315
|
+
}
|
316
|
+
promise = @client.make_request_async(:get, path_template, options)
|
317
|
+
|
318
|
+
promise = promise.then do |result|
|
319
|
+
http_response = result.response
|
320
|
+
status_code = http_response.status
|
321
|
+
response_content = http_response.body
|
322
|
+
unless status_code == 200
|
323
|
+
error_model = JSON.load(response_content)
|
324
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
325
|
+
end
|
326
|
+
|
327
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
328
|
+
# Deserialize Response
|
329
|
+
if status_code == 200
|
330
|
+
begin
|
331
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
332
|
+
result_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::VersionInfo.mapper()
|
333
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
334
|
+
rescue Exception => e
|
335
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
336
|
+
end
|
337
|
+
end
|
338
|
+
|
339
|
+
result
|
340
|
+
end
|
341
|
+
|
342
|
+
promise.execute
|
343
|
+
end
|
344
|
+
|
345
|
+
#
|
346
|
+
# Updates the name or description of the application version.
|
347
|
+
#
|
348
|
+
# @param app_id The application ID.
|
349
|
+
# @param version_id [String] The version ID.
|
350
|
+
# @param version_update_object [TaskUpdateObject] A model containing Name and
|
351
|
+
# Description of the application.
|
352
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
353
|
+
# will be added to the HTTP request.
|
354
|
+
#
|
355
|
+
# @return [OperationStatus] operation results.
|
356
|
+
#
|
357
|
+
def update(app_id, version_id, version_update_object, custom_headers:nil)
|
358
|
+
response = update_async(app_id, version_id, version_update_object, custom_headers:custom_headers).value!
|
359
|
+
response.body unless response.nil?
|
360
|
+
end
|
361
|
+
|
362
|
+
#
|
363
|
+
# Updates the name or description of the application version.
|
364
|
+
#
|
365
|
+
# @param app_id The application ID.
|
366
|
+
# @param version_id [String] The version ID.
|
367
|
+
# @param version_update_object [TaskUpdateObject] A model containing Name and
|
368
|
+
# Description of the application.
|
369
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
370
|
+
# will be added to the HTTP request.
|
371
|
+
#
|
372
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
373
|
+
#
|
374
|
+
def update_with_http_info(app_id, version_id, version_update_object, custom_headers:nil)
|
375
|
+
update_async(app_id, version_id, version_update_object, custom_headers:custom_headers).value!
|
376
|
+
end
|
377
|
+
|
378
|
+
#
|
379
|
+
# Updates the name or description of the application version.
|
380
|
+
#
|
381
|
+
# @param app_id The application ID.
|
382
|
+
# @param version_id [String] The version ID.
|
383
|
+
# @param version_update_object [TaskUpdateObject] A model containing Name and
|
384
|
+
# Description of the application.
|
385
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
386
|
+
# to the HTTP request.
|
387
|
+
#
|
388
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
389
|
+
#
|
390
|
+
def update_async(app_id, version_id, version_update_object, custom_headers:nil)
|
391
|
+
fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
|
392
|
+
fail ArgumentError, 'app_id is nil' if app_id.nil?
|
393
|
+
fail ArgumentError, 'version_id is nil' if version_id.nil?
|
394
|
+
fail ArgumentError, 'version_update_object is nil' if version_update_object.nil?
|
395
|
+
|
396
|
+
|
397
|
+
request_headers = {}
|
398
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
399
|
+
|
400
|
+
# Set Headers
|
401
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
402
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
403
|
+
|
404
|
+
# Serialize Request
|
405
|
+
request_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::TaskUpdateObject.mapper()
|
406
|
+
request_content = @client.serialize(request_mapper, version_update_object)
|
407
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
408
|
+
|
409
|
+
path_template = 'apps/{appId}/versions/{versionId}/'
|
410
|
+
|
411
|
+
request_url = @base_url || @client.base_url
|
412
|
+
request_url = request_url.gsub('{Endpoint}', @client.endpoint)
|
413
|
+
|
414
|
+
options = {
|
415
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
416
|
+
path_params: {'appId' => app_id,'versionId' => version_id},
|
417
|
+
body: request_content,
|
418
|
+
headers: request_headers.merge(custom_headers || {}),
|
419
|
+
base_url: request_url
|
420
|
+
}
|
421
|
+
promise = @client.make_request_async(:put, path_template, options)
|
422
|
+
|
423
|
+
promise = promise.then do |result|
|
424
|
+
http_response = result.response
|
425
|
+
status_code = http_response.status
|
426
|
+
response_content = http_response.body
|
427
|
+
unless status_code == 200
|
428
|
+
error_model = JSON.load(response_content)
|
429
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
430
|
+
end
|
431
|
+
|
432
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
433
|
+
# Deserialize Response
|
434
|
+
if status_code == 200
|
435
|
+
begin
|
436
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
437
|
+
result_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::OperationStatus.mapper()
|
438
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
439
|
+
rescue Exception => e
|
440
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
441
|
+
end
|
442
|
+
end
|
443
|
+
|
444
|
+
result
|
445
|
+
end
|
446
|
+
|
447
|
+
promise.execute
|
448
|
+
end
|
449
|
+
|
450
|
+
#
|
451
|
+
# Deletes an application version.
|
452
|
+
#
|
453
|
+
# @param app_id The application ID.
|
454
|
+
# @param version_id [String] The version ID.
|
455
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
456
|
+
# will be added to the HTTP request.
|
457
|
+
#
|
458
|
+
# @return [OperationStatus] operation results.
|
459
|
+
#
|
460
|
+
def delete(app_id, version_id, custom_headers:nil)
|
461
|
+
response = delete_async(app_id, version_id, custom_headers:custom_headers).value!
|
462
|
+
response.body unless response.nil?
|
463
|
+
end
|
464
|
+
|
465
|
+
#
|
466
|
+
# Deletes an application version.
|
467
|
+
#
|
468
|
+
# @param app_id The application ID.
|
469
|
+
# @param version_id [String] The version ID.
|
470
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
471
|
+
# will be added to the HTTP request.
|
472
|
+
#
|
473
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
474
|
+
#
|
475
|
+
def delete_with_http_info(app_id, version_id, custom_headers:nil)
|
476
|
+
delete_async(app_id, version_id, custom_headers:custom_headers).value!
|
477
|
+
end
|
478
|
+
|
479
|
+
#
|
480
|
+
# Deletes an application version.
|
481
|
+
#
|
482
|
+
# @param app_id The application ID.
|
483
|
+
# @param version_id [String] The version ID.
|
484
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
485
|
+
# to the HTTP request.
|
486
|
+
#
|
487
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
488
|
+
#
|
489
|
+
def delete_async(app_id, version_id, custom_headers:nil)
|
490
|
+
fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
|
491
|
+
fail ArgumentError, 'app_id is nil' if app_id.nil?
|
492
|
+
fail ArgumentError, 'version_id is nil' if version_id.nil?
|
493
|
+
|
494
|
+
|
495
|
+
request_headers = {}
|
496
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
497
|
+
|
498
|
+
# Set Headers
|
499
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
500
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
501
|
+
path_template = 'apps/{appId}/versions/{versionId}/'
|
502
|
+
|
503
|
+
request_url = @base_url || @client.base_url
|
504
|
+
request_url = request_url.gsub('{Endpoint}', @client.endpoint)
|
505
|
+
|
506
|
+
options = {
|
507
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
508
|
+
path_params: {'appId' => app_id,'versionId' => version_id},
|
509
|
+
headers: request_headers.merge(custom_headers || {}),
|
510
|
+
base_url: request_url
|
511
|
+
}
|
512
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
513
|
+
|
514
|
+
promise = promise.then do |result|
|
515
|
+
http_response = result.response
|
516
|
+
status_code = http_response.status
|
517
|
+
response_content = http_response.body
|
518
|
+
unless status_code == 200
|
519
|
+
error_model = JSON.load(response_content)
|
520
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
521
|
+
end
|
522
|
+
|
523
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
524
|
+
# Deserialize Response
|
525
|
+
if status_code == 200
|
526
|
+
begin
|
527
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
528
|
+
result_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::OperationStatus.mapper()
|
529
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
530
|
+
rescue Exception => e
|
531
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
532
|
+
end
|
533
|
+
end
|
534
|
+
|
535
|
+
result
|
536
|
+
end
|
537
|
+
|
538
|
+
promise.execute
|
539
|
+
end
|
540
|
+
|
541
|
+
#
|
542
|
+
# Exports a LUIS application to JSON format.
|
543
|
+
#
|
544
|
+
# @param app_id The application ID.
|
545
|
+
# @param version_id [String] The version ID.
|
546
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
547
|
+
# will be added to the HTTP request.
|
548
|
+
#
|
549
|
+
# @return [LuisApp] operation results.
|
550
|
+
#
|
551
|
+
def export(app_id, version_id, custom_headers:nil)
|
552
|
+
response = export_async(app_id, version_id, custom_headers:custom_headers).value!
|
553
|
+
response.body unless response.nil?
|
554
|
+
end
|
555
|
+
|
556
|
+
#
|
557
|
+
# Exports a LUIS application to JSON format.
|
558
|
+
#
|
559
|
+
# @param app_id The application ID.
|
560
|
+
# @param version_id [String] The version ID.
|
561
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
562
|
+
# will be added to the HTTP request.
|
563
|
+
#
|
564
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
565
|
+
#
|
566
|
+
def export_with_http_info(app_id, version_id, custom_headers:nil)
|
567
|
+
export_async(app_id, version_id, custom_headers:custom_headers).value!
|
568
|
+
end
|
569
|
+
|
570
|
+
#
|
571
|
+
# Exports a LUIS application to JSON format.
|
572
|
+
#
|
573
|
+
# @param app_id The application ID.
|
574
|
+
# @param version_id [String] The version ID.
|
575
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
576
|
+
# to the HTTP request.
|
577
|
+
#
|
578
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
579
|
+
#
|
580
|
+
def export_async(app_id, version_id, custom_headers:nil)
|
581
|
+
fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
|
582
|
+
fail ArgumentError, 'app_id is nil' if app_id.nil?
|
583
|
+
fail ArgumentError, 'version_id is nil' if version_id.nil?
|
584
|
+
|
585
|
+
|
586
|
+
request_headers = {}
|
587
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
588
|
+
|
589
|
+
# Set Headers
|
590
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
591
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
592
|
+
path_template = 'apps/{appId}/versions/{versionId}/export'
|
593
|
+
|
594
|
+
request_url = @base_url || @client.base_url
|
595
|
+
request_url = request_url.gsub('{Endpoint}', @client.endpoint)
|
596
|
+
|
597
|
+
options = {
|
598
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
599
|
+
path_params: {'appId' => app_id,'versionId' => version_id},
|
600
|
+
headers: request_headers.merge(custom_headers || {}),
|
601
|
+
base_url: request_url
|
602
|
+
}
|
603
|
+
promise = @client.make_request_async(:get, path_template, options)
|
604
|
+
|
605
|
+
promise = promise.then do |result|
|
606
|
+
http_response = result.response
|
607
|
+
status_code = http_response.status
|
608
|
+
response_content = http_response.body
|
609
|
+
unless status_code == 200
|
610
|
+
error_model = JSON.load(response_content)
|
611
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
612
|
+
end
|
613
|
+
|
614
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
615
|
+
# Deserialize Response
|
616
|
+
if status_code == 200
|
617
|
+
begin
|
618
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
619
|
+
result_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::LuisApp.mapper()
|
620
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
621
|
+
rescue Exception => e
|
622
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
623
|
+
end
|
624
|
+
end
|
625
|
+
|
626
|
+
result
|
627
|
+
end
|
628
|
+
|
629
|
+
promise.execute
|
630
|
+
end
|
631
|
+
|
632
|
+
#
|
633
|
+
# Imports a new version into a LUIS application.
|
634
|
+
#
|
635
|
+
# @param app_id The application ID.
|
636
|
+
# @param luis_app [LuisApp] A LUIS application structure.
|
637
|
+
# @param version_id [String] The new versionId to import. If not specified, the
|
638
|
+
# versionId will be read from the imported object.
|
639
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
640
|
+
# will be added to the HTTP request.
|
641
|
+
#
|
642
|
+
# @return [String] operation results.
|
643
|
+
#
|
644
|
+
def import(app_id, luis_app, version_id:nil, custom_headers:nil)
|
645
|
+
response = import_async(app_id, luis_app, version_id:version_id, custom_headers:custom_headers).value!
|
646
|
+
response.body unless response.nil?
|
647
|
+
end
|
648
|
+
|
649
|
+
#
|
650
|
+
# Imports a new version into a LUIS application.
|
651
|
+
#
|
652
|
+
# @param app_id The application ID.
|
653
|
+
# @param luis_app [LuisApp] A LUIS application structure.
|
654
|
+
# @param version_id [String] The new versionId to import. If not specified, the
|
655
|
+
# versionId will be read from the imported object.
|
656
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
657
|
+
# will be added to the HTTP request.
|
658
|
+
#
|
659
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
660
|
+
#
|
661
|
+
def import_with_http_info(app_id, luis_app, version_id:nil, custom_headers:nil)
|
662
|
+
import_async(app_id, luis_app, version_id:version_id, custom_headers:custom_headers).value!
|
663
|
+
end
|
664
|
+
|
665
|
+
#
|
666
|
+
# Imports a new version into a LUIS application.
|
667
|
+
#
|
668
|
+
# @param app_id The application ID.
|
669
|
+
# @param luis_app [LuisApp] A LUIS application structure.
|
670
|
+
# @param version_id [String] The new versionId to import. If not specified, the
|
671
|
+
# versionId will be read from the imported object.
|
672
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
673
|
+
# to the HTTP request.
|
674
|
+
#
|
675
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
676
|
+
#
|
677
|
+
def import_async(app_id, luis_app, version_id:nil, custom_headers:nil)
|
678
|
+
fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
|
679
|
+
fail ArgumentError, 'app_id is nil' if app_id.nil?
|
680
|
+
fail ArgumentError, 'luis_app is nil' if luis_app.nil?
|
681
|
+
|
682
|
+
|
683
|
+
request_headers = {}
|
684
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
685
|
+
|
686
|
+
# Set Headers
|
687
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
688
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
689
|
+
|
690
|
+
# Serialize Request
|
691
|
+
request_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::LuisApp.mapper()
|
692
|
+
request_content = @client.serialize(request_mapper, luis_app)
|
693
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
694
|
+
|
695
|
+
path_template = 'apps/{appId}/versions/import'
|
696
|
+
|
697
|
+
request_url = @base_url || @client.base_url
|
698
|
+
request_url = request_url.gsub('{Endpoint}', @client.endpoint)
|
699
|
+
|
700
|
+
options = {
|
701
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
702
|
+
path_params: {'appId' => app_id},
|
703
|
+
query_params: {'versionId' => version_id},
|
704
|
+
body: request_content,
|
705
|
+
headers: request_headers.merge(custom_headers || {}),
|
706
|
+
base_url: request_url
|
707
|
+
}
|
708
|
+
promise = @client.make_request_async(:post, path_template, options)
|
709
|
+
|
710
|
+
promise = promise.then do |result|
|
711
|
+
http_response = result.response
|
712
|
+
status_code = http_response.status
|
713
|
+
response_content = http_response.body
|
714
|
+
unless status_code == 201
|
715
|
+
error_model = JSON.load(response_content)
|
716
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
717
|
+
end
|
718
|
+
|
719
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
720
|
+
# Deserialize Response
|
721
|
+
if status_code == 201
|
722
|
+
begin
|
723
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
724
|
+
result_mapper = {
|
725
|
+
client_side_validation: true,
|
726
|
+
required: false,
|
727
|
+
serialized_name: 'parsed_response',
|
728
|
+
type: {
|
729
|
+
name: 'String'
|
730
|
+
}
|
731
|
+
}
|
732
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
733
|
+
rescue Exception => e
|
734
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
735
|
+
end
|
736
|
+
end
|
737
|
+
|
738
|
+
result
|
739
|
+
end
|
740
|
+
|
741
|
+
promise.execute
|
742
|
+
end
|
743
|
+
|
744
|
+
#
|
745
|
+
# Deleted an unlabelled utterance.
|
746
|
+
#
|
747
|
+
# @param app_id The application ID.
|
748
|
+
# @param version_id [String] The version ID.
|
749
|
+
# @param utterance [String] The utterance text to delete.
|
750
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
751
|
+
# will be added to the HTTP request.
|
752
|
+
#
|
753
|
+
# @return [OperationStatus] operation results.
|
754
|
+
#
|
755
|
+
def delete_unlabelled_utterance(app_id, version_id, utterance, custom_headers:nil)
|
756
|
+
response = delete_unlabelled_utterance_async(app_id, version_id, utterance, custom_headers:custom_headers).value!
|
757
|
+
response.body unless response.nil?
|
758
|
+
end
|
759
|
+
|
760
|
+
#
|
761
|
+
# Deleted an unlabelled utterance.
|
762
|
+
#
|
763
|
+
# @param app_id The application ID.
|
764
|
+
# @param version_id [String] The version ID.
|
765
|
+
# @param utterance [String] The utterance text to delete.
|
766
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
767
|
+
# will be added to the HTTP request.
|
768
|
+
#
|
769
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
770
|
+
#
|
771
|
+
def delete_unlabelled_utterance_with_http_info(app_id, version_id, utterance, custom_headers:nil)
|
772
|
+
delete_unlabelled_utterance_async(app_id, version_id, utterance, custom_headers:custom_headers).value!
|
773
|
+
end
|
774
|
+
|
775
|
+
#
|
776
|
+
# Deleted an unlabelled utterance.
|
777
|
+
#
|
778
|
+
# @param app_id The application ID.
|
779
|
+
# @param version_id [String] The version ID.
|
780
|
+
# @param utterance [String] The utterance text to delete.
|
781
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
782
|
+
# to the HTTP request.
|
783
|
+
#
|
784
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
785
|
+
#
|
786
|
+
def delete_unlabelled_utterance_async(app_id, version_id, utterance, custom_headers:nil)
|
787
|
+
fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
|
788
|
+
fail ArgumentError, 'app_id is nil' if app_id.nil?
|
789
|
+
fail ArgumentError, 'version_id is nil' if version_id.nil?
|
790
|
+
fail ArgumentError, 'utterance is nil' if utterance.nil?
|
791
|
+
|
792
|
+
|
793
|
+
request_headers = {}
|
794
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
795
|
+
|
796
|
+
# Set Headers
|
797
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
798
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
799
|
+
|
800
|
+
# Serialize Request
|
801
|
+
request_mapper = {
|
802
|
+
client_side_validation: true,
|
803
|
+
required: true,
|
804
|
+
serialized_name: 'utterance',
|
805
|
+
type: {
|
806
|
+
name: 'String'
|
807
|
+
}
|
808
|
+
}
|
809
|
+
request_content = @client.serialize(request_mapper, utterance)
|
810
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
811
|
+
|
812
|
+
path_template = 'apps/{appId}/versions/{versionId}/suggest'
|
813
|
+
|
814
|
+
request_url = @base_url || @client.base_url
|
815
|
+
request_url = request_url.gsub('{Endpoint}', @client.endpoint)
|
816
|
+
|
817
|
+
options = {
|
818
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
819
|
+
path_params: {'appId' => app_id,'versionId' => version_id},
|
820
|
+
body: request_content,
|
821
|
+
headers: request_headers.merge(custom_headers || {}),
|
822
|
+
base_url: request_url
|
823
|
+
}
|
824
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
825
|
+
|
826
|
+
promise = promise.then do |result|
|
827
|
+
http_response = result.response
|
828
|
+
status_code = http_response.status
|
829
|
+
response_content = http_response.body
|
830
|
+
unless status_code == 200
|
831
|
+
error_model = JSON.load(response_content)
|
832
|
+
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
|
833
|
+
end
|
834
|
+
|
835
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
836
|
+
# Deserialize Response
|
837
|
+
if status_code == 200
|
838
|
+
begin
|
839
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
840
|
+
result_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::OperationStatus.mapper()
|
841
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
842
|
+
rescue Exception => e
|
843
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
844
|
+
end
|
845
|
+
end
|
846
|
+
|
847
|
+
result
|
848
|
+
end
|
849
|
+
|
850
|
+
promise.execute
|
851
|
+
end
|
852
|
+
|
853
|
+
end
|
854
|
+
end
|