samsa/internal/contracts/types.go
Franz Kafka 8e9aae062b
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 11s
Mirror to GitHub / mirror (push) Failing after 5s
Tests / test (push) Successful in 42s
rename: kafka → samsa
Full project rename from kafka to samsa (after Gregor Samsa, who
woke one morning from uneasy dreams to find himself transformed).

- Module: github.com/metamorphosis-dev/kafka → samsa
- Binary: cmd/kafka/ → cmd/samsa/
- CSS: kafka.css → samsa.css
- UI: all 'kafka' product names, titles, localStorage keys → samsa
- localStorage keys: kafka-theme → samsa-theme, kafka-engines → samsa-engines
- OpenSearch: ShortName, LongName, description, URLs updated
- AGPL headers: 'kafka' → 'samsa'
- Docs, configs, examples updated
- Cache key prefix: kafka: → samsa:
2026-03-22 23:44:55 +00:00

61 lines
2.1 KiB
Go

// samsa — a privacy-respecting metasearch engine
// Copyright (C) 2026-present metamorphosis-dev
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
package contracts
// OutputFormat matches the `/search?format=...` values.
type OutputFormat string
const (
FormatHTML OutputFormat = "html" // accepted for compatibility
FormatJSON OutputFormat = "json"
FormatCSV OutputFormat = "csv"
FormatRSS OutputFormat = "rss"
)
type SearchRequest struct {
Format OutputFormat
Query string
Pageno int
Safesearch int
TimeRange *string
TimeoutLimit *float64
Language string
// Engines and categories decide which engines run locally vs proxy to upstream.
Engines []string
Categories []string
// EngineData matches the `engine_data-<engine>-<key>=<value>` parameters.
EngineData map[string]map[string]string
// AccessToken gates paid/limited engines. Not part of upstream JSON schema.
AccessToken string
}
// SearchResponse matches the JSON schema used by `webutils.get_json_response()`.
type SearchResponse struct {
Query string `json:"query"`
NumberOfResults int `json:"number_of_results"`
Results []MainResult `json:"results"`
Answers []map[string]any `json:"answers"`
Corrections []string `json:"corrections"`
Infoboxes []map[string]any `json:"infoboxes"`
Suggestions []string `json:"suggestions"`
UnresponsiveEngines [][2]string `json:"unresponsive_engines"`
}