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,65 @@
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
+ module Models
8
+ #
9
+ # Object model for updating one of the closed list's sublists.
10
+ #
11
+ class WordListBaseUpdateObject
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] The standard form that the list represents.
16
+ attr_accessor :canonical_form
17
+
18
+ # @return [Array<String>] List of synonym words.
19
+ attr_accessor :list
20
+
21
+
22
+ #
23
+ # Mapper for WordListBaseUpdateObject class as Ruby Hash.
24
+ # This will be used for serialization/deserialization.
25
+ #
26
+ def self.mapper()
27
+ {
28
+ client_side_validation: true,
29
+ required: false,
30
+ serialized_name: 'WordListBaseUpdateObject',
31
+ type: {
32
+ name: 'Composite',
33
+ class_name: 'WordListBaseUpdateObject',
34
+ model_properties: {
35
+ canonical_form: {
36
+ client_side_validation: true,
37
+ required: false,
38
+ serialized_name: 'canonicalForm',
39
+ type: {
40
+ name: 'String'
41
+ }
42
+ },
43
+ list: {
44
+ client_side_validation: true,
45
+ required: false,
46
+ serialized_name: 'list',
47
+ type: {
48
+ name: 'Sequence',
49
+ element: {
50
+ client_side_validation: true,
51
+ required: false,
52
+ serialized_name: 'StringElementType',
53
+ type: {
54
+ name: 'String'
55
+ }
56
+ }
57
+ }
58
+ }
59
+ }
60
+ }
61
+ }
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,65 @@
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
+ module Models
8
+ #
9
+ # Sublist of items for a Closed list.
10
+ #
11
+ class WordListObject
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] The standard form that the list represents.
16
+ attr_accessor :canonical_form
17
+
18
+ # @return [Array<String>] List of synonym words.
19
+ attr_accessor :list
20
+
21
+
22
+ #
23
+ # Mapper for WordListObject class as Ruby Hash.
24
+ # This will be used for serialization/deserialization.
25
+ #
26
+ def self.mapper()
27
+ {
28
+ client_side_validation: true,
29
+ required: false,
30
+ serialized_name: 'WordListObject',
31
+ type: {
32
+ name: 'Composite',
33
+ class_name: 'WordListObject',
34
+ model_properties: {
35
+ canonical_form: {
36
+ client_side_validation: true,
37
+ required: false,
38
+ serialized_name: 'canonicalForm',
39
+ type: {
40
+ name: 'String'
41
+ }
42
+ },
43
+ list: {
44
+ client_side_validation: true,
45
+ required: false,
46
+ serialized_name: 'list',
47
+ type: {
48
+ name: 'Sequence',
49
+ element: {
50
+ client_side_validation: true,
51
+ required: false,
52
+ serialized_name: 'StringElementType',
53
+ type: {
54
+ name: 'String'
55
+ }
56
+ }
57
+ }
58
+ }
59
+ }
60
+ }
61
+ }
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,9 @@
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 end
7
+ module Azure::CognitiveServices end
8
+ module Azure::CognitiveServices::LuisAuthoring end
9
+ module Azure::CognitiveServices::LuisAuthoring::V2_0 end
@@ -0,0 +1,963 @@
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
+ # Pattern
9
+ #
10
+ class Pattern
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Pattern 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 one pattern to the specified application.
26
+ #
27
+ # @param app_id The application ID.
28
+ # @param version_id [String] The version ID.
29
+ # @param pattern [PatternRuleCreateObject] The input pattern.
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [PatternRuleInfo] operation results.
34
+ #
35
+ def add_pattern(app_id, version_id, pattern, custom_headers:nil)
36
+ response = add_pattern_async(app_id, version_id, pattern, custom_headers:custom_headers).value!
37
+ response.body unless response.nil?
38
+ end
39
+
40
+ #
41
+ # Adds one pattern to the specified application.
42
+ #
43
+ # @param app_id The application ID.
44
+ # @param version_id [String] The version ID.
45
+ # @param pattern [PatternRuleCreateObject] The input pattern.
46
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
47
+ # will be added to the HTTP request.
48
+ #
49
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
50
+ #
51
+ def add_pattern_with_http_info(app_id, version_id, pattern, custom_headers:nil)
52
+ add_pattern_async(app_id, version_id, pattern, custom_headers:custom_headers).value!
53
+ end
54
+
55
+ #
56
+ # Adds one pattern to the specified application.
57
+ #
58
+ # @param app_id The application ID.
59
+ # @param version_id [String] The version ID.
60
+ # @param pattern [PatternRuleCreateObject] The input pattern.
61
+ # @param [Hash{String => String}] A hash of custom headers that will be added
62
+ # to the HTTP request.
63
+ #
64
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
65
+ #
66
+ def add_pattern_async(app_id, version_id, pattern, custom_headers:nil)
67
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
68
+ fail ArgumentError, 'app_id is nil' if app_id.nil?
69
+ fail ArgumentError, 'version_id is nil' if version_id.nil?
70
+ fail ArgumentError, 'pattern is nil' if pattern.nil?
71
+
72
+
73
+ request_headers = {}
74
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
75
+
76
+ # Set Headers
77
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
78
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
79
+
80
+ # Serialize Request
81
+ request_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::PatternRuleCreateObject.mapper()
82
+ request_content = @client.serialize(request_mapper, pattern)
83
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
84
+
85
+ path_template = 'apps/{appId}/versions/{versionId}/patternrule'
86
+
87
+ request_url = @base_url || @client.base_url
88
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
89
+
90
+ options = {
91
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
92
+ path_params: {'appId' => app_id,'versionId' => version_id},
93
+ body: request_content,
94
+ headers: request_headers.merge(custom_headers || {}),
95
+ base_url: request_url
96
+ }
97
+ promise = @client.make_request_async(:post, path_template, options)
98
+
99
+ promise = promise.then do |result|
100
+ http_response = result.response
101
+ status_code = http_response.status
102
+ response_content = http_response.body
103
+ unless status_code == 201
104
+ error_model = JSON.load(response_content)
105
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
106
+ end
107
+
108
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
109
+ # Deserialize Response
110
+ if status_code == 201
111
+ begin
112
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
113
+ result_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::PatternRuleInfo.mapper()
114
+ result.body = @client.deserialize(result_mapper, parsed_response)
115
+ rescue Exception => e
116
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
117
+ end
118
+ end
119
+
120
+ result
121
+ end
122
+
123
+ promise.execute
124
+ end
125
+
126
+ #
127
+ # Returns an application version's patterns.
128
+ #
129
+ # @param app_id The application ID.
130
+ # @param version_id [String] The version ID.
131
+ # @param skip [Integer] The number of entries to skip. Default value is 0.
132
+ # @param take [Integer] The number of entries to return. Maximum page size is
133
+ # 500. Default is 100.
134
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
135
+ # will be added to the HTTP request.
136
+ #
137
+ # @return [Array] operation results.
138
+ #
139
+ def get_patterns(app_id, version_id, skip:0, take:100, custom_headers:nil)
140
+ response = get_patterns_async(app_id, version_id, skip:skip, take:take, custom_headers:custom_headers).value!
141
+ response.body unless response.nil?
142
+ end
143
+
144
+ #
145
+ # Returns an application version's patterns.
146
+ #
147
+ # @param app_id The application ID.
148
+ # @param version_id [String] The version ID.
149
+ # @param skip [Integer] The number of entries to skip. Default value is 0.
150
+ # @param take [Integer] The number of entries to return. Maximum page size is
151
+ # 500. Default is 100.
152
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
153
+ # will be added to the HTTP request.
154
+ #
155
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
156
+ #
157
+ def get_patterns_with_http_info(app_id, version_id, skip:0, take:100, custom_headers:nil)
158
+ get_patterns_async(app_id, version_id, skip:skip, take:take, custom_headers:custom_headers).value!
159
+ end
160
+
161
+ #
162
+ # Returns an application version's patterns.
163
+ #
164
+ # @param app_id The application ID.
165
+ # @param version_id [String] The version ID.
166
+ # @param skip [Integer] The number of entries to skip. Default value is 0.
167
+ # @param take [Integer] The number of entries to return. Maximum page size is
168
+ # 500. Default is 100.
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 get_patterns_async(app_id, version_id, skip:0, take:100, 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, "'skip' should satisfy the constraint - 'InclusiveMinimum': '0'" if !skip.nil? && skip < 0
179
+ fail ArgumentError, "'take' should satisfy the constraint - 'InclusiveMaximum': '500'" if !take.nil? && take > 500
180
+ fail ArgumentError, "'take' should satisfy the constraint - 'InclusiveMinimum': '0'" if !take.nil? && take < 0
181
+
182
+
183
+ request_headers = {}
184
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
185
+
186
+ # Set Headers
187
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
188
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
189
+ path_template = 'apps/{appId}/versions/{versionId}/patternrules'
190
+
191
+ request_url = @base_url || @client.base_url
192
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
193
+
194
+ options = {
195
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
196
+ path_params: {'appId' => app_id,'versionId' => version_id},
197
+ query_params: {'skip' => skip,'take' => take},
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: 'PatternRuleInfoElementType',
227
+ type: {
228
+ name: 'Composite',
229
+ class_name: 'PatternRuleInfo'
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
+ #
247
+ # Updates patterns
248
+ #
249
+ # @param app_id The application ID.
250
+ # @param version_id [String] The version ID.
251
+ # @param patterns [Array<PatternRuleUpdateObject>] An array represents the
252
+ # patterns.
253
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
254
+ # will be added to the HTTP request.
255
+ #
256
+ # @return [Array] operation results.
257
+ #
258
+ def update_patterns(app_id, version_id, patterns, custom_headers:nil)
259
+ response = update_patterns_async(app_id, version_id, patterns, custom_headers:custom_headers).value!
260
+ response.body unless response.nil?
261
+ end
262
+
263
+ #
264
+ # Updates patterns
265
+ #
266
+ # @param app_id The application ID.
267
+ # @param version_id [String] The version ID.
268
+ # @param patterns [Array<PatternRuleUpdateObject>] An array represents the
269
+ # patterns.
270
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
271
+ # will be added to the HTTP request.
272
+ #
273
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
274
+ #
275
+ def update_patterns_with_http_info(app_id, version_id, patterns, custom_headers:nil)
276
+ update_patterns_async(app_id, version_id, patterns, custom_headers:custom_headers).value!
277
+ end
278
+
279
+ #
280
+ # Updates patterns
281
+ #
282
+ # @param app_id The application ID.
283
+ # @param version_id [String] The version ID.
284
+ # @param patterns [Array<PatternRuleUpdateObject>] An array represents the
285
+ # patterns.
286
+ # @param [Hash{String => String}] A hash of custom headers that will be added
287
+ # to the HTTP request.
288
+ #
289
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
290
+ #
291
+ def update_patterns_async(app_id, version_id, patterns, custom_headers:nil)
292
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
293
+ fail ArgumentError, 'app_id is nil' if app_id.nil?
294
+ fail ArgumentError, 'version_id is nil' if version_id.nil?
295
+ fail ArgumentError, 'patterns is nil' if patterns.nil?
296
+
297
+
298
+ request_headers = {}
299
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
300
+
301
+ # Set Headers
302
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
303
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
304
+
305
+ # Serialize Request
306
+ request_mapper = {
307
+ client_side_validation: true,
308
+ required: true,
309
+ serialized_name: 'patterns',
310
+ type: {
311
+ name: 'Sequence',
312
+ element: {
313
+ client_side_validation: true,
314
+ required: false,
315
+ serialized_name: 'PatternRuleUpdateObjectElementType',
316
+ type: {
317
+ name: 'Composite',
318
+ class_name: 'PatternRuleUpdateObject'
319
+ }
320
+ }
321
+ }
322
+ }
323
+ request_content = @client.serialize(request_mapper, patterns)
324
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
325
+
326
+ path_template = 'apps/{appId}/versions/{versionId}/patternrules'
327
+
328
+ request_url = @base_url || @client.base_url
329
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
330
+
331
+ options = {
332
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
333
+ path_params: {'appId' => app_id,'versionId' => version_id},
334
+ body: request_content,
335
+ headers: request_headers.merge(custom_headers || {}),
336
+ base_url: request_url
337
+ }
338
+ promise = @client.make_request_async(:put, path_template, options)
339
+
340
+ promise = promise.then do |result|
341
+ http_response = result.response
342
+ status_code = http_response.status
343
+ response_content = http_response.body
344
+ unless status_code == 200
345
+ error_model = JSON.load(response_content)
346
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
347
+ end
348
+
349
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
350
+ # Deserialize Response
351
+ if status_code == 200
352
+ begin
353
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
354
+ result_mapper = {
355
+ client_side_validation: true,
356
+ required: false,
357
+ serialized_name: 'parsed_response',
358
+ type: {
359
+ name: 'Sequence',
360
+ element: {
361
+ client_side_validation: true,
362
+ required: false,
363
+ serialized_name: 'PatternRuleInfoElementType',
364
+ type: {
365
+ name: 'Composite',
366
+ class_name: 'PatternRuleInfo'
367
+ }
368
+ }
369
+ }
370
+ }
371
+ result.body = @client.deserialize(result_mapper, parsed_response)
372
+ rescue Exception => e
373
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
374
+ end
375
+ end
376
+
377
+ result
378
+ end
379
+
380
+ promise.execute
381
+ end
382
+
383
+ #
384
+ # Adds a batch of patterns to the specified application.
385
+ #
386
+ # @param app_id The application ID.
387
+ # @param version_id [String] The version ID.
388
+ # @param patterns [Array<PatternRuleCreateObject>] A JSON array containing
389
+ # patterns.
390
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
391
+ # will be added to the HTTP request.
392
+ #
393
+ # @return [Array] operation results.
394
+ #
395
+ def batch_add_patterns(app_id, version_id, patterns, custom_headers:nil)
396
+ response = batch_add_patterns_async(app_id, version_id, patterns, custom_headers:custom_headers).value!
397
+ response.body unless response.nil?
398
+ end
399
+
400
+ #
401
+ # Adds a batch of patterns to the specified application.
402
+ #
403
+ # @param app_id The application ID.
404
+ # @param version_id [String] The version ID.
405
+ # @param patterns [Array<PatternRuleCreateObject>] A JSON array containing
406
+ # patterns.
407
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
408
+ # will be added to the HTTP request.
409
+ #
410
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
411
+ #
412
+ def batch_add_patterns_with_http_info(app_id, version_id, patterns, custom_headers:nil)
413
+ batch_add_patterns_async(app_id, version_id, patterns, custom_headers:custom_headers).value!
414
+ end
415
+
416
+ #
417
+ # Adds a batch of patterns to the specified application.
418
+ #
419
+ # @param app_id The application ID.
420
+ # @param version_id [String] The version ID.
421
+ # @param patterns [Array<PatternRuleCreateObject>] A JSON array containing
422
+ # patterns.
423
+ # @param [Hash{String => String}] A hash of custom headers that will be added
424
+ # to the HTTP request.
425
+ #
426
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
427
+ #
428
+ def batch_add_patterns_async(app_id, version_id, patterns, custom_headers:nil)
429
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
430
+ fail ArgumentError, 'app_id is nil' if app_id.nil?
431
+ fail ArgumentError, 'version_id is nil' if version_id.nil?
432
+ fail ArgumentError, 'patterns is nil' if patterns.nil?
433
+
434
+
435
+ request_headers = {}
436
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
437
+
438
+ # Set Headers
439
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
440
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
441
+
442
+ # Serialize Request
443
+ request_mapper = {
444
+ client_side_validation: true,
445
+ required: true,
446
+ serialized_name: 'patterns',
447
+ type: {
448
+ name: 'Sequence',
449
+ element: {
450
+ client_side_validation: true,
451
+ required: false,
452
+ serialized_name: 'PatternRuleCreateObjectElementType',
453
+ type: {
454
+ name: 'Composite',
455
+ class_name: 'PatternRuleCreateObject'
456
+ }
457
+ }
458
+ }
459
+ }
460
+ request_content = @client.serialize(request_mapper, patterns)
461
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
462
+
463
+ path_template = 'apps/{appId}/versions/{versionId}/patternrules'
464
+
465
+ request_url = @base_url || @client.base_url
466
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
467
+
468
+ options = {
469
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
470
+ path_params: {'appId' => app_id,'versionId' => version_id},
471
+ body: request_content,
472
+ headers: request_headers.merge(custom_headers || {}),
473
+ base_url: request_url
474
+ }
475
+ promise = @client.make_request_async(:post, path_template, options)
476
+
477
+ promise = promise.then do |result|
478
+ http_response = result.response
479
+ status_code = http_response.status
480
+ response_content = http_response.body
481
+ unless status_code == 201
482
+ error_model = JSON.load(response_content)
483
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
484
+ end
485
+
486
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
487
+ # Deserialize Response
488
+ if status_code == 201
489
+ begin
490
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
491
+ result_mapper = {
492
+ client_side_validation: true,
493
+ required: false,
494
+ serialized_name: 'parsed_response',
495
+ type: {
496
+ name: 'Sequence',
497
+ element: {
498
+ client_side_validation: true,
499
+ required: false,
500
+ serialized_name: 'PatternRuleInfoElementType',
501
+ type: {
502
+ name: 'Composite',
503
+ class_name: 'PatternRuleInfo'
504
+ }
505
+ }
506
+ }
507
+ }
508
+ result.body = @client.deserialize(result_mapper, parsed_response)
509
+ rescue Exception => e
510
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
511
+ end
512
+ end
513
+
514
+ result
515
+ end
516
+
517
+ promise.execute
518
+ end
519
+
520
+ #
521
+ # Deletes the patterns with the specified IDs.
522
+ #
523
+ # @param app_id The application ID.
524
+ # @param version_id [String] The version ID.
525
+ # @param pattern_ids The patterns IDs.
526
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
527
+ # will be added to the HTTP request.
528
+ #
529
+ # @return [OperationStatus] operation results.
530
+ #
531
+ def delete_patterns(app_id, version_id, pattern_ids, custom_headers:nil)
532
+ response = delete_patterns_async(app_id, version_id, pattern_ids, custom_headers:custom_headers).value!
533
+ response.body unless response.nil?
534
+ end
535
+
536
+ #
537
+ # Deletes the patterns with the specified IDs.
538
+ #
539
+ # @param app_id The application ID.
540
+ # @param version_id [String] The version ID.
541
+ # @param pattern_ids The patterns IDs.
542
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
543
+ # will be added to the HTTP request.
544
+ #
545
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
546
+ #
547
+ def delete_patterns_with_http_info(app_id, version_id, pattern_ids, custom_headers:nil)
548
+ delete_patterns_async(app_id, version_id, pattern_ids, custom_headers:custom_headers).value!
549
+ end
550
+
551
+ #
552
+ # Deletes the patterns with the specified IDs.
553
+ #
554
+ # @param app_id The application ID.
555
+ # @param version_id [String] The version ID.
556
+ # @param pattern_ids The patterns IDs.
557
+ # @param [Hash{String => String}] A hash of custom headers that will be added
558
+ # to the HTTP request.
559
+ #
560
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
561
+ #
562
+ def delete_patterns_async(app_id, version_id, pattern_ids, custom_headers:nil)
563
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
564
+ fail ArgumentError, 'app_id is nil' if app_id.nil?
565
+ fail ArgumentError, 'version_id is nil' if version_id.nil?
566
+ fail ArgumentError, 'pattern_ids is nil' if pattern_ids.nil?
567
+
568
+
569
+ request_headers = {}
570
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
571
+
572
+ # Set Headers
573
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
574
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
575
+
576
+ # Serialize Request
577
+ request_mapper = {
578
+ client_side_validation: true,
579
+ required: true,
580
+ serialized_name: 'patternIds',
581
+ type: {
582
+ name: 'Sequence',
583
+ element: {
584
+ client_side_validation: true,
585
+ required: false,
586
+ serialized_name: 'UuidElementType',
587
+ type: {
588
+ name: 'String'
589
+ }
590
+ }
591
+ }
592
+ }
593
+ request_content = @client.serialize(request_mapper, pattern_ids)
594
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
595
+
596
+ path_template = 'apps/{appId}/versions/{versionId}/patternrules'
597
+
598
+ request_url = @base_url || @client.base_url
599
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
600
+
601
+ options = {
602
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
603
+ path_params: {'appId' => app_id,'versionId' => version_id},
604
+ body: request_content,
605
+ headers: request_headers.merge(custom_headers || {}),
606
+ base_url: request_url
607
+ }
608
+ promise = @client.make_request_async(:delete, path_template, options)
609
+
610
+ promise = promise.then do |result|
611
+ http_response = result.response
612
+ status_code = http_response.status
613
+ response_content = http_response.body
614
+ unless status_code == 200
615
+ error_model = JSON.load(response_content)
616
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
617
+ end
618
+
619
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
620
+ # Deserialize Response
621
+ if status_code == 200
622
+ begin
623
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
624
+ result_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::OperationStatus.mapper()
625
+ result.body = @client.deserialize(result_mapper, parsed_response)
626
+ rescue Exception => e
627
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
628
+ end
629
+ end
630
+
631
+ result
632
+ end
633
+
634
+ promise.execute
635
+ end
636
+
637
+ #
638
+ # Updates a pattern
639
+ #
640
+ # @param app_id The application ID.
641
+ # @param version_id [String] The version ID.
642
+ # @param pattern_id The pattern ID.
643
+ # @param pattern [PatternRuleUpdateObject] An object representing a pattern.
644
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
645
+ # will be added to the HTTP request.
646
+ #
647
+ # @return [PatternRuleInfo] operation results.
648
+ #
649
+ def update_pattern(app_id, version_id, pattern_id, pattern, custom_headers:nil)
650
+ response = update_pattern_async(app_id, version_id, pattern_id, pattern, custom_headers:custom_headers).value!
651
+ response.body unless response.nil?
652
+ end
653
+
654
+ #
655
+ # Updates a pattern
656
+ #
657
+ # @param app_id The application ID.
658
+ # @param version_id [String] The version ID.
659
+ # @param pattern_id The pattern ID.
660
+ # @param pattern [PatternRuleUpdateObject] An object representing a pattern.
661
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
662
+ # will be added to the HTTP request.
663
+ #
664
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
665
+ #
666
+ def update_pattern_with_http_info(app_id, version_id, pattern_id, pattern, custom_headers:nil)
667
+ update_pattern_async(app_id, version_id, pattern_id, pattern, custom_headers:custom_headers).value!
668
+ end
669
+
670
+ #
671
+ # Updates a pattern
672
+ #
673
+ # @param app_id The application ID.
674
+ # @param version_id [String] The version ID.
675
+ # @param pattern_id The pattern ID.
676
+ # @param pattern [PatternRuleUpdateObject] An object representing a pattern.
677
+ # @param [Hash{String => String}] A hash of custom headers that will be added
678
+ # to the HTTP request.
679
+ #
680
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
681
+ #
682
+ def update_pattern_async(app_id, version_id, pattern_id, pattern, custom_headers:nil)
683
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
684
+ fail ArgumentError, 'app_id is nil' if app_id.nil?
685
+ fail ArgumentError, 'version_id is nil' if version_id.nil?
686
+ fail ArgumentError, 'pattern_id is nil' if pattern_id.nil?
687
+ fail ArgumentError, 'pattern is nil' if pattern.nil?
688
+
689
+
690
+ request_headers = {}
691
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
692
+
693
+ # Set Headers
694
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
695
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
696
+
697
+ # Serialize Request
698
+ request_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::PatternRuleUpdateObject.mapper()
699
+ request_content = @client.serialize(request_mapper, pattern)
700
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
701
+
702
+ path_template = 'apps/{appId}/versions/{versionId}/patternrules/{patternId}'
703
+
704
+ request_url = @base_url || @client.base_url
705
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
706
+
707
+ options = {
708
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
709
+ path_params: {'appId' => app_id,'versionId' => version_id,'patternId' => pattern_id},
710
+ body: request_content,
711
+ headers: request_headers.merge(custom_headers || {}),
712
+ base_url: request_url
713
+ }
714
+ promise = @client.make_request_async(:put, path_template, options)
715
+
716
+ promise = promise.then do |result|
717
+ http_response = result.response
718
+ status_code = http_response.status
719
+ response_content = http_response.body
720
+ unless status_code == 200
721
+ error_model = JSON.load(response_content)
722
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
723
+ end
724
+
725
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
726
+ # Deserialize Response
727
+ if status_code == 200
728
+ begin
729
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
730
+ result_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::PatternRuleInfo.mapper()
731
+ result.body = @client.deserialize(result_mapper, parsed_response)
732
+ rescue Exception => e
733
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
734
+ end
735
+ end
736
+
737
+ result
738
+ end
739
+
740
+ promise.execute
741
+ end
742
+
743
+ #
744
+ # Deletes the pattern with the specified ID.
745
+ #
746
+ # @param app_id The application ID.
747
+ # @param version_id [String] The version ID.
748
+ # @param pattern_id The pattern ID.
749
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
750
+ # will be added to the HTTP request.
751
+ #
752
+ # @return [OperationStatus] operation results.
753
+ #
754
+ def delete_pattern(app_id, version_id, pattern_id, custom_headers:nil)
755
+ response = delete_pattern_async(app_id, version_id, pattern_id, custom_headers:custom_headers).value!
756
+ response.body unless response.nil?
757
+ end
758
+
759
+ #
760
+ # Deletes the pattern with the specified ID.
761
+ #
762
+ # @param app_id The application ID.
763
+ # @param version_id [String] The version ID.
764
+ # @param pattern_id The pattern ID.
765
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
766
+ # will be added to the HTTP request.
767
+ #
768
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
769
+ #
770
+ def delete_pattern_with_http_info(app_id, version_id, pattern_id, custom_headers:nil)
771
+ delete_pattern_async(app_id, version_id, pattern_id, custom_headers:custom_headers).value!
772
+ end
773
+
774
+ #
775
+ # Deletes the pattern with the specified ID.
776
+ #
777
+ # @param app_id The application ID.
778
+ # @param version_id [String] The version ID.
779
+ # @param pattern_id The pattern ID.
780
+ # @param [Hash{String => String}] A hash of custom headers that will be added
781
+ # to the HTTP request.
782
+ #
783
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
784
+ #
785
+ def delete_pattern_async(app_id, version_id, pattern_id, custom_headers:nil)
786
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
787
+ fail ArgumentError, 'app_id is nil' if app_id.nil?
788
+ fail ArgumentError, 'version_id is nil' if version_id.nil?
789
+ fail ArgumentError, 'pattern_id is nil' if pattern_id.nil?
790
+
791
+
792
+ request_headers = {}
793
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
794
+
795
+ # Set Headers
796
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
797
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
798
+ path_template = 'apps/{appId}/versions/{versionId}/patternrules/{patternId}'
799
+
800
+ request_url = @base_url || @client.base_url
801
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
802
+
803
+ options = {
804
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
805
+ path_params: {'appId' => app_id,'versionId' => version_id,'patternId' => pattern_id},
806
+ headers: request_headers.merge(custom_headers || {}),
807
+ base_url: request_url
808
+ }
809
+ promise = @client.make_request_async(:delete, path_template, options)
810
+
811
+ promise = promise.then do |result|
812
+ http_response = result.response
813
+ status_code = http_response.status
814
+ response_content = http_response.body
815
+ unless status_code == 200
816
+ error_model = JSON.load(response_content)
817
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
818
+ end
819
+
820
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
821
+ # Deserialize Response
822
+ if status_code == 200
823
+ begin
824
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
825
+ result_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::OperationStatus.mapper()
826
+ result.body = @client.deserialize(result_mapper, parsed_response)
827
+ rescue Exception => e
828
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
829
+ end
830
+ end
831
+
832
+ result
833
+ end
834
+
835
+ promise.execute
836
+ end
837
+
838
+ #
839
+ # Returns patterns to be retrieved for the specific intent.
840
+ #
841
+ # @param app_id The application ID.
842
+ # @param version_id [String] The version ID.
843
+ # @param intent_id The intent classifier ID.
844
+ # @param skip [Integer] The number of entries to skip. Default value is 0.
845
+ # @param take [Integer] The number of entries to return. Maximum page size is
846
+ # 500. Default is 100.
847
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
848
+ # will be added to the HTTP request.
849
+ #
850
+ # @return [Array] operation results.
851
+ #
852
+ def get_intent_patterns(app_id, version_id, intent_id, skip:0, take:100, custom_headers:nil)
853
+ response = get_intent_patterns_async(app_id, version_id, intent_id, skip:skip, take:take, custom_headers:custom_headers).value!
854
+ response.body unless response.nil?
855
+ end
856
+
857
+ #
858
+ # Returns patterns to be retrieved for the specific intent.
859
+ #
860
+ # @param app_id The application ID.
861
+ # @param version_id [String] The version ID.
862
+ # @param intent_id The intent classifier ID.
863
+ # @param skip [Integer] The number of entries to skip. Default value is 0.
864
+ # @param take [Integer] The number of entries to return. Maximum page size is
865
+ # 500. Default is 100.
866
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
867
+ # will be added to the HTTP request.
868
+ #
869
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
870
+ #
871
+ def get_intent_patterns_with_http_info(app_id, version_id, intent_id, skip:0, take:100, custom_headers:nil)
872
+ get_intent_patterns_async(app_id, version_id, intent_id, skip:skip, take:take, custom_headers:custom_headers).value!
873
+ end
874
+
875
+ #
876
+ # Returns patterns to be retrieved for the specific intent.
877
+ #
878
+ # @param app_id The application ID.
879
+ # @param version_id [String] The version ID.
880
+ # @param intent_id The intent classifier ID.
881
+ # @param skip [Integer] The number of entries to skip. Default value is 0.
882
+ # @param take [Integer] The number of entries to return. Maximum page size is
883
+ # 500. Default is 100.
884
+ # @param [Hash{String => String}] A hash of custom headers that will be added
885
+ # to the HTTP request.
886
+ #
887
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
888
+ #
889
+ def get_intent_patterns_async(app_id, version_id, intent_id, skip:0, take:100, custom_headers:nil)
890
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
891
+ fail ArgumentError, 'app_id is nil' if app_id.nil?
892
+ fail ArgumentError, 'version_id is nil' if version_id.nil?
893
+ fail ArgumentError, 'intent_id is nil' if intent_id.nil?
894
+ fail ArgumentError, "'skip' should satisfy the constraint - 'InclusiveMinimum': '0'" if !skip.nil? && skip < 0
895
+ fail ArgumentError, "'take' should satisfy the constraint - 'InclusiveMaximum': '500'" if !take.nil? && take > 500
896
+ fail ArgumentError, "'take' should satisfy the constraint - 'InclusiveMinimum': '0'" if !take.nil? && take < 0
897
+
898
+
899
+ request_headers = {}
900
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
901
+
902
+ # Set Headers
903
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
904
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
905
+ path_template = 'apps/{appId}/versions/{versionId}/intents/{intentId}/patternrules'
906
+
907
+ request_url = @base_url || @client.base_url
908
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
909
+
910
+ options = {
911
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
912
+ path_params: {'appId' => app_id,'versionId' => version_id,'intentId' => intent_id},
913
+ query_params: {'skip' => skip,'take' => take},
914
+ headers: request_headers.merge(custom_headers || {}),
915
+ base_url: request_url
916
+ }
917
+ promise = @client.make_request_async(:get, path_template, options)
918
+
919
+ promise = promise.then do |result|
920
+ http_response = result.response
921
+ status_code = http_response.status
922
+ response_content = http_response.body
923
+ unless status_code == 200
924
+ error_model = JSON.load(response_content)
925
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
926
+ end
927
+
928
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
929
+ # Deserialize Response
930
+ if status_code == 200
931
+ begin
932
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
933
+ result_mapper = {
934
+ client_side_validation: true,
935
+ required: false,
936
+ serialized_name: 'parsed_response',
937
+ type: {
938
+ name: 'Sequence',
939
+ element: {
940
+ client_side_validation: true,
941
+ required: false,
942
+ serialized_name: 'PatternRuleInfoElementType',
943
+ type: {
944
+ name: 'Composite',
945
+ class_name: 'PatternRuleInfo'
946
+ }
947
+ }
948
+ }
949
+ }
950
+ result.body = @client.deserialize(result_mapper, parsed_response)
951
+ rescue Exception => e
952
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
953
+ end
954
+ end
955
+
956
+ result
957
+ end
958
+
959
+ promise.execute
960
+ end
961
+
962
+ end
963
+ end