This commit is contained in:
2025-05-20 04:16:03 +03:00
parent 21a05dd202
commit 9531bff01a
88 changed files with 7797 additions and 2246 deletions

View File

@@ -1,10 +1,16 @@
import axios from "../http-client"
import type { RecipientChannel, User } from "../types"
import type { FullUser, PartialUser, RecipientChannel, UserId, Uuid } from "../types"
export async function me() {
const response = await axios.get("/users/@me")
return response.data as User
return response.data as FullUser
}
export async function getUser(userId: UserId) {
const response = await axios.get(`/users/${userId}`)
return response.data as PartialUser
}
export async function channels() {
@@ -13,7 +19,20 @@ export async function channels() {
return response.data as RecipientChannel[]
}
interface PatchUserRequest {
displayName?: string | null
avatarId?: Uuid | null
}
export async function patchUser(request: PatchUserRequest) {
const response = await axios.patch(`/users/@me`, request)
return response.data as FullUser
}
export default {
me,
channels
channels,
getUser,
patchUser
}