'; } } } window.addEventListener("load", displaySearchResults);
```
--------------------------------
### Generate Proto Descriptor with Protoc
Source: https://github.com/markvincze/sabledocs/blob/main/README.md
Use the protoc compiler to generate a binary descriptor from your Proto contracts. Ensure the --include_source_info flag is used to include comments in the documentation.
```bash
protoc *.proto -o descriptor.pb --include_source_info
```
--------------------------------
### Configure sabledocs.toml for extra templates
Source: https://context7.com/markvincze/sabledocs/llms.txt
Defines the directory and file suffix for custom HTML templates.
```toml
extra-template-path = "extra-templates"
extra-template-suffix = ".html" # Only process files with this suffix
```
--------------------------------
### Configure Extra Jinja Templates and Suffix
Source: https://github.com/markvincze/sabledocs/blob/main/README.md
Define paths for extra Jinja templates and their file suffix. Subdirectories prefixed with '_' are ignored.
```toml
extra-template-path = "extra-templates"
extra-template-suffix = ".tpl" # default value is ".html"
```
--------------------------------
### Build Python Package
Source: https://github.com/markvincze/sabledocs/blob/main/README.md
Command to build the Python package using the 'build' module.
```bash
python -m build
```
--------------------------------
### Publish Package to TestPyPI
Source: https://github.com/markvincze/sabledocs/blob/main/README.md
Command to upload the built Python package to the TestPyPI repository using 'twine'.
```bash
python -m twine upload --repository testpypi dist/*
```
--------------------------------
### Service Documentation
Source: https://github.com/markvincze/sabledocs/blob/main/src/sabledocs/templates/_default/service.html
Details about the available services and their methods.
```APIDOC
## Service Documentation
This section provides details about the available services and their associated RPC methods.
### Service: `{{ service.name }}`
**Description:** {{ service.description_html | safe }}
{% for method in service.methods %}
##### RPC Method: `{{ method.name }}`
**Request Type:** `{{ common.type_name(method.request) | trim }}`
**Response Type:** `{{ common.type_name(method.response) }}`
{% if method.description_html %}
**Description:** {{ method.description_html | safe }}
{% endif %}
{% endfor %}
```
--------------------------------
### Configure Markdown Extensions
Source: https://github.com/markvincze/sabledocs/blob/main/README.md
Specify markdown extensions to be used by Sabledocs. 'fenced_code' and 'nl2br' are common choices.
```toml
markdown-extensions = ["fenced_code", "nl2br"]
```
--------------------------------
### Set Custom Jinja Template Path
Source: https://github.com/markvincze/sabledocs/blob/main/README.md
Specify a directory for custom Jinja templates to override Sabledocs' default templates.
```toml
template-path = "templates"
```
--------------------------------
### Enum Documentation
Source: https://github.com/markvincze/sabledocs/blob/main/src/sabledocs/templates/_default/enum.html
This section details the structure and values of enums within SableDocs.
```APIDOC
## Enum Documentation
### Description
This section details the structure and values of enums within SableDocs.
### Enum Structure
#### `{{ enum.name }}`
**Description:** {{ enum.description_html | safe }}
{% if enum.repository_url %} **Source:** [{{ enum.source_file_path }}]({{ enum.repository_url }}) {% endif %}
### Enum Values
| Name | Number | Description |
|---|---|---|
{% for enum_value in enum.values %}
| `{{ enum_value.name }}` | {{ enum_value.number }} | {{ enum_value.description_html | safe }} |
{% endfor %}
```
--------------------------------
### Implement custom comment parser
Source: https://context7.com/markvincze/sabledocs/llms.txt
Configures a custom Python parser for processing JSON-formatted comments in Protobuf files.
```toml
# sabledocs.toml
comments-parser-file = "custom_parser.py"
```
```python
# custom_parser.py - Custom comment parser for JSON-formatted comments
import json
import re
class CustomCommentsParser(CommentsParser):
"""Parse JSON-structured comments and extract documentation fields."""
def __init__(self):
pass
def ParseAll(self, comment):
"""Process all comment types - extracts 'desc' field from JSON comments."""
# Normalize whitespace for JSON parsing
comment_simple = ' '.join(comment.split())
try:
comments_dict = json.loads(comment_simple)
if "desc" in comments_dict:
# Convert
tags to markdown paragraphs
comment = re.sub(r'
', r'\n\n', comments_dict["desc"])
# Optionally handle other fields
if "deprecated" in comments_dict:
comment = f"**DEPRECATED**: {comments_dict['deprecated']}\n\n{comment}"
if "since" in comments_dict:
comment = f"{comment}\n\n*Since version {comments_dict['since']}*"
except json.decoder.JSONDecodeError:
# Return original comment if not valid JSON
pass
return comment
def ParseMessage(self, comment):
"""Custom processing for message comments."""
return self.ParseAll(comment)
def ParseField(self, comment):
"""Custom processing for field comments."""
return self.ParseAll(comment)
def ParseService(self, comment):
"""Custom processing for service comments."""
return self.ParseAll(comment)
def ParseServiceMethod(self, comment):
"""Custom processing for service method comments."""
return self.ParseAll(comment)
def ParseEnum(self, comment):
"""Custom processing for enum comments."""
return self.ParseAll(comment)
def ParseEnumValue(self, comment):
"""Custom processing for enum value comments."""
return self.ParseAll(comment)
```
--------------------------------
### Customize Templates
Source: https://context7.com/markvincze/sabledocs/llms.txt
Override default Jinja2 templates by specifying a template path in the configuration.
```toml
# sabledocs.toml
template-path = "my-templates"
```
```html
{% endfor %}
```
--------------------------------
### Format Type Name with Package Linking
Source: https://github.com/markvincze/sabledocs/blob/main/src/sabledocs/templates/_default/type_name.html
Use this macro to format a message field's type name. It trims whitespace and conditionally adds a link to the package if the type is a MESSAGE and the package is visible.
```jinja
{%- macro type_name(message_field) -%}
{%- if message_field.package and not message_field.is_package_hidden and message_field.type_kind != "UNKNOWN" -%}
{%- if message_field.type_kind == "MESSAGE" -%}
[{%- else -%}]
({{ message_field.package.name if message_field.package.name else )
[{%- endif -%}
{{ message_field.full_type }}
]({{ message_field.package.name if message_field.package.name else )
{%- else -%}
{{ message_field.full_type }}
{%- endif -%}
{%- endmacro -%}
```
--------------------------------
### RefundService API
Source: https://context7.com/markvincze/sabledocs/llms.txt
Details for the RefundService, which handles refunds and chargebacks.
```APIDOC
## RefundService API
### Description
Handles refunds and chargebacks for payment transactions.
### Authentication
All API calls require a valid API key passed in the `x-api-key` metadata header.
*(Note: Specific RPC methods for RefundService are not detailed in the provided text. Please refer to the proto file or other documentation for specific endpoints.)*
```
--------------------------------
### Specify Custom Comments Parser
Source: https://github.com/markvincze/sabledocs/blob/main/README.md
Indicate a Python script that defines a class inheriting from CommentsParser for pre-processing comment strings.
```toml
comments-parser-file = "sample/custom_comments_parser.py"
```
--------------------------------
### Message Structure
Source: https://github.com/markvincze/sabledocs/blob/main/src/sabledocs/templates/_default/message.html
Defines the structure of a message, including its fields, nested messages, and source information.
```APIDOC
## Message {{ message.name }}
### Description
{{ message.description_html | safe }}
{% if message.repository_url %}
### Source
[{{ message.source_file_path }}]({{ message.repository_url }})
{% endif %}
### Fields
| Field | Type | Description | Default Value |
|---|---|---|---|
{% for field in message.non_oneof_fields %}
| {{ field.number }} | `{% if field.label != "" %} {{ field.label }} {% endif %} {{ common.type_name(field) }}` | {{ field.description_html | safe }} | {{ field.default_value }} |
{% endfor %}
{% for oneof_field_group in message.oneof_field_groups %}
#### oneof {{ oneof_field_group.name }}
| Field | Type | Description | Default Value |
|---|---|---|---|
{% for field in oneof_field_group.fields %}
| {{ field.number }} | `{% if field.label != "" %} {{ field.label }} {% endif %} {{ common.type_name(field) }}` | {{ field.description_html | safe }} | {{ field.default_value }} |
{% endfor %}
{% endfor %}
```
--------------------------------
### PaymentService API
Source: https://context7.com/markvincze/sabledocs/llms.txt
Details for the PaymentService, including its RPC methods and associated messages.
```APIDOC
## PaymentService API
### Description
Handles all payment-related operations, including creating, retrieving, and managing payments. All monetary amounts are represented in the smallest currency unit (e.g., cents).
### Authentication
All API calls require a valid API key passed in the `x-api-key` metadata header.
### RPC Methods
#### CreatePayment
##### Description
Initiates a new payment transaction. Returns the created payment with a unique identifier. The payment starts in PENDING status.
##### Method
`POST` (gRPC equivalent)
##### Endpoint
`/payment.v1.PaymentService/CreatePayment`
##### Parameters
###### Request Body
- **customer_id** (string) - Required - Customer identifier
- **amount** (int64) - Required - Amount in smallest currency unit (must be positive)
- **currency** (string) - Optional - ISO 4217 currency code (default: "USD")
- **idempotency_key** (string) - Optional - Idempotency key to prevent duplicate payments
##### Request Example
```json
{
"customer_id": "cust_123",
"amount": 1000,
"currency": "USD",
"idempotency_key": "unique-key-123"
}
```
##### Response
###### Success Response (200)
- **id** (string) - Unique identifier for the payment (format: pay_xxxxx)
- **customer_id** (string) - Customer who initiated the payment
- **amount** (int64) - Payment amount in smallest currency unit (e.g., cents)
- **currency** (string) - ISO 4217 currency code (e.g., "USD", "EUR")
- **status** (PaymentStatus) - Current status of the payment
- **created_at** (string) - Timestamp when payment was created (RFC 3339)
###### Response Example
```json
{
"id": "pay_abcde",
"customer_id": "cust_123",
"amount": 1000,
"currency": "USD",
"status": "PAYMENT_STATUS_PENDING",
"created_at": "2023-10-27T10:00:00Z"
}
```
#### GetPayment
##### Description
Retrieves a payment by its unique identifier.
##### Method
`GET` (gRPC equivalent)
##### Endpoint
`/payment.v1.PaymentService/GetPayment`
##### Parameters
###### Query Parameters
- **id** (string) - Required - Unique identifier for the payment
##### Response
###### Success Response (200)
- **id** (string) - Unique identifier for the payment (format: pay_xxxxx)
- **customer_id** (string) - Customer who initiated the payment
- **amount** (int64) - Payment amount in smallest currency unit (e.g., cents)
- **currency** (string) - ISO 4217 currency code (e.g., "USD", "EUR")
- **status** (PaymentStatus) - Current status of the payment
- **created_at** (string) - Timestamp when payment was created (RFC 3339)
#### ListPayments
##### Description
Returns all payments for a customer.
##### Method
`GET` (gRPC equivalent)
##### Endpoint
`/payment.v1.PaymentService/ListPayments`
##### Parameters
###### Query Parameters
- **customer_id** (string) - Required - The ID of the customer whose payments to list.
##### Response
###### Success Response (200)
- **payments** (array) - A list of payments for the customer.
###### Response Example
```json
{
"payments": [
{
"id": "pay_abcde",
"customer_id": "cust_123",
"amount": 1000,
"currency": "USD",
"status": "PAYMENT_STATUS_COMPLETED",
"created_at": "2023-10-27T10:00:00Z"
},
{
"id": "pay_fghij",
"customer_id": "cust_123",
"amount": 500,
"currency": "USD",
"status": "PAYMENT_STATUS_PENDING",
"created_at": "2023-10-27T11:00:00Z"
}
]
}
```
### Data Types
#### Payment
##### Description
Represents a single payment transaction.
##### Fields
- **id** (string) - Unique identifier for the payment (format: pay_xxxxx)
- **customer_id** (string) - Customer who initiated the payment
- **amount** (int64) - Payment amount in smallest currency unit (e.g., cents)
- **currency** (string) - ISO 4217 currency code (e.g., "USD", "EUR")
- **status** (PaymentStatus) - Current status of the payment
- **created_at** (string) - Timestamp when payment was created (RFC 3339)
#### PaymentStatus (Enum)
##### Description
Represents the lifecycle state of a payment.
##### Values
- **PAYMENT_STATUS_UNSPECIFIED**: Default unspecified status
- **PAYMENT_STATUS_PENDING**: Payment is being processed
- **PAYMENT_STATUS_COMPLETED**: Payment completed successfully
- **PAYMENT_STATUS_FAILED**: Payment failed (see failure_reason for details)
- **PAYMENT_STATUS_REFUNDED**: Payment was refunded
```
--------------------------------
### ReportingService API
Source: https://context7.com/markvincze/sabledocs/llms.txt
Details for the ReportingService, which provides transaction reporting and analytics.
```APIDOC
## ReportingService API
### Description
Provides transaction reporting and analytics.
### Authentication
All API calls require a valid API key passed in the `x-api-key` metadata header.
*(Note: Specific RPC methods for ReportingService are not detailed in the provided text. Please refer to the proto file or other documentation for specific endpoints.)*
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.