HelpCommand¶
- class openapi_client.help.HelpCommand[source]
Bases:
objectMain class that provides command-line help functionality for Amorphic SDK APIs. Handles discovery, inspection, and documentation of available APIs and their methods.
- __init__()[source]
Initialize the help command by discovering all available API classes.
- list_apis()[source]
Display a summary list of all available APIs with method counts. This provides a high-level overview of what APIs are available in the SDK.
- show_api_details(api_name)[source]
Display detailed information about a specific API including all its methods.
- Parameters:
api_name (str) – Name of the API class to display details for
- describe_api_method(api_name, method_name)[source]
Display comprehensive information about a specific API method.
Shows method signature, parameters, types, default values, and documentation.
- Parameters:
api_name (str) – Name of the API class containing the method
method_name (str) – Name of the specific method to describe
- search_apis(query)[source]
Search for APIs and methods containing the query string (case-insensitive).
Searches through API names, method names, and method descriptions to find relevant functionality based on the user’s query.
- Parameters:
query (str) – Search term to look for in API/method names and descriptions
Overview:
The HelpCommand class provides a comprehensive help utility for discovering and exploring Amorphic SDK APIs. It includes functionality to list available APIs, show detailed API information, describe specific methods with parameters, and search for APIs and methods by keywords.
Key Features:
API Discovery: Automatically discover all available API classes
Method Inspection: Detailed parameter information and documentation
Search Functionality: Search APIs and methods by keywords
Command-line Interface: Full CLI support for interactive exploration
Documentation Parsing: Extract and format method documentation
Command-line Usage:
# List all available APIs
python -m openapi_client.help list
# Show details for a specific API
python -m openapi_client.help api DatasetsApi
# Describe a specific method
python -m openapi_client.help describe DatasetsApi create_dataset
# Search for APIs and methods
python -m openapi_client.help search dataset
Programmatic Usage:
from openapi_client.help import HelpCommand
# Create help instance
help_cmd = HelpCommand()
# List all APIs
help_cmd.list_apis()
# Show API details
help_cmd.show_api_details('DatasetsApi')
# Describe specific method
help_cmd.describe_api_method('DatasetsApi', 'create_dataset')
# Search functionality
help_cmd.search_apis('dataset')
Example Output:
List APIs:¶
Available APIs:
==============================
- DatasetsApi (45 methods)
- ManagementApi (4 methods)
- UsersApi (2 methods)
- MLAIApi (1 method)
API Details:¶
API: DatasetsApi
==============================
Total methods: 45
Available Methods:
- create_dataset
Description: Create a new dataset with specified metadata and configuration
- list_datasets
Description: Retrieve a list of all datasets accessible to the user
Method Description:¶
API: DatasetsApi
Method: create_dataset
==================================================
Description:
Create a new dataset with specified metadata and configuration
Parameters:
- role_id (required)
Type: str
Description: The role ID for authentication
- dataset_metadata (required)
Type: DatasetMetadata
Description: Dataset metadata including name, description, and configuration
Search Results:¶
Search results for 'dataset':
==============================
API: DatasetsApi
Matching Methods:
- create_dataset
Description: Create a new dataset with specified metadata
- delete_dataset
Description: Delete an existing dataset
CLI Function:
- openapi_client.help.main()[source]
Main entry point for the help utility command-line interface.
Parses command-line arguments and routes to appropriate help functions. Supports commands: list, api, describe, search
Error Handling: - No arguments: Shows usage instructions - Invalid command: Shows “Invalid command or missing arguments” + usage hint - Missing required args: Shows “Invalid command or missing arguments” + usage hint - Wrong API name: Shows “Error: API ‘name’ not found” + available APIs list - Wrong method name: Shows “Error: Method ‘name’ not found” + available methods list