You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.2 KiB
TypeScript

//
// Copyright (C) 2024 veypi <i@veypi.com>
1 year ago
// 2024-10-11 14:35:47
// Distributed under terms of the MIT license.
//
import webapi from "./webapi"
import * as models from "./models"
1 year ago
export function Get(user_id: string) {
1 year ago
return webapi.Get<models.User>(`/user/${user_id}`, {})
1 year ago
}
export interface PatchOpts {
username?: string
nickname?: string
icon?: string
email?: string
phone?: string
status?: number
}
export function Patch(user_id: string, json: PatchOpts) {
return webapi.Patch<models.User>(`/user/${user_id}`, { json })
}
export function Delete(user_id: string) {
1 year ago
return webapi.Delete<models.User>(`/user/${user_id}`, {})
1 year ago
}
export interface PostOpts {
1 year ago
username: string
nickname?: string
icon?: string
email?: string
phone?: string
salt: string
code: string
}
export function Post(json: PostOpts) {
return webapi.Post<models.User>(`/user`, { json })
}
12 months ago
export interface ListQuery {
1 year ago
username?: string
nickname?: string
email?: string
phone?: string
status?: number
}
12 months ago
export function List(query: ListQuery) {
return webapi.Get<models.User[]>(`/user`, { query })
1 year ago
}
12 months ago
export function UserRoleGet(user_id: string, user_role_id: string) {
1 year ago
return webapi.Get<models.UserRole>(`/user/${user_id}/user_role/${user_role_id}`, {})
}
export interface UserRolePatchOpts {
1 year ago
status?: string
}
12 months ago
export function UserRolePatch(user_id: string, user_role_id: string, json: UserRolePatchOpts) {
return webapi.Patch<models.UserRole>(`/user/${user_id}/user_role/${user_role_id}`, { json })
}
export interface UserRoleDeleteOpts {
1 year ago
role_id: string
app_id: string
}
11 months ago
export function UserRoleDelete(user_id: string, user_role_id: string) {
return webapi.Delete<models.UserRole>(`/user/${user_id}/user_role/${user_role_id}`, {})
}
export interface UserRolePostOpts {
1 year ago
status: string
role_id: string
app_id: string
}
1 year ago
export function UserRolePost(user_id: string, json: UserRolePostOpts) {
return webapi.Post<models.UserRole>(`/user/${user_id}/user_role`, { json })
}
12 months ago
export interface UserRoleListQuery {
1 year ago
status?: string
11 months ago
role_id?: string
app_id?: string
}
12 months ago
export function UserRoleList(user_id: string, query: UserRoleListQuery) {
return webapi.Get<models.UserRole[]>(`/user/${user_id}/user_role`, { query })
}