Class OpenBiApiClientLanguageTextExtensions
- Namespace
- BiExcellence.OpenBi.Api.LanguageTexts
- Assembly
- BiExcellence.OpenBi.Api.Client.dll
Extension methods for the /languagetexts REST API.
public static class OpenBiApiClientLanguageTextExtensions
- Inheritance
-
objectOpenBiApiClientLanguageTextExtensions
Methods
CreateLanguageTextAsync(IOpenBiApiClient, LanguageText, CancellationToken)
Creates a language text (POST languagetexts). This creates the text itself; add its translations
with CreateLanguageTextValueAsync(IOpenBiApiClient, string, LanguageTextValue, CancellationToken). Throws OpenBiApiException (409) when a
language text with this id already exists.
public static Task<LanguageText?> CreateLanguageTextAsync(this IOpenBiApiClient client, LanguageText languageText, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClientlanguageTextLanguageTextcancellationTokenCancellationToken
Returns
- Task<LanguageText>
CreateLanguageTextValueAsync(IOpenBiApiClient, string, LanguageTextValue, CancellationToken)
Adds the translation for one language of the text id
(POST languagetexts/{id}/values); the language comes from Language,
and an empty one creates the default (fallback) value. Throws OpenBiApiException (409) when
the text already has a value for that language - use UpdateLanguageTextValueAsync(IOpenBiApiClient, string, string?, LanguageTextValue, CancellationToken), which
creates as well as updates.
public static Task<LanguageTextValue?> CreateLanguageTextValueAsync(this IOpenBiApiClient client, string id, LanguageTextValue value, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClientidstringvalueLanguageTextValuecancellationTokenCancellationToken
Returns
- Task<LanguageTextValue>
DeleteLanguageTextAsync(IOpenBiApiClient, string, CancellationToken)
Deletes a language text together with all of its values (DELETE languagetexts/{id}). To clear the
values but keep the text, use DeleteLanguageTextValueAsync(IOpenBiApiClient, string, string?, CancellationToken) with "*".
public static Task DeleteLanguageTextAsync(this IOpenBiApiClient client, string id, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClientidstringcancellationTokenCancellationToken
Returns
- Task
DeleteLanguageTextValueAsync(IOpenBiApiClient, string, string?, CancellationToken)
Deletes a specific language's value, or every value when language is "*",
null or empty - removing the default (fallback) value removes the translations with it
(DELETE languagetexts/{id}/values[/{language}|/default]). The text itself stays; delete it with
DeleteLanguageTextAsync(IOpenBiApiClient, string, CancellationToken).
public static Task DeleteLanguageTextValueAsync(this IOpenBiApiClient client, string id, string? language, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClientidstringlanguagestringcancellationTokenCancellationToken
Returns
- Task
GetLanguageTextAsync(IOpenBiApiClient, string, CancellationToken)
Gets one language text by id (GET languagetexts/{id}). Throws OpenBiApiException
(404) when there is no language text with this id.
public static Task<LanguageText> GetLanguageTextAsync(this IOpenBiApiClient client, string id, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClientidstringcancellationTokenCancellationToken
Returns
- Task<LanguageText>
GetLanguageTextValueAsync(IOpenBiApiClient, string, string?, CancellationToken)
Gets a specific language's value, or the default (fallback) value when language is
null or empty (GET languagetexts/{id}/values/{language} or .../default).
A client resolving a label asks for its language and falls back to the default. Throws
OpenBiApiException (404) when the text has no value for that language.
public static Task<LanguageTextValue> GetLanguageTextValueAsync(this IOpenBiApiClient client, string id, string? language, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClientidstringlanguagestringcancellationTokenCancellationToken
Returns
- Task<LanguageTextValue>
GetLanguageTextValuesAsync(IOpenBiApiClient, string, OpenBiListRequest?, CancellationToken)
Lists every translated value of a language text, one per language (GET languagetexts/{id}/values).
public static Task<OpenBiListResult<LanguageTextValue>> GetLanguageTextValuesAsync(this IOpenBiApiClient client, string id, OpenBiListRequest? request = null, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClientidstringrequestOpenBiListRequestcancellationTokenCancellationToken
Returns
GetLanguageTextsAsync(IOpenBiApiClient, OpenBiListRequest?, CancellationToken)
Lists language texts (GET languagetexts). Language texts are the translation table: a text id with
one value per language, read with GetLanguageTextValuesAsync(IOpenBiApiClient, string, OpenBiListRequest?, CancellationToken). The CMS and the clients
resolve labels through it. Use QueryLanguageTextsAsync(IOpenBiApiClient, OpenBiListRequest?, CancellationToken) when a filter is too long for a URL.
public static Task<OpenBiListResult<LanguageText>> GetLanguageTextsAsync(this IOpenBiApiClient client, OpenBiListRequest? request = null, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClientrequestOpenBiListRequestcancellationTokenCancellationToken
Returns
- Task<OpenBiListResult<LanguageText>>
QueryLanguageTextsAsync(IOpenBiApiClient, OpenBiListRequest?, CancellationToken)
Lists language texts with the options in the request body instead of in the query string - the QUERY-method
form of the list route, for filters that do not fit in a URL.
public static Task<OpenBiListResult<LanguageText>> QueryLanguageTextsAsync(this IOpenBiApiClient client, OpenBiListRequest? request = null, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClientrequestOpenBiListRequestcancellationTokenCancellationToken
Returns
- Task<OpenBiListResult<LanguageText>>
SearchLanguageTextValuesAsync(IOpenBiApiClient, string?, string?, string?, CancellationToken)
Searches values across every language text (GET languagetextvalues/search): name
matches a text's id and content matches a translation, either of which is a hit, and
language narrows to one language. Hits whose id contains the term earliest come first.
The translated text itself is not returned; read the chosen one with
GetLanguageTextValueAsync(IOpenBiApiClient, string, string?, CancellationToken).
public static Task<OpenBiListResult<LanguageTextValue>> SearchLanguageTextValuesAsync(this IOpenBiApiClient client, string? language = null, string? name = null, string? content = null, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClientThe client.
languagestringOnly values in this language; null for every language.
namestringA substring of the text id to look for.
contentstringA substring of the translated text to look for.
cancellationTokenCancellationTokenA cancellation token.
Returns
UpdateLanguageTextAsync(IOpenBiApiClient, string, LanguageText, CancellationToken)
Creates or updates a language text (POST languagetexts/{id}): an id that does not exist yet is
inserted rather than answered with a 404.
public static Task<LanguageText?> UpdateLanguageTextAsync(this IOpenBiApiClient client, string id, LanguageText languageText, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClientidstringlanguageTextLanguageTextcancellationTokenCancellationToken
Returns
- Task<LanguageText>
UpdateLanguageTextValueAsync(IOpenBiApiClient, string, string?, LanguageTextValue, CancellationToken)
Creates or updates a specific language's value, or the default (fallback) value when
language is null or empty
(POST languagetexts/{id}/values/{language} or .../default). The id and language come from
the route, not from value.
public static Task<LanguageTextValue?> UpdateLanguageTextValueAsync(this IOpenBiApiClient client, string id, string? language, LanguageTextValue value, CancellationToken cancellationToken = default)
Parameters
clientIOpenBiApiClientidstringlanguagestringvalueLanguageTextValuecancellationTokenCancellationToken
Returns
- Task<LanguageTextValue>