Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/pp9 15876 pp9 15877 dynamicviewfield showrelatedcontentondownload #589

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -1526,7 +1526,7 @@ public static PictureparkBusinessException FromJson(string data)
[JsonInheritanceAttribute("SchemaSortFieldException", typeof(SchemaSortFieldException))]
[JsonInheritanceAttribute("SchemaFieldIdException", typeof(SchemaFieldIdException))]
[JsonInheritanceAttribute("SchemaFieldTypeChangeException", typeof(SchemaFieldTypeChangeException))]
[JsonInheritanceAttribute("SchemaFieldIndexException", typeof(SchemaFieldIndexException))]
[JsonInheritanceAttribute("SchemaFieldNotFilterableException", typeof(SchemaFieldNotFilterableException))]
[JsonInheritanceAttribute("SchemaFieldNotSortableException", typeof(SchemaFieldNotSortableException))]
[JsonInheritanceAttribute("SchemaFieldNotSearchableException", typeof(SchemaFieldNotSearchableException))]
[JsonInheritanceAttribute("SchemaFieldInvalidBoostException", typeof(SchemaFieldInvalidBoostException))]
Expand Down Expand Up @@ -6284,7 +6284,7 @@ public static SchemaFieldTypeChangeException FromJson(string data)

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.23.0 (Newtonsoft.Json v11.0.0.0)")]
[Newtonsoft.Json.JsonObjectAttribute]
public partial class SchemaFieldIndexException : PictureparkValidationException
public partial class SchemaFieldNotFilterableException : PictureparkValidationException
{
[Newtonsoft.Json.JsonProperty("schemaId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string SchemaId { get; set; }
Expand All @@ -6297,9 +6297,9 @@ public string ToJson()
return Newtonsoft.Json.JsonConvert.SerializeObject(this);
}

public static SchemaFieldIndexException FromJson(string data)
public static SchemaFieldNotFilterableException FromJson(string data)
{
return Newtonsoft.Json.JsonConvert.DeserializeObject<SchemaFieldIndexException>(data);
return Newtonsoft.Json.JsonConvert.DeserializeObject<SchemaFieldNotFilterableException>(data);
}

}
Expand Down Expand Up @@ -9676,48 +9676,6 @@ public static ConversionPresetTemplateNotFoundException FromJson(string data)

}

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.23.0 (Newtonsoft.Json v11.0.0.0)")]
public partial class ProblemDetails
{
[Newtonsoft.Json.JsonProperty("type", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Type { get; set; }

[Newtonsoft.Json.JsonProperty("title", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Title { get; set; }

[Newtonsoft.Json.JsonProperty("status", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public int? Status { get; set; }

[Newtonsoft.Json.JsonProperty("detail", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Detail { get; set; }

[Newtonsoft.Json.JsonProperty("instance", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string Instance { get; set; }

[Newtonsoft.Json.JsonProperty("extensions", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.IDictionary<string, object> Extensions { get; set; }

private System.Collections.Generic.IDictionary<string, object> _additionalProperties = new System.Collections.Generic.Dictionary<string, object>();

[Newtonsoft.Json.JsonExtensionData]
public System.Collections.Generic.IDictionary<string, object> AdditionalProperties
{
get { return _additionalProperties; }
set { _additionalProperties = value; }
}

public string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this);
}

public static ProblemDetails FromJson(string data)
{
return Newtonsoft.Json.JsonConvert.DeserializeObject<ProblemDetails>(data);
}

}

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.23.0 (Newtonsoft.Json v11.0.0.0)")]
public partial class SnapshotRepository
{
Expand Down Expand Up @@ -14910,7 +14868,7 @@ public static LowLevelPriorityRelatedConfigurationBase FromJson(string data)
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.23.0 (Newtonsoft.Json v11.0.0.0)")]
public partial class MessagesInFlight : QueuePriorityModelConfiguration
{
[Newtonsoft.Json.JsonProperty("function", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[Newtonsoft.Json.JsonProperty("function", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public QueuePriorityMathFunctionAndArguments Function { get; set; }

public string ToJson()
Expand Down Expand Up @@ -16747,10 +16705,10 @@ public static BusinessProcessCancellationRequestedEvent FromJson(string data)
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.23.0 (Newtonsoft.Json v11.0.0.0)")]
public partial class DataExtractionRepairEvent : ApplicationEvent
{
[Newtonsoft.Json.JsonProperty("contentRepairRequestId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[Newtonsoft.Json.JsonProperty("contentRepairRequestId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string ContentRepairRequestId { get; set; }

[Newtonsoft.Json.JsonProperty("contentId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[Newtonsoft.Json.JsonProperty("contentId", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string ContentId { get; set; }

[Newtonsoft.Json.JsonProperty("error", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
Expand Down
@@ -0,0 +1,60 @@
using System;
using Newtonsoft.Json;
using Picturepark.SDK.V1.Contract.Providers;
using Picturepark.SDK.V1.Contract.SystemTypes;

namespace Picturepark.SDK.V1.Contract.Attributes
{
/// <summary>
/// Used to specify options for a field of type <see cref="FieldDynamicView"/>
/// </summary>
/// <remarks>Use with property of type <see cref="DynamicViewObject"/></remarks>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
public class PictureparkDynamicViewAttribute : Attribute, IPictureparkAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="PictureparkDynamicViewAttribute"/> class.
/// </summary>
/// <param name="filter">JSON-serialized filter</param>
/// <exception cref="ArgumentNullException"><paramref name="filter"/> is null or whitespace</exception>
public PictureparkDynamicViewAttribute(string filter) : this()
{
if (string.IsNullOrEmpty(filter))
throw new ArgumentNullException(nameof(filter));

FilterTemplate = JsonConvert.DeserializeObject<FilterBase>(filter);
}

/// <summary>
/// Initializes a new instance of the <see cref="PictureparkDynamicViewAttribute"/> class.
/// </summary>
/// <param name="filterProvider"><see cref="IFilterProvider"/> to obtain instance of <see cref="FilterBase"/></param>
/// <exception cref="ArgumentNullException"><paramref name="filterProvider"/> is null</exception>
/// <exception cref="ArgumentException"><paramref name="filterProvider"/> is of wrong type</exception>
public PictureparkDynamicViewAttribute(Type filterProvider) : this()
{
if (Activator.CreateInstance(filterProvider) is IFilterProvider provider)
FilterTemplate = provider.GetFilter();
else
throw new ArgumentException($"The parameter {nameof(filterProvider)} is not of type {nameof(IFilterProvider)}.");
}

/// <summary>
/// Initializes a new instance of the <see cref="PictureparkDynamicViewAttribute"/> class.
/// </summary>
protected PictureparkDynamicViewAttribute()
{
TargetDocType = "Content";
}

/// <summary>
/// Please refer to <see cref="FieldDynamicView.TargetDocType"/>
/// </summary>
public string TargetDocType { get; }

/// <summary>
/// Please refer to <see cref="FieldDynamicView.FilterTemplate"/>
/// </summary>
public FilterBase FilterTemplate { get; }
}
}
@@ -0,0 +1,63 @@
using System;

namespace Picturepark.SDK.V1.Contract.Attributes
{
/// <summary>
/// Sets the UI settings of a single / multi relationship field
/// </summary>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
public class PictureparkDynamicViewUiSettingsAttribute : PictureparkItemFieldUiSettingsAttributeBase
{
/// <summary>
/// Initializes a new instance of the <see cref="PictureparkDynamicViewUiSettingsAttribute"/> class.
/// </summary>
/// <param name="view">The default view that the UI will use to render the relationship field</param>
/// <param name="maxListRows">Maximum number of rows for the list view.</param>
/// <param name="maxThumbRows">Maximum number of rows for the Thumbnail views.</param>
/// <param name="showRelatedContentOnDownload">Whether related content should be shown in UI download dialog</param>
public PictureparkDynamicViewUiSettingsAttribute(
ItemFieldViewMode view,
int maxListRows,
int maxThumbRows,
bool showRelatedContentOnDownload)
: base(view, maxListRows, maxThumbRows, showRelatedContentOnDownload)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="PictureparkDynamicViewUiSettingsAttribute"/> class.
/// </summary>
/// <param name="view">The default view that the UI will use to render the field</param>
/// <param name="showRelatedContentOnDownload">Whether related content should be shown in UI download dialog</param>
public PictureparkDynamicViewUiSettingsAttribute(
ItemFieldViewMode view,
bool showRelatedContentOnDownload)
: base(view, showRelatedContentOnDownload: showRelatedContentOnDownload)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="PictureparkDynamicViewUiSettingsAttribute"/> class.
/// </summary>
/// <param name="view">The default view that the UI will use to render the field</param>
/// <param name="maxListRows">Maximum number of rows for the list view.</param>
/// <param name="maxThumbRows">Maximum number of rows for the Thumbnail views.</param>
public PictureparkDynamicViewUiSettingsAttribute(
ItemFieldViewMode view,
int maxListRows,
int maxThumbRows)
: base(view, maxListRows, maxThumbRows)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="PictureparkDynamicViewUiSettingsAttribute"/> class.
/// </summary>
/// <param name="view">The default view that the UI will use to render the relationship field</param>
public PictureparkDynamicViewUiSettingsAttribute(
ItemFieldViewMode view)
: base(view)
{
}
}
}
@@ -0,0 +1,49 @@
using System;

namespace Picturepark.SDK.V1.Contract.Attributes
{
/// <summary>
/// Base class to define <see cref="ItemFieldUiSettingsViewItemBase"/> for <see cref="ISchemaClient.GenerateSchemasAsync"/>
/// </summary>
public abstract class PictureparkItemFieldUiSettingsAttributeBase : Attribute, IPictureparkAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="PictureparkItemFieldUiSettingsAttributeBase"/> class.
/// </summary>
/// <param name="view">The default view that the UI will use to render the relationship field</param>
/// <param name="maxListRows">Maximum number of rows for the list view.</param>
/// <param name="maxThumbRows">Maximum number of rows for the Thumbnail views.</param>
/// <param name="showRelatedContentOnDownload">Whether related content should be shown in UI download dialog</param>
protected PictureparkItemFieldUiSettingsAttributeBase(
ItemFieldViewMode view = ItemFieldViewMode.List,
int? maxListRows = null,
int? maxThumbRows = null,
bool? showRelatedContentOnDownload = null)
{
View = view;
MaxListRows = maxListRows;
MaxThumbRows = maxThumbRows;
ShowRelatedContentOnDownload = showRelatedContentOnDownload;
}

/// <summary>
/// Default view that the UI will use to render the field.
/// </summary>
public ItemFieldViewMode View { get; }

/// <summary>
/// Maximum number of rows for the list view.
/// </summary>
public int? MaxListRows { get; }

/// <summary>
/// Maximum number of rows for the Thumbnail views.
/// </summary>
public int? MaxThumbRows { get; }

/// <summary>
/// Whether related content should be shown in UI download dialog
/// </summary>
public bool? ShowRelatedContentOnDownload { get; }
}
}
Expand Up @@ -6,42 +6,58 @@ namespace Picturepark.SDK.V1.Contract.Attributes
/// Sets the UI settings of a single / multi relationship field
/// </summary>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
public class PictureparkRelationUiSettingsAttribute : Attribute, IPictureparkAttribute
public class PictureparkRelationUiSettingsAttribute : PictureparkItemFieldUiSettingsAttributeBase
{
/// <summary>
/// Initializes a new instance of the <see cref="PictureparkRelationUiSettingsAttribute"/> class.
/// </summary>
/// <param name="view">Default view that the UI will use to render a single / multi relationship field.</param>
public PictureparkRelationUiSettingsAttribute(RelationView view)
{
View = view;
}

/// <summary>
/// Initializes a new instance of the <see cref="PictureparkRelationUiSettingsAttribute"/> class.
/// </summary>
/// <param name="view">The default view that the UI will use to render the relationship field</param>
/// <param name="maxListRows">Maximum number of rows for the list view.</param>
/// <param name="maxThumbRows">Maximum number of rows for the Thumbnail views.</param>
public PictureparkRelationUiSettingsAttribute(RelationView view, int maxListRows, int maxThumbRows) : this(view)
/// <param name="showRelatedContentOnDownload">Whether related content should be shown in UI download dialog</param>
public PictureparkRelationUiSettingsAttribute(
ItemFieldViewMode view,
int maxListRows,
int maxThumbRows,
bool showRelatedContentOnDownload)
: base(view, maxListRows, maxThumbRows, showRelatedContentOnDownload)
{
MaxListRows = maxListRows;
MaxThumbRows = maxThumbRows;
}

/// <summary>
/// Default view that the UI will use to render a single / multi relationship field.
/// Initializes a new instance of the <see cref="PictureparkRelationUiSettingsAttribute"/> class.
/// </summary>
public RelationView View { get; }
/// <param name="view">The default view that the UI will use to render the field</param>
/// <param name="showRelatedContentOnDownload">Whether related content should be shown in UI download dialog</param>
public PictureparkRelationUiSettingsAttribute(
ItemFieldViewMode view,
bool showRelatedContentOnDownload)
: base(view, showRelatedContentOnDownload: showRelatedContentOnDownload)
{
}

/// <summary>
/// Maximum number of rows for the list view.
/// Initializes a new instance of the <see cref="PictureparkRelationUiSettingsAttribute"/> class.
/// </summary>
public int? MaxListRows { get; }
/// <param name="view">The default view that the UI will use to render the field</param>
/// <param name="maxListRows">Maximum number of rows for the list view.</param>
/// <param name="maxThumbRows">Maximum number of rows for the Thumbnail views.</param>
public PictureparkRelationUiSettingsAttribute(
ItemFieldViewMode view,
int maxListRows,
int maxThumbRows)
: base(view, maxListRows, maxThumbRows)
{
}

/// <summary>
/// Maximum number of rows for the Thumbnail views.
/// Initializes a new instance of the <see cref="PictureparkRelationUiSettingsAttribute"/> class.
/// </summary>
public int? MaxThumbRows { get; }
/// <param name="view">The default view that the UI will use to render the relationship field</param>
public PictureparkRelationUiSettingsAttribute(
ItemFieldViewMode view)
: base(view)
{
}
}
}