function changeSlug
changeSlug(
kind: SlugKind,
item: { id: string; userId: string; slug: string; },
slug: string,
exempt: boolean
): void

Gives item the slug slug, keeping its current one as an alias. An alias always names the item itself, so redirects never chain; taking back one of the item's own aliases swaps it with the current slug. Unless exempt (a moderator), an item's slug changes at most RENAME_LIMITS.SLUG.count times in its window, counted from its aliases. A slug equal to the current one changes nothing.

Parameters

item: { id: string; userId: string; slug: string; }
slug: string
exempt: boolean

Return Type

void

Throws

APIException

400 when slug isn't valid, 409 when another item of the owner's holds it now or held it before, 429 when the item's slug changed too often lately.

Usage

import { changeSlug } from "api/services/slug-service.ts";