mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Update GQL schema adding labels to highlights
This commit is contained in:
parent
4f1b4e523c
commit
179d791a73
1 changed files with 22 additions and 0 deletions
|
|
@ -6315,6 +6315,7 @@ extension Objects {
|
|||
let highlightPositionAnchorIndex: [String: Int]
|
||||
let highlightPositionPercent: [String: Double]
|
||||
let id: [String: String]
|
||||
let labels: [String: [Objects.Label]]
|
||||
let patch: [String: String]
|
||||
let prefix: [String: String]
|
||||
let quote: [String: String]
|
||||
|
|
@ -6368,6 +6369,10 @@ extension Objects.Highlight: Decodable {
|
|||
if let value = try container.decode(String?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "labels":
|
||||
if let value = try container.decode([Objects.Label]?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "patch":
|
||||
if let value = try container.decode(String?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
|
|
@ -6424,6 +6429,7 @@ extension Objects.Highlight: Decodable {
|
|||
highlightPositionAnchorIndex = map["highlightPositionAnchorIndex"]
|
||||
highlightPositionPercent = map["highlightPositionPercent"]
|
||||
id = map["id"]
|
||||
labels = map["labels"]
|
||||
patch = map["patch"]
|
||||
prefix = map["prefix"]
|
||||
quote = map["quote"]
|
||||
|
|
@ -6537,6 +6543,22 @@ extension Fields where TypeLock == Objects.Highlight {
|
|||
}
|
||||
}
|
||||
|
||||
func labels<Type>(selection: Selection<Type, [Objects.Label]?>) throws -> Type {
|
||||
let field = GraphQLField.composite(
|
||||
name: "labels",
|
||||
arguments: [],
|
||||
selection: selection.selection
|
||||
)
|
||||
select(field)
|
||||
|
||||
switch response {
|
||||
case let .decoding(data):
|
||||
return try selection.decode(data: data.labels[field.alias!])
|
||||
case .mocking:
|
||||
return selection.mock()
|
||||
}
|
||||
}
|
||||
|
||||
func patch() throws -> String {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "patch",
|
||||
|
|
|
|||
Loading…
Reference in a new issue