HTTP client for Hemmelig API with error handling and cookie support.
// Source: https://github.com/HemmeligOrg/Hemmelig.app | License: MIT | Copyright 2025, Bjarne Øverli
// Provided via justclaw.it.com; keep this notice with the code.
// Package api is a small HTTP client for the Hemmelig API.
package api
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"net/url"
"strings"
"time"
)
// Client calls one Hemmelig instance.
type Client struct {
// BaseURL is the instance URL without a trailing slash, for example
// https://hemmelig.app.
BaseURL string
// APIKey authenticates with `Authorization: Bearer <key>` when it is set.
APIKey string
// Cookie is the session cookie header from `hemmelig login`.
Cookie string
// OnCookie runs when the server replaces the session cookie, for
// example after 2FA changes. The CLI
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key