Skip to content

Commit 84a9604

Browse files
author
Dave de Moel
committed
Updated package info
1 parent 53146bb commit 84a9604

File tree

8 files changed

+61
-93
lines changed

8 files changed

+61
-93
lines changed

ContentApi Umb9.yml

-64
This file was deleted.

License.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 Dave de Moel
3+
Copyright (c) 2021 Dave de Moel
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+37-15
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Out of the box easy to use, full DI support and fast.
1111
- The Umbraco Content Api 2.0.10 works with Umbraco 8.1.3+
1212
- The Umbraco Content Api 3.0.0+ works with Umbraco 8.7.0+
1313
- 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+
1415

1516
#### Basic Usage:
1617
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.
2021
5. Resolve the content
2122

2223
```csharp
23-
public class SampleApiController : UmbracoApiController
24+
[Route("api/content")]
25+
public class ContentApiController : UmbracoApiController
2426
{
2527
private readonly Lazy<IContentResolver> _contentResolver;
28+
private readonly IPublishedContentQuery _publishedContent;
2629

27-
public ContentApiController(Lazy<IContentResolver> contentResolver)
30+
public ContentApiController(
31+
Lazy<IContentResolver> contentResolver, IPublishedContentQuery publishedContent)
2832
{
2933
_contentResolver = contentResolver;
34+
_publishedContent = publishedContent;
3035
}
3136

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));
3754
}
3855
}
3956
```
@@ -54,20 +71,16 @@ public class SampleConverter : IConverter
5471
}
5572
}
5673
// 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)
6175
{
62-
composition.Converters().Append<SampleConverter>();
76+
builder.Converters().Append<SampleConverter>();
6377
}
64-
}
6578
```
6679

6780
#### Replace an exsisting converter
6881
To replace a converter just add the following to the composer:
6982
```csharp
70-
composition.Converters()
83+
builder.Converters()
7184
.Replace<ConverterToReplace, SampleConverter>();
7285
```
7386

@@ -87,4 +100,13 @@ Added grid editor converters.
87100

88101
#### 4.0.0
89102

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.

src/UmbracoContentApi/UmbracoContentApi.Core/GitVersion.yml

-9
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Umbraco Content Api
2+
3+
The Umbraco Content Api is a package that enables easy integration of Headless Api functionality into your project.
4+
The package includes converters for all default Umbraco porperty editors and allows developers to add to and replace them at will.
5+
6+
Out of the box easy to use, full DI support and fast.
7+
8+
Read more on https://github.com/deMD/UmbracoContentApi

src/UmbracoContentApi/UmbracoContentApi.Core/UmbracoContentApi.Core.csproj

+15
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
<Authors>Dave de Moel</Authors>
66
<Company>Dave de Moel</Company>
77
<PackageTags>Umbraco; API; Content;</PackageTags>
8+
<PackageProjectUrl>https://github.com/deMD/UmbracoContentApi</PackageProjectUrl>
9+
<PackageReadmeFile>README.md</PackageReadmeFile>
10+
<PackageLicenseFile>License.txt</PackageLicenseFile>
11+
<Copyright>Copyright (c) 2021 Dave de Moel</Copyright>
12+
<Description>The Umbraco Content Api is a package that enables easy integration of Headless Api functionality into your project.</Description>
13+
<PackageIcon>UmbracoContentApiLogo.png</PackageIcon>
814
</PropertyGroup>
915

1016

@@ -15,6 +21,9 @@
1521

1622
<ItemGroup>
1723
<None Remove="GitVersion.yml" />
24+
<None Include="README.md" Pack="true" PackagePath="\" />
25+
<None Include="License.txt" Pack="true" PackagePath="\" />
26+
<None Include="UmbracoContentApiLogo.png" Pack="true" PackagePath="\" />
1827
</ItemGroup>
1928

2029
<ItemGroup>
@@ -24,4 +33,10 @@
2433
<PackageReference Include="Umbraco.Cms.Web.Common" Version="9.0.0" />
2534
</ItemGroup>
2635

36+
<ItemGroup>
37+
<Content Include="..\..\..\License.txt">
38+
<Link>License.txt</Link>
39+
</Content>
40+
</ItemGroup>
41+
2742
</Project>
Loading

src/UmbracoContentApi/UmbracoContentApi.sln

-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Documentation", "Documentat
1212
..\..\.gitattributes = ..\..\.gitattributes
1313
..\..\.gitignore = ..\..\.gitignore
1414
..\..\ContentApi Umb8.yml = ..\..\ContentApi Umb8.yml
15-
..\..\ContentApi Umb9.yml = ..\..\ContentApi Umb9.yml
1615
..\..\GitVersion.yml = ..\..\GitVersion.yml
1716
..\..\License.txt = ..\..\License.txt
1817
..\..\README.md = ..\..\README.md
@@ -34,9 +33,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Umbraco 8", "Umbraco 8", "{
3433
EndProjectSection
3534
EndProject
3635
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Umbraco 9", "Umbraco 9", "{ED25CE6F-82DF-499E-9597-7CEF5238B4E7}"
37-
ProjectSection(SolutionItems) = preProject
38-
UmbracoContentApi.Core\GitVersion.yml = UmbracoContentApi.Core\GitVersion.yml
39-
EndProjectSection
4036
EndProject
4137
Global
4238
GlobalSection(SolutionConfigurationPlatforms) = preSolution

0 commit comments

Comments
 (0)