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.

145 lines
3.9 KiB
TypeScript

//
// Copyright (C) 2024 veypi <i@veypi.com>
1 year ago
// 2024-10-11 14:36:07
// Distributed under terms of the MIT license.
//
import webapi from "./webapi"
import * as models from "./models"
11 months ago
export function Key(app_id: string) {
return webapi.Get<string>(`/app/${app_id}/key`, {})
}
1 year ago
export function Get(app_id: string) {
1 year ago
return webapi.Get<models.App>(`/app/${app_id}`, {})
}
1 year ago
export interface PatchOpts {
1 year ago
name?: string
icon?: string
des?: string
1 year ago
typ?: string
12 months ago
init_role_id?: string
11 months ago
init_url?: string
1 year ago
status?: string
}
1 year ago
export function Patch(app_id: string, json: PatchOpts) {
return webapi.Patch<models.App>(`/app/${app_id}`, { json })
}
1 year ago
export function Delete(app_id: string) {
1 year ago
return webapi.Delete<models.App>(`/app/${app_id}`, {})
1 year ago
}
1 year ago
export interface PostOpts {
1 year ago
name: string
icon: string
1 year ago
des?: string
1 year ago
typ: string
status: string
}
export function Post(json: PostOpts) {
return webapi.Post<models.App>(`/app`, { json })
}
12 months ago
export interface ListQuery {
1 year ago
name?: string
}
12 months ago
export function List(query: ListQuery) {
return webapi.Get<models.App[]>(`/app`, { query })
}
12 months ago
export interface AppUserGetQuery {
1 year ago
user_id: string
}
12 months ago
export function AppUserGet(app_id: string, app_user_id: string, query: AppUserGetQuery) {
return webapi.Get<models.AppUser>(`/app/${app_id}/app_user/${app_user_id}`, { query })
}
1 year ago
export interface AppUserPatchOpts {
1 year ago
status?: string
}
12 months ago
export function AppUserPatch(app_id: string, app_user_id: string, json: AppUserPatchOpts) {
return webapi.Patch<models.AppUser>(`/app/${app_id}/app_user/${app_user_id}`, { json })
}
12 months ago
export function AppUserDelete(app_id: string, app_user_id: string) {
1 year ago
return webapi.Delete<models.AppUser>(`/app/${app_id}/app_user/${app_user_id}`, {})
1 year ago
}
12 months ago
export interface AppUserListQuery {
1 year ago
user_id?: string
status?: string
}
12 months ago
export function AppUserList(app_id: string, query: AppUserListQuery) {
return webapi.Get<models.AppUser[]>(`/app/${app_id}/app_user`, { query })
1 year ago
}
1 year ago
export interface AppUserPostOpts {
1 year ago
status: string
user_id: string
}
1 year ago
export function AppUserPost(app_id: string, json: AppUserPostOpts) {
return webapi.Post<models.AppUser>(`/app/${app_id}/app_user`, { json })
}
12 months ago
export function ResourceGet(app_id: string, resource_id: string) {
return webapi.Get<models.Resource>(`/app/${app_id}/resource/${resource_id}`, {})
}
12 months ago
export interface ResourcePatchOpts {
des?: string
}
export function ResourcePatch(app_id: string, resource_id: string, json: ResourcePatchOpts) {
return webapi.Patch<models.Resource>(`/app/${app_id}/resource/${resource_id}`, { json })
1 year ago
}
12 months ago
export function ResourceDelete(app_id: string, resource_id: string) {
return webapi.Delete<models.Resource>(`/app/${app_id}/resource/${resource_id}`, {})
1 year ago
}
12 months ago
export function ResourceList(app_id: string) {
return webapi.Get<models.Resource[]>(`/app/${app_id}/resource`, {})
12 months ago
}
12 months ago
export interface ResourcePostOpts {
name: string
des: string
12 months ago
}
12 months ago
export function ResourcePost(app_id: string, json: ResourcePostOpts) {
return webapi.Post<models.Resource>(`/app/${app_id}/resource`, { json })
12 months ago
}
12 months ago
11 months ago
export function RoleGet(app_id: string, role_id: string) {
return webapi.Get<models.Role>(`/app/${app_id}/role/${role_id}`, {})
}
export interface RolePatchOpts {
name?: string
des?: string
}
export function RolePatch(app_id: string, role_id: string, json: RolePatchOpts) {
return webapi.Patch<models.Role>(`/app/${app_id}/role/${role_id}`, { json })
}
export function RoleDelete(app_id: string, role_id: string) {
return webapi.Delete<models.Role>(`/app/${app_id}/role/${role_id}`, {})
}
export interface RoleListQuery {
name?: string
}
export function RoleList(app_id: string, query: RoleListQuery) {
return webapi.Get<models.Role[]>(`/app/${app_id}/role`, { query })
}
export interface RolePostOpts {
name: string
des: string
}
export function RolePost(app_id: string, json: RolePostOpts) {
return webapi.Post<models.Role>(`/app/${app_id}/role`, { json })
}