Rocketmakers.Templates.Http 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Rocketmakers.Templates.Http --version 0.1.0                
NuGet\Install-Package Rocketmakers.Templates.Http -Version 0.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Rocketmakers.Templates.Http" Version="0.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Rocketmakers.Templates.Http --version 0.1.0                
#r "nuget: Rocketmakers.Templates.Http, 0.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Rocketmakers.Templates.Http as a Cake Addin
#addin nuget:?package=Rocketmakers.Templates.Http&version=0.1.0

// Install Rocketmakers.Templates.Http as a Cake Tool
#tool nuget:?package=Rocketmakers.Templates.Http&version=0.1.0                

Rocketmakers.Templates

A library for interacting with templates stored in a remote repository.

Setup

The template service can be set up like below:

// Initialise the template service
var templateService = new HttpTemplateService(
    repository: new AnonTemplateRepository(
        new HttpClient { BaseAddress = config.RepositoryUrl }
    ),
    cache: new InMemoryTemplateContentCache(
        new InMemoryTemplateContentCacheConfig(
            UseCache: true,
            CacheExpirySeconds: 3600
        )
    )
);

The template service can be injected by using the Rocketmakers.Templates.Http.ServiceCollectionExtensions.AddHttpTemplateService extension method like below:

// Inject service into Microsoft.Extensions.DependencyInjection.IServiceCollection
services.AddHttpTemplateService(
    repositoryUrl: new Uri("http://my-repository-url"), 
    cacheConfig: new InMemoryTemplateContentCacheConfig(
        UseCache: true,
        CacheExpirySeconds: 3600
    )
);

Usage

// Maps to 'myService.json' in the repository containing your templates. This is what contains the 
// metadata describing the location of the layouts and partials comprising your templates
var serviceName = "myService";

// Get the latest templates for your service
TemplateGroup templateGroup = await templateService.GetTemplatesAsync(serviceName); 

var renderer = new HandleBarsTemplateRenderer();

// Update the renderer with the latest templates
await renderer.UpdateTemplateGroupAsync(templateGroup);

// Render the template with the supplied payload of parameters
IReadOnlyCollection<RenderedTemplate> rendered = await renderer.RenderAsync(
    layoutId: "My layout", 
    payload: new { username = "Alan", returnUrl = "https://rocketmakers.com" });
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.2.2 2,918 11/4/2024
0.2.1 14,614 5/5/2023
0.2.0 5,301 1/5/2023
0.1.0 314 11/23/2022

