List tag groups
Log in to add to favouritesGet a list of all tag groups, or provide options to find tag groups with a simple query
Call signatures
list(): Promise<PagedList<TagGroup>>;
list({
language?: string;
order?: string[];
pageOptions?: PageOptions;
q?: string;
}: TagGroupListOptions): Promise<PagedList<TagGroup>>;
Parameters
Name | Type | Description |
---|---|---|
options | TagGroupListOptions | An options object to find tag groups with a simple query, provide paging options or order results by specific fields |
Returns
Remarks
Throws any error that is returned by the API for any unsuccessful request echoing the HTTP status returned from the API
Examples
Get a list of all tag groups (with the pageSize set in the client config)
const tagGroups = await client.tags.groups.list();
console.log(`Found ${tagGroups.totalCount} tag groups`);
for (const tagGroup of tagGroups.items) {
console.log(`${tagGroup.name} has ${tagGroup.tagCount} tags`);
}
Get a list of tag groups, filtered by a query in a specific language, results to be ordered by name, then by modified date descending, requesting the second page while returning (up to) 10 tag groups in each page
const tagGroups = await client.tags.groups.list({
q: "topics",
language: "en-GB",
pageOptions: {
pageSize: 10,
pageIndex: 1
},
order: ["name", "-version.modifed"]
});
console.log(`Page ${tagGroups.pageIndex + 1} of ${tagGroups.pageCount}`);
for (const tagGroup of tagGroups.items) {
console.log(`${tagGroup.name} has ${tagGroup.tagCount} tags`);
}