//---------------------- // // Generated using the NSwag toolchain v13.2.0.0 (NJsonSchema v10.1.2.0 (Newtonsoft.Json v11.0.0.0)) (http://NSwag.org) // //---------------------- #pragma warning disable 108 // Disable "CS0108 '{derivedDto}.ToJson()' hides inherited member '{dtoBase}.ToJson()'. Use the new keyword if hiding was intended." #pragma warning disable 114 // Disable "CS0114 '{derivedDto}.RaisePropertyChanged(String)' hides inherited member 'dtoBase.RaisePropertyChanged(String)'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." #pragma warning disable 472 // Disable "CS0472 The result of the expression is always 'false' since a value of type 'Int32' is never equal to 'null' of type 'Int32?' #pragma warning disable 1573 // Disable "CS1573 Parameter '...' has no matching param tag in the XML comment for ... #pragma warning disable 1591 // Disable "CS1591 Missing XML comment for publicly visible type or member ..." namespace SABClientNSwag { using System = global::System; [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.2.0.0 (NJsonSchema v10.1.2.0 (Newtonsoft.Json v11.0.0.0))")] public partial class Client { private string _baseUrl = ""; private System.Net.Http.HttpClient _httpClient; private System.Lazy _settings; public Client(string baseUrl, System.Net.Http.HttpClient httpClient) { BaseUrl = baseUrl; _httpClient = httpClient; _settings = new System.Lazy(() => { var settings = new Newtonsoft.Json.JsonSerializerSettings(); UpdateJsonSerializerSettings(settings); return settings; }); } public string BaseUrl { get { return _baseUrl; } set { _baseUrl = value; } } protected Newtonsoft.Json.JsonSerializerSettings JsonSerializerSettings { get { return _settings.Value; } } partial void UpdateJsonSerializerSettings(Newtonsoft.Json.JsonSerializerSettings settings); partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, string url); partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Server status /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task GetStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/public/api/status"); var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { request_.Method = new System.Net.Http.HttpMethod("GET"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(StatusResponse); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// User login status /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task GetLoginStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/public/api/loginStatus"); var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { request_.Method = new System.Net.Http.HttpMethod("GET"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(LoginStatusResponse); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// User configuration /// optional code from user invitation /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task ConfigAsync(string code = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/public/api/user/config?"); if (code != null) { urlBuilder_.Append(System.Uri.EscapeDataString("code") + "=").Append(System.Uri.EscapeDataString(ConvertToString(code, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { request_.Method = new System.Net.Http.HttpMethod("GET"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(UserConfigResponse); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Localization messages /// Localization messages (key=message JSON). /// A server side error occurred. public async System.Threading.Tasks.Task> GetMessagesAsync(string locale, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (locale == null) throw new System.ArgumentNullException("locale"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/public/api/messages/{locale}"); urlBuilder_.Replace("{locale}", System.Uri.EscapeDataString(ConvertToString(locale, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { request_.Method = new System.Net.Http.HttpMethod("GET"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(System.Collections.Generic.IDictionary); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Generate user login password or access code (type = 'login'/'accessCode') /// optional code from user invitation (if no user is ahenticated) /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task GenerateUserPasswordAsync(Type type, string code = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (type == null) throw new System.ArgumentNullException("type"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/public/api/user/generate-password?"); urlBuilder_.Append(System.Uri.EscapeDataString("type") + "=").Append(System.Uri.EscapeDataString(ConvertToString(type, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); if (code != null) { urlBuilder_.Append(System.Uri.EscapeDataString("code") + "=").Append(System.Uri.EscapeDataString(ConvertToString(code, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { request_.Method = new System.Net.Http.HttpMethod("GET"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(GeneratedPassword); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Generate password based on provided PasswordRequirements /// optional code from user invitation (if no user is ahenticated) /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task GenerateCustomPasswordAsync(PasswordRequirements body, string code = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/public/api/user/generate-password?"); if (code != null) { urlBuilder_.Append(System.Uri.EscapeDataString("code") + "=").Append(System.Uri.EscapeDataString(ConvertToString(code, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; request_.Method = new System.Net.Http.HttpMethod("POST"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(GeneratedPassword); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Password policy checker for user login password and access code /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task CheckUserPasswordComplianceAsync(string password = null, Type2? type = null, string code = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/public/api/user/generate-password"); var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var boundary_ = System.Guid.NewGuid().ToString(); var content_ = new System.Net.Http.MultipartFormDataContent(boundary_); content_.Headers.Remove("Content-Type"); content_.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + boundary_); if (password != null) { content_.Add(new System.Net.Http.StringContent(ConvertToString(password, System.Globalization.CultureInfo.InvariantCulture)), "password"); } if (type != null) { content_.Add(new System.Net.Http.StringContent(ConvertToString(type, System.Globalization.CultureInfo.InvariantCulture)), "type"); } if (code != null) { content_.Add(new System.Net.Http.StringContent(ConvertToString(code, System.Globalization.CultureInfo.InvariantCulture)), "code"); } request_.Content = content_; request_.Method = new System.Net.Http.HttpMethod("OPTIONS"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(PasswodComplianceResponse); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Calculates entropy of user provided password /// optional code from user invitation (if no user is ahenticated) /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task CalculatePasswordEntropyAsync(string password, string code = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (password == null) throw new System.ArgumentNullException("password"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/public/api/password-entropy/{password}?"); urlBuilder_.Replace("{password}", System.Uri.EscapeDataString(ConvertToString(password, System.Globalization.CultureInfo.InvariantCulture))); if (code != null) { urlBuilder_.Append(System.Uri.EscapeDataString("code") + "=").Append(System.Uri.EscapeDataString(ConvertToString(code, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { request_.Method = new System.Net.Http.HttpMethod("GET"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(PasswordEntropyResponse); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Ticket password /// Ticket ID /// Station name /// Optional station user - it is ignored if station user is defined in ticket /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task GetStationPasswordAsync(string ticket, string station, Platform? platform = null, string user = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (ticket == null) throw new System.ArgumentNullException("ticket"); if (station == null) throw new System.ArgumentNullException("station"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/public/api/getPassword?"); urlBuilder_.Append(System.Uri.EscapeDataString("ticket") + "=").Append(System.Uri.EscapeDataString(ConvertToString(ticket, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); urlBuilder_.Append(System.Uri.EscapeDataString("station") + "=").Append(System.Uri.EscapeDataString(ConvertToString(station, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); if (platform != null) { urlBuilder_.Append(System.Uri.EscapeDataString("platform") + "=").Append(System.Uri.EscapeDataString(ConvertToString(platform, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (user != null) { urlBuilder_.Append(System.Uri.EscapeDataString("user") + "=").Append(System.Uri.EscapeDataString(ConvertToString(user, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { request_.Method = new System.Net.Http.HttpMethod("GET"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); var result_ = (string)System.Convert.ChangeType(responseData_, typeof(string)); return result_; } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(string); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// QR Code /// QR code url /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task GetQrCodeImageAsync(string url, int? size = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (url == null) throw new System.ArgumentNullException("url"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/public/api/qr?"); urlBuilder_.Append(System.Uri.EscapeDataString("url") + "=").Append(System.Uri.EscapeDataString(ConvertToString(url, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); if (size != null) { urlBuilder_.Append(System.Uri.EscapeDataString("size") + "=").Append(System.Uri.EscapeDataString(ConvertToString(size, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { request_.Method = new System.Net.Http.HttpMethod("GET"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200" || status_ == "206") { var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false); var fileResponse_ = new FileResponse((int)response_.StatusCode, headers_, responseStream_, null, response_); client_ = null; response_ = null; // response and client are disposed by FileResponse return fileResponse_; } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(FileResponse); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Register station /// Station/agent config name /// Station platform /// Station name /// Unique random string /// digest computed from stationName, nonce and seedBase /// name of timezone - defined in java.util.TimeZone class /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task RegisterStationAsync(string configName, Platform2 platform, string stationName, string nonce, string digest, string timezone = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (configName == null) throw new System.ArgumentNullException("configName"); if (platform == null) throw new System.ArgumentNullException("platform"); if (stationName == null) throw new System.ArgumentNullException("stationName"); if (nonce == null) throw new System.ArgumentNullException("nonce"); if (digest == null) throw new System.ArgumentNullException("digest"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/public/api/registerStation?"); urlBuilder_.Append(System.Uri.EscapeDataString("configName") + "=").Append(System.Uri.EscapeDataString(ConvertToString(configName, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); urlBuilder_.Append(System.Uri.EscapeDataString("platform") + "=").Append(System.Uri.EscapeDataString(ConvertToString(platform, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); urlBuilder_.Append(System.Uri.EscapeDataString("stationName") + "=").Append(System.Uri.EscapeDataString(ConvertToString(stationName, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); urlBuilder_.Append(System.Uri.EscapeDataString("nonce") + "=").Append(System.Uri.EscapeDataString(ConvertToString(nonce, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); urlBuilder_.Append(System.Uri.EscapeDataString("digest") + "=").Append(System.Uri.EscapeDataString(ConvertToString(digest, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); if (timezone != null) { urlBuilder_.Append(System.Uri.EscapeDataString("timezone") + "=").Append(System.Uri.EscapeDataString(ConvertToString(timezone, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { request_.Method = new System.Net.Http.HttpMethod("GET"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ == "422") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Validation failed!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(string); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// User Login /// 'username' (if authenticating to the System domain) or 'domain\username' of user logging in /// Login Success /// A server side error occurred. public async System.Threading.Tasks.Task LoginAsync(string login = null, string password = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/login"); var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var keyValues_ = new System.Collections.Generic.List>(); if (login != null) keyValues_.Add(new System.Collections.Generic.KeyValuePair("login", ConvertToString(login, System.Globalization.CultureInfo.InvariantCulture))); if (password != null) keyValues_.Add(new System.Collections.Generic.KeyValuePair("password", ConvertToString(password, System.Globalization.CultureInfo.InvariantCulture))); request_.Content = new System.Net.Http.FormUrlEncodedContent(keyValues_); request_.Method = new System.Net.Http.HttpMethod("POST"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ == "401") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Login failed", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(LoginStatusResponse); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// User Login using KeyShield SSO (certificate/token) /// base64 encoded KeyShield SSO authentication (certificate/token) /// Login Success /// A server side error occurred. public async System.Threading.Tasks.Task KshieldCertLoginAsync(string authCert = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/certlogin"); var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var keyValues_ = new System.Collections.Generic.List>(); if (authCert != null) keyValues_.Add(new System.Collections.Generic.KeyValuePair("authCert", ConvertToString(authCert, System.Globalization.CultureInfo.InvariantCulture))); request_.Content = new System.Net.Http.FormUrlEncodedContent(keyValues_); request_.Method = new System.Net.Http.HttpMethod("POST"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ == "401") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Login failed", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(LoginStatusResponse); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// 2FA authentication / verification /// Login Success /// A server side error occurred. public async System.Threading.Tasks.Task Authenticate2FAsync(string securityCode = null, string key = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/user/secondfactor"); var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var keyValues_ = new System.Collections.Generic.List>(); if (securityCode != null) keyValues_.Add(new System.Collections.Generic.KeyValuePair("securityCode", ConvertToString(securityCode, System.Globalization.CultureInfo.InvariantCulture))); if (key != null) keyValues_.Add(new System.Collections.Generic.KeyValuePair("key", ConvertToString(key, System.Globalization.CultureInfo.InvariantCulture))); request_.Content = new System.Net.Http.FormUrlEncodedContent(keyValues_); request_.Method = new System.Net.Http.HttpMethod("POST"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ == "500") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Failed to verify securityCode - see msg in response for details", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(Response); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Safe Boxes /// list only boxes for which user has at least ccess rights specified (example for Read and Create: RC) /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task GetSafeBoxesAsync(string access = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/safe/boxes?"); if (access != null) { urlBuilder_.Append(System.Uri.EscapeDataString("access") + "=").Append(System.Uri.EscapeDataString(ConvertToString(access, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { request_.Method = new System.Net.Http.HttpMethod("GET"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ == "401") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("No user is authenticated!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "403") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("User has no permission for requested operation.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "404") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Database record with provided id was not found.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(SafeBoxes); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// New Safe Box /// URL encoded access code - you must use URL encoding on utf-8 bytes to preserve international characters, special characters etc. as HTTP headers use only limited ASCII. There is no encoding standard and SecureAnyBox expects and decodes URL encoded access code. /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task CreateSafeBoxAsync(string sAB_Access_Code, SafeBox body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/safe/boxes"); var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { if (sAB_Access_Code == null) throw new System.ArgumentNullException("sAB_Access_Code"); request_.Headers.TryAddWithoutValidation("SAB-Access-Code", ConvertToString(sAB_Access_Code, System.Globalization.CultureInfo.InvariantCulture)); var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; request_.Method = new System.Net.Http.HttpMethod("POST"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ == "401") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("No user is authenticated!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "403") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("User has no permission for requested operation.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "404") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Database record with provided id was not found.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "422") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Validation failed!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(NewRecordId); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Get Safe Box /// ID of Safe Box to get. /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task GetSafeBoxAsync(long boxId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (boxId == null) throw new System.ArgumentNullException("boxId"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/safe/boxes/{boxId}"); urlBuilder_.Replace("{boxId}", System.Uri.EscapeDataString(ConvertToString(boxId, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { request_.Method = new System.Net.Http.HttpMethod("GET"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ == "401") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("No user is authenticated!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "403") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("User has no permission for requested operation.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "404") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Database record with provided id was not found.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(Response2); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// New Safe Box /// URL encoded access code - you must use URL encoding on utf-8 bytes to preserve international characters, special characters etc. as HTTP headers use only limited ASCII. There is no encoding standard and SecureAnyBox expects and decodes URL encoded access code. /// ID of Safe Box. ID=0 or missing ID means Root Safe Box /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task CreateChildSafeBoxAsync(string sAB_Access_Code, SafeBox safebox, long boxId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (boxId == null) throw new System.ArgumentNullException("boxId"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/safe/boxes/{boxId}"); urlBuilder_.Replace("{boxId}", System.Uri.EscapeDataString(ConvertToString(boxId, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { if (sAB_Access_Code == null) throw new System.ArgumentNullException("sAB_Access_Code"); request_.Headers.TryAddWithoutValidation("SAB-Access-Code", ConvertToString(sAB_Access_Code, System.Globalization.CultureInfo.InvariantCulture)); var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(safebox, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; request_.Method = new System.Net.Http.HttpMethod("POST"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ == "401") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("No user is authenticated!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "403") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("User has no permission for requested operation.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "404") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Database record with provided id was not found.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "422") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Validation failed!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(NewRecordId); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Update Safe Box /// ID of Safe Box. ID=0 or missing ID means Root Safe Box /// access code is required when changing to/from private safebox /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task UpdateChildSafeBoxAsync(long boxId, string sAB_Access_Code = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (boxId == null) throw new System.ArgumentNullException("boxId"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/safe/boxes/{boxId}"); urlBuilder_.Replace("{boxId}", System.Uri.EscapeDataString(ConvertToString(boxId, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { if (sAB_Access_Code != null) request_.Headers.TryAddWithoutValidation("SAB-Access-Code", ConvertToString(sAB_Access_Code, System.Globalization.CultureInfo.InvariantCulture)); request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); request_.Method = new System.Net.Http.HttpMethod("PUT"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ == "401") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("No user is authenticated!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "403") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("User has no permission for requested operation.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "404") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Database record with provided id was not found.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "422") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Validation failed!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(Response3); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Delete Safe Box /// ID of Safe Box. ID=0 or missing ID means Root Safe Box /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task DeleteChildSafeBoxAsync(long boxId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (boxId == null) throw new System.ArgumentNullException("boxId"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/safe/boxes/{boxId}"); urlBuilder_.Replace("{boxId}", System.Uri.EscapeDataString(ConvertToString(boxId, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { request_.Method = new System.Net.Http.HttpMethod("DELETE"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ == "401") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("No user is authenticated!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "403") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("User has no permission for requested operation.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "404") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Database record with provided id was not found.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(Response4); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Safe Boxes /// ID of parent Safe Box /// list only boxes for which user has at least ccess rights specified (example for Read and Create: RC) /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task GetChildSafeBoxesAsync(long boxId, string access = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (boxId == null) throw new System.ArgumentNullException("boxId"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/safe/boxes/{boxId}/boxes?"); urlBuilder_.Replace("{boxId}", System.Uri.EscapeDataString(ConvertToString(boxId, System.Globalization.CultureInfo.InvariantCulture))); if (access != null) { urlBuilder_.Append(System.Uri.EscapeDataString("access") + "=").Append(System.Uri.EscapeDataString(ConvertToString(access, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { request_.Method = new System.Net.Http.HttpMethod("GET"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ == "401") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("No user is authenticated!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "403") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("User has no permission for requested operation.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "404") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Database record with provided id was not found.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(SafeBoxes); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Find Safe Boxes and Records using given query /// Lucene query string /// optional query syntax switch (currently recognizes 'default' = the way SecureAnyBox web interface searches or 'standard' which accepts Lucene query syntax (field names = name,description,note,login,address,tag,type,template) /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task FindRecordsAsync(string query, string queryType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (query == null) throw new System.ArgumentNullException("query"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/safe/search/{query}?"); urlBuilder_.Replace("{query}", System.Uri.EscapeDataString(ConvertToString(query, System.Globalization.CultureInfo.InvariantCulture))); if (queryType != null) { urlBuilder_.Append(System.Uri.EscapeDataString("queryType") + "=").Append(System.Uri.EscapeDataString(ConvertToString(queryType, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { request_.Method = new System.Net.Http.HttpMethod("GET"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ == "401") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("No user is authenticated!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "403") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("User has no permission for requested operation.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "404") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Database record with provided id was not found.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "500") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Request failed.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(SearchResults); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Safe Box Records /// ID of parent Safe Box /// return file name and size in record list /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task GetRecordsAsync(long boxId, bool? fileInfo = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (boxId == null) throw new System.ArgumentNullException("boxId"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/safe/boxes/{boxId}/records?"); urlBuilder_.Replace("{boxId}", System.Uri.EscapeDataString(ConvertToString(boxId, System.Globalization.CultureInfo.InvariantCulture))); if (fileInfo != null) { urlBuilder_.Append(System.Uri.EscapeDataString("fileInfo") + "=").Append(System.Uri.EscapeDataString(ConvertToString(fileInfo, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { request_.Method = new System.Net.Http.HttpMethod("GET"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ == "401") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("No user is authenticated!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "403") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("User has no permission for requested operation.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "404") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Database record with provided id was not found.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(Records); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// New Record /// ID of parent Safe Box /// required if setting password or encrypted attributes - URL encoded access code - you must use URL encoding on utf-8 bytes to preserve international characters, special characters etc. as HTTP headers use only limited ASCII. There is no encoding standard and SecureAnyBox expects and decodes URL encoded access code. /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task CreateRecordAsync(Record body, long boxId, string sAB_Access_Code = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (boxId == null) throw new System.ArgumentNullException("boxId"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/safe/boxes/{boxId}/records"); urlBuilder_.Replace("{boxId}", System.Uri.EscapeDataString(ConvertToString(boxId, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { if (sAB_Access_Code != null) request_.Headers.TryAddWithoutValidation("SAB-Access-Code", ConvertToString(sAB_Access_Code, System.Globalization.CultureInfo.InvariantCulture)); var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; request_.Method = new System.Net.Http.HttpMethod("POST"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ == "401") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("No user is authenticated!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "403") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("User has no permission for requested operation.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "404") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Database record with provided id was not found.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "422") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Request parameter validation failed.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "500") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Request failed.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(NewRecordId); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Get Record /// ID of Record /// URL encoded access code - you must use URL encoding on utf-8 bytes to preserve international characters, special characters etc. as HTTP headers use only limited ASCII. There is no encoding standard and SecureAnyBox expects and decodes URL encoded access code. /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task GetRecordAsync(long recordId, string sAB_Access_Code = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (recordId == null) throw new System.ArgumentNullException("recordId"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/safe/records/{recordId}"); urlBuilder_.Replace("{recordId}", System.Uri.EscapeDataString(ConvertToString(recordId, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { if (sAB_Access_Code != null) request_.Headers.TryAddWithoutValidation("SAB-Access-Code", ConvertToString(sAB_Access_Code, System.Globalization.CultureInfo.InvariantCulture)); request_.Method = new System.Net.Http.HttpMethod("GET"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ == "401") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("No user is authenticated!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "403") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("User has no permission for requested operation.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "404") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Database record with provided id was not found.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "500") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Login failed", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(Response5); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Update Record /// ID of Record /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task UpdateRecordAsync(long recordId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (recordId == null) throw new System.ArgumentNullException("recordId"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/safe/records/{recordId}"); urlBuilder_.Replace("{recordId}", System.Uri.EscapeDataString(ConvertToString(recordId, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); request_.Method = new System.Net.Http.HttpMethod("PUT"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ == "401") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("No user is authenticated!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "403") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("User has no permission for requested operation.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "404") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Database record with provided id was not found.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "422") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Validation failed!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(Response6); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Delete Record /// ID of Record /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task DeleteRecordAsync(long recordId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (recordId == null) throw new System.ArgumentNullException("recordId"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/safe/records/{recordId}"); urlBuilder_.Replace("{recordId}", System.Uri.EscapeDataString(ConvertToString(recordId, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { request_.Method = new System.Net.Http.HttpMethod("DELETE"); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { return; } else if (status_ == "401") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("No user is authenticated!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "403") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("User has no permission for requested operation.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "404") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Database record with provided id was not found.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Get Account or Secret Account Password /// URL encoded access code - you must use URL encoding on utf-8 bytes to preserve international characters, special characters etc. as HTTP headers use only limited ASCII. There is no encoding standard and SecureAnyBox expects and decodes URL encoded access code. /// ID of Record /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task GetPasswordAsync(string sAB_Access_Code, long recordId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (recordId == null) throw new System.ArgumentNullException("recordId"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/safe/records/{recordId}/passwords"); urlBuilder_.Replace("{recordId}", System.Uri.EscapeDataString(ConvertToString(recordId, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { if (sAB_Access_Code == null) throw new System.ArgumentNullException("sAB_Access_Code"); request_.Headers.TryAddWithoutValidation("SAB-Access-Code", ConvertToString(sAB_Access_Code, System.Globalization.CultureInfo.InvariantCulture)); request_.Method = new System.Net.Http.HttpMethod("GET"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ == "401") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("No user is authenticated!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "403") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("User has no permission for requested operation.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "404") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Database record with provided id was not found.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(Response7); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Change Account or Secret Account Password /// URL encoded access code - you must use URL encoding on utf-8 bytes to preserve international characters, special characters etc. as HTTP headers use only limited ASCII. There is no encoding standard and SecureAnyBox expects and decodes URL encoded access code. /// ID of Record /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task SetPasswordAsync(string sAB_Access_Code, Body body, long recordId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (recordId == null) throw new System.ArgumentNullException("recordId"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/safe/records/{recordId}/passwords"); urlBuilder_.Replace("{recordId}", System.Uri.EscapeDataString(ConvertToString(recordId, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { if (sAB_Access_Code == null) throw new System.ArgumentNullException("sAB_Access_Code"); request_.Headers.TryAddWithoutValidation("SAB-Access-Code", ConvertToString(sAB_Access_Code, System.Globalization.CultureInfo.InvariantCulture)); var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; request_.Method = new System.Net.Http.HttpMethod("POST"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ == "401") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("No user is authenticated!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "403") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("User has no permission for requested operation.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "404") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Database record with provided id was not found.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "422") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Validation failed!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(Response8); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Get Account or Secret Account password history /// ID of Record /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task GetPasswordHistoryAsync(long recordId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (recordId == null) throw new System.ArgumentNullException("recordId"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/safe/records/{recordId}/passwords"); urlBuilder_.Replace("{recordId}", System.Uri.EscapeDataString(ConvertToString(recordId, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { request_.Content = new System.Net.Http.StringContent(string.Empty, System.Text.Encoding.UTF8, "application/json"); request_.Method = new System.Net.Http.HttpMethod("OPTIONS"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ == "401") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("No user is authenticated!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "403") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("User has no permission for requested operation.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "404") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Database record with provided id was not found.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(Response9); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Get record password by Id /// URL encoded access code - you must use URL encoding on utf-8 bytes to preserve international characters, special characters etc. as HTTP headers use only limited ASCII. There is no encoding standard and SecureAnyBox expects and decodes URL encoded access code. /// ID of Record /// ID of account password /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task PasswordsAsync(string sAB_Access_Code, long recordId, string passwordId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (recordId == null) throw new System.ArgumentNullException("recordId"); if (passwordId == null) throw new System.ArgumentNullException("passwordId"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/safe/records/{recordId}/passwords/{passwordId}"); urlBuilder_.Replace("{recordId}", System.Uri.EscapeDataString(ConvertToString(recordId, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{passwordId}", System.Uri.EscapeDataString(ConvertToString(passwordId, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { if (sAB_Access_Code == null) throw new System.ArgumentNullException("sAB_Access_Code"); request_.Headers.TryAddWithoutValidation("SAB-Access-Code", ConvertToString(sAB_Access_Code, System.Globalization.CultureInfo.InvariantCulture)); request_.Method = new System.Net.Http.HttpMethod("GET"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); return objectResponse_.Object; } else if (status_ == "401") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("No user is authenticated!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "403") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("User has no permission for requested operation.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "404") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Database record with provided id was not found.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(Response10); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Upload file to record /// URL encoded access code - you must use URL encoding on utf-8 bytes to preserve international characters, special characters etc. as HTTP headers use only limited ASCII. There is no encoding standard and SecureAnyBox expects and decodes URL encoded access code. /// ID of Record /// name of file attribute in Record. Usually 'file' /// The file to upload /// File uploaded successfully. /// A server side error occurred. public async System.Threading.Tasks.Task UploadAsync(string sAB_Access_Code, long recordId, string attrName, FileParameter file = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (recordId == null) throw new System.ArgumentNullException("recordId"); if (attrName == null) throw new System.ArgumentNullException("attrName"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/safe/records/{recordId}/upload/{attrName}"); urlBuilder_.Replace("{recordId}", System.Uri.EscapeDataString(ConvertToString(recordId, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{attrName}", System.Uri.EscapeDataString(ConvertToString(attrName, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { if (sAB_Access_Code == null) throw new System.ArgumentNullException("sAB_Access_Code"); request_.Headers.TryAddWithoutValidation("SAB-Access-Code", ConvertToString(sAB_Access_Code, System.Globalization.CultureInfo.InvariantCulture)); var boundary_ = System.Guid.NewGuid().ToString(); var content_ = new System.Net.Http.MultipartFormDataContent(boundary_); content_.Headers.Remove("Content-Type"); content_.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + boundary_); if (file != null) { var content_file_ = new System.Net.Http.StreamContent(file.Data); if (!string.IsNullOrEmpty(file.ContentType)) content_file_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse(file.ContentType); content_.Add(content_file_, "file", file.FileName ?? "file"); } request_.Content = content_; request_.Method = new System.Net.Http.HttpMethod("POST"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200" || status_ == "206") { var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false); var fileResponse_ = new FileResponse((int)response_.StatusCode, headers_, responseStream_, null, response_); client_ = null; response_ = null; // response and client are disposed by FileResponse return fileResponse_; } else if (status_ == "401") { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("Not user authenticated!", (int)response_.StatusCode, responseText_, headers_, null); } else if (status_ == "403") { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("User has no permission to modify Account", (int)response_.StatusCode, responseText_, headers_, null); } else if (status_ == "404") { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("Record not found!", (int)response_.StatusCode, responseText_, headers_, null); } else if (status_ == "413") { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("File size limit exceeded!", (int)response_.StatusCode, responseText_, headers_, null); } else if (status_ == "422") { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("Validation failed!", (int)response_.StatusCode, responseText_, headers_, null); } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(FileResponse); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// Download file from record /// URL encoded access code - you must use URL encoding on utf-8 bytes to preserve international characters, special characters etc. as HTTP headers use only limited ASCII. There is no encoding standard and SecureAnyBox expects and decodes URL encoded access code. /// ID of Record /// name of file attribute in Record. Usually 'file' /// Status 200 /// A server side error occurred. public async System.Threading.Tasks.Task DownloadAsync(string sAB_Access_Code, long recordId, string attrName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (recordId == null) throw new System.ArgumentNullException("recordId"); if (attrName == null) throw new System.ArgumentNullException("attrName"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/safe/records/{recordId}/download/{attrName}"); urlBuilder_.Replace("{recordId}", System.Uri.EscapeDataString(ConvertToString(recordId, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{attrName}", System.Uri.EscapeDataString(ConvertToString(attrName, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var keyValues_ = new System.Collections.Generic.List>(); if (sAB_Access_Code == null) throw new System.ArgumentNullException("sAB_Access_Code"); else keyValues_.Add(new System.Collections.Generic.KeyValuePair("SAB-Access-Code", ConvertToString(sAB_Access_Code, System.Globalization.CultureInfo.InvariantCulture))); request_.Content = new System.Net.Http.FormUrlEncodedContent(keyValues_); request_.Method = new System.Net.Http.HttpMethod("POST"); request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("binary/octet-stream")); PrepareRequest(client_, request_, urlBuilder_); var url_ = urlBuilder_.ToString(); request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); PrepareRequest(client_, request_, url_); var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); try { var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); if (response_.Content != null && response_.Content.Headers != null) { foreach (var item_ in response_.Content.Headers) headers_[item_.Key] = item_.Value; } ProcessResponse(client_, response_); var status_ = ((int)response_.StatusCode).ToString(); if (status_ == "200" || status_ == "206") { var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false); var fileResponse_ = new FileResponse((int)response_.StatusCode, headers_, responseStream_, null, response_); client_ = null; response_ = null; // response and client are disposed by FileResponse return fileResponse_; } else if (status_ == "401") { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("No user authenticated!", (int)response_.StatusCode, responseText_, headers_, null); } else if (status_ == "403") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("User has no permission to read record.", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "404") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Record not found!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == "422") { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_).ConfigureAwait(false); throw new ApiException("Validation failed!", (int)response_.StatusCode, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ != "200" && status_ != "204") { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new ApiException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", (int)response_.StatusCode, responseData_, headers_, null); } return default(FileResponse); } finally { if (response_ != null) response_.Dispose(); } } } finally { } } protected struct ObjectResponseResult { public ObjectResponseResult(T responseObject, string responseText) { this.Object = responseObject; this.Text = responseText; } public T Object { get; } public string Text { get; } } public bool ReadResponseAsString { get; set; } protected virtual async System.Threading.Tasks.Task> ReadObjectResponseAsync(System.Net.Http.HttpResponseMessage response, System.Collections.Generic.IReadOnlyDictionary> headers) { if (response == null || response.Content == null) { return new ObjectResponseResult(default(T), string.Empty); } if (ReadResponseAsString) { var responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false); try { var typedBody = Newtonsoft.Json.JsonConvert.DeserializeObject(responseText, JsonSerializerSettings); return new ObjectResponseResult(typedBody, responseText); } catch (Newtonsoft.Json.JsonException exception) { var message = "Could not deserialize the response body string as " + typeof(T).FullName + "."; throw new ApiException(message, (int)response.StatusCode, responseText, headers, exception); } } else { try { using (var responseStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false)) using (var streamReader = new System.IO.StreamReader(responseStream)) using (var jsonTextReader = new Newtonsoft.Json.JsonTextReader(streamReader)) { var serializer = Newtonsoft.Json.JsonSerializer.Create(JsonSerializerSettings); var typedBody = serializer.Deserialize(jsonTextReader); return new ObjectResponseResult(typedBody, string.Empty); } } catch (Newtonsoft.Json.JsonException exception) { var message = "Could not deserialize the response body stream as " + typeof(T).FullName + "."; throw new ApiException(message, (int)response.StatusCode, string.Empty, headers, exception); } } } private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) { if (value is System.Enum) { string name = System.Enum.GetName(value.GetType(), value); if (name != null) { var field = System.Reflection.IntrospectionExtensions.GetTypeInfo(value.GetType()).GetDeclaredField(name); if (field != null) { var attribute = System.Reflection.CustomAttributeExtensions.GetCustomAttribute(field, typeof(System.Runtime.Serialization.EnumMemberAttribute)) as System.Runtime.Serialization.EnumMemberAttribute; if (attribute != null) { return attribute.Value != null ? attribute.Value : name; } } } } else if (value is bool) { return System.Convert.ToString(value, cultureInfo).ToLowerInvariant(); } else if (value is byte[]) { return System.Convert.ToBase64String((byte[]) value); } else if (value != null && value.GetType().IsArray) { var array = System.Linq.Enumerable.OfType((System.Array) value); return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } return System.Convert.ToString(value, cultureInfo); } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class Message { /// formatted localization key with parameters [Newtonsoft.Json.JsonProperty("message", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Message1 { get; set; } [Newtonsoft.Json.JsonProperty("severity", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public MessageSeverity Severity { get; set; } /// error code (currently not used) [Newtonsoft.Json.JsonProperty("code", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? Code { get; set; } } /// message severity [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public enum MessageSeverity { [System.Runtime.Serialization.EnumMember(Value = @"SUCCESS")] SUCCESS = 0, [System.Runtime.Serialization.EnumMember(Value = @"INFO")] INFO = 1, [System.Runtime.Serialization.EnumMember(Value = @"WARNING")] WARNING = 2, [System.Runtime.Serialization.EnumMember(Value = @"ERROR")] ERROR = 3, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class ErrorMessage : Message { /// Message or message localization key (prefixed with m:) optionally followed by localization message parameters in square brackets. You can use message key (e.g 'record.not.found') to uniquely identify error or message. [Newtonsoft.Json.JsonProperty("message", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Message { get; set; } [Newtonsoft.Json.JsonProperty("severity", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public MessageSeverity? Severity { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class NewRecordId { /// ID of new SafeBox [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Range(1D, double.MaxValue)] public long Id { get; set; } [Newtonsoft.Json.JsonProperty("msg", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.ICollection Msg { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class ErrorResponse { /// Array of error and other messages. [Newtonsoft.Json.JsonProperty("msg", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.ICollection Msg { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class Response { /// Array of messages (may be empty) [Newtonsoft.Json.JsonProperty("msg", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.ICollection Msg { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class StatusResponse : Response { /// Name of application, e.g. SecureAnyBox [Newtonsoft.Json.JsonProperty("product", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Product { get; set; } /// Application version [Newtonsoft.Json.JsonProperty("version", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Version { get; set; } /// This API version [Newtonsoft.Json.JsonProperty("apiVersion", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string ApiVersion { get; set; } /// Formatted time on server, format is HH:mm [Newtonsoft.Json.JsonProperty("serverTime", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string ServerTime { get; set; } /// current server time in milliseconds measured from midnight, January 1, 1970 UTC(coordinated universal time). [Newtonsoft.Json.JsonProperty("gmtTime", Required = Newtonsoft.Json.Required.Always)] public long GmtTime { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class LoginStatusResponse { /// True if user is authenticated [Newtonsoft.Json.JsonProperty("authenticated", Required = Newtonsoft.Json.Required.Always)] public bool Authenticated { get; set; } /// Username (including domain) of authenticated user [Newtonsoft.Json.JsonProperty("uid", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Uid { get; set; } /// True if user has SecureAnyBox user role [Newtonsoft.Json.JsonProperty("SAB_USER", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? SAB_USER { get; set; } /// True if user has SecureAnyBox admin role [Newtonsoft.Json.JsonProperty("SAB_ADMIN", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? SAB_ADMIN { get; set; } /// True if user has Config admin role [Newtonsoft.Json.JsonProperty("CFG_ADMIN", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? CFG_ADMIN { get; set; } /// True if user has safebox user role [Newtonsoft.Json.JsonProperty("SAFEBOX_USER", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? SAFEBOX_USER { get; set; } /// True if user has safebox admin role [Newtonsoft.Json.JsonProperty("SAFEBOX_ADMIN", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? SAFEBOX_ADMIN { get; set; } /// True if user has auditor role [Newtonsoft.Json.JsonProperty("AUDITOR", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? AUDITOR { get; set; } /// Second factor authentication is required to complete login. [Newtonsoft.Json.JsonProperty("secondFactorRequired", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? SecondFactorRequired { get; set; } /// Configured access code timeout in seconds. [Newtonsoft.Json.JsonProperty("accessCodeTimeout", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long? AccessCodeTimeout { get; set; } /// true if user has set his access code and can work with Safe Boxes. [Newtonsoft.Json.JsonProperty("hasAccessCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? HasAccessCode { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class FileSizeLimitResponse : Response { [Newtonsoft.Json.JsonProperty("fileSizeLimit", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long? FileSizeLimit { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class UserConfigResponse { /// user language setting [Newtonsoft.Json.JsonProperty("lang", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Lang { get; set; } [Newtonsoft.Json.JsonProperty("enterpriseEdition", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? EnterpriseEdition { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class PasswordRequirements { [Newtonsoft.Json.JsonProperty("useLower", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? UseLower { get; set; } [Newtonsoft.Json.JsonProperty("useUpper", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? UseUpper { get; set; } [Newtonsoft.Json.JsonProperty("useDigits", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? UseDigits { get; set; } [Newtonsoft.Json.JsonProperty("useSpecial", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? UseSpecial { get; set; } /// minimum Lowercase characters [Newtonsoft.Json.JsonProperty("minLower", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MinLower { get; set; } /// minimum Uppercase characters [Newtonsoft.Json.JsonProperty("minUpper", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MinUpper { get; set; } /// minimum Digits [Newtonsoft.Json.JsonProperty("minDigits", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MinDigits { get; set; } /// minimum Special characters [Newtonsoft.Json.JsonProperty("minSpecial", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MinSpecial { get; set; } /// minimum password length [Newtonsoft.Json.JsonProperty("minLength", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MinLength { get; set; } /// minimum password entropy [Newtonsoft.Json.JsonProperty("minEntropy", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MinEntropy { get; set; } /// chars to be included in the generated password [Newtonsoft.Json.JsonProperty("includeChars", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string IncludeChars { get; set; } /// excluded chars [Newtonsoft.Json.JsonProperty("excludeChars", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string ExcludeChars { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class GeneratedPassword { /// generated password [Newtonsoft.Json.JsonProperty("password", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Password { get; set; } /// estimated entropy of generated password as computed by NBVCXZ library using installed dictionaries [Newtonsoft.Json.JsonProperty("estimate", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public PasswordEntropy Estimate { get; set; } /// warnings and error messages when requested password requirements coul'd not be met (e.g. not enough entropy could be generated using allowed character set) [Newtonsoft.Json.JsonProperty("msg", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.ICollection Msg { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class PasswordEntropyResponse : PasswordEntropy { /// Array of messages (may be empty) [Newtonsoft.Json.JsonProperty("msg", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.ICollection Msg { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class PasswordEntropy { /// generated password entropy as computed by NBVCXZ library using installed dictionaries [Newtonsoft.Json.JsonProperty("entropy", Required = Newtonsoft.Json.Required.Always)] public double Entropy { get; set; } /// estimatee of how login it would take to crack the password online (throttled) [Newtonsoft.Json.JsonProperty("secondsToCrackOnline", Required = Newtonsoft.Json.Required.Always)] public double SecondsToCrackOnline { get; set; } /// estimatee of how login it would take to crack the password offline (assuming bcrypt cost=12) [Newtonsoft.Json.JsonProperty("secondsToCrackOffline", Required = Newtonsoft.Json.Required.Always)] public double SecondsToCrackOffline { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class PasswodComplianceResponse { [Newtonsoft.Json.JsonProperty("lowercase", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public double? Lowercase { get; set; } [Newtonsoft.Json.JsonProperty("uppercase", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public double? Uppercase { get; set; } [Newtonsoft.Json.JsonProperty("digits", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public double? Digits { get; set; } [Newtonsoft.Json.JsonProperty("special", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public double? Special { get; set; } [Newtonsoft.Json.JsonProperty("len", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public double? Len { get; set; } [Newtonsoft.Json.JsonProperty("uppercaseBad", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? UppercaseBad { get; set; } [Newtonsoft.Json.JsonProperty("lowercaseBad", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? LowercaseBad { get; set; } [Newtonsoft.Json.JsonProperty("digitsBad", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? DigitsBad { get; set; } [Newtonsoft.Json.JsonProperty("specialBad", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? SpecialBad { get; set; } [Newtonsoft.Json.JsonProperty("lenBad", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? LenBad { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class SearchResult { /// ID of Record [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Always)] public long Id { get; set; } /// Record name [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] [System.ComponentModel.DataAnnotations.StringLength(255)] public string Name { get; set; } /// Record description [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Description { get; set; } /// Login name [Newtonsoft.Json.JsonProperty("login", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Login { get; set; } /// Login site or hostname:port extracted from record address. [Newtonsoft.Json.JsonProperty("fromSite", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string FromSite { get; set; } /// Record type [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] [System.ComponentModel.DataAnnotations.StringLength(255)] public string Type { get; set; } /// ID of owner user [Newtonsoft.Json.JsonProperty("ownerId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long? OwnerId { get; set; } [Newtonsoft.Json.JsonProperty("template", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public RecordTemplate? Template { get; set; } /// Name of parent Safe Box [Newtonsoft.Json.JsonProperty("parent", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Parent { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class SearchResults : Response { [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.ICollection Result { get; set; } = new System.Collections.ObjectModel.Collection(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class WhiteBox { /// ID of White Box [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Always)] public long Id { get; set; } /// White Box name [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] [System.ComponentModel.DataAnnotations.StringLength(255)] public string Name { get; set; } [Newtonsoft.Json.JsonProperty("passwordPattern", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string PasswordPattern { get; set; } /// True for private Safe Box, False for shared Safe Box [Newtonsoft.Json.JsonProperty("privateBox", Required = Newtonsoft.Json.Required.Always)] public bool PrivateBox { get; set; } /// Whitebox owner user id [Newtonsoft.Json.JsonProperty("ownerUserId", Required = Newtonsoft.Json.Required.Always)] public long OwnerUserId { get; set; } /// Whitebox user domain id [Newtonsoft.Json.JsonProperty("domainId", Required = Newtonsoft.Json.Required.Always)] public long DomainId { get; set; } /// modification timestamp - milliseconds measured from midnight, January 1, 1970 UTC(coordinated universal time). [Newtonsoft.Json.JsonProperty("modified", Required = Newtonsoft.Json.Required.Always)] public long Modified { get; set; } /// creation timestamp - milliseconds measured from midnight, January 1, 1970 UTC(coordinated universal time). [Newtonsoft.Json.JsonProperty("created", Required = Newtonsoft.Json.Required.Always)] public long Created { get; set; } [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public WhiteBoxType Type { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class SafeBox { /// ID of Safe Box [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long? Id { get; set; } /// Safe Box name [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] [System.ComponentModel.DataAnnotations.StringLength(255)] public string Name { get; set; } [Newtonsoft.Json.JsonProperty("passwordPattern", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string PasswordPattern { get; set; } /// True for private Safe Box, False for shared Safe Box [Newtonsoft.Json.JsonProperty("privateBox", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? PrivateBox { get; set; } /// Safe Box owner name [Newtonsoft.Json.JsonProperty("ownerName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string OwnerName { get; set; } /// Safe Box domain name [Newtonsoft.Json.JsonProperty("domainName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string DomainName { get; set; } /// ID of parent Safe Box, could be ommited if parent is root [Newtonsoft.Json.JsonProperty("parentId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long? ParentId { get; set; } /// Type of Safe Box [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public SafeBoxType Type { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class SafeBoxes : Response { [Newtonsoft.Json.JsonProperty("whiteBox", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public WhiteBox WhiteBox { get; set; } [Newtonsoft.Json.JsonProperty("safeboxes", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.ICollection Safeboxes { get; set; } = new System.Collections.ObjectModel.Collection(); } /// type of record [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public enum RecordTemplate { [System.Runtime.Serialization.EnumMember(Value = @"account")] Account = 0, [System.Runtime.Serialization.EnumMember(Value = @"account-sec")] AccountSec = 1, [System.Runtime.Serialization.EnumMember(Value = @"file")] File = 2, [System.Runtime.Serialization.EnumMember(Value = @"cert")] Cert = 3, [System.Runtime.Serialization.EnumMember(Value = @"ccard")] Ccard = 4, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class Record { /// ID of record [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long? Id { get; set; } [Newtonsoft.Json.JsonProperty("template", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public RecordTemplate? Template { get; set; } /// Name of record [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] [System.ComponentModel.DataAnnotations.StringLength(255)] public string Name { get; set; } /// Optional name of attached file [Newtonsoft.Json.JsonProperty("fileName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string FileName { get; set; } /// Optional approximate file size (rounded to encryption block size) [Newtonsoft.Json.JsonProperty("fileSizeApprox", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long? FileSizeApprox { get; set; } /// Target address or URL [Newtonsoft.Json.JsonProperty("serverAddress", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string ServerAddress { get; set; } /// Hostname or domain name and port identifying server or server group matching an account. Example google.com:443 or server1.domain.com:8080. [Newtonsoft.Json.JsonProperty("site", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Site { get; set; } /// Description of record [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.StringLength(255)] public string Description { get; set; } /// Comma separated tag list [Newtonsoft.Json.JsonProperty("tags", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.ICollection Tags { get; set; } /// Type of Launcher, e.g. remote desktop, putty, Winscp, ... [Newtonsoft.Json.JsonProperty("launcher", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public RecordLauncher? Launcher { get; set; } = SABClientNSwag.RecordLauncher.NONE; /// Additional notes [Newtonsoft.Json.JsonProperty("note", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Note { get; set; } /// Login name [Newtonsoft.Json.JsonProperty("loginName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string LoginName { get; set; } /// modification timestamp - milliseconds measured from midnight, January 1, 1970 UTC(coordinated universal time). [Newtonsoft.Json.JsonProperty("modified", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long? Modified { get; set; } /// new account password (when creating) [Newtonsoft.Json.JsonProperty("password", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Password { get; set; } /// repeating new password [Newtonsoft.Json.JsonProperty("passwordRe", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string PasswordRe { get; set; } [Newtonsoft.Json.JsonProperty("attributes", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.IDictionary Attributes { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class Records : Response { [Newtonsoft.Json.JsonProperty("records", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.ICollection Records1 { get; set; } = new System.Collections.ObjectModel.Collection(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class Account : Record { [Newtonsoft.Json.JsonProperty("template", Required = Newtonsoft.Json.Required.Always)] public AccountTemplate Template { get; set; } /// Password pattern used for password generation [Newtonsoft.Json.JsonProperty("passwordPattern", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string PasswordPattern { get; set; } /// Account user login name (Only aplicable for template=account) [Newtonsoft.Json.JsonProperty("loginName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string LoginName { get; set; } /// URL of web associated with account - if any (Only aplicable for template=account) [Newtonsoft.Json.JsonProperty("serverAddress", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string ServerAddress { get; set; } /// Account password - only used when adding new account [Newtonsoft.Json.JsonProperty("password", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Password { get; set; } /// Account password repeated - only used when adding new account [Newtonsoft.Json.JsonProperty("passwordRe", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string PasswordRe { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class SecretAccount : Record { [Newtonsoft.Json.JsonProperty("template", Required = Newtonsoft.Json.Required.Always)] public SecretAccountTemplate Template { get; set; } /// Password pattern used for password generation [Newtonsoft.Json.JsonProperty("passwordPattern", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string PasswordPattern { get; set; } /// Account password - only used when adding new account [Newtonsoft.Json.JsonProperty("password", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Password { get; set; } /// Account password repeated - only used when adding new account [Newtonsoft.Json.JsonProperty("passwordRe", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string PasswordRe { get; set; } /// Server address (encrypted attribute) [Newtonsoft.Json.JsonProperty("sec-serverAddress", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string SecServerAddress { get; set; } /// Login name (encrypted attribute) [Newtonsoft.Json.JsonProperty("sec-loginName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string SecLoginName { get; set; } /// Notes (encrypted attribute) [Newtonsoft.Json.JsonProperty("sec-note", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string SecNote { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class FileRecord : Record { [Newtonsoft.Json.JsonProperty("template", Required = Newtonsoft.Json.Required.Always)] public FileRecordTemplate Template { get; set; } /// Name of uploaded file (encrypted attribute) [Newtonsoft.Json.JsonProperty("file", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string File { get; set; } /// Notes (encrypted attribute) [Newtonsoft.Json.JsonProperty("sec-note", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string SecNote { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class CreditCardRecord : Record { [Newtonsoft.Json.JsonProperty("template", Required = Newtonsoft.Json.Required.Always)] public CreditCardRecordTemplate Template { get; set; } /// Credit Card number (encrypted record) [Newtonsoft.Json.JsonProperty("number", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Number { get; set; } /// Expiration Date (encrypted record) [Newtonsoft.Json.JsonProperty("expiration", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Expiration { get; set; } /// CVV (encrypted record) [Newtonsoft.Json.JsonProperty("cvv", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Cvv { get; set; } /// PIN (encrypted record) [Newtonsoft.Json.JsonProperty("pin", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Pin { get; set; } /// Notes (encrypted attribute) [Newtonsoft.Json.JsonProperty("sec-note", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string SecNote { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class CertificateRecord : Record { [Newtonsoft.Json.JsonProperty("template", Required = Newtonsoft.Json.Required.Always)] public CertificateRecordTemplate Template { get; set; } /// (encrypted record) [Newtonsoft.Json.JsonProperty("alias", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Alias { get; set; } /// Certificate file name (encrypted record) [Newtonsoft.Json.JsonProperty("file", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string File { get; set; } /// Certificate file password (encrypted record) [Newtonsoft.Json.JsonProperty("filePassword", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string FilePassword { get; set; } /// Notes (encrypted attribute) [Newtonsoft.Json.JsonProperty("sec-note", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string SecNote { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public enum Type { [System.Runtime.Serialization.EnumMember(Value = @"login")] Login = 0, [System.Runtime.Serialization.EnumMember(Value = @"accessCode")] AccessCode = 1, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public enum Type2 { [System.Runtime.Serialization.EnumMember(Value = @"login")] Login = 0, [System.Runtime.Serialization.EnumMember(Value = @"accessCode")] AccessCode = 1, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public enum Platform { [System.Runtime.Serialization.EnumMember(Value = @"WINDOWS")] WINDOWS = 0, [System.Runtime.Serialization.EnumMember(Value = @"LINUX")] LINUX = 1, [System.Runtime.Serialization.EnumMember(Value = @"MAC")] MAC = 2, [System.Runtime.Serialization.EnumMember(Value = @"LDAP")] LDAP = 3, } /// Station platform [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public enum Platform2 { [System.Runtime.Serialization.EnumMember(Value = @"WINDOWS")] WINDOWS = 0, [System.Runtime.Serialization.EnumMember(Value = @"LINUX")] LINUX = 1, [System.Runtime.Serialization.EnumMember(Value = @"MAC")] MAC = 2, [System.Runtime.Serialization.EnumMember(Value = @"LDAP")] LDAP = 3, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class Body { [Newtonsoft.Json.JsonProperty("password", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Password { get; set; } [Newtonsoft.Json.JsonProperty("passwordRe", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string PasswordRe { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class Response2 { [Newtonsoft.Json.JsonProperty("safebox", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required] public SafeBox Safebox { get; set; } = new SafeBox(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class Response3 { [Newtonsoft.Json.JsonProperty("msg", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.ICollection Msg { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class Response4 { [Newtonsoft.Json.JsonProperty("msg", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.ICollection Msg { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class Response5 { [Newtonsoft.Json.JsonProperty("record", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required] public Record Record { get; set; } = new Record(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class Response6 { [Newtonsoft.Json.JsonProperty("msg", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.ICollection Msg { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class Response7 { [Newtonsoft.Json.JsonProperty("password", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Password { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class Response8 { [Newtonsoft.Json.JsonProperty("msg", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.ICollection Msg { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class Response9 { [Newtonsoft.Json.JsonProperty("passwords", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.ICollection Passwords { get; set; } = new System.Collections.ObjectModel.Collection(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class Response10 { [Newtonsoft.Json.JsonProperty("password", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Password { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public enum WhiteBoxType { [System.Runtime.Serialization.EnumMember(Value = @"WHITEBOX")] WHITEBOX = 0, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public enum SafeBoxType { [System.Runtime.Serialization.EnumMember(Value = @"SAFEBOX")] SAFEBOX = 0, [System.Runtime.Serialization.EnumMember(Value = @"SAFEBOX_GROUP")] SAFEBOX_GROUP = 1, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public enum RecordLauncher { [System.Runtime.Serialization.EnumMember(Value = @"NONE")] NONE = 0, [System.Runtime.Serialization.EnumMember(Value = @"REMOTE_DESKTOP")] REMOTE_DESKTOP = 1, [System.Runtime.Serialization.EnumMember(Value = @"SSH")] SSH = 2, [System.Runtime.Serialization.EnumMember(Value = @"SFTP")] SFTP = 3, [System.Runtime.Serialization.EnumMember(Value = @"FTP")] FTP = 4, [System.Runtime.Serialization.EnumMember(Value = @"TELNET")] TELNET = 5, [System.Runtime.Serialization.EnumMember(Value = @"SCP")] SCP = 6, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public enum AccountTemplate { [System.Runtime.Serialization.EnumMember(Value = @"account")] Account = 0, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public enum SecretAccountTemplate { [System.Runtime.Serialization.EnumMember(Value = @"account-sec")] AccountSec = 0, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public enum FileRecordTemplate { [System.Runtime.Serialization.EnumMember(Value = @"file")] File = 0, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public enum CreditCardRecordTemplate { [System.Runtime.Serialization.EnumMember(Value = @"ccard")] Ccard = 0, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public enum CertificateRecordTemplate { [System.Runtime.Serialization.EnumMember(Value = @"cert")] Cert = 0, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.2.0 (Newtonsoft.Json v11.0.0.0)")] public partial class Passwords { [Newtonsoft.Json.JsonProperty("username", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string Username { get; set; } [Newtonsoft.Json.JsonProperty("created", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public System.DateTimeOffset Created { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.2.0.0 (NJsonSchema v10.1.2.0 (Newtonsoft.Json v11.0.0.0))")] public partial class FileParameter { public FileParameter(System.IO.Stream data) : this (data, null) { } public FileParameter(System.IO.Stream data, string fileName) : this (data, fileName, null) { } public FileParameter(System.IO.Stream data, string fileName, string contentType) { Data = data; FileName = fileName; ContentType = contentType; } public System.IO.Stream Data { get; private set; } public string FileName { get; private set; } public string ContentType { get; private set; } } public partial class FileResponse : System.IDisposable { private System.IDisposable _client; private System.IDisposable _response; public int StatusCode { get; private set; } public System.Collections.Generic.IReadOnlyDictionary> Headers { get; private set; } public System.IO.Stream Stream { get; private set; } public bool IsPartial { get { return StatusCode == 206; } } public FileResponse(int statusCode, System.Collections.Generic.IReadOnlyDictionary> headers, System.IO.Stream stream, System.IDisposable client, System.IDisposable response) { StatusCode = statusCode; Headers = headers; Stream = stream; _client = client; _response = response; } public void Dispose() { if (Stream != null) Stream.Dispose(); if (_response != null) _response.Dispose(); if (_client != null) _client.Dispose(); } } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.2.0.0 (NJsonSchema v10.1.2.0 (Newtonsoft.Json v11.0.0.0))")] public partial class ApiException : System.Exception { public int StatusCode { get; private set; } public string Response { get; private set; } public System.Collections.Generic.IReadOnlyDictionary> Headers { get; private set; } public ApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Exception innerException) : base(message + "\n\nStatus: " + statusCode + "\nResponse: \n" + response.Substring(0, response.Length >= 512 ? 512 : response.Length), innerException) { StatusCode = statusCode; Response = response; Headers = headers; } public override string ToString() { return string.Format("HTTP Response: \n\n{0}\n\n{1}", Response, base.ToString()); } } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.2.0.0 (NJsonSchema v10.1.2.0 (Newtonsoft.Json v11.0.0.0))")] public partial class ApiException : ApiException { public TResult Result { get; private set; } public ApiException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, TResult result, System.Exception innerException) : base(message, statusCode, response, headers, innerException) { Result = result; } } } #pragma warning restore 1591 #pragma warning restore 1573 #pragma warning restore 472 #pragma warning restore 114 #pragma warning restore 108