Heapi API Reference
Explore the list of all functions available to the frontend.
API Layers
- Backend (Go): Functions defined in App struct (app.go), exposed via Wails.
- Frontend (TypeScript): Located in src/api/, providing async wrappers with error handling and proper typing.
Collections API
getCollections
Retrieves all collections and their requests. Loads collections from YAML storage and enriches requests with last response metadata from the SQLite database.
TypeScript: function getCollections(): Promise<Collection[]>
Go: func (a *App) GetCollections() ([]models.Collection, error)
Returns: Array of Collection objects including nested Requests.
createCollection
Creates a new empty collection and persists it as a new YAML file.
TypeScript: function createCollection(name: string): Promise<Collection | null>
Go: func (a *App) CreateCollection(name string) (models.Collection, error)
Parameters:
name(string): The display name for the new collection.
deleteCollection
Deletes a collection and removes all associated requests from the YAML file system.
TypeScript: function deleteCollection(id: string): Promise<boolean>
Go: func (a *App) DeleteCollection(id string) error
Parameters:
id(string): The UUID of the collection to delete.
renameCollection
Renames an existing collection.
TypeScript: function renameCollection(id: string, name: string): Promise<boolean>
Go: func (a *App) RenameCollection(id string, name string) error
Parameters:
id(string): The UUID of the collection.name(string): The new name.
Requests API
execute
Performs the actual HTTP call, executes variable substitution from the active environment, and persists results/history.
TypeScript: function execute(requestID: string, method: string, url: string, headers: string, body: string, auth: string, envID: string | null): Promise<ResponseResult | null>
Go: func (a *App) Execute(requestID string, method, url, headers, body, auth string, envID *string) (*service.ResponseResult, error)
Parameters:
requestID(string): The UUID of the request being executed.method(string): HTTP Method (e.g., 'GET', 'POST').url(string): The endpoint to call.headers(string): JSON string representing headers array.body(string): Raw request body.auth(string): JSON string containing auth configuration.envID(string | null): ID of the active environment for variable substitution.
createRequest
Adds a new request to an existing collection.
TypeScript: function createRequest(colId: string, name: string, method: string, url: string): Promise<Request | null>
Go: func (a *App) CreateRequest(colID string, name, method, url string) (models.Request, error)
Parameters:
colId(string): The UUID of the parent collection.name(string): The name of the request.
updateRequest
Updates request details and persists response metadata to SQLite cache.
TypeScript: function updateRequest(id: string, name: string, method: string, url: string, headers: string, body: string, auth: string, lastRes: string, lastStatus: number, lastDur: number, lastHeaders: string): Promise<boolean>
Go: func (a *App) UpdateRequest(id string, name, method, url, headers, body, auth string, lastRes string, lastStatus int, lastDur int64, lastHeaders string) error
Environments API
getEnvironments
Lists all available environments stored in the YAML config.
TypeScript: function getEnvironments(): Promise<Environment[]>
Go: func (a *App) GetEnvironments() ([]models.Environment, error)
updateEnvironment
Updates an environment's variable mappings.
TypeScript: function updateEnvironment(id: string, name: string, variables: string): Promise<boolean>
Go: func (a *App) UpdateEnvironment(id, name, variables string) error
Parameters:
variables(string): JSON string mapping keys to values.