Stancer. DynamicAPI
(stancer v0.1.0)
Copy Markdown
Dynamically generated Stancer API functions from OpenAPI specification.
This module generates all available API functions at runtime from the Stancer OpenAPI spec. Each function is automatically documented and type-specified based on the schema.
Generated Functions
Functions are generated for each endpoint in the OpenAPI spec, including:
tokenize_card/1- POST /tokenscreate_payment/1- POST /paymentsget_payment/1- GET /payments/{id}capture_payment/2- POST /payments/{id}/capturerefund_payment/2- POST /payments/{id}/refundget_card/1- GET /cards/{id}delete_card/1- DELETE /cards/{id}- And many more endpoints based on the Stancer API
All functions return {:ok, response_data} on success or {:error, reason} on failure.
Summary
Functions
Call an API endpoint dynamically by name with parameters.
Get information about a specific endpoint.
Load the OpenAPI specification and return all available endpoints.
Get all available operations grouped by tag/resource.
List all available API operations with their documentation.
Print formatted documentation for all available operations.
Functions
Call an API endpoint dynamically by name with parameters.
Parameters:
operation_id: The operationId from OpenAPIparams: Map or list of parameters for the operation
Returns: {:ok, response} or {:error, reason}
Example:
{:ok, token} = Stancer.DynamicAPI.call("post_tokens", %{
"card" => %{
"number" => "4111111111111111",
"exp_month" => 12,
"exp_year" => 2026,
"cvc" => "123"
}
})
Get information about a specific endpoint.
Parameters:
operation_id: The operationId from OpenAPI (e.g., "post_tokens")
Returns: {:ok, endpoint_info} or {:error, :not_found}
Load the OpenAPI specification and return all available endpoints.
Returns a list of endpoint maps with metadata from the OpenAPI spec.
Get all available operations grouped by tag/resource.
Returns a map where keys are resource names and values are lists of operations.
List all available API operations with their documentation.
Returns a list of operation maps with full metadata.
@spec print_api_docs() :: :ok | {:error, term()}
Print formatted documentation for all available operations.
This is useful for exploring the API in development.