Skip to content

Commit

Permalink
simplified content item model implementation + medial model url source (
Browse files Browse the repository at this point in the history
#8)

* simplified content item model implementation + medial model url source

+ various fixes regarding media file import

* pipeline warnings fix

---------

Co-authored-by: Tomáš Krch <[email protected]>
  • Loading branch information
tkrch and tkrch authored Jan 26, 2024
1 parent 9e51e26 commit 309c31e
Show file tree
Hide file tree
Showing 24 changed files with 892 additions and 43 deletions.
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Kentico.Xperience.Core" Version="28.0.3" />
<PackageVersion Include="Kentico.Xperience.ImageProcessing" Version="28.0.3" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
Expand Down
4 changes: 2 additions & 2 deletions docs/Model/ContentItemModel.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Model [discriminator](../UmtModel.md#discriminator): `ContentItem`
|ContentItemGUID\*||System.Guid?|[UniqueId](../UmtModel.md#UniqueId)|
|ContentItemName\*||string?||
|ContentItemIsReusable\*||bool?||
|ContentItemIsSecured\*||bool?||
|ContentItemIsSecured||bool?||
|ContentItemDataClassGuid||System.Guid?|Reference to [DataClassInfo](../References.md#DataClassInfo) on property ContentItemContentTypeID|
|ContentItemChannelGuid||System.Guid?|Reference to [ChannelInfo](../References.md#ChannelInfo) on property ContentItemChannelID|
|[customPropertyName]|custom property defined by created [DataClass](./DataClassModel.md)|.NET type defined by data class field||
Expand All @@ -23,7 +23,7 @@ This sample describes how to create content item data inside XbyK
"ContentItemGUID": "df81215e-1414-4d87-befd-ae123f4e5653",
"ContentItemName": "CreationOfUmtModel",
"ContentItemIsReusable": false,
"ContentItemIsSecured": true,
"ContentItemIsSecured": false,
"ContentItemDataClassGuid": "06540294-3b56-4cf7-8773-088bb766ac23",
"ContentItemChannelGuid": "5322a379-5b5f-4220-9383-8e3115e66cd3"
}
Expand Down
51 changes: 51 additions & 0 deletions docs/Model/ContentItemSimplifiedModel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!-- generated file with tool "Kentico.Xperience.UMT.DocUtils" - edited through template "UmtModel.cshtml" -->
## ContentItemSimplifiedModel
Model [discriminator](../UmtModel.md#discriminator): `ContentItemSimplified`

|PropertyName|Summary|.NET Type|Notes|
|---|---|---|---|
|ContentItemGUID\*||System.Guid?|[UniqueId](../UmtModel.md#UniqueId)|
|IsSecured||bool?||
|ContentTypeName\*|Content item type name.|string?||
|Name\*|Code name of the content item.|string?||
|IsReusable|Indicates if content item is reusable. By default, item will be created as reusable.|bool||
|ChannelName|ID of a channel the content item is owned by. By default, item won't be owned by a channel.|string?||
|LanguageData||Kentico.Xperience.UMT.Model.ContentItemLanguageData[]||
|PageData||Kentico.Xperience.UMT.Model.PageDataModel?||
|[customPropertyName]|custom property defined by created [DataClass](./DataClassModel.md)|.NET type defined by data class field||

<p>*) value is required</p>

## ContentItemLanguageData

|PropertyName|Summary|.NET Type|Notes|
|---|---|---|---|
|LanguageName\*||string||
|DisplayName\*||string||
|VersionStatus||CMS.ContentEngine.VersionStatus||
|UserGuid\*||System.Guid?||
|ContentItemData||System.Collections.Generic.Dictionary<string, object?>?||

<p>*) value is required</p>

## PageDataModel

|PropertyName|Summary|.NET Type|Notes|
|---|---|---|---|
|PageUrls||Kentico.Xperience.UMT.Model.PageUrlModel[]||
|ParentGuid||System.Guid?||
|TreePath||string?||
|ItemOrder||int?||

<p>*) value is required</p>

## PageUrlModel

|PropertyName|Summary|.NET Type|Notes|
|---|---|---|---|
|UrlPath||string?||
|PathIsDraft||bool?||
|LanguageName||string?||

<p>*) value is required</p>

23 changes: 20 additions & 3 deletions docs/Model/MediaFileModel.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Model [discriminator](../UmtModel.md#discriminator): `Media_File`
|PropertyName|Summary|.NET Type|Notes|
|---|---|---|---|
|DataSourcePath||string?||
|DataSourceUrl||string?||
|FileGUID\*||System.Guid?|[UniqueId](../UmtModel.md#UniqueId)|
|FileLibraryGuid\*||System.Guid?|Reference to [MediaLibraryInfo](../References.md#MediaLibraryInfo) on property FileLibraryID **required**|
|FileCreatedByUserGuid||System.Guid?|Reference to [UserInfo](../References.md#UserInfo) on property FileCreatedByUserID|
Expand All @@ -24,7 +25,7 @@ Model [discriminator](../UmtModel.md#discriminator): `Media_File`
<p>*) value is required</p>


### Sample of media file
### Sample of media file loaded from disk

```json
{
Expand All @@ -33,9 +34,25 @@ Model [discriminator](../UmtModel.md#discriminator): `Media_File`
"FileGUID": "214e29aa-32d5-40d7-9fea-896591439e74",
"FileLibraryGuid": "e3a9c50c-2b76-4ba8-ac19-2f0aa64c47d5",
"FileCreatedByUserGuid": "863f796e-823a-4f5e-bbdb-e4a6f15b349b",
"FileName": "NewTestFile.png",
"FileName": "NewTestFile",
"FileTitle": "Title",
"FileExtension": ".png",
"FilePath": "newPath/somepath"
"FilePath": "customdir/NewTestFile.png"
}
```

### Sample of media file downloaded from url

```json
{
"$type": "Media_File",
"DataSourceUrl": "https://devnet.kentico.com/DevNet/media/devnet/cms_screen.jpg",
"FileGUID": "94df1156-c85d-4356-8e28-16d71c6ac899",
"FileLibraryGuid": "e3a9c50c-2b76-4ba8-ac19-2f0aa64c47d5",
"FileCreatedByUserGuid": "863f796e-823a-4f5e-bbdb-e4a6f15b349b",
"FileName": "NewTestFileFromUri",
"FileTitle": "Old devnet screen",
"FileExtension": ".jpg",
"FilePath": "customdir/NewTestFileFromUri.jpg"
}
```
14 changes: 11 additions & 3 deletions docs/Model/UMT.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,7 @@
"required": [
"ContentItemGUID",
"ContentItemName",
"ContentItemIsReusable",
"ContentItemIsSecured"
"ContentItemIsReusable"
],
"properties": {
"ContentItemGUID": {
Expand All @@ -310,7 +309,10 @@
"type": "boolean"
},
"ContentItemIsSecured": {
"type": "boolean"
"type": [
"boolean",
"null"
]
},
"ContentItemDataClassGuid": {
"type": [
Expand Down Expand Up @@ -726,6 +728,12 @@
"string"
]
},
"DataSourceUrl": {
"type": [
"null",
"string"
]
},
"FileGUID": {
"type": "string",
"format": "guid",
Expand Down
110 changes: 107 additions & 3 deletions docs/Samples/basic.json
Original file line number Diff line number Diff line change
Expand Up @@ -270,16 +270,36 @@
{
"$type": "Media_File",
"DataSourcePath": ".\\sample.png",
"DataSourceUrl": null,
"FileGUID": "214e29aa-32d5-40d7-9fea-896591439e74",
"FileLibraryGuid": "e3a9c50c-2b76-4ba8-ac19-2f0aa64c47d5",
"FileCreatedByUserGuid": "863f796e-823a-4f5e-bbdb-e4a6f15b349b",
"FileModifiedByUserGuid": null,
"FileName": "NewTestFile.png",
"FileName": "NewTestFile",
"FileTitle": "Title",
"FileDescription": null,
"FileExtension": ".png",
"FileMimeType": null,
"FilePath": "newPath/somepath",
"FilePath": "customdir/NewTestFile.png",
"FileImageWidth": null,
"FileImageHeight": null,
"FileCreatedWhen": null,
"FileModifiedWhen": null
},
{
"$type": "Media_File",
"DataSourcePath": null,
"DataSourceUrl": "https://devnet.kentico.com/DevNet/media/devnet/cms_screen.jpg",
"FileGUID": "94df1156-c85d-4356-8e28-16d71c6ac899",
"FileLibraryGuid": "e3a9c50c-2b76-4ba8-ac19-2f0aa64c47d5",
"FileCreatedByUserGuid": "863f796e-823a-4f5e-bbdb-e4a6f15b349b",
"FileModifiedByUserGuid": null,
"FileName": "NewTestFileFromUri",
"FileTitle": "Old devnet screen",
"FileDescription": null,
"FileExtension": ".jpg",
"FileMimeType": null,
"FilePath": "customdir/NewTestFileFromUri.jpg",
"FileImageWidth": null,
"FileImageHeight": null,
"FileCreatedWhen": null,
Expand Down Expand Up @@ -361,7 +381,7 @@
"ContentItemGUID": "df81215e-1414-4d87-befd-ae123f4e5653",
"ContentItemName": "CreationOfUmtModel",
"ContentItemIsReusable": false,
"ContentItemIsSecured": true,
"ContentItemIsSecured": false,
"ContentItemDataClassGuid": "06540294-3b56-4cf7-8773-088bb766ac23",
"ContentItemChannelGuid": "5322a379-5b5f-4220-9383-8e3115e66cd3"
},
Expand Down Expand Up @@ -583,5 +603,89 @@
"WebPageUrlPathContentLanguageGuid": "a6c0a558-8b33-47b6-87a8-491b437c9923",
"WebPageUrlPathIsLatest": true,
"WebPageUrlPathIsDraft": false
},
{
"$type": "ContentItemSimplified",
"ContentItemGUID": "37c3f5dd-6f2a-4eff-b46e-a36eddebf572",
"IsSecured": false,
"ContentTypeName": "UMT.Article",
"Name": "SimplifiedModelSample",
"IsReusable": true,
"ChannelName": "websitechannelExample",
"LanguageData": [
{
"LanguageName": "en-US",
"DisplayName": "Simplified model sample - en-us",
"VersionStatus": 0,
"UserGuid": "dbfcc244-2cb9-4934-857f-9d75404c1553",
"ContentItemData": {
"ArticleTitle": "en-US UMT simplified model creation",
"ArticleText": "This article is only example of creation UMT simplified model for en-US language",
"RelatedArticles": null,
"RelatedFaq": null
}
},
{
"LanguageName": "en-GB",
"DisplayName": "Simplified model sample - en-gb",
"VersionStatus": 2,
"UserGuid": "dbfcc244-2cb9-4934-857f-9d75404c1553",
"ContentItemData": {
"ArticleTitle": "en-GB UMT simplified model creation",
"ArticleText": "This article is only example of creation UMT simplified model for en-GB language",
"RelatedArticles": null,
"RelatedFaq": null
}
}
],
"PageData": {
"PageUrls": [
{
"UrlPath": "en-us/simplified-sample",
"PathIsDraft": true,
"LanguageName": "en-US"
},
{
"UrlPath": "en-gb/simplified-sample",
"PathIsDraft": true,
"LanguageName": "en-GB"
}
],
"ParentGuid": null,
"TreePath": "/simplified-sample",
"ItemOrder": null
}
},
{
"$type": "ContentItemSimplified",
"ContentItemGUID": "f9cb9484-ce90-460f-a5c8-ad953e2b9286",
"IsSecured": false,
"ContentTypeName": "UMT.Faq",
"Name": "SimplifiedModelSampleReusable",
"IsReusable": true,
"ChannelName": null,
"LanguageData": [
{
"LanguageName": "en-US",
"DisplayName": "FAQ: reusable simplified model sample - en-us",
"VersionStatus": 0,
"UserGuid": "dbfcc244-2cb9-4934-857f-9d75404c1553",
"ContentItemData": {
"FaqQuestion": "en-US FAQ question text (reusable)",
"FaqAnswer": "en-US FAQ answer text (reusable)"
}
},
{
"LanguageName": "en-GB",
"DisplayName": "FAQ: reusable simplified model sample - en-gb",
"VersionStatus": 2,
"UserGuid": "dbfcc244-2cb9-4934-857f-9d75404c1553",
"ContentItemData": {
"FaqQuestion": "en-US FAQ question text (reusable)",
"FaqAnswer": "en-US FAQ answer text (reusable)"
}
}
],
"PageData": null
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Kentico.Xperience.ImageProcessing" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
Expand Down
1 change: 1 addition & 0 deletions examples/Kentico.Xperience.UMT.Example.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// See https://aka.ms/new-console-template for more information

using System.Text.Json;
using CMS.ContentEngine;
using CMS.Core;
using CMS.DataEngine;
using Kentico.Xperience.UMT;
Expand Down
Loading

0 comments on commit 309c31e

Please sign in to comment.