mirror of
https://github.com/hanzoai/swift-sdk.git
synced 2026-10-30 18:20:19 +00:00
The forge tree held the package scaffolding and none of the generated sources — 2,435 files of APIs, Models and Infrastructure, including BaseAPI, were simply absent, so anything depending on this copy had a package that compiled to nothing usable. Generated from the current API document rather than reconciled with the other copy: a client is a function of the spec, so regenerating answers "which history wins" without anyone having to choose. .spec-lock records which document, so the next reader can tell.
51 lines
2.4 KiB
Swift
51 lines
2.4 KiB
Swift
//
|
|
// Source.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct Source: Sendable, Codable, ParameterConvertible, Hashable {
|
|
|
|
/** Engine is the search backend the hit came from: bing, ddg, mojeek or brave. Omitted when the backend did not name itself. Results are merged across backends, so two sources in one answer can carry different engines. */
|
|
public var engine: String?
|
|
/** Favicon is a 64px icon URL derived from the host for the client to render beside the citation. It is Google's s2 service, not something we host or fetched — an empty host yields the empty string. */
|
|
public var favicon: String?
|
|
/** Snippet is the engine's summary of the page, clipped to 600 runes. THIS IS WHAT THE CLIENT SHOWS. What the model reads is the fetched page, which is far larger and deliberately never on the wire. */
|
|
public var snippet: String?
|
|
/** Title is the page title the engine reported, stripped of the bracketed furniture engines staple on (\"[PDF]\", \"(Official Site)\"). It falls back to the www-stripped host when the engine gave none, so it is never empty and is safe to use as link text. */
|
|
public var title: String?
|
|
/** URL is the page, absolute, exactly as the engine gave it. It is also the dedupe key — one source per URL, and at most hostCap per host — and what a markdown citation in the answer is checked against, so a link in the prose always matches a URL here. */
|
|
public var url: String?
|
|
|
|
public init(engine: String? = nil, favicon: String? = nil, snippet: String? = nil, title: String? = nil, url: String? = nil) {
|
|
self.engine = engine
|
|
self.favicon = favicon
|
|
self.snippet = snippet
|
|
self.title = title
|
|
self.url = url
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey, CaseIterable {
|
|
case engine
|
|
case favicon
|
|
case snippet
|
|
case title
|
|
case url
|
|
}
|
|
|
|
// Encodable protocol methods
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encodeIfPresent(engine, forKey: .engine)
|
|
try container.encodeIfPresent(favicon, forKey: .favicon)
|
|
try container.encodeIfPresent(snippet, forKey: .snippet)
|
|
try container.encodeIfPresent(title, forKey: .title)
|
|
try container.encodeIfPresent(url, forKey: .url)
|
|
}
|
|
}
|
|
|