izartu API

Tag

Tag queries: a bookmark's tags and the tag-cloud data.

Table of Contents

Methods

countTags()  : int
Count the tags whose name contains the search term (see `searchTags`).
getCloud()  : array<int, array{id: int, name: string, value: int}>
Return the tag-cloud data for the current list: the `CLOUD_SIZE` most-used tags among the bookmarks the list shows, with their counts, ordered alphabetically.
getTags()  : array<int, array{id: int, name: string}>
Return the tags attached to a single bookmark.
listFilter()  : array{0: string, 1: string, 2: string, 3: list}
The SQL pieces every tag listing shares: the visibility condition, the `user` join and extra WHERE clauses for the list's tag/username filters (with the filtered tag names themselves excluded), and the parameters.
searchTags()  : array<int, array{id: int, name: string, value: int}>
Return one page of the tags whose name contains the search term, with their visible-bookmark count, ordered alphabetically. Same visibility and list filters as the cloud (`$tags`/`$username` scope the search to the current list). An empty term matches every tag (the tag index).

Methods

countTags()

Count the tags whose name contains the search term (see `searchTags`).

private countTags(int|null $viewer, string $term[, array<int, string> $tags = [] ][, string|null $username = null ]) : int
Parameters
$viewer : int|null

The viewer's user id (Auth::id()), or null for anonymous.

$term : string

The search term (matched as a substring).

$tags : array<int, string> = []

The tag names the list is filtered by; empty for none.

$username : string|null = null

The username the list is filtered by, or null.

Return values
int

How many visible tags match.

getCloud()

Return the tag-cloud data for the current list: the `CLOUD_SIZE` most-used tags among the bookmarks the list shows, with their counts, ordered alphabetically.

private getCloud([int|null $viewer = null ][, array<int, string> $tags = [] ][, string|null $username = null ]) : array<int, array{id: int, name: string, value: int}>

A viewer counts public bookmarks plus their own private ones; tags with no visible bookmark are not returned. With $tags, only bookmarks carrying ALL of them count, and those tags themselves are left out (they are the active filter). With $username, only that user's bookmarks count.

Parameters
$viewer : int|null = null

The viewer's user id (Auth::id()), or null for anonymous.

$tags : array<int, string> = []

The tag names the list is filtered by; empty for none.

$username : string|null = null

The username the list is filtered by, or null.

Return values
array<int, array{id: int, name: string, value: int}>

One row per tag.

getTags()

Return the tags attached to a single bookmark.

private getTags(int $id) : array<int, array{id: int, name: string}>
Parameters
$id : int

Bookmark id.

Return values
array<int, array{id: int, name: string}>

One row per tag.

listFilter()

The SQL pieces every tag listing shares: the visibility condition, the `user` join and extra WHERE clauses for the list's tag/username filters (with the filtered tag names themselves excluded), and the parameters.

private listFilter(int|null $viewer, array<int, string> $tags, string|null $username) : array{0: string, 1: string, 2: string, 3: list}
Parameters
$viewer : int|null

The viewer's user id, or null for anonymous.

$tags : array<int, string>

The tag names the list is filtered by; empty for none.

$username : string|null

The username the list is filtered by, or null.

Return values
array{0: string, 1: string, 2: string, 3: list}

searchTags()

Return one page of the tags whose name contains the search term, with their visible-bookmark count, ordered alphabetically. Same visibility and list filters as the cloud (`$tags`/`$username` scope the search to the current list). An empty term matches every tag (the tag index).

private searchTags(int|null $viewer, string $term[, int $page = 1 ][, array<int, string> $tags = [] ][, string|null $username = null ]) : array<int, array{id: int, name: string, value: int}>
Parameters
$viewer : int|null

The viewer's user id (Auth::id()), or null for anonymous.

$term : string

The search term (matched as a substring).

$page : int = 1

1-based page number (TAGS_PAGE_SIZE tags per page).

$tags : array<int, string> = []

The tag names the list is filtered by; empty for none.

$username : string|null = null

The username the list is filtered by, or null.

Return values
array<int, array{id: int, name: string, value: int}>

One row per tag.

On this page

Search results