@@ -11,6 +11,7 @@ Out of the box easy to use, full DI support and fast.
11
11
- The Umbraco Content Api 2.0.10 works with Umbraco 8.1.3+
12
12
- The Umbraco Content Api 3.0.0+ works with Umbraco 8.7.0+
13
13
- The Umbraco Content Api 4.0.0+ works with Umbraco 8.14.0+
14
+ - The Umbraco Content Api 9.2.0+ works with Umbraco 9.0.0+
14
15
15
16
#### Basic Usage:
16
17
1 . Download the package from [ NuGet] ( https://www.nuget.org/packages/UmbracoContentApi.Core/ )
@@ -20,20 +21,36 @@ Out of the box easy to use, full DI support and fast.
20
21
5 . Resolve the content
21
22
22
23
``` csharp
23
- public class SampleApiController : UmbracoApiController
24
+ [Route (" api/content" )]
25
+ public class ContentApiController : UmbracoApiController
24
26
{
25
27
private readonly Lazy <IContentResolver > _contentResolver ;
28
+ private readonly IPublishedContentQuery _publishedContent ;
26
29
27
- public ContentApiController (Lazy <IContentResolver > contentResolver )
30
+ public ContentApiController (
31
+ Lazy <IContentResolver > contentResolver , IPublishedContentQuery publishedContent )
28
32
{
29
33
_contentResolver = contentResolver ;
34
+ _publishedContent = publishedContent ;
30
35
}
31
36
32
- public IHttpActionResult Get (Guid id )
33
- {
34
- IPublishedContent content = Umbraco .Content (id );
35
- var model = _contentResolver .Value .ResolveContent (content );
36
- return Ok (model );
37
+ [HttpGet (" {id:guid}" )]
38
+ public IActionResult Get (Guid id , int level = 0 )
39
+ {
40
+ var content = _publishedContent .Content (id );
41
+ var dictionary = new Dictionary <string , object >
42
+ {
43
+ {" addUrl" , true }
44
+ };
45
+
46
+ if (level <= 0 )
47
+ {
48
+ return Ok (_contentResolver .Value .ResolveContent (content , dictionary ));
49
+ }
50
+
51
+ dictionary .Add (" level" , level );
52
+
53
+ return Ok (_contentResolver .Value .ResolveContent (content , dictionary ));
37
54
}
38
55
}
39
56
```
@@ -54,20 +71,16 @@ public class SampleConverter : IConverter
54
71
}
55
72
}
56
73
// Composer:
57
- [ComposeAfter (typeof (UmbracoContentApi .Core .Composers .ConvertersComposer ))]
58
- public class ConverterComposer : IUserComposer
59
- {
60
- public void Compose (Composition composition )
74
+ public void Compose (IUmbracoBuilder builder )
61
75
{
62
- composition .Converters ().Append <SampleConverter >();
76
+ builder .Converters ().Append <SampleConverter >();
63
77
}
64
- }
65
78
```
66
79
67
80
#### Replace an exsisting converter
68
81
To replace a converter just add the following to the composer:
69
82
``` csharp
70
- composition .Converters ()
83
+ builder .Converters ()
71
84
.Replace <ConverterToReplace , SampleConverter >();
72
85
```
73
86
@@ -87,4 +100,13 @@ Added grid editor converters.
87
100
88
101
#### 4.0.0
89
102
90
- Added support for Umbraco MediaPicker 3
103
+ Added support for Umbraco MediaPicker 3
104
+
105
+ #### 9.2.0
106
+
107
+ Added official support for Umbraco 9
108
+
109
+ Added default BlocklistConverter.
110
+ The BlockListConverter will use the default converter if no specific converter is specified for the block's element type.
111
+
112
+ Migrated to Github Actions for package releases.
0 commit comments