# Changelog  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.  ### 0.0.1 (2022-11-23)   ### Features  * Add interface definitions ([dc656b3](https://gitlab.com/rocketmakers/core/templates/commit/dc656b35839d7b6f3b6059ec2535ee5e8d2b526a)) * **dotnet-templates:** AnonTemplateFetcher.GetContentAsync() ([0fc5030](https://gitlab.com/rocketmakers/core/templates/commit/0fc5030b56adb28097e3fecef0e36d0c86857998)) * **dotnet-templates:** Get content and etag via AnonTemplateFetcher ([b616314](https://gitlab.com/rocketmakers/core/templates/commit/b616314036c9c5667935ccff04a380000bd790b1)) * **dotnet-templates:** Handle different bad http status codes in AnonTemplateFetcher ([7b95d05](https://gitlab.com/rocketmakers/core/templates/commit/7b95d0540d8a4f8afe57328c12b0c98d4fad5a6e)) * **dotnet-templates:** Implement AnonTemplateFetcher.GetTemplateGroupMetadataAsync() ([88dd01c](https://gitlab.com/rocketmakers/core/templates/commit/88dd01cbb381852b95a97a630ca1893cb59b0daa)) * **dotnet-templates:** Implement HandleBarsTemplateRenderer and AnonTemplateFetcher (partially) ([bf23938](https://gitlab.com/rocketmakers/core/templates/commit/bf239383e8ac9d91262c5a3bde57840b55ac9971)) * **dotnet-templates:** Implement HttpTemplateRetriever and test via CLI ([356ce5d](https://gitlab.com/rocketmakers/core/templates/commit/356ce5d1e9b0d7454c17a8d74778f7fea1e1f46f)) * **dotnet-templates:** Implement the handlebars renderer ([a661cdc](https://gitlab.com/rocketmakers/core/templates/commit/a661cdc3d224a9bb6073c25af839585c06347a14))   ### Bug Fixes  * Actually install dotnet CLI when doing dotnet things ([fc37a3d](https://gitlab.com/rocketmakers/core/templates/commit/fc37a3dae8ab429ac3b5c23953800ffba7cbf6ff)) * **dotnet-templates:** Add  to fetcher response stream ([263a3b6](https://gitlab.com/rocketmakers/core/templates/commit/263a3b67080d0c27ad94a9bebf9ef0b919c5d267)) * **dotnet-templates:** Add missing import ([de05b9d](https://gitlab.com/rocketmakers/core/templates/commit/de05b9d916dd84d4e9f1656110e092b892bb9152)) * **dotnet-templates:** Avoid exceptions getting values from dictionaries in HandlebarsTemplateRenderer ([5e79242](https://gitlab.com/rocketmakers/core/templates/commit/5e79242c4af0db29c3b8c118aa28cf4bf1fb6f69))   ### CI  * **config:** Don't wait for code_quality before running MR reminder ([1746659](https://gitlab.com/rocketmakers/core/templates/commit/17466597321a7be39c791b98a247dbbd6b75b33f))   ### Tests  * **dotnet-templates:** More tests for the HandlebarsTemplateRenderer ([6072390](https://gitlab.com/rocketmakers/core/templates/commit/6072390310cf1bb6c0c4eee993a09c7e4518574b)) * **dotnet-templates:** Rename AnonTemplateFetcherTests.cs -> AnonTemplateFetcherTests/GetTemplateGroupMetadataAsyncTests.cs ([90060c9](https://gitlab.com/rocketmakers/core/templates/commit/90060c92462afbd8b1451ebf12ea9b54ea9d828c))   ### Code Refactoring  * **dotnet-templates:** Add AnonTemplateFetcher.GetFullAddress() ([8d08960](https://gitlab.com/rocketmakers/core/templates/commit/8d0896029e16bc36201e19d294ab528f88dd112b)) * **dotnet-templates:** Use C# conventions and improved types ([536f40c](https://gitlab.com/rocketmakers/core/templates/commit/536f40cce05b101638541c2af5e6ce280385f1ae)) * **dotnet-templates:** Use const for not specified etag ([90550c2](https://gitlab.com/rocketmakers/core/templates/commit/90550c2f73790979b94d716ed1f570e3e85d69bd)) * **dotnet-templates:** Use MockHttpClient.When() for setting up a not found address ([8b17f48](https://gitlab.com/rocketmakers/core/templates/commit/8b17f488813fc75dc31c62bf47d2b32cf15259e7)) * **dotnet-templates:** Use non-static handlebars ([5fd3493](https://gitlab.com/rocketmakers/core/templates/commit/5fd34933d018d4abb192b85fc0797ab1a204fa81)) * **dotnet-templates:** Use non-static handlebars ([567a73d](https://gitlab.com/rocketmakers/core/templates/commit/567a73d618df0e4be98411c61fa1f4a484b58532))   ### Other Changes  * Add to .gitignore ([2e4ce6d](https://gitlab.com/rocketmakers/core/templates/commit/2e4ce6dc1c3117285d410e42ef15b47b419edd44)) * **config:** Use latest node 18 for ts scripts ([52164bf](https://gitlab.com/rocketmakers/core/templates/commit/52164bf98409f23b4687fec60da07b1fc712daa4)) * Ignore gitlab-ci config in prettier ([1ea8141](https://gitlab.com/rocketmakers/core/templates/commit/1ea8141d8d44976715fd02cbee89bf7ba35a4808)) * Initial commit ([eb47961](https://gitlab.com/rocketmakers/core/templates/commit/eb479612d7b218fc8131f3fba77eb2b3989ba1db))  ### 0.0.1 (2022-11-23)   ### Features  * Add interface definitions ([dc656b3](https://gitlab.com/rocketmakers/core/templates/commit/dc656b35839d7b6f3b6059ec2535ee5e8d2b526a)) * **dotnet-templates:** AnonTemplateFetcher.GetContentAsync() ([0fc5030](https://gitlab.com/rocketmakers/core/templates/commit/0fc5030b56adb28097e3fecef0e36d0c86857998)) * **dotnet-templates:** Get content and etag via AnonTemplateFetcher ([b616314](https://gitlab.com/rocketmakers/core/templates/commit/b616314036c9c5667935ccff04a380000bd790b1)) * **dotnet-templates:** Handle different bad http status codes in AnonTemplateFetcher ([7b95d05](https://gitlab.com/rocketmakers/core/templates/commit/7b95d0540d8a4f8afe57328c12b0c98d4fad5a6e)) * **dotnet-templates:** Implement AnonTemplateFetcher.GetTemplateGroupMetadataAsync() ([88dd01c](https://gitlab.com/rocketmakers/core/templates/commit/88dd01cbb381852b95a97a630ca1893cb59b0daa)) * **dotnet-templates:** Implement HandleBarsTemplateRenderer and AnonTemplateFetcher (partially) ([bf23938](https://gitlab.com/rocketmakers/core/templates/commit/bf239383e8ac9d91262c5a3bde57840b55ac9971)) * **dotnet-templates:** Implement HttpTemplateRetriever and test via CLI ([356ce5d](https://gitlab.com/rocketmakers/core/templates/commit/356ce5d1e9b0d7454c17a8d74778f7fea1e1f46f)) * **dotnet-templates:** Implement the handlebars renderer ([a661cdc](https://gitlab.com/rocketmakers/core/templates/commit/a661cdc3d224a9bb6073c25af839585c06347a14))   ### Bug Fixes  * Actually install dotnet CLI when doing dotnet things ([fc37a3d](https://gitlab.com/rocketmakers/core/templates/commit/fc37a3dae8ab429ac3b5c23953800ffba7cbf6ff)) * **dotnet-templates:** Add  to fetcher response stream ([263a3b6](https://gitlab.com/rocketmakers/core/templates/commit/263a3b67080d0c27ad94a9bebf9ef0b919c5d267)) * **dotnet-templates:** Add missing import ([de05b9d](https://gitlab.com/rocketmakers/core/templates/commit/de05b9d916dd84d4e9f1656110e092b892bb9152)) * **dotnet-templates:** Avoid exceptions getting values from dictionaries in HandlebarsTemplateRenderer ([5e79242](https://gitlab.com/rocketmakers/core/templates/commit/5e79242c4af0db29c3b8c118aa28cf4bf1fb6f69))   ### CI  * **config:** Don't wait for code_quality before running MR reminder ([1746659](https://gitlab.com/rocketmakers/core/templates/commit/17466597321a7be39c791b98a247dbbd6b75b33f))   ### Tests  * **dotnet-templates:** More tests for the HandlebarsTemplateRenderer ([6072390](https://gitlab.com/rocketmakers/core/templates/commit/6072390310cf1bb6c0c4eee993a09c7e4518574b)) * **dotnet-templates:** Rename AnonTemplateFetcherTests.cs -> AnonTemplateFetcherTests/GetTemplateGroupMetadataAsyncTests.cs ([90060c9](https://gitlab.com/rocketmakers/core/templates/commit/90060c92462afbd8b1451ebf12ea9b54ea9d828c))   ### Code Refactoring  * **dotnet-templates:** Add AnonTemplateFetcher.GetFullAddress() ([8d08960](https://gitlab.com/rocketmakers/core/templates/commit/8d0896029e16bc36201e19d294ab528f88dd112b)) * **dotnet-templates:** Use C# conventions and improved types ([536f40c](https://gitlab.com/rocketmakers/core/templates/commit/536f40cce05b101638541c2af5e6ce280385f1ae)) * **dotnet-templates:** Use const for not specified etag ([90550c2](https://gitlab.com/rocketmakers/core/templates/commit/90550c2f73790979b94d716ed1f570e3e85d69bd)) * **dotnet-templates:** Use MockHttpClient.When() for setting up a not found address ([8b17f48](https://gitlab.com/rocketmakers/core/templates/commit/8b17f488813fc75dc31c62bf47d2b32cf15259e7)) * **dotnet-templates:** Use non-static handlebars ([5fd3493](https://gitlab.com/rocketmakers/core/templates/commit/5fd34933d018d4abb192b85fc0797ab1a204fa81)) * **dotnet-templates:** Use non-static handlebars ([567a73d](https://gitlab.com/rocketmakers/core/templates/commit/567a73d618df0e4be98411c61fa1f4a484b58532))   ### Other Changes  * Add to .gitignore ([2e4ce6d](https://gitlab.com/rocketmakers/core/templates/commit/2e4ce6dc1c3117285d410e42ef15b47b419edd44)) * **config:** Use latest node 18 for ts scripts ([52164bf](https://gitlab.com/rocketmakers/core/templates/commit/52164bf98409f23b4687fec60da07b1fc712daa4)) * Ignore gitlab-ci config in prettier ([1ea8141](https://gitlab.com/rocketmakers/core/templates/commit/1ea8141d8d44976715fd02cbee89bf7ba35a4808)) * Initial commit ([eb47961](https://gitlab.com/rocketmakers/core/templates/commit/eb479612d7b218fc8131f3fba77eb2b3989ba1db))  ### 0.0.1 (2022-11-23)   ### Features  * Add interface definitions ([dc656b3](https://gitlab.com/rocketmakers/core/templates/commit/dc656b35839d7b6f3b6059ec2535ee5e8d2b526a)) * **dotnet-templates:** AnonTemplateFetcher.GetContentAsync() ([0fc5030](https://gitlab.com/rocketmakers/core/templates/commit/0fc5030b56adb28097e3fecef0e36d0c86857998)) * **dotnet-templates:** Get content and etag via AnonTemplateFetcher ([b616314](https://gitlab.com/rocketmakers/core/templates/commit/b616314036c9c5667935ccff04a380000bd790b1)) * **dotnet-templates:** Handle different bad http status codes in AnonTemplateFetcher ([7b95d05](https://gitlab.com/rocketmakers/core/templates/commit/7b95d0540d8a4f8afe57328c12b0c98d4fad5a6e)) * **dotnet-templates:** Implement AnonTemplateFetcher.GetTemplateGroupMetadataAsync() ([88dd01c](https://gitlab.com/rocketmakers/core/templates/commit/88dd01cbb381852b95a97a630ca1893cb59b0daa)) * **dotnet-templates:** Implement HandleBarsTemplateRenderer and AnonTemplateFetcher (partially) ([bf23938](https://gitlab.com/rocketmakers/core/templates/commit/bf239383e8ac9d91262c5a3bde57840b55ac9971)) * **dotnet-templates:** Implement HttpTemplateRetriever and test via CLI ([356ce5d](https://gitlab.com/rocketmakers/core/templates/commit/356ce5d1e9b0d7454c17a8d74778f7fea1e1f46f)) * **dotnet-templates:** Implement the handlebars renderer ([a661cdc](https://gitlab.com/rocketmakers/core/templates/commit/a661cdc3d224a9bb6073c25af839585c06347a14))   ### Bug Fixes  * Actually install dotnet CLI when doing dotnet things ([fc37a3d](https://gitlab.com/rocketmakers/core/templates/commit/fc37a3dae8ab429ac3b5c23953800ffba7cbf6ff)) * **dotnet-templates:** Add  to fetcher response stream ([263a3b6](https://gitlab.com/rocketmakers/core/templates/commit/263a3b67080d0c27ad94a9bebf9ef0b919c5d267)) * **dotnet-templates:** Add missing import ([de05b9d](https://gitlab.com/rocketmakers/core/templates/commit/de05b9d916dd84d4e9f1656110e092b892bb9152)) * **dotnet-templates:** Avoid exceptions getting values from dictionaries in HandlebarsTemplateRenderer ([5e79242](https://gitlab.com/rocketmakers/core/templates/commit/5e79242c4af0db29c3b8c118aa28cf4bf1fb6f69))   ### CI  * **config:** Don't wait for code_quality before running MR reminder ([1746659](https://gitlab.com/rocketmakers/core/templates/commit/17466597321a7be39c791b98a247dbbd6b75b33f))   ### Tests  * **dotnet-templates:** More tests for the HandlebarsTemplateRenderer ([6072390](https://gitlab.com/rocketmakers/core/templates/commit/6072390310cf1bb6c0c4eee993a09c7e4518574b)) * **dotnet-templates:** Rename AnonTemplateFetcherTests.cs -> AnonTemplateFetcherTests/GetTemplateGroupMetadataAsyncTests.cs ([90060c9](https://gitlab.com/rocketmakers/core/templates/commit/90060c92462afbd8b1451ebf12ea9b54ea9d828c))   ### Code Refactoring  * **dotnet-templates:** Add AnonTemplateFetcher.GetFullAddress() ([8d08960](https://gitlab.com/rocketmakers/core/templates/commit/8d0896029e16bc36201e19d294ab528f88dd112b)) * **dotnet-templates:** Use C# conventions and improved types ([536f40c](https://gitlab.com/rocketmakers/core/templates/commit/536f40cce05b101638541c2af5e6ce280385f1ae)) * **dotnet-templates:** Use const for not specified etag ([90550c2](https://gitlab.com/rocketmakers/core/templates/commit/90550c2f73790979b94d716ed1f570e3e85d69bd)) * **dotnet-templates:** Use MockHttpClient.When() for setting up a not found address ([8b17f48](https://gitlab.com/rocketmakers/core/templates/commit/8b17f488813fc75dc31c62bf47d2b32cf15259e7)) * **dotnet-templates:** Use non-static handlebars ([5fd3493](https://gitlab.com/rocketmakers/core/templates/commit/5fd34933d018d4abb192b85fc0797ab1a204fa81)) * **dotnet-templates:** Use non-static handlebars ([567a73d](https://gitlab.com/rocketmakers/core/templates/commit/567a73d618df0e4be98411c61fa1f4a484b58532))   ### Other Changes  * Add to .gitignore ([2e4ce6d](https://gitlab.com/rocketmakers/core/templates/commit/2e4ce6dc1c3117285d410e42ef15b47b419edd44)) * **config:** Use latest node 18 for ts scripts ([52164bf](https://gitlab.com/rocketmakers/core/templates/commit/52164bf98409f23b4687fec60da07b1fc712daa4)) * Ignore gitlab-ci config in prettier ([1ea8141](https://gitlab.com/rocketmakers/core/templates/commit/1ea8141d8d44976715fd02cbee89bf7ba35a4808)) * Initial commit ([eb47961](https://gitlab.com/rocketmakers/core/templates/commit/eb479612d7b218fc8131f3fba77eb2b3989ba1db))  ### 0.0.1 (2022-11-22)   ### Features  * **dotnet-templates:** Get templates via cached http requests ([75196a4](https://gitlab.com/rocketmakers/core/templates/commit/75196a4c7e87e59375f2c4b68961ee908b605020)) * **dotnet-templates:** Implement HandleBarsTemplateRenderer and AnonTemplateFetcher (partially) ([bf23938](https://gitlab.com/rocketmakers/core/templates/commit/bf239383e8ac9d91262c5a3bde57840b55ac9971))   ### Other Changes  * Initial commit ([eb47961](https://gitlab.com/rocketmakers/core/templates/commit/eb479612d7b218fc8131f3fba77eb2b3989ba1db))   ### CI  * **config:** Don't wait for code_quality before running MR reminder ([1746659](https://gitlab.com/rocketmakers/core/templates/commit/17466597321a7be39c791b98a247dbbd6b75b33f)) * **config:** Target tech-dotnet for MR reminders ([a6a16ca](https://gitlab.com/rocketmakers/core/templates/commit/a6a16ca17618925c2da89b5497a3c66e9bf23184))