azure_cognitiveservices_qnamaker 0.17.2 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +20 -20
  3. data/lib/4.0/generated/azure_cognitiveservices_qnamaker.rb +0 -1
  4. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/alterations.rb +193 -193
  5. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/endpoint_keys.rb +198 -198
  6. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/endpoint_settings.rb +214 -214
  7. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/knowledgebase.rb +737 -737
  8. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/active_learning_settings_dto.rb +46 -46
  9. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/alterations_dto.rb +54 -54
  10. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/context_dto.rb +73 -73
  11. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/create_kb_dto.rb +44 -0
  12. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/create_kb_input_dto.rb +95 -95
  13. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/delete_kb_contents_dto.rb +74 -74
  14. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/endpoint_keys_dto.rb +11 -0
  15. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/endpoint_settings_dto.rb +48 -48
  16. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/endpoint_settings_dtoactive_learning.rb +43 -43
  17. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/environment_type.rb +16 -16
  18. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/error.rb +108 -108
  19. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/error_code_type.rb +28 -28
  20. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/error_response.rb +48 -48
  21. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/error_response_error.rb +85 -85
  22. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/file_dto.rb +62 -62
  23. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/inner_error_model.rb +62 -62
  24. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/knowledgebase_dto.rb +155 -155
  25. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/knowledgebases_dto.rb +55 -55
  26. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/metadata_dto.rb +65 -65
  27. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/operation.rb +115 -115
  28. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/operation_state_type.rb +18 -18
  29. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/prompt_dto.rb +86 -86
  30. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/prompt_dtoqna.rb +108 -108
  31. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/qn_adocuments_dto.rb +55 -55
  32. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/qn_adto.rb +128 -128
  33. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/qn_adtocontext.rb +63 -63
  34. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/replace_kb_dto.rb +57 -57
  35. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/update_context_dto.rb +90 -90
  36. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/update_kb_contents_dto.rb +87 -87
  37. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/update_kb_operation_dto.rb +30 -0
  38. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/update_kb_operation_dtoadd.rb +85 -85
  39. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/update_kb_operation_dtodelete.rb +67 -67
  40. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/update_kb_operation_dtoupdate.rb +76 -76
  41. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/update_metadata_dto.rb +77 -77
  42. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/update_qna_dto.rb +115 -115
  43. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/update_qna_dtocontext.rb +76 -76
  44. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/update_qna_dtometadata.rb +69 -69
  45. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/update_qna_dtoquestions.rb +67 -67
  46. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/update_questions_dto.rb +74 -74
  47. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/word_alterations_dto.rb +55 -55
  48. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/module_definition.rb +9 -9
  49. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/operations.rb +114 -114
  50. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/qnamaker_client.rb +1 -1
  51. data/lib/azure_cognitiveservices_qnamaker.rb +6 -6
  52. data/lib/module_definition.rb +7 -7
  53. data/lib/profiles/latest/modules/qnamaker_profile_module.rb +0 -4
  54. data/lib/profiles/latest/qnamaker_latest_profile_client.rb +38 -38
  55. data/lib/profiles/latest/qnamaker_module_definition.rb +8 -8
  56. data/lib/version.rb +1 -1
  57. metadata +3 -4
  58. data/lib/4.0/generated/azure_cognitiveservices_qnamaker/models/knowledgebase_environment_type.rb +0 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a5e82e19876c0315fecfc5fc4a9a5be47d0d09805ab91543d526a9fbd551d6e4
4
- data.tar.gz: ec9908ab7f4cc5f7d8dd190b0eff321315a2709f18f8759a4bd6c1b1c2a04a18
3
+ metadata.gz: 3026596d3aff1200ff09ff54154912271f23878e7ebc6101baa301ea3b06ce45
4
+ data.tar.gz: 57260a59d53db5e6358d8196dee84c3b4e16cfd4f24c3be8a4372232b5096b19
5
5
  SHA512:
6
- metadata.gz: c6b42ce11ce440c6de60edca1e5d6feb9ea2261f6f4990715ce493daaf4c6f4fbc8635c50bcc2e22853f9f6864062e88e684369967b28874696d7bdd8879b30c
7
- data.tar.gz: 4b475238eeaca1c0eaedbbd0b14e5be7f8e37604856745088540719cbcbdc05aaed4fa0bf53db8207f798f286a8099cefa42879dea077863f256e7bf25c30471
6
+ metadata.gz: 7b8693831694bda558ca62ace24f032db8e12c0d6b4f0f8876359ae9ed71b5a049a59376f8d64fc6a9465053d82d0f48326846061cb4cace1e58000d8524ae99
7
+ data.tar.gz: a5f92ef1e68259006d166914b59b0c18e6d1f056f706df35905622e5066f5cb74e28030a292d45018e119ebb23dd6d67a19de8060562a1012e9a69349cf0090b
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2015 Microsoft Corporation
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Microsoft Corporation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
21
  THE SOFTWARE.
@@ -65,7 +65,6 @@ module Azure::CognitiveServices::Qnamaker::V4_0
65
65
  autoload :QnADTOContext, '4.0/generated/azure_cognitiveservices_qnamaker/models/qn_adtocontext.rb'
66
66
  autoload :ErrorResponseError, '4.0/generated/azure_cognitiveservices_qnamaker/models/error_response_error.rb'
67
67
  autoload :EndpointSettingsDTOActiveLearning, '4.0/generated/azure_cognitiveservices_qnamaker/models/endpoint_settings_dtoactive_learning.rb'
68
- autoload :KnowledgebaseEnvironmentType, '4.0/generated/azure_cognitiveservices_qnamaker/models/knowledgebase_environment_type.rb'
69
68
  autoload :ErrorCodeType, '4.0/generated/azure_cognitiveservices_qnamaker/models/error_code_type.rb'
70
69
  autoload :OperationStateType, '4.0/generated/azure_cognitiveservices_qnamaker/models/operation_state_type.rb'
71
70
  autoload :EnvironmentType, '4.0/generated/azure_cognitiveservices_qnamaker/models/environment_type.rb'
