Class OpenBiApiClientHtmlItemTemplateExtensions
Extension methods for the /htmlitems REST API: the items the server knows, what each one accepts,
and the templates that render them.
public static class OpenBiApiClientHtmlItemTemplateExtensions
- Inheritance
-
objectOpenBiApiClientHtmlItemTemplateExtensions
Methods
CreateHtmlItemTemplateAsync(IOpenBiApiClient, string, CmsItemTemplate, CancellationToken)
Creates a new template. The tag on template is set to tagName
regardless of what it was passed in as. Name is required (400 when empty),
and a template with the same tag, id and language fails with 409 - UpdateHtmlItemTemplateAsync(IOpenBiApiClient, string, string, string, CmsItemTemplate, CancellationToken)
creates as well as updates. For a CMS page layout, create it under the PAGE tag.
public static Task<CmsItemTemplate?> CreateHtmlItemTemplateAsync(this IOpenBiApiClient client, string tagName, CmsItemTemplate template, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClienttagNamestringtemplateCmsItemTemplatecancellationTokenCancellationToken
Returns
- Task<CmsItemTemplate>
DeleteHtmlItemTemplateAsync(IOpenBiApiClient, string, string, string, CancellationToken)
Deletes one specific language variant of a template. The other languages and the default stay, so the item
keeps rendering for them. An empty language is the default, and removing that removes the
template: every language variant goes with it, as with DeleteHtmlItemTemplatesAsync(IOpenBiApiClient, string, string, CancellationToken).
public static Task DeleteHtmlItemTemplateAsync(this IOpenBiApiClient client, string tagName, string id, string language, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClienttagNamestringidstringlanguagestringcancellationTokenCancellationToken
Returns
- Task
DeleteHtmlItemTemplateDefaultAsync(IOpenBiApiClient, string, string, CancellationToken)
Deletes the default-language (empty language) variant of a template, and with it every other language - the same as DeleteHtmlItemTemplatesAsync(IOpenBiApiClient, string, string, CancellationToken).
public static Task DeleteHtmlItemTemplateDefaultAsync(this IOpenBiApiClient client, string tagName, string id, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClienttagNamestringidstringcancellationTokenCancellationToken
Returns
- Task
DeleteHtmlItemTemplatesAsync(IOpenBiApiClient, string, string, CancellationToken)
Deletes every language variant of a template, the default among them. Its history is kept.
public static Task DeleteHtmlItemTemplatesAsync(this IOpenBiApiClient client, string tagName, string id, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClienttagNamestringidstringcancellationTokenCancellationToken
Returns
- Task
GetHtmlItemAsync(IOpenBiApiClient, string, CancellationToken)
One html item with the attributes it takes and the placeholders it replaces.
public static Task<HtmlItemDefinition> GetHtmlItemAsync(this IOpenBiApiClient client, string tagName, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClienttagNamestringcancellationTokenCancellationToken
Returns
- Task<HtmlItemDefinition>
Exceptions
- OpenBiApiException
No html item with this tag name.
GetHtmlItemTemplateAsync(IOpenBiApiClient, string, string, string, CancellationToken)
Gets one specific language variant of a template (GET htmlitems/{tagName}/templates/{id}/{language}).
Throws an OpenBiApiException with status 404 when that language has no variant of its own;
fall back to GetHtmlItemTemplateDefaultAsync(IOpenBiApiClient, string, string, CancellationToken) then.
public static Task<CmsItemTemplate> GetHtmlItemTemplateAsync(this IOpenBiApiClient client, string tagName, string id, string language, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClienttagNamestringidstringlanguagestringcancellationTokenCancellationToken
Returns
- Task<CmsItemTemplate>
GetHtmlItemTemplateDefaultAsync(IOpenBiApiClient, string, string, CancellationToken)
Gets the default-language (empty language) variant of one template - the fallback the CMS renders where a language has no variant of its own. Throws an OpenBiApiException with status 404 when there is none.
public static Task<CmsItemTemplate> GetHtmlItemTemplateDefaultAsync(this IOpenBiApiClient client, string tagName, string id, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClienttagNamestringidstringcancellationTokenCancellationToken
Returns
- Task<CmsItemTemplate>
GetHtmlItemTemplateHistoryAsync(IOpenBiApiClient, string, string, string?, OpenBiListRequest?, CancellationToken)
Lists the saved versions of one template, newest first (GET htmlitems/{tagName}/templates/{id}/history).
With a language it is that language variant's history; without one, the history of the
default-language (empty language) variant - not of every language.
public static Task<OpenBiListResult<CmsItemTemplateHistory>> GetHtmlItemTemplateHistoryAsync(this IOpenBiApiClient client, string tagName, string id, string? language = null, OpenBiListRequest? request = null, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClienttagNamestringidstringlanguagestringrequestOpenBiListRequestcancellationTokenCancellationToken
Returns
GetHtmlItemTemplatesAsync(IOpenBiApiClient, OpenBiListRequest?, CancellationToken)
Lists every template across every tag (cross-tag search via the standard list query parameters).
public static Task<OpenBiListResult<CmsItemTemplate>> GetHtmlItemTemplatesAsync(this IOpenBiApiClient client, OpenBiListRequest? request = null, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClientrequestOpenBiListRequestcancellationTokenCancellationToken
Returns
- Task<OpenBiListResult<CmsItemTemplate>>
GetHtmlItemTemplatesByIdAsync(IOpenBiApiClient, string, string, OpenBiListRequest?, CancellationToken)
Lists every language variant of one template (tag + id), the default among them
(GET htmlitems/{tagName}/templates/{id}).
public static Task<OpenBiListResult<CmsItemTemplate>> GetHtmlItemTemplatesByIdAsync(this IOpenBiApiClient client, string tagName, string id, OpenBiListRequest? request = null, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClienttagNamestringidstringrequestOpenBiListRequestcancellationTokenCancellationToken
Returns
- Task<OpenBiListResult<CmsItemTemplate>>
GetHtmlItemTemplatesForTagAsync(IOpenBiApiClient, string, OpenBiListRequest?, CancellationToken)
Lists every template defined for the given HTML item tag, across all ids and languages
(GET htmlitems/{tagName}/templates). The templates of PAGE are the base layouts of the CMS
websites.
public static Task<OpenBiListResult<CmsItemTemplate>> GetHtmlItemTemplatesForTagAsync(this IOpenBiApiClient client, string tagName, OpenBiListRequest? request = null, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClienttagNamestringrequestOpenBiListRequestcancellationTokenCancellationToken
Returns
- Task<OpenBiListResult<CmsItemTemplate>>
GetHtmlItemsAsync(IOpenBiApiClient, CancellationToken)
Lists every html item the server knows - the ones it and its plugins ship, and the Razor tag helpers.
public static Task<IReadOnlyList<HtmlItem>> GetHtmlItemsAsync(this IOpenBiApiClient client, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClientcancellationTokenCancellationToken
Returns
- Task<IReadOnlyList<HtmlItem>>
Remarks
The list carries only what identifies an item. What one accepts is in GetHtmlItemAsync(IOpenBiApiClient, string, CancellationToken), and the templates that render it are under GetHtmlItemTemplatesForTagAsync(IOpenBiApiClient, string, OpenBiListRequest?, CancellationToken).
SearchHtmlItemTemplatesAsync(IOpenBiApiClient, string?, string?, string?, string?, string?, CancellationToken)
Searches templates across every html item, by name and optionally by what they contain, narrowed by
any of the filters (GET htmlitems/templates/search). name and content are
alternatives - a template matches when either of them does - and every other filter narrows. Hits whose
name contains the term earliest come first. The content itself is not returned; read the chosen one with
GetHtmlItemTemplateAsync(IOpenBiApiClient, string, string, string, CancellationToken).
public static Task<OpenBiListResult<CmsItemTemplate>> SearchHtmlItemTemplatesAsync(this IOpenBiApiClient client, string? tagName = null, string? owner = null, string? language = null, string? name = null, string? content = null, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClienttagNamestringownerstringlanguagestringnamestringcontentstringcancellationTokenCancellationToken
Returns
- Task<OpenBiListResult<CmsItemTemplate>>
UpdateHtmlItemTemplateAsync(IOpenBiApiClient, string, string, string, CmsItemTemplate, CancellationToken)
Creates or updates one specific language variant of a template
(POST htmlitems/{tagName}/templates/{id}/{language}). Tag, id and language come from the route, not
from template. Every save stores a copy in the history
(GetHtmlItemTemplateHistoryAsync(IOpenBiApiClient, string, string, string?, OpenBiListRequest?, CancellationToken)).
public static Task<CmsItemTemplate?> UpdateHtmlItemTemplateAsync(this IOpenBiApiClient client, string tagName, string id, string language, CmsItemTemplate template, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClienttagNamestringidstringlanguagestringtemplateCmsItemTemplatecancellationTokenCancellationToken
Returns
- Task<CmsItemTemplate>
UpdateHtmlItemTemplateDefaultAsync(IOpenBiApiClient, string, string, CmsItemTemplate, CancellationToken)
Creates or updates the default-language (empty language) variant of a template - the one the CMS renders where a language has no variant of its own. Same behaviour as UpdateHtmlItemTemplateAsync(IOpenBiApiClient, string, string, string, CmsItemTemplate, CancellationToken).
public static Task<CmsItemTemplate?> UpdateHtmlItemTemplateDefaultAsync(this IOpenBiApiClient client, string tagName, string id, CmsItemTemplate template, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClienttagNamestringidstringtemplateCmsItemTemplatecancellationTokenCancellationToken
Returns
- Task<CmsItemTemplate>