trinsic_service_clients 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +0 -0
  5. data/lib/trinsic_service_clients.rb +12 -0
  6. data/lib/trinsic_service_clients/credentials.rb +68 -0
  7. data/lib/trinsic_service_clients/credentials/credentials_client.rb +4702 -0
  8. data/lib/trinsic_service_clients/credentials/models/agent_endpoint.rb +77 -0
  9. data/lib/trinsic_service_clients/credentials/models/attribute_filter.rb +111 -0
  10. data/lib/trinsic_service_clients/credentials/models/attribute_value.rb +55 -0
  11. data/lib/trinsic_service_clients/credentials/models/basic_message_contract.rb +76 -0
  12. data/lib/trinsic_service_clients/credentials/models/basic_message_parameters.rb +54 -0
  13. data/lib/trinsic_service_clients/credentials/models/basic_message_record.rb +124 -0
  14. data/lib/trinsic_service_clients/credentials/models/connection_contract.rb +178 -0
  15. data/lib/trinsic_service_clients/credentials/models/connection_invitation_parameters.rb +71 -0
  16. data/lib/trinsic_service_clients/credentials/models/credential_contract.rb +152 -0
  17. data/lib/trinsic_service_clients/credentials/models/credential_definition_contract.rb +107 -0
  18. data/lib/trinsic_service_clients/credentials/models/credential_definition_from_schema_parameters.rb +97 -0
  19. data/lib/trinsic_service_clients/credentials/models/credential_definition_parameters.rb +55 -0
  20. data/lib/trinsic_service_clients/credentials/models/credential_offer_parameters.rb +90 -0
  21. data/lib/trinsic_service_clients/credentials/models/issuer_status_contract.rb +111 -0
  22. data/lib/trinsic_service_clients/credentials/models/network_contract.rb +77 -0
  23. data/lib/trinsic_service_clients/credentials/models/network_txn_agreement_contract.rb +73 -0
  24. data/lib/trinsic_service_clients/credentials/models/proof_attribute_contract.rb +108 -0
  25. data/lib/trinsic_service_clients/credentials/models/proof_attribute_info.rb +95 -0
  26. data/lib/trinsic_service_clients/credentials/models/proof_predicate_info.rb +117 -0
  27. data/lib/trinsic_service_clients/credentials/models/proof_proposal.rb +84 -0
  28. data/lib/trinsic_service_clients/credentials/models/proof_request.rb +118 -0
  29. data/lib/trinsic_service_clients/credentials/models/proposed_attribute.rb +110 -0
  30. data/lib/trinsic_service_clients/credentials/models/proposed_predicate.rb +110 -0
  31. data/lib/trinsic_service_clients/credentials/models/revocation_interval.rb +55 -0
  32. data/lib/trinsic_service_clients/credentials/models/schema_parameters.rb +73 -0
  33. data/lib/trinsic_service_clients/credentials/models/schema_record.rb +121 -0
  34. data/lib/trinsic_service_clients/credentials/models/tenant_contract.rb +91 -0
  35. data/lib/trinsic_service_clients/credentials/models/tenant_extended_information_contract.rb +123 -0
  36. data/lib/trinsic_service_clients/credentials/models/tenant_parameters.rb +90 -0
  37. data/lib/trinsic_service_clients/credentials/models/verification_contract.rb +188 -0
  38. data/lib/trinsic_service_clients/credentials/models/verification_definition_contract.rb +56 -0
  39. data/lib/trinsic_service_clients/credentials/models/verification_parameters.rb +54 -0
  40. data/lib/trinsic_service_clients/credentials/models/verification_policy_attribute_contract.rb +83 -0
  41. data/lib/trinsic_service_clients/credentials/models/verification_policy_contract.rb +118 -0
  42. data/lib/trinsic_service_clients/credentials/models/verification_policy_parameters.rb +107 -0
  43. data/lib/trinsic_service_clients/credentials/models/verification_policy_predicate_contract.rb +97 -0
  44. data/lib/trinsic_service_clients/credentials/models/verification_policy_restriction.rb +111 -0
  45. data/lib/trinsic_service_clients/credentials/models/verification_policy_restriction_attribute.rb +55 -0
  46. data/lib/trinsic_service_clients/credentials/models/verification_policy_revocation_requirement.rb +44 -0
  47. data/lib/trinsic_service_clients/credentials/models/verification_result.rb +64 -0
  48. data/lib/trinsic_service_clients/credentials/models/webhook_contract.rb +78 -0
  49. data/lib/trinsic_service_clients/credentials/models/webhook_parameters.rb +67 -0
  50. data/lib/trinsic_service_clients/credentials/module_definition.rb +6 -0
  51. data/lib/trinsic_service_clients/credentials/version.rb +8 -0
  52. data/lib/trinsic_service_clients/provider.rb +35 -0
  53. data/lib/trinsic_service_clients/provider/models/asset_contract.rb +43 -0
  54. data/lib/trinsic_service_clients/provider/models/cloud_wallet_analytics_contract.rb +43 -0
  55. data/lib/trinsic_service_clients/provider/models/network_contract.rb +77 -0
  56. data/lib/trinsic_service_clients/provider/models/tenant_contract.rb +91 -0
  57. data/lib/trinsic_service_clients/provider/models/tenant_extended_information_contract.rb +123 -0
  58. data/lib/trinsic_service_clients/provider/models/tenant_keys_contract.rb +55 -0
  59. data/lib/trinsic_service_clients/provider/models/tenant_parameters.rb +101 -0
  60. data/lib/trinsic_service_clients/provider/models/tenant_update_parameters.rb +54 -0
  61. data/lib/trinsic_service_clients/provider/models/usage_contract.rb +87 -0
  62. data/lib/trinsic_service_clients/provider/module_definition.rb +6 -0
  63. data/lib/trinsic_service_clients/provider/provider_client.rb +826 -0
  64. data/lib/trinsic_service_clients/provider/version.rb +8 -0
  65. data/lib/trinsic_service_clients/wallet.rb +44 -0
  66. data/lib/trinsic_service_clients/wallet/models/agent_endpoint.rb +77 -0
  67. data/lib/trinsic_service_clients/wallet/models/connection_contract.rb +178 -0
  68. data/lib/trinsic_service_clients/wallet/models/credential_contract.rb +152 -0
  69. data/lib/trinsic_service_clients/wallet/models/custodian_wallet_contract.rb +54 -0
  70. data/lib/trinsic_service_clients/wallet/models/proof_attribute_contract.rb +108 -0
  71. data/lib/trinsic_service_clients/wallet/models/proof_proposal.rb +84 -0
  72. data/lib/trinsic_service_clients/wallet/models/proposed_attribute.rb +110 -0
  73. data/lib/trinsic_service_clients/wallet/models/proposed_predicate.rb +110 -0
  74. data/lib/trinsic_service_clients/wallet/models/verification_contract.rb +188 -0
  75. data/lib/trinsic_service_clients/wallet/models/verification_policy_attribute_contract.rb +83 -0
  76. data/lib/trinsic_service_clients/wallet/models/verification_policy_credential_contract.rb +83 -0
  77. data/lib/trinsic_service_clients/wallet/models/verification_policy_credential_parameters.rb +66 -0
  78. data/lib/trinsic_service_clients/wallet/models/verification_policy_parameters.rb +107 -0
  79. data/lib/trinsic_service_clients/wallet/models/verification_policy_predicate_contract.rb +97 -0
  80. data/lib/trinsic_service_clients/wallet/models/verification_policy_restriction.rb +111 -0
  81. data/lib/trinsic_service_clients/wallet/models/verification_policy_restriction_attribute.rb +55 -0
  82. data/lib/trinsic_service_clients/wallet/models/verification_policy_revocation_reqirement.rb +44 -0
  83. data/lib/trinsic_service_clients/wallet/models/wallet_parameters.rb +58 -0
  84. data/lib/trinsic_service_clients/wallet/module_definition.rb +6 -0
  85. data/lib/trinsic_service_clients/wallet/version.rb +8 -0
  86. data/lib/trinsic_service_clients/wallet/wallet_client.rb +2045 -0
  87. data/trinsic_service_clients-0.0.0.gem +0 -0
  88. data/trinsic_service_clients.gemspec +13 -0
  89. metadata +129 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0d8ae61f520062ea37af88d86a1ec79ab821bd65a961207f538a72051eb798c0
