Endpoints SDK CLI
The `endpoints-sdk-cli` is a command-line interface tool designed for generating SDKs for various API endpoints. Currently at version 3.1.7, the package exhibits an active release cadence, with frequent patch and minor updates primarily addressing dependency updates and bug fixes. Its core functionality revolves around consuming Git repositories to generate client-side SDKs, simplifying interaction with defined API endpoints. While specific details on the input format (e.g., OpenAPI) are not explicitly stated in the provided context, its role as an 'endpoints SDK CLI' strongly implies it processes API definitions to produce code. A key differentiator is its focus on streamlining the SDK creation process directly from remote Git repositories via CLI commands, reducing the need for manual setup or complex configuration within development environments.
Common errors
-
このバージョンは、パスの生成が上手くできないケースが発覚しています。v3.0.1以上を利用してください。
cause Path generation bug present in version 3.0.0.fixUpgrade the package to version 3.0.1 or any newer version (e.g., `npm install -g endpoints-sdk-cli@latest`).
Warnings
- breaking The functionality for generating SDKs from local repositories was abolished. Directly referencing local paths like `add /Users/.../local-repository/` or `add ./local-repository` will no longer work.
- breaking Repository addition methods were unified, deprecating old syntaxes for adding remote repositories. Specific formats like `add git@github.com:username/repository.git` and `add https://github.com/[username/repository].git` may no longer be directly supported in their previous forms.
- gotcha Version 3.0.0 contained a bug where path generation did not work correctly, potentially leading to incorrect file paths in generated SDKs or other output issues.
Install
-
npm install endpoints-sdk-cli -
yarn add endpoints-sdk-cli -
pnpm add endpoints-sdk-cli
Imports
- cli
import { cli } from 'endpoints-sdk-cli'; cli.run(['add', 'repo']);This package is primarily a CLI tool and not intended for direct library-style imports. Its functionality is accessed via the 'endpoints' command in the terminal.
- generateSdk
import { generateSdk } from 'endpoints-sdk-cli'; generateSdk({ repo: '...' });This package primarily operates via CLI commands. The SDK generation process is initiated through the `endpoints` CLI command (e.g., `endpoints add <repo_url>`), rather than a directly importable function.
- EndpointsCLI
import EndpointsCLI from 'endpoints-sdk-cli'; new EndpointsCLI().addRepo('...');There is no exposed class or default export for programmatic instantiation of the CLI program.
Quickstart
npm install -g endpoints-sdk-cli # Or use npx for one-off commands # npx endpoints-sdk-cli <command> # Add a remote repository containing your API definition (e.g., OpenAPI spec) # Replace with your actual repository URL and branch endpoints add https://github.com/your-org/your-api-specs.git --branch main # The CLI will process the repository and generate an SDK based on its contents. # The generated files are typically output to the current working directory # or a configurable path. Consult the official documentation for output specifics. # Example: To list available commands endpoints --help