Resource types define the interface for syncing data between the Buttondown API and local storage.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/buttondown/cli/llms.txt
Use this file to discover all available pages before exploring further.
Resource
AResource represents a single type of data that can be synced, with methods for reading, writing, and transforming between different representations.
Type Definition
Type Parameters
The runtime representation of the resource, typically the raw API response or in-memory data structure.
The serialized representation used for local storage, typically a JSON-serializable format.
Methods
Retrieves the resource data. Returns
null if the resource doesn’t exist.Parameters:configuration: The Configuration object with API credentials and directory path
null if not foundWrites the resource data, creating or updating as needed.Parameters:
value: The resource data to writeconfiguration: The Configuration object with API credentials and directory path
Transforms the runtime Model into a SerializedModel suitable for local storage.Parameters:
r: The resource in Model format
Transforms a SerializedModel back into the runtime Model format.Parameters:
s: The resource in SerializedModel format
ResourceGroup
AResourceGroup pairs a remote (API) resource with a local (filesystem) resource, enabling bidirectional sync.
Type Definition
Type Parameters
The Model type for the remote resource (API response format).
The SerializedModel type for the remote resource, which serves as the Model type for the local resource. This is the intermediate format used for sync.
The SerializedModel type for the local resource (filesystem storage format).
Properties
The remote resource that interfaces with the Buttondown API. It transforms API responses (type
A) into the intermediate sync format (type B).The local resource that interfaces with the filesystem. It transforms the intermediate sync format (type
B) into the local storage format (type C).A human-readable name for this resource group, used for logging and display purposes.
Usage Example
Type Flow
The type parameters ensure type safety through the sync pipeline:- Remote fetch: API returns
A→ serialized toB - Intermediate: Both remote and local work with
B - Local storage:
Bserialized toCfor filesystem