4
+ data.tar.gz: 51350a239cb9c02dc98a70f19c366cfb02d887dc528e32a2a4db407f51fa6be1
5
+ SHA512:
6
+ metadata.gz: f27f87b0f884815bdebdd80c8413641ed99ed37e2208a5ad24cc78663738ebbb67c91be1ea7f8e72633228f73592a2c51f215c9a2768cedf82b6bb3a1dcf8361
7
+ data.tar.gz: 0c46aecd929d95258fb4009ba968ec87b89287516cb339ec83dc18275c4a8b573f3e8e352d288a8a12121dd840b83b8b10a657174d7518dbf34e69467db36e79
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in test-gem.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "minitest", "~> 5.0"
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Trinsic
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 all
13
+ 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 THE
21
+ SOFTWARE.
File without changes
@@ -0,0 +1,12 @@
1
+ require 'trinsic_service_clients/credentials'
2
+ require 'trinsic_service_clients/wallet'
3
+ require 'trinsic_service_clients/provider'
4
+
5
+ module TrinsicServiceClients
6
+ autoload :Credentials, 'trinsic_service_clients/credentials'
7
+ autoload :Wallet, 'trinsic_service_clients/wallet'
8
+ autoload :Provider, 'trinsic_service_clients/provider'
9
+ autoload :CredentialsClient, 'trinsic_service_clients/credentials/credentials_client'
10
+ autoload :WalletClient, 'trinsic_service_clients/wallet/wallet_client'
11
+ autoload :ProviderClient, 'trinsic_service_clients/provider/provider_client'
12
+ end
@@ -0,0 +1,68 @@
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
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require 'generated/credentials/module_definition'
20
+
21
+ module Credentials
22
+ autoload :CredentialsClient, 'generated/credentials/credentials_client.rb'
23
+
24
+ module Models
25
+ autoload :AttributeFilter, 'generated/credentials/models/attribute_filter.rb'
26
+ autoload :RevocationInterval, 'generated/credentials/models/revocation_interval.rb'
27
+ autoload :NetworkTxnAgreementContract, 'generated/credentials/models/network_txn_agreement_contract.rb'
28
+ autoload :ProofAttributeInfo, 'generated/credentials/models/proof_attribute_info.rb'
29
+ autoload :ConnectionContract, 'generated/credentials/models/connection_contract.rb'
30
+ autoload :ProofPredicateInfo, 'generated/credentials/models/proof_predicate_info.rb'
31
+ autoload :CredentialContract, 'generated/credentials/models/credential_contract.rb'
32
+ autoload :ProofRequest, 'generated/credentials/models/proof_request.rb'
33
+ autoload :VerificationPolicyRestrictionAttribute, 'generated/credentials/models/verification_policy_restriction_attribute.rb'
34
+ autoload :VerificationDefinitionContract, 'generated/credentials/models/verification_definition_contract.rb'
35
+ autoload :VerificationPolicyAttributeContract, 'generated/credentials/models/verification_policy_attribute_contract.rb'
36
+ autoload :BasicMessageParameters, 'generated/credentials/models/basic_message_parameters.rb'
37
+ autoload :VerificationPolicyRevocationRequirement, 'generated/credentials/models/verification_policy_revocation_requirement.rb'
38
+ autoload :BasicMessageRecord, 'generated/credentials/models/basic_message_record.rb'
39
+ autoload :VerificationPolicyParameters, 'generated/credentials/models/verification_policy_parameters.rb'
40
+ autoload :BasicMessageContract, 'generated/credentials/models/basic_message_contract.rb'
41
+ autoload :CredentialDefinitionFromSchemaParameters, 'generated/credentials/models/credential_definition_from_schema_parameters.rb'
42
+ autoload :TenantExtendedInformationContract, 'generated/credentials/models/tenant_extended_information_contract.rb'
43
+ autoload :SchemaParameters, 'generated/credentials/models/schema_parameters.rb'
44
+ autoload :TenantContract, 'generated/credentials/models/tenant_contract.rb'
45
+ autoload :AttributeValue, 'generated/credentials/models/attribute_value.rb'
46
+ autoload :TenantParameters, 'generated/credentials/models/tenant_parameters.rb'
47
+ autoload :AgentEndpoint, 'generated/credentials/models/agent_endpoint.rb'
48
+ autoload :IssuerStatusContract, 'generated/credentials/models/issuer_status_contract.rb'
49
+ autoload :CredentialOfferParameters, 'generated/credentials/models/credential_offer_parameters.rb'
50
+ autoload :ProofAttributeContract, 'generated/credentials/models/proof_attribute_contract.rb'
51
+ autoload :VerificationPolicyPredicateContract, 'generated/credentials/models/verification_policy_predicate_contract.rb'
52
+ autoload :ProposedAttribute, 'generated/credentials/models/proposed_attribute.rb'
53
+ autoload :CredentialDefinitionContract, 'generated/credentials/models/credential_definition_contract.rb'
54
+ autoload :ProposedPredicate, 'generated/credentials/models/proposed_predicate.rb'
55
+ autoload :SchemaRecord, 'generated/credentials/models/schema_record.rb'
56
+ autoload :ProofProposal, 'generated/credentials/models/proof_proposal.rb'
57
+ autoload :ConnectionInvitationParameters, 'generated/credentials/models/connection_invitation_parameters.rb'
58
+ autoload :VerificationContract, 'generated/credentials/models/verification_contract.rb'
59
+ autoload :VerificationPolicyContract, 'generated/credentials/models/verification_policy_contract.rb'
60
+ autoload :VerificationParameters, 'generated/credentials/models/verification_parameters.rb'
61
+ autoload :NetworkContract, 'generated/credentials/models/network_contract.rb'
62
+ autoload :VerificationResult, 'generated/credentials/models/verification_result.rb'
63
+ autoload :CredentialDefinitionParameters, 'generated/credentials/models/credential_definition_parameters.rb'
64
+ autoload :WebhookContract, 'generated/credentials/models/webhook_contract.rb'
65
+ autoload :VerificationPolicyRestriction, 'generated/credentials/models/verification_policy_restriction.rb'
66
+ autoload :WebhookParameters, 'generated/credentials/models/webhook_parameters.rb'
67
+ end
68
+ end
@@ -0,0 +1,4702 @@
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 Credentials
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class CredentialsClient < MsRest::ServiceClient
11
+ include MsRest::Serialization
12
+
13
+ # @return [String] the base URI of the service.
14
+ attr_accessor :base_url
15
+
16
+ # @return Subscription credentials which uniquely identify client
17
+ # subscription.
18
+ attr_accessor :credentials
19
+
20
+ #
21
+ # Creates initializes a new instance of the CredentialsClient class.
22
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
23
+ # @param base_url [String] the base URI of the service.
24
+ # @param options [Array] filters to be applied to the HTTP requests.
25
+ #
26
+ def initialize(credentials = nil, base_url = nil, options = nil)
27
+ super(credentials, options)
28
+ @base_url = base_url || 'https://api.trinsic.id/credentials/v1'
29
+
30
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
31
+ @credentials = credentials
32
+
33
+ add_telemetry
34
+ end
35
+
36
+ #
37
+ # Makes a request and returns the body of the response.
38
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
39
+ # @param path [String] the path, relative to {base_url}.
40
+ # @param options [Hash{String=>String}] specifying any request options like :body.
41
+ # @return [Hash{String=>String}] containing the body of the response.
42
+ # Example:
43
+ #
44
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
45
+ # path = "/path"
46
+ # options = {
47
+ # body: request_content,
48
+ # query_params: {'api-version' => '2016-02-01'}
49
+ # }
50
+ # result = @client.make_request(:put, path, options)
51
+ #
52
+ def make_request(method, path, options = {})
53
+ result = make_request_with_http_info(method, path, options)
54
+ result.body unless result.nil?
55
+ end
56
+
57
+ #
58
+ # Makes a request and returns the operation response.
59
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
60
+ # @param path [String] the path, relative to {base_url}.
61
+ # @param options [Hash{String=>String}] specifying any request options like :body.
62
+ # @return [MsRest::HttpOperationResponse] Operation response containing the request, response and status.
63
+ #
64
+ def make_request_with_http_info(method, path, options = {})
65
+ result = make_request_async(method, path, options).value!
66
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
67
+ result
68
+ end
69
+
70
+ #
71
+ # Makes a request asynchronously.
72
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
73
+ # @param path [String] the path, relative to {base_url}.
74
+ # @param options [Hash{String=>String}] specifying any request options like :body.
75
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
76
+ #
77
+ def make_request_async(method, path, options = {})
78
+ fail ArgumentError, 'method is nil' if method.nil?
79
+ fail ArgumentError, 'path is nil' if path.nil?
80
+
81
+ request_url = options[:base_url] || @base_url
82
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
83
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
84
+ end
85
+
86
+ request_headers = @request_headers
87
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
88
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
89
+
90
+ super(request_url, method, path, options)
91
+ end
92
+
93
+ #
94
+ # [Deprecated] Upload image
95
+ #
96
+ # Please use the Provider API instead.
97
+ # Upload an image and return a URL with the static remote location.
98
+ #
99
+ # @param uploaded_files
100
+ # @param filename [String]
101
+ # @param content_type [String]
102
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
103
+ # will be added to the HTTP request.
104
+ #
105
+ # @return [String] operation results.
106
+ #
107
+ def upload_image(uploaded_files, filename:nil, content_type:nil, custom_headers:nil)
108
+ response = upload_image_async(uploaded_files, filename:filename, content_type:content_type, custom_headers:custom_headers).value!
109
+ response.body unless response.nil?
110
+ end
111
+
112
+ #
113
+ # [Deprecated] Upload image
114
+ #
115
+ # Please use the Provider API instead.
116
+ # Upload an image and return a URL with the static remote location.
117
+ #
118
+ # @param uploaded_files
119
+ # @param filename [String]
120
+ # @param content_type [String]
121
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
122
+ # will be added to the HTTP request.
123
+ #
124
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
125
+ #
126
+ def upload_image_with_http_info(uploaded_files, filename:nil, content_type:nil, custom_headers:nil)
127
+ upload_image_async(uploaded_files, filename:filename, content_type:content_type, custom_headers:custom_headers).value!
128
+ end
129
+
130
+ #
131
+ # [Deprecated] Upload image
132
+ #
133
+ # Please use the Provider API instead.
134
+ # Upload an image and return a URL with the static remote location.
135
+ #
136
+ # @param uploaded_files
137
+ # @param filename [String]
138
+ # @param content_type [String]
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 upload_image_async(uploaded_files, filename:nil, content_type:nil, custom_headers:nil)
145
+ fail ArgumentError, 'uploaded_files is nil' if uploaded_files.nil?
146
+
147
+
148
+ request_headers = {}
149
+ request_headers['Content-Type'] = 'multipart/form-data'
150
+
151
+ # Set Form Data
152
+ form_data = {}
153
+ form_data['uploadedFiles'] = uploaded_files.to_s unless uploaded_files.to_s.nil?
154
+ form_data['filename'] = filename unless filename.nil?
155
+ form_data['contentType'] = content_type unless content_type.nil?
156
+
157
+ path_template = 'common/upload'
158
+
159
+ request_url = @base_url || self.base_url
160
+
161
+ options = {
162
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
163
+ headers: request_headers.merge(custom_headers || {}),
164
+ body: URI.encode_www_form(form_data),
165
+ base_url: request_url
166
+ }
167
+ promise = self.make_request_async(:post, path_template, options)
168
+
169
+ promise = promise.then do |result|
170
+ http_response = result.response
171
+ status_code = http_response.status
172
+ response_content = http_response.body
173
+ unless status_code == 200
174
+ error_model = JSON.load(response_content)
175
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
176
+ end
177
+
178
+ # Deserialize Response
179
+ if status_code == 200
180
+ begin
181
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
182
+ result_mapper = {
183
+ client_side_validation: true,
184
+ required: false,
185
+ serialized_name: 'parsed_response',
186
+ type: {
187
+ name: 'String'
188
+ }
189
+ }
190
+ result.body = self.deserialize(result_mapper, parsed_response)
191
+ rescue Exception => e
192
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
193
+ end
194
+ end
195
+
196
+ result
197
+ end
198
+
199
+ promise.execute
200
+ end
201
+
202
+ #
203
+ # List all ledger networks
204
+ #
205
+ # List all available ledger networks.
206
+ # Some networks are not available based on your subscription.
207
+ #
208
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
209
+ # will be added to the HTTP request.
210
+ #
211
+ # @return [Array] operation results.
212
+ #
213
+ def list_networks(custom_headers:nil)
214
+ response = list_networks_async(custom_headers:custom_headers).value!
215
+ response.body unless response.nil?
216
+ end
217
+
218
+ #
219
+ # List all ledger networks
220
+ #
221
+ # List all available ledger networks.
222
+ # Some networks are not available based on your subscription.
223
+ #
224
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
225
+ # will be added to the HTTP request.
226
+ #
227
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
228
+ #
229
+ def list_networks_with_http_info(custom_headers:nil)
230
+ list_networks_async(custom_headers:custom_headers).value!
231
+ end
232
+
233
+ #
234
+ # List all ledger networks
235
+ #
236
+ # List all available ledger networks.
237
+ # Some networks are not available based on your subscription.
238
+ #
239
+ # @param [Hash{String => String}] A hash of custom headers that will be added
240
+ # to the HTTP request.
241
+ #
242
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
243
+ #
244
+ def list_networks_async(custom_headers:nil)
245
+
246
+
247
+ request_headers = {}
248
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
249
+ path_template = 'common/networks'
250
+
251
+ request_url = @base_url || self.base_url
252
+
253
+ options = {
254
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
255
+ headers: request_headers.merge(custom_headers || {}),
256
+ base_url: request_url
257
+ }
258
+ promise = self.make_request_async(:get, path_template, options)
259
+
260
+ promise = promise.then do |result|
261
+ http_response = result.response
262
+ status_code = http_response.status
263
+ response_content = http_response.body
264
+ unless status_code == 200
265
+ error_model = JSON.load(response_content)
266
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
267
+ end
268
+
269
+ # Deserialize Response
270
+ if status_code == 200
271
+ begin
272
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
273
+ result_mapper = {
274
+ client_side_validation: true,
275
+ required: false,
276
+ serialized_name: 'parsed_response',
277
+ type: {
278
+ name: 'Sequence',
279
+ element: {
280
+ client_side_validation: true,
281
+ required: false,
282
+ serialized_name: 'NetworkContractElementType',
283
+ type: {
284
+ name: 'Composite',
285
+ class_name: 'NetworkContract'
286
+ }
287
+ }
288
+ }
289
+ }
290
+ result.body = self.deserialize(result_mapper, parsed_response)
291
+ rescue Exception => e
292
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
293
+ end
294
+ end
295
+
296
+ result
297
+ end
298
+
299
+ promise.execute
300
+ end
301
+
302
+ #
303
+ # [Deprecated] Get network transaction author agreement
304
+ #
305
+ # This endpoint is no longer needed.
306
+ # Get the latest transaction author agreement and acceptance methods if one is
307
+ # set on the specified network.
308
+ #
309
+ # @param network_id [String] The network identifier
310
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
311
+ # will be added to the HTTP request.
312
+ #
313
+ # @return [NetworkTxnAgreementContract] operation results.
314
+ #
315
+ def get_transaction_author_agreement(network_id, custom_headers:nil)
316
+ response = get_transaction_author_agreement_async(network_id, custom_headers:custom_headers).value!
317
+ response.body unless response.nil?
318
+ end
319
+
320
+ #
321
+ # [Deprecated] Get network transaction author agreement
322
+ #
323
+ # This endpoint is no longer needed.
324
+ # Get the latest transaction author agreement and acceptance methods if one is
325
+ # set on the specified network.
326
+ #
327
+ # @param network_id [String] The network identifier
328
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
329
+ # will be added to the HTTP request.
330
+ #
331
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
332
+ #
333
+ def get_transaction_author_agreement_with_http_info(network_id, custom_headers:nil)
334
+ get_transaction_author_agreement_async(network_id, custom_headers:custom_headers).value!
335
+ end
336
+
337
+ #
338
+ # [Deprecated] Get network transaction author agreement
339
+ #
340
+ # This endpoint is no longer needed.
341
+ # Get the latest transaction author agreement and acceptance methods if one is
342
+ # set on the specified network.
343
+ #
344
+ # @param network_id [String] The network identifier
345
+ # @param [Hash{String => String}] A hash of custom headers that will be added
346
+ # to the HTTP request.
347
+ #
348
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
349
+ #
350
+ def get_transaction_author_agreement_async(network_id, custom_headers:nil)
351
+ fail ArgumentError, 'network_id is nil' if network_id.nil?
352
+
353
+
354
+ request_headers = {}
355
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
356
+ path_template = 'common/networks/{networkId}/txnAuthorAgreement'
357
+
358
+ request_url = @base_url || self.base_url
359
+
360
+ options = {
361
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
362
+ path_params: {'networkId' => network_id},
363
+ headers: request_headers.merge(custom_headers || {}),
364
+ base_url: request_url
365
+ }
366
+ promise = self.make_request_async(:get, path_template, options)
367
+
368
+ promise = promise.then do |result|
369
+ http_response = result.response
370
+ status_code = http_response.status
371
+ response_content = http_response.body
372
+ unless status_code == 200
373
+ error_model = JSON.load(response_content)
374
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
375
+ end
376
+
377
+ # Deserialize Response
378
+ if status_code == 200
379
+ begin
380
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
381
+ result_mapper = Credentials::Models::NetworkTxnAgreementContract.mapper()
382
+ result.body = self.deserialize(result_mapper, parsed_response)
383
+ rescue Exception => e
384
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
385
+ end
386
+ end
387
+
388
+ result
389
+ end
390
+
391
+ promise.execute
392
+ end
393
+
394
+ #
395
+ # [Deprecated] Accept network transaction author agreement
396
+ #
397
+ # This endpoint is no longer needed.
398
+ # Accept the latest transaction author agreement on the specified network.
399
+ #
400
+ # @param tenant_id [String] The tenant identifier
401
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
402
+ # will be added to the HTTP request.
403
+ #
404
+ #
405
+ def accept_transaction_author_agreement(tenant_id, custom_headers:nil)
406
+ response = accept_transaction_author_agreement_async(tenant_id, custom_headers:custom_headers).value!
407
+ nil
408
+ end
409
+
410
+ #
411
+ # [Deprecated] Accept network transaction author agreement
412
+ #
413
+ # This endpoint is no longer needed.
414
+ # Accept the latest transaction author agreement on the specified network.
415
+ #
416
+ # @param tenant_id [String] The tenant identifier
417
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
418
+ # will be added to the HTTP request.
419
+ #
420
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
421
+ #
422
+ def accept_transaction_author_agreement_with_http_info(tenant_id, custom_headers:nil)
423
+ accept_transaction_author_agreement_async(tenant_id, custom_headers:custom_headers).value!
424
+ end
425
+
426
+ #
427
+ # [Deprecated] Accept network transaction author agreement
428
+ #
429
+ # This endpoint is no longer needed.
430
+ # Accept the latest transaction author agreement on the specified network.
431
+ #
432
+ # @param tenant_id [String] The tenant identifier
433
+ # @param [Hash{String => String}] A hash of custom headers that will be added
434
+ # to the HTTP request.
435
+ #
436
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
437
+ #
438
+ def accept_transaction_author_agreement_async(tenant_id, custom_headers:nil)
439
+ fail ArgumentError, 'tenant_id is nil' if tenant_id.nil?
440
+
441
+
442
+ request_headers = {}
443
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
444
+ path_template = 'common/networks/{tenantId}/txnAuthorAgreement'
445
+
446
+ request_url = @base_url || self.base_url
447
+
448
+ options = {
449
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
450
+ path_params: {'tenantId' => tenant_id},
451
+ headers: request_headers.merge(custom_headers || {}),
452
+ base_url: request_url
453
+ }
454
+ promise = self.make_request_async(:put, path_template, options)
455
+
456
+ promise = promise.then do |result|
457
+ http_response = result.response
458
+ status_code = http_response.status
459
+ response_content = http_response.body
460
+ unless status_code == 200
461
+ error_model = JSON.load(response_content)
462
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
463
+ end
464
+
465
+
466
+ result
467
+ end
468
+
469
+ promise.execute
470
+ end
471
+
472
+ #
473
+ # List all connections
474
+ #
475
+ # Retrieve a list of all connections.
476
+ # Optionally, list only connections in a specified state.
477
+ #
478
+ # @param state [Enum] The connection state. Possible values include: 'Invited',
479
+ # 'Negotiating', 'Connected'
480
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
481
+ # will be added to the HTTP request.
482
+ #
483
+ # @return [Array] operation results.
484
+ #
485
+ def list_connections(state:nil, custom_headers:nil)
486
+ response = list_connections_async(state:state, custom_headers:custom_headers).value!
487
+ response.body unless response.nil?
488
+ end
489
+
490
+ #
491
+ # List all connections
492
+ #
493
+ # Retrieve a list of all connections.
494
+ # Optionally, list only connections in a specified state.
495
+ #
496
+ # @param state [Enum] The connection state. Possible values include: 'Invited',
497
+ # 'Negotiating', 'Connected'
498
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
499
+ # will be added to the HTTP request.
500
+ #
501
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
502
+ #
503
+ def list_connections_with_http_info(state:nil, custom_headers:nil)
504
+ list_connections_async(state:state, custom_headers:custom_headers).value!
505
+ end
506
+
507
+ #
508
+ # List all connections
509
+ #
510
+ # Retrieve a list of all connections.
511
+ # Optionally, list only connections in a specified state.
512
+ #
513
+ # @param state [Enum] The connection state. Possible values include: 'Invited',
514
+ # 'Negotiating', 'Connected'
515
+ # @param [Hash{String => String}] A hash of custom headers that will be added
516
+ # to the HTTP request.
517
+ #
518
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
519
+ #
520
+ def list_connections_async(state:nil, custom_headers:nil)
521
+
522
+
523
+ request_headers = {}
524
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
525
+ path_template = 'connections'
526
+
527
+ request_url = @base_url || self.base_url
528
+
529
+ options = {
530
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
531
+ query_params: {'state' => state},
532
+ headers: request_headers.merge(custom_headers || {}),
533
+ base_url: request_url
534
+ }
535
+ promise = self.make_request_async(:get, path_template, options)
536
+
537
+ promise = promise.then do |result|
538
+ http_response = result.response
539
+ status_code = http_response.status
540
+ response_content = http_response.body
541
+ unless status_code == 200
542
+ error_model = JSON.load(response_content)
543
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
544
+ end
545
+
546
+ # Deserialize Response
547
+ if status_code == 200
548
+ begin
549
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
550
+ result_mapper = {
551
+ client_side_validation: true,
552
+ required: false,
553
+ serialized_name: 'parsed_response',
554
+ type: {
555
+ name: 'Sequence',
556
+ element: {
557
+ client_side_validation: true,
558
+ required: false,
559
+ serialized_name: 'ConnectionContractElementType',
560
+ type: {
561
+ name: 'Composite',
562
+ class_name: 'ConnectionContract'
563
+ }
564
+ }
565
+ }
566
+ }
567
+ result.body = self.deserialize(result_mapper, parsed_response)
568
+ rescue Exception => e
569
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
570
+ end
571
+ end
572
+
573
+ result
574
+ end
575
+
576
+ promise.execute
577
+ end
578
+
579
+ #
580
+ # Create connection
581
+ #
582
+ # Initiate a new connection by creating an invitation.
583
+ # The newly created connection record will be in state 'Invited' until the
584
+ # other party has accepted the invitation.
585
+ # The response body includes details about the newly creation connection.
586
+ #
587
+ # @param body [ConnectionInvitationParameters] Connection invitation parameters
588
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
589
+ # will be added to the HTTP request.
590
+ #
591
+ # @return [ConnectionContract] operation results.
592
+ #
593
+ def create_connection(body, custom_headers:nil)
594
+ response = create_connection_async(body, custom_headers:custom_headers).value!
595
+ response.body unless response.nil?
596
+ end
597
+
598
+ #
599
+ # Create connection
600
+ #
601
+ # Initiate a new connection by creating an invitation.
602
+ # The newly created connection record will be in state 'Invited' until the
603
+ # other party has accepted the invitation.
604
+ # The response body includes details about the newly creation connection.
605
+ #
606
+ # @param body [ConnectionInvitationParameters] Connection invitation parameters
607
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
608
+ # will be added to the HTTP request.
609
+ #
610
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
611
+ #
612
+ def create_connection_with_http_info(body, custom_headers:nil)
613
+ create_connection_async(body, custom_headers:custom_headers).value!
614
+ end
615
+
616
+ #
617
+ # Create connection
618
+ #
619
+ # Initiate a new connection by creating an invitation.
620
+ # The newly created connection record will be in state 'Invited' until the
621
+ # other party has accepted the invitation.
622
+ # The response body includes details about the newly creation connection.
623
+ #
624
+ # @param body [ConnectionInvitationParameters] Connection invitation parameters
625
+ # @param [Hash{String => String}] A hash of custom headers that will be added
626
+ # to the HTTP request.
627
+ #
628
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
629
+ #
630
+ def create_connection_async(body, custom_headers:nil)
631
+ fail ArgumentError, 'body is nil' if body.nil?
632
+
633
+
634
+ request_headers = {}
635
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
636
+
637
+ # Serialize Request
638
+ request_mapper = Credentials::Models::ConnectionInvitationParameters.mapper()
639
+ request_content = self.serialize(request_mapper, body)
640
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
641
+
642
+ path_template = 'connections'
643
+
644
+ request_url = @base_url || self.base_url
645
+
646
+ options = {
647
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
648
+ body: request_content,
649
+ headers: request_headers.merge(custom_headers || {}),
650
+ base_url: request_url
651
+ }
652
+ promise = self.make_request_async(:post, path_template, options)
653
+
654
+ promise = promise.then do |result|
655
+ http_response = result.response
656
+ status_code = http_response.status
657
+ response_content = http_response.body
658
+ unless status_code == 200
659
+ error_model = JSON.load(response_content)
660
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
661
+ end
662
+
663
+ # Deserialize Response
664
+ if status_code == 200
665
+ begin
666
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
667
+ result_mapper = Credentials::Models::ConnectionContract.mapper()
668
+ result.body = self.deserialize(result_mapper, parsed_response)
669
+ rescue Exception => e
670
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
671
+ end
672
+ end
673
+
674
+ result
675
+ end
676
+
677
+ promise.execute
678
+ end
679
+
680
+ #
681
+ # Get connection
682
+ #
683
+ # Get the specified connection.
684
+ #
685
+ # @param connection_id [String] The connection identifier
686
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
687
+ # will be added to the HTTP request.
688
+ #
689
+ # @return [ConnectionContract] operation results.
690
+ #
691
+ def get_connection(connection_id, custom_headers:nil)
692
+ response = get_connection_async(connection_id, custom_headers:custom_headers).value!
693
+ response.body unless response.nil?
694
+ end
695
+
696
+ #
697
+ # Get connection
698
+ #
699
+ # Get the specified connection.
700
+ #
701
+ # @param connection_id [String] The connection identifier
702
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
703
+ # will be added to the HTTP request.
704
+ #
705
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
706
+ #
707
+ def get_connection_with_http_info(connection_id, custom_headers:nil)
708
+ get_connection_async(connection_id, custom_headers:custom_headers).value!
709
+ end
710
+
711
+ #
712
+ # Get connection
713
+ #
714
+ # Get the specified connection.
715
+ #
716
+ # @param connection_id [String] The connection identifier
717
+ # @param [Hash{String => String}] A hash of custom headers that will be added
718
+ # to the HTTP request.
719
+ #
720
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
721
+ #
722
+ def get_connection_async(connection_id, custom_headers:nil)
723
+ fail ArgumentError, 'connection_id is nil' if connection_id.nil?
724
+
725
+
726
+ request_headers = {}
727
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
728
+ path_template = 'connections/{connectionId}'
729
+
730
+ request_url = @base_url || self.base_url
731
+
732
+ options = {
733
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
734
+ path_params: {'connectionId' => connection_id},
735
+ headers: request_headers.merge(custom_headers || {}),
736
+ base_url: request_url
737
+ }
738
+ promise = self.make_request_async(:get, path_template, options)
739
+
740
+ promise = promise.then do |result|
741
+ http_response = result.response
742
+ status_code = http_response.status
743
+ response_content = http_response.body
744
+ unless status_code == 200
745
+ error_model = JSON.load(response_content)
746
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
747
+ end
748
+
749
+ # Deserialize Response
750
+ if status_code == 200
751
+ begin
752
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
753
+ result_mapper = Credentials::Models::ConnectionContract.mapper()
754
+ result.body = self.deserialize(result_mapper, parsed_response)
755
+ rescue Exception => e
756
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
757
+ end
758
+ end
759
+
760
+ result
761
+ end
762
+
763
+ promise.execute
764
+ end
765
+
766
+ #
767
+ # Delete connection
768
+ #
769
+ # Delete the specified connection.
770
+ #
771
+ # @param connection_id [String] The connection identifier
772
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
773
+ # will be added to the HTTP request.
774
+ #
775
+ #
776
+ def delete_connection(connection_id, custom_headers:nil)
777
+ response = delete_connection_async(connection_id, custom_headers:custom_headers).value!
778
+ nil
779
+ end
780
+
781
+ #
782
+ # Delete connection
783
+ #
784
+ # Delete the specified connection.
785
+ #
786
+ # @param connection_id [String] The connection identifier
787
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
788
+ # will be added to the HTTP request.
789
+ #
790
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
791
+ #
792
+ def delete_connection_with_http_info(connection_id, custom_headers:nil)
793
+ delete_connection_async(connection_id, custom_headers:custom_headers).value!
794
+ end
795
+
796
+ #
797
+ # Delete connection
798
+ #
799
+ # Delete the specified connection.
800
+ #
801
+ # @param connection_id [String] The connection identifier
802
+ # @param [Hash{String => String}] A hash of custom headers that will be added
803
+ # to the HTTP request.
804
+ #
805
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
806
+ #
807
+ def delete_connection_async(connection_id, custom_headers:nil)
808
+ fail ArgumentError, 'connection_id is nil' if connection_id.nil?
809
+
810
+
811
+ request_headers = {}
812
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
813
+ path_template = 'connections/{connectionId}'
814
+
815
+ request_url = @base_url || self.base_url
816
+
817
+ options = {
818
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
819
+ path_params: {'connectionId' => connection_id},
820
+ headers: request_headers.merge(custom_headers || {}),
821
+ base_url: request_url
822
+ }
823
+ promise = self.make_request_async(:delete, path_template, options)
824
+
825
+ promise = promise.then do |result|
826
+ http_response = result.response
827
+ status_code = http_response.status
828
+ response_content = http_response.body
829
+ unless status_code == 200
830
+ error_model = JSON.load(response_content)
831
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
832
+ end
833
+
834
+
835
+ result
836
+ end
837
+
838
+ promise.execute
839
+ end
840
+
841
+ #
842
+ # List all credentials
843
+ #
844
+ # List all credentials that match any specified query parameters.
845
+ # No query parameters are required, but any provided will filter the results.
846
+ #
847
+ # @param connection_id [String] A connection identifier
848
+ # @param state [Enum] The state of credentials. Possible values include:
849
+ # 'Offered', 'Requested', 'Issued', 'Rejected', 'Revoked'
850
+ # @param definition_id [String] A credential definition identifier
851
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
852
+ # will be added to the HTTP request.
853
+ #
854
+ # @return [Array] operation results.
855
+ #
856
+ def list_credentials(connection_id:nil, state:nil, definition_id:nil, custom_headers:nil)
857
+ response = list_credentials_async(connection_id:connection_id, state:state, definition_id:definition_id, custom_headers:custom_headers).value!
858
+ response.body unless response.nil?
859
+ end
860
+
861
+ #
862
+ # List all credentials
863
+ #
864
+ # List all credentials that match any specified query parameters.
865
+ # No query parameters are required, but any provided will filter the results.
866
+ #
867
+ # @param connection_id [String] A connection identifier
868
+ # @param state [Enum] The state of credentials. Possible values include:
869
+ # 'Offered', 'Requested', 'Issued', 'Rejected', 'Revoked'
870
+ # @param definition_id [String] A credential definition identifier
871
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
872
+ # will be added to the HTTP request.
873
+ #
874
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
875
+ #
876
+ def list_credentials_with_http_info(connection_id:nil, state:nil, definition_id:nil, custom_headers:nil)
877
+ list_credentials_async(connection_id:connection_id, state:state, definition_id:definition_id, custom_headers:custom_headers).value!
878
+ end
879
+
880
+ #
881
+ # List all credentials
882
+ #
883
+ # List all credentials that match any specified query parameters.
884
+ # No query parameters are required, but any provided will filter the results.
885
+ #
886
+ # @param connection_id [String] A connection identifier
887
+ # @param state [Enum] The state of credentials. Possible values include:
888
+ # 'Offered', 'Requested', 'Issued', 'Rejected', 'Revoked'
889
+ # @param definition_id [String] A credential definition identifier
890
+ # @param [Hash{String => String}] A hash of custom headers that will be added
891
+ # to the HTTP request.
892
+ #
893
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
894
+ #
895
+ def list_credentials_async(connection_id:nil, state:nil, definition_id:nil, custom_headers:nil)
896
+
897
+
898
+ request_headers = {}
899
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
900
+ path_template = 'credentials'
901
+
902
+ request_url = @base_url || self.base_url
903
+
904
+ options = {
905
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
906
+ query_params: {'connectionId' => connection_id,'state' => state,'definitionId' => definition_id},
907
+ headers: request_headers.merge(custom_headers || {}),
908
+ base_url: request_url
909
+ }
910
+ promise = self.make_request_async(:get, path_template, options)
911
+
912
+ promise = promise.then do |result|
913
+ http_response = result.response
914
+ status_code = http_response.status
915
+ response_content = http_response.body
916
+ unless status_code == 200
917
+ error_model = JSON.load(response_content)
918
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
919
+ end
920
+
921
+ # Deserialize Response
922
+ if status_code == 200
923
+ begin
924
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
925
+ result_mapper = {
926
+ client_side_validation: true,
927
+ required: false,
928
+ serialized_name: 'parsed_response',
929
+ type: {
930
+ name: 'Sequence',
931
+ element: {
932
+ client_side_validation: true,
933
+ required: false,
934
+ serialized_name: 'CredentialContractElementType',
935
+ type: {
936
+ name: 'Composite',
937
+ class_name: 'CredentialContract'
938
+ }
939
+ }
940
+ }
941
+ }
942
+ result.body = self.deserialize(result_mapper, parsed_response)
943
+ rescue Exception => e
944
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
945
+ end
946
+ end
947
+
948
+ result
949
+ end
950
+
951
+ promise.execute
952
+ end
953
+
954
+ #
955
+ # Create and offer credential
956
+ #
957
+ # Send a credential offer of the specified credential definition to the
958
+ # specified connection.
959
+ #
960
+ # @param body [CredentialOfferParameters] The definition and connection to
961
+ # which this offer will be sent
962
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
963
+ # will be added to the HTTP request.
964
+ #
965
+ # @return [CredentialContract] operation results.
966
+ #
967
+ def create_credential(body, custom_headers:nil)
968
+ response = create_credential_async(body, custom_headers:custom_headers).value!
969
+ response.body unless response.nil?
970
+ end
971
+
972
+ #
973
+ # Create and offer credential
974
+ #
975
+ # Send a credential offer of the specified credential definition to the
976
+ # specified connection.
977
+ #
978
+ # @param body [CredentialOfferParameters] The definition and connection to
979
+ # which this offer will be sent
980
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
981
+ # will be added to the HTTP request.
982
+ #
983
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
984
+ #
985
+ def create_credential_with_http_info(body, custom_headers:nil)
986
+ create_credential_async(body, custom_headers:custom_headers).value!
987
+ end
988
+
989
+ #
990
+ # Create and offer credential
991
+ #
992
+ # Send a credential offer of the specified credential definition to the
993
+ # specified connection.
994
+ #
995
+ # @param body [CredentialOfferParameters] The definition and connection to
996
+ # which this offer will be sent
997
+ # @param [Hash{String => String}] A hash of custom headers that will be added
998
+ # to the HTTP request.
999
+ #
1000
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1001
+ #
1002
+ def create_credential_async(body, custom_headers:nil)
1003
+ fail ArgumentError, 'body is nil' if body.nil?
1004
+
1005
+
1006
+ request_headers = {}
1007
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1008
+
1009
+ # Serialize Request
1010
+ request_mapper = Credentials::Models::CredentialOfferParameters.mapper()
1011
+ request_content = self.serialize(request_mapper, body)
1012
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1013
+
1014
+ path_template = 'credentials'
1015
+
1016
+ request_url = @base_url || self.base_url
1017
+
1018
+ options = {
1019
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1020
+ body: request_content,
1021
+ headers: request_headers.merge(custom_headers || {}),
1022
+ base_url: request_url
1023
+ }
1024
+ promise = self.make_request_async(:post, path_template, options)
1025
+
1026
+ promise = promise.then do |result|
1027
+ http_response = result.response
1028
+ status_code = http_response.status
1029
+ response_content = http_response.body
1030
+ unless status_code == 200
1031
+ error_model = JSON.load(response_content)
1032
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1033
+ end
1034
+
1035
+ # Deserialize Response
1036
+ if status_code == 200
1037
+ begin
1038
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1039
+ result_mapper = Credentials::Models::CredentialContract.mapper()
1040
+ result.body = self.deserialize(result_mapper, parsed_response)
1041
+ rescue Exception => e
1042
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1043
+ end
1044
+ end
1045
+
1046
+ result
1047
+ end
1048
+
1049
+ promise.execute
1050
+ end
1051
+
1052
+ #
1053
+ # Get credential
1054
+ #
1055
+ # Get the specified credential.
1056
+ #
1057
+ # @param credential_id [String] The credential identifier
1058
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1059
+ # will be added to the HTTP request.
1060
+ #
1061
+ # @return [CredentialContract] operation results.
1062
+ #
1063
+ def get_credential(credential_id, custom_headers:nil)
1064
+ response = get_credential_async(credential_id, custom_headers:custom_headers).value!
1065
+ response.body unless response.nil?
1066
+ end
1067
+
1068
+ #
1069
+ # Get credential
1070
+ #
1071
+ # Get the specified credential.
1072
+ #
1073
+ # @param credential_id [String] The credential identifier
1074
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1075
+ # will be added to the HTTP request.
1076
+ #
1077
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
1078
+ #
1079
+ def get_credential_with_http_info(credential_id, custom_headers:nil)
1080
+ get_credential_async(credential_id, custom_headers:custom_headers).value!
1081
+ end
1082
+
1083
+ #
1084
+ # Get credential
1085
+ #
1086
+ # Get the specified credential.
1087
+ #
1088
+ # @param credential_id [String] The credential identifier
1089
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1090
+ # to the HTTP request.
1091
+ #
1092
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1093
+ #
1094
+ def get_credential_async(credential_id, custom_headers:nil)
1095
+ fail ArgumentError, 'credential_id is nil' if credential_id.nil?
1096
+
1097
+
1098
+ request_headers = {}
1099
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1100
+ path_template = 'credentials/{credentialId}'
1101
+
1102
+ request_url = @base_url || self.base_url
1103
+
1104
+ options = {
1105
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1106
+ path_params: {'credentialId' => credential_id},
1107
+ headers: request_headers.merge(custom_headers || {}),
1108
+ base_url: request_url
1109
+ }
1110
+ promise = self.make_request_async(:get, path_template, options)
1111
+
1112
+ promise = promise.then do |result|
1113
+ http_response = result.response
1114
+ status_code = http_response.status
1115
+ response_content = http_response.body
1116
+ unless status_code == 200
1117
+ error_model = JSON.load(response_content)
1118
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1119
+ end
1120
+
1121
+ # Deserialize Response
1122
+ if status_code == 200
1123
+ begin
1124
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1125
+ result_mapper = Credentials::Models::CredentialContract.mapper()
1126
+ result.body = self.deserialize(result_mapper, parsed_response)
1127
+ rescue Exception => e
1128
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1129
+ end
1130
+ end
1131
+
1132
+ result
1133
+ end
1134
+
1135
+ promise.execute
1136
+ end
1137
+
1138
+ #
1139
+ # Issue credential
1140
+ #
1141
+ # Issue the specified credential.
1142
+ # If the values offered were incorrect, changes to the values may be made here.
1143
+ # You must update all of the values, and they must be follow the same structure
1144
+ # of the schema.
1145
+ # To keep the values the same as those included in the credential offer, leave
1146
+ # the body blank.
1147
+ #
1148
+ # @param credential_id [String] The credential identifier
1149
+ # @param body [Hash{String => String}] Updated credential values
1150
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1151
+ # will be added to the HTTP request.
1152
+ #
1153
+ #
1154
+ def issue_credential(credential_id, body:nil, custom_headers:nil)
1155
+ response = issue_credential_async(credential_id, body:body, custom_headers:custom_headers).value!
1156
+ nil
1157
+ end
1158
+
1159
+ #
1160
+ # Issue credential
1161
+ #
1162
+ # Issue the specified credential.
1163
+ # If the values offered were incorrect, changes to the values may be made here.
1164
+ # You must update all of the values, and they must be follow the same structure
1165
+ # of the schema.
1166
+ # To keep the values the same as those included in the credential offer, leave
1167
+ # the body blank.
1168
+ #
1169
+ # @param credential_id [String] The credential identifier
1170
+ # @param body [Hash{String => String}] Updated credential values
1171
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1172
+ # will be added to the HTTP request.
1173
+ #
1174
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
1175
+ #
1176
+ def issue_credential_with_http_info(credential_id, body:nil, custom_headers:nil)
1177
+ issue_credential_async(credential_id, body:body, custom_headers:custom_headers).value!
1178
+ end
1179
+
1180
+ #
1181
+ # Issue credential
1182
+ #
1183
+ # Issue the specified credential.
1184
+ # If the values offered were incorrect, changes to the values may be made here.
1185
+ # You must update all of the values, and they must be follow the same structure
1186
+ # of the schema.
1187
+ # To keep the values the same as those included in the credential offer, leave
1188
+ # the body blank.
1189
+ #
1190
+ # @param credential_id [String] The credential identifier
1191
+ # @param body [Hash{String => String}] Updated credential values
1192
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1193
+ # to the HTTP request.
1194
+ #
1195
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1196
+ #
1197
+ def issue_credential_async(credential_id, body:nil, custom_headers:nil)
1198
+ fail ArgumentError, 'credential_id is nil' if credential_id.nil?
1199
+
1200
+
1201
+ request_headers = {}
1202
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1203
+
1204
+ # Serialize Request
1205
+ request_mapper = {
1206
+ client_side_validation: true,
1207
+ required: false,
1208
+ serialized_name: 'body',
1209
+ type: {
1210
+ name: 'Dictionary',
1211
+ value: {
1212
+ client_side_validation: true,
1213
+ required: false,
1214
+ serialized_name: 'StringElementType',
1215
+ type: {
1216
+ name: 'String'
1217
+ }
1218
+ }
1219
+ }
1220
+ }
1221
+ request_content = self.serialize(request_mapper, body)
1222
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1223
+
1224
+ path_template = 'credentials/{credentialId}'
1225
+
1226
+ request_url = @base_url || self.base_url
1227
+
1228
+ options = {
1229
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1230
+ path_params: {'credentialId' => credential_id},
1231
+ body: request_content,
1232
+ headers: request_headers.merge(custom_headers || {}),
1233
+ base_url: request_url
1234
+ }
1235
+ promise = self.make_request_async(:put, path_template, options)
1236
+
1237
+ promise = promise.then do |result|
1238
+ http_response = result.response
1239
+ status_code = http_response.status
1240
+ response_content = http_response.body
1241
+ unless status_code == 200
1242
+ error_model = JSON.load(response_content)
1243
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1244
+ end
1245
+
1246
+
1247
+ result
1248
+ end
1249
+
1250
+ promise.execute
1251
+ end
1252
+
1253
+ #
1254
+ # Revoke an issued credential
1255
+ #
1256
+ # Revoke credential that was issued previously.
1257
+ # Process of revocation will update the revocation registry locally and on the
1258
+ # ledger.
1259
+ # Issued credentials can still participate in proof workflows and be considered
1260
+ # valid, but only if the verifying ignores the revocation trail.
1261
+ #
1262
+ # @param credential_id [String] The credential identifier
1263
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1264
+ # will be added to the HTTP request.
1265
+ #
1266
+ #
1267
+ def revoke_credential(credential_id, custom_headers:nil)
1268
+ response = revoke_credential_async(credential_id, custom_headers:custom_headers).value!
1269
+ nil
1270
+ end
1271
+
1272
+ #
1273
+ # Revoke an issued credential
1274
+ #
1275
+ # Revoke credential that was issued previously.
1276
+ # Process of revocation will update the revocation registry locally and on the
1277
+ # ledger.
1278
+ # Issued credentials can still participate in proof workflows and be considered
1279
+ # valid, but only if the verifying ignores the revocation trail.
1280
+ #
1281
+ # @param credential_id [String] The credential identifier
1282
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1283
+ # will be added to the HTTP request.
1284
+ #
1285
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
1286
+ #
1287
+ def revoke_credential_with_http_info(credential_id, custom_headers:nil)
1288
+ revoke_credential_async(credential_id, custom_headers:custom_headers).value!
1289
+ end
1290
+
1291
+ #
1292
+ # Revoke an issued credential
1293
+ #
1294
+ # Revoke credential that was issued previously.
1295
+ # Process of revocation will update the revocation registry locally and on the
1296
+ # ledger.
1297
+ # Issued credentials can still participate in proof workflows and be considered
1298
+ # valid, but only if the verifying ignores the revocation trail.
1299
+ #
1300
+ # @param credential_id [String] The credential identifier
1301
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1302
+ # to the HTTP request.
1303
+ #
1304
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1305
+ #
1306
+ def revoke_credential_async(credential_id, custom_headers:nil)
1307
+ fail ArgumentError, 'credential_id is nil' if credential_id.nil?
1308
+
1309
+
1310
+ request_headers = {}
1311
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1312
+ path_template = 'credentials/{credentialId}'
1313
+
1314
+ request_url = @base_url || self.base_url
1315
+
1316
+ options = {
1317
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1318
+ path_params: {'credentialId' => credential_id},
1319
+ headers: request_headers.merge(custom_headers || {}),
1320
+ base_url: request_url
1321
+ }
1322
+ promise = self.make_request_async(:delete, path_template, options)
1323
+
1324
+ promise = promise.then do |result|
1325
+ http_response = result.response
1326
+ status_code = http_response.status
1327
+ response_content = http_response.body
1328
+ unless status_code == 200
1329
+ error_model = JSON.load(response_content)
1330
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1331
+ end
1332
+
1333
+
1334
+ result
1335
+ end
1336
+
1337
+ promise.execute
1338
+ end
1339
+
1340
+ #
1341
+ # Delete credential
1342
+ #
1343
+ # Delete the specified credential.
1344
+ # This endpoint does not revoke the credential.
1345
+ #
1346
+ # @param credential_id [String] The credential identifier
1347
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1348
+ # will be added to the HTTP request.
1349
+ #
1350
+ #
1351
+ def delete_credential(credential_id, custom_headers:nil)
1352
+ response = delete_credential_async(credential_id, custom_headers:custom_headers).value!
1353
+ nil
1354
+ end
1355
+
1356
+ #
1357
+ # Delete credential
1358
+ #
1359
+ # Delete the specified credential.
1360
+ # This endpoint does not revoke the credential.
1361
+ #
1362
+ # @param credential_id [String] The credential identifier
1363
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1364
+ # will be added to the HTTP request.
1365
+ #
1366
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
1367
+ #
1368
+ def delete_credential_with_http_info(credential_id, custom_headers:nil)
1369
+ delete_credential_async(credential_id, custom_headers:custom_headers).value!
1370
+ end
1371
+
1372
+ #
1373
+ # Delete credential
1374
+ #
1375
+ # Delete the specified credential.
1376
+ # This endpoint does not revoke the credential.
1377
+ #
1378
+ # @param credential_id [String] The credential identifier
1379
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1380
+ # to the HTTP request.
1381
+ #
1382
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1383
+ #
1384
+ def delete_credential_async(credential_id, custom_headers:nil)
1385
+ fail ArgumentError, 'credential_id is nil' if credential_id.nil?
1386
+
1387
+
1388
+ request_headers = {}
1389
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1390
+ path_template = 'credentials/delete/{credentialId}'
1391
+
1392
+ request_url = @base_url || self.base_url
1393
+
1394
+ options = {
1395
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1396
+ path_params: {'credentialId' => credential_id},
1397
+ headers: request_headers.merge(custom_headers || {}),
1398
+ base_url: request_url
1399
+ }
1400
+ promise = self.make_request_async(:delete, path_template, options)
1401
+
1402
+ promise = promise.then do |result|
1403
+ http_response = result.response
1404
+ status_code = http_response.status
1405
+ response_content = http_response.body
1406
+ unless status_code == 200
1407
+ error_model = JSON.load(response_content)
1408
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1409
+ end
1410
+
1411
+
1412
+ result
1413
+ end
1414
+
1415
+ promise.execute
1416
+ end
1417
+
1418
+ #
1419
+ # List all verification policies
1420
+ #
1421
+ # List all verification policies for the authenticated organization.
1422
+ #
1423
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1424
+ # will be added to the HTTP request.
1425
+ #
1426
+ # @return [Array] operation results.
1427
+ #
1428
+ def list_verification_policies(custom_headers:nil)
1429
+ response = list_verification_policies_async(custom_headers:custom_headers).value!
1430
+ response.body unless response.nil?
1431
+ end
1432
+
1433
+ #
1434
+ # List all verification policies
1435
+ #
1436
+ # List all verification policies for the authenticated organization.
1437
+ #
1438
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1439
+ # will be added to the HTTP request.
1440
+ #
1441
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
1442
+ #
1443
+ def list_verification_policies_with_http_info(custom_headers:nil)
1444
+ list_verification_policies_async(custom_headers:custom_headers).value!
1445
+ end
1446
+
1447
+ #
1448
+ # List all verification policies
1449
+ #
1450
+ # List all verification policies for the authenticated organization.
1451
+ #
1452
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1453
+ # to the HTTP request.
1454
+ #
1455
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1456
+ #
1457
+ def list_verification_policies_async(custom_headers:nil)
1458
+
1459
+
1460
+ request_headers = {}
1461
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1462
+ path_template = 'verificationPolicies'
1463
+
1464
+ request_url = @base_url || self.base_url
1465
+
1466
+ options = {
1467
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1468
+ headers: request_headers.merge(custom_headers || {}),
1469
+ base_url: request_url
1470
+ }
1471
+ promise = self.make_request_async(:get, path_template, options)
1472
+
1473
+ promise = promise.then do |result|
1474
+ http_response = result.response
1475
+ status_code = http_response.status
1476
+ response_content = http_response.body
1477
+ unless status_code == 200
1478
+ error_model = JSON.load(response_content)
1479
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1480
+ end
1481
+
1482
+ # Deserialize Response
1483
+ if status_code == 200
1484
+ begin
1485
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1486
+ result_mapper = {
1487
+ client_side_validation: true,
1488
+ required: false,
1489
+ serialized_name: 'parsed_response',
1490
+ type: {
1491
+ name: 'Sequence',
1492
+ element: {
1493
+ client_side_validation: true,
1494
+ required: false,
1495
+ serialized_name: 'VerificationPolicyContractElementType',
1496
+ type: {
1497
+ name: 'Composite',
1498
+ class_name: 'VerificationPolicyContract'
1499
+ }
1500
+ }
1501
+ }
1502
+ }
1503
+ result.body = self.deserialize(result_mapper, parsed_response)
1504
+ rescue Exception => e
1505
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1506
+ end
1507
+ end
1508
+
1509
+ result
1510
+ end
1511
+
1512
+ promise.execute
1513
+ end
1514
+
1515
+ #
1516
+ # Create verification policy
1517
+ #
1518
+ # Create a verification policy from the specified parameters.
1519
+ #
1520
+ # @param body [VerificationPolicyParameters] The verification policy parameters
1521
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1522
+ # will be added to the HTTP request.
1523
+ #
1524
+ # @return [VerificationPolicyContract] operation results.
1525
+ #
1526
+ def create_verification_policy(body, custom_headers:nil)
1527
+ response = create_verification_policy_async(body, custom_headers:custom_headers).value!
1528
+ response.body unless response.nil?
1529
+ end
1530
+
1531
+ #
1532
+ # Create verification policy
1533
+ #
1534
+ # Create a verification policy from the specified parameters.
1535
+ #
1536
+ # @param body [VerificationPolicyParameters] The verification policy parameters
1537
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1538
+ # will be added to the HTTP request.
1539
+ #
1540
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
1541
+ #
1542
+ def create_verification_policy_with_http_info(body, custom_headers:nil)
1543
+ create_verification_policy_async(body, custom_headers:custom_headers).value!
1544
+ end
1545
+
1546
+ #
1547
+ # Create verification policy
1548
+ #
1549
+ # Create a verification policy from the specified parameters.
1550
+ #
1551
+ # @param body [VerificationPolicyParameters] The verification policy parameters
1552
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1553
+ # to the HTTP request.
1554
+ #
1555
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1556
+ #
1557
+ def create_verification_policy_async(body, custom_headers:nil)
1558
+ fail ArgumentError, 'body is nil' if body.nil?
1559
+
1560
+
1561
+ request_headers = {}
1562
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1563
+
1564
+ # Serialize Request
1565
+ request_mapper = Credentials::Models::VerificationPolicyParameters.mapper()
1566
+ request_content = self.serialize(request_mapper, body)
1567
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1568
+
1569
+ path_template = 'verificationPolicies'
1570
+
1571
+ request_url = @base_url || self.base_url
1572
+
1573
+ options = {
1574
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1575
+ body: request_content,
1576
+ headers: request_headers.merge(custom_headers || {}),
1577
+ base_url: request_url
1578
+ }
1579
+ promise = self.make_request_async(:post, path_template, options)
1580
+
1581
+ promise = promise.then do |result|
1582
+ http_response = result.response
1583
+ status_code = http_response.status
1584
+ response_content = http_response.body
1585
+ unless status_code == 200
1586
+ error_model = JSON.load(response_content)
1587
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1588
+ end
1589
+
1590
+ # Deserialize Response
1591
+ if status_code == 200
1592
+ begin
1593
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1594
+ result_mapper = Credentials::Models::VerificationPolicyContract.mapper()
1595
+ result.body = self.deserialize(result_mapper, parsed_response)
1596
+ rescue Exception => e
1597
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1598
+ end
1599
+ end
1600
+
1601
+ result
1602
+ end
1603
+
1604
+ promise.execute
1605
+ end
1606
+
1607
+ #
1608
+ # Get verification policy
1609
+ #
1610
+ # Get the specified verification policy.
1611
+ #
1612
+ # @param policy_id [String] The verification policy identifier
1613
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1614
+ # will be added to the HTTP request.
1615
+ #
1616
+ # @return [VerificationPolicyContract] operation results.
1617
+ #
1618
+ def get_verification_policy(policy_id, custom_headers:nil)
1619
+ response = get_verification_policy_async(policy_id, custom_headers:custom_headers).value!
1620
+ response.body unless response.nil?
1621
+ end
1622
+
1623
+ #
1624
+ # Get verification policy
1625
+ #
1626
+ # Get the specified verification policy.
1627
+ #
1628
+ # @param policy_id [String] The verification policy identifier
1629
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1630
+ # will be added to the HTTP request.
1631
+ #
1632
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
1633
+ #
1634
+ def get_verification_policy_with_http_info(policy_id, custom_headers:nil)
1635
+ get_verification_policy_async(policy_id, custom_headers:custom_headers).value!
1636
+ end
1637
+
1638
+ #
1639
+ # Get verification policy
1640
+ #
1641
+ # Get the specified verification policy.
1642
+ #
1643
+ # @param policy_id [String] The verification policy identifier
1644
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1645
+ # to the HTTP request.
1646
+ #
1647
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1648
+ #
1649
+ def get_verification_policy_async(policy_id, custom_headers:nil)
1650
+ fail ArgumentError, 'policy_id is nil' if policy_id.nil?
1651
+
1652
+
1653
+ request_headers = {}
1654
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1655
+ path_template = 'verificationPolicies/{policyId}'
1656
+
1657
+ request_url = @base_url || self.base_url
1658
+
1659
+ options = {
1660
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1661
+ path_params: {'policyId' => policy_id},
1662
+ headers: request_headers.merge(custom_headers || {}),
1663
+ base_url: request_url
1664
+ }
1665
+ promise = self.make_request_async(:get, path_template, options)
1666
+
1667
+ promise = promise.then do |result|
1668
+ http_response = result.response
1669
+ status_code = http_response.status
1670
+ response_content = http_response.body
1671
+ unless status_code == 200
1672
+ error_model = JSON.load(response_content)
1673
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1674
+ end
1675
+
1676
+ # Deserialize Response
1677
+ if status_code == 200
1678
+ begin
1679
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1680
+ result_mapper = Credentials::Models::VerificationPolicyContract.mapper()
1681
+ result.body = self.deserialize(result_mapper, parsed_response)
1682
+ rescue Exception => e
1683
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1684
+ end
1685
+ end
1686
+
1687
+ result
1688
+ end
1689
+
1690
+ promise.execute
1691
+ end
1692
+
1693
+ #
1694
+ # Delete verification policy
1695
+ #
1696
+ # Delete the specified verification policy.
1697
+ #
1698
+ # @param policy_id [String] The verification policy identifier
1699
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1700
+ # will be added to the HTTP request.
1701
+ #
1702
+ #
1703
+ def delete_verification_policy(policy_id, custom_headers:nil)
1704
+ response = delete_verification_policy_async(policy_id, custom_headers:custom_headers).value!
1705
+ nil
1706
+ end
1707
+
1708
+ #
1709
+ # Delete verification policy
1710
+ #
1711
+ # Delete the specified verification policy.
1712
+ #
1713
+ # @param policy_id [String] The verification policy identifier
1714
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1715
+ # will be added to the HTTP request.
1716
+ #
1717
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
1718
+ #
1719
+ def delete_verification_policy_with_http_info(policy_id, custom_headers:nil)
1720
+ delete_verification_policy_async(policy_id, custom_headers:custom_headers).value!
1721
+ end
1722
+
1723
+ #
1724
+ # Delete verification policy
1725
+ #
1726
+ # Delete the specified verification policy.
1727
+ #
1728
+ # @param policy_id [String] The verification policy identifier
1729
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1730
+ # to the HTTP request.
1731
+ #
1732
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1733
+ #
1734
+ def delete_verification_policy_async(policy_id, custom_headers:nil)
1735
+ fail ArgumentError, 'policy_id is nil' if policy_id.nil?
1736
+
1737
+
1738
+ request_headers = {}
1739
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1740
+ path_template = 'verificationPolicies/{policyId}'
1741
+
1742
+ request_url = @base_url || self.base_url
1743
+
1744
+ options = {
1745
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1746
+ path_params: {'policyId' => policy_id},
1747
+ headers: request_headers.merge(custom_headers || {}),
1748
+ base_url: request_url
1749
+ }
1750
+ promise = self.make_request_async(:delete, path_template, options)
1751
+
1752
+ promise = promise.then do |result|
1753
+ http_response = result.response
1754
+ status_code = http_response.status
1755
+ response_content = http_response.body
1756
+ unless status_code == 200
1757
+ error_model = JSON.load(response_content)
1758
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1759
+ end
1760
+
1761
+
1762
+ result
1763
+ end
1764
+
1765
+ promise.execute
1766
+ end
1767
+
1768
+ #
1769
+ # List all credential definitions
1770
+ #
1771
+ # List all credential definitions for the authorization context.
1772
+ #
1773
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1774
+ # will be added to the HTTP request.
1775
+ #
1776
+ # @return [Array] operation results.
1777
+ #
1778
+ def list_credential_definitions(custom_headers:nil)
1779
+ response = list_credential_definitions_async(custom_headers:custom_headers).value!
1780
+ response.body unless response.nil?
1781
+ end
1782
+
1783
+ #
1784
+ # List all credential definitions
1785
+ #
1786
+ # List all credential definitions for the authorization context.
1787
+ #
1788
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1789
+ # will be added to the HTTP request.
1790
+ #
1791
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
1792
+ #
1793
+ def list_credential_definitions_with_http_info(custom_headers:nil)
1794
+ list_credential_definitions_async(custom_headers:custom_headers).value!
1795
+ end
1796
+
1797
+ #
1798
+ # List all credential definitions
1799
+ #
1800
+ # List all credential definitions for the authorization context.
1801
+ #
1802
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1803
+ # to the HTTP request.
1804
+ #
1805
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1806
+ #
1807
+ def list_credential_definitions_async(custom_headers:nil)
1808
+
1809
+
1810
+ request_headers = {}
1811
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1812
+ path_template = 'definitions/credentials'
1813
+
1814
+ request_url = @base_url || self.base_url
1815
+
1816
+ options = {
1817
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1818
+ headers: request_headers.merge(custom_headers || {}),
1819
+ base_url: request_url
1820
+ }
1821
+ promise = self.make_request_async(:get, path_template, options)
1822
+
1823
+ promise = promise.then do |result|
1824
+ http_response = result.response
1825
+ status_code = http_response.status
1826
+ response_content = http_response.body
1827
+ unless status_code == 200
1828
+ error_model = JSON.load(response_content)
1829
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1830
+ end
1831
+
1832
+ # Deserialize Response
1833
+ if status_code == 200
1834
+ begin
1835
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1836
+ result_mapper = {
1837
+ client_side_validation: true,
1838
+ required: false,
1839
+ serialized_name: 'parsed_response',
1840
+ type: {
1841
+ name: 'Sequence',
1842
+ element: {
1843
+ client_side_validation: true,
1844
+ required: false,
1845
+ serialized_name: 'CredentialDefinitionContractElementType',
1846
+ type: {
1847
+ name: 'Composite',
1848
+ class_name: 'CredentialDefinitionContract'
1849
+ }
1850
+ }
1851
+ }
1852
+ }
1853
+ result.body = self.deserialize(result_mapper, parsed_response)
1854
+ rescue Exception => e
1855
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1856
+ end
1857
+ end
1858
+
1859
+ result
1860
+ end
1861
+
1862
+ promise.execute
1863
+ end
1864
+
1865
+ #
1866
+ # Create credential definition and schema from parameters
1867
+ #
1868
+ # A credential definition is created and saved on your cloud agent.
1869
+ #
1870
+ # @param body [CredentialDefinitionFromSchemaParameters] Definition parameters
1871
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1872
+ # will be added to the HTTP request.
1873
+ #
1874
+ # @return [CredentialDefinitionContract] operation results.
1875
+ #
1876
+ def create_credential_definition(body, custom_headers:nil)
1877
+ response = create_credential_definition_async(body, custom_headers:custom_headers).value!
1878
+ response.body unless response.nil?
1879
+ end
1880
+
1881
+ #
1882
+ # Create credential definition and schema from parameters
1883
+ #
1884
+ # A credential definition is created and saved on your cloud agent.
1885
+ #
1886
+ # @param body [CredentialDefinitionFromSchemaParameters] Definition parameters
1887
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1888
+ # will be added to the HTTP request.
1889
+ #
1890
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
1891
+ #
1892
+ def create_credential_definition_with_http_info(body, custom_headers:nil)
1893
+ create_credential_definition_async(body, custom_headers:custom_headers).value!
1894
+ end
1895
+
1896
+ #
1897
+ # Create credential definition and schema from parameters
1898
+ #
1899
+ # A credential definition is created and saved on your cloud agent.
1900
+ #
1901
+ # @param body [CredentialDefinitionFromSchemaParameters] Definition parameters
1902
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1903
+ # to the HTTP request.
1904
+ #
1905
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1906
+ #
1907
+ def create_credential_definition_async(body, custom_headers:nil)
1908
+ fail ArgumentError, 'body is nil' if body.nil?
1909
+
1910
+
1911
+ request_headers = {}
1912
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1913
+
1914
+ # Serialize Request
1915
+ request_mapper = Credentials::Models::CredentialDefinitionFromSchemaParameters.mapper()
1916
+ request_content = self.serialize(request_mapper, body)
1917
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1918
+
1919
+ path_template = 'definitions/credentials'
1920
+
1921
+ request_url = @base_url || self.base_url
1922
+
1923
+ options = {
1924
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1925
+ body: request_content,
1926
+ headers: request_headers.merge(custom_headers || {}),
1927
+ base_url: request_url
1928
+ }
1929
+ promise = self.make_request_async(:post, path_template, options)
1930
+
1931
+ promise = promise.then do |result|
1932
+ http_response = result.response
1933
+ status_code = http_response.status
1934
+ response_content = http_response.body
1935
+ unless status_code == 200
1936
+ error_model = JSON.load(response_content)
1937
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1938
+ end
1939
+
1940
+ # Deserialize Response
1941
+ if status_code == 200
1942
+ begin
1943
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1944
+ result_mapper = Credentials::Models::CredentialDefinitionContract.mapper()
1945
+ result.body = self.deserialize(result_mapper, parsed_response)
1946
+ rescue Exception => e
1947
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1948
+ end
1949
+ end
1950
+
1951
+ result
1952
+ end
1953
+
1954
+ promise.execute
1955
+ end
1956
+
1957
+ #
1958
+ # Get credential definition
1959
+ #
1960
+ # Get the specified credential definition.
1961
+ #
1962
+ # @param definition_id [String] The credential definition identifier
1963
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1964
+ # will be added to the HTTP request.
1965
+ #
1966
+ # @return [CredentialDefinitionContract] operation results.
1967
+ #
1968
+ def get_credential_definition(definition_id, custom_headers:nil)
1969
+ response = get_credential_definition_async(definition_id, custom_headers:custom_headers).value!
1970
+ response.body unless response.nil?
1971
+ end
1972
+
1973
+ #
1974
+ # Get credential definition
1975
+ #
1976
+ # Get the specified credential definition.
1977
+ #
1978
+ # @param definition_id [String] The credential definition identifier
1979
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1980
+ # will be added to the HTTP request.
1981
+ #
1982
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
1983
+ #
1984
+ def get_credential_definition_with_http_info(definition_id, custom_headers:nil)
1985
+ get_credential_definition_async(definition_id, custom_headers:custom_headers).value!
1986
+ end
1987
+
1988
+ #
1989
+ # Get credential definition
1990
+ #
1991
+ # Get the specified credential definition.
1992
+ #
1993
+ # @param definition_id [String] The credential definition identifier
1994
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1995
+ # to the HTTP request.
1996
+ #
1997
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1998
+ #
1999
+ def get_credential_definition_async(definition_id, custom_headers:nil)
2000
+ fail ArgumentError, 'definition_id is nil' if definition_id.nil?
2001
+
2002
+
2003
+ request_headers = {}
2004
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2005
+ path_template = 'definitions/credentials/{definitionId}'
2006
+
2007
+ request_url = @base_url || self.base_url
2008
+
2009
+ options = {
2010
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2011
+ path_params: {'definitionId' => definition_id},
2012
+ headers: request_headers.merge(custom_headers || {}),
2013
+ base_url: request_url
2014
+ }
2015
+ promise = self.make_request_async(:get, path_template, options)
2016
+
2017
+ promise = promise.then do |result|
2018
+ http_response = result.response
2019
+ status_code = http_response.status
2020
+ response_content = http_response.body
2021
+ unless status_code == 200
2022
+ error_model = JSON.load(response_content)
2023
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2024
+ end
2025
+
2026
+ # Deserialize Response
2027
+ if status_code == 200
2028
+ begin
2029
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2030
+ result_mapper = Credentials::Models::CredentialDefinitionContract.mapper()
2031
+ result.body = self.deserialize(result_mapper, parsed_response)
2032
+ rescue Exception => e
2033
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2034
+ end
2035
+ end
2036
+
2037
+ result
2038
+ end
2039
+
2040
+ promise.execute
2041
+ end
2042
+
2043
+ #
2044
+ # Create credential definition from schema
2045
+ #
2046
+ # Create a credential definition from the specified schema.
2047
+ #
2048
+ # @param schema_id [String] The schema identifier
2049
+ # @param body [CredentialDefinitionParameters] The definition parameters
2050
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2051
+ # will be added to the HTTP request.
2052
+ #
2053
+ # @return [CredentialDefinitionContract] operation results.
2054
+ #
2055
+ def create_credential_definition_for_schema_id(schema_id, body, custom_headers:nil)
2056
+ response = create_credential_definition_for_schema_id_async(schema_id, body, custom_headers:custom_headers).value!
2057
+ response.body unless response.nil?
2058
+ end
2059
+
2060
+ #
2061
+ # Create credential definition from schema
2062
+ #
2063
+ # Create a credential definition from the specified schema.
2064
+ #
2065
+ # @param schema_id [String] The schema identifier
2066
+ # @param body [CredentialDefinitionParameters] The definition parameters
2067
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2068
+ # will be added to the HTTP request.
2069
+ #
2070
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
2071
+ #
2072
+ def create_credential_definition_for_schema_id_with_http_info(schema_id, body, custom_headers:nil)
2073
+ create_credential_definition_for_schema_id_async(schema_id, body, custom_headers:custom_headers).value!
2074
+ end
2075
+
2076
+ #
2077
+ # Create credential definition from schema
2078
+ #
2079
+ # Create a credential definition from the specified schema.
2080
+ #
2081
+ # @param schema_id [String] The schema identifier
2082
+ # @param body [CredentialDefinitionParameters] The definition parameters
2083
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2084
+ # to the HTTP request.
2085
+ #
2086
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2087
+ #
2088
+ def create_credential_definition_for_schema_id_async(schema_id, body, custom_headers:nil)
2089
+ fail ArgumentError, 'schema_id is nil' if schema_id.nil?
2090
+ fail ArgumentError, 'body is nil' if body.nil?
2091
+
2092
+
2093
+ request_headers = {}
2094
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2095
+
2096
+ # Serialize Request
2097
+ request_mapper = Credentials::Models::CredentialDefinitionParameters.mapper()
2098
+ request_content = self.serialize(request_mapper, body)
2099
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2100
+
2101
+ path_template = 'definitions/credentials/{schemaId}'
2102
+
2103
+ request_url = @base_url || self.base_url
2104
+
2105
+ options = {
2106
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2107
+ path_params: {'schemaId' => schema_id},
2108
+ body: request_content,
2109
+ headers: request_headers.merge(custom_headers || {}),
2110
+ base_url: request_url
2111
+ }
2112
+ promise = self.make_request_async(:post, path_template, options)
2113
+
2114
+ promise = promise.then do |result|
2115
+ http_response = result.response
2116
+ status_code = http_response.status
2117
+ response_content = http_response.body
2118
+ unless status_code == 200
2119
+ error_model = JSON.load(response_content)
2120
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2121
+ end
2122
+
2123
+ # Deserialize Response
2124
+ if status_code == 200
2125
+ begin
2126
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2127
+ result_mapper = Credentials::Models::CredentialDefinitionContract.mapper()
2128
+ result.body = self.deserialize(result_mapper, parsed_response)
2129
+ rescue Exception => e
2130
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2131
+ end
2132
+ end
2133
+
2134
+ result
2135
+ end
2136
+
2137
+ promise.execute
2138
+ end
2139
+
2140
+ #
2141
+ # Delete credential definition
2142
+ #
2143
+ # Delete the specified credential definition.
2144
+ #
2145
+ # @param credential_definition_id [String] The credential definition identifier
2146
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2147
+ # will be added to the HTTP request.
2148
+ #
2149
+ #
2150
+ def delete_credential_definition(credential_definition_id, custom_headers:nil)
2151
+ response = delete_credential_definition_async(credential_definition_id, custom_headers:custom_headers).value!
2152
+ nil
2153
+ end
2154
+
2155
+ #
2156
+ # Delete credential definition
2157
+ #
2158
+ # Delete the specified credential definition.
2159
+ #
2160
+ # @param credential_definition_id [String] The credential definition identifier
2161
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2162
+ # will be added to the HTTP request.
2163
+ #
2164
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
2165
+ #
2166
+ def delete_credential_definition_with_http_info(credential_definition_id, custom_headers:nil)
2167
+ delete_credential_definition_async(credential_definition_id, custom_headers:custom_headers).value!
2168
+ end
2169
+
2170
+ #
2171
+ # Delete credential definition
2172
+ #
2173
+ # Delete the specified credential definition.
2174
+ #
2175
+ # @param credential_definition_id [String] The credential definition identifier
2176
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2177
+ # to the HTTP request.
2178
+ #
2179
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2180
+ #
2181
+ def delete_credential_definition_async(credential_definition_id, custom_headers:nil)
2182
+ fail ArgumentError, 'credential_definition_id is nil' if credential_definition_id.nil?
2183
+
2184
+
2185
+ request_headers = {}
2186
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2187
+ path_template = 'definitions/credentials/{credentialDefinitionId}'
2188
+
2189
+ request_url = @base_url || self.base_url
2190
+
2191
+ options = {
2192
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2193
+ path_params: {'credentialDefinitionId' => credential_definition_id},
2194
+ headers: request_headers.merge(custom_headers || {}),
2195
+ base_url: request_url
2196
+ }
2197
+ promise = self.make_request_async(:delete, path_template, options)
2198
+
2199
+ promise = promise.then do |result|
2200
+ http_response = result.response
2201
+ status_code = http_response.status
2202
+ response_content = http_response.body
2203
+ unless status_code == 200
2204
+ error_model = JSON.load(response_content)
2205
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2206
+ end
2207
+
2208
+
2209
+ result
2210
+ end
2211
+
2212
+ promise.execute
2213
+ end
2214
+
2215
+ #
2216
+ # Create schema
2217
+ #
2218
+ # Register schema with the current agency tenant and write the schema to the
2219
+ # ledger using the tenant as issuer.
2220
+ # This does not create credential definition.
2221
+ #
2222
+ # @param body [SchemaParameters] Schema parameters
2223
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2224
+ # will be added to the HTTP request.
2225
+ #
2226
+ # @return [String] operation results.
2227
+ #
2228
+ def create_schema(body, custom_headers:nil)
2229
+ response = create_schema_async(body, custom_headers:custom_headers).value!
2230
+ response.body unless response.nil?
2231
+ end
2232
+
2233
+ #
2234
+ # Create schema
2235
+ #
2236
+ # Register schema with the current agency tenant and write the schema to the
2237
+ # ledger using the tenant as issuer.
2238
+ # This does not create credential definition.
2239
+ #
2240
+ # @param body [SchemaParameters] Schema parameters
2241
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2242
+ # will be added to the HTTP request.
2243
+ #
2244
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
2245
+ #
2246
+ def create_schema_with_http_info(body, custom_headers:nil)
2247
+ create_schema_async(body, custom_headers:custom_headers).value!
2248
+ end
2249
+
2250
+ #
2251
+ # Create schema
2252
+ #
2253
+ # Register schema with the current agency tenant and write the schema to the
2254
+ # ledger using the tenant as issuer.
2255
+ # This does not create credential definition.
2256
+ #
2257
+ # @param body [SchemaParameters] Schema parameters
2258
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2259
+ # to the HTTP request.
2260
+ #
2261
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2262
+ #
2263
+ def create_schema_async(body, custom_headers:nil)
2264
+ fail ArgumentError, 'body is nil' if body.nil?
2265
+
2266
+
2267
+ request_headers = {}
2268
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2269
+
2270
+ # Serialize Request
2271
+ request_mapper = Credentials::Models::SchemaParameters.mapper()
2272
+ request_content = self.serialize(request_mapper, body)
2273
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2274
+
2275
+ path_template = 'definitions/schemas'
2276
+
2277
+ request_url = @base_url || self.base_url
2278
+
2279
+ options = {
2280
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2281
+ body: request_content,
2282
+ headers: request_headers.merge(custom_headers || {}),
2283
+ base_url: request_url
2284
+ }
2285
+ promise = self.make_request_async(:post, path_template, options)
2286
+
2287
+ promise = promise.then do |result|
2288
+ http_response = result.response
2289
+ status_code = http_response.status
2290
+ response_content = http_response.body
2291
+ unless status_code == 200
2292
+ error_model = JSON.load(response_content)
2293
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2294
+ end
2295
+
2296
+ # Deserialize Response
2297
+ if status_code == 200
2298
+ begin
2299
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2300
+ result_mapper = {
2301
+ client_side_validation: true,
2302
+ required: false,
2303
+ serialized_name: 'parsed_response',
2304
+ type: {
2305
+ name: 'String'
2306
+ }
2307
+ }
2308
+ result.body = self.deserialize(result_mapper, parsed_response)
2309
+ rescue Exception => e
2310
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2311
+ end
2312
+ end
2313
+
2314
+ result
2315
+ end
2316
+
2317
+ promise.execute
2318
+ end
2319
+
2320
+ #
2321
+ # List all schemas
2322
+ #
2323
+ # List all schemas registered to or used by the authenticated organization.
2324
+ #
2325
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2326
+ # will be added to the HTTP request.
2327
+ #
2328
+ # @return [Array] operation results.
2329
+ #
2330
+ def list_schemas(custom_headers:nil)
2331
+ response = list_schemas_async(custom_headers:custom_headers).value!
2332
+ response.body unless response.nil?
2333
+ end
2334
+
2335
+ #
2336
+ # List all schemas
2337
+ #
2338
+ # List all schemas registered to or used by the authenticated organization.
2339
+ #
2340
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2341
+ # will be added to the HTTP request.
2342
+ #
2343
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
2344
+ #
2345
+ def list_schemas_with_http_info(custom_headers:nil)
2346
+ list_schemas_async(custom_headers:custom_headers).value!
2347
+ end
2348
+
2349
+ #
2350
+ # List all schemas
2351
+ #
2352
+ # List all schemas registered to or used by the authenticated organization.
2353
+ #
2354
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2355
+ # to the HTTP request.
2356
+ #
2357
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2358
+ #
2359
+ def list_schemas_async(custom_headers:nil)
2360
+
2361
+
2362
+ request_headers = {}
2363
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2364
+ path_template = 'definitions/schemas'
2365
+
2366
+ request_url = @base_url || self.base_url
2367
+
2368
+ options = {
2369
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2370
+ headers: request_headers.merge(custom_headers || {}),
2371
+ base_url: request_url
2372
+ }
2373
+ promise = self.make_request_async(:get, path_template, options)
2374
+
2375
+ promise = promise.then do |result|
2376
+ http_response = result.response
2377
+ status_code = http_response.status
2378
+ response_content = http_response.body
2379
+ unless status_code == 200
2380
+ error_model = JSON.load(response_content)
2381
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2382
+ end
2383
+
2384
+ # Deserialize Response
2385
+ if status_code == 200
2386
+ begin
2387
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2388
+ result_mapper = {
2389
+ client_side_validation: true,
2390
+ required: false,
2391
+ serialized_name: 'parsed_response',
2392
+ type: {
2393
+ name: 'Sequence',
2394
+ element: {
2395
+ client_side_validation: true,
2396
+ required: false,
2397
+ serialized_name: 'SchemaRecordElementType',
2398
+ type: {
2399
+ name: 'Composite',
2400
+ class_name: 'SchemaRecord'
2401
+ }
2402
+ }
2403
+ }
2404
+ }
2405
+ result.body = self.deserialize(result_mapper, parsed_response)
2406
+ rescue Exception => e
2407
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2408
+ end
2409
+ end
2410
+
2411
+ result
2412
+ end
2413
+
2414
+ promise.execute
2415
+ end
2416
+
2417
+ #
2418
+ # [Deprecated] Get verification definition
2419
+ #
2420
+ # Please use Verification Policies endpoints.
2421
+ # Get the specified verification definition.
2422
+ #
2423
+ # @param definition_id [String] The verification definition identifier
2424
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2425
+ # will be added to the HTTP request.
2426
+ #
2427
+ # @return [VerificationDefinitionContract] operation results.
2428
+ #
2429
+ def get_verification_definition(definition_id, custom_headers:nil)
2430
+ response = get_verification_definition_async(definition_id, custom_headers:custom_headers).value!
2431
+ response.body unless response.nil?
2432
+ end
2433
+
2434
+ #
2435
+ # [Deprecated] Get verification definition
2436
+ #
2437
+ # Please use Verification Policies endpoints.
2438
+ # Get the specified verification definition.
2439
+ #
2440
+ # @param definition_id [String] The verification definition identifier
2441
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2442
+ # will be added to the HTTP request.
2443
+ #
2444
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
2445
+ #
2446
+ def get_verification_definition_with_http_info(definition_id, custom_headers:nil)
2447
+ get_verification_definition_async(definition_id, custom_headers:custom_headers).value!
2448
+ end
2449
+
2450
+ #
2451
+ # [Deprecated] Get verification definition
2452
+ #
2453
+ # Please use Verification Policies endpoints.
2454
+ # Get the specified verification definition.
2455
+ #
2456
+ # @param definition_id [String] The verification definition identifier
2457
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2458
+ # to the HTTP request.
2459
+ #
2460
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2461
+ #
2462
+ def get_verification_definition_async(definition_id, custom_headers:nil)
2463
+ fail ArgumentError, 'definition_id is nil' if definition_id.nil?
2464
+
2465
+
2466
+ request_headers = {}
2467
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2468
+ path_template = 'definitions/verifications/{definitionId}'
2469
+
2470
+ request_url = @base_url || self.base_url
2471
+
2472
+ options = {
2473
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2474
+ path_params: {'definitionId' => definition_id},
2475
+ headers: request_headers.merge(custom_headers || {}),
2476
+ base_url: request_url
2477
+ }
2478
+ promise = self.make_request_async(:get, path_template, options)
2479
+
2480
+ promise = promise.then do |result|
2481
+ http_response = result.response
2482
+ status_code = http_response.status
2483
+ response_content = http_response.body
2484
+ unless status_code == 200
2485
+ error_model = JSON.load(response_content)
2486
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2487
+ end
2488
+
2489
+ # Deserialize Response
2490
+ if status_code == 200
2491
+ begin
2492
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2493
+ result_mapper = Credentials::Models::VerificationDefinitionContract.mapper()
2494
+ result.body = self.deserialize(result_mapper, parsed_response)
2495
+ rescue Exception => e
2496
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2497
+ end
2498
+ end
2499
+
2500
+ result
2501
+ end
2502
+
2503
+ promise.execute
2504
+ end
2505
+
2506
+ #
2507
+ # [Deprecated] List all verification definitions
2508
+ #
2509
+ # Please use Verification Policies endpoints.
2510
+ # List all verification definitions for the authenticated organization.
2511
+ #
2512
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2513
+ # will be added to the HTTP request.
2514
+ #
2515
+ # @return [Array] operation results.
2516
+ #
2517
+ def list_verification_definitions(custom_headers:nil)
2518
+ response = list_verification_definitions_async(custom_headers:custom_headers).value!
2519
+ response.body unless response.nil?
2520
+ end
2521
+
2522
+ #
2523
+ # [Deprecated] List all verification definitions
2524
+ #
2525
+ # Please use Verification Policies endpoints.
2526
+ # List all verification definitions for the authenticated organization.
2527
+ #
2528
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2529
+ # will be added to the HTTP request.
2530
+ #
2531
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
2532
+ #
2533
+ def list_verification_definitions_with_http_info(custom_headers:nil)
2534
+ list_verification_definitions_async(custom_headers:custom_headers).value!
2535
+ end
2536
+
2537
+ #
2538
+ # [Deprecated] List all verification definitions
2539
+ #
2540
+ # Please use Verification Policies endpoints.
2541
+ # List all verification definitions for the authenticated organization.
2542
+ #
2543
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2544
+ # to the HTTP request.
2545
+ #
2546
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2547
+ #
2548
+ def list_verification_definitions_async(custom_headers:nil)
2549
+
2550
+
2551
+ request_headers = {}
2552
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2553
+ path_template = 'definitions/verifications'
2554
+
2555
+ request_url = @base_url || self.base_url
2556
+
2557
+ options = {
2558
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2559
+ headers: request_headers.merge(custom_headers || {}),
2560
+ base_url: request_url
2561
+ }
2562
+ promise = self.make_request_async(:get, path_template, options)
2563
+
2564
+ promise = promise.then do |result|
2565
+ http_response = result.response
2566
+ status_code = http_response.status
2567
+ response_content = http_response.body
2568
+ unless status_code == 200
2569
+ error_model = JSON.load(response_content)
2570
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2571
+ end
2572
+
2573
+ # Deserialize Response
2574
+ if status_code == 200
2575
+ begin
2576
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2577
+ result_mapper = {
2578
+ client_side_validation: true,
2579
+ required: false,
2580
+ serialized_name: 'parsed_response',
2581
+ type: {
2582
+ name: 'Sequence',
2583
+ element: {
2584
+ client_side_validation: true,
2585
+ required: false,
2586
+ serialized_name: 'VerificationDefinitionContractElementType',
2587
+ type: {
2588
+ name: 'Composite',
2589
+ class_name: 'VerificationDefinitionContract'
2590
+ }
2591
+ }
2592
+ }
2593
+ }
2594
+ result.body = self.deserialize(result_mapper, parsed_response)
2595
+ rescue Exception => e
2596
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2597
+ end
2598
+ end
2599
+
2600
+ result
2601
+ end
2602
+
2603
+ promise.execute
2604
+ end
2605
+
2606
+ #
2607
+ # [Deprecated] Create verification definition
2608
+ #
2609
+ # Please use Verification Policies endpoints.
2610
+ # A verification definition is created and saved on your cloud agent.
2611
+ # You can discover your definition based on the ID that is returned or the
2612
+ # name.
2613
+ #
2614
+ # @param body [ProofRequest] The proof request
2615
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2616
+ # will be added to the HTTP request.
2617
+ #
2618
+ # @return [VerificationDefinitionContract] operation results.
2619
+ #
2620
+ def create_verification_definition(body, custom_headers:nil)
2621
+ response = create_verification_definition_async(body, custom_headers:custom_headers).value!
2622
+ response.body unless response.nil?
2623
+ end
2624
+
2625
+ #
2626
+ # [Deprecated] Create verification definition
2627
+ #
2628
+ # Please use Verification Policies endpoints.
2629
+ # A verification definition is created and saved on your cloud agent.
2630
+ # You can discover your definition based on the ID that is returned or the
2631
+ # name.
2632
+ #
2633
+ # @param body [ProofRequest] The proof request
2634
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2635
+ # will be added to the HTTP request.
2636
+ #
2637
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
2638
+ #
2639
+ def create_verification_definition_with_http_info(body, custom_headers:nil)
2640
+ create_verification_definition_async(body, custom_headers:custom_headers).value!
2641
+ end
2642
+
2643
+ #
2644
+ # [Deprecated] Create verification definition
2645
+ #
2646
+ # Please use Verification Policies endpoints.
2647
+ # A verification definition is created and saved on your cloud agent.
2648
+ # You can discover your definition based on the ID that is returned or the
2649
+ # name.
2650
+ #
2651
+ # @param body [ProofRequest] The proof request
2652
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2653
+ # to the HTTP request.
2654
+ #
2655
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2656
+ #
2657
+ def create_verification_definition_async(body, custom_headers:nil)
2658
+ fail ArgumentError, 'body is nil' if body.nil?
2659
+
2660
+
2661
+ request_headers = {}
2662
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2663
+
2664
+ # Serialize Request
2665
+ request_mapper = Credentials::Models::ProofRequest.mapper()
2666
+ request_content = self.serialize(request_mapper, body)
2667
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2668
+
2669
+ path_template = 'definitions/verifications'
2670
+
2671
+ request_url = @base_url || self.base_url
2672
+
2673
+ options = {
2674
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2675
+ body: request_content,
2676
+ headers: request_headers.merge(custom_headers || {}),
2677
+ base_url: request_url
2678
+ }
2679
+ promise = self.make_request_async(:post, path_template, options)
2680
+
2681
+ promise = promise.then do |result|
2682
+ http_response = result.response
2683
+ status_code = http_response.status
2684
+ response_content = http_response.body
2685
+ unless status_code == 200
2686
+ error_model = JSON.load(response_content)
2687
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2688
+ end
2689
+
2690
+ # Deserialize Response
2691
+ if status_code == 200
2692
+ begin
2693
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2694
+ result_mapper = Credentials::Models::VerificationDefinitionContract.mapper()
2695
+ result.body = self.deserialize(result_mapper, parsed_response)
2696
+ rescue Exception => e
2697
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2698
+ end
2699
+ end
2700
+
2701
+ result
2702
+ end
2703
+
2704
+ promise.execute
2705
+ end
2706
+
2707
+ #
2708
+ # [Deprecated] Delete verification definition
2709
+ #
2710
+ # Please use Verification Policies endpoints.
2711
+ # Delete the specified verification definition.
2712
+ #
2713
+ # @param verification_definition_id [String] The verification definition
2714
+ # identifier
2715
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2716
+ # will be added to the HTTP request.
2717
+ #
2718
+ #
2719
+ def delete_verification_definition(verification_definition_id, custom_headers:nil)
2720
+ response = delete_verification_definition_async(verification_definition_id, custom_headers:custom_headers).value!
2721
+ nil
2722
+ end
2723
+
2724
+ #
2725
+ # [Deprecated] Delete verification definition
2726
+ #
2727
+ # Please use Verification Policies endpoints.
2728
+ # Delete the specified verification definition.
2729
+ #
2730
+ # @param verification_definition_id [String] The verification definition
2731
+ # identifier
2732
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2733
+ # will be added to the HTTP request.
2734
+ #
2735
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
2736
+ #
2737
+ def delete_verification_definition_with_http_info(verification_definition_id, custom_headers:nil)
2738
+ delete_verification_definition_async(verification_definition_id, custom_headers:custom_headers).value!
2739
+ end
2740
+
2741
+ #
2742
+ # [Deprecated] Delete verification definition
2743
+ #
2744
+ # Please use Verification Policies endpoints.
2745
+ # Delete the specified verification definition.
2746
+ #
2747
+ # @param verification_definition_id [String] The verification definition
2748
+ # identifier
2749
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2750
+ # to the HTTP request.
2751
+ #
2752
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2753
+ #
2754
+ def delete_verification_definition_async(verification_definition_id, custom_headers:nil)
2755
+ fail ArgumentError, 'verification_definition_id is nil' if verification_definition_id.nil?
2756
+
2757
+
2758
+ request_headers = {}
2759
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2760
+ path_template = 'definitions/verifications/{verificationDefinitionId}'
2761
+
2762
+ request_url = @base_url || self.base_url
2763
+
2764
+ options = {
2765
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2766
+ path_params: {'verificationDefinitionId' => verification_definition_id},
2767
+ headers: request_headers.merge(custom_headers || {}),
2768
+ base_url: request_url
2769
+ }
2770
+ promise = self.make_request_async(:delete, path_template, options)
2771
+
2772
+ promise = promise.then do |result|
2773
+ http_response = result.response
2774
+ status_code = http_response.status
2775
+ response_content = http_response.body
2776
+ unless status_code == 200
2777
+ error_model = JSON.load(response_content)
2778
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2779
+ end
2780
+
2781
+
2782
+ result
2783
+ end
2784
+
2785
+ promise.execute
2786
+ end
2787
+
2788
+ #
2789
+ # [Deprecated] List all tenants
2790
+ #
2791
+ # Please use the Provider API instead.
2792
+ # List all tenants for the current authorization context.
2793
+ #
2794
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2795
+ # will be added to the HTTP request.
2796
+ #
2797
+ # @return [Array] operation results.
2798
+ #
2799
+ def list_tenants(custom_headers:nil)
2800
+ response = list_tenants_async(custom_headers:custom_headers).value!
2801
+ response.body unless response.nil?
2802
+ end
2803
+
2804
+ #
2805
+ # [Deprecated] List all tenants
2806
+ #
2807
+ # Please use the Provider API instead.
2808
+ # List all tenants for the current authorization context.
2809
+ #
2810
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2811
+ # will be added to the HTTP request.
2812
+ #
2813
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
2814
+ #
2815
+ def list_tenants_with_http_info(custom_headers:nil)
2816
+ list_tenants_async(custom_headers:custom_headers).value!
2817
+ end
2818
+
2819
+ #
2820
+ # [Deprecated] List all tenants
2821
+ #
2822
+ # Please use the Provider API instead.
2823
+ # List all tenants for the current authorization context.
2824
+ #
2825
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2826
+ # to the HTTP request.
2827
+ #
2828
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2829
+ #
2830
+ def list_tenants_async(custom_headers:nil)
2831
+
2832
+
2833
+ request_headers = {}
2834
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2835
+ path_template = 'tenants'
2836
+
2837
+ request_url = @base_url || self.base_url
2838
+
2839
+ options = {
2840
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2841
+ headers: request_headers.merge(custom_headers || {}),
2842
+ base_url: request_url
2843
+ }
2844
+ promise = self.make_request_async(:get, path_template, options)
2845
+
2846
+ promise = promise.then do |result|
2847
+ http_response = result.response
2848
+ status_code = http_response.status
2849
+ response_content = http_response.body
2850
+ unless status_code == 200
2851
+ error_model = JSON.load(response_content)
2852
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2853
+ end
2854
+
2855
+ # Deserialize Response
2856
+ if status_code == 200
2857
+ begin
2858
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2859
+ result_mapper = {
2860
+ client_side_validation: true,
2861
+ required: false,
2862
+ serialized_name: 'parsed_response',
2863
+ type: {
2864
+ name: 'Sequence',
2865
+ element: {
2866
+ client_side_validation: true,
2867
+ required: false,
2868
+ serialized_name: 'TenantContractElementType',
2869
+ type: {
2870
+ name: 'Composite',
2871
+ class_name: 'TenantContract'
2872
+ }
2873
+ }
2874
+ }
2875
+ }
2876
+ result.body = self.deserialize(result_mapper, parsed_response)
2877
+ rescue Exception => e
2878
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2879
+ end
2880
+ end
2881
+
2882
+ result
2883
+ end
2884
+
2885
+ promise.execute
2886
+ end
2887
+
2888
+ #
2889
+ # [Deprecated] Create tenant
2890
+ #
2891
+ # Please use the Provider API instead.
2892
+ # Create a new tenant and setup a unique agency endpoint.
2893
+ # The agency will be set as an issuer.
2894
+ #
2895
+ # @param body [TenantParameters] Configuration options for creating new tenant
2896
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2897
+ # will be added to the HTTP request.
2898
+ #
2899
+ # @return [TenantContract] operation results.
2900
+ #
2901
+ def create_tenant(body, custom_headers:nil)
2902
+ response = create_tenant_async(body, custom_headers:custom_headers).value!
2903
+ response.body unless response.nil?
2904
+ end
2905
+
2906
+ #
2907
+ # [Deprecated] Create tenant
2908
+ #
2909
+ # Please use the Provider API instead.
2910
+ # Create a new tenant and setup a unique agency endpoint.
2911
+ # The agency will be set as an issuer.
2912
+ #
2913
+ # @param body [TenantParameters] Configuration options for creating new tenant
2914
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2915
+ # will be added to the HTTP request.
2916
+ #
2917
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
2918
+ #
2919
+ def create_tenant_with_http_info(body, custom_headers:nil)
2920
+ create_tenant_async(body, custom_headers:custom_headers).value!
2921
+ end
2922
+
2923
+ #
2924
+ # [Deprecated] Create tenant
2925
+ #
2926
+ # Please use the Provider API instead.
2927
+ # Create a new tenant and setup a unique agency endpoint.
2928
+ # The agency will be set as an issuer.
2929
+ #
2930
+ # @param body [TenantParameters] Configuration options for creating new tenant
2931
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2932
+ # to the HTTP request.
2933
+ #
2934
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2935
+ #
2936
+ def create_tenant_async(body, custom_headers:nil)
2937
+ fail ArgumentError, 'body is nil' if body.nil?
2938
+
2939
+
2940
+ request_headers = {}
2941
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2942
+
2943
+ # Serialize Request
2944
+ request_mapper = Credentials::Models::TenantParameters.mapper()
2945
+ request_content = self.serialize(request_mapper, body)
2946
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2947
+
2948
+ path_template = 'tenants'
2949
+
2950
+ request_url = @base_url || self.base_url
2951
+
2952
+ options = {
2953
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2954
+ body: request_content,
2955
+ headers: request_headers.merge(custom_headers || {}),
2956
+ base_url: request_url
2957
+ }
2958
+ promise = self.make_request_async(:post, path_template, options)
2959
+
2960
+ promise = promise.then do |result|
2961
+ http_response = result.response
2962
+ status_code = http_response.status
2963
+ response_content = http_response.body
2964
+ unless status_code == 200
2965
+ error_model = JSON.load(response_content)
2966
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2967
+ end
2968
+
2969
+ # Deserialize Response
2970
+ if status_code == 200
2971
+ begin
2972
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2973
+ result_mapper = Credentials::Models::TenantContract.mapper()
2974
+ result.body = self.deserialize(result_mapper, parsed_response)
2975
+ rescue Exception => e
2976
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2977
+ end
2978
+ end
2979
+
2980
+ result
2981
+ end
2982
+
2983
+ promise.execute
2984
+ end
2985
+
2986
+ #
2987
+ # [Deprecated] Get tenant
2988
+ #
2989
+ # Please use the Provider API instead.
2990
+ # Get the configuration for the specified tenant.
2991
+ #
2992
+ # @param tenant_id [String] The tenant identifier
2993
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2994
+ # will be added to the HTTP request.
2995
+ #
2996
+ # @return [TenantContract] operation results.
2997
+ #
2998
+ def get_tenant(tenant_id, custom_headers:nil)
2999
+ response = get_tenant_async(tenant_id, custom_headers:custom_headers).value!
3000
+ response.body unless response.nil?
3001
+ end
3002
+
3003
+ #
3004
+ # [Deprecated] Get tenant
3005
+ #
3006
+ # Please use the Provider API instead.
3007
+ # Get the configuration for the specified tenant.
3008
+ #
3009
+ # @param tenant_id [String] The tenant identifier
3010
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3011
+ # will be added to the HTTP request.
3012
+ #
3013
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
3014
+ #
3015
+ def get_tenant_with_http_info(tenant_id, custom_headers:nil)
3016
+ get_tenant_async(tenant_id, custom_headers:custom_headers).value!
3017
+ end
3018
+
3019
+ #
3020
+ # [Deprecated] Get tenant
3021
+ #
3022
+ # Please use the Provider API instead.
3023
+ # Get the configuration for the specified tenant.
3024
+ #
3025
+ # @param tenant_id [String] The tenant identifier
3026
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3027
+ # to the HTTP request.
3028
+ #
3029
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3030
+ #
3031
+ def get_tenant_async(tenant_id, custom_headers:nil)
3032
+ fail ArgumentError, 'tenant_id is nil' if tenant_id.nil?
3033
+
3034
+
3035
+ request_headers = {}
3036
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3037
+ path_template = 'tenants/{tenantId}'
3038
+
3039
+ request_url = @base_url || self.base_url
3040
+
3041
+ options = {
3042
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3043
+ path_params: {'tenantId' => tenant_id},
3044
+ headers: request_headers.merge(custom_headers || {}),
3045
+ base_url: request_url
3046
+ }
3047
+ promise = self.make_request_async(:get, path_template, options)
3048
+
3049
+ promise = promise.then do |result|
3050
+ http_response = result.response
3051
+ status_code = http_response.status
3052
+ response_content = http_response.body
3053
+ unless status_code == 200
3054
+ error_model = JSON.load(response_content)
3055
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
3056
+ end
3057
+
3058
+ # Deserialize Response
3059
+ if status_code == 200
3060
+ begin
3061
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3062
+ result_mapper = Credentials::Models::TenantContract.mapper()
3063
+ result.body = self.deserialize(result_mapper, parsed_response)
3064
+ rescue Exception => e
3065
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3066
+ end
3067
+ end
3068
+
3069
+ result
3070
+ end
3071
+
3072
+ promise.execute
3073
+ end
3074
+
3075
+ #
3076
+ # [Deprecated] Delete tenant
3077
+ #
3078
+ # Please use the Provider API instead.
3079
+ # Permanently remove the specified tenant, including their wallet, endpoint
3080
+ # registrations and all data.
3081
+ # All definitions, connections and credentials issued will be deleted.
3082
+ # This action cannot be reverted.
3083
+ #
3084
+ # @param tenant_id [String] The tenant identifier
3085
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3086
+ # will be added to the HTTP request.
3087
+ #
3088
+ #
3089
+ def delete_tenant(tenant_id, custom_headers:nil)
3090
+ response = delete_tenant_async(tenant_id, custom_headers:custom_headers).value!
3091
+ nil
3092
+ end
3093
+
3094
+ #
3095
+ # [Deprecated] Delete tenant
3096
+ #
3097
+ # Please use the Provider API instead.
3098
+ # Permanently remove the specified tenant, including their wallet, endpoint
3099
+ # registrations and all data.
3100
+ # All definitions, connections and credentials issued will be deleted.
3101
+ # This action cannot be reverted.
3102
+ #
3103
+ # @param tenant_id [String] The tenant identifier
3104
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3105
+ # will be added to the HTTP request.
3106
+ #
3107
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
3108
+ #
3109
+ def delete_tenant_with_http_info(tenant_id, custom_headers:nil)
3110
+ delete_tenant_async(tenant_id, custom_headers:custom_headers).value!
3111
+ end
3112
+
3113
+ #
3114
+ # [Deprecated] Delete tenant
3115
+ #
3116
+ # Please use the Provider API instead.
3117
+ # Permanently remove the specified tenant, including their wallet, endpoint
3118
+ # registrations and all data.
3119
+ # All definitions, connections and credentials issued will be deleted.
3120
+ # This action cannot be reverted.
3121
+ #
3122
+ # @param tenant_id [String] The tenant identifier
3123
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3124
+ # to the HTTP request.
3125
+ #
3126
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3127
+ #
3128
+ def delete_tenant_async(tenant_id, custom_headers:nil)
3129
+ fail ArgumentError, 'tenant_id is nil' if tenant_id.nil?
3130
+
3131
+
3132
+ request_headers = {}
3133
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3134
+ path_template = 'tenants/{tenantId}'
3135
+
3136
+ request_url = @base_url || self.base_url
3137
+
3138
+ options = {
3139
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3140
+ path_params: {'tenantId' => tenant_id},
3141
+ headers: request_headers.merge(custom_headers || {}),
3142
+ base_url: request_url
3143
+ }
3144
+ promise = self.make_request_async(:delete, path_template, options)
3145
+
3146
+ promise = promise.then do |result|
3147
+ http_response = result.response
3148
+ status_code = http_response.status
3149
+ response_content = http_response.body
3150
+ unless status_code == 200
3151
+ error_model = JSON.load(response_content)
3152
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
3153
+ end
3154
+
3155
+
3156
+ result
3157
+ end
3158
+
3159
+ promise.execute
3160
+ end
3161
+
3162
+ #
3163
+ # [Deprecated] Get issuer status for current tenant
3164
+ #
3165
+ # Please use the Provider API instead.
3166
+ # If the tenant is configured with Dedicated endorsement, this action will
3167
+ # check if the issuer DID has the required ENDORSER role on the configured
3168
+ # ledger network.
3169
+ # Additionally, check the acceptance of the transaction author agreement and
3170
+ # return the text and version if acceptance is required.
3171
+ #
3172
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3173
+ # will be added to the HTTP request.
3174
+ #
3175
+ # @return [IssuerStatusContract] operation results.
3176
+ #
3177
+ def get_issuer_status(custom_headers:nil)
3178
+ response = get_issuer_status_async(custom_headers:custom_headers).value!
3179
+ response.body unless response.nil?
3180
+ end
3181
+
3182
+ #
3183
+ # [Deprecated] Get issuer status for current tenant
3184
+ #
3185
+ # Please use the Provider API instead.
3186
+ # If the tenant is configured with Dedicated endorsement, this action will
3187
+ # check if the issuer DID has the required ENDORSER role on the configured
3188
+ # ledger network.
3189
+ # Additionally, check the acceptance of the transaction author agreement and
3190
+ # return the text and version if acceptance is required.
3191
+ #
3192
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3193
+ # will be added to the HTTP request.
3194
+ #
3195
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
3196
+ #
3197
+ def get_issuer_status_with_http_info(custom_headers:nil)
3198
+ get_issuer_status_async(custom_headers:custom_headers).value!
3199
+ end
3200
+
3201
+ #
3202
+ # [Deprecated] Get issuer status for current tenant
3203
+ #
3204
+ # Please use the Provider API instead.
3205
+ # If the tenant is configured with Dedicated endorsement, this action will
3206
+ # check if the issuer DID has the required ENDORSER role on the configured
3207
+ # ledger network.
3208
+ # Additionally, check the acceptance of the transaction author agreement and
3209
+ # return the text and version if acceptance is required.
3210
+ #
3211
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3212
+ # to the HTTP request.
3213
+ #
3214
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3215
+ #
3216
+ def get_issuer_status_async(custom_headers:nil)
3217
+
3218
+
3219
+ request_headers = {}
3220
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3221
+ path_template = 'tenants/issuerStatus'
3222
+
3223
+ request_url = @base_url || self.base_url
3224
+
3225
+ options = {
3226
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3227
+ headers: request_headers.merge(custom_headers || {}),
3228
+ base_url: request_url
3229
+ }
3230
+ promise = self.make_request_async(:get, path_template, options)
3231
+
3232
+ promise = promise.then do |result|
3233
+ http_response = result.response
3234
+ status_code = http_response.status
3235
+ response_content = http_response.body
3236
+ unless status_code == 200
3237
+ error_model = JSON.load(response_content)
3238
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
3239
+ end
3240
+
3241
+ # Deserialize Response
3242
+ if status_code == 200
3243
+ begin
3244
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3245
+ result_mapper = Credentials::Models::IssuerStatusContract.mapper()
3246
+ result.body = self.deserialize(result_mapper, parsed_response)
3247
+ rescue Exception => e
3248
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3249
+ end
3250
+ end
3251
+
3252
+ result
3253
+ end
3254
+
3255
+ promise.execute
3256
+ end
3257
+
3258
+ #
3259
+ # Send verification to connection from policy
3260
+ #
3261
+ # Send a verification to the specified connection using an existing policy.
3262
+ #
3263
+ # @param connection_id [String] The connection identifier
3264
+ # @param policy_id [String] The policy identifier
3265
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3266
+ # will be added to the HTTP request.
3267
+ #
3268
+ # @return [VerificationContract] operation results.
3269
+ #
3270
+ def send_verification_from_policy(connection_id, policy_id, custom_headers:nil)
3271
+ response = send_verification_from_policy_async(connection_id, policy_id, custom_headers:custom_headers).value!
3272
+ response.body unless response.nil?
3273
+ end
3274
+
3275
+ #
3276
+ # Send verification to connection from policy
3277
+ #
3278
+ # Send a verification to the specified connection using an existing policy.
3279
+ #
3280
+ # @param connection_id [String] The connection identifier
3281
+ # @param policy_id [String] The policy identifier
3282
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3283
+ # will be added to the HTTP request.
3284
+ #
3285
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
3286
+ #
3287
+ def send_verification_from_policy_with_http_info(connection_id, policy_id, custom_headers:nil)
3288
+ send_verification_from_policy_async(connection_id, policy_id, custom_headers:custom_headers).value!
3289
+ end
3290
+
3291
+ #
3292
+ # Send verification to connection from policy
3293
+ #
3294
+ # Send a verification to the specified connection using an existing policy.
3295
+ #
3296
+ # @param connection_id [String] The connection identifier
3297
+ # @param policy_id [String] The policy identifier
3298
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3299
+ # to the HTTP request.
3300
+ #
3301
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3302
+ #
3303
+ def send_verification_from_policy_async(connection_id, policy_id, custom_headers:nil)
3304
+ fail ArgumentError, 'connection_id is nil' if connection_id.nil?
3305
+ fail ArgumentError, 'policy_id is nil' if policy_id.nil?
3306
+
3307
+
3308
+ request_headers = {}
3309
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3310
+ path_template = 'verifications/policy/{policyId}/connections/{connectionId}'
3311
+
3312
+ request_url = @base_url || self.base_url
3313
+
3314
+ options = {
3315
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3316
+ path_params: {'connectionId' => connection_id,'policyId' => policy_id},
3317
+ headers: request_headers.merge(custom_headers || {}),
3318
+ base_url: request_url
3319
+ }
3320
+ promise = self.make_request_async(:put, path_template, options)
3321
+
3322
+ promise = promise.then do |result|
3323
+ http_response = result.response
3324
+ status_code = http_response.status
3325
+ response_content = http_response.body
3326
+ unless status_code == 200
3327
+ error_model = JSON.load(response_content)
3328
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
3329
+ end
3330
+
3331
+ # Deserialize Response
3332
+ if status_code == 200
3333
+ begin
3334
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3335
+ result_mapper = Credentials::Models::VerificationContract.mapper()
3336
+ result.body = self.deserialize(result_mapper, parsed_response)
3337
+ rescue Exception => e
3338
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3339
+ end
3340
+ end
3341
+
3342
+ result
3343
+ end
3344
+
3345
+ promise.execute
3346
+ end
3347
+
3348
+ #
3349
+ # Send verification to connection from parameters
3350
+ #
3351
+ # Send a verification request to the specified connection from a set of
3352
+ # parameters.
3353
+ #
3354
+ # @param connection_id [String] The connection identifier
3355
+ # @param body [VerificationPolicyParameters] The policy parameters
3356
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3357
+ # will be added to the HTTP request.
3358
+ #
3359
+ # @return [VerificationContract] operation results.
3360
+ #
3361
+ def send_verification_from_parameters(connection_id, body, custom_headers:nil)
3362
+ response = send_verification_from_parameters_async(connection_id, body, custom_headers:custom_headers).value!
3363
+ response.body unless response.nil?
3364
+ end
3365
+
3366
+ #
3367
+ # Send verification to connection from parameters
3368
+ #
3369
+ # Send a verification request to the specified connection from a set of
3370
+ # parameters.
3371
+ #
3372
+ # @param connection_id [String] The connection identifier
3373
+ # @param body [VerificationPolicyParameters] The policy parameters
3374
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3375
+ # will be added to the HTTP request.
3376
+ #
3377
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
3378
+ #
3379
+ def send_verification_from_parameters_with_http_info(connection_id, body, custom_headers:nil)
3380
+ send_verification_from_parameters_async(connection_id, body, custom_headers:custom_headers).value!
3381
+ end
3382
+
3383
+ #
3384
+ # Send verification to connection from parameters
3385
+ #
3386
+ # Send a verification request to the specified connection from a set of
3387
+ # parameters.
3388
+ #
3389
+ # @param connection_id [String] The connection identifier
3390
+ # @param body [VerificationPolicyParameters] The policy parameters
3391
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3392
+ # to the HTTP request.
3393
+ #
3394
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3395
+ #
3396
+ def send_verification_from_parameters_async(connection_id, body, custom_headers:nil)
3397
+ fail ArgumentError, 'connection_id is nil' if connection_id.nil?
3398
+ fail ArgumentError, 'body is nil' if body.nil?
3399
+
3400
+
3401
+ request_headers = {}
3402
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3403
+
3404
+ # Serialize Request
3405
+ request_mapper = Credentials::Models::VerificationPolicyParameters.mapper()
3406
+ request_content = self.serialize(request_mapper, body)
3407
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
3408
+
3409
+ path_template = 'verifications/policy/connections/{connectionId}'
3410
+
3411
+ request_url = @base_url || self.base_url
3412
+
3413
+ options = {
3414
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3415
+ path_params: {'connectionId' => connection_id},
3416
+ body: request_content,
3417
+ headers: request_headers.merge(custom_headers || {}),
3418
+ base_url: request_url
3419
+ }
3420
+ promise = self.make_request_async(:post, path_template, options)
3421
+
3422
+ promise = promise.then do |result|
3423
+ http_response = result.response
3424
+ status_code = http_response.status
3425
+ response_content = http_response.body
3426
+ unless status_code == 200
3427
+ error_model = JSON.load(response_content)
3428
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
3429
+ end
3430
+
3431
+ # Deserialize Response
3432
+ if status_code == 200
3433
+ begin
3434
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3435
+ result_mapper = Credentials::Models::VerificationContract.mapper()
3436
+ result.body = self.deserialize(result_mapper, parsed_response)
3437
+ rescue Exception => e
3438
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3439
+ end
3440
+ end
3441
+
3442
+ result
3443
+ end
3444
+
3445
+ promise.execute
3446
+ end
3447
+
3448
+ #
3449
+ # Send verification from policy
3450
+ #
3451
+ # Create a verification from the specified policy and send it to the specified
3452
+ # connection.
3453
+ #
3454
+ # @param connection_id [String] The connection identifier
3455
+ # @param policy_id [String] The verification policy identifier
3456
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3457
+ # will be added to the HTTP request.
3458
+ #
3459
+ # @return [VerificationContract] operation results.
3460
+ #
3461
+ def send_verification_from_proposal(connection_id, policy_id, custom_headers:nil)
3462
+ response = send_verification_from_proposal_async(connection_id, policy_id, custom_headers:custom_headers).value!
3463
+ response.body unless response.nil?
3464
+ end
3465
+
3466
+ #
3467
+ # Send verification from policy
3468
+ #
3469
+ # Create a verification from the specified policy and send it to the specified
3470
+ # connection.
3471
+ #
3472
+ # @param connection_id [String] The connection identifier
3473
+ # @param policy_id [String] The verification policy identifier
3474
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3475
+ # will be added to the HTTP request.
3476
+ #
3477
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
3478
+ #
3479
+ def send_verification_from_proposal_with_http_info(connection_id, policy_id, custom_headers:nil)
3480
+ send_verification_from_proposal_async(connection_id, policy_id, custom_headers:custom_headers).value!
3481
+ end
3482
+
3483
+ #
3484
+ # Send verification from policy
3485
+ #
3486
+ # Create a verification from the specified policy and send it to the specified
3487
+ # connection.
3488
+ #
3489
+ # @param connection_id [String] The connection identifier
3490
+ # @param policy_id [String] The verification policy identifier
3491
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3492
+ # to the HTTP request.
3493
+ #
3494
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3495
+ #
3496
+ def send_verification_from_proposal_async(connection_id, policy_id, custom_headers:nil)
3497
+ fail ArgumentError, 'connection_id is nil' if connection_id.nil?
3498
+ fail ArgumentError, 'policy_id is nil' if policy_id.nil?
3499
+
3500
+
3501
+ request_headers = {}
3502
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3503
+ path_template = 'verifications/proposal/{policyId}/connections/{connectionId}'
3504
+
3505
+ request_url = @base_url || self.base_url
3506
+
3507
+ options = {
3508
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3509
+ path_params: {'connectionId' => connection_id,'policyId' => policy_id},
3510
+ headers: request_headers.merge(custom_headers || {}),
3511
+ base_url: request_url
3512
+ }
3513
+ promise = self.make_request_async(:put, path_template, options)
3514
+
3515
+ promise = promise.then do |result|
3516
+ http_response = result.response
3517
+ status_code = http_response.status
3518
+ response_content = http_response.body
3519
+ unless status_code == 200
3520
+ error_model = JSON.load(response_content)
3521
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
3522
+ end
3523
+
3524
+ # Deserialize Response
3525
+ if status_code == 200
3526
+ begin
3527
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3528
+ result_mapper = Credentials::Models::VerificationContract.mapper()
3529
+ result.body = self.deserialize(result_mapper, parsed_response)
3530
+ rescue Exception => e
3531
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3532
+ end
3533
+ end
3534
+
3535
+ result
3536
+ end
3537
+
3538
+ promise.execute
3539
+ end
3540
+
3541
+ #
3542
+ # Create connectionless verification from policy
3543
+ #
3544
+ # Create a connectionless verification from the specified policy.
3545
+ # Connectionless transport uses URLs that can be shared with the user over any
3546
+ # existing transport (email, SMS, web).
3547
+ #
3548
+ # @param policy_id [String] The policy identifier
3549
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3550
+ # will be added to the HTTP request.
3551
+ #
3552
+ # @return [VerificationContract] operation results.
3553
+ #
3554
+ def create_verification_from_policy(policy_id, custom_headers:nil)
3555
+ response = create_verification_from_policy_async(policy_id, custom_headers:custom_headers).value!
3556
+ response.body unless response.nil?
3557
+ end
3558
+
3559
+ #
3560
+ # Create connectionless verification from policy
3561
+ #
3562
+ # Create a connectionless verification from the specified policy.
3563
+ # Connectionless transport uses URLs that can be shared with the user over any
3564
+ # existing transport (email, SMS, web).
3565
+ #
3566
+ # @param policy_id [String] The policy identifier
3567
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3568
+ # will be added to the HTTP request.
3569
+ #
3570
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
3571
+ #
3572
+ def create_verification_from_policy_with_http_info(policy_id, custom_headers:nil)
3573
+ create_verification_from_policy_async(policy_id, custom_headers:custom_headers).value!
3574
+ end
3575
+
3576
+ #
3577
+ # Create connectionless verification from policy
3578
+ #
3579
+ # Create a connectionless verification from the specified policy.
3580
+ # Connectionless transport uses URLs that can be shared with the user over any
3581
+ # existing transport (email, SMS, web).
3582
+ #
3583
+ # @param policy_id [String] The policy identifier
3584
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3585
+ # to the HTTP request.
3586
+ #
3587
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3588
+ #
3589
+ def create_verification_from_policy_async(policy_id, custom_headers:nil)
3590
+ fail ArgumentError, 'policy_id is nil' if policy_id.nil?
3591
+
3592
+
3593
+ request_headers = {}
3594
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3595
+ path_template = 'verifications/policy/{policyId}'
3596
+
3597
+ request_url = @base_url || self.base_url
3598
+
3599
+ options = {
3600
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3601
+ path_params: {'policyId' => policy_id},
3602
+ headers: request_headers.merge(custom_headers || {}),
3603
+ base_url: request_url
3604
+ }
3605
+ promise = self.make_request_async(:put, path_template, options)
3606
+
3607
+ promise = promise.then do |result|
3608
+ http_response = result.response
3609
+ status_code = http_response.status
3610
+ response_content = http_response.body
3611
+ unless status_code == 200
3612
+ error_model = JSON.load(response_content)
3613
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
3614
+ end
3615
+
3616
+ # Deserialize Response
3617
+ if status_code == 200
3618
+ begin
3619
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3620
+ result_mapper = Credentials::Models::VerificationContract.mapper()
3621
+ result.body = self.deserialize(result_mapper, parsed_response)
3622
+ rescue Exception => e
3623
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3624
+ end
3625
+ end
3626
+
3627
+ result
3628
+ end
3629
+
3630
+ promise.execute
3631
+ end
3632
+
3633
+ #
3634
+ # Create connectionless verification from parameters
3635
+ #
3636
+ # Create verification from parameters.
3637
+ # Connectionless transport uses URLs that can be shared with the user over any
3638
+ # existing transport (email, SMS, web).
3639
+ #
3640
+ # @param body [VerificationPolicyParameters] The policy parameters
3641
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3642
+ # will be added to the HTTP request.
3643
+ #
3644
+ # @return [VerificationContract] operation results.
3645
+ #
3646
+ def create_verification_from_parameters(body, custom_headers:nil)
3647
+ response = create_verification_from_parameters_async(body, custom_headers:custom_headers).value!
3648
+ response.body unless response.nil?
3649
+ end
3650
+
3651
+ #
3652
+ # Create connectionless verification from parameters
3653
+ #
3654
+ # Create verification from parameters.
3655
+ # Connectionless transport uses URLs that can be shared with the user over any
3656
+ # existing transport (email, SMS, web).
3657
+ #
3658
+ # @param body [VerificationPolicyParameters] The policy parameters
3659
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3660
+ # will be added to the HTTP request.
3661
+ #
3662
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
3663
+ #
3664
+ def create_verification_from_parameters_with_http_info(body, custom_headers:nil)
3665
+ create_verification_from_parameters_async(body, custom_headers:custom_headers).value!
3666
+ end
3667
+
3668
+ #
3669
+ # Create connectionless verification from parameters
3670
+ #
3671
+ # Create verification from parameters.
3672
+ # Connectionless transport uses URLs that can be shared with the user over any
3673
+ # existing transport (email, SMS, web).
3674
+ #
3675
+ # @param body [VerificationPolicyParameters] The policy parameters
3676
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3677
+ # to the HTTP request.
3678
+ #
3679
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3680
+ #
3681
+ def create_verification_from_parameters_async(body, custom_headers:nil)
3682
+ fail ArgumentError, 'body is nil' if body.nil?
3683
+
3684
+
3685
+ request_headers = {}
3686
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3687
+
3688
+ # Serialize Request
3689
+ request_mapper = Credentials::Models::VerificationPolicyParameters.mapper()
3690
+ request_content = self.serialize(request_mapper, body)
3691
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
3692
+
3693
+ path_template = 'verifications/policy'
3694
+
3695
+ request_url = @base_url || self.base_url
3696
+
3697
+ options = {
3698
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3699
+ body: request_content,
3700
+ headers: request_headers.merge(custom_headers || {}),
3701
+ base_url: request_url
3702
+ }
3703
+ promise = self.make_request_async(:post, path_template, options)
3704
+
3705
+ promise = promise.then do |result|
3706
+ http_response = result.response
3707
+ status_code = http_response.status
3708
+ response_content = http_response.body
3709
+ unless status_code == 200
3710
+ error_model = JSON.load(response_content)
3711
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
3712
+ end
3713
+
3714
+ # Deserialize Response
3715
+ if status_code == 200
3716
+ begin
3717
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3718
+ result_mapper = Credentials::Models::VerificationContract.mapper()
3719
+ result.body = self.deserialize(result_mapper, parsed_response)
3720
+ rescue Exception => e
3721
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3722
+ end
3723
+ end
3724
+
3725
+ result
3726
+ end
3727
+
3728
+ promise.execute
3729
+ end
3730
+
3731
+ #
3732
+ # List all verifications
3733
+ #
3734
+ # List all verifications.
3735
+ # Optionally filter by connection and/or definition.
3736
+ #
3737
+ # @param connection_id [String] The connection identifier
3738
+ # @param definition_id [String] The definition identifier
3739
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3740
+ # will be added to the HTTP request.
3741
+ #
3742
+ # @return [Array] operation results.
3743
+ #
3744
+ def list_verifications(connection_id:nil, definition_id:nil, custom_headers:nil)
3745
+ response = list_verifications_async(connection_id:connection_id, definition_id:definition_id, custom_headers:custom_headers).value!
3746
+ response.body unless response.nil?
3747
+ end
3748
+
3749
+ #
3750
+ # List all verifications
3751
+ #
3752
+ # List all verifications.
3753
+ # Optionally filter by connection and/or definition.
3754
+ #
3755
+ # @param connection_id [String] The connection identifier
3756
+ # @param definition_id [String] The definition identifier
3757
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3758
+ # will be added to the HTTP request.
3759
+ #
3760
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
3761
+ #
3762
+ def list_verifications_with_http_info(connection_id:nil, definition_id:nil, custom_headers:nil)
3763
+ list_verifications_async(connection_id:connection_id, definition_id:definition_id, custom_headers:custom_headers).value!
3764
+ end
3765
+
3766
+ #
3767
+ # List all verifications
3768
+ #
3769
+ # List all verifications.
3770
+ # Optionally filter by connection and/or definition.
3771
+ #
3772
+ # @param connection_id [String] The connection identifier
3773
+ # @param definition_id [String] The definition identifier
3774
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3775
+ # to the HTTP request.
3776
+ #
3777
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3778
+ #
3779
+ def list_verifications_async(connection_id:nil, definition_id:nil, custom_headers:nil)
3780
+
3781
+
3782
+ request_headers = {}
3783
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3784
+ path_template = 'verifications'
3785
+
3786
+ request_url = @base_url || self.base_url
3787
+
3788
+ options = {
3789
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3790
+ query_params: {'connectionId' => connection_id,'definitionId' => definition_id},
3791
+ headers: request_headers.merge(custom_headers || {}),
3792
+ base_url: request_url
3793
+ }
3794
+ promise = self.make_request_async(:get, path_template, options)
3795
+
3796
+ promise = promise.then do |result|
3797
+ http_response = result.response
3798
+ status_code = http_response.status
3799
+ response_content = http_response.body
3800
+ unless status_code == 200
3801
+ error_model = JSON.load(response_content)
3802
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
3803
+ end
3804
+
3805
+ # Deserialize Response
3806
+ if status_code == 200
3807
+ begin
3808
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3809
+ result_mapper = {
3810
+ client_side_validation: true,
3811
+ required: false,
3812
+ serialized_name: 'parsed_response',
3813
+ type: {
3814
+ name: 'Sequence',
3815
+ element: {
3816
+ client_side_validation: true,
3817
+ required: false,
3818
+ serialized_name: 'VerificationContractElementType',
3819
+ type: {
3820
+ name: 'Composite',
3821
+ class_name: 'VerificationContract'
3822
+ }
3823
+ }
3824
+ }
3825
+ }
3826
+ result.body = self.deserialize(result_mapper, parsed_response)
3827
+ rescue Exception => e
3828
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3829
+ end
3830
+ end
3831
+
3832
+ result
3833
+ end
3834
+
3835
+ promise.execute
3836
+ end
3837
+
3838
+ #
3839
+ # [Deprecated] Create/send verification
3840
+ #
3841
+ # Please use SendVerification(policyId) or CreateVerification(policyId)
3842
+ # instead.
3843
+ # This endpoint can be used to send a verification definition to a connection,
3844
+ # which will create a verification ID to track the response from the
3845
+ # connection.
3846
+ # If the parameter {connectionId} is not specified, this endpoint will create a
3847
+ # connectionless verification. A URL will be generated that can be shared with
3848
+ # anonymous user.
3849
+ #
3850
+ # @param body [VerificationParameters] The verification parameters
3851
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3852
+ # will be added to the HTTP request.
3853
+ #
3854
+ # @return [VerificationContract] operation results.
3855
+ #
3856
+ def create_verification(body, custom_headers:nil)
3857
+ response = create_verification_async(body, custom_headers:custom_headers).value!
3858
+ response.body unless response.nil?
3859
+ end
3860
+
3861
+ #
3862
+ # [Deprecated] Create/send verification
3863
+ #
3864
+ # Please use SendVerification(policyId) or CreateVerification(policyId)
3865
+ # instead.
3866
+ # This endpoint can be used to send a verification definition to a connection,
3867
+ # which will create a verification ID to track the response from the
3868
+ # connection.
3869
+ # If the parameter {connectionId} is not specified, this endpoint will create a
3870
+ # connectionless verification. A URL will be generated that can be shared with
3871
+ # anonymous user.
3872
+ #
3873
+ # @param body [VerificationParameters] The verification parameters
3874
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3875
+ # will be added to the HTTP request.
3876
+ #
3877
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
3878
+ #
3879
+ def create_verification_with_http_info(body, custom_headers:nil)
3880
+ create_verification_async(body, custom_headers:custom_headers).value!
3881
+ end
3882
+
3883
+ #
3884
+ # [Deprecated] Create/send verification
3885
+ #
3886
+ # Please use SendVerification(policyId) or CreateVerification(policyId)
3887
+ # instead.
3888
+ # This endpoint can be used to send a verification definition to a connection,
3889
+ # which will create a verification ID to track the response from the
3890
+ # connection.
3891
+ # If the parameter {connectionId} is not specified, this endpoint will create a
3892
+ # connectionless verification. A URL will be generated that can be shared with
3893
+ # anonymous user.
3894
+ #
3895
+ # @param body [VerificationParameters] The verification parameters
3896
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3897
+ # to the HTTP request.
3898
+ #
3899
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3900
+ #
3901
+ def create_verification_async(body, custom_headers:nil)
3902
+ fail ArgumentError, 'body is nil' if body.nil?
3903
+
3904
+
3905
+ request_headers = {}
3906
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3907
+
3908
+ # Serialize Request
3909
+ request_mapper = Credentials::Models::VerificationParameters.mapper()
3910
+ request_content = self.serialize(request_mapper, body)
3911
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
3912
+
3913
+ path_template = 'verifications'
3914
+
3915
+ request_url = @base_url || self.base_url
3916
+
3917
+ options = {
3918
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3919
+ body: request_content,
3920
+ headers: request_headers.merge(custom_headers || {}),
3921
+ base_url: request_url
3922
+ }
3923
+ promise = self.make_request_async(:post, path_template, options)
3924
+
3925
+ promise = promise.then do |result|
3926
+ http_response = result.response
3927
+ status_code = http_response.status
3928
+ response_content = http_response.body
3929
+ unless status_code == 200
3930
+ error_model = JSON.load(response_content)
3931
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
3932
+ end
3933
+
3934
+ # Deserialize Response
3935
+ if status_code == 200
3936
+ begin
3937
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3938
+ result_mapper = Credentials::Models::VerificationContract.mapper()
3939
+ result.body = self.deserialize(result_mapper, parsed_response)
3940
+ rescue Exception => e
3941
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3942
+ end
3943
+ end
3944
+
3945
+ result
3946
+ end
3947
+
3948
+ promise.execute
3949
+ end
3950
+
3951
+ #
3952
+ # Get verification
3953
+ #
3954
+ # Get the specified verification.
3955
+ #
3956
+ # @param verification_id [String] The verification identifier
3957
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3958
+ # will be added to the HTTP request.
3959
+ #
3960
+ # @return [VerificationContract] operation results.
3961
+ #
3962
+ def get_verification(verification_id, custom_headers:nil)
3963
+ response = get_verification_async(verification_id, custom_headers:custom_headers).value!
3964
+ response.body unless response.nil?
3965
+ end
3966
+
3967
+ #
3968
+ # Get verification
3969
+ #
3970
+ # Get the specified verification.
3971
+ #
3972
+ # @param verification_id [String] The verification identifier
3973
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3974
+ # will be added to the HTTP request.
3975
+ #
3976
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
3977
+ #
3978
+ def get_verification_with_http_info(verification_id, custom_headers:nil)
3979
+ get_verification_async(verification_id, custom_headers:custom_headers).value!
3980
+ end
3981
+
3982
+ #
3983
+ # Get verification
3984
+ #
3985
+ # Get the specified verification.
3986
+ #
3987
+ # @param verification_id [String] The verification identifier
3988
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3989
+ # to the HTTP request.
3990
+ #
3991
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3992
+ #
3993
+ def get_verification_async(verification_id, custom_headers:nil)
3994
+ fail ArgumentError, 'verification_id is nil' if verification_id.nil?
3995
+
3996
+
3997
+ request_headers = {}
3998
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3999
+ path_template = 'verifications/{verificationId}'
4000
+
4001
+ request_url = @base_url || self.base_url
4002
+
4003
+ options = {
4004
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
4005
+ path_params: {'verificationId' => verification_id},
4006
+ headers: request_headers.merge(custom_headers || {}),
4007
+ base_url: request_url
4008
+ }
4009
+ promise = self.make_request_async(:get, path_template, options)
4010
+
4011
+ promise = promise.then do |result|
4012
+ http_response = result.response
4013
+ status_code = http_response.status
4014
+ response_content = http_response.body
4015
+ unless status_code == 200
4016
+ error_model = JSON.load(response_content)
4017
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
4018
+ end
4019
+
4020
+ # Deserialize Response
4021
+ if status_code == 200
4022
+ begin
4023
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
4024
+ result_mapper = Credentials::Models::VerificationContract.mapper()
4025
+ result.body = self.deserialize(result_mapper, parsed_response)
4026
+ rescue Exception => e
4027
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
4028
+ end
4029
+ end
4030
+
4031
+ result
4032
+ end
4033
+
4034
+ promise.execute
4035
+ end
4036
+
4037
+ #
4038
+ # Delete verification
4039
+ #
4040
+ # Delete the specified verification.
4041
+ #
4042
+ # @param verification_id [String] The verification identifier
4043
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
4044
+ # will be added to the HTTP request.
4045
+ #
4046
+ #
4047
+ def delete_verification(verification_id, custom_headers:nil)
4048
+ response = delete_verification_async(verification_id, custom_headers:custom_headers).value!
4049
+ nil
4050
+ end
4051
+
4052
+ #
4053
+ # Delete verification
4054
+ #
4055
+ # Delete the specified verification.
4056
+ #
4057
+ # @param verification_id [String] The verification identifier
4058
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
4059
+ # will be added to the HTTP request.
4060
+ #
4061
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
4062
+ #
4063
+ def delete_verification_with_http_info(verification_id, custom_headers:nil)
4064
+ delete_verification_async(verification_id, custom_headers:custom_headers).value!
4065
+ end
4066
+
4067
+ #
4068
+ # Delete verification
4069
+ #
4070
+ # Delete the specified verification.
4071
+ #
4072
+ # @param verification_id [String] The verification identifier
4073
+ # @param [Hash{String => String}] A hash of custom headers that will be added
4074
+ # to the HTTP request.
4075
+ #
4076
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
4077
+ #
4078
+ def delete_verification_async(verification_id, custom_headers:nil)
4079
+ fail ArgumentError, 'verification_id is nil' if verification_id.nil?
4080
+
4081
+
4082
+ request_headers = {}
4083
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
4084
+ path_template = 'verifications/{verificationId}'
4085
+
4086
+ request_url = @base_url || self.base_url
4087
+
4088
+ options = {
4089
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
4090
+ path_params: {'verificationId' => verification_id},
4091
+ headers: request_headers.merge(custom_headers || {}),
4092
+ base_url: request_url
4093
+ }
4094
+ promise = self.make_request_async(:delete, path_template, options)
4095
+
4096
+ promise = promise.then do |result|
4097
+ http_response = result.response
4098
+ status_code = http_response.status
4099
+ response_content = http_response.body
4100
+ unless status_code == 200
4101
+ error_model = JSON.load(response_content)
4102
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
4103
+ end
4104
+
4105
+
4106
+ result
4107
+ end
4108
+
4109
+ promise.execute
4110
+ end
4111
+
4112
+ #
4113
+ # [Deprecated] Verify verification
4114
+ #
4115
+ # This action is now obsolete. Verifications are automatically verified when
4116
+ # they are received.
4117
+ # Execute verification on this record. This is an expensive action and is
4118
+ # executed by verifying the proof against the ledger data.
4119
+ #
4120
+ # @param verification_id [String] The verification identifier
4121
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
4122
+ # will be added to the HTTP request.
4123
+ #
4124
+ # @return [VerificationResult] operation results.
4125
+ #
4126
+ def verify_verification(verification_id, custom_headers:nil)
4127
+ response = verify_verification_async(verification_id, custom_headers:custom_headers).value!
4128
+ response.body unless response.nil?
4129
+ end
4130
+
4131
+ #
4132
+ # [Deprecated] Verify verification
4133
+ #
4134
+ # This action is now obsolete. Verifications are automatically verified when
4135
+ # they are received.
4136
+ # Execute verification on this record. This is an expensive action and is
4137
+ # executed by verifying the proof against the ledger data.
4138
+ #
4139
+ # @param verification_id [String] The verification identifier
4140
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
4141
+ # will be added to the HTTP request.
4142
+ #
4143
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
4144
+ #
4145
+ def verify_verification_with_http_info(verification_id, custom_headers:nil)
4146
+ verify_verification_async(verification_id, custom_headers:custom_headers).value!
4147
+ end
4148
+
4149
+ #
4150
+ # [Deprecated] Verify verification
4151
+ #
4152
+ # This action is now obsolete. Verifications are automatically verified when
4153
+ # they are received.
4154
+ # Execute verification on this record. This is an expensive action and is
4155
+ # executed by verifying the proof against the ledger data.
4156
+ #
4157
+ # @param verification_id [String] The verification identifier
4158
+ # @param [Hash{String => String}] A hash of custom headers that will be added
4159
+ # to the HTTP request.
4160
+ #
4161
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
4162
+ #
4163
+ def verify_verification_async(verification_id, custom_headers:nil)
4164
+ fail ArgumentError, 'verification_id is nil' if verification_id.nil?
4165
+
4166
+
4167
+ request_headers = {}
4168
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
4169
+ path_template = 'verifications/{verificationId}/verify'
4170
+
4171
+ request_url = @base_url || self.base_url
4172
+
4173
+ options = {
4174
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
4175
+ path_params: {'verificationId' => verification_id},
4176
+ headers: request_headers.merge(custom_headers || {}),
4177
+ base_url: request_url
4178
+ }
4179
+ promise = self.make_request_async(:get, path_template, options)
4180
+
4181
+ promise = promise.then do |result|
4182
+ http_response = result.response
4183
+ status_code = http_response.status
4184
+ response_content = http_response.body
4185
+ unless status_code == 200
4186
+ error_model = JSON.load(response_content)
4187
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
4188
+ end
4189
+
4190
+ # Deserialize Response
4191
+ if status_code == 200
4192
+ begin
4193
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
4194
+ result_mapper = Credentials::Models::VerificationResult.mapper()
4195
+ result.body = self.deserialize(result_mapper, parsed_response)
4196
+ rescue Exception => e
4197
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
4198
+ end
4199
+ end
4200
+
4201
+ result
4202
+ end
4203
+
4204
+ promise.execute
4205
+ end
4206
+
4207
+ #
4208
+ # List all webhooks
4209
+ #
4210
+ # List all webhooks registered with the authenticated organization.
4211
+ #
4212
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
4213
+ # will be added to the HTTP request.
4214
+ #
4215
+ # @return [Array] operation results.
4216
+ #
4217
+ def list_webhooks(custom_headers:nil)
4218
+ response = list_webhooks_async(custom_headers:custom_headers).value!
4219
+ response.body unless response.nil?
4220
+ end
4221
+
4222
+ #
4223
+ # List all webhooks
4224
+ #
4225
+ # List all webhooks registered with the authenticated organization.
4226
+ #
4227
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
4228
+ # will be added to the HTTP request.
4229
+ #
4230
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
4231
+ #
4232
+ def list_webhooks_with_http_info(custom_headers:nil)
4233
+ list_webhooks_async(custom_headers:custom_headers).value!
4234
+ end
4235
+
4236
+ #
4237
+ # List all webhooks
4238
+ #
4239
+ # List all webhooks registered with the authenticated organization.
4240
+ #
4241
+ # @param [Hash{String => String}] A hash of custom headers that will be added
4242
+ # to the HTTP request.
4243
+ #
4244
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
4245
+ #
4246
+ def list_webhooks_async(custom_headers:nil)
4247
+
4248
+
4249
+ request_headers = {}
4250
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
4251
+ path_template = 'webhooks'
4252
+
4253
+ request_url = @base_url || self.base_url
4254
+
4255
+ options = {
4256
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
4257
+ headers: request_headers.merge(custom_headers || {}),
4258
+ base_url: request_url
4259
+ }
4260
+ promise = self.make_request_async(:get, path_template, options)
4261
+
4262
+ promise = promise.then do |result|
4263
+ http_response = result.response
4264
+ status_code = http_response.status
4265
+ response_content = http_response.body
4266
+ unless status_code == 200
4267
+ error_model = JSON.load(response_content)
4268
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
4269
+ end
4270
+
4271
+ # Deserialize Response
4272
+ if status_code == 200
4273
+ begin
4274
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
4275
+ result_mapper = {
4276
+ client_side_validation: true,
4277
+ required: false,
4278
+ serialized_name: 'parsed_response',
4279
+ type: {
4280
+ name: 'Sequence',
4281
+ element: {
4282
+ client_side_validation: true,
4283
+ required: false,
4284
+ serialized_name: 'WebhookContractElementType',
4285
+ type: {
4286
+ name: 'Composite',
4287
+ class_name: 'WebhookContract'
4288
+ }
4289
+ }
4290
+ }
4291
+ }
4292
+ result.body = self.deserialize(result_mapper, parsed_response)
4293
+ rescue Exception => e
4294
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
4295
+ end
4296
+ end
4297
+
4298
+ result
4299
+ end
4300
+
4301
+ promise.execute
4302
+ end
4303
+
4304
+ #
4305
+ # Create webhook
4306
+ #
4307
+ # Register a webhook with the authenticated organization.
4308
+ #
4309
+ # @param body [WebhookParameters] The webhook parameters
4310
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
4311
+ # will be added to the HTTP request.
4312
+ #
4313
+ # @return [WebhookContract] operation results.
4314
+ #
4315
+ def create_webhook(body, custom_headers:nil)
4316
+ response = create_webhook_async(body, custom_headers:custom_headers).value!
4317
+ response.body unless response.nil?
4318
+ end
4319
+
4320
+ #
4321
+ # Create webhook
4322
+ #
4323
+ # Register a webhook with the authenticated organization.
4324
+ #
4325
+ # @param body [WebhookParameters] The webhook parameters
4326
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
4327
+ # will be added to the HTTP request.
4328
+ #
4329
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
4330
+ #
4331
+ def create_webhook_with_http_info(body, custom_headers:nil)
4332
+ create_webhook_async(body, custom_headers:custom_headers).value!
4333
+ end
4334
+
4335
+ #
4336
+ # Create webhook
4337
+ #
4338
+ # Register a webhook with the authenticated organization.
4339
+ #
4340
+ # @param body [WebhookParameters] The webhook parameters
4341
+ # @param [Hash{String => String}] A hash of custom headers that will be added
4342
+ # to the HTTP request.
4343
+ #
4344
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
4345
+ #
4346
+ def create_webhook_async(body, custom_headers:nil)
4347
+ fail ArgumentError, 'body is nil' if body.nil?
4348
+
4349
+
4350
+ request_headers = {}
4351
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
4352
+
4353
+ # Serialize Request
4354
+ request_mapper = Credentials::Models::WebhookParameters.mapper()
4355
+ request_content = self.serialize(request_mapper, body)
4356
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
4357
+
4358
+ path_template = 'webhooks'
4359
+
4360
+ request_url = @base_url || self.base_url
4361
+
4362
+ options = {
4363
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
4364
+ body: request_content,
4365
+ headers: request_headers.merge(custom_headers || {}),
4366
+ base_url: request_url
4367
+ }
4368
+ promise = self.make_request_async(:post, path_template, options)
4369
+
4370
+ promise = promise.then do |result|
4371
+ http_response = result.response
4372
+ status_code = http_response.status
4373
+ response_content = http_response.body
4374
+ unless status_code == 200
4375
+ error_model = JSON.load(response_content)
4376
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
4377
+ end
4378
+
4379
+ # Deserialize Response
4380
+ if status_code == 200
4381
+ begin
4382
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
4383
+ result_mapper = Credentials::Models::WebhookContract.mapper()
4384
+ result.body = self.deserialize(result_mapper, parsed_response)
4385
+ rescue Exception => e
4386
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
4387
+ end
4388
+ end
4389
+
4390
+ result
4391
+ end
4392
+
4393
+ promise.execute
4394
+ end
4395
+
4396
+ #
4397
+ # Remove webhook
4398
+ #
4399
+ # Remove a registered webhook from the authenticated organization.
4400
+ #
4401
+ # @param webhook_id [String] The webhook identifier
4402
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
4403
+ # will be added to the HTTP request.
4404
+ #
4405
+ #
4406
+ def remove_webhook(webhook_id, custom_headers:nil)
4407
+ response = remove_webhook_async(webhook_id, custom_headers:custom_headers).value!
4408
+ nil
4409
+ end
4410
+
4411
+ #
4412
+ # Remove webhook
4413
+ #
4414
+ # Remove a registered webhook from the authenticated organization.
4415
+ #
4416
+ # @param webhook_id [String] The webhook identifier
4417
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
4418
+ # will be added to the HTTP request.
4419
+ #
4420
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
4421
+ #
4422
+ def remove_webhook_with_http_info(webhook_id, custom_headers:nil)
4423
+ remove_webhook_async(webhook_id, custom_headers:custom_headers).value!
4424
+ end
4425
+
4426
+ #
4427
+ # Remove webhook
4428
+ #
4429
+ # Remove a registered webhook from the authenticated organization.
4430
+ #
4431
+ # @param webhook_id [String] The webhook identifier
4432
+ # @param [Hash{String => String}] A hash of custom headers that will be added
4433
+ # to the HTTP request.
4434
+ #
4435
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
4436
+ #
4437
+ def remove_webhook_async(webhook_id, custom_headers:nil)
4438
+ fail ArgumentError, 'webhook_id is nil' if webhook_id.nil?
4439
+
4440
+
4441
+ request_headers = {}
4442
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
4443
+ path_template = 'webhooks/{webhookId}'
4444
+
4445
+ request_url = @base_url || self.base_url
4446
+
4447
+ options = {
4448
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
4449
+ path_params: {'webhookId' => webhook_id},
4450
+ headers: request_headers.merge(custom_headers || {}),
4451
+ base_url: request_url
4452
+ }
4453
+ promise = self.make_request_async(:delete, path_template, options)
4454
+
4455
+ promise = promise.then do |result|
4456
+ http_response = result.response
4457
+ status_code = http_response.status
4458
+ response_content = http_response.body
4459
+ unless status_code == 200
4460
+ error_model = JSON.load(response_content)
4461
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
4462
+ end
4463
+
4464
+
4465
+ result
4466
+ end
4467
+
4468
+ promise.execute
4469
+ end
4470
+
4471
+ #
4472
+ # Enable webhook
4473
+ #
4474
+ # Enable a registered webhook for the authenticated organization.
4475
+ #
4476
+ # @param webhook_id [String] The webhook identifier
4477
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
4478
+ # will be added to the HTTP request.
4479
+ #
4480
+ #
4481
+ def enable_webhook(webhook_id, custom_headers:nil)
4482
+ response = enable_webhook_async(webhook_id, custom_headers:custom_headers).value!
4483
+ nil
4484
+ end
4485
+
4486
+ #
4487
+ # Enable webhook
4488
+ #
4489
+ # Enable a registered webhook for the authenticated organization.
4490
+ #
4491
+ # @param webhook_id [String] The webhook identifier
4492
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
4493
+ # will be added to the HTTP request.
4494
+ #
4495
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
4496
+ #
4497
+ def enable_webhook_with_http_info(webhook_id, custom_headers:nil)
4498
+ enable_webhook_async(webhook_id, custom_headers:custom_headers).value!
4499
+ end
4500
+
4501
+ #
4502
+ # Enable webhook
4503
+ #
4504
+ # Enable a registered webhook for the authenticated organization.
4505
+ #
4506
+ # @param webhook_id [String] The webhook identifier
4507
+ # @param [Hash{String => String}] A hash of custom headers that will be added
4508
+ # to the HTTP request.
4509
+ #
4510
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
4511
+ #
4512
+ def enable_webhook_async(webhook_id, custom_headers:nil)
4513
+ fail ArgumentError, 'webhook_id is nil' if webhook_id.nil?
4514
+
4515
+
4516
+ request_headers = {}
4517
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
4518
+ path_template = 'webhooks/{webhookId}/enable'
4519
+
4520
+ request_url = @base_url || self.base_url
4521
+
4522
+ options = {
4523
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
4524
+ path_params: {'webhookId' => webhook_id},
4525
+ headers: request_headers.merge(custom_headers || {}),
4526
+ base_url: request_url
4527
+ }
4528
+ promise = self.make_request_async(:put, path_template, options)
4529
+
4530
+ promise = promise.then do |result|
4531
+ http_response = result.response
4532
+ status_code = http_response.status
4533
+ response_content = http_response.body
4534
+ unless status_code == 200
4535
+ error_model = JSON.load(response_content)
4536
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
4537
+ end
4538
+
4539
+
4540
+ result
4541
+ end
4542
+
4543
+ promise.execute
4544
+ end
4545
+
4546
+ #
4547
+ # Disable webhook
4548
+ #
4549
+ # Enable a registered webhook for the authenticated organization.
4550
+ #
4551
+ # @param webhook_id [String] The webhook identifier
4552
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
4553
+ # will be added to the HTTP request.
4554
+ #
4555
+ #
4556
+ def disable_webhook(webhook_id, custom_headers:nil)
4557
+ response = disable_webhook_async(webhook_id, custom_headers:custom_headers).value!
4558
+ nil
4559
+ end
4560
+
4561
+ #
4562
+ # Disable webhook
4563
+ #
4564
+ # Enable a registered webhook for the authenticated organization.
4565
+ #
4566
+ # @param webhook_id [String] The webhook identifier
4567
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
4568
+ # will be added to the HTTP request.
4569
+ #
4570
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
4571
+ #
4572
+ def disable_webhook_with_http_info(webhook_id, custom_headers:nil)
4573
+ disable_webhook_async(webhook_id, custom_headers:custom_headers).value!
4574
+ end
4575
+
4576
+ #
4577
+ # Disable webhook
4578
+ #
4579
+ # Enable a registered webhook for the authenticated organization.
4580
+ #
4581
+ # @param webhook_id [String] The webhook identifier
4582
+ # @param [Hash{String => String}] A hash of custom headers that will be added
4583
+ # to the HTTP request.
4584
+ #
4585
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
4586
+ #
4587
+ def disable_webhook_async(webhook_id, custom_headers:nil)
4588
+ fail ArgumentError, 'webhook_id is nil' if webhook_id.nil?
4589
+
4590
+
4591
+ request_headers = {}
4592
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
4593
+ path_template = 'webhooks/{webhookId}/disable'
4594
+
4595
+ request_url = @base_url || self.base_url
4596
+
4597
+ options = {
4598
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
4599
+ path_params: {'webhookId' => webhook_id},
4600
+ headers: request_headers.merge(custom_headers || {}),
4601
+ base_url: request_url
4602
+ }
4603
+ promise = self.make_request_async(:put, path_template, options)
4604
+
4605
+ promise = promise.then do |result|
4606
+ http_response = result.response
4607
+ status_code = http_response.status
4608
+ response_content = http_response.body
4609
+ unless status_code == 200
4610
+ error_model = JSON.load(response_content)
4611
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
4612
+ end
4613
+
4614
+
4615
+ result
4616
+ end
4617
+
4618
+ promise.execute
4619
+ end
4620
+
4621
+ #
4622
+ # Health check
4623
+ #
4624
+ # Check the health of the API.
4625
+ #
4626
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
4627
+ # will be added to the HTTP request.
4628
+ #
4629
+ #
4630
+ def health(custom_headers:nil)
4631
+ response = health_async(custom_headers:custom_headers).value!
4632
+ nil
4633
+ end
4634
+
4635
+ #
4636
+ # Health check
4637
+ #
4638
+ # Check the health of the API.
4639
+ #
4640
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
4641
+ # will be added to the HTTP request.
4642
+ #
4643
+ # @return [MsRest::HttpOperationResponse] HTTP response information.
4644
+ #
4645
+ def health_with_http_info(custom_headers:nil)
4646
+ health_async(custom_headers:custom_headers).value!
4647
+ end
4648
+
4649
+ #
4650
+ # Health check
4651
+ #
4652
+ # Check the health of the API.
4653
+ #
4654
+ # @param [Hash{String => String}] A hash of custom headers that will be added
4655
+ # to the HTTP request.
4656
+ #
4657
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
4658
+ #
4659
+ def health_async(custom_headers:nil)
4660
+
4661
+
4662
+ request_headers = {}
4663
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
4664
+ path_template = 'health'
4665
+
4666
+ request_url = @base_url || self.base_url
4667
+
4668
+ options = {
4669
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
4670
+ headers: request_headers.merge(custom_headers || {}),
4671
+ base_url: request_url
4672
+ }
4673
+ promise = self.make_request_async(:get, path_template, options)
4674
+
4675
+ promise = promise.then do |result|
4676
+ http_response = result.response
4677
+ status_code = http_response.status
4678
+ response_content = http_response.body
4679
+ unless status_code == 200
4680
+ error_model = JSON.load(response_content)
4681
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
4682
+ end
4683
+
4684
+
4685
+ result
4686
+ end
4687
+
4688
+ promise.execute
4689
+ end
4690
+
4691
+
4692
+ private
4693
+ #
4694
+ # Adds telemetry information.
4695
+ #
4696
+ def add_telemetry
4697
+ sdk_information = 'credentials'
4698
+ sdk_information = "#{sdk_information}/1.1.4000"
4699
+ add_user_agent_information(sdk_information)
4700
+ end
4701
+ end
4702
+ end