function renameUser
renameUser(
userId: string,
username: string
): User

Renames user userId to username, for PATCH /api/users/:key/username, which only user:manage may call: users can't rename themselves. Returns them renamed. The old name becomes an alias of theirs for good, so /@old/… still reaches them and nobody else may take it; a change of case alone leaves none, since names are looked up in any case. Taking back a former name of their own is allowed. Their dumps' and playlists' slugs belong to their id, so their paths follow the new name.

Parameters

userId: string
username: string

Return Type

Throws

APIException

400 when username isn't a valid name, 404 when there is no such user, 409 when the name is or was someone else's.

Usage

import { renameUser } from "api/services/user-service.ts";