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.
61 lines
2.1 KiB
Swift
61 lines
2.1 KiB
Swift
//
|
|
// NewsItem.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct NewsItem: Sendable, Codable, ParameterConvertible, Hashable {
|
|
|
|
/** Image is a lead-image URL when the upstream carried one. */
|
|
public var image: String?
|
|
/** Lang is the article's language code when the upstream reported one. */
|
|
public var lang: String?
|
|
/** Link is the article's URL at the outlet. */
|
|
public var link: String?
|
|
/** PubDate is when the outlet published it, RFC3339 UTC. Empty when the upstream gave no date this could parse — items with no date sort last. */
|
|
public var pubDate: String?
|
|
/** Source is the outlet the item came from, as the upstream named it. */
|
|
public var source: String?
|
|
/** Title is the headline. */
|
|
public var title: String?
|
|
/** Tone is GDELT's own sentiment score for the article, as text. Only GDELT items carry it. */
|
|
public var tone: String?
|
|
|
|
public init(image: String? = nil, lang: String? = nil, link: String? = nil, pubDate: String? = nil, source: String? = nil, title: String? = nil, tone: String? = nil) {
|
|
self.image = image
|
|
self.lang = lang
|
|
self.link = link
|
|
self.pubDate = pubDate
|
|
self.source = source
|
|
self.title = title
|
|
self.tone = tone
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey, CaseIterable {
|
|
case image
|
|
case lang
|
|
case link
|
|
case pubDate
|
|
case source
|
|
case title
|
|
case tone
|
|
}
|
|
|
|
// Encodable protocol methods
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encodeIfPresent(image, forKey: .image)
|
|
try container.encodeIfPresent(lang, forKey: .lang)
|
|
try container.encodeIfPresent(link, forKey: .link)
|
|
try container.encodeIfPresent(pubDate, forKey: .pubDate)
|
|
try container.encodeIfPresent(source, forKey: .source)
|
|
try container.encodeIfPresent(title, forKey: .title)
|
|
try container.encodeIfPresent(tone, forKey: .tone)
|
|
}
|
|
}
|
|
|