import { type PolicySection } from './types'; import { CodeBlock } from '@/components/ui/code-block'; import { DocsTable, DocsTableBody, DocsTableCell, DocsTableHead, DocsTableHeader, DocsTableRow, } from '@/components/ui/docs-table'; export const DOCS_LAST_UPDATED = '2026-06-07'; type TFn = (key: string) => string; export function getApiSections(t: TFn): PolicySection[] { return [ { value: 'api-specs', title: t('api.section1.title'), content: (

{t('api.section1.desc')}

{t('api.section1.responseFormat')}

{t('api.section1.responseFormatDesc')}

{t('api.field')} {t('api.type')} {t('api.description')} error_msg string {t('api.section1.errorMsgDesc')} data any {t('api.section1.dataDesc')}

{t('api.section1.successExample')}

{t('api.section1.failExample')}

{t('api.section1.authentication')}

{t('api.section1.authenticationDesc')}

  • {t('api.section1.sessionCredential')} {t('api.section1.sessionCredentialDesc')}
  • {t('api.section1.accessTokenCredential')} {t('api.section1.accessTokenCredentialDesc')}

{t('api.section1.supportedHeaders')}

  • Authorization: Bearer at_xxx
  • X-Access-Token: at_xxx
), children: [ { value: '1-1-response-format', title: t('api.section1.responseFormat'), }, { value: '1-2-authentication', title: t('api.section1.authentication'), }, ], }, { value: 'auth-apis', title: t('api.section2.title'), content: (

{t('api.section2.register')}

{t('api.endpoint')}POST{' '} /api/v1/user/register

{t('api.desc')} {t('api.section2.registerDesc')}

{t('api.param')} {t('api.required')} {t('api.type')} {t('api.description')} username {t('api.yes')} string {t('api.section2.usernameDesc')} password {t('api.yes')} string {t('api.section2.passwordDesc')} nickname {t('api.no')} string {t('api.section2.nicknameDesc')}

{t('api.section2.passwordLogin')}

{t('api.endpoint')}POST{' '} /api/v1/user/login

{t('api.desc')} {t('api.section2.passwordLoginDesc')}

{t('api.param')} {t('api.required')} {t('api.type')} {t('api.description')} username {t('api.yes')} string {t('api.username')} password {t('api.yes')} string {t('api.password')}

{t('api.section2.logout')}

{t('api.endpoint')}GET{' '} /api/v1/user/logout

{t('api.desc')} {t('api.section2.logoutDesc')}

{t('api.section2.getProfile')}

{t('api.endpoint')}GET{' '} /api/v1/user/self

{t('api.desc')} {t('api.section2.getProfileDesc')}

), children: [ { value: '2-1-register', title: t('api.section2.register') }, { value: '2-2-login', title: t('api.section2.passwordLogin') }, { value: '2-3-logout', title: t('api.section2.logout') }, { value: '2-4-profile', title: t('api.section2.getProfile') }, ], }, { value: 'token-apis', title: t('api.section3.title'), content: (

{t('api.section3.desc')}

{t('api.section3.listTokens')}

{t('api.endpoint')}GET{' '} /api/v1/user/access-tokens

{t('api.desc')} {t('api.section3.listTokensDesc')}

{t('api.section3.createToken')}

{t('api.endpoint')}POST{' '} /api/v1/user/access-tokens

{t('api.param')}JSON Body{' '} {`{"name": "${t('api.section3.tokenName')}", "is_admin": false}`}

{t('api.desc')} {t('api.section3.createTokenDesc')}

is_admin( {t('api.optional')},{t('api.default')}{' '} false ):{t('api.section3.isAdminDesc')}{' '} /admin/**{' '} {t('api.section3.endpoint')}.

{t('api.section3.successResponseExample')}

{t('api.section3.deleteToken')}

{t('api.endpoint')}DELETE{' '} /api/v1/user/access-tokens/:id

{t('api.desc')} {t('api.section3.deleteTokenDesc')}

{t('api.section3.rotateToken')}

{t('api.endpoint')}POST{' '} /api/v1/user/access-tokens/:id/rotate

{t('api.desc')} {t('api.section3.rotateTokenDesc')}

), children: [ { value: '3-1-list-token', title: t('api.section3.listTokens') }, { value: '3-2-create-token', title: t('api.section3.createToken') }, { value: '3-3-delete-token', title: t('api.section3.deleteToken') }, { value: '3-4-rotate-token', title: t('api.section3.rotateToken') }, ], }, { value: 'config-apis', title: t('api.section4.title'), content: (

{t('api.section4.publicConfig')}

{t('api.endpoint')}GET{' '} /api/v1/config/public

{t('api.desc')} {t('api.section4.publicConfigDesc')}

{t('api.section4.responseExample')}

{t('api.section4.adminConfigs')}

{t('api.desc')} {t('api.section4.adminConfigsDesc')}

), children: [ { value: '4-1-public-config', title: t('api.section4.publicConfig') }, { value: '4-2-admin-configs', title: t('api.section4.adminConfigs') }, ], }, ]; }