API 参考
会话
创建命名 API 令牌,返回 clientId 和 Base64 编码的 32 字节 token。 列出登录和 API 令牌会话。LOGIN 的 token 和 urlToken 为空;API_TOKEN 凭证仅限本机所有者请求读取。
类型定义
graphql
type Mutation {
createApiToken(name: String!): CreatedApiToken!
renameSession(clientId: ID!, name: String!): Boolean!
revokeSession(clientId: ID!): Boolean!
}
type Query {
sessions: [Session!]!
}
type CreatedApiToken {
clientId: ID!
token: String!
}
scalar Instant
type Session {
clientId: ID!
clientName: String!
type: SessionType!
clientIp: String!
osName: String!
osVersion: String!
appName: String!
appVersion: String!
lastSeenAt: Instant
lastActive: Instant!
createdAt: Instant!
updatedAt: Instant!
}
enum SessionType {
LOGIN
API_TOKEN
}操作
mutation
createApiToken
创建命名 API 令牌,返回 clientId 和 Base64 编码的 32 字节 token。
graphql
mutation createApiToken($name: String!) {
createApiToken(name: $name) { clientId token }
}mutation
renameSession
重命名指定的已授权客户端会话。
graphql
mutation renameSession($clientId: ID!, $name: String!) {
renameSession(clientId: $clientId, name: $name)
}mutation
revokeSession
撤销指定客户端会话及其访问权限。
graphql
mutation revokeSession($clientId: ID!) {
revokeSession(clientId: $clientId)
}query
sessions
列出登录和 API 令牌会话。LOGIN 的 token 和 urlToken 为空;API_TOKEN 凭证仅限本机所有者请求读取。
graphql
query sessions {
sessions { clientId clientName type clientIp osName osVersion appName appVersion }
}