@@ -1,193 +1,193 @@
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::Qnamaker::V4_0
7
- #
8
- # An API for QnAMaker Service
9
- #
10
- class Alterations
11
- include MsRestAzure
12
-
13
- #
14
- # Creates and initializes a new instance of the Alterations class.
15
- # @param client service class for accessing basic functionality.
16
- #
17
- def initialize(client)
18
- @client = client
19
- end
20
-
21
- # @return [QnamakerClient] reference to the QnamakerClient
22
- attr_reader :client
23
-
24
- #
25
- # Download alterations from runtime.
26
- #
27
- # @param custom_headers [Hash{String => String}] A hash of custom headers that
28
- # will be added to the HTTP request.
29
- #
30
- # @return [WordAlterationsDTO] operation results.
31
- #
32
- def get(custom_headers:nil)
33
- response = get_async(custom_headers:custom_headers).value!
34
- response.body unless response.nil?
35
- end
36
-
37
- #
38
- # Download alterations from runtime.
39
- #
40
- # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
- # will be added to the HTTP request.
42
- #
43
- # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
44
- #
45
- def get_with_http_info(custom_headers:nil)
46
- get_async(custom_headers:custom_headers).value!
47
- end
48
-
49
- #
50
- # Download alterations from runtime.
51
- #
52
- # @param [Hash{String => String}] A hash of custom headers that will be added
53
- # to the HTTP request.
54
- #
55
- # @return [Concurrent::Promise] Promise object which holds the HTTP response.
56
- #
57
- def get_async(custom_headers:nil)
58
- fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
59
-
60
-
61
- request_headers = {}
62
- request_headers['Content-Type'] = 'application/json; charset=utf-8'
63
-
64
- # Set Headers
65
- request_headers['x-ms-client-request-id'] = SecureRandom.uuid
66
- request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
67
- path_template = 'alterations'
68
-
69
- request_url = @base_url || @client.base_url
70
- request_url = request_url.gsub('{Endpoint}', @client.endpoint)
71
-
72
- options = {
73
- middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
74
- headers: request_headers.merge(custom_headers || {}),
75
- base_url: request_url
76
- }
77
- promise = @client.make_request_async(:get, path_template, options)
78
-
79
- promise = promise.then do |result|
80
- http_response = result.response
81
- status_code = http_response.status
82
- response_content = http_response.body
83
- unless status_code == 200
84
- error_model = JSON.load(response_content)
85
- fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
86
- end
87
-
88
- result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
89
- result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
90
- result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
91
- # Deserialize Response
92
- if status_code == 200
93
- begin
94
- parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
95
- result_mapper = Azure::CognitiveServices::Qnamaker::V4_0::Models::WordAlterationsDTO.mapper()
96
- result.body = @client.deserialize(result_mapper, parsed_response)
97
- rescue Exception => e
98
- fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
99
- end
100
- end
101
-
102
- result
103
- end
104
-
105
- promise.execute
106
- end
107
-
108
- #
109
- # Replace alterations data.
110
- #
111
- # @param word_alterations [WordAlterationsDTO] New alterations data.
112
- # @param custom_headers [Hash{String => String}] A hash of custom headers that
113
- # will be added to the HTTP request.
114
- #
115
- #
116
- def replace(word_alterations, custom_headers:nil)
117
- response = replace_async(word_alterations, custom_headers:custom_headers).value!
118
- nil
119
- end
120
-
121
- #
122
- # Replace alterations data.
123
- #
124
- # @param word_alterations [WordAlterationsDTO] New alterations data.
125
- # @param custom_headers [Hash{String => String}] A hash of custom headers that
126
- # will be added to the HTTP request.
127
- #
128
- # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
129
- #
130
- def replace_with_http_info(word_alterations, custom_headers:nil)
131
- replace_async(word_alterations, custom_headers:custom_headers).value!
132
- end
133
-
134
- #
135
- # Replace alterations data.
136
- #
137
- # @param word_alterations [WordAlterationsDTO] New alterations data.
138
- # @param [Hash{String => String}] A hash of custom headers that will be added
139
- # to the HTTP request.
140
- #
141
- # @return [Concurrent::Promise] Promise object which holds the HTTP response.
142
- #
143
- def replace_async(word_alterations, custom_headers:nil)
144
- fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
145
- fail ArgumentError, 'word_alterations is nil' if word_alterations.nil?
146
-
147
-
148
- request_headers = {}
149
- request_headers['Content-Type'] = 'application/json; charset=utf-8'
150
-
151
- # Set Headers
152
- request_headers['x-ms-client-request-id'] = SecureRandom.uuid
153
- request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
154
-
155
- # Serialize Request
156
- request_mapper = Azure::CognitiveServices::Qnamaker::V4_0::Models::WordAlterationsDTO.mapper()
157
- request_content = @client.serialize(request_mapper, word_alterations)
158
- request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
159
-
160
- path_template = 'alterations'
161
-
162
- request_url = @base_url || @client.base_url
163
- request_url = request_url.gsub('{Endpoint}', @client.endpoint)
164
-
165
- options = {
166
- middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
167
- body: request_content,
168
- headers: request_headers.merge(custom_headers || {}),
169
- base_url: request_url
170
- }
171
- promise = @client.make_request_async(:put, path_template, options)
172
-
173
- promise = promise.then do |result|
174
- http_response = result.response
175
- status_code = http_response.status
176
- response_content = http_response.body
177
- unless status_code == 204
178
- error_model = JSON.load(response_content)
179
- fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
180
- end
181
-
182
- result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
183
- result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
184
- result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
185
-
186
- result
187
- end
188
-
189
- promise.execute
190
- end
191
-
192
- end
193
- end
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::Qnamaker::V4_0
7
+ #
8
+ # An API for QnAMaker Service
9
+ #
10
+ class Alterations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Alterations class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [QnamakerClient] reference to the QnamakerClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Download alterations from runtime.
26
+ #
27
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
28
+ # will be added to the HTTP request.
29
+ #
30
+ # @return [WordAlterationsDTO] operation results.
31
+ #
32
+ def get(custom_headers:nil)
33
+ response = get_async(custom_headers:custom_headers).value!
34
+ response.body unless response.nil?
35
+ end
36
+
37
+ #
38
+ # Download alterations from runtime.
39
+ #
40
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
+ # will be added to the HTTP request.
42
+ #
43
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
44
+ #
45
+ def get_with_http_info(custom_headers:nil)
46
+ get_async(custom_headers:custom_headers).value!
47
+ end
48
+
49
+ #
50
+ # Download alterations from runtime.
51
+ #
52
+ # @param [Hash{String => String}] A hash of custom headers that will be added
53
+ # to the HTTP request.
54
+ #
55
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
56
+ #
57
+ def get_async(custom_headers:nil)
58
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
59
+
60
+
61
+ request_headers = {}
62
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
63
+
64
+ # Set Headers
65
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
66
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
67
+ path_template = 'alterations'
68
+
69
+ request_url = @base_url || @client.base_url
70
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
71
+
72
+ options = {
73
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
74
+ headers: request_headers.merge(custom_headers || {}),
75
+ base_url: request_url
76
+ }
77
+ promise = @client.make_request_async(:get, path_template, options)
78
+
79
+ promise = promise.then do |result|
80
+ http_response = result.response
81
+ status_code = http_response.status
82
+ response_content = http_response.body
83
+ unless status_code == 200
84
+ error_model = JSON.load(response_content)
85
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
86
+ end
87
+
88
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
89
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
90
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
91
+ # Deserialize Response
92
+ if status_code == 200
93
+ begin
94
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
95
+ result_mapper = Azure::CognitiveServices::Qnamaker::V4_0::Models::WordAlterationsDTO.mapper()
96
+ result.body = @client.deserialize(result_mapper, parsed_response)
97
+ rescue Exception => e
98
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
99
+ end
100
+ end
101
+
102
+ result
103
+ end
104
+
105
+ promise.execute
106
+ end
107
+
108
+ #
109
+ # Replace alterations data.
110
+ #
111
+ # @param word_alterations [WordAlterationsDTO] New alterations data.
112
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
113
+ # will be added to the HTTP request.
114
+ #
115
+ #
116
+ def replace(word_alterations, custom_headers:nil)
117
+ response = replace_async(word_alterations, custom_headers:custom_headers).value!
118
+ nil
119
+ end
120
+
121
+ #
122
+ # Replace alterations data.
123
+ #
124
+ # @param word_alterations [WordAlterationsDTO] New alterations data.
125
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
126
+ # will be added to the HTTP request.
127
+ #
128
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
129
+ #
130
+ def replace_with_http_info(word_alterations, custom_headers:nil)
131
+ replace_async(word_alterations, custom_headers:custom_headers).value!
132
+ end
133
+
134
+ #
135
+ # Replace alterations data.
136
+ #
137
+ # @param word_alterations [WordAlterationsDTO] New alterations data.
138
+ # @param [Hash{String => String}] A hash of custom headers that will be added
139
+ # to the HTTP request.
140
+ #
141
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
142
+ #
143
+ def replace_async(word_alterations, custom_headers:nil)
144
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
145
+ fail ArgumentError, 'word_alterations is nil' if word_alterations.nil?
146
+
147
+
148
+ request_headers = {}
149
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
150
+
151
+ # Set Headers
152
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
153
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
154
+
155
+ # Serialize Request
156
+ request_mapper = Azure::CognitiveServices::Qnamaker::V4_0::Models::WordAlterationsDTO.mapper()
157
+ request_content = @client.serialize(request_mapper, word_alterations)
158
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
159
+
160
+ path_template = 'alterations'
161
+
162
+ request_url = @base_url || @client.base_url
163
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
164
+
165
+ options = {
166
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
167
+ body: request_content,
168
+ headers: request_headers.merge(custom_headers || {}),
169
+ base_url: request_url
170
+ }
171
+ promise = @client.make_request_async(:put, path_template, options)
172
+
173
+ promise = promise.then do |result|
174
+ http_response = result.response
175
+ status_code = http_response.status
176
+ response_content = http_response.body
177
+ unless status_code == 204
178
+ error_model = JSON.load(response_content)
179
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
180
+ end
181
+
182
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
183
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
184
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
185
+
186
+ result
187
+ end
188
+
189
+ promise.execute
190
+ end
191
+
192
+ end
193
+ end
@@ -1,198 +1,198 @@
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::Qnamaker::V4_0
7
- #
8
- # An API for QnAMaker Service
9
- #
10
- class EndpointKeys
11
- include MsRestAzure
12
-
13
- #
14
- # Creates and initializes a new instance of the EndpointKeys class.
15
- # @param client service class for accessing basic functionality.
16
- #
17
- def initialize(client)
18
- @client = client
19
- end
20
-
21
- # @return [QnamakerClient] reference to the QnamakerClient
22
- attr_reader :client
23
-
24
- #
25
- # Gets endpoint keys for an endpoint
26
- #
27
- # @param custom_headers [Hash{String => String}] A hash of custom headers that
28
- # will be added to the HTTP request.
29
- #
30
- # @return [EndpointKeysDTO] operation results.
31
- #
32
- def get_keys(custom_headers:nil)
33
- response = get_keys_async(custom_headers:custom_headers).value!
34
- response.body unless response.nil?
35
- end
36
-
37
- #
38
- # Gets endpoint keys for an endpoint
39
- #
40
- # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
- # will be added to the HTTP request.
42
- #
43
- # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
44
- #
45
- def get_keys_with_http_info(custom_headers:nil)
46
- get_keys_async(custom_headers:custom_headers).value!
47
- end
48
-
49
- #
50
- # Gets endpoint keys for an endpoint
51
- #
52
- # @param [Hash{String => String}] A hash of custom headers that will be added
53
- # to the HTTP request.
54
- #
55
- # @return [Concurrent::Promise] Promise object which holds the HTTP response.
56
- #
57
- def get_keys_async(custom_headers:nil)
58
- fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
59
-
60
-
61
- request_headers = {}
62
- request_headers['Content-Type'] = 'application/json; charset=utf-8'
63
-
64
- # Set Headers
65
- request_headers['x-ms-client-request-id'] = SecureRandom.uuid
66
- request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
67
- path_template = 'endpointkeys'
68
-
69
- request_url = @base_url || @client.base_url
70
- request_url = request_url.gsub('{Endpoint}', @client.endpoint)
71
-
72
- options = {
73
- middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
74
- headers: request_headers.merge(custom_headers || {}),
75
- base_url: request_url
76
- }
77
- promise = @client.make_request_async(:get, path_template, options)
78
-
79
- promise = promise.then do |result|
80
- http_response = result.response
81
- status_code = http_response.status
82
- response_content = http_response.body
83
- unless status_code == 200
84
- error_model = JSON.load(response_content)
85
- fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
86
- end
87
-
88
- result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
89
- result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
90
- result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
91
- # Deserialize Response
92
- if status_code == 200
93
- begin
94
- parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
95
- result_mapper = Azure::CognitiveServices::Qnamaker::V4_0::Models::EndpointKeysDTO.mapper()
96
- result.body = @client.deserialize(result_mapper, parsed_response)
97
- rescue Exception => e
98
- fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
99
- end
100
- end
101
-
102
- result
103
- end
104
-
105
- promise.execute
106
- end
107
-
108
- #
109
- # Re-generates an endpoint key.
110
- #
111
- # @param key_type [String] Type of Key
112
- # @param custom_headers [Hash{String => String}] A hash of custom headers that
113
- # will be added to the HTTP request.
114
- #
115
- # @return [EndpointKeysDTO] operation results.
116
- #
117
- def refresh_keys(key_type, custom_headers:nil)
118
- response = refresh_keys_async(key_type, custom_headers:custom_headers).value!
119
- response.body unless response.nil?
120
- end
121
-
122
- #
123
- # Re-generates an endpoint key.
124
- #
125
- # @param key_type [String] Type of Key
126
- # @param custom_headers [Hash{String => String}] A hash of custom headers that
127
- # will be added to the HTTP request.
128
- #
129
- # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
130
- #
131
- def refresh_keys_with_http_info(key_type, custom_headers:nil)
132
- refresh_keys_async(key_type, custom_headers:custom_headers).value!
133
- end
134
-
135
- #
136
- # Re-generates an endpoint key.
137
- #
138
- # @param key_type [String] Type of Key
139
- # @param [Hash{String => String}] A hash of custom headers that will be added
140
- # to the HTTP request.
141
- #
142
- # @return [Concurrent::Promise] Promise object which holds the HTTP response.
143
- #
144
- def refresh_keys_async(key_type, custom_headers:nil)
145
- fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
146
- fail ArgumentError, 'key_type is nil' if key_type.nil?
147
-
148
-
149
- request_headers = {}
150
- request_headers['Content-Type'] = 'application/json; charset=utf-8'
151
-
152
- # Set Headers
153
- request_headers['x-ms-client-request-id'] = SecureRandom.uuid
154
- request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
155
- path_template = 'endpointkeys/{keyType}'
156
-
157
- request_url = @base_url || @client.base_url
158
- request_url = request_url.gsub('{Endpoint}', @client.endpoint)
159
-
160
- options = {
161
- middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
162
- path_params: {'keyType' => key_type},
163
- headers: request_headers.merge(custom_headers || {}),
164
- base_url: request_url
165
- }
166
- promise = @client.make_request_async(:patch, path_template, options)
167
-
168
- promise = promise.then do |result|
169
- http_response = result.response
170
- status_code = http_response.status
171
- response_content = http_response.body
172
- unless status_code == 200
173
- error_model = JSON.load(response_content)
174
- fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
175
- end
176
-
177
- result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
178
- result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
179
- result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
180
- # Deserialize Response
181
- if status_code == 200
182
- begin
183
- parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
184
- result_mapper = Azure::CognitiveServices::Qnamaker::V4_0::Models::EndpointKeysDTO.mapper()
185
- result.body = @client.deserialize(result_mapper, parsed_response)
186
- rescue Exception => e
187
- fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
188
- end
189
- end
190
-
191
- result
192
- end
193
-
194
- promise.execute
195
- end
196
-
197
- end
198
- end
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::Qnamaker::V4_0
7
+ #
8
+ # An API for QnAMaker Service
9
+ #
10
+ class EndpointKeys
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the EndpointKeys class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [QnamakerClient] reference to the QnamakerClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Gets endpoint keys for an endpoint
26
+ #
27
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
28
+ # will be added to the HTTP request.
29
+ #
30
+ # @return [EndpointKeysDTO] operation results.
31
+ #
32
+ def get_keys(custom_headers:nil)
33
+ response = get_keys_async(custom_headers:custom_headers).value!
34
+ response.body unless response.nil?
35
+ end
36
+
37
+ #
38
+ # Gets endpoint keys for an endpoint
39
+ #
40
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
+ # will be added to the HTTP request.
42
+ #
43
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
44
+ #
45
+ def get_keys_with_http_info(custom_headers:nil)
46
+ get_keys_async(custom_headers:custom_headers).value!
47
+ end
48
+
49
+ #
50
+ # Gets endpoint keys for an endpoint
51
+ #
52
+ # @param [Hash{String => String}] A hash of custom headers that will be added
53
+ # to the HTTP request.
54
+ #
55
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
56
+ #
57
+ def get_keys_async(custom_headers:nil)
58
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
59
+
60
+
61
+ request_headers = {}
62
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
63
+
64
+ # Set Headers
65
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
66
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
67
+ path_template = 'endpointkeys'
68
+
69
+ request_url = @base_url || @client.base_url
70
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
71
+
72
+ options = {
73
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
74
+ headers: request_headers.merge(custom_headers || {}),
75
+ base_url: request_url
76
+ }
77
+ promise = @client.make_request_async(:get, path_template, options)
78
+
79
+ promise = promise.then do |result|
80
+ http_response = result.response
81
+ status_code = http_response.status
82
+ response_content = http_response.body
83
+ unless status_code == 200
84
+ error_model = JSON.load(response_content)
85
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
86
+ end
87
+
88
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
89
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
90
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
91
+ # Deserialize Response
92
+ if status_code == 200
93
+ begin
94
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
95
+ result_mapper = Azure::CognitiveServices::Qnamaker::V4_0::Models::EndpointKeysDTO.mapper()
96
+ result.body = @client.deserialize(result_mapper, parsed_response)
97
+ rescue Exception => e
98
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
99
+ end
100
+ end
101
+
102
+ result
103
+ end
104
+
105
+ promise.execute
106
+ end
107
+
108
+ #
109
+ # Re-generates an endpoint key.
110
+ #
111
+ # @param key_type [String] Type of Key
112
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
113
+ # will be added to the HTTP request.
114
+ #
115
+ # @return [EndpointKeysDTO] operation results.
116
+ #
117
+ def refresh_keys(key_type, custom_headers:nil)
118
+ response = refresh_keys_async(key_type, custom_headers:custom_headers).value!
119
+ response.body unless response.nil?
120
+ end
121
+
122
+ #
123
+ # Re-generates an endpoint key.
124
+ #
125
+ # @param key_type [String] Type of Key
126
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
127
+ # will be added to the HTTP request.
128
+ #
129
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
130
+ #
131
+ def refresh_keys_with_http_info(key_type, custom_headers:nil)
132
+ refresh_keys_async(key_type, custom_headers:custom_headers).value!
133
+ end
134
+
135
+ #
136
+ # Re-generates an endpoint key.
137
+ #
138
+ # @param key_type [String] Type of Key
139
+ # @param [Hash{String => String}] A hash of custom headers that will be added
140
+ # to the HTTP request.
141
+ #
142
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
143
+ #
144
+ def refresh_keys_async(key_type, custom_headers:nil)
145
+ fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
146
+ fail ArgumentError, 'key_type is nil' if key_type.nil?
147
+
148
+
149
+ request_headers = {}
150
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
151
+
152
+ # Set Headers
153
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
154
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
155
+ path_template = 'endpointkeys/{keyType}'
156
+
157
+ request_url = @base_url || @client.base_url
158
+ request_url = request_url.gsub('{Endpoint}', @client.endpoint)
159
+
160
+ options = {
161
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
162
+ path_params: {'keyType' => key_type},
163
+ headers: request_headers.merge(custom_headers || {}),
164
+ base_url: request_url
165
+ }
166
+ promise = @client.make_request_async(:patch, path_template, options)
167
+
168
+ promise = promise.then do |result|
169
+ http_response = result.response
170
+ status_code = http_response.status
171
+ response_content = http_response.body
172
+ unless status_code == 200
173
+ error_model = JSON.load(response_content)
174
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
175
+ end
176
+
177
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
178
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
179
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
180
+ # Deserialize Response
181
+ if status_code == 200
182
+ begin
183
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
184
+ result_mapper = Azure::CognitiveServices::Qnamaker::V4_0::Models::EndpointKeysDTO.mapper()
185
+ result.body = @client.deserialize(result_mapper, parsed_response)
186
+ rescue Exception => e
187
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
188
+ end
189
+ end
190
+
191
+ result
192
+ end
193
+
194
+ promise.execute
195
+ end
196
+
197
+ end
198
+ end