├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── appveyor.yml ├── assets ├── logo.png └── logo.svg ├── build-appveyor.cmd ├── build.cmd ├── build ├── package.nuspec ├── package.proj ├── readme.txt └── tools │ ├── AppVeyorUmbraco │ └── AppVeyorUmbraco.Targets │ ├── MSBuildCommunityTasks │ ├── ICSharpCode.SharpZipLib.dll │ ├── MSBuild.Community.Tasks.Targets │ ├── MSBuild.Community.Tasks.chm │ ├── MSBuild.Community.Tasks.dll │ ├── MSBuild.Community.Tasks.xml │ └── Sample.proj │ └── MSBuildNugetTasks │ ├── MSBuild.NuGet.Tasks.Targets │ └── MSBuild.NuGet.Tasks.dll └── src ├── .nuget ├── NuGet.Config ├── NuGet.exe └── NuGet.targets ├── Our.Umbraco.HeadRest.sln └── Our.Umbraco.HeadRest ├── Composing ├── HeadRestComponent.cs └── HeadRestComposer.cs ├── HeadRest.cs ├── HeadRestConfig.cs ├── HeadRestEndpointMode.cs ├── HeadRestOptions.cs ├── Interfaces ├── IHeadRestConfig.cs └── IHeadRestOptions.cs ├── Mapping └── HeadRestMapDefinition.cs ├── Our.Umbraco.HeadRest.csproj ├── Properties ├── AssemblyInfo.cs └── VersionInfo.cs ├── UmbracoMapperContextExtensions.cs ├── Web ├── Controllers │ ├── AuthorizedHeadRestController.cs │ └── HeadRestController.cs ├── HttpRequestBaseExtensions.cs ├── Mapping │ ├── HeadRestMappingContext.cs │ └── HeadRestViewModelMap.cs ├── Models │ └── NotFoundPublishedContent.cs ├── Mvc │ ├── HeadRestAuthorizeAttribute.cs │ ├── HeadRestExceptionFilterAttribute.cs │ └── HeadRestResult.cs └── Routing │ ├── HeadRestRouteHandler.cs │ ├── HeadRestRouteMap.cs │ ├── HeadRestRouteParamsCollection.cs │ ├── HeadRestUrlProvider.cs │ └── UmbracoRoutesConstraint.cs ├── app.config └── packages.config /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | # build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | [Ii]mport/ 25 | 26 | # Visual Studio 2015 cache/options directory 27 | .vs/ 28 | # Uncomment if you have tasks that create the project's static files in wwwroot 29 | #wwwroot/ 30 | 31 | # MSTest test Results 32 | [Tt]est[Rr]esult*/ 33 | [Bb]uild[Ll]og.* 34 | 35 | # NUNIT 36 | *.VisualState.xml 37 | TestResult.xml 38 | 39 | # Build Results of an ATL Project 40 | [Dd]ebugPS/ 41 | [Rr]eleasePS/ 42 | dlldata.c 43 | 44 | # DNX 45 | project.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | 84 | # Visual Studio profiler 85 | *.psess 86 | *.vsp 87 | *.vspx 88 | *.sap 89 | 90 | # TFS 2012 Local Workspace 91 | $tf/ 92 | 93 | # Guidance Automation Toolkit 94 | *.gpState 95 | 96 | # ReSharper is a .NET coding add-in 97 | _ReSharper*/ 98 | *.[Rr]e[Ss]harper 99 | *.DotSettings.user 100 | 101 | # JustCode is a .NET coding add-in 102 | .JustCode 103 | 104 | # TeamCity is a build add-in 105 | _TeamCity* 106 | 107 | # DotCover is a Code Coverage Tool 108 | *.dotCover 109 | 110 | # NCrunch 111 | _NCrunch_* 112 | .*crunch*.local.xml 113 | nCrunchTemp_* 114 | 115 | # MightyMoose 116 | *.mm.* 117 | AutoTest.Net/ 118 | 119 | # Web workbench (sass) 120 | .sass-cache/ 121 | 122 | # Installshield output folder 123 | [Ee]xpress/ 124 | 125 | # DocProject is a documentation generator add-in 126 | DocProject/buildhelp/ 127 | DocProject/Help/*.HxT 128 | DocProject/Help/*.HxC 129 | DocProject/Help/*.hhc 130 | DocProject/Help/*.hhk 131 | DocProject/Help/*.hhp 132 | DocProject/Help/Html2 133 | DocProject/Help/html 134 | 135 | # Click-Once directory 136 | publish/ 137 | 138 | # Publish Web Output 139 | *.[Pp]ublish.xml 140 | *.azurePubxml 141 | # TODO: Comment the next line if you want to checkin your web deploy settings 142 | # but database connection strings (with potential passwords) will be unencrypted 143 | # *.pubxml 144 | # *.publishproj 145 | 146 | # NuGet Packages 147 | *.nupkg 148 | # The packages folder can be ignored because of Package Restore 149 | **/packages/* 150 | # except build/, which is used as an MSBuild target. 151 | !**/packages/build/ 152 | # Uncomment if necessary however generally it will be regenerated when needed 153 | #!**/packages/repositories.config 154 | 155 | # Windows Azure Build Output 156 | csx/ 157 | *.build.csdef 158 | 159 | # Windows Store app package directory 160 | AppPackages/ 161 | 162 | # Visual Studio cache files 163 | # files ending in .cache can be ignored 164 | *.[Cc]ache 165 | # but keep track of directories ending in .cache 166 | !*.[Cc]ache/ 167 | 168 | # Others 169 | ClientBin/ 170 | [Ss]tyle[Cc]op.* 171 | ~$* 172 | *~ 173 | *.dbmdl 174 | *.dbproj.schemaview 175 | *.pfx 176 | *.publishsettings 177 | node_modules/ 178 | orleans.codegen.cs 179 | 180 | # RIA/Silverlight projects 181 | Generated_Code/ 182 | 183 | # Backup & report files from converting an old project file 184 | # to a newer Visual Studio version. Backup files are not needed, 185 | # because we have git ;-) 186 | _UpgradeReport_Files/ 187 | Backup*/ 188 | UpgradeLog*.XML 189 | UpgradeLog*.htm 190 | 191 | # SQL Server files 192 | *.mdf 193 | *.ldf 194 | 195 | # Business Intelligence projects 196 | *.rdl.data 197 | *.bim.layout 198 | *.bim_*.settings 199 | 200 | # Microsoft Fakes 201 | FakesAssemblies/ 202 | 203 | # GhostDoc plugin setting file 204 | *.GhostDoc.xml 205 | 206 | # Node.js Tools for Visual Studio 207 | .ntvs_analysis.dat 208 | 209 | # Visual Studio 6 build log 210 | *.plg 211 | 212 | # Visual Studio 6 workspace options file 213 | *.opt 214 | 215 | # Visual Studio LightSwitch build output 216 | **/*.HTMLClient/GeneratedArtifacts 217 | **/*.DesktopClient/GeneratedArtifacts 218 | **/*.DesktopClient/ModelManifest.xml 219 | **/*.Server/GeneratedArtifacts 220 | **/*.Server/ModelManifest.xml 221 | _Pvt_Extensions 222 | 223 | # Paket dependency manager 224 | .paket/paket.exe 225 | 226 | # FAKE - F# Make 227 | .fake/ 228 | 229 | # Ignore unimportant folders generated by Umbraco 230 | **/App_Data/ClientDependency/ 231 | **/App_Data/ExamineIndexes/ 232 | **/App_Data/Logs/ 233 | **/App_Data/[Pp]review/ 234 | **/App_Data/TEMP/ 235 | **/App_Data/cache/ 236 | **/css/cache/ 237 | **/scripts/cache/ 238 | **/Media/ 239 | Cached/ 240 | 241 | # Ignore Umbraco content cache file 242 | **/App_Data/umbraco.config 243 | 244 | # Don't ignore Umbraco packages (VisualStudio.gitignore mistakes this for a NuGet packages folder) 245 | # Make sure to include details from VisualStudio.gitignore BEFORE this 246 | !**/App_Data/[Pp]ackages/ 247 | !**/[Uu]mbraco/[Dd]eveloper/[Pp]ackages 248 | 249 | # Custom 250 | build/_nuget 251 | src/Our.Umbraco.AuthU.TestHarness 252 | src/Our.Umbraco.AuthU.Web 253 | src/Our.Umbraco.AuthU.Matt.* -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to this project 2 | 3 | Please take a moment to review this document in order to make the contribution 4 | process easy and effective for everyone involved. 5 | 6 | Following these guidelines helps to communicate that you respect the time of 7 | the developers managing and developing this open source project. In return, 8 | they should reciprocate that respect in addressing your issue or assessing 9 | patches and features. 10 | 11 | 12 | ## Using the issue tracker 13 | 14 | The issue tracker is the preferred channel for [bug reports](#bugs), 15 | [features requests](#features) and [submitting pull 16 | requests](#pull-requests), but please respect the following restrictions: 17 | 18 | * Please **do not** use the issue tracker for personal support requests (use 19 | [Our Umbraco](https://our.umbraco.org) or Twitter). 20 | 21 | * Please **do not** derail or troll issues. Keep the discussion on topic and 22 | respect the opinions of others. 23 | 24 | 25 | 26 | ## Bug reports 27 | 28 | A bug is a _demonstrable problem_ that is caused by the code in the repository. 29 | Good bug reports are extremely helpful - thank you! 30 | 31 | Guidelines for bug reports: 32 | 33 | 1. **Use the GitHub issue search** — check if the issue has already been 34 | reported. 35 | 36 | 2. **Check if the issue has been fixed** — try to reproduce it using the 37 | latest `master` or development branch in the repository. 38 | 39 | 3. **Isolate the problem** — create a reduced test case and a live example. 40 | 41 | A good bug report shouldn't leave others needing to chase you up for more 42 | information. Please try to be as detailed as possible in your report. What is 43 | your environment? What steps will reproduce the issue? What browser(s) and OS 44 | experience the problem? What would you expect to be the outcome? All these 45 | details will help people to fix any potential bugs. 46 | 47 | Example: 48 | 49 | > Short and descriptive example bug report title 50 | > 51 | > A summary of the issue and the browser/OS environment in which it occurs. If 52 | > suitable, include the steps required to reproduce the bug. 53 | > 54 | > 1. This is the first step 55 | > 2. This is the second step 56 | > 3. Further steps, etc. 57 | > 58 | > `` - a link to the reduced test case 59 | > 60 | > Any other information you want to share that is relevant to the issue being 61 | > reported. This might include the lines of code that you have identified as 62 | > causing the bug, and potential solutions (and your opinions on their 63 | > merits). 64 | 65 | 66 | 67 | ## Feature requests 68 | 69 | Feature requests are welcome. But take a moment to find out whether your idea 70 | fits with the scope and aims of the project. It's up to *you* to make a strong 71 | case to convince the project's developers of the merits of this feature. Please 72 | provide as much detail and context as possible. 73 | 74 | 75 | 76 | ## Pull requests 77 | 78 | Good pull requests - patches, improvements, new features - are a fantastic 79 | help. They should remain focused in scope and avoid containing unrelated 80 | commits. 81 | 82 | **Please ask first** before embarking on any significant pull request (e.g. 83 | implementing features, refactoring code, porting to a different language), 84 | otherwise you risk spending a lot of time working on something that the 85 | project's developers might not want to merge into the project. 86 | 87 | Please adhere to the coding conventions used throughout a project (indentation, 88 | accurate comments, etc.) and any other requirements (such as test coverage). 89 | 90 | Follow this process if you'd like your work considered for inclusion in the 91 | project: 92 | 93 | 1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork, 94 | and configure the remotes: 95 | 96 | ```bash 97 | # Clone your fork of the repo into the current directory 98 | git clone https://github.com// 99 | # Navigate to the newly cloned directory 100 | cd 101 | # Assign the original repo to a remote called "upstream" 102 | git remote add upstream https://github.com// 103 | ``` 104 | 105 | 2. If you cloned a while ago, get the latest changes from upstream: 106 | 107 | ```bash 108 | git checkout develop 109 | git pull upstream develop 110 | ``` 111 | 112 | 3. Create a new topic branch (off the main project `develop` branch) to 113 | contain your feature, change, or fix: 114 | 115 | ```bash 116 | git checkout -b 117 | ``` 118 | 119 | 4. Commit your changes in logical chunks. Please adhere to these [git commit 120 | message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) 121 | or your code is unlikely be merged into the main project. Use Git's 122 | [interactive rebase](https://help.github.com/articles/interactive-rebase) 123 | feature to tidy up your commits before making them public. 124 | 125 | 5. Locally merge (or rebase) the upstream development branch into your topic branch: 126 | 127 | ```bash 128 | git pull [--rebase] upstream develop 129 | ``` 130 | 131 | 6. Push your topic branch up to your fork: 132 | 133 | ```bash 134 | git push origin 135 | ``` 136 | 137 | 7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) 138 | with a clear title and description. 139 | 140 | **IMPORTANT**: By submitting a patch, you agree to allow the project owner to 141 | license your work under the same license as that used by the project. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Matt Brailsford 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | HeadRest 2 | 3 | # HeadRest 4 | A REST based headless approach for Umbraco. 5 | 6 | HeadRest converts your Umbraco front end into a REST API by passing ModelsBuilder models through a mapping function to create serializable ViewModels and returning them as JSON payloads. 7 | 8 | Out of the box HeadRest is configured to use UmbracoMapper to perform it's mappings, however you can define your own custom mapper function to use other model mappers such as AutoMapper. 9 | 10 | ## Installation 11 | 12 | ### Nuget 13 | 14 | PM> Install-Package Our.Umbraco.HeadRest 15 | 16 | ## Configuration 17 | In order to configure HeadRest you will first of all need to create an Umbraco composer + compontent combination, resolving the HeadRest service from the DI container like so: 18 | ````csharp 19 | public class HeadRestConfigComponent : IComponent 20 | { 21 | private readonly HeadRest _headRest; 22 | 23 | public HeadRestConfigComponent(HeadRest headRest) 24 | => _headRest = headRest; 25 | 26 | public void Initialize() 27 | { 28 | // Configuration goes here 29 | } 30 | 31 | public void Terminate() { } 32 | } 33 | 34 | public class HeadRestConfigComposer : ComponentComposer 35 | { } 36 | ```` 37 | 38 | From within the `Initialize` method, you can then configure your endpoint(s) via the `ConfigureEndpoint` method on the resolved HeadRest service instance: 39 | ````csharp 40 | ... 41 | _headRest.ConfigureEndpoint(...); 42 | ... 43 | ```` 44 | 45 | ### Basic Configuration 46 | For the most basic implementation, the following minimal configuration is all that is needed: 47 | ````csharp 48 | _headRest.ConfigureEndpoint(new HeadRestOptions { 49 | ViewModelMappings = new HeadRestViewModelMap() 50 | .For(HomePage.ModelTypeAlias).MapTo() 51 | ... 52 | }); 53 | ```` 54 | 55 | This will create an API endpoint at the path `/`, and will be anchored to the first content at the root of the site. It will use the list of `ViewModelMappings` provided to lookup the viewmodel to map a given node to. 56 | 57 | ### Advanced Configuration 58 | For a more advanced implementation, the following configuration shows all the supported options. 59 | ````csharp 60 | _headRest.ConfigureEndpoint("/api/", "/root//nodeTypeAlias[1]", new HeadRestOptions { 61 | Mode = HeadRestEndpointMode.Dedicated, 62 | ControllerType = typeof(HeadRestController), 63 | Mapper = ctx => AutoMapper.Map(ctx.Content, ctx.ContentType, ctx.ViewModelType), 64 | ViewModelMappings = new HeadRestViewModelMap() 65 | .For(HomePage.ModelTypeAlias) 66 | .If(x => x.Request.HeadRestRouteParam("altRoute") == "init") 67 | .MapTo() 68 | .For(HomePage.ModelTypeAlias).MapTo() 69 | .Default().MapTo(), 70 | CustomRouteMappings = new HeadRestRouteMap() 71 | .For("/(?init)/?$").MapTo("/") 72 | }); 73 | ```` 74 | This will create an endpoint at the url `/api/`, and will be anchored to the node at the XPath `/root//nodeTypeAlias[1]`. In addition, the supplied controller will be used to handle the HeadRest requests and the supplied mapper function will be used to perform the mapping. It will use the list of `ViewModelMappings` provided to lookup the viewmodel to map a given node to. Lastly, a custom route is defined to map the url`/api/init/` to the `/api/` URL, storing the string `"init"`, captured via the route pattern, which is then used in the `ViewModelMappings` to map `/api/init/` request to the `InitViewModel` instead of the default `HomePageViewModel`. 75 | 76 | ### Configuration Options 77 | * __basePath : string__ 78 | _[optional, default:"/"]_ 79 | The base path from which your API will be accessible from. 80 | * __rootNodeXPath : string__ 81 | _[optional, default:"/root/*[@isDoc][1]"]_ 82 | The XPath statement for the root node from which to anchor your API endpoint to. 83 | * __Mode : HeadRestEndpointMode__ 84 | _[optional, default:HeadRestEndpointMode.Dedicated]_ 85 | The mode in which the headrest endpoint will run. Can be either `HeadRestEndpointMode.Dedicated`, in which case the generated endpoint URLs will be the primary URLs for the relevant content nodes, or `HeadRestEndpointMode.Mixed`, in which case node will maintain their primary URLs and the endpoint URLs will be added to the nodes "Other URLs" collection. 86 | * __ControllerType : Type__ 87 | _[optional, default:typeof(HeadRestController)]_ 88 | The Controller to use to service the API requests. Controllers must inherit from `HeadRestController`. Useful to add extra FilterAttributes to the request such as AuthU and the `OAuth` attribute. 89 | * __Mapper : Func__ 90 | _[optional, default:ctx => UmbracoMapper.Map(ctx.Content)]_ 91 | A function to perform the map between the nodes ModelsBuilder model and it's associated ViewModel. Defaults to using the build in UmbracoMapper. 92 | * __ViewModelMappings : HeadRestViewModelMap__ 93 | _[required, default:null]_ 94 | A fluent list of mappings to determine which ViewModel a given content type should be mapped to. Multiple mappings can be defined for the same content type by defining a condition for the mapping via the flient `.If(...)` interface. Any conditional mappings should be defined before any non-conditional (fallback) mappings. You can set a default map that will be used if no other matching maps are found by using the `.ForEverythingElse().MapTo()` syntax. If a default map is defined, it must be the last map defined. 95 | * __CustomRouteMappings : HeadRestRouteMap__ 96 | _[optional, default:null]_ 97 | A fluent list of custom route mappings to map any custom routes to a standard built in route. Routes are defined as regex patterns with any captured paramters being made accessible via a `HeadRestRouteParam` extension on the standard `Request` object. Usefull to support multiple routes pointing to the same endpoint URL, or for things like pagination URLs. 98 | 99 | **NB** Whilst the `ViewModelMappings` tells HeadRest which ViewModel to map a content model to, it does *not* tell it how to actually map the properties over. For this you will need to instruct the model mapper using it's predefined mapping approach, for example, with UmbracoMapper you will want to define your mappings via a `MapDefinition` class registered via a composer like so: 100 | ````csharp 101 | public class MyHeadRestMapDefinition : IMapDefinition 102 | { 103 | public void DefineMaps(UmbracoMapper mapper) 104 | { 105 | mapper.Define( 106 | (frm, ctx) => ..., // Constructor function 107 | (frm, to, ctx) => ... // Map function 108 | } 109 | } 110 | 111 | public class MyHeadRestMapDefinisionComposer : IUserComposer 112 | { 113 | public void Compose(Composition composition) 114 | { 115 | composition.WithCollectionBuilder() 116 | .Add(); 117 | } 118 | } 119 | ```` 120 | ## How is HeadRest different to Umbraco Headless? 121 | | | HeadRest | Umbraco Headless | 122 | |-|----------|---------------| 123 | | Configuration | HeadRest requires configuring via a code based API so requires C# knowledge | Zero config required | 124 | | Maintenance | You are responsible for applying security patches / updates | Automatic updates | 125 | | Scalability | You are responsible for making the API scalable for your needs | Automatic scalability | 126 | | API | Fixed API based on compiled ViewModels | Flexible query language | 127 | | Security | You are responsible for securing your API (Suggest [AuthU](https://github.com/mattbrailsford/umbraco-authu)) | Security baked in | 128 | | Back office UI | Potentially unused features visible | Unused features disabled | 129 | | Supports use of 3rd party packages | Yes | No | 130 | | Supports mixed install | Yes. You can have a headless API + website in one install | No. Headless only install | 131 | | Supports custom backend code | Yes | No | 132 | | Client libraries available | None. Roll your own | .NET Framework, .NET Core, Node.js | 133 | | Hosting | Installs to any Umbraco version (7.12+) | Umbraco Cloud service only | 134 | | Support | Limited community support | HQ Supported | 135 | 136 | ## Contributing To This Project 137 | 138 | Anyone and everyone is welcome to contribute. Please take a moment to review the [guidelines for contributing](CONTRIBUTING.md). 139 | 140 | * [Bug reports](CONTRIBUTING.md#bugs) 141 | * [Feature requests](CONTRIBUTING.md#features) 142 | * [Pull requests](CONTRIBUTING.md#pull-requests) 143 | 144 | ## License 145 | 146 | Copyright © 2019 Matt Brailsford, Outfield Digital Ltd 147 | 148 | Licensed under the [MIT License](LICENSE) 149 | 150 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | image: Visual Studio 2017 2 | 3 | # version format 4 | version: 0.2.0.{build} 5 | 6 | # UMBRACO_PACKAGE_PRERELEASE_SUFFIX if a rtm release build this should be blank, otherwise if empty will default to alpha 7 | # example UMBRACO_PACKAGE_PRERELEASE_SUFFIX=beta 8 | init: 9 | - set UMBRACO_PACKAGE_PRERELEASE_SUFFIX= 10 | 11 | cache: 12 | - src\packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified 13 | 14 | before_build: 15 | - nuget restore src 16 | 17 | build_script: 18 | - build-appveyor.cmd 19 | 20 | artifacts: 21 | - path: artifacts\*.nupkg 22 | - path: artifacts\*.zip 23 | 24 | deploy: 25 | # GitHub Deployment for releases 26 | - provider: GitHub 27 | auth_token: 28 | secure: k1eoY0KXg/FPYKGDeVJCl31exw28E7ToEZmAgc2M9VfbnSN6HeWltfTe7u20lvP7 29 | artifact: /.*\.zip/ # upload all Zip packages to release assets 30 | draft: false 31 | prerelease: false 32 | on: 33 | branch: master 34 | appveyor_repo_tag: true # deploy on tag push only 35 | 36 | # NuGet Deployment for releases 37 | - provider: NuGet 38 | server: 39 | api_key: 40 | secure: q2Aov00i+eWTpbwWHB1JN8EAGw4o8FaOC2lj2MolyS6TGkUUFTJK/vQTQzaf/EQ5 41 | artifact: /.*\.nupkg/ 42 | on: 43 | branch: master 44 | appveyor_repo_tag: true 45 | -------------------------------------------------------------------------------- /assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattbrailsford/umbraco-headrest/a50f41145e6b9481ed5b739fa2cbf6e7ef1cb27b/assets/logo.png -------------------------------------------------------------------------------- /assets/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 21 | 29 | 34 | 35 | 43 | 48 | 49 | 57 | 62 | 63 | 71 | 76 | 77 | 78 | 98 | 100 | 101 | 103 | image/svg+xml 104 | 106 | 107 | 108 | 109 | 110 | 114 | 118 | 124 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /build-appveyor.cmd: -------------------------------------------------------------------------------- 1 | ECHO APPVEYOR_REPO_BRANCH: %APPVEYOR_REPO_BRANCH% 2 | ECHO APPVEYOR_REPO_TAG: %APPVEYOR_REPO_TAG% 3 | ECHO APPVEYOR_BUILD_NUMBER : %APPVEYOR_BUILD_NUMBER% 4 | ECHO APPVEYOR_BUILD_VERSION : %APPVEYOR_BUILD_VERSION% 5 | 6 | CALL src\.nuget\NuGet.exe restore src\Our.Umbraco.HeadRest.sln 7 | CALL "%programfiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\amd64\MsBuild.exe" build\package.proj -------------------------------------------------------------------------------- /build.cmd: -------------------------------------------------------------------------------- 1 | ECHO off 2 | 3 | SET /P APPVEYOR_BUILD_NUMBER=Please enter a build number (e.g. 134): 4 | SET /P PACKAGE_VERISON=Please enter your package version (e.g. 1.0.5): 5 | SET /P UMBRACO_PACKAGE_PRERELEASE_SUFFIX=Please enter your package release suffix or leave empty (e.g. beta): 6 | 7 | SET /P APPVEYOR_REPO_TAG=If you want to simulate a GitHub tag for a release (e.g. true): 8 | 9 | if "%APPVEYOR_BUILD_NUMBER%" == "" ( 10 | SET APPVEYOR_BUILD_NUMBER=100 11 | ) 12 | if "%PACKAGE_VERISON%" == "" ( 13 | SET PACKAGE_VERISON=0.0.0 14 | ) 15 | 16 | SET APPVEYOR_BUILD_VERSION=%PACKAGE_VERISON%.%APPVEYOR_BUILD_NUMBER% 17 | 18 | build-appveyor.cmd 19 | 20 | @IF %ERRORLEVEL% NEQ 0 GOTO err 21 | @EXIT /B 0 22 | :err 23 | @PAUSE 24 | @EXIT /B 1 -------------------------------------------------------------------------------- /build/package.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 0.0.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /build/package.proj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | $(MSBuildProjectDirectory)\tools\MSBuildCommunityTasks 7 | $(MSBuildProjectDirectory)\tools\MSBuildNugetTasks 8 | $(MSBuildProjectDirectory)\tools\AppVeyorUmbraco 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Our.Umbraco.HeadRest 18 | Our.Umbraco.HeadRest 19 | Our.Umbraco.HeadRest 20 | A REST based headless approach for Umbraco 21 | Matt Brailsford 22 | https://github.com/mattbrailsford/umbraco-headrest/graphs/contributors 23 | Matt Brailsford 24 | Copyright © 2018 Matt Brailsford 25 | MIT license 26 | http://opensource.org/licenses/MIT 27 | false 28 | https://github.com/mattbrailsford/umbraco-headrest 29 | https://raw.githubusercontent.com/mattbrailsford/umbraco-headrest/master/assets/logo.png 30 | umbraco rest headless 31 | en-GB 32 | 33 | 34 | 35 | 36 | $(APPVEYOR_BUILD_VERSION) 37 | 38 | 39 | 40 | 41 | false 42 | 43 | 44 | 45 | 46 | true 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | true 55 | 56 | 57 | 58 | 59 | false 60 | 61 | 62 | 63 | 64 | 65 | 66 | Release 67 | $(MSBuildProjectDirectory)\.. 68 | $(MSBuildProjectDirectory)\_nuget 69 | $(RootDir)\artifacts 70 | $(RootDir)\src\$(ProjectName) 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 167 | 168 | 169 | 170 | -------------------------------------------------------------------------------- /build/readme.txt: -------------------------------------------------------------------------------- 1 | =============================================================== 2 | HeadRest 3 | =============================================================== 4 | 5 | HeadRest has been installed! 6 | 7 | Please review the documentation on GitHub to get starterd 8 | - https://github.com/mattbrailsford/umbraco-headrest -------------------------------------------------------------------------------- /build/tools/AppVeyorUmbraco/AppVeyorUmbraco.Targets: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /build/tools/MSBuildCommunityTasks/ICSharpCode.SharpZipLib.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattbrailsford/umbraco-headrest/a50f41145e6b9481ed5b739fa2cbf6e7ef1cb27b/build/tools/MSBuildCommunityTasks/ICSharpCode.SharpZipLib.dll -------------------------------------------------------------------------------- /build/tools/MSBuildCommunityTasks/MSBuild.Community.Tasks.Targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | $(MSBuildExtensionsPath)\MSBuildCommunityTasks 7 | $(MSBuildCommunityTasksPath)\MSBuild.Community.Tasks.dll 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /build/tools/MSBuildCommunityTasks/MSBuild.Community.Tasks.chm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattbrailsford/umbraco-headrest/a50f41145e6b9481ed5b739fa2cbf6e7ef1cb27b/build/tools/MSBuildCommunityTasks/MSBuild.Community.Tasks.chm -------------------------------------------------------------------------------- /build/tools/MSBuildCommunityTasks/MSBuild.Community.Tasks.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mattbrailsford/umbraco-headrest/a50f41145e6b9481ed5b739fa2cbf6e7ef1cb27b/build/tools/MSBuildCommunityTasks/MSBuild.Community.Tasks.dll -------------------------------------------------------------------------------- /build/tools/MSBuildCommunityTasks/Sample.proj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 67 | 68 | 69 | 70 | 71 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 91 | 92 | 93 | 94 | 104 | 105 | 106 | 107 | list = new List(); 110 | list.Add("Happy"); 111 | list.Add("New"); 112 | list.Add("Year"); 113 | Console.WriteLine("Hello MSBuild Community Scripting World."); 114 | foreach(string s in list) 115 | { 116 | Console.WriteLine(s); 117 | } 118 | } 119 | ]]> 120 | 121 | 122 | 123 | 124 |