Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Support the full v1 API through the generated API client

未关闭
#118 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
openapi, typescript
领域
api, cli

调研方向

Begin with the proposed api operations, api describe, and api call entry points, then inspect the generated client's vendored OpenAPI spec and @hackmd/api/raw. Confirm the API client version includes /raw and the registry before implementing. Done means existing commands still work and the new API entry handles the listed request, response, and error cases against a local server.

由索引模型根据 Issue 内容生成。

描述

Why

The CLI has useful notes and folders commands, but adding a dedicated command for every v1 endpoint would duplicate the API client and leave coverage gaps.

Design

Keep all existing commands and add one generic api entry:

  • api operations and api describe <OperationId> read the installed API client registry offline. They do not claim that a connected EE server supports every operation.
  • api call <OperationId> delegates to @hackmd/api/raw, using the existing token and endpoint settings. Accept explicit --path, --query, --header, JSON --body, and multipart --file options.
  • Print the response body by default; --include also shows status and headers. Handle empty responses, 207, NDJSON, and HTTP errors. Do not automatically retry writes.

This follows the GitHub CLI gh api design: dedicated commands for common workflows, plus a generic API entry for broader coverage. We borrow the interface idea, but delegate requests to the API client rather than adding another HTTP transport.

Generate the operation registry from the API client's vendored OpenAPI spec. Do not download a spec at CLI runtime or add another HTTP transport.

Example

# GitHub CLI: a focused command and a generic API entry
gh issue list --repo OWNER/REPO
gh api repos/OWNER/REPO/issues --include

# HackMD CLI: the same two-layer idea
hackmd-cli notes --noteId=abc
hackmd-cli api describe GetNote
hackmd-cli api call GetNote --path noteId=abc --include

Before release

This depends on the HackMD OpenAPI update and the API client PR. Publish a new API client version with /raw and the registry, then pin it in the CLI.

Reference

hmd is another reference for operation discovery and generic HackMD API commands. It reads OpenAPI at runtime; our CLI instead uses the installed API client's generated registry and raw operations.

主要语言
TypeScript
星标
176
派生
13
平均合并
4 小时 35 分钟
30 天内合并 PR
4

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

hackmdio/hackmd-cli 的其他 Issue

查看 hackmdio/hackmd-cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。