//---------------------- // // Generated using the NSwag toolchain v13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.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 ..." #pragma warning disable 8073 // Disable "CS8073 The result of the expression is always 'false' since a value of type 'T' is never equal to 'null' of type 'T?'" #pragma warning disable 3016 // Disable "CS3016 Arrays as attribute arguments is not CLS-compliant" #pragma warning disable 8603 // Disable "CS8603 Possible null reference return" namespace Squidex.ClientLibrary.Management { using System = global::System; [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial interface IUsersClient { /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get the user resources. /// /// User resources returned. /// A server side error occurred. System.Threading.Tasks.Task GetUserResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get users by query. /// /// The query to search the user by email address. Case invariant. /// Users returned. /// A server side error occurred. System.Threading.Tasks.Task> GetUsersAsync(string query = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get user by id. /// /// The id of the user (GUID). /// User found. /// A server side error occurred. System.Threading.Tasks.Task GetUserAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get user picture by id. /// /// The id of the user (GUID). /// User found and image or fallback returned. /// A server side error occurred. System.Threading.Tasks.Task GetUserPictureAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class UsersClient : IUsersClient { private System.Net.Http.HttpClient _httpClient; private System.Lazy _settings; public UsersClient(System.Net.Http.HttpClient httpClient) { _httpClient = httpClient; _settings = new System.Lazy(CreateSerializerSettings); } private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { var settings = new Newtonsoft.Json.JsonSerializerSettings(); UpdateJsonSerializerSettings(settings); return settings; } 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. /// /// Get the user resources. /// /// User resources returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetUserResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api"); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get users by query. /// /// The query to search the user by email address. Case invariant. /// Users returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task> GetUsersAsync(string query = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/users?"); if (query != null) { urlBuilder_.Append(System.Uri.EscapeDataString("query") + "=").Append(System.Uri.EscapeDataString(ConvertToString(query, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get user by id. /// /// The id of the user (GUID). /// User found. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetUserAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/users/{id}"); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("User not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get user picture by id. /// /// The id of the user (GUID). /// User found and image or fallback returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetUserPictureAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/users/{id}/picture"); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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/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); var disposeResponse_ = true; 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; if (status_ == 200 || status_ == 206) { var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false); var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_); disposeClient_ = false; disposeResponse_ = false; // response and client are disposed by FileResponse return fileResponse_; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("User not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } 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, System.Threading.CancellationToken cancellationToken) { 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 SquidexManagementException(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 SquidexManagementException(message, (int)response.StatusCode, string.Empty, headers, exception); } } } private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) { if (value == null) { return ""; } if (value is System.Enum) { var 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; } } var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); return converted == null ? string.Empty : converted; } } else if (value is bool) { return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } else if (value is byte[]) { return System.Convert.ToBase64String((byte[]) value); } else if (value.GetType().IsArray) { var array = System.Linq.Enumerable.OfType((System.Array) value); return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } var result = System.Convert.ToString(value, cultureInfo); return result == null ? "" : result; } } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial interface ITranslationsClient { /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Translate a text. /// /// The name of the app. /// The translation request. /// Text translated. /// A server side error occurred. System.Threading.Tasks.Task PostTranslationAsync(string app, TranslateDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class TranslationsClient : ITranslationsClient { private System.Net.Http.HttpClient _httpClient; private System.Lazy _settings; public TranslationsClient(System.Net.Http.HttpClient httpClient) { _httpClient = httpClient; _settings = new System.Lazy(CreateSerializerSettings); } private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { var settings = new Newtonsoft.Json.JsonSerializerSettings(); UpdateJsonSerializerSettings(settings); return settings; } 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. /// /// Translate a text. /// /// The name of the app. /// The translation request. /// Text translated. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PostTranslationAsync(string app, TranslateDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/translations"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } 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, System.Threading.CancellationToken cancellationToken) { 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 SquidexManagementException(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 SquidexManagementException(message, (int)response.StatusCode, string.Empty, headers, exception); } } } private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) { if (value == null) { return ""; } if (value is System.Enum) { var 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; } } var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); return converted == null ? string.Empty : converted; } } else if (value is bool) { return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } else if (value is byte[]) { return System.Convert.ToBase64String((byte[]) value); } else if (value.GetType().IsArray) { var array = System.Linq.Enumerable.OfType((System.Array) value); return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } var result = System.Convert.ToString(value, cultureInfo); return result == null ? "" : result; } } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial interface ITemplatesClient { /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get all templates. /// /// Templates returned. /// A server side error occurred. System.Threading.Tasks.Task GetTemplatesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get template details. /// /// The name of the template. /// Template returned. /// A server side error occurred. System.Threading.Tasks.Task GetTemplateAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class TemplatesClient : ITemplatesClient { private System.Net.Http.HttpClient _httpClient; private System.Lazy _settings; public TemplatesClient(System.Net.Http.HttpClient httpClient) { _httpClient = httpClient; _settings = new System.Lazy(CreateSerializerSettings); } private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { var settings = new Newtonsoft.Json.JsonSerializerSettings(); UpdateJsonSerializerSettings(settings); return settings; } 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. /// /// Get all templates. /// /// Templates returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetTemplatesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/templates"); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get template details. /// /// The name of the template. /// Template returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetTemplateAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (name == null) throw new System.ArgumentNullException("name"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/templates/{name}"); urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Template not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } 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, System.Threading.CancellationToken cancellationToken) { 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 SquidexManagementException(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 SquidexManagementException(message, (int)response.StatusCode, string.Empty, headers, exception); } } } private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) { if (value == null) { return ""; } if (value is System.Enum) { var 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; } } var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); return converted == null ? string.Empty : converted; } } else if (value is bool) { return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } else if (value is byte[]) { return System.Convert.ToBase64String((byte[]) value); } else if (value.GetType().IsArray) { var array = System.Linq.Enumerable.OfType((System.Array) value); return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } var result = System.Convert.ToString(value, cultureInfo); return result == null ? "" : result; } } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial interface IStatisticsClient { /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get api calls as log file. /// /// The name of the app. /// Usage tracking results returned. /// A server side error occurred. System.Threading.Tasks.Task GetLogAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get api calls in date range. /// /// The name of the app. /// The from date. /// The to date. /// API call returned. /// A server side error occurred. System.Threading.Tasks.Task GetUsagesAsync(string app, string fromDate, string toDate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get total asset size. /// /// The name of the app. /// Storage usage returned. /// A server side error occurred. System.Threading.Tasks.Task GetCurrentStorageSizeAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get asset usage by date. /// /// The name of the app. /// The from date. /// The to date. /// Storage usage returned. /// A server side error occurred. System.Threading.Tasks.Task> GetStorageSizesAsync(string app, string fromDate, string toDate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class StatisticsClient : IStatisticsClient { private System.Net.Http.HttpClient _httpClient; private System.Lazy _settings; public StatisticsClient(System.Net.Http.HttpClient httpClient) { _httpClient = httpClient; _settings = new System.Lazy(CreateSerializerSettings); } private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { var settings = new Newtonsoft.Json.JsonSerializerSettings(); UpdateJsonSerializerSettings(settings); return settings; } 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. /// /// Get api calls as log file. /// /// The name of the app. /// Usage tracking results returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetLogAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/usages/log"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get api calls in date range. /// /// The name of the app. /// The from date. /// The to date. /// API call returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetUsagesAsync(string app, string fromDate, string toDate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (fromDate == null) throw new System.ArgumentNullException("fromDate"); if (toDate == null) throw new System.ArgumentNullException("toDate"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/usages/calls/{fromDate}/{toDate}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{fromDate}", System.Uri.EscapeDataString(ConvertToString(fromDate, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{toDate}", System.Uri.EscapeDataString(ConvertToString(toDate, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Range between from date and to date is not valid or has more than 100 days.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get total asset size. /// /// The name of the app. /// Storage usage returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetCurrentStorageSizeAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/usages/storage/today"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get asset usage by date. /// /// The name of the app. /// The from date. /// The to date. /// Storage usage returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task> GetStorageSizesAsync(string app, string fromDate, string toDate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (fromDate == null) throw new System.ArgumentNullException("fromDate"); if (toDate == null) throw new System.ArgumentNullException("toDate"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/usages/storage/{fromDate}/{toDate}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{fromDate}", System.Uri.EscapeDataString(ConvertToString(fromDate, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{toDate}", System.Uri.EscapeDataString(ConvertToString(toDate, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Range between from date and to date is not valid or has more than 100 days.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } 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, System.Threading.CancellationToken cancellationToken) { 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 SquidexManagementException(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 SquidexManagementException(message, (int)response.StatusCode, string.Empty, headers, exception); } } } private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) { if (value == null) { return ""; } if (value is System.Enum) { var 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; } } var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); return converted == null ? string.Empty : converted; } } else if (value is bool) { return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } else if (value is byte[]) { return System.Convert.ToBase64String((byte[]) value); } else if (value.GetType().IsArray) { var array = System.Linq.Enumerable.OfType((System.Array) value); return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } var result = System.Convert.ToString(value, cultureInfo); return result == null ? "" : result; } } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial interface ISearchClient { /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get search results. /// /// The name of the app. /// The search query. /// Search results returned. /// A server side error occurred. System.Threading.Tasks.Task> GetSearchResultsAsync(string app, string query = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class SearchClient : ISearchClient { private System.Net.Http.HttpClient _httpClient; private System.Lazy _settings; public SearchClient(System.Net.Http.HttpClient httpClient) { _httpClient = httpClient; _settings = new System.Lazy(CreateSerializerSettings); } private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { var settings = new Newtonsoft.Json.JsonSerializerSettings(); UpdateJsonSerializerSettings(settings); return settings; } 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. /// /// Get search results. /// /// The name of the app. /// The search query. /// Search results returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task> GetSearchResultsAsync(string app, string query = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/search?"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); if (query != null) { urlBuilder_.Append(System.Uri.EscapeDataString("query") + "=").Append(System.Uri.EscapeDataString(ConvertToString(query, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } 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, System.Threading.CancellationToken cancellationToken) { 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 SquidexManagementException(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 SquidexManagementException(message, (int)response.StatusCode, string.Empty, headers, exception); } } } private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) { if (value == null) { return ""; } if (value is System.Enum) { var 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; } } var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); return converted == null ? string.Empty : converted; } } else if (value is bool) { return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } else if (value is byte[]) { return System.Convert.ToBase64String((byte[]) value); } else if (value.GetType().IsArray) { var array = System.Linq.Enumerable.OfType((System.Array) value); return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } var result = System.Convert.ToString(value, cultureInfo); return result == null ? "" : result; } } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial interface ISchemasClient { /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Add a schema field. /// /// The name of the app. /// The name of the schema. /// The field object that needs to be added to the schema. /// Schema field created. /// A server side error occurred. System.Threading.Tasks.Task PostFieldAsync(string app, string schema, AddFieldDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Add a nested field. /// /// The name of the app. /// The name of the schema. /// The parent field id. /// The field object that needs to be added to the schema. /// Schema field created. /// A server side error occurred. System.Threading.Tasks.Task PostNestedFieldAsync(string app, string schema, long parentId, AddFieldDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Configure UI fields. /// /// The name of the app. /// The name of the schema. /// The request that contains the field names. /// Schema UI fields defined. /// A server side error occurred. System.Threading.Tasks.Task PutSchemaUIFieldsAsync(string app, string schema, ConfigureUIFieldsDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Reorder all fields. /// /// The name of the app. /// The name of the schema. /// The request that contains the field ids. /// Schema fields reordered. /// A server side error occurred. System.Threading.Tasks.Task PutSchemaFieldOrderingAsync(string app, string schema, ReorderFieldsDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Reorder all nested fields. /// /// The name of the app. /// The name of the schema. /// The parent field id. /// The request that contains the field ids. /// Schema fields reordered. /// A server side error occurred. System.Threading.Tasks.Task PutNestedFieldOrderingAsync(string app, string schema, long parentId, ReorderFieldsDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update a schema field. /// /// The name of the app. /// The name of the schema. /// The id of the field to update. /// The field object that needs to be added to the schema. /// Schema field updated. /// A server side error occurred. System.Threading.Tasks.Task PutFieldAsync(string app, string schema, long id, UpdateFieldDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Delete a schema field. /// /// The name of the app. /// The name of the schema. /// The id of the field to disable. /// Schema field deleted. /// A server side error occurred. System.Threading.Tasks.Task DeleteFieldAsync(string app, string schema, long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update a nested field. /// /// The name of the app. /// The name of the schema. /// The parent field id. /// The id of the field to update. /// The field object that needs to be added to the schema. /// Schema field updated. /// A server side error occurred. System.Threading.Tasks.Task PutNestedFieldAsync(string app, string schema, long parentId, long id, UpdateFieldDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Delete a nested field. /// /// The name of the app. /// The name of the schema. /// The parent field id. /// The id of the field to disable. /// Schema field deleted. /// A server side error occurred. System.Threading.Tasks.Task DeleteNestedFieldAsync(string app, string schema, long parentId, long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Lock a schema field. /// /// The name of the app. /// The name of the schema. /// The id of the field to lock. /// Schema field shown. /// A server side error occurred. System.Threading.Tasks.Task LockFieldAsync(string app, string schema, long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Lock a nested field. /// /// The name of the app. /// The name of the schema. /// The parent field id. /// The id of the field to lock. /// Schema field hidden. /// A server side error occurred. System.Threading.Tasks.Task LockNestedFieldAsync(string app, string schema, long parentId, long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Hide a schema field. /// /// The name of the app. /// The name of the schema. /// The id of the field to hide. /// Schema field hidden. /// A server side error occurred. System.Threading.Tasks.Task HideFieldAsync(string app, string schema, long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Hide a nested field. /// /// The name of the app. /// The name of the schema. /// The parent field id. /// The id of the field to hide. /// Schema field hidden. /// A server side error occurred. System.Threading.Tasks.Task HideNestedFieldAsync(string app, string schema, long parentId, long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Show a schema field. /// /// The name of the app. /// The name of the schema. /// The id of the field to show. /// Schema field shown. /// A server side error occurred. System.Threading.Tasks.Task ShowFieldAsync(string app, string schema, long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Show a nested field. /// /// The name of the app. /// The name of the schema. /// The parent field id. /// The id of the field to show. /// Schema field shown. /// A server side error occurred. System.Threading.Tasks.Task ShowNestedFieldAsync(string app, string schema, long parentId, long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Enable a schema field. /// /// The name of the app. /// The name of the schema. /// The id of the field to enable. /// Schema field enabled. /// A server side error occurred. System.Threading.Tasks.Task EnableFieldAsync(string app, string schema, long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Enable a nested field. /// /// The name of the app. /// The name of the schema. /// The parent field id. /// The id of the field to enable. /// Schema field enabled. /// A server side error occurred. System.Threading.Tasks.Task EnableNestedFieldAsync(string app, string schema, long parentId, long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Disable a schema field. /// /// The name of the app. /// The name of the schema. /// The id of the field to disable. /// Schema field disabled. /// A server side error occurred. System.Threading.Tasks.Task DisableFieldAsync(string app, string schema, long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Disable a nested field. /// /// The name of the app. /// The name of the schema. /// The parent field id. /// The id of the field to disable. /// Schema field disabled. /// A server side error occurred. System.Threading.Tasks.Task DisableNestedFieldAsync(string app, string schema, long parentId, long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get schemas. /// /// The name of the app. /// Schemas returned. /// A server side error occurred. System.Threading.Tasks.Task GetSchemasAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Create a new schema. /// /// The name of the app. /// The schema object that needs to be added to the app. /// Schema created. /// A server side error occurred. System.Threading.Tasks.Task PostSchemaAsync(string app, CreateSchemaDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get a schema by name. /// /// The name of the app. /// The name of the schema to retrieve. /// Schema found. /// A server side error occurred. System.Threading.Tasks.Task GetSchemaAsync(string app, string schema, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update a schema. /// /// The name of the app. /// The name of the schema. /// The schema object that needs to updated. /// Schema updated. /// A server side error occurred. System.Threading.Tasks.Task PutSchemaAsync(string app, string schema, UpdateSchemaDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Delete a schema. /// /// The name of the app. /// The name of the schema to delete. /// Schema deleted. /// A server side error occurred. System.Threading.Tasks.Task DeleteSchemaAsync(string app, string schema, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Synchronize a schema. /// /// The name of the app. /// The name of the schema. /// The schema object that needs to updated. /// Schema updated. /// A server side error occurred. System.Threading.Tasks.Task PutSchemaSyncAsync(string app, string schema, SynchronizeSchemaDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update a schema category. /// /// The name of the app. /// The name of the schema. /// The schema object that needs to updated. /// Schema updated. /// A server side error occurred. System.Threading.Tasks.Task PutCategoryAsync(string app, string schema, ChangeCategoryDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update the preview urls. /// /// The name of the app. /// The name of the schema. /// The preview urls for the schema. /// Schema updated. /// A server side error occurred. System.Threading.Tasks.Task PutPreviewUrlsAsync(string app, string schema, System.Collections.Generic.IDictionary request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update the scripts. /// /// The name of the app. /// The name of the schema. /// The schema scripts object that needs to updated. /// Schema updated. /// A server side error occurred. System.Threading.Tasks.Task PutScriptsAsync(string app, string schema, SchemaScriptsDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update the rules. /// /// The name of the app. /// The name of the schema. /// The schema rules object that needs to updated. /// Schema updated. /// A server side error occurred. System.Threading.Tasks.Task PutRulesAsync(string app, string schema, ConfigureFieldRulesDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Publish a schema. /// /// The name of the app. /// The name of the schema to publish. /// Schema published. /// A server side error occurred. System.Threading.Tasks.Task PublishSchemaAsync(string app, string schema, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Unpublish a schema. /// /// The name of the app. /// The name of the schema to unpublish. /// Schema unpublished. /// A server side error occurred. System.Threading.Tasks.Task UnpublishSchemaAsync(string app, string schema, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class SchemasClient : ISchemasClient { private System.Net.Http.HttpClient _httpClient; private System.Lazy _settings; public SchemasClient(System.Net.Http.HttpClient httpClient) { _httpClient = httpClient; _settings = new System.Lazy(CreateSerializerSettings); } private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { var settings = new Newtonsoft.Json.JsonSerializerSettings(); UpdateJsonSerializerSettings(settings); return settings; } 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. /// /// Add a schema field. /// /// The name of the app. /// The name of the schema. /// The field object that needs to be added to the schema. /// Schema field created. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PostFieldAsync(string app, string schema, AddFieldDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/fields"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _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); var disposeResponse_ = true; 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; if (status_ == 201) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema or app not found.", status_, responseText_, headers_, null); } else if (status_ == 409) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema field name already in use.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Add a nested field. /// /// The name of the app. /// The name of the schema. /// The parent field id. /// The field object that needs to be added to the schema. /// Schema field created. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PostNestedFieldAsync(string app, string schema, long parentId, AddFieldDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (parentId == null) throw new System.ArgumentNullException("parentId"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/fields/{parentId}/nested"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{parentId}", System.Uri.EscapeDataString(ConvertToString(parentId, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _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); var disposeResponse_ = true; 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; if (status_ == 201) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 409) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema field name already in use.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema, field or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Configure UI fields. /// /// The name of the app. /// The name of the schema. /// The request that contains the field names. /// Schema UI fields defined. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutSchemaUIFieldsAsync(string app, string schema, ConfigureUIFieldsDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/fields/ui"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Reorder all fields. /// /// The name of the app. /// The name of the schema. /// The request that contains the field ids. /// Schema fields reordered. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutSchemaFieldOrderingAsync(string app, string schema, ReorderFieldsDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/fields/ordering"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Reorder all nested fields. /// /// The name of the app. /// The name of the schema. /// The parent field id. /// The request that contains the field ids. /// Schema fields reordered. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutNestedFieldOrderingAsync(string app, string schema, long parentId, ReorderFieldsDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (parentId == null) throw new System.ArgumentNullException("parentId"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/fields/{parentId}/nested/ordering"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{parentId}", System.Uri.EscapeDataString(ConvertToString(parentId, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema field request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema, field or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update a schema field. /// /// The name of the app. /// The name of the schema. /// The id of the field to update. /// The field object that needs to be added to the schema. /// Schema field updated. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutFieldAsync(string app, string schema, long id, UpdateFieldDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (id == null) throw new System.ArgumentNullException("id"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/fields/{id}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema field request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema, field or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Delete a schema field. /// /// The name of the app. /// The name of the schema. /// The id of the field to disable. /// Schema field deleted. /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteFieldAsync(string app, string schema, long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/fields/{id}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema field request not valid or field locked.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema, field or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update a nested field. /// /// The name of the app. /// The name of the schema. /// The parent field id. /// The id of the field to update. /// The field object that needs to be added to the schema. /// Schema field updated. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutNestedFieldAsync(string app, string schema, long parentId, long id, UpdateFieldDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (parentId == null) throw new System.ArgumentNullException("parentId"); if (id == null) throw new System.ArgumentNullException("id"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/fields/{parentId}/nested/{id}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{parentId}", System.Uri.EscapeDataString(ConvertToString(parentId, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema field request not valid or field locked.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema, field or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Delete a nested field. /// /// The name of the app. /// The name of the schema. /// The parent field id. /// The id of the field to disable. /// Schema field deleted. /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteNestedFieldAsync(string app, string schema, long parentId, long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (parentId == null) throw new System.ArgumentNullException("parentId"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/fields/{parentId}/nested/{id}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{parentId}", System.Uri.EscapeDataString(ConvertToString(parentId, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema field request not valid or field locked.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema, field or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Lock a schema field. /// /// The name of the app. /// The name of the schema. /// The id of the field to lock. /// Schema field shown. /// A server side error occurred. public virtual async System.Threading.Tasks.Task LockFieldAsync(string app, string schema, long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/fields/{id}/lock"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema field request not valid or field locked.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema, field or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Lock a nested field. /// /// The name of the app. /// The name of the schema. /// The parent field id. /// The id of the field to lock. /// Schema field hidden. /// A server side error occurred. public virtual async System.Threading.Tasks.Task LockNestedFieldAsync(string app, string schema, long parentId, long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (parentId == null) throw new System.ArgumentNullException("parentId"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/fields/{parentId}/nested/{id}/lock"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{parentId}", System.Uri.EscapeDataString(ConvertToString(parentId, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema field request not valid or field locked.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Field, schema, or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Hide a schema field. /// /// The name of the app. /// The name of the schema. /// The id of the field to hide. /// Schema field hidden. /// A server side error occurred. public virtual async System.Threading.Tasks.Task HideFieldAsync(string app, string schema, long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/fields/{id}/hide"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema field request not valid or field locked.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema, field or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Hide a nested field. /// /// The name of the app. /// The name of the schema. /// The parent field id. /// The id of the field to hide. /// Schema field hidden. /// A server side error occurred. public virtual async System.Threading.Tasks.Task HideNestedFieldAsync(string app, string schema, long parentId, long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (parentId == null) throw new System.ArgumentNullException("parentId"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/fields/{parentId}/nested/{id}/hide"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{parentId}", System.Uri.EscapeDataString(ConvertToString(parentId, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema field request not valid or field locked.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Field, schema, or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Show a schema field. /// /// The name of the app. /// The name of the schema. /// The id of the field to show. /// Schema field shown. /// A server side error occurred. public virtual async System.Threading.Tasks.Task ShowFieldAsync(string app, string schema, long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/fields/{id}/show"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema field request not valid or field locked.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema, field or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Show a nested field. /// /// The name of the app. /// The name of the schema. /// The parent field id. /// The id of the field to show. /// Schema field shown. /// A server side error occurred. public virtual async System.Threading.Tasks.Task ShowNestedFieldAsync(string app, string schema, long parentId, long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (parentId == null) throw new System.ArgumentNullException("parentId"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/fields/{parentId}/nested/{id}/show"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{parentId}", System.Uri.EscapeDataString(ConvertToString(parentId, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema field request not valid or field locked.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema, field or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Enable a schema field. /// /// The name of the app. /// The name of the schema. /// The id of the field to enable. /// Schema field enabled. /// A server side error occurred. public virtual async System.Threading.Tasks.Task EnableFieldAsync(string app, string schema, long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/fields/{id}/enable"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema field request not valid or field locked.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema, field or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Enable a nested field. /// /// The name of the app. /// The name of the schema. /// The parent field id. /// The id of the field to enable. /// Schema field enabled. /// A server side error occurred. public virtual async System.Threading.Tasks.Task EnableNestedFieldAsync(string app, string schema, long parentId, long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (parentId == null) throw new System.ArgumentNullException("parentId"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/fields/{parentId}/nested/{id}/enable"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{parentId}", System.Uri.EscapeDataString(ConvertToString(parentId, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema field request not valid or field locked.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema, field or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Disable a schema field. /// /// The name of the app. /// The name of the schema. /// The id of the field to disable. /// Schema field disabled. /// A server side error occurred. public virtual async System.Threading.Tasks.Task DisableFieldAsync(string app, string schema, long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/fields/{id}/disable"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema field request not valid or field locked.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema, field or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Disable a nested field. /// /// The name of the app. /// The name of the schema. /// The parent field id. /// The id of the field to disable. /// Schema field disabled. /// A server side error occurred. public virtual async System.Threading.Tasks.Task DisableNestedFieldAsync(string app, string schema, long parentId, long id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (parentId == null) throw new System.ArgumentNullException("parentId"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/fields/{parentId}/nested/{id}/disable"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{parentId}", System.Uri.EscapeDataString(ConvertToString(parentId, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema field request not valid or field locked.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema, field or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get schemas. /// /// The name of the app. /// Schemas returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetSchemasAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Create a new schema. /// /// The name of the app. /// The schema object that needs to be added to the app. /// Schema created. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PostSchemaAsync(string app, CreateSchemaDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _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); var disposeResponse_ = true; 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; if (status_ == 201) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 409) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema name already in use.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get a schema by name. /// /// The name of the app. /// The name of the schema to retrieve. /// Schema found. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetSchemaAsync(string app, string schema, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update a schema. /// /// The name of the app. /// The name of the schema. /// The schema object that needs to updated. /// Schema updated. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutSchemaAsync(string app, string schema, UpdateSchemaDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Delete a schema. /// /// The name of the app. /// The name of the schema to delete. /// Schema deleted. /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteSchemaAsync(string app, string schema, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 204) { return; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Synchronize a schema. /// /// The name of the app. /// The name of the schema. /// The schema object that needs to updated. /// Schema updated. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutSchemaSyncAsync(string app, string schema, SynchronizeSchemaDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/sync"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update a schema category. /// /// The name of the app. /// The name of the schema. /// The schema object that needs to updated. /// Schema updated. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutCategoryAsync(string app, string schema, ChangeCategoryDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/category"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update the preview urls. /// /// The name of the app. /// The name of the schema. /// The preview urls for the schema. /// Schema updated. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutPreviewUrlsAsync(string app, string schema, System.Collections.Generic.IDictionary request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/preview-urls"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update the scripts. /// /// The name of the app. /// The name of the schema. /// The schema scripts object that needs to updated. /// Schema updated. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutScriptsAsync(string app, string schema, SchemaScriptsDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/scripts"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update the rules. /// /// The name of the app. /// The name of the schema. /// The schema rules object that needs to updated. /// Schema updated. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutRulesAsync(string app, string schema, ConfigureFieldRulesDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/rules"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Schema request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Publish a schema. /// /// The name of the app. /// The name of the schema to publish. /// Schema published. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PublishSchemaAsync(string app, string schema, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/publish"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Unpublish a schema. /// /// The name of the app. /// The name of the schema to unpublish. /// Schema unpublished. /// A server side error occurred. public virtual async System.Threading.Tasks.Task UnpublishSchemaAsync(string app, string schema, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (schema == null) throw new System.ArgumentNullException("schema"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/schemas/{schema}/unpublish"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{schema}", System.Uri.EscapeDataString(ConvertToString(schema, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Schema or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } 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, System.Threading.CancellationToken cancellationToken) { 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 SquidexManagementException(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 SquidexManagementException(message, (int)response.StatusCode, string.Empty, headers, exception); } } } private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) { if (value == null) { return ""; } if (value is System.Enum) { var 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; } } var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); return converted == null ? string.Empty : converted; } } else if (value is bool) { return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } else if (value is byte[]) { return System.Convert.ToBase64String((byte[]) value); } else if (value.GetType().IsArray) { var array = System.Linq.Enumerable.OfType((System.Array) value); return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } var result = System.Convert.ToString(value, cultureInfo); return result == null ? "" : result; } } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial interface IRulesClient { /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get supported rule actions. /// /// Rule actions returned. /// A server side error occurred. System.Threading.Tasks.Task> GetActionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get rules. /// /// The name of the app. /// Rules returned. /// A server side error occurred. System.Threading.Tasks.Task GetRulesAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Create a new rule. /// /// The name of the app. /// The rule object that needs to be added to the app. /// Rule created. /// A server side error occurred. System.Threading.Tasks.Task PostRuleAsync(string app, CreateRuleDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Cancel the current run. /// /// The name of the app. /// Rule run cancelled. /// A server side error occurred. System.Threading.Tasks.Task DeleteRuleRunAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update a rule. /// /// The name of the app. /// The id of the rule to update. /// The rule object that needs to be added to the app. /// Rule updated. /// A server side error occurred. System.Threading.Tasks.Task PutRuleAsync(string app, string id, UpdateRuleDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Delete a rule. /// /// The name of the app. /// The id of the rule to delete. /// Rule deleted. /// A server side error occurred. System.Threading.Tasks.Task DeleteRuleAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Enable a rule. /// /// The name of the app. /// The id of the rule to enable. /// Rule enabled. /// A server side error occurred. System.Threading.Tasks.Task EnableRuleAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Disable a rule. /// /// The name of the app. /// The id of the rule to disable. /// Rule disabled. /// A server side error occurred. System.Threading.Tasks.Task DisableRuleAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Trigger a rule. /// /// The name of the app. /// The id of the rule to disable. /// Rule triggered. /// A server side error occurred. System.Threading.Tasks.Task TriggerRuleAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Run a rule. /// /// The name of the app. /// The id of the rule to run. /// Runs the rule from snapeshots if possible. /// Rule started. /// A server side error occurred. System.Threading.Tasks.Task PutRuleRunAsync(string app, string id, bool? fromSnapshots = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Cancels all rule events. /// /// The name of the app. /// The id of the rule to cancel. /// Rule events cancelled. /// A server side error occurred. System.Threading.Tasks.Task DeleteRuleEventsAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Simulate a rule. /// /// The name of the app. /// The rule to simulate. /// Rule simulated. /// A server side error occurred. System.Threading.Tasks.Task SimulatePOSTAsync(string app, CreateRuleDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Simulate a rule. /// /// The name of the app. /// The id of the rule to simulate. /// Rule simulated. /// A server side error occurred. System.Threading.Tasks.Task SimulateGETAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get rule events. /// /// The name of the app. /// The optional rule id to filter to events. /// The number of events to skip. /// The number of events to take. /// Rule events returned. /// A server side error occurred. System.Threading.Tasks.Task GetEventsAsync(string app, string ruleId = null, int? skip = null, int? take = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Cancels all events. /// /// The name of the app. /// Events cancelled. /// A server side error occurred. System.Threading.Tasks.Task DeleteEventsAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Retry the event immediately. /// /// The name of the app. /// The event to enqueue. /// Rule enqueued. /// A server side error occurred. System.Threading.Tasks.Task PutEventAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Cancels an event. /// /// The name of the app. /// The event to enqueue. /// Rule deqeued. /// A server side error occurred. System.Threading.Tasks.Task DeleteEventAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Provide a list of all event types that are used in rules. /// /// Rule events returned. /// A server side error occurred. System.Threading.Tasks.Task> GetEventTypesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Provide the json schema for the event with the specified name. /// /// The type name of the event. /// Rule event type found. /// A server side error occurred. System.Threading.Tasks.Task GetEventSchemaAsync(string type, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class RulesClient : IRulesClient { private System.Net.Http.HttpClient _httpClient; private System.Lazy _settings; public RulesClient(System.Net.Http.HttpClient httpClient) { _httpClient = httpClient; _settings = new System.Lazy(CreateSerializerSettings); } private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { var settings = new Newtonsoft.Json.JsonSerializerSettings(); UpdateJsonSerializerSettings(settings); return settings; } 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. /// /// Get supported rule actions. /// /// Rule actions returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task> GetActionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/rules/actions"); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get rules. /// /// The name of the app. /// Rules returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetRulesAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/rules"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Create a new rule. /// /// The name of the app. /// The rule object that needs to be added to the app. /// Rule created. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PostRuleAsync(string app, CreateRuleDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/rules"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _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); var disposeResponse_ = true; 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; if (status_ == 201) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Rule request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Cancel the current run. /// /// The name of the app. /// Rule run cancelled. /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteRuleRunAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/rules/run"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 204) { return; } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update a rule. /// /// The name of the app. /// The id of the rule to update. /// The rule object that needs to be added to the app. /// Rule updated. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutRuleAsync(string app, string id, UpdateRuleDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/rules/{id}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Rule request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Rule or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Delete a rule. /// /// The name of the app. /// The id of the rule to delete. /// Rule deleted. /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteRuleAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/rules/{id}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 204) { return; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Rule or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Enable a rule. /// /// The name of the app. /// The id of the rule to enable. /// Rule enabled. /// A server side error occurred. public virtual async System.Threading.Tasks.Task EnableRuleAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/rules/{id}/enable"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Rule or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Disable a rule. /// /// The name of the app. /// The id of the rule to disable. /// Rule disabled. /// A server side error occurred. public virtual async System.Threading.Tasks.Task DisableRuleAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/rules/{id}/disable"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Rule or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Trigger a rule. /// /// The name of the app. /// The id of the rule to disable. /// Rule triggered. /// A server side error occurred. public virtual async System.Threading.Tasks.Task TriggerRuleAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/rules/{id}/trigger"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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"); 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); var disposeResponse_ = true; 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; if (status_ == 204) { return; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Rule or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Run a rule. /// /// The name of the app. /// The id of the rule to run. /// Runs the rule from snapeshots if possible. /// Rule started. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutRuleRunAsync(string app, string id, bool? fromSnapshots = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/rules/{id}/run?"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); if (fromSnapshots != null) { urlBuilder_.Append(System.Uri.EscapeDataString("fromSnapshots") + "=").Append(System.Uri.EscapeDataString(ConvertToString(fromSnapshots, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; var disposeClient_ = false; 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"); 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); var disposeResponse_ = true; 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; if (status_ == 204) { return; } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Cancels all rule events. /// /// The name of the app. /// The id of the rule to cancel. /// Rule events cancelled. /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteRuleEventsAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/rules/{id}/events"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 204) { return; } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Simulate a rule. /// /// The name of the app. /// The rule to simulate. /// Rule simulated. /// A server side error occurred. public virtual async System.Threading.Tasks.Task SimulatePOSTAsync(string app, CreateRuleDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/rules/simulate"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Rule or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Simulate a rule. /// /// The name of the app. /// The id of the rule to simulate. /// Rule simulated. /// A server side error occurred. public virtual async System.Threading.Tasks.Task SimulateGETAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/rules/{id}/simulate"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Rule or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get rule events. /// /// The name of the app. /// The optional rule id to filter to events. /// The number of events to skip. /// The number of events to take. /// Rule events returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetEventsAsync(string app, string ruleId = null, int? skip = null, int? take = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/rules/events?"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); if (ruleId != null) { urlBuilder_.Append(System.Uri.EscapeDataString("ruleId") + "=").Append(System.Uri.EscapeDataString(ConvertToString(ruleId, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (skip != null) { urlBuilder_.Append(System.Uri.EscapeDataString("skip") + "=").Append(System.Uri.EscapeDataString(ConvertToString(skip, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (take != null) { urlBuilder_.Append(System.Uri.EscapeDataString("take") + "=").Append(System.Uri.EscapeDataString(ConvertToString(take, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Cancels all events. /// /// The name of the app. /// Events cancelled. /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteEventsAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/rules/events"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 204) { return; } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Retry the event immediately. /// /// The name of the app. /// The event to enqueue. /// Rule enqueued. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutEventAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/rules/events/{id}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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"); 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); var disposeResponse_ = true; 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; if (status_ == 204) { return; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App or rule event not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Cancels an event. /// /// The name of the app. /// The event to enqueue. /// Rule deqeued. /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteEventAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/rules/events/{id}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 204) { return; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App or rule event not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Provide a list of all event types that are used in rules. /// /// Rule events returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task> GetEventTypesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/rules/eventtypes"); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Provide the json schema for the event with the specified name. /// /// The type name of the event. /// Rule event type found. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetEventSchemaAsync(string type, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (type == null) throw new System.ArgumentNullException("type"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/rules/eventtypes/{type}"); urlBuilder_.Replace("{type}", System.Uri.EscapeDataString(ConvertToString(type, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Rule event not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } 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, System.Threading.CancellationToken cancellationToken) { 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 SquidexManagementException(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 SquidexManagementException(message, (int)response.StatusCode, string.Empty, headers, exception); } } } private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) { if (value == null) { return ""; } if (value is System.Enum) { var 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; } } var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); return converted == null ? string.Empty : converted; } } else if (value is bool) { return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } else if (value is byte[]) { return System.Convert.ToBase64String((byte[]) value); } else if (value.GetType().IsArray) { var array = System.Linq.Enumerable.OfType((System.Array) value); return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } var result = System.Convert.ToString(value, cultureInfo); return result == null ? "" : result; } } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial interface IPlansClient { /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get app plan information. /// /// The name of the app. /// App plan information returned. /// A server side error occurred. System.Threading.Tasks.Task GetPlansAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Change the app plan. /// /// The name of the app. /// Plan object that needs to be changed. /// Plan changed or redirect url returned. /// A server side error occurred. System.Threading.Tasks.Task PutPlanAsync(string app, ChangePlanDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class PlansClient : IPlansClient { private System.Net.Http.HttpClient _httpClient; private System.Lazy _settings; public PlansClient(System.Net.Http.HttpClient httpClient) { _httpClient = httpClient; _settings = new System.Lazy(CreateSerializerSettings); } private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { var settings = new Newtonsoft.Json.JsonSerializerSettings(); UpdateJsonSerializerSettings(settings); return settings; } 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. /// /// Get app plan information. /// /// The name of the app. /// App plan information returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetPlansAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/plans"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Change the app plan. /// /// The name of the app. /// Plan object that needs to be changed. /// Plan changed or redirect url returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutPlanAsync(string app, ChangePlanDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/plan"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Plan not owned by user.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } 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, System.Threading.CancellationToken cancellationToken) { 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 SquidexManagementException(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 SquidexManagementException(message, (int)response.StatusCode, string.Empty, headers, exception); } } } private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) { if (value == null) { return ""; } if (value is System.Enum) { var 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; } } var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); return converted == null ? string.Empty : converted; } } else if (value is bool) { return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } else if (value is byte[]) { return System.Convert.ToBase64String((byte[]) value); } else if (value.GetType().IsArray) { var array = System.Linq.Enumerable.OfType((System.Array) value); return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } var result = System.Convert.ToString(value, cultureInfo); return result == null ? "" : result; } } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial interface IPingClient { /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get API information. /// /// Infos returned. /// A server side error occurred. System.Threading.Tasks.Task> GetInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get ping status of the API. /// /// Service ping successful. /// A server side error occurred. System.Threading.Tasks.Task GetPingAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get ping status. /// /// The name of the app. /// Service ping successful. /// A server side error occurred. System.Threading.Tasks.Task GetAppPingAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class PingClient : IPingClient { private System.Net.Http.HttpClient _httpClient; private System.Lazy _settings; public PingClient(System.Net.Http.HttpClient httpClient) { _httpClient = httpClient; _settings = new System.Lazy(CreateSerializerSettings); } private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { var settings = new Newtonsoft.Json.JsonSerializerSettings(); UpdateJsonSerializerSettings(settings); return settings; } 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. /// /// Get API information. /// /// Infos returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task> GetInfoAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/info"); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get ping status of the API. /// /// Service ping successful. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetPingAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/ping"); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { request_.Method = new System.Net.Http.HttpMethod("GET"); 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); var disposeResponse_ = true; 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; if (status_ == 204) { return; } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get ping status. /// /// The name of the app. /// Service ping successful. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetAppPingAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/ping/{app}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { request_.Method = new System.Net.Http.HttpMethod("GET"); 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); var disposeResponse_ = true; 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; if (status_ == 204) { return; } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } 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, System.Threading.CancellationToken cancellationToken) { 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 SquidexManagementException(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 SquidexManagementException(message, (int)response.StatusCode, string.Empty, headers, exception); } } } private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) { if (value == null) { return ""; } if (value is System.Enum) { var 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; } } var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); return converted == null ? string.Empty : converted; } } else if (value is bool) { return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } else if (value is byte[]) { return System.Convert.ToBase64String((byte[]) value); } else if (value.GetType().IsArray) { var array = System.Linq.Enumerable.OfType((System.Array) value); return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } var result = System.Convert.ToString(value, cultureInfo); return result == null ? "" : result; } } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial interface INewsClient { /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get features since version. /// /// The latest received version. /// Latest features returned. /// A server side error occurred. System.Threading.Tasks.Task GetNewsAsync(int? version = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class NewsClient : INewsClient { private System.Net.Http.HttpClient _httpClient; private System.Lazy _settings; public NewsClient(System.Net.Http.HttpClient httpClient) { _httpClient = httpClient; _settings = new System.Lazy(CreateSerializerSettings); } private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { var settings = new Newtonsoft.Json.JsonSerializerSettings(); UpdateJsonSerializerSettings(settings); return settings; } 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. /// /// Get features since version. /// /// The latest received version. /// Latest features returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetNewsAsync(int? version = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/news/features?"); if (version != null) { urlBuilder_.Append(System.Uri.EscapeDataString("version") + "=").Append(System.Uri.EscapeDataString(ConvertToString(version, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } 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, System.Threading.CancellationToken cancellationToken) { 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 SquidexManagementException(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 SquidexManagementException(message, (int)response.StatusCode, string.Empty, headers, exception); } } } private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) { if (value == null) { return ""; } if (value is System.Enum) { var 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; } } var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); return converted == null ? string.Empty : converted; } } else if (value is bool) { return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } else if (value is byte[]) { return System.Convert.ToBase64String((byte[]) value); } else if (value.GetType().IsArray) { var array = System.Linq.Enumerable.OfType((System.Array) value); return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } var result = System.Convert.ToString(value, cultureInfo); return result == null ? "" : result; } } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial interface ILanguagesClient { /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get supported languages. /// /// Supported language codes returned. /// A server side error occurred. System.Threading.Tasks.Task> GetLanguagesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class LanguagesClient : ILanguagesClient { private System.Net.Http.HttpClient _httpClient; private System.Lazy _settings; public LanguagesClient(System.Net.Http.HttpClient httpClient) { _httpClient = httpClient; _settings = new System.Lazy(CreateSerializerSettings); } private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { var settings = new Newtonsoft.Json.JsonSerializerSettings(); UpdateJsonSerializerSettings(settings); return settings; } 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. /// /// Get supported languages. /// /// Supported language codes returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task> GetLanguagesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/languages"); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } 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, System.Threading.CancellationToken cancellationToken) { 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 SquidexManagementException(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 SquidexManagementException(message, (int)response.StatusCode, string.Empty, headers, exception); } } } private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) { if (value == null) { return ""; } if (value is System.Enum) { var 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; } } var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); return converted == null ? string.Empty : converted; } } else if (value is bool) { return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } else if (value is byte[]) { return System.Convert.ToBase64String((byte[]) value); } else if (value.GetType().IsArray) { var array = System.Linq.Enumerable.OfType((System.Array) value); return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } var result = System.Convert.ToString(value, cultureInfo); return result == null ? "" : result; } } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial interface IHistoryClient { /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get historical events. /// /// The name of the app. /// The name of the channel. /// Events returned. /// A server side error occurred. System.Threading.Tasks.Task GetHistoryAsync(string app, string channel = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class HistoryClient : IHistoryClient { private System.Net.Http.HttpClient _httpClient; private System.Lazy _settings; public HistoryClient(System.Net.Http.HttpClient httpClient) { _httpClient = httpClient; _settings = new System.Lazy(CreateSerializerSettings); } private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { var settings = new Newtonsoft.Json.JsonSerializerSettings(); UpdateJsonSerializerSettings(settings); return settings; } 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. /// /// Get historical events. /// /// The name of the app. /// The name of the channel. /// Events returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetHistoryAsync(string app, string channel = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/history?"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); if (channel != null) { urlBuilder_.Append(System.Uri.EscapeDataString("channel") + "=").Append(System.Uri.EscapeDataString(ConvertToString(channel, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } 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, System.Threading.CancellationToken cancellationToken) { 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 SquidexManagementException(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 SquidexManagementException(message, (int)response.StatusCode, string.Empty, headers, exception); } } } private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) { if (value == null) { return ""; } if (value is System.Enum) { var 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; } } var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); return converted == null ? string.Empty : converted; } } else if (value is bool) { return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } else if (value is byte[]) { return System.Convert.ToBase64String((byte[]) value); } else if (value.GetType().IsArray) { var array = System.Linq.Enumerable.OfType((System.Array) value); return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } var result = System.Convert.ToString(value, cultureInfo); return result == null ? "" : result; } } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial interface ICommentsClient { /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get all watching users.. /// /// The name of the app. /// The path to the resource. /// Watching users returned. /// A server side error occurred. System.Threading.Tasks.Task> GetWatchingUsersAsync(string app, string resource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get all comments. /// /// The name of the app. /// The id of the comments. /// The current version. /// Comments returned. /// A server side error occurred. System.Threading.Tasks.Task GetCommentsAsync(string app, string commentsId, long? version = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Create a new comment. /// /// The name of the app. /// The id of the comments. /// The comment object that needs to created. /// Comment created. /// A server side error occurred. System.Threading.Tasks.Task PostCommentAsync(string app, string commentsId, UpsertCommentDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update a comment. /// /// The name of the app. /// The id of the comments. /// The id of the comment. /// The comment object that needs to updated. /// Comment updated. /// A server side error occurred. System.Threading.Tasks.Task PutCommentAsync(string app, string commentsId, string commentId, UpsertCommentDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Delete a comment. /// /// The name of the app. /// The id of the comments. /// The id of the comment. /// Comment deleted. /// A server side error occurred. System.Threading.Tasks.Task DeleteCommentAsync(string app, string commentsId, string commentId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class CommentsClient : ICommentsClient { private System.Net.Http.HttpClient _httpClient; private System.Lazy _settings; public CommentsClient(System.Net.Http.HttpClient httpClient) { _httpClient = httpClient; _settings = new System.Lazy(CreateSerializerSettings); } private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { var settings = new Newtonsoft.Json.JsonSerializerSettings(); UpdateJsonSerializerSettings(settings); return settings; } 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. /// /// Get all watching users.. /// /// The name of the app. /// The path to the resource. /// Watching users returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task> GetWatchingUsersAsync(string app, string resource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (resource == null) throw new System.ArgumentNullException("resource"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/watching/{resource}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{resource}", System.Uri.EscapeDataString(ConvertToString(resource, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get all comments. /// /// The name of the app. /// The id of the comments. /// The current version. /// Comments returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetCommentsAsync(string app, string commentsId, long? version = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (commentsId == null) throw new System.ArgumentNullException("commentsId"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/comments/{commentsId}?"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{commentsId}", System.Uri.EscapeDataString(ConvertToString(commentsId, System.Globalization.CultureInfo.InvariantCulture))); if (version != null) { urlBuilder_.Append(System.Uri.EscapeDataString("version") + "=").Append(System.Uri.EscapeDataString(ConvertToString(version, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Create a new comment. /// /// The name of the app. /// The id of the comments. /// The comment object that needs to created. /// Comment created. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PostCommentAsync(string app, string commentsId, UpsertCommentDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (commentsId == null) throw new System.ArgumentNullException("commentsId"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/comments/{commentsId}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{commentsId}", System.Uri.EscapeDataString(ConvertToString(commentsId, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _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); var disposeResponse_ = true; 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; if (status_ == 201) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Comment request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update a comment. /// /// The name of the app. /// The id of the comments. /// The id of the comment. /// The comment object that needs to updated. /// Comment updated. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutCommentAsync(string app, string commentsId, string commentId, UpsertCommentDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (commentsId == null) throw new System.ArgumentNullException("commentsId"); if (commentId == null) throw new System.ArgumentNullException("commentId"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/comments/{commentsId}/{commentId}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{commentsId}", System.Uri.EscapeDataString(ConvertToString(commentsId, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{commentId}", System.Uri.EscapeDataString(ConvertToString(commentId, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; request_.Method = new System.Net.Http.HttpMethod("PUT"); 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); var disposeResponse_ = true; 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; if (status_ == 204) { return; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Comment request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Comment or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Delete a comment. /// /// The name of the app. /// The id of the comments. /// The id of the comment. /// Comment deleted. /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteCommentAsync(string app, string commentsId, string commentId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (commentsId == null) throw new System.ArgumentNullException("commentsId"); if (commentId == null) throw new System.ArgumentNullException("commentId"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/comments/{commentsId}/{commentId}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{commentsId}", System.Uri.EscapeDataString(ConvertToString(commentsId, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{commentId}", System.Uri.EscapeDataString(ConvertToString(commentId, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 204) { return; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Comment or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } 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, System.Threading.CancellationToken cancellationToken) { 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 SquidexManagementException(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 SquidexManagementException(message, (int)response.StatusCode, string.Empty, headers, exception); } } } private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) { if (value == null) { return ""; } if (value is System.Enum) { var 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; } } var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); return converted == null ? string.Empty : converted; } } else if (value is bool) { return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } else if (value is byte[]) { return System.Convert.ToBase64String((byte[]) value); } else if (value.GetType().IsArray) { var array = System.Linq.Enumerable.OfType((System.Array) value); return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } var result = System.Convert.ToString(value, cultureInfo); return result == null ? "" : result; } } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial interface INotificationsClient { /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get all notifications. /// /// The user id. /// The current version. /// All comments returned. /// A server side error occurred. System.Threading.Tasks.Task GetNotificationsAsync(string userId, long? version = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Delete a notification. /// /// The user id. /// The id of the comment. /// Comment deleted. /// A server side error occurred. System.Threading.Tasks.Task DeleteCommentAsync(string userId, string commentId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class NotificationsClient : INotificationsClient { private System.Net.Http.HttpClient _httpClient; private System.Lazy _settings; public NotificationsClient(System.Net.Http.HttpClient httpClient) { _httpClient = httpClient; _settings = new System.Lazy(CreateSerializerSettings); } private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { var settings = new Newtonsoft.Json.JsonSerializerSettings(); UpdateJsonSerializerSettings(settings); return settings; } 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. /// /// Get all notifications. /// /// The user id. /// The current version. /// All comments returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetNotificationsAsync(string userId, long? version = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (userId == null) throw new System.ArgumentNullException("userId"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/users/{userId}/notifications?"); urlBuilder_.Replace("{userId}", System.Uri.EscapeDataString(ConvertToString(userId, System.Globalization.CultureInfo.InvariantCulture))); if (version != null) { urlBuilder_.Append(System.Uri.EscapeDataString("version") + "=").Append(System.Uri.EscapeDataString(ConvertToString(version, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Delete a notification. /// /// The user id. /// The id of the comment. /// Comment deleted. /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteCommentAsync(string userId, string commentId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (userId == null) throw new System.ArgumentNullException("userId"); if (commentId == null) throw new System.ArgumentNullException("commentId"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/users/{userId}/notifications/{commentId}"); urlBuilder_.Replace("{userId}", System.Uri.EscapeDataString(ConvertToString(userId, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{commentId}", System.Uri.EscapeDataString(ConvertToString(commentId, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 204) { return; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Comment not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } 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, System.Threading.CancellationToken cancellationToken) { 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 SquidexManagementException(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 SquidexManagementException(message, (int)response.StatusCode, string.Empty, headers, exception); } } } private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) { if (value == null) { return ""; } if (value is System.Enum) { var 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; } } var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); return converted == null ? string.Empty : converted; } } else if (value is bool) { return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } else if (value is byte[]) { return System.Convert.ToBase64String((byte[]) value); } else if (value.GetType().IsArray) { var array = System.Linq.Enumerable.OfType((System.Array) value); return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } var result = System.Convert.ToString(value, cultureInfo); return result == null ? "" : result; } } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial interface IBackupsClient { /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get the backup content. /// /// The name of the app. /// The id of the asset. /// Backup found and content returned. /// A server side error occurred. System.Threading.Tasks.Task GetBackupContentAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Delete a backup. /// /// The name of the app. /// The id of the backup to delete. /// Backup deleted. /// A server side error occurred. System.Threading.Tasks.Task DeleteBackupAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get all backup jobs. /// /// The name of the app. /// Backups returned. /// A server side error occurred. System.Threading.Tasks.Task GetBackupsAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Start a new backup. /// /// The name of the app. /// Backup started. /// A server side error occurred. System.Threading.Tasks.Task PostBackupAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get current restore status. /// /// Status returned. /// A server side error occurred. System.Threading.Tasks.Task GetRestoreJobAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Restore a backup. /// /// The backup to restore. /// Restore operation started. /// A server side error occurred. System.Threading.Tasks.Task PostRestoreJobAsync(RestoreRequestDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class BackupsClient : IBackupsClient { private System.Net.Http.HttpClient _httpClient; private System.Lazy _settings; public BackupsClient(System.Net.Http.HttpClient httpClient) { _httpClient = httpClient; _settings = new System.Lazy(CreateSerializerSettings); } private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { var settings = new Newtonsoft.Json.JsonSerializerSettings(); UpdateJsonSerializerSettings(settings); return settings; } 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. /// /// Get the backup content. /// /// The name of the app. /// The id of the asset. /// Backup found and content returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetBackupContentAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/backups/{id}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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/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); var disposeResponse_ = true; 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; if (status_ == 200 || status_ == 206) { var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false); var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_); disposeClient_ = false; disposeResponse_ = false; // response and client are disposed by FileResponse return fileResponse_; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Backup or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Delete a backup. /// /// The name of the app. /// The id of the backup to delete. /// Backup deleted. /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteBackupAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/backups/{id}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 204) { return; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Backup or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get all backup jobs. /// /// The name of the app. /// Backups returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetBackupsAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/backups"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Start a new backup. /// /// The name of the app. /// Backup started. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PostBackupAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/backups"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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("POST"); 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); var disposeResponse_ = true; 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; if (status_ == 204) { return; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Backup contingent reached.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get current restore status. /// /// Status returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetRestoreJobAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/restore"); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Restore a backup. /// /// The backup to restore. /// Restore operation started. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PostRestoreJobAsync(RestoreRequestDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/restore"); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; request_.Method = new System.Net.Http.HttpMethod("POST"); 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); var disposeResponse_ = true; 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; if (status_ == 204) { return; } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } 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, System.Threading.CancellationToken cancellationToken) { 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 SquidexManagementException(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 SquidexManagementException(message, (int)response.StatusCode, string.Empty, headers, exception); } } } private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) { if (value == null) { return ""; } if (value is System.Enum) { var 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; } } var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); return converted == null ? string.Empty : converted; } } else if (value is bool) { return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } else if (value is byte[]) { return System.Convert.ToBase64String((byte[]) value); } else if (value.GetType().IsArray) { var array = System.Linq.Enumerable.OfType((System.Array) value); return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } var result = System.Convert.ToString(value, cultureInfo); return result == null ? "" : result; } } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial interface IAssetsClient { /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get the asset content. /// /// The name of the app. /// The id or slug of the asset. /// Optional suffix that can be used to seo-optimize the link to the image Has not effect. /// The optional version of the asset. /// The cache duration in seconds. /// Set it to 0 to prevent download. /// The target width of the asset, if it is an image. /// The target height of the asset, if it is an image. /// Optional image quality, it is is an jpeg image. /// The resize mode when the width and height is defined. /// Optional background color. /// Override the y focus point. /// Override the x focus point. /// True to ignore the asset focus point if any. /// True to force a new resize even if it already stored. /// True to force a new resize even if it already stored. /// Asset found and content or (resized) image returned. /// A server side error occurred. System.Threading.Tasks.Task GetAssetContentBySlugAsync(string app, string idOrSlug, string more, long? version = null, long? cache = null, int? download = null, int? width = null, int? height = null, int? quality = null, ResizeMode? mode = null, string bg = null, float? focusX = null, float? focusY = null, bool? nofocus = null, bool? force = null, ImageFormat? format = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get the asset content. /// /// The id of the asset. /// The optional version of the asset. /// The cache duration in seconds. /// Set it to 0 to prevent download. /// The target width of the asset, if it is an image. /// The target height of the asset, if it is an image. /// Optional image quality, it is is an jpeg image. /// The resize mode when the width and height is defined. /// Optional background color. /// Override the y focus point. /// Override the x focus point. /// True to ignore the asset focus point if any. /// True to force a new resize even if it already stored. /// True to force a new resize even if it already stored. /// Asset found and content or (resized) image returned. /// A server side error occurred. [System.Obsolete] System.Threading.Tasks.Task GetAssetContentAsync(string id, long? version = null, long? cache = null, int? download = null, int? width = null, int? height = null, int? quality = null, ResizeMode? mode = null, string bg = null, float? focusX = null, float? focusY = null, bool? nofocus = null, bool? force = null, ImageFormat? format = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get asset folders. /// /// The name of the app. /// The optional parent folder id. /// The scope of the query. /// Asset folders returned. /// A server side error occurred. System.Threading.Tasks.Task GetAssetFoldersAsync(string app, string parentId = null, AssetFolderScope? scope = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Create an asset folder. /// /// The name of the app. /// The asset folder object that needs to be added to the App. /// Asset folder created. /// A server side error occurred. System.Threading.Tasks.Task PostAssetFolderAsync(string app, CreateAssetFolderDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update an asset folder. /// /// The name of the app. /// The id of the asset folder. /// The asset folder object that needs to updated. /// Asset folder updated. /// A server side error occurred. System.Threading.Tasks.Task PutAssetFolderAsync(string app, string id, RenameAssetFolderDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Delete an asset folder. /// /// The name of the app. /// The id of the asset folder to delete. /// Asset folder deleted. /// A server side error occurred. System.Threading.Tasks.Task DeleteAssetFolderAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Move an asset folder. /// /// The name of the app. /// The id of the asset folder. /// The asset folder object that needs to updated. /// Asset folder moved. /// A server side error occurred. System.Threading.Tasks.Task PutAssetFolderParentAsync(string app, string id, MoveAssetFolderDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get assets tags. /// /// The name of the app. /// Assets tags returned. /// A server side error occurred. System.Threading.Tasks.Task> GetTagsAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Rename an asset tag. /// /// The name of the app. /// The tag to return. /// The required request object. /// Asset tag renamed and new tags returned. /// A server side error occurred. System.Threading.Tasks.Task> PutTagAsync(string app, string name, RenameTagDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get assets. /// /// The name of the app. /// Optional number of contents to take. /// Optional number of contents to skip. /// Optional OData order definition. /// Optional OData filter. /// The optional parent folder id. /// The optional asset ids. /// The optional json query. /// Assets returned. /// A server side error occurred. System.Threading.Tasks.Task GetAssetsAsync(string app, double? top = null, double? skip = null, string orderby = null, string filter = null, string parentId = null, string ids = null, string q = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Upload a new asset. /// /// The name of the app. /// The optional parent folder id. /// The optional custom asset id. /// True to duplicate the asset, event if the file has been uploaded. /// Asset created. /// A server side error occurred. System.Threading.Tasks.Task PostAssetAsync(string app, string parentId = null, string id = null, bool? duplicate = null, FileParameter file = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get assets. /// /// The name of the app. /// The required query object. /// Assets returned. /// A server side error occurred. System.Threading.Tasks.Task GetAssetsPostAsync(string app, QueryDto query, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get an asset by id. /// /// The name of the app. /// The id of the asset to retrieve. /// Asset found. /// A server side error occurred. System.Threading.Tasks.Task GetAssetAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Upsert an asset. /// /// The name of the app. /// The optional custom asset id. /// The optional parent folder id. /// True to duplicate the asset, event if the file has been uploaded. /// Asset created or updated. /// A server side error occurred. System.Threading.Tasks.Task PostUpsertAssetAsync(string app, string id, string parentId = null, bool? duplicate = null, FileParameter file = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update an asset. /// /// The name of the app. /// The id of the asset. /// The asset object that needs to updated. /// Asset updated. /// A server side error occurred. System.Threading.Tasks.Task PutAssetAsync(string app, string id, AnnotateAssetDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Delete an asset. /// /// The name of the app. /// The id of the asset to delete. /// True to check referrers of this asset. /// True to delete the asset permanently. /// Asset deleted. /// A server side error occurred. System.Threading.Tasks.Task DeleteAssetAsync(string app, string id, bool? checkReferrers = null, bool? permanent = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Bulk update assets. /// /// The name of the app. /// The bulk update request. /// Assets created, update or delete. /// A server side error occurred. System.Threading.Tasks.Task> BulkUpdateAssetsAsync(string app, BulkUpdateAssetsDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Replace asset content. /// /// The name of the app. /// The id of the asset. /// Asset updated. /// A server side error occurred. System.Threading.Tasks.Task PutAssetContentAsync(string app, string id, FileParameter file = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Moves the asset. /// /// The name of the app. /// The id of the asset. /// The asset object that needs to updated. /// Asset moved. /// A server side error occurred. System.Threading.Tasks.Task PutAssetParentAsync(string app, string id, MoveAssetDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class AssetsClient : IAssetsClient { private System.Net.Http.HttpClient _httpClient; private System.Lazy _settings; public AssetsClient(System.Net.Http.HttpClient httpClient) { _httpClient = httpClient; _settings = new System.Lazy(CreateSerializerSettings); } private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { var settings = new Newtonsoft.Json.JsonSerializerSettings(); UpdateJsonSerializerSettings(settings); return settings; } 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. /// /// Get the asset content. /// /// The name of the app. /// The id or slug of the asset. /// Optional suffix that can be used to seo-optimize the link to the image Has not effect. /// The optional version of the asset. /// The cache duration in seconds. /// Set it to 0 to prevent download. /// The target width of the asset, if it is an image. /// The target height of the asset, if it is an image. /// Optional image quality, it is is an jpeg image. /// The resize mode when the width and height is defined. /// Optional background color. /// Override the y focus point. /// Override the x focus point. /// True to ignore the asset focus point if any. /// True to force a new resize even if it already stored. /// True to force a new resize even if it already stored. /// Asset found and content or (resized) image returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetAssetContentBySlugAsync(string app, string idOrSlug, string more, long? version = null, long? cache = null, int? download = null, int? width = null, int? height = null, int? quality = null, ResizeMode? mode = null, string bg = null, float? focusX = null, float? focusY = null, bool? nofocus = null, bool? force = null, ImageFormat? format = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (idOrSlug == null) throw new System.ArgumentNullException("idOrSlug"); if (more == null) throw new System.ArgumentNullException("more"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/assets/{app}/{idOrSlug}/{more}?"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{idOrSlug}", System.Uri.EscapeDataString(ConvertToString(idOrSlug, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{more}", System.Uri.EscapeDataString(ConvertToString(more, System.Globalization.CultureInfo.InvariantCulture))); if (version != null) { urlBuilder_.Append(System.Uri.EscapeDataString("version") + "=").Append(System.Uri.EscapeDataString(ConvertToString(version, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (cache != null) { urlBuilder_.Append(System.Uri.EscapeDataString("cache") + "=").Append(System.Uri.EscapeDataString(ConvertToString(cache, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (download != null) { urlBuilder_.Append(System.Uri.EscapeDataString("download") + "=").Append(System.Uri.EscapeDataString(ConvertToString(download, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (width != null) { urlBuilder_.Append(System.Uri.EscapeDataString("width") + "=").Append(System.Uri.EscapeDataString(ConvertToString(width, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (height != null) { urlBuilder_.Append(System.Uri.EscapeDataString("height") + "=").Append(System.Uri.EscapeDataString(ConvertToString(height, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (quality != null) { urlBuilder_.Append(System.Uri.EscapeDataString("quality") + "=").Append(System.Uri.EscapeDataString(ConvertToString(quality, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (mode != null) { urlBuilder_.Append(System.Uri.EscapeDataString("mode") + "=").Append(System.Uri.EscapeDataString(ConvertToString(mode, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (bg != null) { urlBuilder_.Append(System.Uri.EscapeDataString("bg") + "=").Append(System.Uri.EscapeDataString(ConvertToString(bg, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (focusX != null) { urlBuilder_.Append(System.Uri.EscapeDataString("focusX") + "=").Append(System.Uri.EscapeDataString(ConvertToString(focusX, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (focusY != null) { urlBuilder_.Append(System.Uri.EscapeDataString("focusY") + "=").Append(System.Uri.EscapeDataString(ConvertToString(focusY, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (nofocus != null) { urlBuilder_.Append(System.Uri.EscapeDataString("nofocus") + "=").Append(System.Uri.EscapeDataString(ConvertToString(nofocus, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (force != null) { urlBuilder_.Append(System.Uri.EscapeDataString("force") + "=").Append(System.Uri.EscapeDataString(ConvertToString(force, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (format != null) { urlBuilder_.Append(System.Uri.EscapeDataString("format") + "=").Append(System.Uri.EscapeDataString(ConvertToString(format, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; var disposeClient_ = false; 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/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); var disposeResponse_ = true; 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; if (status_ == 200 || status_ == 206) { var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false); var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_); disposeClient_ = false; disposeResponse_ = false; // response and client are disposed by FileResponse return fileResponse_; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Asset or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get the asset content. /// /// The id of the asset. /// The optional version of the asset. /// The cache duration in seconds. /// Set it to 0 to prevent download. /// The target width of the asset, if it is an image. /// The target height of the asset, if it is an image. /// Optional image quality, it is is an jpeg image. /// The resize mode when the width and height is defined. /// Optional background color. /// Override the y focus point. /// Override the x focus point. /// True to ignore the asset focus point if any. /// True to force a new resize even if it already stored. /// True to force a new resize even if it already stored. /// Asset found and content or (resized) image returned. /// A server side error occurred. [System.Obsolete] public virtual async System.Threading.Tasks.Task GetAssetContentAsync(string id, long? version = null, long? cache = null, int? download = null, int? width = null, int? height = null, int? quality = null, ResizeMode? mode = null, string bg = null, float? focusX = null, float? focusY = null, bool? nofocus = null, bool? force = null, ImageFormat? format = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/assets/{id}?"); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); if (version != null) { urlBuilder_.Append(System.Uri.EscapeDataString("version") + "=").Append(System.Uri.EscapeDataString(ConvertToString(version, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (cache != null) { urlBuilder_.Append(System.Uri.EscapeDataString("cache") + "=").Append(System.Uri.EscapeDataString(ConvertToString(cache, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (download != null) { urlBuilder_.Append(System.Uri.EscapeDataString("download") + "=").Append(System.Uri.EscapeDataString(ConvertToString(download, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (width != null) { urlBuilder_.Append(System.Uri.EscapeDataString("width") + "=").Append(System.Uri.EscapeDataString(ConvertToString(width, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (height != null) { urlBuilder_.Append(System.Uri.EscapeDataString("height") + "=").Append(System.Uri.EscapeDataString(ConvertToString(height, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (quality != null) { urlBuilder_.Append(System.Uri.EscapeDataString("quality") + "=").Append(System.Uri.EscapeDataString(ConvertToString(quality, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (mode != null) { urlBuilder_.Append(System.Uri.EscapeDataString("mode") + "=").Append(System.Uri.EscapeDataString(ConvertToString(mode, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (bg != null) { urlBuilder_.Append(System.Uri.EscapeDataString("bg") + "=").Append(System.Uri.EscapeDataString(ConvertToString(bg, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (focusX != null) { urlBuilder_.Append(System.Uri.EscapeDataString("focusX") + "=").Append(System.Uri.EscapeDataString(ConvertToString(focusX, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (focusY != null) { urlBuilder_.Append(System.Uri.EscapeDataString("focusY") + "=").Append(System.Uri.EscapeDataString(ConvertToString(focusY, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (nofocus != null) { urlBuilder_.Append(System.Uri.EscapeDataString("nofocus") + "=").Append(System.Uri.EscapeDataString(ConvertToString(nofocus, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (force != null) { urlBuilder_.Append(System.Uri.EscapeDataString("force") + "=").Append(System.Uri.EscapeDataString(ConvertToString(force, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (format != null) { urlBuilder_.Append(System.Uri.EscapeDataString("format") + "=").Append(System.Uri.EscapeDataString(ConvertToString(format, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; var disposeClient_ = false; 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/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); var disposeResponse_ = true; 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; if (status_ == 200 || status_ == 206) { var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false); var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_); disposeClient_ = false; disposeResponse_ = false; // response and client are disposed by FileResponse return fileResponse_; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Asset or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get asset folders. /// /// The name of the app. /// The optional parent folder id. /// The scope of the query. /// Asset folders returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetAssetFoldersAsync(string app, string parentId = null, AssetFolderScope? scope = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/assets/folders?"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); if (parentId != null) { urlBuilder_.Append(System.Uri.EscapeDataString("parentId") + "=").Append(System.Uri.EscapeDataString(ConvertToString(parentId, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (scope != null) { urlBuilder_.Append(System.Uri.EscapeDataString("scope") + "=").Append(System.Uri.EscapeDataString(ConvertToString(scope, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Create an asset folder. /// /// The name of the app. /// The asset folder object that needs to be added to the App. /// Asset folder created. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PostAssetFolderAsync(string app, CreateAssetFolderDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/assets/folders"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _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); var disposeResponse_ = true; 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; if (status_ == 201) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Asset folder request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update an asset folder. /// /// The name of the app. /// The id of the asset folder. /// The asset folder object that needs to updated. /// Asset folder updated. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutAssetFolderAsync(string app, string id, RenameAssetFolderDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/assets/folders/{id}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Asset folder request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Asset folder or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Delete an asset folder. /// /// The name of the app. /// The id of the asset folder to delete. /// Asset folder deleted. /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteAssetFolderAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/assets/folders/{id}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 204) { return; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Asset folder or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Move an asset folder. /// /// The name of the app. /// The id of the asset folder. /// The asset folder object that needs to updated. /// Asset folder moved. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutAssetFolderParentAsync(string app, string id, MoveAssetFolderDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/assets/folders/{id}/parent"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Asset folder request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Asset folder or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get assets tags. /// /// The name of the app. /// Assets tags returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task> GetTagsAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/assets/tags"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Rename an asset tag. /// /// The name of the app. /// The tag to return. /// The required request object. /// Asset tag renamed and new tags returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task> PutTagAsync(string app, string name, RenameTagDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (name == null) throw new System.ArgumentNullException("name"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/assets/tags/{name}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{name}", System.Uri.EscapeDataString(ConvertToString(name, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get assets. /// /// The name of the app. /// Optional number of contents to take. /// Optional number of contents to skip. /// Optional OData order definition. /// Optional OData filter. /// The optional parent folder id. /// The optional asset ids. /// The optional json query. /// Assets returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetAssetsAsync(string app, double? top = null, double? skip = null, string orderby = null, string filter = null, string parentId = null, string ids = null, string q = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/assets?"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); if (top != null) { urlBuilder_.Append(System.Uri.EscapeDataString("$top") + "=").Append(System.Uri.EscapeDataString(ConvertToString(top, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (skip != null) { urlBuilder_.Append(System.Uri.EscapeDataString("$skip") + "=").Append(System.Uri.EscapeDataString(ConvertToString(skip, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (orderby != null) { urlBuilder_.Append(System.Uri.EscapeDataString("$orderby") + "=").Append(System.Uri.EscapeDataString(ConvertToString(orderby, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (filter != null) { urlBuilder_.Append(System.Uri.EscapeDataString("$filter") + "=").Append(System.Uri.EscapeDataString(ConvertToString(filter, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (parentId != null) { urlBuilder_.Append(System.Uri.EscapeDataString("parentId") + "=").Append(System.Uri.EscapeDataString(ConvertToString(parentId, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (ids != null) { urlBuilder_.Append(System.Uri.EscapeDataString("ids") + "=").Append(System.Uri.EscapeDataString(ConvertToString(ids, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (q != null) { urlBuilder_.Append(System.Uri.EscapeDataString("q") + "=").Append(System.Uri.EscapeDataString(ConvertToString(q, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Upload a new asset. /// /// The name of the app. /// The optional parent folder id. /// The optional custom asset id. /// True to duplicate the asset, event if the file has been uploaded. /// Asset created. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PostAssetAsync(string app, string parentId = null, string id = null, bool? duplicate = null, FileParameter file = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/assets?"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); if (parentId != null) { urlBuilder_.Append(System.Uri.EscapeDataString("ParentId") + "=").Append(System.Uri.EscapeDataString(ConvertToString(parentId, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (id != null) { urlBuilder_.Append(System.Uri.EscapeDataString("Id") + "=").Append(System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (duplicate != null) { urlBuilder_.Append(System.Uri.EscapeDataString("Duplicate") + "=").Append(System.Uri.EscapeDataString(ConvertToString(duplicate, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; var disposeClient_ = false; 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 (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("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); var disposeResponse_ = true; 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; if (status_ == 201) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Asset request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 413) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Asset exceeds the maximum upload size.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get assets. /// /// The name of the app. /// The required query object. /// Assets returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetAssetsPostAsync(string app, QueryDto query, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (query == null) throw new System.ArgumentNullException("query"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/assets/query"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(query, _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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get an asset by id. /// /// The name of the app. /// The id of the asset to retrieve. /// Asset found. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetAssetAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/assets/{id}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Asset or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Upsert an asset. /// /// The name of the app. /// The optional custom asset id. /// The optional parent folder id. /// True to duplicate the asset, event if the file has been uploaded. /// Asset created or updated. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PostUpsertAssetAsync(string app, string id, string parentId = null, bool? duplicate = null, FileParameter file = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/assets/{id}?"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); if (parentId != null) { urlBuilder_.Append(System.Uri.EscapeDataString("ParentId") + "=").Append(System.Uri.EscapeDataString(ConvertToString(parentId, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (duplicate != null) { urlBuilder_.Append(System.Uri.EscapeDataString("Duplicate") + "=").Append(System.Uri.EscapeDataString(ConvertToString(duplicate, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; var disposeClient_ = false; 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 (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("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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Asset request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 413) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Asset exceeds the maximum upload size.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update an asset. /// /// The name of the app. /// The id of the asset. /// The asset object that needs to updated. /// Asset updated. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutAssetAsync(string app, string id, AnnotateAssetDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/assets/{id}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Asset request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Asset or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Delete an asset. /// /// The name of the app. /// The id of the asset to delete. /// True to check referrers of this asset. /// True to delete the asset permanently. /// Asset deleted. /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteAssetAsync(string app, string id, bool? checkReferrers = null, bool? permanent = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/assets/{id}?"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); if (checkReferrers != null) { urlBuilder_.Append(System.Uri.EscapeDataString("CheckReferrers") + "=").Append(System.Uri.EscapeDataString(ConvertToString(checkReferrers, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } if (permanent != null) { urlBuilder_.Append(System.Uri.EscapeDataString("Permanent") + "=").Append(System.Uri.EscapeDataString(ConvertToString(permanent, System.Globalization.CultureInfo.InvariantCulture))).Append("&"); } urlBuilder_.Length--; var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 204) { return; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Asset or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Bulk update assets. /// /// The name of the app. /// The bulk update request. /// Assets created, update or delete. /// A server side error occurred. public virtual async System.Threading.Tasks.Task> BulkUpdateAssetsAsync(string app, BulkUpdateAssetsDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/assets/bulk"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Assets request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Replace asset content. /// /// The name of the app. /// The id of the asset. /// Asset updated. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutAssetContentAsync(string app, string id, FileParameter file = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/assets/{id}/content"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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 (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("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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Asset request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 413) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Asset exceeds the maximum upload size.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Asset or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Moves the asset. /// /// The name of the app. /// The id of the asset. /// The asset object that needs to updated. /// Asset moved. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutAssetParentAsync(string app, string id, MoveAssetDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/assets/{id}/parent"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Asset request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Asset or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } 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, System.Threading.CancellationToken cancellationToken) { 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 SquidexManagementException(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 SquidexManagementException(message, (int)response.StatusCode, string.Empty, headers, exception); } } } private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) { if (value == null) { return ""; } if (value is System.Enum) { var 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; } } var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); return converted == null ? string.Empty : converted; } } else if (value is bool) { return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } else if (value is byte[]) { return System.Convert.ToBase64String((byte[]) value); } else if (value.GetType().IsArray) { var array = System.Linq.Enumerable.OfType((System.Array) value); return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } var result = System.Convert.ToString(value, cultureInfo); return result == null ? "" : result; } } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial interface IAppsClient { /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get the app asset scripts. /// /// The name of the app to get the asset scripts for. /// Asset scripts returned. /// A server side error occurred. System.Threading.Tasks.Task GetAssetScriptsAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update the app asset scripts. /// /// The name of the app to update. /// The values to update. /// Asset scripts updated. /// A server side error occurred. System.Threading.Tasks.Task PutAssetScriptsAsync(string app, UpdateAssetScriptsDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get app clients. /// /// The name of the app. /// Clients returned. /// A server side error occurred. System.Threading.Tasks.Task GetClientsAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Create a new app client. /// /// The name of the app. /// Client object that needs to be added to the app. /// Client created. /// A server side error occurred. System.Threading.Tasks.Task PostClientAsync(string app, CreateClientDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Updates an app client. /// /// The name of the app. /// The id of the client that must be updated. /// Client object that needs to be updated. /// Client updated. /// A server side error occurred. System.Threading.Tasks.Task PutClientAsync(string app, string id, UpdateClientDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Revoke an app client. /// /// The name of the app. /// The id of the client that must be deleted. /// Client deleted. /// A server side error occurred. System.Threading.Tasks.Task DeleteClientAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get app contributors. /// /// The name of the app. /// Contributors returned. /// A server side error occurred. System.Threading.Tasks.Task GetContributorsAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Assign contributor to app. /// /// The name of the app. /// Contributor object that needs to be added to the app. /// Contributor assigned to app. /// A server side error occurred. System.Threading.Tasks.Task PostContributorAsync(string app, AssignContributorDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Remove yourself. /// /// The name of the app. /// Contributor removed. /// A server side error occurred. System.Threading.Tasks.Task DeleteMyselfAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Remove contributor. /// /// The name of the app. /// The id of the contributor. /// Contributor removed. /// A server side error occurred. System.Threading.Tasks.Task DeleteContributorAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get the app image. /// /// The name of the app. /// App image found and content or (resized) image returned. /// A server side error occurred. System.Threading.Tasks.Task GetImageAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Upload the app image. /// /// The name of the app to update. /// App image uploaded. /// A server side error occurred. System.Threading.Tasks.Task UploadImageAsync(string app, FileParameter file = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Remove the app image. /// /// The name of the app to update. /// App image removed. /// A server side error occurred. System.Threading.Tasks.Task DeleteImageAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get app languages. /// /// The name of the app. /// Languages returned. /// A server side error occurred. System.Threading.Tasks.Task GetLanguagesAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Attaches an app language. /// /// The name of the app. /// The language to add to the app. /// Language created. /// A server side error occurred. System.Threading.Tasks.Task PostLanguageAsync(string app, AddLanguageDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Updates an app language. /// /// The name of the app. /// The language to update. /// The language object. /// Language updated. /// A server side error occurred. System.Threading.Tasks.Task PutLanguageAsync(string app, string language, UpdateLanguageDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Deletes an app language. /// /// The name of the app. /// The language to delete from the app. /// Language deleted. /// A server side error occurred. System.Threading.Tasks.Task DeleteLanguageAsync(string app, string language, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get app roles. /// /// The name of the app. /// Roles returned. /// A server side error occurred. System.Threading.Tasks.Task GetRolesAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Add role to app. /// /// The name of the app. /// Role object that needs to be added to the app. /// Role created. /// A server side error occurred. System.Threading.Tasks.Task PostRoleAsync(string app, AddRoleDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get app permissions. /// /// The name of the app. /// App permissions returned. /// A server side error occurred. System.Threading.Tasks.Task> GetPermissionsAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update an app role. /// /// The name of the app. /// The name of the role to be updated. /// Role to be updated for the app. /// Role updated. /// A server side error occurred. System.Threading.Tasks.Task PutRoleAsync(string app, string roleName, UpdateRoleDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Remove role from app. /// /// The name of the app. /// The name of the role. /// Role deleted. /// A server side error occurred. System.Threading.Tasks.Task DeleteRoleAsync(string app, string roleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get your apps. /// /// Apps returned. /// A server side error occurred. System.Threading.Tasks.Task> GetAppsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Create a new app. /// /// The app object that needs to be added to Squidex. /// App created. /// A server side error occurred. System.Threading.Tasks.Task PostAppAsync(CreateAppDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get an app by name. /// /// The name of the app. /// Apps returned. /// A server side error occurred. System.Threading.Tasks.Task GetAppAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update the app. /// /// The name of the app to update. /// The values to update. /// App updated. /// A server side error occurred. System.Threading.Tasks.Task PutAppAsync(string app, UpdateAppDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Delete the app. /// /// The name of the app to delete. /// App deleted. /// A server side error occurred. System.Threading.Tasks.Task DeleteAppAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get the app settings. /// /// The name of the app to get the settings for. /// App settingsd returned. /// A server side error occurred. System.Threading.Tasks.Task GetSettingsAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update the app settings. /// /// The name of the app to update. /// The values to update. /// App updated. /// A server side error occurred. System.Threading.Tasks.Task PutSettingsAsync(string app, UpdateAppSettingsDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get app workflow. /// /// The name of the app. /// Workflows returned. /// A server side error occurred. System.Threading.Tasks.Task GetWorkflowsAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Create a workflow. /// /// The name of the app. /// The new workflow. /// Workflow created. /// A server side error occurred. System.Threading.Tasks.Task PostWorkflowAsync(string app, AddWorkflowDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update a workflow. /// /// The name of the app. /// The id of the workflow to update. /// The new workflow. /// Workflow updated. /// A server side error occurred. System.Threading.Tasks.Task PutWorkflowAsync(string app, string id, UpdateWorkflowDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Delete a workflow. /// /// The name of the app. /// The id of the workflow to update. /// Workflow deleted. /// A server side error occurred. System.Threading.Tasks.Task DeleteWorkflowAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class AppsClient : IAppsClient { private System.Net.Http.HttpClient _httpClient; private System.Lazy _settings; public AppsClient(System.Net.Http.HttpClient httpClient) { _httpClient = httpClient; _settings = new System.Lazy(CreateSerializerSettings); } private Newtonsoft.Json.JsonSerializerSettings CreateSerializerSettings() { var settings = new Newtonsoft.Json.JsonSerializerSettings(); UpdateJsonSerializerSettings(settings); return settings; } 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. /// /// Get the app asset scripts. /// /// The name of the app to get the asset scripts for. /// Asset scripts returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetAssetScriptsAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/assets/scripts"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update the app asset scripts. /// /// The name of the app to update. /// The values to update. /// Asset scripts updated. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutAssetScriptsAsync(string app, UpdateAssetScriptsDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/assets/scripts"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Asset request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get app clients. /// /// The name of the app. /// Clients returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetClientsAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/clients"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Create a new app client. /// /// The name of the app. /// Client object that needs to be added to the app. /// Client created. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PostClientAsync(string app, CreateClientDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/clients"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _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); var disposeResponse_ = true; 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; if (status_ == 201) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Client request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Updates an app client. /// /// The name of the app. /// The id of the client that must be updated. /// Client object that needs to be updated. /// Client updated. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutClientAsync(string app, string id, UpdateClientDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/clients/{id}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Client request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Client or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Revoke an app client. /// /// The name of the app. /// The id of the client that must be deleted. /// Client deleted. /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteClientAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/clients/{id}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Client or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get app contributors. /// /// The name of the app. /// Contributors returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetContributorsAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/contributors"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Assign contributor to app. /// /// The name of the app. /// Contributor object that needs to be added to the app. /// Contributor assigned to app. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PostContributorAsync(string app, AssignContributorDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/contributors"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _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); var disposeResponse_ = true; 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; if (status_ == 201) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Contributor request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Remove yourself. /// /// The name of the app. /// Contributor removed. /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteMyselfAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/contributors/me"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Contributor or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Remove contributor. /// /// The name of the app. /// The id of the contributor. /// Contributor removed. /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteContributorAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/contributors/{id}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Contributor or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get the app image. /// /// The name of the app. /// App image found and content or (resized) image returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetImageAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/image"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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/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); var disposeResponse_ = true; 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; if (status_ == 200 || status_ == 206) { var responseStream_ = response_.Content == null ? System.IO.Stream.Null : await response_.Content.ReadAsStreamAsync().ConfigureAwait(false); var fileResponse_ = new FileResponse(status_, headers_, responseStream_, null, response_); disposeClient_ = false; disposeResponse_ = false; // response and client are disposed by FileResponse return fileResponse_; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Upload the app image. /// /// The name of the app to update. /// App image uploaded. /// A server side error occurred. public virtual async System.Threading.Tasks.Task UploadImageAsync(string app, FileParameter file = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/image"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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 (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("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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("App request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Remove the app image. /// /// The name of the app to update. /// App image removed. /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteImageAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/image"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get app languages. /// /// The name of the app. /// Languages returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetLanguagesAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/languages"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Attaches an app language. /// /// The name of the app. /// The language to add to the app. /// Language created. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PostLanguageAsync(string app, AddLanguageDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/languages"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _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); var disposeResponse_ = true; 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; if (status_ == 201) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Language request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Updates an app language. /// /// The name of the app. /// The language to update. /// The language object. /// Language updated. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutLanguageAsync(string app, string language, UpdateLanguageDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (language == null) throw new System.ArgumentNullException("language"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/languages/{language}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{language}", System.Uri.EscapeDataString(ConvertToString(language, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Language request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Language or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Deletes an app language. /// /// The name of the app. /// The language to delete from the app. /// Language deleted. /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteLanguageAsync(string app, string language, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (language == null) throw new System.ArgumentNullException("language"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/languages/{language}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{language}", System.Uri.EscapeDataString(ConvertToString(language, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Language is master language.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Language or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get app roles. /// /// The name of the app. /// Roles returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetRolesAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/roles"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Add role to app. /// /// The name of the app. /// Role object that needs to be added to the app. /// Role created. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PostRoleAsync(string app, AddRoleDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/roles"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _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); var disposeResponse_ = true; 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; if (status_ == 201) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Role request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get app permissions. /// /// The name of the app. /// App permissions returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task> GetPermissionsAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/roles/permissions"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update an app role. /// /// The name of the app. /// The name of the role to be updated. /// Role to be updated for the app. /// Role updated. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutRoleAsync(string app, string roleName, UpdateRoleDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (roleName == null) throw new System.ArgumentNullException("roleName"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/roles/{roleName}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{roleName}", System.Uri.EscapeDataString(ConvertToString(roleName, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Role request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Role or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Remove role from app. /// /// The name of the app. /// The name of the role. /// Role deleted. /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteRoleAsync(string app, string roleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (roleName == null) throw new System.ArgumentNullException("roleName"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/roles/{roleName}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{roleName}", System.Uri.EscapeDataString(ConvertToString(roleName, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Role is in use by contributor or client or a default role.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Role or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get your apps. /// /// Apps returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task> GetAppsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps"); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync>(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Create a new app. /// /// The app object that needs to be added to Squidex. /// App created. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PostAppAsync(CreateAppDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps"); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _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); var disposeResponse_ = true; 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; if (status_ == 201) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("App request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 409) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("App name is already in use.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get an app by name. /// /// The name of the app. /// Apps returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetAppAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update the app. /// /// The name of the app to update. /// The values to update. /// App updated. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutAppAsync(string app, UpdateAppDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("App request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Delete the app. /// /// The name of the app to delete. /// App deleted. /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteAppAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 204) { return; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get the app settings. /// /// The name of the app to get the settings for. /// App settingsd returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetSettingsAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/settings"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update the app settings. /// /// The name of the app to update. /// The values to update. /// App updated. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutSettingsAsync(string app, UpdateAppSettingsDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/settings"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("App request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Get app workflow. /// /// The name of the app. /// Workflows returned. /// A server side error occurred. public virtual async System.Threading.Tasks.Task GetWorkflowsAsync(string app, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/workflows"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("App not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Create a workflow. /// /// The name of the app. /// The new workflow. /// Workflow created. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PostWorkflowAsync(string app, AddWorkflowDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/workflows"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Workflow request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Workflow or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Update a workflow. /// /// The name of the app. /// The id of the workflow to update. /// The new workflow. /// Workflow updated. /// A server side error occurred. public virtual async System.Threading.Tasks.Task PutWorkflowAsync(string app, string id, UpdateWorkflowDto request, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); if (request == null) throw new System.ArgumentNullException("request"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/workflows/{id}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; try { using (var request_ = new System.Net.Http.HttpRequestMessage()) { var content_ = new System.Net.Http.StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(request, _settings.Value)); content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); request_.Content = content_; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 400) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Workflow request not valid.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Workflow or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// Delete a workflow. /// /// The name of the app. /// The id of the workflow to update. /// Workflow deleted. /// A server side error occurred. public virtual async System.Threading.Tasks.Task DeleteWorkflowAsync(string app, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { if (app == null) throw new System.ArgumentNullException("app"); if (id == null) throw new System.ArgumentNullException("id"); var urlBuilder_ = new System.Text.StringBuilder(); urlBuilder_.Append("api/apps/{app}/workflows/{id}"); urlBuilder_.Replace("{app}", System.Uri.EscapeDataString(ConvertToString(app, System.Globalization.CultureInfo.InvariantCulture))); urlBuilder_.Replace("{id}", System.Uri.EscapeDataString(ConvertToString(id, System.Globalization.CultureInfo.InvariantCulture))); var client_ = _httpClient; var disposeClient_ = false; 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); var disposeResponse_ = true; 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; if (status_ == 200) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } return objectResponse_.Object; } else if (status_ == 404) { string responseText_ = ( response_.Content == null ) ? string.Empty : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("Workflow or app not found.", status_, responseText_, headers_, null); } else if (status_ == 500) { var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); if (objectResponse_.Object == null) { throw new SquidexManagementException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); } throw new SquidexManagementException("Operation failed.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); } else { var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); throw new SquidexManagementException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); } } finally { if (disposeResponse_) response_.Dispose(); } } } finally { if (disposeClient_) client_.Dispose(); } } 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, System.Threading.CancellationToken cancellationToken) { 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 SquidexManagementException(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 SquidexManagementException(message, (int)response.StatusCode, string.Empty, headers, exception); } } } private string ConvertToString(object value, System.Globalization.CultureInfo cultureInfo) { if (value == null) { return ""; } if (value is System.Enum) { var 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; } } var converted = System.Convert.ToString(System.Convert.ChangeType(value, System.Enum.GetUnderlyingType(value.GetType()), cultureInfo)); return converted == null ? string.Empty : converted; } } else if (value is bool) { return System.Convert.ToString((bool)value, cultureInfo).ToLowerInvariant(); } else if (value is byte[]) { return System.Convert.ToBase64String((byte[]) value); } else if (value.GetType().IsArray) { var array = System.Linq.Enumerable.OfType((System.Array) value); return string.Join(",", System.Linq.Enumerable.Select(array, o => ConvertToString(o, cultureInfo))); } var result = System.Convert.ToString(value, cultureInfo); return result == null ? "" : result; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class UserProperty { [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Name { get; set; } [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Value { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class UsersDto : Resource { /// /// The total number of users. /// [Newtonsoft.Json.JsonProperty("total", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long Total { get; set; } /// /// The users. /// [Newtonsoft.Json.JsonProperty("items", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Items { get; set; } = new System.Collections.Generic.List(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class UserDto : Resource { /// /// The id of the user. /// [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Id { get; set; } /// /// The email of the user. Unique value. /// [Newtonsoft.Json.JsonProperty("email", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Email { get; set; } /// /// The display name (usually first name and last name) of the user. /// [Newtonsoft.Json.JsonProperty("displayName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string DisplayName { get; set; } /// /// Determines if the user is locked. /// [Newtonsoft.Json.JsonProperty("isLocked", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsLocked { get; set; } /// /// Additional permissions for the user. /// [Newtonsoft.Json.JsonProperty("permissions", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Permissions { get; set; } = new System.Collections.Generic.List(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public abstract partial class Resource { /// /// The links. /// [Newtonsoft.Json.JsonProperty("_links", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.Dictionary _links { get; set; } = new System.Collections.Generic.Dictionary(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ResourceLink { /// /// The link url. /// [Newtonsoft.Json.JsonProperty("href", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Href { get; set; } /// /// The link method. /// [Newtonsoft.Json.JsonProperty("method", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Method { get; set; } /// /// Additional data about the link. /// [Newtonsoft.Json.JsonProperty("metadata", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Metadata { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class CreateUserDto { /// /// The email of the user. Unique value. /// [Newtonsoft.Json.JsonProperty("email", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Email { get; set; } /// /// The display name (usually first name and last name) of the user. /// [Newtonsoft.Json.JsonProperty("displayName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string DisplayName { get; set; } /// /// The password of the user. /// [Newtonsoft.Json.JsonProperty("password", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Password { get; set; } /// /// Additional permissions for the user. /// [Newtonsoft.Json.JsonProperty("permissions", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Permissions { get; set; } = new System.Collections.Generic.List(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class UpdateUserDto { /// /// The email of the user. Unique value. /// [Newtonsoft.Json.JsonProperty("email", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Email { get; set; } /// /// The display name (usually first name and last name) of the user. /// [Newtonsoft.Json.JsonProperty("displayName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string DisplayName { get; set; } /// /// The password of the user. /// [Newtonsoft.Json.JsonProperty("password", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Password { get; set; } /// /// Additional permissions for the user. /// [Newtonsoft.Json.JsonProperty("permissions", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Permissions { get; set; } = new System.Collections.Generic.List(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class UISettingsDto { /// /// True when the user can create apps. /// [Newtonsoft.Json.JsonProperty("canCreateApps", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool CanCreateApps { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class UpdateSettingDto { /// /// The value for the setting. /// [Newtonsoft.Json.JsonProperty("value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public object Value { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class EventConsumersDto : Resource { /// /// The event consumers. /// [Newtonsoft.Json.JsonProperty("items", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List Items { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class EventConsumerDto : Resource { [Newtonsoft.Json.JsonProperty("isStopped", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsStopped { get; set; } [Newtonsoft.Json.JsonProperty("isResetting", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsResetting { get; set; } [Newtonsoft.Json.JsonProperty("count", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int Count { get; set; } [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Name { get; set; } [Newtonsoft.Json.JsonProperty("error", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Error { get; set; } [Newtonsoft.Json.JsonProperty("position", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Position { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ContentsDto : Resource { /// /// The total number of content items. /// [Newtonsoft.Json.JsonProperty("total", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long Total { get; set; } /// /// The content items. /// [Newtonsoft.Json.JsonProperty("items", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Items { get; set; } = new System.Collections.Generic.List(); /// /// The possible statuses. /// [Newtonsoft.Json.JsonProperty("statuses", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Statuses { get; set; } = new System.Collections.Generic.List(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ContentDto : Resource { /// /// The if of the content item. /// [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Id { get; set; } /// /// The user that has created the content item. /// [Newtonsoft.Json.JsonProperty("createdBy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string CreatedBy { get; set; } /// /// The user that has updated the content item. /// [Newtonsoft.Json.JsonProperty("lastModifiedBy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string LastModifiedBy { get; set; } /// /// The data of the content item. /// [Newtonsoft.Json.JsonProperty("data", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public object Data { get; set; } /// /// The reference data for the frontend UI. /// [Newtonsoft.Json.JsonProperty("referenceData", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public ContentData ReferenceData { get; set; } /// /// The date and time when the content item has been created. /// [Newtonsoft.Json.JsonProperty("created", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset Created { get; set; } /// /// The date and time when the content item has been modified last. /// [Newtonsoft.Json.JsonProperty("lastModified", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset LastModified { get; set; } /// /// The status of the content. /// [Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Status { get; set; } /// /// The new status of the content. /// [Newtonsoft.Json.JsonProperty("newStatus", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string NewStatus { get; set; } /// /// The color of the status. /// [Newtonsoft.Json.JsonProperty("statusColor", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string StatusColor { get; set; } /// /// The color of the new status. /// [Newtonsoft.Json.JsonProperty("newStatusColor", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string NewStatusColor { get; set; } /// /// The UI token. /// [Newtonsoft.Json.JsonProperty("editToken", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string EditToken { get; set; } /// /// The scheduled status. /// [Newtonsoft.Json.JsonProperty("scheduleJob", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public ScheduleJobDto ScheduleJob { get; set; } /// /// The id of the schema. /// [Newtonsoft.Json.JsonProperty("schemaId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string SchemaId { get; set; } /// /// The name of the schema. /// [Newtonsoft.Json.JsonProperty("schemaName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string SchemaName { get; set; } /// /// The display name of the schema. /// [Newtonsoft.Json.JsonProperty("schemaDisplayName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string SchemaDisplayName { get; set; } /// /// The reference fields. /// [Newtonsoft.Json.JsonProperty("referenceFields", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List ReferenceFields { get; set; } /// /// Indicates whether the content is deleted. /// [Newtonsoft.Json.JsonProperty("isDeleted", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsDeleted { get; set; } /// /// The version of the content. /// [Newtonsoft.Json.JsonProperty("version", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long Version { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ContentData : System.Collections.Generic.Dictionary { } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ContentFieldData : System.Collections.Generic.Dictionary { } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ScheduleJobDto { /// /// The id of the schedule job. /// [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Id { get; set; } /// /// The new status. /// [Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Status { get; set; } /// /// The target date and time when the content should be scheduled. /// [Newtonsoft.Json.JsonProperty("dueTime", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset DueTime { get; set; } /// /// The color of the scheduled status. /// [Newtonsoft.Json.JsonProperty("color", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Color { get; set; } /// /// The user who schedule the content. /// [Newtonsoft.Json.JsonProperty("scheduledBy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string ScheduledBy { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class FieldDto : Resource { /// /// The id of the field. /// [Newtonsoft.Json.JsonProperty("fieldId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long FieldId { get; set; } /// /// The name of the field. Must be unique within the schema. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] [System.ComponentModel.DataAnnotations.RegularExpression(@"^[a-z0-9]+(\-[a-z0-9]+)*$")] public string Name { get; set; } /// /// Defines if the field is hidden. /// [Newtonsoft.Json.JsonProperty("isHidden", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsHidden { get; set; } /// /// Defines if the field is locked. /// [Newtonsoft.Json.JsonProperty("isLocked", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsLocked { get; set; } /// /// Defines if the field is disabled. /// [Newtonsoft.Json.JsonProperty("isDisabled", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsDisabled { get; set; } /// /// Defines the partitioning of the field. /// [Newtonsoft.Json.JsonProperty("partitioning", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Partitioning { get; set; } /// /// The field properties. /// [Newtonsoft.Json.JsonProperty("properties", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public FieldPropertiesDto Properties { get; set; } /// /// The nested fields. /// [Newtonsoft.Json.JsonProperty("nested", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List Nested { get; set; } } [Newtonsoft.Json.JsonConverter(typeof(JsonInheritanceConverter), "fieldType")] [JsonInheritanceAttribute("Array", typeof(ArrayFieldPropertiesDto))] [JsonInheritanceAttribute("Assets", typeof(AssetsFieldPropertiesDto))] [JsonInheritanceAttribute("Boolean", typeof(BooleanFieldPropertiesDto))] [JsonInheritanceAttribute("Component", typeof(ComponentFieldPropertiesDto))] [JsonInheritanceAttribute("Components", typeof(ComponentsFieldPropertiesDto))] [JsonInheritanceAttribute("DateTime", typeof(DateTimeFieldPropertiesDto))] [JsonInheritanceAttribute("Geolocation", typeof(GeolocationFieldPropertiesDto))] [JsonInheritanceAttribute("Json", typeof(JsonFieldPropertiesDto))] [JsonInheritanceAttribute("Number", typeof(NumberFieldPropertiesDto))] [JsonInheritanceAttribute("References", typeof(ReferencesFieldPropertiesDto))] [JsonInheritanceAttribute("String", typeof(StringFieldPropertiesDto))] [JsonInheritanceAttribute("Tags", typeof(TagsFieldPropertiesDto))] [JsonInheritanceAttribute("UI", typeof(UIFieldPropertiesDto))] [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public abstract partial class FieldPropertiesDto { /// /// Optional label for the editor. /// [Newtonsoft.Json.JsonProperty("label", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.StringLength(100)] public string Label { get; set; } /// /// Hints to describe the field. /// [Newtonsoft.Json.JsonProperty("hints", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.StringLength(1000)] public string Hints { get; set; } /// /// Placeholder to show when no value has been entered. /// [Newtonsoft.Json.JsonProperty("placeholder", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.StringLength(100)] public string Placeholder { get; set; } /// /// Indicates if the field is required. /// [Newtonsoft.Json.JsonProperty("isRequired", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsRequired { get; set; } /// /// Indicates if the field is required when publishing. /// [Newtonsoft.Json.JsonProperty("isRequiredOnPublish", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsRequiredOnPublish { get; set; } /// /// Indicates if the field should be rendered with half width only. /// [Newtonsoft.Json.JsonProperty("isHalfWidth", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsHalfWidth { get; set; } /// /// Optional url to the editor. /// [Newtonsoft.Json.JsonProperty("editorUrl", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string EditorUrl { get; set; } /// /// Tags for automation processes. /// [Newtonsoft.Json.JsonProperty("tags", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List Tags { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ArrayFieldPropertiesDto : FieldPropertiesDto { /// /// The minimum allowed items for the field value. /// [Newtonsoft.Json.JsonProperty("minItems", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MinItems { get; set; } /// /// The maximum allowed items for the field value. /// [Newtonsoft.Json.JsonProperty("maxItems", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MaxItems { get; set; } /// /// The fields that must be unique. /// [Newtonsoft.Json.JsonProperty("uniqueFields", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List UniqueFields { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class AssetsFieldPropertiesDto : FieldPropertiesDto { /// /// The preview mode for the asset. /// [Newtonsoft.Json.JsonProperty("previewMode", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public AssetPreviewMode PreviewMode { get; set; } /// /// The language specific default value as a list of asset ids. /// [Newtonsoft.Json.JsonProperty("defaultValues", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public LocalizedValueOfReadonlyListOfString DefaultValues { get; set; } /// /// The default value as a list of asset ids. /// [Newtonsoft.Json.JsonProperty("defaultValue", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List DefaultValue { get; set; } /// /// The initial id to the folder. /// [Newtonsoft.Json.JsonProperty("folderId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string FolderId { get; set; } /// /// The minimum allowed items for the field value. /// [Newtonsoft.Json.JsonProperty("minItems", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MinItems { get; set; } /// /// The maximum allowed items for the field value. /// [Newtonsoft.Json.JsonProperty("maxItems", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MaxItems { get; set; } /// /// The minimum file size in bytes. /// [Newtonsoft.Json.JsonProperty("minSize", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MinSize { get; set; } /// /// The maximum file size in bytes. /// [Newtonsoft.Json.JsonProperty("maxSize", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MaxSize { get; set; } /// /// The minimum image width in pixels. /// [Newtonsoft.Json.JsonProperty("minWidth", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MinWidth { get; set; } /// /// The maximum image width in pixels. /// [Newtonsoft.Json.JsonProperty("maxWidth", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MaxWidth { get; set; } /// /// The minimum image height in pixels. /// [Newtonsoft.Json.JsonProperty("minHeight", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MinHeight { get; set; } /// /// The maximum image height in pixels. /// [Newtonsoft.Json.JsonProperty("maxHeight", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MaxHeight { get; set; } /// /// The image aspect width in pixels. /// [Newtonsoft.Json.JsonProperty("aspectWidth", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? AspectWidth { get; set; } /// /// The image aspect height in pixels. /// [Newtonsoft.Json.JsonProperty("aspectHeight", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? AspectHeight { get; set; } /// /// The expected type. /// [Newtonsoft.Json.JsonProperty("expectedType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public AssetType? ExpectedType { get; set; } /// /// True to resolve first asset in the content list. /// [Newtonsoft.Json.JsonProperty("resolveFirst", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool ResolveFirst { get; set; } /// /// True to resolve first image in the content list. /// [Newtonsoft.Json.JsonProperty("mustBeImage", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.Obsolete("Use \'expectedType\' field now")] public bool MustBeImage { get; set; } /// /// True to resolve first image in the content list. /// [Newtonsoft.Json.JsonProperty("resolveImage", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.Obsolete("Use \'resolveFirst\' field now")] public bool ResolveImage { get; set; } /// /// The allowed file extensions. /// [Newtonsoft.Json.JsonProperty("allowedExtensions", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List AllowedExtensions { get; set; } /// /// True, if duplicate values are allowed. /// [Newtonsoft.Json.JsonProperty("allowDuplicates", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool AllowDuplicates { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum AssetPreviewMode { [System.Runtime.Serialization.EnumMember(Value = @"ImageAndFileName")] ImageAndFileName = 0, [System.Runtime.Serialization.EnumMember(Value = @"Image")] Image = 1, [System.Runtime.Serialization.EnumMember(Value = @"FileName")] FileName = 2, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class LocalizedValueOfReadonlyListOfString : System.Collections.Generic.Dictionary> { } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum AssetType { [System.Runtime.Serialization.EnumMember(Value = @"Unknown")] Unknown = 0, [System.Runtime.Serialization.EnumMember(Value = @"Image")] Image = 1, [System.Runtime.Serialization.EnumMember(Value = @"Audio")] Audio = 2, [System.Runtime.Serialization.EnumMember(Value = @"Video")] Video = 3, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class BooleanFieldPropertiesDto : FieldPropertiesDto { /// /// The language specific default value for the field value. /// [Newtonsoft.Json.JsonProperty("defaultValues", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public LocalizedValueOfNullableBoolean DefaultValues { get; set; } /// /// The default value for the field value. /// [Newtonsoft.Json.JsonProperty("defaultValue", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? DefaultValue { get; set; } /// /// Indicates that the inline editor is enabled for this field. /// [Newtonsoft.Json.JsonProperty("inlineEditable", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool InlineEditable { get; set; } /// /// The editor that is used to manage this field. /// [Newtonsoft.Json.JsonProperty("editor", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public BooleanFieldEditor Editor { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class LocalizedValueOfNullableBoolean : System.Collections.Generic.Dictionary { } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum BooleanFieldEditor { [System.Runtime.Serialization.EnumMember(Value = @"Checkbox")] Checkbox = 0, [System.Runtime.Serialization.EnumMember(Value = @"Toggle")] Toggle = 1, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ComponentFieldPropertiesDto : FieldPropertiesDto { /// /// The id of the embedded schemas. /// [Newtonsoft.Json.JsonProperty("schemaIds", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List SchemaIds { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ComponentsFieldPropertiesDto : FieldPropertiesDto { /// /// The minimum allowed items for the field value. /// [Newtonsoft.Json.JsonProperty("minItems", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MinItems { get; set; } /// /// The maximum allowed items for the field value. /// [Newtonsoft.Json.JsonProperty("maxItems", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MaxItems { get; set; } /// /// The id of the embedded schemas. /// [Newtonsoft.Json.JsonProperty("schemaIds", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List SchemaIds { get; set; } /// /// The fields that must be unique. /// [Newtonsoft.Json.JsonProperty("uniqueFields", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List UniqueFields { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class DateTimeFieldPropertiesDto : FieldPropertiesDto { /// /// The language specific default value for the field value. /// [Newtonsoft.Json.JsonProperty("defaultValues", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public LocalizedValueOfNullableInstant DefaultValues { get; set; } /// /// The default value for the field value. /// [Newtonsoft.Json.JsonProperty("defaultValue", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset? DefaultValue { get; set; } /// /// The maximum allowed value for the field value. /// [Newtonsoft.Json.JsonProperty("maxValue", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset? MaxValue { get; set; } /// /// The minimum allowed value for the field value. /// [Newtonsoft.Json.JsonProperty("minValue", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset? MinValue { get; set; } /// /// The format pattern when displayed in the UI. /// [Newtonsoft.Json.JsonProperty("format", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Format { get; set; } /// /// The editor that is used to manage this field. /// [Newtonsoft.Json.JsonProperty("editor", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public DateTimeFieldEditor Editor { get; set; } /// /// The calculated default value for the field value. /// [Newtonsoft.Json.JsonProperty("calculatedDefaultValue", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public DateTimeCalculatedDefaultValue? CalculatedDefaultValue { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class LocalizedValueOfNullableInstant : System.Collections.Generic.Dictionary { } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum DateTimeFieldEditor { [System.Runtime.Serialization.EnumMember(Value = @"Date")] Date = 0, [System.Runtime.Serialization.EnumMember(Value = @"DateTime")] DateTime = 1, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum DateTimeCalculatedDefaultValue { [System.Runtime.Serialization.EnumMember(Value = @"Now")] Now = 0, [System.Runtime.Serialization.EnumMember(Value = @"Today")] Today = 1, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class GeolocationFieldPropertiesDto : FieldPropertiesDto { /// /// The editor that is used to manage this field. /// [Newtonsoft.Json.JsonProperty("editor", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public GeolocationFieldEditor Editor { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum GeolocationFieldEditor { [System.Runtime.Serialization.EnumMember(Value = @"Map")] Map = 0, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class JsonFieldPropertiesDto : FieldPropertiesDto { } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class NumberFieldPropertiesDto : FieldPropertiesDto { /// /// The language specific default value for the field value. /// [Newtonsoft.Json.JsonProperty("defaultValues", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public LocalizedValueOfNullableDouble DefaultValues { get; set; } /// /// The default value for the field value. /// [Newtonsoft.Json.JsonProperty("defaultValue", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public double? DefaultValue { get; set; } /// /// The maximum allowed value for the field value. /// [Newtonsoft.Json.JsonProperty("maxValue", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public double? MaxValue { get; set; } /// /// The minimum allowed value for the field value. /// [Newtonsoft.Json.JsonProperty("minValue", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public double? MinValue { get; set; } /// /// The allowed values for the field value. /// [Newtonsoft.Json.JsonProperty("allowedValues", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List AllowedValues { get; set; } /// /// Indicates if the field value must be unique. Ignored for nested fields and localized fields. /// [Newtonsoft.Json.JsonProperty("isUnique", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsUnique { get; set; } /// /// Indicates that the inline editor is enabled for this field. /// [Newtonsoft.Json.JsonProperty("inlineEditable", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool InlineEditable { get; set; } /// /// The editor that is used to manage this field. /// [Newtonsoft.Json.JsonProperty("editor", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public NumberFieldEditor Editor { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class LocalizedValueOfNullableDouble : System.Collections.Generic.Dictionary { } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum NumberFieldEditor { [System.Runtime.Serialization.EnumMember(Value = @"Input")] Input = 0, [System.Runtime.Serialization.EnumMember(Value = @"Radio")] Radio = 1, [System.Runtime.Serialization.EnumMember(Value = @"Dropdown")] Dropdown = 2, [System.Runtime.Serialization.EnumMember(Value = @"Stars")] Stars = 3, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ReferencesFieldPropertiesDto : FieldPropertiesDto { /// /// The language specific default value as a list of content ids. /// [Newtonsoft.Json.JsonProperty("defaultValues", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public LocalizedValueOfReadonlyListOfString DefaultValues { get; set; } /// /// The default value as a list of content ids. /// [Newtonsoft.Json.JsonProperty("defaultValue", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List DefaultValue { get; set; } /// /// The minimum allowed items for the field value. /// [Newtonsoft.Json.JsonProperty("minItems", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MinItems { get; set; } /// /// The maximum allowed items for the field value. /// [Newtonsoft.Json.JsonProperty("maxItems", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MaxItems { get; set; } /// /// True, if duplicate values are allowed. /// [Newtonsoft.Json.JsonProperty("allowDuplicates", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool AllowDuplicates { get; set; } /// /// True to resolve references in the content list. /// [Newtonsoft.Json.JsonProperty("resolveReference", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool ResolveReference { get; set; } /// /// True when all references must be published. /// [Newtonsoft.Json.JsonProperty("mustBePublished", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool MustBePublished { get; set; } /// /// The editor that is used to manage this field. /// [Newtonsoft.Json.JsonProperty("editor", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public ReferencesFieldEditor Editor { get; set; } /// /// The id of the referenced schemas. /// [Newtonsoft.Json.JsonProperty("schemaIds", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List SchemaIds { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum ReferencesFieldEditor { [System.Runtime.Serialization.EnumMember(Value = @"List")] List = 0, [System.Runtime.Serialization.EnumMember(Value = @"Dropdown")] Dropdown = 1, [System.Runtime.Serialization.EnumMember(Value = @"Tags")] Tags = 2, [System.Runtime.Serialization.EnumMember(Value = @"Checkboxes")] Checkboxes = 3, [System.Runtime.Serialization.EnumMember(Value = @"Input")] Input = 4, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class StringFieldPropertiesDto : FieldPropertiesDto { /// /// The language specific default value for the field value. /// [Newtonsoft.Json.JsonProperty("defaultValues", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public LocalizedValueOfString DefaultValues { get; set; } /// /// The default value for the field value. /// [Newtonsoft.Json.JsonProperty("defaultValue", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string DefaultValue { get; set; } /// /// The pattern to enforce a specific format for the field value. /// [Newtonsoft.Json.JsonProperty("pattern", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Pattern { get; set; } /// /// The validation message for the pattern. /// [Newtonsoft.Json.JsonProperty("patternMessage", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string PatternMessage { get; set; } /// /// The initial id to the folder when the control supports file uploads. /// [Newtonsoft.Json.JsonProperty("folderId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string FolderId { get; set; } /// /// The minimum allowed length for the field value. /// [Newtonsoft.Json.JsonProperty("minLength", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MinLength { get; set; } /// /// The maximum allowed length for the field value. /// [Newtonsoft.Json.JsonProperty("maxLength", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MaxLength { get; set; } /// /// The minimum allowed of normal characters for the field value. /// [Newtonsoft.Json.JsonProperty("minCharacters", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MinCharacters { get; set; } /// /// The maximum allowed of normal characters for the field value. /// [Newtonsoft.Json.JsonProperty("maxCharacters", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MaxCharacters { get; set; } /// /// The minimum allowed number of words for the field value. /// [Newtonsoft.Json.JsonProperty("minWords", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MinWords { get; set; } /// /// The maximum allowed number of words for the field value. /// [Newtonsoft.Json.JsonProperty("maxWords", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MaxWords { get; set; } /// /// The allowed values for the field value. /// [Newtonsoft.Json.JsonProperty("allowedValues", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List AllowedValues { get; set; } /// /// The allowed schema ids that can be embedded. /// [Newtonsoft.Json.JsonProperty("schemaIds", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List SchemaIds { get; set; } /// /// Indicates if the field value must be unique. Ignored for nested fields and localized fields. /// [Newtonsoft.Json.JsonProperty("isUnique", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsUnique { get; set; } /// /// Indicates that other content items or references are embedded. /// [Newtonsoft.Json.JsonProperty("isEmbeddable", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsEmbeddable { get; set; } /// /// Indicates that the inline editor is enabled for this field. /// [Newtonsoft.Json.JsonProperty("inlineEditable", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool InlineEditable { get; set; } /// /// Indicates whether GraphQL Enum should be created. /// [Newtonsoft.Json.JsonProperty("createEnum", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool CreateEnum { get; set; } /// /// How the string content should be interpreted. /// [Newtonsoft.Json.JsonProperty("contentType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public StringContentType ContentType { get; set; } /// /// The editor that is used to manage this field. /// [Newtonsoft.Json.JsonProperty("editor", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public StringFieldEditor Editor { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class LocalizedValueOfString : System.Collections.Generic.Dictionary { } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum StringContentType { [System.Runtime.Serialization.EnumMember(Value = @"Unspecified")] Unspecified = 0, [System.Runtime.Serialization.EnumMember(Value = @"Html")] Html = 1, [System.Runtime.Serialization.EnumMember(Value = @"Markdown")] Markdown = 2, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum StringFieldEditor { [System.Runtime.Serialization.EnumMember(Value = @"Input")] Input = 0, [System.Runtime.Serialization.EnumMember(Value = @"Color")] Color = 1, [System.Runtime.Serialization.EnumMember(Value = @"Markdown")] Markdown = 2, [System.Runtime.Serialization.EnumMember(Value = @"Dropdown")] Dropdown = 3, [System.Runtime.Serialization.EnumMember(Value = @"Html")] Html = 4, [System.Runtime.Serialization.EnumMember(Value = @"Radio")] Radio = 5, [System.Runtime.Serialization.EnumMember(Value = @"RichText")] RichText = 6, [System.Runtime.Serialization.EnumMember(Value = @"Slug")] Slug = 7, [System.Runtime.Serialization.EnumMember(Value = @"StockPhoto")] StockPhoto = 8, [System.Runtime.Serialization.EnumMember(Value = @"TextArea")] TextArea = 9, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class TagsFieldPropertiesDto : FieldPropertiesDto { /// /// The language specific default value for the field value. /// [Newtonsoft.Json.JsonProperty("defaultValues", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public LocalizedValueOfReadonlyListOfString DefaultValues { get; set; } /// /// The default value. /// [Newtonsoft.Json.JsonProperty("defaultValue", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List DefaultValue { get; set; } /// /// The minimum allowed items for the field value. /// [Newtonsoft.Json.JsonProperty("minItems", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MinItems { get; set; } /// /// The maximum allowed items for the field value. /// [Newtonsoft.Json.JsonProperty("maxItems", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? MaxItems { get; set; } /// /// The allowed values for the field value. /// [Newtonsoft.Json.JsonProperty("allowedValues", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List AllowedValues { get; set; } /// /// Indicates whether GraphQL Enum should be created. /// [Newtonsoft.Json.JsonProperty("createEnum", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool CreateEnum { get; set; } /// /// The editor that is used to manage this field. /// [Newtonsoft.Json.JsonProperty("editor", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public TagsFieldEditor Editor { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum TagsFieldEditor { [System.Runtime.Serialization.EnumMember(Value = @"Tags")] Tags = 0, [System.Runtime.Serialization.EnumMember(Value = @"Checkboxes")] Checkboxes = 1, [System.Runtime.Serialization.EnumMember(Value = @"Dropdown")] Dropdown = 2, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class UIFieldPropertiesDto : FieldPropertiesDto { /// /// The editor that is used to manage this field. /// [Newtonsoft.Json.JsonProperty("editor", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public UIFieldEditor Editor { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum UIFieldEditor { [System.Runtime.Serialization.EnumMember(Value = @"Separator")] Separator = 0, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class NestedFieldDto : Resource { /// /// The id of the field. /// [Newtonsoft.Json.JsonProperty("fieldId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long FieldId { get; set; } /// /// The name of the field. Must be unique within the schema. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] [System.ComponentModel.DataAnnotations.RegularExpression(@"^[a-z0-9]+(\-[a-z0-9]+)*$")] public string Name { get; set; } /// /// Defines if the field is hidden. /// [Newtonsoft.Json.JsonProperty("isHidden", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsHidden { get; set; } /// /// Defines if the field is locked. /// [Newtonsoft.Json.JsonProperty("isLocked", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsLocked { get; set; } /// /// Defines if the field is disabled. /// [Newtonsoft.Json.JsonProperty("isDisabled", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsDisabled { get; set; } /// /// The field properties. /// [Newtonsoft.Json.JsonProperty("properties", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public FieldPropertiesDto Properties { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class StatusInfoDto { /// /// The name of the status. /// [Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Status { get; set; } /// /// The color of the status. /// [Newtonsoft.Json.JsonProperty("color", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Color { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class AllContentsByPostDto { /// /// The list of ids to query. /// [Newtonsoft.Json.JsonProperty("ids", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List Ids { get; set; } /// /// The start of the schedule. /// [Newtonsoft.Json.JsonProperty("scheduledFrom", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset? ScheduledFrom { get; set; } /// /// The end of the schedule. /// [Newtonsoft.Json.JsonProperty("scheduledTo", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset? ScheduledTo { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class QueryDto { /// /// The optional list of ids to query. /// [Newtonsoft.Json.JsonProperty("ids", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List Ids { get; set; } /// /// The optional odata query. /// [Newtonsoft.Json.JsonProperty("oData", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string OData { get; set; } /// /// The optional json query. /// [Newtonsoft.Json.JsonProperty("q", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public object Q { get; set; } /// /// The parent id (for assets). /// [Newtonsoft.Json.JsonProperty("parentId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string ParentId { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class BulkResultDto { /// /// The error when the bulk job failed. /// [Newtonsoft.Json.JsonProperty("error", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public ErrorDto Error { get; set; } /// /// The index of the bulk job where the result belongs to. The order can change. /// [Newtonsoft.Json.JsonProperty("jobIndex", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int JobIndex { get; set; } /// /// The id of the entity that has been handled successfully or not. /// [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Id { get; set; } /// /// The id of the entity that has been handled successfully or not. /// [Newtonsoft.Json.JsonProperty("contentId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.Obsolete("Use \'id\' field now.")] public string ContentId { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ErrorDto { /// /// Error message. /// [Newtonsoft.Json.JsonProperty("message", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Message { get; set; } /// /// The error code. /// [Newtonsoft.Json.JsonProperty("errorCode", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string ErrorCode { get; set; } /// /// The optional trace id. /// [Newtonsoft.Json.JsonProperty("traceId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string TraceId { get; set; } /// /// Link to the error details. /// [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Type { get; set; } /// /// Detailed error messages. /// [Newtonsoft.Json.JsonProperty("details", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List Details { get; set; } /// /// Status code of the http response. /// [Newtonsoft.Json.JsonProperty("statusCode", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int StatusCode { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ImportContentsDto { /// /// The data to import. /// [Newtonsoft.Json.JsonProperty("datas", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Datas { get; set; } = new System.Collections.Generic.List(); /// /// True to automatically publish the content. /// [Newtonsoft.Json.JsonProperty("publish", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.Obsolete("Use bulk endpoint now.")] public bool Publish { get; set; } /// /// True to turn off scripting for faster inserts. Default: true. /// [Newtonsoft.Json.JsonProperty("doNotScript", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool DoNotScript { get; set; } /// /// True to turn off costly validation: Unique checks, asset checks and reference checks. Default: true. /// [Newtonsoft.Json.JsonProperty("optimizeValidation", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool OptimizeValidation { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class BulkUpdateContentsDto { /// /// The contents to update or insert. /// [Newtonsoft.Json.JsonProperty("jobs", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Jobs { get; set; } = new System.Collections.Generic.List(); /// /// True to automatically publish the content. /// [Newtonsoft.Json.JsonProperty("publish", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.Obsolete("Use \'jobs.status\' fields now.")] public bool Publish { get; set; } /// /// True to turn off scripting for faster inserts. Default: true. /// [Newtonsoft.Json.JsonProperty("doNotScript", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool DoNotScript { get; set; } /// /// True to turn off validation for faster inserts. Default: false. /// [Newtonsoft.Json.JsonProperty("doNotValidate", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool DoNotValidate { get; set; } /// /// True to turn off validation of workflow rules. Default: false. /// [Newtonsoft.Json.JsonProperty("doNotValidateWorkflow", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool DoNotValidateWorkflow { get; set; } /// /// True to check referrers of deleted contents. /// [Newtonsoft.Json.JsonProperty("checkReferrers", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool CheckReferrers { get; set; } /// /// True to turn off costly validation: Unique checks, asset checks and reference checks. Default: true. /// [Newtonsoft.Json.JsonProperty("optimizeValidation", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool OptimizeValidation { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class BulkUpdateContentsJobDto { /// /// An optional query to identify the content to update. /// [Newtonsoft.Json.JsonProperty("query", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public JsonQueryDto Query { get; set; } /// /// An optional id of the content to update. /// [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Id { get; set; } /// /// The data of the content when type is set to 'Upsert', 'Create', 'Update' or 'Patch. /// [Newtonsoft.Json.JsonProperty("data", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public ContentData Data { get; set; } /// /// The new status when the type is set to 'ChangeStatus' or 'Upsert'. /// [Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Status { get; set; } /// /// The due time. /// [Newtonsoft.Json.JsonProperty("dueTime", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset? DueTime { get; set; } /// /// The update type. /// [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public BulkUpdateContentType Type { get; set; } /// /// The optional schema id or name. /// [Newtonsoft.Json.JsonProperty("schema", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Schema { get; set; } /// /// Makes the update as patch. /// [Newtonsoft.Json.JsonProperty("patch", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool Patch { get; set; } /// /// True to delete the content permanently. /// [Newtonsoft.Json.JsonProperty("permanent", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool Permanent { get; set; } /// /// The number of expected items. Set it to a higher number to update multiple items when a query is defined. /// [Newtonsoft.Json.JsonProperty("expectedCount", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long ExpectedCount { get; set; } /// /// The expected version. /// [Newtonsoft.Json.JsonProperty("expectedVersion", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long ExpectedVersion { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class JsonQueryDto { [Newtonsoft.Json.JsonProperty("filter", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public object Filter { get; set; } [Newtonsoft.Json.JsonProperty("fullText", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string FullText { get; set; } [Newtonsoft.Json.JsonProperty("skip", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long Skip { get; set; } [Newtonsoft.Json.JsonProperty("take", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long Take { get; set; } [Newtonsoft.Json.JsonProperty("top", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long Top { get; set; } [Newtonsoft.Json.JsonProperty("sort", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List Sort { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class SortNode { [Newtonsoft.Json.JsonProperty("path", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public PropertyPath Path { get; set; } [Newtonsoft.Json.JsonProperty("order", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public SortOrder Order { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class PropertyPath : System.Collections.Generic.List { } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum SortOrder { [System.Runtime.Serialization.EnumMember(Value = @"Ascending")] Ascending = 0, [System.Runtime.Serialization.EnumMember(Value = @"Descending")] Descending = 1, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum BulkUpdateContentType { [System.Runtime.Serialization.EnumMember(Value = @"Upsert")] Upsert = 0, [System.Runtime.Serialization.EnumMember(Value = @"ChangeStatus")] ChangeStatus = 1, [System.Runtime.Serialization.EnumMember(Value = @"Create")] Create = 2, [System.Runtime.Serialization.EnumMember(Value = @"Delete")] Delete = 3, [System.Runtime.Serialization.EnumMember(Value = @"Patch")] Patch = 4, [System.Runtime.Serialization.EnumMember(Value = @"Update")] Update = 5, [System.Runtime.Serialization.EnumMember(Value = @"Validate")] Validate = 6, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ChangeStatusDto { /// /// The new status. /// [Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Status { get; set; } /// /// The due time. /// [Newtonsoft.Json.JsonProperty("dueTime", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset? DueTime { get; set; } /// /// True to check referrers of this content. /// [Newtonsoft.Json.JsonProperty("checkReferrers", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool CheckReferrers { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ResourcesDto : Resource { } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class TranslationDto { /// /// The result of the translation. /// [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public TranslationResultCode Result { get; set; } /// /// The translated text. /// [Newtonsoft.Json.JsonProperty("text", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Text { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum TranslationResultCode { [System.Runtime.Serialization.EnumMember(Value = @"Translated")] Translated = 0, [System.Runtime.Serialization.EnumMember(Value = @"LanguageNotSupported")] LanguageNotSupported = 1, [System.Runtime.Serialization.EnumMember(Value = @"NotTranslated")] NotTranslated = 2, [System.Runtime.Serialization.EnumMember(Value = @"NotConfigured")] NotConfigured = 3, [System.Runtime.Serialization.EnumMember(Value = @"Unauthorized")] Unauthorized = 4, [System.Runtime.Serialization.EnumMember(Value = @"Failed")] Failed = 5, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class TranslateDto { /// /// The text to translate. /// [Newtonsoft.Json.JsonProperty("text", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Text { get; set; } /// /// The target language. /// [Newtonsoft.Json.JsonProperty("targetLanguage", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string TargetLanguage { get; set; } /// /// The optional source language. /// [Newtonsoft.Json.JsonProperty("sourceLanguage", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string SourceLanguage { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class TemplatesDto : Resource { /// /// The event consumers. /// [Newtonsoft.Json.JsonProperty("items", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List Items { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class TemplateDto : Resource { /// /// The name of the template. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Name { get; set; } /// /// The title of the template. /// [Newtonsoft.Json.JsonProperty("title", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Title { get; set; } /// /// The description of the template. /// [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Description { get; set; } /// /// True, if the template is a starter. /// [Newtonsoft.Json.JsonProperty("isStarter", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsStarter { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class TemplateDetailsDto : Resource { /// /// The details of the template. /// [Newtonsoft.Json.JsonProperty("details", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Details { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class LogDownloadDto { /// /// The url to download the log. /// [Newtonsoft.Json.JsonProperty("downloadUrl", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string DownloadUrl { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class CallsUsageDtoDto { /// /// The total number of API calls. /// [Newtonsoft.Json.JsonProperty("totalCalls", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long TotalCalls { get; set; } /// /// The total number of bytes transferred. /// [Newtonsoft.Json.JsonProperty("totalBytes", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long TotalBytes { get; set; } /// /// The total number of API calls this month. /// [Newtonsoft.Json.JsonProperty("monthCalls", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long MonthCalls { get; set; } /// /// The total number of bytes transferred this month. /// [Newtonsoft.Json.JsonProperty("monthBytes", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long MonthBytes { get; set; } /// /// The amount of calls that will block the app. /// [Newtonsoft.Json.JsonProperty("blockingApiCalls", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long BlockingApiCalls { get; set; } /// /// The included API traffic. /// [Newtonsoft.Json.JsonProperty("allowedBytes", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long AllowedBytes { get; set; } /// /// The included API calls. /// [Newtonsoft.Json.JsonProperty("allowedCalls", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long AllowedCalls { get; set; } /// /// The average duration in milliseconds. /// [Newtonsoft.Json.JsonProperty("averageElapsedMs", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public double AverageElapsedMs { get; set; } /// /// The statistics by date and group. /// [Newtonsoft.Json.JsonProperty("details", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.Dictionary> Details { get; set; } = new System.Collections.Generic.Dictionary>(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class CallsUsagePerDateDto { /// /// The date when the usage was tracked. /// [Newtonsoft.Json.JsonProperty("date", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(DateFormatConverter))] public System.DateTimeOffset Date { get; set; } /// /// The total number of API calls. /// [Newtonsoft.Json.JsonProperty("totalCalls", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long TotalCalls { get; set; } /// /// The total number of bytes transferred. /// [Newtonsoft.Json.JsonProperty("totalBytes", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long TotalBytes { get; set; } /// /// The average duration in milliseconds. /// [Newtonsoft.Json.JsonProperty("averageElapsedMs", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public double AverageElapsedMs { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class CurrentStorageDto { /// /// The size in bytes. /// [Newtonsoft.Json.JsonProperty("size", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long Size { get; set; } /// /// The maximum allowed asset size. /// [Newtonsoft.Json.JsonProperty("maxAllowed", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long MaxAllowed { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class StorageUsagePerDateDto { /// /// The date when the usage was tracked. /// [Newtonsoft.Json.JsonProperty("date", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(DateFormatConverter))] public System.DateTimeOffset Date { get; set; } /// /// The number of assets. /// [Newtonsoft.Json.JsonProperty("totalCount", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long TotalCount { get; set; } /// /// The size in bytes. /// [Newtonsoft.Json.JsonProperty("totalSize", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long TotalSize { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class SearchResultDto : Resource { /// /// The name of the search result. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Name { get; set; } /// /// The type of the search result. /// [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public SearchResultType Type { get; set; } /// /// An optional label. /// [Newtonsoft.Json.JsonProperty("label", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Label { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum SearchResultType { [System.Runtime.Serialization.EnumMember(Value = @"Asset")] Asset = 0, [System.Runtime.Serialization.EnumMember(Value = @"Content")] Content = 1, [System.Runtime.Serialization.EnumMember(Value = @"Dashboard")] Dashboard = 2, [System.Runtime.Serialization.EnumMember(Value = @"Setting")] Setting = 3, [System.Runtime.Serialization.EnumMember(Value = @"Rule")] Rule = 4, [System.Runtime.Serialization.EnumMember(Value = @"Schema")] Schema = 5, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class SchemaDto : Resource { /// /// The id of the schema. /// [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Id { get; set; } /// /// The user that has created the schema. /// [Newtonsoft.Json.JsonProperty("createdBy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string CreatedBy { get; set; } /// /// The user that has updated the schema. /// [Newtonsoft.Json.JsonProperty("lastModifiedBy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string LastModifiedBy { get; set; } /// /// The name of the schema. Unique within the app. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] [System.ComponentModel.DataAnnotations.RegularExpression(@"^[a-z0-9]+(\-[a-z0-9]+)*$")] public string Name { get; set; } /// /// The type of the schema. /// [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public SchemaType Type { get; set; } /// /// The name of the category. /// [Newtonsoft.Json.JsonProperty("category", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Category { get; set; } /// /// The schema properties. /// [Newtonsoft.Json.JsonProperty("properties", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public SchemaPropertiesDto Properties { get; set; } = new SchemaPropertiesDto(); /// /// Indicates if the schema is a singleton. /// [Newtonsoft.Json.JsonProperty("isSingleton", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.Obsolete("Use \'type\' field now.")] public bool IsSingleton { get; set; } /// /// Indicates if the schema is published. /// [Newtonsoft.Json.JsonProperty("isPublished", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsPublished { get; set; } /// /// The date and time when the schema has been created. /// [Newtonsoft.Json.JsonProperty("created", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset Created { get; set; } /// /// The date and time when the schema has been modified last. /// [Newtonsoft.Json.JsonProperty("lastModified", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset LastModified { get; set; } /// /// The version of the schema. /// [Newtonsoft.Json.JsonProperty("version", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long Version { get; set; } /// /// The scripts. /// [Newtonsoft.Json.JsonProperty("scripts", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public SchemaScriptsDto Scripts { get; set; } = new SchemaScriptsDto(); /// /// The preview Urls. /// [Newtonsoft.Json.JsonProperty("previewUrls", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.Dictionary PreviewUrls { get; set; } = new System.Collections.Generic.Dictionary(); /// /// The name of fields that are used in content lists. /// [Newtonsoft.Json.JsonProperty("fieldsInLists", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.ICollection FieldsInLists { get; set; } = new FieldNames(); /// /// The name of fields that are used in content references. /// [Newtonsoft.Json.JsonProperty("fieldsInReferences", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.ICollection FieldsInReferences { get; set; } = new FieldNames(); /// /// The field rules. /// [Newtonsoft.Json.JsonProperty("fieldRules", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List FieldRules { get; set; } /// /// The list of fields. /// [Newtonsoft.Json.JsonProperty("fields", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Fields { get; set; } = new System.Collections.Generic.List(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum SchemaType { [System.Runtime.Serialization.EnumMember(Value = @"Default")] Default = 0, [System.Runtime.Serialization.EnumMember(Value = @"Singleton")] Singleton = 1, [System.Runtime.Serialization.EnumMember(Value = @"Component")] Component = 2, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class SchemaPropertiesDto { /// /// Optional label for the editor. /// [Newtonsoft.Json.JsonProperty("label", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.StringLength(100)] public string Label { get; set; } /// /// Hints to describe the schema. /// [Newtonsoft.Json.JsonProperty("hints", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.StringLength(1000)] public string Hints { get; set; } /// /// The url to a the sidebar plugin for content lists. /// [Newtonsoft.Json.JsonProperty("contentsSidebarUrl", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string ContentsSidebarUrl { get; set; } /// /// The url to a the sidebar plugin for content items. /// [Newtonsoft.Json.JsonProperty("contentSidebarUrl", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string ContentSidebarUrl { get; set; } /// /// The url to the editor plugin. /// [Newtonsoft.Json.JsonProperty("contentEditorUrl", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string ContentEditorUrl { get; set; } /// /// True to validate the content items on publish. /// [Newtonsoft.Json.JsonProperty("validateOnPublish", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool ValidateOnPublish { get; set; } /// /// Tags for automation processes. /// [Newtonsoft.Json.JsonProperty("tags", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List Tags { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class SchemaScriptsDto { /// /// The script that is executed for each content when querying contents. /// [Newtonsoft.Json.JsonProperty("query", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Query { get; set; } /// /// The script that is executed for all contents when querying contents. /// [Newtonsoft.Json.JsonProperty("queryPre", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string QueryPre { get; set; } /// /// The script that is executed when creating a content. /// [Newtonsoft.Json.JsonProperty("create", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Create { get; set; } /// /// The script that is executed when updating a content. /// [Newtonsoft.Json.JsonProperty("update", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Update { get; set; } /// /// The script that is executed when deleting a content. /// [Newtonsoft.Json.JsonProperty("delete", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Delete { get; set; } /// /// The script that is executed when change a content status. /// [Newtonsoft.Json.JsonProperty("change", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Change { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class FieldNames : System.Collections.Generic.List { } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class FieldRuleDto { /// /// The action to perform when the condition is met. /// [Newtonsoft.Json.JsonProperty("action", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public FieldRuleAction Action { get; set; } /// /// The field to update. /// [Newtonsoft.Json.JsonProperty("field", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Field { get; set; } /// /// The condition. /// [Newtonsoft.Json.JsonProperty("condition", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Condition { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum FieldRuleAction { [System.Runtime.Serialization.EnumMember(Value = @"Disable")] Disable = 0, [System.Runtime.Serialization.EnumMember(Value = @"Hide")] Hide = 1, [System.Runtime.Serialization.EnumMember(Value = @"Require")] Require = 2, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class AddFieldDto { /// /// The name of the field. Must be unique within the schema. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] [System.ComponentModel.DataAnnotations.RegularExpression(@"^[a-zA-Z0-9]+(\-[a-zA-Z0-9]+)*$")] public string Name { get; set; } /// /// Determines the optional partitioning of the field. /// [Newtonsoft.Json.JsonProperty("partitioning", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Partitioning { get; set; } /// /// The field properties. /// [Newtonsoft.Json.JsonProperty("properties", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public FieldPropertiesDto Properties { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ConfigureUIFieldsDto { /// /// The name of fields that are used in content lists. /// [Newtonsoft.Json.JsonProperty("fieldsInLists", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.ICollection FieldsInLists { get; set; } /// /// The name of fields that are used in content references. /// [Newtonsoft.Json.JsonProperty("fieldsInReferences", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.ICollection FieldsInReferences { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ReorderFieldsDto { /// /// The field ids in the target order. /// [Newtonsoft.Json.JsonProperty("fieldIds", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List FieldIds { get; set; } = new System.Collections.Generic.List(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class UpdateFieldDto { /// /// The field properties. /// [Newtonsoft.Json.JsonProperty("properties", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public FieldPropertiesDto Properties { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class SchemasDto : Resource { /// /// The schemas. /// [Newtonsoft.Json.JsonProperty("items", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List Items { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class CreateSchemaDto : UpsertSchemaDto { /// /// The name of the schema. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] [System.ComponentModel.DataAnnotations.RegularExpression(@"^[a-z0-9]+(\-[a-z0-9]+)*$")] public string Name { get; set; } /// /// The type of the schema. /// [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public SchemaType Type { get; set; } /// /// Set to true to allow a single content item only. /// [Newtonsoft.Json.JsonProperty("isSingleton", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.Obsolete("Use \'type\' field now.")] public bool IsSingleton { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public abstract partial class UpsertSchemaDto { /// /// The optional properties. /// [Newtonsoft.Json.JsonProperty("properties", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public SchemaPropertiesDto Properties { get; set; } /// /// The optional scripts. /// [Newtonsoft.Json.JsonProperty("scripts", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public SchemaScriptsDto Scripts { get; set; } /// /// The names of the fields that should be used in references. /// [Newtonsoft.Json.JsonProperty("fieldsInReferences", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.ICollection FieldsInReferences { get; set; } /// /// The names of the fields that should be shown in lists, including meta fields. /// [Newtonsoft.Json.JsonProperty("fieldsInLists", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.ICollection FieldsInLists { get; set; } /// /// Optional fields. /// [Newtonsoft.Json.JsonProperty("fields", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List Fields { get; set; } /// /// The optional preview urls. /// [Newtonsoft.Json.JsonProperty("previewUrls", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.Dictionary PreviewUrls { get; set; } /// /// The optional field Rules. /// [Newtonsoft.Json.JsonProperty("fieldRules", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List FieldRules { get; set; } /// /// The category. /// [Newtonsoft.Json.JsonProperty("category", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Category { get; set; } /// /// Set it to true to autopublish the schema. /// [Newtonsoft.Json.JsonProperty("isPublished", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsPublished { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class UpsertSchemaFieldDto { /// /// The name of the field. Must be unique within the schema. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] [System.ComponentModel.DataAnnotations.RegularExpression(@"^[a-zA-Z0-9]+(\-[a-zA-Z0-9]+)*$")] public string Name { get; set; } /// /// Defines if the field is hidden. /// [Newtonsoft.Json.JsonProperty("isHidden", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsHidden { get; set; } /// /// Defines if the field is locked. /// [Newtonsoft.Json.JsonProperty("isLocked", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsLocked { get; set; } /// /// Defines if the field is disabled. /// [Newtonsoft.Json.JsonProperty("isDisabled", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsDisabled { get; set; } /// /// Determines the optional partitioning of the field. /// [Newtonsoft.Json.JsonProperty("partitioning", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Partitioning { get; set; } /// /// The field properties. /// [Newtonsoft.Json.JsonProperty("properties", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public FieldPropertiesDto Properties { get; set; } /// /// The nested fields. /// [Newtonsoft.Json.JsonProperty("nested", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List Nested { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class UpsertSchemaNestedFieldDto { /// /// The name of the field. Must be unique within the schema. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] [System.ComponentModel.DataAnnotations.RegularExpression(@"^[a-zA-Z0-9]+(\-[a-zA-Z0-9]+)*$")] public string Name { get; set; } /// /// Defines if the field is hidden. /// [Newtonsoft.Json.JsonProperty("isHidden", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsHidden { get; set; } /// /// Defines if the field is locked. /// [Newtonsoft.Json.JsonProperty("isLocked", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsLocked { get; set; } /// /// Defines if the field is disabled. /// [Newtonsoft.Json.JsonProperty("isDisabled", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsDisabled { get; set; } /// /// The field properties. /// [Newtonsoft.Json.JsonProperty("properties", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public FieldPropertiesDto Properties { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class UpdateSchemaDto { /// /// Optional label for the editor. /// [Newtonsoft.Json.JsonProperty("label", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.StringLength(100)] public string Label { get; set; } /// /// Hints to describe the schema. /// [Newtonsoft.Json.JsonProperty("hints", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.StringLength(1000)] public string Hints { get; set; } /// /// The url to a the sidebar plugin for content lists. /// [Newtonsoft.Json.JsonProperty("contentsSidebarUrl", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string ContentsSidebarUrl { get; set; } /// /// The url to a the sidebar plugin for content items. /// [Newtonsoft.Json.JsonProperty("contentSidebarUrl", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string ContentSidebarUrl { get; set; } /// /// The url to the editor plugin. /// [Newtonsoft.Json.JsonProperty("contentEditorUrl", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string ContentEditorUrl { get; set; } /// /// True to validate the content items on publish. /// [Newtonsoft.Json.JsonProperty("validateOnPublish", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool ValidateOnPublish { get; set; } /// /// Tags for automation processes. /// [Newtonsoft.Json.JsonProperty("tags", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List Tags { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class SynchronizeSchemaDto : UpsertSchemaDto { /// /// True, when fields should not be deleted. /// [Newtonsoft.Json.JsonProperty("noFieldDeletion", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool NoFieldDeletion { get; set; } /// /// True, when fields with different types should not be recreated. /// [Newtonsoft.Json.JsonProperty("noFieldRecreation", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool NoFieldRecreation { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ChangeCategoryDto { /// /// The name of the category. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Name { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ConfigurePreviewUrlsDto : System.Collections.Generic.Dictionary { } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ConfigureFieldRulesDto { /// /// The field rules to configure. /// [Newtonsoft.Json.JsonProperty("fieldRules", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List FieldRules { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class RuleElementDto { /// /// Describes the action or trigger type. /// [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Description { get; set; } /// /// The label for the action or trigger type. /// [Newtonsoft.Json.JsonProperty("display", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Display { get; set; } /// /// Optional title. /// [Newtonsoft.Json.JsonProperty("title", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Title { get; set; } /// /// The color for the icon. /// [Newtonsoft.Json.JsonProperty("iconColor", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string IconColor { get; set; } /// /// The image for the icon. /// [Newtonsoft.Json.JsonProperty("iconImage", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string IconImage { get; set; } /// /// The optional link to the product that is integrated. /// [Newtonsoft.Json.JsonProperty("readMore", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string ReadMore { get; set; } /// /// The properties. /// [Newtonsoft.Json.JsonProperty("properties", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Properties { get; set; } = new System.Collections.Generic.List(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class RuleElementPropertyDto { /// /// The html editor. /// [Newtonsoft.Json.JsonProperty("editor", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public RuleFieldEditor Editor { get; set; } /// /// The name of the editor. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Name { get; set; } /// /// The label to use. /// [Newtonsoft.Json.JsonProperty("display", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Display { get; set; } /// /// The options, if the editor is a dropdown. /// [Newtonsoft.Json.JsonProperty("options", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List Options { get; set; } /// /// The optional description. /// [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Description { get; set; } /// /// Indicates if the property is formattable. /// [Newtonsoft.Json.JsonProperty("isFormattable", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsFormattable { get; set; } /// /// Indicates if the property is required. /// [Newtonsoft.Json.JsonProperty("isRequired", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsRequired { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum RuleFieldEditor { [System.Runtime.Serialization.EnumMember(Value = @"Checkbox")] Checkbox = 0, [System.Runtime.Serialization.EnumMember(Value = @"Dropdown")] Dropdown = 1, [System.Runtime.Serialization.EnumMember(Value = @"Email")] Email = 2, [System.Runtime.Serialization.EnumMember(Value = @"Javascript")] Javascript = 3, [System.Runtime.Serialization.EnumMember(Value = @"Number")] Number = 4, [System.Runtime.Serialization.EnumMember(Value = @"Password")] Password = 5, [System.Runtime.Serialization.EnumMember(Value = @"Text")] Text = 6, [System.Runtime.Serialization.EnumMember(Value = @"TextArea")] TextArea = 7, [System.Runtime.Serialization.EnumMember(Value = @"Url")] Url = 8, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class RulesDto : Resource { /// /// The rules. /// [Newtonsoft.Json.JsonProperty("items", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Items { get; set; } = new System.Collections.Generic.List(); /// /// The id of the rule that is currently rerunning. /// [Newtonsoft.Json.JsonProperty("runningRuleId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string RunningRuleId { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class RuleDto : Resource { /// /// The id of the rule. /// [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Id { get; set; } /// /// The user that has created the rule. /// [Newtonsoft.Json.JsonProperty("createdBy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string CreatedBy { get; set; } /// /// The user that has updated the rule. /// [Newtonsoft.Json.JsonProperty("lastModifiedBy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string LastModifiedBy { get; set; } /// /// The date and time when the rule has been created. /// [Newtonsoft.Json.JsonProperty("created", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset Created { get; set; } /// /// The date and time when the rule has been modified last. /// [Newtonsoft.Json.JsonProperty("lastModified", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset LastModified { get; set; } /// /// The version of the rule. /// [Newtonsoft.Json.JsonProperty("version", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long Version { get; set; } /// /// Determines if the rule is enabled. /// [Newtonsoft.Json.JsonProperty("isEnabled", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsEnabled { get; set; } /// /// Optional rule name. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Name { get; set; } /// /// The trigger properties. /// [Newtonsoft.Json.JsonProperty("trigger", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public RuleTriggerDto Trigger { get; set; } /// /// The action properties. /// [Newtonsoft.Json.JsonProperty("action", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public RuleAction Action { get; set; } /// /// The number of completed executions. /// [Newtonsoft.Json.JsonProperty("numSucceeded", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int NumSucceeded { get; set; } /// /// The number of failed executions. /// [Newtonsoft.Json.JsonProperty("numFailed", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int NumFailed { get; set; } /// /// The date and time when the rule was executed the last time. /// [Newtonsoft.Json.JsonProperty("lastExecuted", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset? LastExecuted { get; set; } } [Newtonsoft.Json.JsonConverter(typeof(JsonInheritanceConverter), "triggerType")] [JsonInheritanceAttribute("AssetChanged", typeof(AssetChangedRuleTriggerDto))] [JsonInheritanceAttribute("Comment", typeof(CommentRuleTriggerDto))] [JsonInheritanceAttribute("ContentChanged", typeof(ContentChangedRuleTriggerDto))] [JsonInheritanceAttribute("Manual", typeof(ManualRuleTriggerDto))] [JsonInheritanceAttribute("SchemaChanged", typeof(SchemaChangedRuleTriggerDto))] [JsonInheritanceAttribute("Usage", typeof(UsageRuleTriggerDto))] [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public abstract partial class RuleTriggerDto { } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class AssetChangedRuleTriggerDto : RuleTriggerDto { /// /// Javascript condition when to trigger. /// [Newtonsoft.Json.JsonProperty("condition", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Condition { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class CommentRuleTriggerDto : RuleTriggerDto { /// /// Javascript condition when to trigger. /// [Newtonsoft.Json.JsonProperty("condition", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Condition { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ContentChangedRuleTriggerDto : RuleTriggerDto { /// /// The schema settings. /// [Newtonsoft.Json.JsonProperty("schemas", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List Schemas { get; set; } /// /// Determines whether the trigger should handle all content changes events. /// [Newtonsoft.Json.JsonProperty("handleAll", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool HandleAll { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ContentChangedRuleTriggerSchemaDto { /// /// The id of the schema. /// [Newtonsoft.Json.JsonProperty("schemaId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string SchemaId { get; set; } /// /// Javascript condition when to trigger. /// [Newtonsoft.Json.JsonProperty("condition", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Condition { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ManualRuleTriggerDto : RuleTriggerDto { } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class SchemaChangedRuleTriggerDto : RuleTriggerDto { /// /// Javascript condition when to trigger. /// [Newtonsoft.Json.JsonProperty("condition", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Condition { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class UsageRuleTriggerDto : RuleTriggerDto { /// /// The number of monthly api calls. /// [Newtonsoft.Json.JsonProperty("limit", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int Limit { get; set; } /// /// The number of days to check or null for the current month. /// [Newtonsoft.Json.JsonProperty("numDays", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Range(1, 30)] public int? NumDays { get; set; } } [Newtonsoft.Json.JsonConverter(typeof(JsonInheritanceConverter), "actionType")] [JsonInheritanceAttribute("Webhook", typeof(WebhookRuleActionDto))] [JsonInheritanceAttribute("Tweet", typeof(TweetRuleActionDto))] [JsonInheritanceAttribute("Slack", typeof(SlackRuleActionDto))] [JsonInheritanceAttribute("SignalR", typeof(SignalRRuleActionDto))] [JsonInheritanceAttribute("Script", typeof(ScriptRuleActionDto))] [JsonInheritanceAttribute("Prerender", typeof(PrerenderRuleActionDto))] [JsonInheritanceAttribute("Notification", typeof(NotificationRuleActionDto))] [JsonInheritanceAttribute("Medium", typeof(MediumRuleActionDto))] [JsonInheritanceAttribute("Fastly", typeof(FastlyRuleActionDto))] [JsonInheritanceAttribute("Email", typeof(EmailRuleActionDto))] [JsonInheritanceAttribute("ElasticSearch", typeof(ElasticSearchRuleActionDto))] [JsonInheritanceAttribute("Discourse", typeof(DiscourseRuleActionDto))] [JsonInheritanceAttribute("CreateContent", typeof(CreateContentRuleActionDto))] [JsonInheritanceAttribute("Comment", typeof(CommentRuleActionDto))] [JsonInheritanceAttribute("AzureQueue", typeof(AzureQueueRuleActionDto))] [JsonInheritanceAttribute("Algolia", typeof(AlgoliaRuleActionDto))] [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public abstract partial class RuleAction { } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class CreateRuleDto { /// /// The trigger properties. /// [Newtonsoft.Json.JsonProperty("trigger", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public RuleTriggerDto Trigger { get; set; } /// /// The action properties. /// [Newtonsoft.Json.JsonProperty("action", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public RuleAction Action { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class UpdateRuleDto { /// /// Optional rule name. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Name { get; set; } /// /// The trigger properties. /// [Newtonsoft.Json.JsonProperty("trigger", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public RuleTriggerDto Trigger { get; set; } /// /// The action properties. /// [Newtonsoft.Json.JsonProperty("action", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public RuleAction Action { get; set; } /// /// Enable or disable the rule. /// [Newtonsoft.Json.JsonProperty("isEnabled", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? IsEnabled { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class SimulatedRuleEventsDto : Resource { /// /// The simulated rule events. /// [Newtonsoft.Json.JsonProperty("items", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Items { get; set; } = new System.Collections.Generic.List(); /// /// The total number of simulated rule events. /// [Newtonsoft.Json.JsonProperty("total", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long Total { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class SimulatedRuleEventDto { /// /// The unique event id. /// [Newtonsoft.Json.JsonProperty("eventId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Guid EventId { get; set; } /// /// The name of the event. /// [Newtonsoft.Json.JsonProperty("eventName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string EventName { get; set; } /// /// The source event. /// [Newtonsoft.Json.JsonProperty("event", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public object Event { get; set; } /// /// The enriched event. /// [Newtonsoft.Json.JsonProperty("enrichedEvent", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public object EnrichedEvent { get; set; } /// /// The data for the action. /// [Newtonsoft.Json.JsonProperty("actionName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string ActionName { get; set; } /// /// The name of the action. /// [Newtonsoft.Json.JsonProperty("actionData", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string ActionData { get; set; } /// /// The name of the event. /// [Newtonsoft.Json.JsonProperty("error", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Error { get; set; } /// /// The reason why the event has been skipped. /// [Newtonsoft.Json.JsonProperty("skipReasons", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ItemConverterType = typeof(Newtonsoft.Json.Converters.StringEnumConverter))] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List SkipReasons { get; set; } = new System.Collections.Generic.List(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] [System.Flags] public enum SkipReason { [System.Runtime.Serialization.EnumMember(Value = @"None")] None = 1, [System.Runtime.Serialization.EnumMember(Value = @"ConditionDoesNotMatch")] ConditionDoesNotMatch = 2, [System.Runtime.Serialization.EnumMember(Value = @"ConditionPrecheckDoesNotMatch")] ConditionPrecheckDoesNotMatch = 4, [System.Runtime.Serialization.EnumMember(Value = @"Disabled")] Disabled = 8, [System.Runtime.Serialization.EnumMember(Value = @"Failed")] Failed = 16, [System.Runtime.Serialization.EnumMember(Value = @"FromRule")] FromRule = 32, [System.Runtime.Serialization.EnumMember(Value = @"NoAction")] NoAction = 64, [System.Runtime.Serialization.EnumMember(Value = @"NoTrigger")] NoTrigger = 128, [System.Runtime.Serialization.EnumMember(Value = @"TooOld")] TooOld = 256, [System.Runtime.Serialization.EnumMember(Value = @"WrongEvent")] WrongEvent = 512, [System.Runtime.Serialization.EnumMember(Value = @"WrongEventForTrigger")] WrongEventForTrigger = 1024, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class RuleEventsDto : Resource { /// /// The rule events. /// [Newtonsoft.Json.JsonProperty("items", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Items { get; set; } = new System.Collections.Generic.List(); /// /// The total number of rule events. /// [Newtonsoft.Json.JsonProperty("total", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long Total { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class RuleEventDto : Resource { /// /// The id of the event. /// [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Id { get; set; } /// /// The time when the event has been created. /// [Newtonsoft.Json.JsonProperty("created", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset Created { get; set; } /// /// The description. /// [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Description { get; set; } /// /// The name of the event. /// [Newtonsoft.Json.JsonProperty("eventName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string EventName { get; set; } /// /// The last dump. /// [Newtonsoft.Json.JsonProperty("lastDump", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string LastDump { get; set; } /// /// The number of calls. /// [Newtonsoft.Json.JsonProperty("numCalls", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int NumCalls { get; set; } /// /// The next attempt. /// [Newtonsoft.Json.JsonProperty("nextAttempt", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset? NextAttempt { get; set; } /// /// The result of the event. /// [Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public RuleResult Result { get; set; } /// /// The result of the job. /// [Newtonsoft.Json.JsonProperty("jobResult", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public RuleJobResult JobResult { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum RuleResult { [System.Runtime.Serialization.EnumMember(Value = @"Pending")] Pending = 0, [System.Runtime.Serialization.EnumMember(Value = @"Success")] Success = 1, [System.Runtime.Serialization.EnumMember(Value = @"Failed")] Failed = 2, [System.Runtime.Serialization.EnumMember(Value = @"Timeout")] Timeout = 3, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum RuleJobResult { [System.Runtime.Serialization.EnumMember(Value = @"Pending")] Pending = 0, [System.Runtime.Serialization.EnumMember(Value = @"Success")] Success = 1, [System.Runtime.Serialization.EnumMember(Value = @"Retry")] Retry = 2, [System.Runtime.Serialization.EnumMember(Value = @"Failed")] Failed = 3, [System.Runtime.Serialization.EnumMember(Value = @"Cancelled")] Cancelled = 4, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class AppPlansDto { /// /// The available plans. /// [Newtonsoft.Json.JsonProperty("plans", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Plans { get; set; } = new System.Collections.Generic.List(); /// /// The current plan id. /// [Newtonsoft.Json.JsonProperty("currentPlanId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string CurrentPlanId { get; set; } /// /// The plan owner. /// [Newtonsoft.Json.JsonProperty("planOwner", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string PlanOwner { get; set; } /// /// Indicates if there is a billing portal. /// [Newtonsoft.Json.JsonProperty("hasPortal", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool HasPortal { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class PlanDto { /// /// The id of the plan. /// [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Id { get; set; } /// /// The name of the plan. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Name { get; set; } /// /// The monthly costs of the plan. /// [Newtonsoft.Json.JsonProperty("costs", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Costs { get; set; } /// /// An optional confirm text for the monthly subscription. /// [Newtonsoft.Json.JsonProperty("confirmText", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string ConfirmText { get; set; } /// /// An optional confirm text for the yearly subscription. /// [Newtonsoft.Json.JsonProperty("yearlyConfirmText", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string YearlyConfirmText { get; set; } /// /// The yearly costs of the plan. /// [Newtonsoft.Json.JsonProperty("yearlyCosts", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string YearlyCosts { get; set; } /// /// The yearly id of the plan. /// [Newtonsoft.Json.JsonProperty("yearlyId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string YearlyId { get; set; } /// /// The maximum number of API traffic. /// [Newtonsoft.Json.JsonProperty("maxApiBytes", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long MaxApiBytes { get; set; } /// /// The maximum number of API calls. /// [Newtonsoft.Json.JsonProperty("maxApiCalls", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long MaxApiCalls { get; set; } /// /// The maximum allowed asset size. /// [Newtonsoft.Json.JsonProperty("maxAssetSize", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long MaxAssetSize { get; set; } /// /// The maximum number of contributors. /// [Newtonsoft.Json.JsonProperty("maxContributors", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int MaxContributors { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class PlanChangedDto { /// /// Optional redirect uri. /// [Newtonsoft.Json.JsonProperty("redirectUri", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string RedirectUri { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ChangePlanDto { /// /// The new plan id. /// [Newtonsoft.Json.JsonProperty("planId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string PlanId { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ExposedValues : System.Collections.Generic.Dictionary { } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class FeaturesDto { /// /// The latest features. /// [Newtonsoft.Json.JsonProperty("features", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Features { get; set; } = new System.Collections.Generic.List(); /// /// The recent version. /// [Newtonsoft.Json.JsonProperty("version", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int Version { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class FeatureDto { /// /// The name of the feature. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Name { get; set; } /// /// The description text. /// [Newtonsoft.Json.JsonProperty("text", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Text { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class LanguageDto { /// /// The iso code of the language. /// [Newtonsoft.Json.JsonProperty("iso2Code", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Iso2Code { get; set; } /// /// The english name of the language. /// [Newtonsoft.Json.JsonProperty("englishName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string EnglishName { get; set; } /// /// The native name of the language. /// [Newtonsoft.Json.JsonProperty("nativeName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string NativeName { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class HistoryEventDto { /// /// The message for the event. /// [Newtonsoft.Json.JsonProperty("message", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Message { get; set; } /// /// The type of the original event. /// [Newtonsoft.Json.JsonProperty("eventType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string EventType { get; set; } /// /// The user who called the action. /// [Newtonsoft.Json.JsonProperty("actor", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Actor { get; set; } /// /// Gets a unique id for the event. /// [Newtonsoft.Json.JsonProperty("eventId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string EventId { get; set; } /// /// The time when the event happened. /// [Newtonsoft.Json.JsonProperty("created", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset Created { get; set; } /// /// The version identifier. /// [Newtonsoft.Json.JsonProperty("version", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long Version { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class CommentsDto { /// /// The created comments including the updates. /// [Newtonsoft.Json.JsonProperty("createdComments", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List CreatedComments { get; set; } /// /// The updates comments since the last version. /// [Newtonsoft.Json.JsonProperty("updatedComments", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List UpdatedComments { get; set; } /// /// The deleted comments since the last version. /// [Newtonsoft.Json.JsonProperty("deletedComments", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List DeletedComments { get; set; } /// /// The current version. /// [Newtonsoft.Json.JsonProperty("version", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long Version { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class CommentDto { /// /// The id of the comment. /// [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Id { get; set; } /// /// The time when the comment was created or updated last. /// [Newtonsoft.Json.JsonProperty("time", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.DateTimeOffset Time { get; set; } /// /// The user who created or updated the comment. /// [Newtonsoft.Json.JsonProperty("user", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string User { get; set; } /// /// The text of the comment. /// [Newtonsoft.Json.JsonProperty("text", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Text { get; set; } /// /// The url where the comment is created. /// [Newtonsoft.Json.JsonProperty("url", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Uri Url { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class UpsertCommentDto { /// /// The comment text. /// [Newtonsoft.Json.JsonProperty("text", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Text { get; set; } /// /// The url where the comment is created. /// [Newtonsoft.Json.JsonProperty("url", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Uri Url { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class BackupJobsDto : Resource { /// /// The backups. /// [Newtonsoft.Json.JsonProperty("items", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Items { get; set; } = new System.Collections.Generic.List(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class BackupJobDto : Resource { /// /// The id of the backup job. /// [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Id { get; set; } /// /// The time when the job has been started. /// [Newtonsoft.Json.JsonProperty("started", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset Started { get; set; } /// /// The time when the job has been stopped. /// [Newtonsoft.Json.JsonProperty("stopped", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset? Stopped { get; set; } /// /// The number of handled events. /// [Newtonsoft.Json.JsonProperty("handledEvents", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int HandledEvents { get; set; } /// /// The number of handled assets. /// [Newtonsoft.Json.JsonProperty("handledAssets", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int HandledAssets { get; set; } /// /// The status of the operation. /// [Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public JobStatus Status { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum JobStatus { [System.Runtime.Serialization.EnumMember(Value = @"Created")] Created = 0, [System.Runtime.Serialization.EnumMember(Value = @"Started")] Started = 1, [System.Runtime.Serialization.EnumMember(Value = @"Completed")] Completed = 2, [System.Runtime.Serialization.EnumMember(Value = @"Failed")] Failed = 3, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class RestoreJobDto { /// /// The uri to load from. /// [Newtonsoft.Json.JsonProperty("url", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Uri Url { get; set; } /// /// The status log. /// [Newtonsoft.Json.JsonProperty("log", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Log { get; set; } = new System.Collections.Generic.List(); /// /// The time when the job has been started. /// [Newtonsoft.Json.JsonProperty("started", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset Started { get; set; } /// /// The time when the job has been stopped. /// [Newtonsoft.Json.JsonProperty("stopped", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset? Stopped { get; set; } /// /// The status of the operation. /// [Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public JobStatus Status { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class RestoreRequestDto { /// /// The name of the app. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.RegularExpression(@"^[a-z0-9]+(\-[a-z0-9]+)*$")] public string Name { get; set; } /// /// The url to the restore file. /// [Newtonsoft.Json.JsonProperty("url", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Uri Url { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum ResizeMode { [System.Runtime.Serialization.EnumMember(Value = @"Crop")] Crop = 0, [System.Runtime.Serialization.EnumMember(Value = @"CropUpsize")] CropUpsize = 1, [System.Runtime.Serialization.EnumMember(Value = @"Pad")] Pad = 2, [System.Runtime.Serialization.EnumMember(Value = @"BoxPad")] BoxPad = 3, [System.Runtime.Serialization.EnumMember(Value = @"Max")] Max = 4, [System.Runtime.Serialization.EnumMember(Value = @"Min")] Min = 5, [System.Runtime.Serialization.EnumMember(Value = @"Stretch")] Stretch = 6, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum ImageFormat { [System.Runtime.Serialization.EnumMember(Value = @"BMP")] BMP = 0, [System.Runtime.Serialization.EnumMember(Value = @"GIF")] GIF = 1, [System.Runtime.Serialization.EnumMember(Value = @"JPEG")] JPEG = 2, [System.Runtime.Serialization.EnumMember(Value = @"PNG")] PNG = 3, [System.Runtime.Serialization.EnumMember(Value = @"TGA")] TGA = 4, [System.Runtime.Serialization.EnumMember(Value = @"TIFF")] TIFF = 5, [System.Runtime.Serialization.EnumMember(Value = @"WEBP")] WEBP = 6, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class AssetFoldersDto : Resource { /// /// The total number of assets. /// [Newtonsoft.Json.JsonProperty("total", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long Total { get; set; } /// /// The assets folders. /// [Newtonsoft.Json.JsonProperty("items", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Items { get; set; } = new System.Collections.Generic.List(); /// /// The path to the current folder. /// [Newtonsoft.Json.JsonProperty("path", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Path { get; set; } = new System.Collections.Generic.List(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class AssetFolderDto : Resource { /// /// The id of the asset. /// [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Id { get; set; } /// /// The id of the parent folder. Empty for files without parent. /// [Newtonsoft.Json.JsonProperty("parentId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string ParentId { get; set; } /// /// The folder name. /// [Newtonsoft.Json.JsonProperty("folderName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string FolderName { get; set; } /// /// The version of the asset folder. /// [Newtonsoft.Json.JsonProperty("version", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long Version { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum AssetFolderScope { [System.Runtime.Serialization.EnumMember(Value = @"PathAndItems")] PathAndItems = 0, [System.Runtime.Serialization.EnumMember(Value = @"Path")] Path = 1, [System.Runtime.Serialization.EnumMember(Value = @"Items")] Items = 2, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class CreateAssetFolderDto { /// /// The name of the folder. /// [Newtonsoft.Json.JsonProperty("folderName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string FolderName { get; set; } /// /// The id of the parent folder. /// [Newtonsoft.Json.JsonProperty("parentId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string ParentId { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class RenameAssetFolderDto { /// /// The name of the folder. /// [Newtonsoft.Json.JsonProperty("folderName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string FolderName { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class MoveAssetFolderDto { /// /// The parent folder id. /// [Newtonsoft.Json.JsonProperty("parentId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string ParentId { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class RenameTagDto { /// /// The new name for the tag. /// [Newtonsoft.Json.JsonProperty("tagName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string TagName { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class AssetsDto : Resource { /// /// The total number of assets. /// [Newtonsoft.Json.JsonProperty("total", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long Total { get; set; } /// /// The assets. /// [Newtonsoft.Json.JsonProperty("items", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Items { get; set; } = new System.Collections.Generic.List(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class AssetDto : Resource { /// /// The id of the asset. /// [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Id { get; set; } /// /// The id of the parent folder. Empty for files without parent. /// [Newtonsoft.Json.JsonProperty("parentId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string ParentId { get; set; } /// /// The file name. /// [Newtonsoft.Json.JsonProperty("fileName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string FileName { get; set; } /// /// The file hash. /// [Newtonsoft.Json.JsonProperty("fileHash", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string FileHash { get; set; } /// /// True, when the asset is not public. /// [Newtonsoft.Json.JsonProperty("isProtected", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsProtected { get; set; } /// /// The slug. /// [Newtonsoft.Json.JsonProperty("slug", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Slug { get; set; } /// /// The mime type. /// [Newtonsoft.Json.JsonProperty("mimeType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string MimeType { get; set; } /// /// The file type. /// [Newtonsoft.Json.JsonProperty("fileType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string FileType { get; set; } /// /// The formatted text representation of the metadata. /// [Newtonsoft.Json.JsonProperty("metadataText", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string MetadataText { get; set; } /// /// The UI token. /// [Newtonsoft.Json.JsonProperty("editToken", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string EditToken { get; set; } /// /// The asset metadata. /// [Newtonsoft.Json.JsonProperty("metadata", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.Dictionary Metadata { get; set; } = new System.Collections.Generic.Dictionary(); /// /// The asset tags. /// [Newtonsoft.Json.JsonProperty("tags", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Tags { get; set; } = new System.Collections.Generic.List(); /// /// The size of the file in bytes. /// [Newtonsoft.Json.JsonProperty("fileSize", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long FileSize { get; set; } /// /// The version of the file. /// [Newtonsoft.Json.JsonProperty("fileVersion", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long FileVersion { get; set; } /// /// The type of the asset. /// [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public AssetType Type { get; set; } /// /// The user that has created the schema. /// [Newtonsoft.Json.JsonProperty("createdBy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string CreatedBy { get; set; } /// /// The user that has updated the asset. /// [Newtonsoft.Json.JsonProperty("lastModifiedBy", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string LastModifiedBy { get; set; } /// /// The date and time when the asset has been created. /// [Newtonsoft.Json.JsonProperty("created", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset Created { get; set; } /// /// The date and time when the asset has been modified last. /// [Newtonsoft.Json.JsonProperty("lastModified", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset LastModified { get; set; } /// /// The version of the asset. /// [Newtonsoft.Json.JsonProperty("version", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long Version { get; set; } /// /// The metadata. /// [Newtonsoft.Json.JsonProperty("_meta", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public AssetMeta _meta { get; set; } /// /// Determines of the created file is an image. /// [Newtonsoft.Json.JsonProperty("isImage", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.Obsolete("Use \'type\' field now.")] public bool IsImage { get; set; } /// /// The width of the image in pixels if the asset is an image. /// [Newtonsoft.Json.JsonProperty("pixelWidth", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.Obsolete("Use \'metdata\' field now.")] public int? PixelWidth { get; set; } /// /// The height of the image in pixels if the asset is an image. /// [Newtonsoft.Json.JsonProperty("pixelHeight", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.Obsolete("Use \'metdata\' field now.")] public int? PixelHeight { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class AssetMeta { /// /// Indicates whether the asset is a duplicate. /// [Newtonsoft.Json.JsonProperty("isDuplicate", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string IsDuplicate { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class BulkUpdateAssetsDto { /// /// The contents to update or insert. /// [Newtonsoft.Json.JsonProperty("jobs", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Jobs { get; set; } = new System.Collections.Generic.List(); /// /// True to check referrers of deleted assets. /// [Newtonsoft.Json.JsonProperty("checkReferrers", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool CheckReferrers { get; set; } /// /// True to turn off costly validation: Folder checks. Default: true. /// [Newtonsoft.Json.JsonProperty("optimizeValidation", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool OptimizeValidation { get; set; } /// /// True to turn off scripting for faster inserts. Default: true. /// [Newtonsoft.Json.JsonProperty("doNotScript", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool DoNotScript { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class BulkUpdateAssetsJobDto { /// /// An optional id of the asset to update. /// [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Id { get; set; } /// /// The update type. /// [Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public BulkUpdateAssetType Type { get; set; } /// /// The parent folder id. /// [Newtonsoft.Json.JsonProperty("parentId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string ParentId { get; set; } /// /// The new name of the asset. /// [Newtonsoft.Json.JsonProperty("fileName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string FileName { get; set; } /// /// The new slug of the asset. /// [Newtonsoft.Json.JsonProperty("slug", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Slug { get; set; } /// /// True, when the asset is not public. /// [Newtonsoft.Json.JsonProperty("isProtected", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? IsProtected { get; set; } /// /// The new asset tags. /// [Newtonsoft.Json.JsonProperty("tags", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List Tags { get; set; } /// /// The asset metadata. /// [Newtonsoft.Json.JsonProperty("metadata", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.Dictionary Metadata { get; set; } /// /// True to delete the asset permanently. /// [Newtonsoft.Json.JsonProperty("permanent", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool Permanent { get; set; } /// /// The expected version. /// [Newtonsoft.Json.JsonProperty("expectedVersion", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long ExpectedVersion { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum BulkUpdateAssetType { [System.Runtime.Serialization.EnumMember(Value = @"Annotate")] Annotate = 0, [System.Runtime.Serialization.EnumMember(Value = @"Move")] Move = 1, [System.Runtime.Serialization.EnumMember(Value = @"Delete")] Delete = 2, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class AnnotateAssetDto { /// /// The new name of the asset. /// [Newtonsoft.Json.JsonProperty("fileName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string FileName { get; set; } /// /// The new slug of the asset. /// [Newtonsoft.Json.JsonProperty("slug", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Slug { get; set; } /// /// True, when the asset is not public. /// [Newtonsoft.Json.JsonProperty("isProtected", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? IsProtected { get; set; } /// /// The new asset tags. /// [Newtonsoft.Json.JsonProperty("tags", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List Tags { get; set; } /// /// The asset metadata. /// [Newtonsoft.Json.JsonProperty("metadata", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.Dictionary Metadata { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class MoveAssetDto { /// /// The parent folder id. /// [Newtonsoft.Json.JsonProperty("parentId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string ParentId { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class AssetScriptsDto : Resource { /// /// The script that is executed when creating an asset. /// [Newtonsoft.Json.JsonProperty("create", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Create { get; set; } /// /// The script that is executed when updating a content. /// [Newtonsoft.Json.JsonProperty("update", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Update { get; set; } /// /// The script that is executed when annotating a content. /// [Newtonsoft.Json.JsonProperty("annotate", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Annotate { get; set; } /// /// The script that is executed when moving a content. /// [Newtonsoft.Json.JsonProperty("move", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Move { get; set; } /// /// The script that is executed when deleting a content. /// [Newtonsoft.Json.JsonProperty("delete", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Delete { get; set; } /// /// The version of the app. /// [Newtonsoft.Json.JsonProperty("version", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long Version { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class UpdateAssetScriptsDto { /// /// The script that is executed when creating an asset. /// [Newtonsoft.Json.JsonProperty("create", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Create { get; set; } /// /// The script that is executed when updating a content. /// [Newtonsoft.Json.JsonProperty("update", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Update { get; set; } /// /// The script that is executed when annotating a content. /// [Newtonsoft.Json.JsonProperty("annotate", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Annotate { get; set; } /// /// The script that is executed when moving a content. /// [Newtonsoft.Json.JsonProperty("move", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Move { get; set; } /// /// The script that is executed when deleting a content. /// [Newtonsoft.Json.JsonProperty("delete", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Delete { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ClientsDto : Resource { /// /// The clients. /// [Newtonsoft.Json.JsonProperty("items", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Items { get; set; } = new System.Collections.Generic.List(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ClientDto : Resource { /// /// The client id. /// [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Id { get; set; } /// /// The client secret. /// [Newtonsoft.Json.JsonProperty("secret", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Secret { get; set; } /// /// The client name. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Name { get; set; } /// /// The role of the client. /// [Newtonsoft.Json.JsonProperty("role", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Role { get; set; } /// /// The number of allowed api calls per month for this client. /// [Newtonsoft.Json.JsonProperty("apiCallsLimit", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long ApiCallsLimit { get; set; } /// /// The number of allowed api traffic bytes per month for this client. /// [Newtonsoft.Json.JsonProperty("apiTrafficLimit", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long ApiTrafficLimit { get; set; } /// /// True to allow anonymous access without an access token for this client. /// [Newtonsoft.Json.JsonProperty("allowAnonymous", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool AllowAnonymous { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class CreateClientDto { /// /// The id of the client. /// [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] [System.ComponentModel.DataAnnotations.RegularExpression(@"^[a-z0-9]+(\-[a-z0-9]+)*$")] public string Id { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class UpdateClientDto { /// /// The new display name of the client. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.StringLength(20)] public string Name { get; set; } /// /// The role of the client. /// [Newtonsoft.Json.JsonProperty("role", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Role { get; set; } /// /// True to allow anonymous access without an access token for this client. /// [Newtonsoft.Json.JsonProperty("allowAnonymous", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? AllowAnonymous { get; set; } /// /// The number of allowed api calls per month for this client. /// [Newtonsoft.Json.JsonProperty("apiCallsLimit", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long? ApiCallsLimit { get; set; } /// /// The number of allowed api traffic bytes per month for this client. /// [Newtonsoft.Json.JsonProperty("apiTrafficLimit", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long? ApiTrafficLimit { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ContributorsDto : Resource { /// /// The contributors. /// [Newtonsoft.Json.JsonProperty("items", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Items { get; set; } = new System.Collections.Generic.List(); /// /// The maximum number of allowed contributors. /// [Newtonsoft.Json.JsonProperty("maxContributors", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int MaxContributors { get; set; } /// /// The metadata to provide information about this request. /// [Newtonsoft.Json.JsonProperty("_meta", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public ContributorsMetadata _meta { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ContributorDto : Resource { /// /// The id of the user that contributes to the app. /// [Newtonsoft.Json.JsonProperty("contributorId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string ContributorId { get; set; } /// /// The display name. /// [Newtonsoft.Json.JsonProperty("contributorName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string ContributorName { get; set; } /// /// The email address. /// [Newtonsoft.Json.JsonProperty("contributorEmail", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string ContributorEmail { get; set; } /// /// The role of the contributor. /// [Newtonsoft.Json.JsonProperty("role", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Role { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ContributorsMetadata { /// /// Indicates whether the user has been invited. /// [Newtonsoft.Json.JsonProperty("isInvited", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string IsInvited { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class AssignContributorDto { /// /// The id or email of the user to add to the app. /// [Newtonsoft.Json.JsonProperty("contributorId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string ContributorId { get; set; } /// /// The role of the contributor. /// [Newtonsoft.Json.JsonProperty("role", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Role { get; set; } /// /// Set to true to invite the user if he does not exist. /// [Newtonsoft.Json.JsonProperty("invite", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool Invite { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class AppLanguagesDto : Resource { /// /// The languages. /// [Newtonsoft.Json.JsonProperty("items", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Items { get; set; } = new System.Collections.Generic.List(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class AppLanguageDto : Resource { /// /// The iso code of the language. /// [Newtonsoft.Json.JsonProperty("iso2Code", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Iso2Code { get; set; } /// /// The english name of the language. /// [Newtonsoft.Json.JsonProperty("englishName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string EnglishName { get; set; } /// /// The fallback languages. /// [Newtonsoft.Json.JsonProperty("fallback", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Fallback { get; set; } = new System.Collections.Generic.List(); /// /// Indicates if the language is the master language. /// [Newtonsoft.Json.JsonProperty("isMaster", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsMaster { get; set; } /// /// Indicates if the language is optional. /// [Newtonsoft.Json.JsonProperty("isOptional", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsOptional { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class AddLanguageDto { /// /// The language to add. /// [Newtonsoft.Json.JsonProperty("language", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Language { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class UpdateLanguageDto { /// /// Set the value to true to make the language the master. /// [Newtonsoft.Json.JsonProperty("isMaster", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool? IsMaster { get; set; } /// /// Set the value to true to make the language optional. /// [Newtonsoft.Json.JsonProperty("isOptional", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsOptional { get; set; } /// /// Optional fallback languages. /// [Newtonsoft.Json.JsonProperty("fallback", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List Fallback { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class RolesDto : Resource { /// /// The roles. /// [Newtonsoft.Json.JsonProperty("items", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Items { get; set; } = new System.Collections.Generic.List(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class RoleDto : Resource { /// /// The role name. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Name { get; set; } /// /// The number of clients with this role. /// [Newtonsoft.Json.JsonProperty("numClients", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int NumClients { get; set; } /// /// The number of contributors with this role. /// [Newtonsoft.Json.JsonProperty("numContributors", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int NumContributors { get; set; } /// /// Indicates if the role is an builtin default role. /// [Newtonsoft.Json.JsonProperty("isDefaultRole", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsDefaultRole { get; set; } /// /// Associated list of permissions. /// [Newtonsoft.Json.JsonProperty("permissions", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Permissions { get; set; } = new System.Collections.Generic.List(); /// /// Associated list of UI properties. /// [Newtonsoft.Json.JsonProperty("properties", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.Dictionary Properties { get; set; } = new System.Collections.Generic.Dictionary(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class AddRoleDto { /// /// The role name. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Name { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class UpdateRoleDto { /// /// Associated list of permissions. /// [Newtonsoft.Json.JsonProperty("permissions", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Permissions { get; set; } = new System.Collections.Generic.List(); /// /// Associated list of UI properties. /// [Newtonsoft.Json.JsonProperty("properties", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.Dictionary Properties { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class AppDto : Resource { /// /// The name of the app. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] [System.ComponentModel.DataAnnotations.RegularExpression(@"^[a-z0-9]+(\-[a-z0-9]+)*$")] public string Name { get; set; } /// /// The optional label of the app. /// [Newtonsoft.Json.JsonProperty("label", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Label { get; set; } /// /// The optional description of the app. /// [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Description { get; set; } /// /// The version of the app. /// [Newtonsoft.Json.JsonProperty("version", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long Version { get; set; } /// /// The id of the app. /// [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Id { get; set; } /// /// The timestamp when the app has been created. /// [Newtonsoft.Json.JsonProperty("created", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset Created { get; set; } /// /// The timestamp when the app has been modified last. /// [Newtonsoft.Json.JsonProperty("lastModified", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.DateTimeOffset LastModified { get; set; } /// /// The permission level of the user. /// [Newtonsoft.Json.JsonProperty("permissions", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List Permissions { get; set; } /// /// Indicates if the user can access the api. /// [Newtonsoft.Json.JsonProperty("canAccessApi", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.Obsolete("Use \'roleProperties\' field now.")] public bool CanAccessApi { get; set; } /// /// Indicates if the user can access at least one content. /// [Newtonsoft.Json.JsonProperty("canAccessContent", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool CanAccessContent { get; set; } /// /// The role name of the user. /// [Newtonsoft.Json.JsonProperty("roleName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string RoleName { get; set; } /// /// The properties from the role. /// [Newtonsoft.Json.JsonProperty("roleProperties", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.Dictionary RoleProperties { get; set; } = new System.Collections.Generic.Dictionary(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class CreateAppDto { /// /// The name of the app. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] [System.ComponentModel.DataAnnotations.RegularExpression(@"^[a-z0-9]+(\-[a-z0-9]+)*$")] public string Name { get; set; } /// /// Initialize the app with the inbuilt template. /// [Newtonsoft.Json.JsonProperty("template", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Template { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class UpdateAppDto { /// /// The optional label of your app. /// [Newtonsoft.Json.JsonProperty("label", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Label { get; set; } /// /// The optional description of your app. /// [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Description { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class AppSettingsDto : Resource { /// /// The configured app patterns. /// [Newtonsoft.Json.JsonProperty("patterns", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Patterns { get; set; } = new System.Collections.Generic.List(); /// /// The configured UI editors. /// [Newtonsoft.Json.JsonProperty("editors", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Editors { get; set; } = new System.Collections.Generic.List(); /// /// Hide the scheduler for content items. /// [Newtonsoft.Json.JsonProperty("hideScheduler", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool HideScheduler { get; set; } /// /// Hide the datetime mode button. /// [Newtonsoft.Json.JsonProperty("hideDateTimeModeButton", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool HideDateTimeModeButton { get; set; } /// /// The version of the app. /// [Newtonsoft.Json.JsonProperty("version", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public long Version { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class PatternDto { /// /// The name of the suggestion. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Name { get; set; } /// /// The regex pattern. /// [Newtonsoft.Json.JsonProperty("regex", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Regex { get; set; } /// /// The regex message. /// [Newtonsoft.Json.JsonProperty("message", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Message { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class EditorDto { /// /// The name of the editor. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Name { get; set; } /// /// The url to the editor. /// [Newtonsoft.Json.JsonProperty("url", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Url { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class UpdateAppSettingsDto { /// /// The configured app patterns. /// [Newtonsoft.Json.JsonProperty("patterns", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Patterns { get; set; } = new System.Collections.Generic.List(); /// /// The configured UI editors. /// [Newtonsoft.Json.JsonProperty("editors", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Editors { get; set; } = new System.Collections.Generic.List(); /// /// Hide the scheduler for content items. /// [Newtonsoft.Json.JsonProperty("hideScheduler", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool HideScheduler { get; set; } /// /// Hide the datetime mode button. /// [Newtonsoft.Json.JsonProperty("hideDateTimeModeButton", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool HideDateTimeModeButton { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class WorkflowsDto : Resource { /// /// The workflow. /// [Newtonsoft.Json.JsonProperty("items", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Items { get; set; } = new System.Collections.Generic.List(); /// /// The errros that should be fixed. /// [Newtonsoft.Json.JsonProperty("errors", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.List Errors { get; set; } = new System.Collections.Generic.List(); } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class WorkflowDto : Resource { /// /// The workflow id. /// [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Id { get; set; } /// /// The name of the workflow. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Name { get; set; } /// /// The workflow steps. /// [Newtonsoft.Json.JsonProperty("steps", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.Dictionary Steps { get; set; } = new System.Collections.Generic.Dictionary(); /// /// The schema ids. /// [Newtonsoft.Json.JsonProperty("schemaIds", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List SchemaIds { get; set; } /// /// The initial step. /// [Newtonsoft.Json.JsonProperty("initial", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Initial { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class WorkflowStepDto { /// /// The transitions. /// [Newtonsoft.Json.JsonProperty("transitions", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.Dictionary Transitions { get; set; } = new System.Collections.Generic.Dictionary(); /// /// The optional color. /// [Newtonsoft.Json.JsonProperty("color", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Color { get; set; } /// /// True if the content should be validated when moving to this step. /// [Newtonsoft.Json.JsonProperty("validate", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool Validate { get; set; } /// /// Indicates if updates should not be allowed. /// [Newtonsoft.Json.JsonProperty("noUpdate", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool NoUpdate { get; set; } /// /// Optional expression that must evaluate to true when you want to prevent updates. /// [Newtonsoft.Json.JsonProperty("noUpdateExpression", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string NoUpdateExpression { get; set; } /// /// Optional list of roles to restrict the updates for users with these roles. /// [Newtonsoft.Json.JsonProperty("noUpdateRoles", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List NoUpdateRoles { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class WorkflowTransitionDto { /// /// The optional expression. /// [Newtonsoft.Json.JsonProperty("expression", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Expression { get; set; } /// /// The optional restricted role. /// [Newtonsoft.Json.JsonProperty("roles", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List Roles { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class AddWorkflowDto { /// /// The name of the workflow. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Name { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class UpdateWorkflowDto { /// /// The name of the workflow. /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Name { get; set; } /// /// The workflow steps. /// [Newtonsoft.Json.JsonProperty("steps", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Collections.Generic.Dictionary Steps { get; set; } = new System.Collections.Generic.Dictionary(); /// /// The schema ids. /// [Newtonsoft.Json.JsonProperty("schemaIds", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public System.Collections.Generic.List SchemaIds { get; set; } /// /// The initial step. /// [Newtonsoft.Json.JsonProperty("initial", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Initial { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class WebhookRuleActionDto : RuleAction { /// /// The url to the webhook. /// [Newtonsoft.Json.JsonProperty("url", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Uri Url { get; set; } /// /// The type of the request. /// [Newtonsoft.Json.JsonProperty("method", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public WebhookMethod Method { get; set; } /// /// Leave it empty to use the full event as body. /// [Newtonsoft.Json.JsonProperty("payload", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Payload { get; set; } /// /// The mime type of the payload. /// [Newtonsoft.Json.JsonProperty("payloadType", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string PayloadType { get; set; } /// /// The message headers in the format '[Key]=[Value]', one entry per line. /// [Newtonsoft.Json.JsonProperty("headers", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Headers { get; set; } /// /// The shared secret that is used to calculate the payload signature. /// [Newtonsoft.Json.JsonProperty("sharedSecret", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string SharedSecret { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum WebhookMethod { [System.Runtime.Serialization.EnumMember(Value = @"POST")] POST = 0, [System.Runtime.Serialization.EnumMember(Value = @"PUT")] PUT = 1, [System.Runtime.Serialization.EnumMember(Value = @"GET")] GET = 2, [System.Runtime.Serialization.EnumMember(Value = @"DELETE")] DELETE = 3, [System.Runtime.Serialization.EnumMember(Value = @"PATCH")] PATCH = 4, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class TweetRuleActionDto : RuleAction { /// /// The generated access token. /// [Newtonsoft.Json.JsonProperty("accessToken", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string AccessToken { get; set; } /// /// The generated access secret. /// [Newtonsoft.Json.JsonProperty("accessSecret", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string AccessSecret { get; set; } /// /// The text that is sent as tweet to twitter. /// [Newtonsoft.Json.JsonProperty("text", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Text { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class SlackRuleActionDto : RuleAction { /// /// The slack webhook url. /// [Newtonsoft.Json.JsonProperty("webhookUrl", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Uri WebhookUrl { get; set; } /// /// The text that is sent as message to slack. /// [Newtonsoft.Json.JsonProperty("text", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Text { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class SignalRRuleActionDto : RuleAction { /// /// The connection string to the Azure SignalR. /// [Newtonsoft.Json.JsonProperty("connectionString", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string ConnectionString { get; set; } /// /// The name of the hub. /// [Newtonsoft.Json.JsonProperty("hubName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string HubName { get; set; } /// /// * Broadcast = send to all users. ///
* User = send to all target users(s). ///
* Group = send to all target group(s). ///
[Newtonsoft.Json.JsonProperty("action", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public ActionTypeEnum Action { get; set; } /// /// Set the Name of the hub method received by the customer. /// [Newtonsoft.Json.JsonProperty("methodName", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string MethodName { get; set; } /// /// Define target users or groups by id or name. One item per line. Not needed for Broadcast action. /// [Newtonsoft.Json.JsonProperty("target", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Target { get; set; } /// /// Leave it empty to use the full event as body. /// [Newtonsoft.Json.JsonProperty("payload", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Payload { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public enum ActionTypeEnum { [System.Runtime.Serialization.EnumMember(Value = @"Broadcast")] Broadcast = 0, [System.Runtime.Serialization.EnumMember(Value = @"User")] User = 1, [System.Runtime.Serialization.EnumMember(Value = @"Group")] Group = 2, } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ScriptRuleActionDto : RuleAction { /// /// The script to render. /// [Newtonsoft.Json.JsonProperty("script", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Script { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class PrerenderRuleActionDto : RuleAction { /// /// The prerender token from your account. /// [Newtonsoft.Json.JsonProperty("token", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Token { get; set; } /// /// The url to recache. /// [Newtonsoft.Json.JsonProperty("url", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Url { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class NotificationRuleActionDto : RuleAction { /// /// The user id or email. /// [Newtonsoft.Json.JsonProperty("user", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string User { get; set; } /// /// The text to send. /// [Newtonsoft.Json.JsonProperty("text", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Text { get; set; } /// /// The optional url to attach to the notification. /// [Newtonsoft.Json.JsonProperty("url", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Url { get; set; } /// /// An optional client name. /// [Newtonsoft.Json.JsonProperty("client", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Client { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class MediumRuleActionDto : RuleAction { /// /// The self issued access token. /// [Newtonsoft.Json.JsonProperty("accessToken", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string AccessToken { get; set; } /// /// The title, used for the url. /// [Newtonsoft.Json.JsonProperty("title", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Title { get; set; } /// /// The content, either html or markdown. /// [Newtonsoft.Json.JsonProperty("content", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Content { get; set; } /// /// The original home of this content, if it was originally published elsewhere. /// [Newtonsoft.Json.JsonProperty("canonicalUrl", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string CanonicalUrl { get; set; } /// /// The optional comma separated list of tags. /// [Newtonsoft.Json.JsonProperty("tags", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Tags { get; set; } /// /// Optional publication id. /// [Newtonsoft.Json.JsonProperty("publicationId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string PublicationId { get; set; } /// /// Indicates whether the content is markdown or html. /// [Newtonsoft.Json.JsonProperty("isHtml", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool IsHtml { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class FastlyRuleActionDto : RuleAction { /// /// The API key to grant access to Squidex. /// [Newtonsoft.Json.JsonProperty("apiKey", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string ApiKey { get; set; } /// /// The ID of the fastly service. /// [Newtonsoft.Json.JsonProperty("serviceId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string ServiceId { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class EmailRuleActionDto : RuleAction { /// /// The IP address or host to the SMTP server. /// [Newtonsoft.Json.JsonProperty("serverHost", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string ServerHost { get; set; } /// /// The port to the SMTP server. /// [Newtonsoft.Json.JsonProperty("serverPort", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int ServerPort { get; set; } /// /// The username for the SMTP server. /// [Newtonsoft.Json.JsonProperty("serverUsername", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string ServerUsername { get; set; } /// /// The password for the SMTP server. /// [Newtonsoft.Json.JsonProperty("serverPassword", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string ServerPassword { get; set; } /// /// The email sending address. /// [Newtonsoft.Json.JsonProperty("messageFrom", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string MessageFrom { get; set; } /// /// The email message will be sent to. /// [Newtonsoft.Json.JsonProperty("messageTo", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string MessageTo { get; set; } /// /// The subject line for this email message. /// [Newtonsoft.Json.JsonProperty("messageSubject", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string MessageSubject { get; set; } /// /// The message body. /// [Newtonsoft.Json.JsonProperty("messageBody", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string MessageBody { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class ElasticSearchRuleActionDto : RuleAction { /// /// The url to the elastic search instance or cluster. /// [Newtonsoft.Json.JsonProperty("host", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Uri Host { get; set; } /// /// The name of the index. /// [Newtonsoft.Json.JsonProperty("indexName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string IndexName { get; set; } /// /// The optional username. /// [Newtonsoft.Json.JsonProperty("username", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Username { get; set; } /// /// The optional password. /// [Newtonsoft.Json.JsonProperty("password", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Password { get; set; } /// /// The optional custom document. /// [Newtonsoft.Json.JsonProperty("document", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Document { get; set; } /// /// The condition when to delete the document. /// [Newtonsoft.Json.JsonProperty("delete", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Delete { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class DiscourseRuleActionDto : RuleAction { /// /// The url to the discourse server. /// [Newtonsoft.Json.JsonProperty("url", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public System.Uri Url { get; set; } /// /// The api key to authenticate to your discourse server. /// [Newtonsoft.Json.JsonProperty("apiKey", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string ApiKey { get; set; } /// /// The api username to authenticate to your discourse server. /// [Newtonsoft.Json.JsonProperty("apiUsername", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string ApiUsername { get; set; } /// /// The text as markdown. /// [Newtonsoft.Json.JsonProperty("text", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Text { get; set; } /// /// The optional title when creating new topics. /// [Newtonsoft.Json.JsonProperty("title", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Title { get; set; } /// /// The optional topic id. /// [Newtonsoft.Json.JsonProperty("topic", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? Topic { get; set; } /// /// The optional category id. /// [Newtonsoft.Json.JsonProperty("category", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int? Category { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class CreateContentRuleActionDto : RuleAction { /// /// The content data. /// [Newtonsoft.Json.JsonProperty("data", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Data { get; set; } /// /// The name of the schema. /// [Newtonsoft.Json.JsonProperty("schema", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Schema { get; set; } /// /// An optional client name. /// [Newtonsoft.Json.JsonProperty("client", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Client { get; set; } /// /// Publish the content. /// [Newtonsoft.Json.JsonProperty("publish", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool Publish { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class CommentRuleActionDto : RuleAction { /// /// The comment text. /// [Newtonsoft.Json.JsonProperty("text", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Text { get; set; } /// /// An optional client name. /// [Newtonsoft.Json.JsonProperty("client", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Client { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class AzureQueueRuleActionDto : RuleAction { /// /// The connection string to the storage account. /// [Newtonsoft.Json.JsonProperty("connectionString", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string ConnectionString { get; set; } /// /// The name of the queue. /// [Newtonsoft.Json.JsonProperty("queue", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string Queue { get; set; } /// /// Leave it empty to use the full event as body. /// [Newtonsoft.Json.JsonProperty("payload", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Payload { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class AlgoliaRuleActionDto : RuleAction { /// /// The application ID. /// [Newtonsoft.Json.JsonProperty("appId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string AppId { get; set; } /// /// The API key to grant access to Squidex. /// [Newtonsoft.Json.JsonProperty("apiKey", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string ApiKey { get; set; } /// /// The name of the index. /// [Newtonsoft.Json.JsonProperty("indexName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public string IndexName { get; set; } /// /// The optional custom document. /// [Newtonsoft.Json.JsonProperty("document", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Document { get; set; } /// /// The condition when to delete the entry. /// [Newtonsoft.Json.JsonProperty("delete", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Delete { get; set; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface, AllowMultiple = true)] internal class JsonInheritanceAttribute : System.Attribute { public JsonInheritanceAttribute(string key, System.Type type) { Key = key; Type = type; } public string Key { get; } public System.Type Type { get; } } [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] internal class DateFormatConverter : Newtonsoft.Json.Converters.IsoDateTimeConverter { public DateFormatConverter() { DateTimeFormat = "yyyy-MM-dd"; } } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class FileParameter { public FileParameter(System.IO.Stream data) : this (data, null, 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; } } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] 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() { Stream.Dispose(); if (_response != null) _response.Dispose(); if (_client != null) _client.Dispose(); } } [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class SquidexManagementException : System.Exception { public int StatusCode { get; private set; } public string Response { get; private set; } public System.Collections.Generic.IReadOnlyDictionary> Headers { get; private set; } public SquidexManagementException(string message, int statusCode, string response, System.Collections.Generic.IReadOnlyDictionary> headers, System.Exception innerException) : base(message + "\n\nStatus: " + statusCode + "\nResponse: \n" + ((response == null) ? "(null)" : 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.15.10.0 (NJsonSchema v10.6.10.0 (Newtonsoft.Json v9.0.0.0))")] public partial class SquidexManagementException : SquidexManagementException { public TResult Result { get; private set; } public SquidexManagementException(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 #pragma warning restore 3016 #pragma warning restore 8603