⚙︎ CoreArticleService
Core service to either query a single article (rpc GetArticle()
) identified
by its id or to query multiple articles (rpc ListArticles()
) by providing
a query.
All results returned from this service are unfiltered by default, hence they may contain
elements
that are expired, not yet valid or whose state
is not PUBLISHED
.
This behaviour can be changed by providing a RequestSettings
object.
service ArticleService {
rpc GetArticle(GetArticleRequest) returns (stroeer.core.v1.Article) {}
rpc BatchGetArticles(BatchGetArticlesRequest) returns (BatchGetArticlesResponse) {}
rpc ListArticles(ListArticlesRequest) returns (ListArticlesResponse) {}
// Allow Empty as request param
// buf:lint:ignore RPC_REQUEST_STANDARD_NAME
rpc ListSections(google.protobuf.Empty) returns (ListSectionsResponse) {}
}
⚙︎ GetArticle
rpc GetArticle (GetArticleRequest) returns (stroeer.core.v1.Article) {}
returns a single stroeer.core.v1.Article
if the given id
exists,
an Error
, otherwise. (todo: describe errors)
Field name | Type | Description |
---|---|---|
id | int64 | [required] Unique id of the article to be fetched. |
message GetArticleRequest {
int64 id = 1;
RequestSettings request_settings = 2;
}
⚙︎ BatchGetArticle
returns multiple stroeer.core.v1.Article
for the given ids
. The
ordering of items will the same ordering as the ids
requested.
If an id
does not exists, it is omitted in the result (no error will be raised).
There is a maximum of 100 items that can be queried in one batch.
Field name | Type | Description |
---|---|---|
ids | repeated int64 | [required] A list of ids of the articles to be fetched |
message BatchGetArticlesRequest {
repeated int64 ids = 1;
RequestSettings request_settings = 2;
}
returns a message-listarticlesresponse
with
articles matching the query. If the results exceed 100 Articles or 1 MB
the response can be paginated to obtain additional results.
ListArticlesRequest
Field name | Type | Description |
---|---|---|
query | Query | [required] find items based on query values |
filters | Filters | [optional] A filter expression is applied after a Query finishes, but before the results are returned. |
page_size | int32 | [optional] limit the results per page, default is 10 ; max is 100 (or result exceeds 1 MB ). Values above 100 will be coerced to 100. If results get truncated, you can use pagination. |
page_token | string | [optional] A page token, received from a previous ListArticles call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to ListArticles must match the call that provided the page token. |
message ListArticlesRequest {
Query query = 1;
Filters filters = 2;
int32 page_size = 3;
string page_token = 4;
RequestSettings request_settings = 5;
Query
Specify the search criteria. The list-API is build around sections which come in two flavors:
home_section
: find all articles that resides within that exact section. Thehome_section
is equal to the settings found in the CMS, e.g./nachrichten/wissen/
root_section
: this property is derived from thehome_section
path by retaining only the root folder, e.g. for/nachrichten/wissen/
theroot_section
becomes/nachrichten/
In most cases using the root_section
should yield better results since
it will also find content in nested sections whereas home_section
would
only return content which was curated into the exact section that was queried.
Field name | Type | Description |
---|---|---|
path | string | [required] path , with leading and trailing slash (e.g. /nachrichten/ ) |
type | Type | [required] query type, either Type.HOME_SECTION or Type.ROOT_SECTION |
sort_by | SortBy | [required] sorting of the result set, either SortBy.UPDATE_TIME or SortBy.PUBLISH_TIME |
order | Order | [optional] sorting direction for the results regarding the sort_by field, default is Order.ASCENDING |
from_time | Timestamp | [optional] time constraint that refers to the sort_by field. |
to_time | Timestamp | [optional] time constraint that refers to the sort_by field. |
message Query {
string path = 1;
Type type = 2;
SortBy sort_by = 3;
Order order = 4;
google.protobuf.Timestamp from_time = 5;
google.protobuf.Timestamp to_time = 6;
Type
Enum value | Description |
---|---|
TYPE_UNSPECIFIED | unspecified |
HOME_SECTION | query by exact home section which is configured in the CMS |
ROOT_SECTION | query by exact root section which is derived from home section when only retaining the first level of the path |
see the description above why these query types exist, also see
Reference
how section information are stored.
enum Type {
TYPE_UNSPECIFIED = 0;
HOME_SECTION = 1;
ROOT_SECTION = 2;
}
SortBy
Enum value | Description |
---|---|
SORT_BY_UNSPECIFIED | unspecified |
UPDATE_TIME | sort by the content's update_time |
PUBLISH_TIME | sort by the content's publish_time |
enum SortBy {
SORT_BY_UNSPECIFIED = 0;
UPDATE_TIME = 1;
PUBLISH_TIME = 2;
}
Order
order of index traversal, default: ascending.
Enum value | Description |
---|---|
ORDER_UNSPECIFIED | unspecified |
ASCENDING | ascending order index traversal |
DESCENDING | descending order index traversal |
enum Order {
ORDER_UNSPECIFIED = 0;
ASCENDING = 1;
DESCENDING = 2;
}
Filters
If you need to further refine the Query results, you can optionally provide a filter expression. A filter expression determines which items within the Query results should be returned to you. All of the other results are discarded.
A filter expression is applied after a Query finishes, but before the results are returned. Therefore, a Query consumes the same amount of read capacity, regardless of whether a filter expression is present.
Field name | Type | Description |
---|---|---|
type_includes | ContentType | type to include into the result set |
type_includes | ContentType | type to exclude from the result set |
sub_type_includes | ContentSubType | sub_type to include into the result set |
sub_type_excludes | ContentSubType | sub_type to exclude from the result set |
message Filters {
repeated Article.Type type_includes = 1;
repeated Article.Type type_excludes = 2;
repeated Article.SubType sub_type_includes = 3;
repeated Article.SubType sub_type_excludes = 4;
}
RequestSettings
Alters the behavior of the request in a way that filters or alters the result or parts of the result based on validity of the article or its elements.
You can also alter the view mode of the article, selecting either the full
article or a limited version of it (called teaser
or trail
)
RequestSettings.ArticleViewMode
Enum value | Description |
---|---|
ARTICLE_VIEW_MODE_UNSPECIFIED | unspecified, defaults to ARTICLE_VIEW_MODE_DEFAULT |
ARTICLE_VIEW_MODE_DEFAULT | full article including body and all elements. |
ARTICLE_VIEW_MODE_TEASER | elements that are not required when teasering the article are removed (e.g. body). |
RequestSettings.ArticleValidity
Enum value | Description |
---|---|
ARTICLE_VALIDITY_UNSPECIFIED | unspecified, defaults to ARTICLE_VALIDITY_IGNORE |
ARTICLE_VALIDITY_VALID | filters articles that are considered valid and allowed to be accessed publicly. |
ARTICLE_VALIDITY_IGNORE | Ignore the article validity and return everything as is, even deleted or expired content. |
RequestSettings.ElementValidity
Enum value | Description |
---|---|
ELEMENT_VALIDITY_UNSPECIFIED | unspecified, defaults to ELEMENT_VALIDITY_IGNORE |
ELEMENT_VALIDITY_VALID | Remove invalid elements from its parent article, such as expired images or videos. |
ELEMENT_VALIDITY_IGNORE | Ignore the element validity and return everything as is, even deleted or expired content. |
message RequestSettings {
ArticleViewMode article_view_mode = 1;
ArticleValidity article_validity = 2;
ElementValidity element_validity = 3;
enum ArticleViewMode {
ARTICLE_VIEW_MODE_UNSPECIFIED = 0;
ARTICLE_VIEW_MODE_DEFAULT = 1;
ARTICLE_VIEW_MODE_TEASER = 2;
}
enum ArticleValidity {
ARTICLE_VALIDITY_UNSPECIFIED = 0;
ARTICLE_VALIDITY_VALID = 1;
ARTICLE_VALIDITY_IGNORE = 2;
}
enum ElementValidity {
ELEMENT_VALIDITY_UNSPECIFIED = 0;
ELEMENT_VALIDITY_VALID = 1;
ELEMENT_VALIDITY_IGNORE = 2;
}
}
ListArticlesResponse
Field name | Type | Description |
---|---|---|
articles | Article | list of articles that match the query and also the filter , otherwise empty . |
next_page_token | string | A token that can be sent as page_token to retrieve the next page. If this field is omitted, there are no subsequent pages. |
message ListArticlesResponse {
repeated stroeer.core.v1.Article articles = 1;
string next_page_token = 2;
}
⚙︎ ListSections
list the available root sections
ListSectionsResponse
list all available root_sections
that can be used in the query
above.
message ListSectionsResponse {
repeated string sections = 1;
}