umbraco / Umbraco.Headless.Client.Net

.NET Client Library and Samples for the Umbraco headless cms Cloud Service called Umbraco Heartcore
https://umbraco.com/products/umbraco-heartcore/
13 stars 14 forks source link

Feature/content management #1

Closed rasmusjp closed 5 years ago

rasmusjp commented 5 years ago

Added content management services, I've also done some general refactoring and renamed content delivery Content and Media to PublishedContent and PublishedMedia since they were colliding with the content management ones in the code generated by refit.

I've created a new task for handling file uploads

sitereactor commented 5 years ago

On the naming: the generel idea is to be consistent with the Content Delivery and Content Management naming in the APIs. It will be confusing if we call the rest APIs Content Delivery and then start using Published Content in the SDKs. There is also some quirks around calling Media published as lts not really published.

So let's try to avoid using "Published" beyond property values.

rasmusjp commented 5 years ago

I agree, but I couldn't get it working with refit since the files it generates included both namespaces and then it wouldn't compile. I couldn't find a way to configure how the code was generated which is why I renamed the classes

rasmusjp commented 5 years ago

Also the reason for PublishedMedia was just to follow the naming in Core

sitereactor commented 5 years ago

Which namespaces or objects were in conflict? Happy to take a look. The rest of the refactor looks really good, so would be great to keep as much of that as possible.

rasmusjp commented 5 years ago

Pushed a new commit where I've removed the Published prefix, but it won't compile

These are some of the errors I'm getting:

RefitStubs.g.cs(44, 59): [CS0535] 'AutoGeneratedContentDeliveryEndpoints' does not implement interface member 'ContentDeliveryEndpoints.GetAncestors(string, string, Guid)'

RefitStubs.g.cs(58, 26): [CS0104] 'Content' is an ambiguous reference between 'Umbraco.Headless.Client.Net.Management.Models.Content' and 'Umbraco.Headless.Client.Net.Delivery.Models.Content'

rasmusjp commented 5 years ago

Looking at the generated RefitStubs.g.cs it adds

using Umbraco.Headless.Client.Net.Delivery.Models;
using Umbraco.Headless.Client.Net.Shared.Models;
using Umbraco.Headless.Client.Net.Management.Models;

to the top of the file which is why the objects collide

sitereactor commented 5 years ago

If we could simply get Refit to put the using statements inside the namespace it wouldn't be an issue. But can't find any references that mentions whether this should be possible.

For now I have removed the use of the Umbraco.Headless.Client.Net.Delivery.Models in ContentDeliveryEndpoints, which solves the ambigious reference issue.

sitereactor commented 5 years ago

Made a few minor corrections here and there, but all in all looks good. Seems like this library is more or less done, so on to the samples 😄