mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Add type to highlights
This commit is contained in:
parent
5e396ef23b
commit
2b62bff958
7 changed files with 179 additions and 25 deletions
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="21513" systemVersion="21G115" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
|
||||
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="21513" systemVersion="21G419" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
|
||||
<entity name="Highlight" representedClassName="Highlight" syncable="YES" codeGenerationType="class">
|
||||
<attribute name="annotation" optional="YES" attributeType="String"/>
|
||||
<attribute name="createdAt" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
|
||||
|
|
@ -14,6 +14,7 @@
|
|||
<attribute name="serverSyncStatus" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
|
||||
<attribute name="shortId" attributeType="String"/>
|
||||
<attribute name="suffix" optional="YES" attributeType="String"/>
|
||||
<attribute name="type" optional="YES" attributeType="String"/>
|
||||
<attribute name="updatedAt" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
|
||||
<relationship name="createdBy" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="UserProfile"/>
|
||||
<relationship name="labels" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="LinkedItemLabel" inverseName="highlights" inverseEntity="LinkedItemLabel"/>
|
||||
|
|
|
|||
|
|
@ -684,6 +684,7 @@ extension Objects {
|
|||
let readAt: [String: DateTime]
|
||||
let readingProgressAnchorIndex: [String: Int]
|
||||
let readingProgressPercent: [String: Double]
|
||||
let readingProgressTopPercent: [String: Double]
|
||||
let recommendations: [String: [Objects.Recommendation]]
|
||||
let savedAt: [String: DateTime]
|
||||
let savedByViewer: [String: Bool]
|
||||
|
|
@ -808,6 +809,10 @@ extension Objects.Article: Decodable {
|
|||
if let value = try container.decode(Double?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "readingProgressTopPercent":
|
||||
if let value = try container.decode(Double?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "recommendations":
|
||||
if let value = try container.decode([Objects.Recommendation]?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
|
|
@ -908,6 +913,7 @@ extension Objects.Article: Decodable {
|
|||
readAt = map["readAt"]
|
||||
readingProgressAnchorIndex = map["readingProgressAnchorIndex"]
|
||||
readingProgressPercent = map["readingProgressPercent"]
|
||||
readingProgressTopPercent = map["readingProgressTopPercent"]
|
||||
recommendations = map["recommendations"]
|
||||
savedAt = map["savedAt"]
|
||||
savedByViewer = map["savedByViewer"]
|
||||
|
|
@ -1288,6 +1294,21 @@ extension Fields where TypeLock == Objects.Article {
|
|||
}
|
||||
}
|
||||
|
||||
func readingProgressTopPercent() throws -> Double? {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "readingProgressTopPercent",
|
||||
arguments: []
|
||||
)
|
||||
select(field)
|
||||
|
||||
switch response {
|
||||
case let .decoding(data):
|
||||
return data.readingProgressTopPercent[field.alias!]
|
||||
case .mocking:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func recommendations<Type>(selection: Selection<Type, [Objects.Recommendation]?>) throws -> Type {
|
||||
let field = GraphQLField.composite(
|
||||
name: "recommendations",
|
||||
|
|
@ -1730,6 +1751,7 @@ extension Objects {
|
|||
let slug: [String: String]
|
||||
let status: [String: Enums.ArticleSavingRequestStatus]
|
||||
let updatedAt: [String: DateTime]
|
||||
let url: [String: String]
|
||||
let user: [String: Objects.User]
|
||||
let userId: [String: String]
|
||||
|
||||
|
|
@ -1779,6 +1801,10 @@ extension Objects.ArticleSavingRequest: Decodable {
|
|||
if let value = try container.decode(DateTime?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "url":
|
||||
if let value = try container.decode(String?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "user":
|
||||
if let value = try container.decode(Objects.User?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
|
|
@ -1804,6 +1830,7 @@ extension Objects.ArticleSavingRequest: Decodable {
|
|||
slug = map["slug"]
|
||||
status = map["status"]
|
||||
updatedAt = map["updatedAt"]
|
||||
url = map["url"]
|
||||
user = map["user"]
|
||||
userId = map["userId"]
|
||||
}
|
||||
|
|
@ -1932,6 +1959,24 @@ extension Fields where TypeLock == Objects.ArticleSavingRequest {
|
|||
}
|
||||
}
|
||||
|
||||
func url() throws -> String {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "url",
|
||||
arguments: []
|
||||
)
|
||||
select(field)
|
||||
|
||||
switch response {
|
||||
case let .decoding(data):
|
||||
if let data = data.url[field.alias!] {
|
||||
return data
|
||||
}
|
||||
throw HttpError.badpayload
|
||||
case .mocking:
|
||||
return String.mockValue
|
||||
}
|
||||
}
|
||||
|
||||
func user<Type>(selection: Selection<Type, Objects.User>) throws -> Type {
|
||||
let field = GraphQLField.composite(
|
||||
name: "user",
|
||||
|
|
@ -7217,6 +7262,7 @@ extension Objects {
|
|||
let createdByMe: [String: Bool]
|
||||
let highlightPositionAnchorIndex: [String: Int]
|
||||
let highlightPositionPercent: [String: Double]
|
||||
let html: [String: String]
|
||||
let id: [String: String]
|
||||
let labels: [String: [Objects.Label]]
|
||||
let patch: [String: String]
|
||||
|
|
@ -7227,6 +7273,7 @@ extension Objects {
|
|||
let sharedAt: [String: DateTime]
|
||||
let shortId: [String: String]
|
||||
let suffix: [String: String]
|
||||
let type: [String: Enums.HighlightType]
|
||||
let updatedAt: [String: DateTime]
|
||||
let user: [String: Objects.User]
|
||||
|
||||
|
|
@ -7268,6 +7315,10 @@ extension Objects.Highlight: Decodable {
|
|||
if let value = try container.decode(Double?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "html":
|
||||
if let value = try container.decode(String?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "id":
|
||||
if let value = try container.decode(String?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
|
|
@ -7308,6 +7359,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 "type":
|
||||
if let value = try container.decode(Enums.HighlightType?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "updatedAt":
|
||||
if let value = try container.decode(DateTime?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
|
|
@ -7331,6 +7386,7 @@ extension Objects.Highlight: Decodable {
|
|||
createdByMe = map["createdByMe"]
|
||||
highlightPositionAnchorIndex = map["highlightPositionAnchorIndex"]
|
||||
highlightPositionPercent = map["highlightPositionPercent"]
|
||||
html = map["html"]
|
||||
id = map["id"]
|
||||
labels = map["labels"]
|
||||
patch = map["patch"]
|
||||
|
|
@ -7341,6 +7397,7 @@ extension Objects.Highlight: Decodable {
|
|||
sharedAt = map["sharedAt"]
|
||||
shortId = map["shortId"]
|
||||
suffix = map["suffix"]
|
||||
type = map["type"]
|
||||
updatedAt = map["updatedAt"]
|
||||
user = map["user"]
|
||||
}
|
||||
|
|
@ -7428,6 +7485,21 @@ extension Fields where TypeLock == Objects.Highlight {
|
|||
}
|
||||
}
|
||||
|
||||
func html() throws -> String? {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "html",
|
||||
arguments: []
|
||||
)
|
||||
select(field)
|
||||
|
||||
switch response {
|
||||
case let .decoding(data):
|
||||
return data.html[field.alias!]
|
||||
case .mocking:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func id() throws -> String {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "id",
|
||||
|
|
@ -7462,7 +7534,7 @@ extension Fields where TypeLock == Objects.Highlight {
|
|||
}
|
||||
}
|
||||
|
||||
func patch() throws -> String {
|
||||
func patch() throws -> String? {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "patch",
|
||||
arguments: []
|
||||
|
|
@ -7471,12 +7543,9 @@ extension Fields where TypeLock == Objects.Highlight {
|
|||
|
||||
switch response {
|
||||
case let .decoding(data):
|
||||
if let data = data.patch[field.alias!] {
|
||||
return data
|
||||
}
|
||||
throw HttpError.badpayload
|
||||
return data.patch[field.alias!]
|
||||
case .mocking:
|
||||
return String.mockValue
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -7495,7 +7564,7 @@ extension Fields where TypeLock == Objects.Highlight {
|
|||
}
|
||||
}
|
||||
|
||||
func quote() throws -> String {
|
||||
func quote() throws -> String? {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "quote",
|
||||
arguments: []
|
||||
|
|
@ -7504,12 +7573,9 @@ extension Fields where TypeLock == Objects.Highlight {
|
|||
|
||||
switch response {
|
||||
case let .decoding(data):
|
||||
if let data = data.quote[field.alias!] {
|
||||
return data
|
||||
}
|
||||
throw HttpError.badpayload
|
||||
return data.quote[field.alias!]
|
||||
case .mocking:
|
||||
return String.mockValue
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -7599,6 +7665,24 @@ extension Fields where TypeLock == Objects.Highlight {
|
|||
}
|
||||
}
|
||||
|
||||
func type() throws -> Enums.HighlightType {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "type",
|
||||
arguments: []
|
||||
)
|
||||
select(field)
|
||||
|
||||
switch response {
|
||||
case let .decoding(data):
|
||||
if let data = data.type[field.alias!] {
|
||||
return data
|
||||
}
|
||||
throw HttpError.badpayload
|
||||
case .mocking:
|
||||
return Enums.HighlightType.allCases.first!
|
||||
}
|
||||
}
|
||||
|
||||
func updatedAt() throws -> DateTime {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "updatedAt",
|
||||
|
|
@ -13125,10 +13209,10 @@ extension Fields where TypeLock == Objects.Query {
|
|||
}
|
||||
}
|
||||
|
||||
func articleSavingRequest<Type>(id: String, selection: Selection<Type, Unions.ArticleSavingRequestResult>) throws -> Type {
|
||||
func articleSavingRequest<Type>(id: OptionalArgument<String> = .absent(), url: OptionalArgument<String> = .absent(), selection: Selection<Type, Unions.ArticleSavingRequestResult>) throws -> Type {
|
||||
let field = GraphQLField.composite(
|
||||
name: "articleSavingRequest",
|
||||
arguments: [Argument(name: "id", type: "ID!", value: id)],
|
||||
arguments: [Argument(name: "id", type: "ID", value: id), Argument(name: "url", type: "String", value: url)],
|
||||
selection: selection.selection
|
||||
)
|
||||
select(field)
|
||||
|
|
@ -16839,6 +16923,7 @@ extension Objects {
|
|||
let readAt: [String: DateTime]
|
||||
let readingProgressAnchorIndex: [String: Int]
|
||||
let readingProgressPercent: [String: Double]
|
||||
let readingProgressTopPercent: [String: Double]
|
||||
let recommendations: [String: [Objects.Recommendation]]
|
||||
let savedAt: [String: DateTime]
|
||||
let shortId: [String: String]
|
||||
|
|
@ -16957,6 +17042,10 @@ extension Objects.SearchItem: Decodable {
|
|||
if let value = try container.decode(Double?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "readingProgressTopPercent":
|
||||
if let value = try container.decode(Double?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
}
|
||||
case "recommendations":
|
||||
if let value = try container.decode([Objects.Recommendation]?.self, forKey: codingKey) {
|
||||
map.set(key: field, hash: alias, value: value as Any)
|
||||
|
|
@ -17048,6 +17137,7 @@ extension Objects.SearchItem: Decodable {
|
|||
readAt = map["readAt"]
|
||||
readingProgressAnchorIndex = map["readingProgressAnchorIndex"]
|
||||
readingProgressPercent = map["readingProgressPercent"]
|
||||
readingProgressTopPercent = map["readingProgressTopPercent"]
|
||||
recommendations = map["recommendations"]
|
||||
savedAt = map["savedAt"]
|
||||
shortId = map["shortId"]
|
||||
|
|
@ -17405,6 +17495,21 @@ extension Fields where TypeLock == Objects.SearchItem {
|
|||
}
|
||||
}
|
||||
|
||||
func readingProgressTopPercent() throws -> Double? {
|
||||
let field = GraphQLField.leaf(
|
||||
name: "readingProgressTopPercent",
|
||||
arguments: []
|
||||
)
|
||||
select(field)
|
||||
|
||||
switch response {
|
||||
case let .decoding(data):
|
||||
return data.readingProgressTopPercent[field.alias!]
|
||||
case .mocking:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func recommendations<Type>(selection: Selection<Type, [Objects.Recommendation]?>) throws -> Type {
|
||||
let field = GraphQLField.composite(
|
||||
name: "recommendations",
|
||||
|
|
@ -30557,6 +30662,8 @@ extension Enums {
|
|||
extension Enums {
|
||||
/// ArticleSavingRequestErrorCode
|
||||
enum ArticleSavingRequestErrorCode: String, CaseIterable, Codable {
|
||||
case badData = "BAD_DATA"
|
||||
|
||||
case notFound = "NOT_FOUND"
|
||||
|
||||
case unauthorized = "UNAUTHORIZED"
|
||||
|
|
@ -30908,6 +31015,17 @@ extension Enums {
|
|||
}
|
||||
}
|
||||
|
||||
extension Enums {
|
||||
/// HighlightType
|
||||
enum HighlightType: String, CaseIterable, Codable {
|
||||
case highlight = "HIGHLIGHT"
|
||||
|
||||
case note = "NOTE"
|
||||
|
||||
case redaction = "REDACTION"
|
||||
}
|
||||
}
|
||||
|
||||
extension Enums {
|
||||
/// IntegrationType
|
||||
enum IntegrationType: String, CaseIterable, Codable {
|
||||
|
|
@ -31812,13 +31930,15 @@ extension InputObjects {
|
|||
|
||||
var highlightPositionPercent: OptionalArgument<Double> = .absent()
|
||||
|
||||
var html: OptionalArgument<String> = .absent()
|
||||
|
||||
var id: String
|
||||
|
||||
var patch: String
|
||||
var patch: OptionalArgument<String> = .absent()
|
||||
|
||||
var prefix: OptionalArgument<String> = .absent()
|
||||
|
||||
var quote: String
|
||||
var quote: OptionalArgument<String> = .absent()
|
||||
|
||||
var sharedAt: OptionalArgument<DateTime> = .absent()
|
||||
|
||||
|
|
@ -31826,19 +31946,23 @@ extension InputObjects {
|
|||
|
||||
var suffix: OptionalArgument<String> = .absent()
|
||||
|
||||
var type: OptionalArgument<Enums.HighlightType> = .absent()
|
||||
|
||||
func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
if annotation.hasValue { try container.encode(annotation, forKey: .annotation) }
|
||||
try container.encode(articleId, forKey: .articleId)
|
||||
if highlightPositionAnchorIndex.hasValue { try container.encode(highlightPositionAnchorIndex, forKey: .highlightPositionAnchorIndex) }
|
||||
if highlightPositionPercent.hasValue { try container.encode(highlightPositionPercent, forKey: .highlightPositionPercent) }
|
||||
if html.hasValue { try container.encode(html, forKey: .html) }
|
||||
try container.encode(id, forKey: .id)
|
||||
try container.encode(patch, forKey: .patch)
|
||||
if patch.hasValue { try container.encode(patch, forKey: .patch) }
|
||||
if prefix.hasValue { try container.encode(prefix, forKey: .prefix) }
|
||||
try container.encode(quote, forKey: .quote)
|
||||
if quote.hasValue { try container.encode(quote, forKey: .quote) }
|
||||
if sharedAt.hasValue { try container.encode(sharedAt, forKey: .sharedAt) }
|
||||
try container.encode(shortId, forKey: .shortId)
|
||||
if suffix.hasValue { try container.encode(suffix, forKey: .suffix) }
|
||||
if type.hasValue { try container.encode(type, forKey: .type) }
|
||||
}
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
|
|
@ -31846,6 +31970,7 @@ extension InputObjects {
|
|||
case articleId
|
||||
case highlightPositionAnchorIndex
|
||||
case highlightPositionPercent
|
||||
case html
|
||||
case id
|
||||
case patch
|
||||
case prefix
|
||||
|
|
@ -31853,6 +31978,7 @@ extension InputObjects {
|
|||
case sharedAt
|
||||
case shortId
|
||||
case suffix
|
||||
case type
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -32044,6 +32170,8 @@ extension InputObjects {
|
|||
|
||||
var highlightPositionPercent: OptionalArgument<Double> = .absent()
|
||||
|
||||
var html: OptionalArgument<String> = .absent()
|
||||
|
||||
var id: String
|
||||
|
||||
var overlapHighlightIdList: [String]
|
||||
|
|
@ -32064,6 +32192,7 @@ extension InputObjects {
|
|||
try container.encode(articleId, forKey: .articleId)
|
||||
if highlightPositionAnchorIndex.hasValue { try container.encode(highlightPositionAnchorIndex, forKey: .highlightPositionAnchorIndex) }
|
||||
if highlightPositionPercent.hasValue { try container.encode(highlightPositionPercent, forKey: .highlightPositionPercent) }
|
||||
if html.hasValue { try container.encode(html, forKey: .html) }
|
||||
try container.encode(id, forKey: .id)
|
||||
try container.encode(overlapHighlightIdList, forKey: .overlapHighlightIdList)
|
||||
try container.encode(patch, forKey: .patch)
|
||||
|
|
@ -32078,6 +32207,7 @@ extension InputObjects {
|
|||
case articleId
|
||||
case highlightPositionAnchorIndex
|
||||
case highlightPositionPercent
|
||||
case html
|
||||
case id
|
||||
case overlapHighlightIdList
|
||||
case patch
|
||||
|
|
@ -32371,17 +32501,21 @@ extension InputObjects {
|
|||
|
||||
var readingProgressPercent: Double
|
||||
|
||||
var readingProgressTopPercent: OptionalArgument<Double> = .absent()
|
||||
|
||||
func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(id, forKey: .id)
|
||||
try container.encode(readingProgressAnchorIndex, forKey: .readingProgressAnchorIndex)
|
||||
try container.encode(readingProgressPercent, forKey: .readingProgressPercent)
|
||||
if readingProgressTopPercent.hasValue { try container.encode(readingProgressTopPercent, forKey: .readingProgressTopPercent) }
|
||||
}
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case id
|
||||
case readingProgressAnchorIndex
|
||||
case readingProgressPercent
|
||||
case readingProgressTopPercent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -32812,18 +32946,26 @@ extension InputObjects {
|
|||
|
||||
var highlightId: String
|
||||
|
||||
var html: OptionalArgument<String> = .absent()
|
||||
|
||||
var quote: OptionalArgument<String> = .absent()
|
||||
|
||||
var sharedAt: OptionalArgument<DateTime> = .absent()
|
||||
|
||||
func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
if annotation.hasValue { try container.encode(annotation, forKey: .annotation) }
|
||||
try container.encode(highlightId, forKey: .highlightId)
|
||||
if html.hasValue { try container.encode(html, forKey: .html) }
|
||||
if quote.hasValue { try container.encode(quote, forKey: .quote) }
|
||||
if sharedAt.hasValue { try container.encode(sharedAt, forKey: .sharedAt) }
|
||||
}
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case annotation
|
||||
case highlightId
|
||||
case html
|
||||
case quote
|
||||
case sharedAt
|
||||
}
|
||||
}
|
||||
|
|
@ -32906,6 +33048,8 @@ extension InputObjects {
|
|||
|
||||
var pageId: String
|
||||
|
||||
var publishedAt: OptionalArgument<DateTime> = .absent()
|
||||
|
||||
var savedAt: OptionalArgument<DateTime> = .absent()
|
||||
|
||||
var title: OptionalArgument<String> = .absent()
|
||||
|
|
@ -32915,6 +33059,7 @@ extension InputObjects {
|
|||
if byline.hasValue { try container.encode(byline, forKey: .byline) }
|
||||
if description.hasValue { try container.encode(description, forKey: .description) }
|
||||
try container.encode(pageId, forKey: .pageId)
|
||||
if publishedAt.hasValue { try container.encode(publishedAt, forKey: .publishedAt) }
|
||||
if savedAt.hasValue { try container.encode(savedAt, forKey: .savedAt) }
|
||||
if title.hasValue { try container.encode(title, forKey: .title) }
|
||||
}
|
||||
|
|
@ -32923,6 +33068,7 @@ extension InputObjects {
|
|||
case byline
|
||||
case description
|
||||
case pageId
|
||||
case publishedAt
|
||||
case savedAt
|
||||
case title
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ extension DataService {
|
|||
) -> [String: Any]? {
|
||||
let internalHighlight = InternalHighlight(
|
||||
id: highlightID,
|
||||
type: "HIGHLIGHT",
|
||||
shortId: shortId,
|
||||
quote: quote,
|
||||
prefix: nil, suffix: nil,
|
||||
|
|
@ -61,9 +62,10 @@ extension DataService {
|
|||
articleId: articleId,
|
||||
highlightPositionAnchorIndex: OptionalArgument(highlight.positionAnchorIndex),
|
||||
highlightPositionPercent: OptionalArgument(highlight.positionPercent), id: highlight.id,
|
||||
patch: highlight.patch,
|
||||
quote: highlight.quote,
|
||||
shortId: highlight.shortId
|
||||
patch: OptionalArgument(highlight.patch),
|
||||
quote: OptionalArgument(highlight.quote),
|
||||
shortId: highlight.shortId,
|
||||
type: OptionalArgument(Enums.HighlightType.highlight)
|
||||
),
|
||||
selection: selection
|
||||
)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ extension DataService {
|
|||
) -> [String: Any]? {
|
||||
let internalHighlight = InternalHighlight(
|
||||
id: highlightID,
|
||||
type: "HIGHLIGHT",
|
||||
shortId: shortId,
|
||||
quote: quote,
|
||||
prefix: nil,
|
||||
|
|
|
|||
|
|
@ -14,11 +14,12 @@ let highlightLabelSelection = Selection.Label {
|
|||
let highlightSelection = Selection.Highlight {
|
||||
InternalHighlight(
|
||||
id: try $0.id(),
|
||||
type: (try $0.type()).rawValue,
|
||||
shortId: try $0.shortId(),
|
||||
quote: try $0.quote(),
|
||||
quote: try $0.quote() ?? "",
|
||||
prefix: try $0.prefix(),
|
||||
suffix: try $0.suffix(),
|
||||
patch: try $0.patch(),
|
||||
patch: try $0.patch() ?? "",
|
||||
annotation: try $0.annotation(),
|
||||
createdAt: try $0.createdAt().value,
|
||||
updatedAt: try $0.updatedAt().value,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import Models
|
|||
|
||||
struct InternalHighlight: Encodable {
|
||||
let id: String
|
||||
let type: String
|
||||
let shortId: String
|
||||
let quote: String
|
||||
let prefix: String?
|
||||
|
|
@ -28,6 +29,7 @@ struct InternalHighlight: Encodable {
|
|||
|
||||
highlight.markedForDeletion = false
|
||||
highlight.id = id
|
||||
highlight.type = type
|
||||
highlight.shortId = shortId
|
||||
highlight.quote = quote
|
||||
highlight.prefix = prefix
|
||||
|
|
@ -60,6 +62,7 @@ struct InternalHighlight: Encodable {
|
|||
static func make(from highlight: Highlight) -> InternalHighlight {
|
||||
InternalHighlight(
|
||||
id: highlight.id ?? "",
|
||||
type: highlight.type ?? "",
|
||||
shortId: highlight.shortId ?? "",
|
||||
quote: highlight.quote ?? "",
|
||||
prefix: highlight.prefix,
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue