openapi: 3.1.0
info:
  title: Arkme REST API
  version: 1.0.0
  license:
    name: Proprietary
    identifier: LicenseRef-Proprietary
  description: Arkme 开放平台 REST 业务接口的机器合同。
externalDocs:
  description: REST API 接入指南
  url: https://openapi.jotmo.cc/docs/rest
servers:
  - url: https://openapi.jotmo.cc
security:
  - apiKeyBearer: []
paths:
  /api/v1/profile/get:
    post:
      operationId: getCurrentUserProfile
      summary: 获取 API Key 所属用户的最小公开资料
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/EmptyObject" }
      responses:
        "200":
          description: 读取成功
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/Envelope"
                  - type: object
                    required: [data]
                    properties:
                      data: { $ref: "#/components/schemas/Profile" }
        "400": { $ref: "#/components/responses/RESTError" }
        "401": { $ref: "#/components/responses/AuthenticationError" }
        "429": { $ref: "#/components/responses/RateLimitError" }
        "502": { $ref: "#/components/responses/RESTError" }
        "503": { $ref: "#/components/responses/RESTError" }
  /api/v1/account-bindings/get:
    post:
      operationId: getCurrentUserAccountBindings
      summary: 获取 API Key 所属用户的登录方式绑定状态
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: "#/components/schemas/EmptyObject" }
      responses:
        "200":
          description: 读取成功
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/Envelope"
                  - type: object
                    required: [data]
                    properties:
                      data: { $ref: "#/components/schemas/Bindings" }
        "400": { $ref: "#/components/responses/RESTError" }
        "401": { $ref: "#/components/responses/AuthenticationError" }
        "429": { $ref: "#/components/responses/RateLimitError" }
        "502": { $ref: "#/components/responses/RESTError" }
        "503": { $ref: "#/components/responses/RESTError" }
components:
  securitySchemes:
    apiKeyBearer:
      type: http
      scheme: bearer
      bearerFormat: Arkme API Key
      description: 在开发者控制台创建的 `arkme_` 个人 API Key。
  schemas:
    EmptyObject:
      type: object
      additionalProperties: false
    Envelope:
      type: object
      required: [code, message]
      properties:
        code: { type: integer }
        message: { type: string }
        request_id: { type: string }
        data: {}
    Profile:
      type: object
      additionalProperties: false
      required: [nickname, jotmo_id, created_at]
      properties:
        nickname: { type: string, description: 当前用户昵称。 }
        jotmo_id: { type: string, description: 当前展示用即我号。 }
        created_at: { type: integer, description: 账号创建时间，Unix 毫秒。 }
    Bindings:
      type: object
      additionalProperties: false
      required: [items]
      properties:
        items:
          type: array
          description: 按 phone、email、wechat、apple、google、huawei 固定顺序返回的绑定状态。
          minItems: 6
          maxItems: 6
          items:
            type: object
            additionalProperties: false
            required: [provider, bound]
            properties:
              provider:
                type: string
                enum: [phone, email, wechat, apple, google, huawei]
                description: 登录方式：phone、email、wechat、apple、google 或 huawei。
              bound: { type: boolean, description: 当前用户是否已绑定该登录方式。 }
  responses:
    RESTError:
      description: Arkme REST API 错误响应
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Envelope" }
    AuthenticationError:
      description: API Key 缺失、无效、已删除，或所属账号不可用
      headers:
        WWW-Authenticate:
          required: true
          schema: { type: string }
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Envelope" }
    RateLimitError:
      description: 当前 API Key 调用过快
      headers:
        Retry-After:
          required: true
          schema: { type: integer, minimum: 1 }
      content:
        application/json:
          schema: { $ref: "#/components/schemas/Envelope" }
