2018-01-20 07:31:17 +01:00
|
|
|
//
|
|
|
|
// Author+Scriptability.swift
|
2018-08-29 07:18:24 +02:00
|
|
|
// NetNewsWire
|
2018-01-20 07:31:17 +01:00
|
|
|
//
|
|
|
|
// Created by Olof Hellman on 1/19/18.
|
|
|
|
// Copyright © 2018 Olof Hellman. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
import Account
|
2018-07-24 03:29:08 +02:00
|
|
|
import Articles
|
2018-01-20 07:31:17 +01:00
|
|
|
|
|
|
|
@objc(ScriptableAuthor)
|
2024-04-17 05:53:33 +02:00
|
|
|
@MainActor final class ScriptableAuthor: NSObject, UniqueIDScriptingObject {
|
2018-01-20 07:31:17 +01:00
|
|
|
|
|
|
|
let author:Author
|
|
|
|
let container:ScriptingObjectContainer
|
|
|
|
|
|
|
|
init (_ author:Author, container:ScriptingObjectContainer) {
|
|
|
|
self.author = author
|
|
|
|
self.container = container
|
|
|
|
}
|
|
|
|
|
|
|
|
@objc(objectSpecifier)
|
|
|
|
override var objectSpecifier: NSScriptObjectSpecifier? {
|
|
|
|
let scriptObjectSpecifier = self.container.makeFormUniqueIDScriptObjectSpecifier(forObject:self)
|
|
|
|
return (scriptObjectSpecifier)
|
|
|
|
}
|
|
|
|
|
2019-07-10 09:02:20 +02:00
|
|
|
@objc(scriptingSpecifierDescriptor)
|
|
|
|
func scriptingSpecifierDescriptor() -> NSScriptObjectSpecifier {
|
|
|
|
return (self.objectSpecifier ?? NSScriptObjectSpecifier() )
|
|
|
|
}
|
|
|
|
|
2018-01-20 07:31:17 +01:00
|
|
|
// MARK: --- ScriptingObject protocol ---
|
|
|
|
|
|
|
|
var scriptingKey: String {
|
|
|
|
return "authors"
|
|
|
|
}
|
|
|
|
|
2024-04-17 04:37:53 +02:00
|
|
|
// MARK: --- UniqueIDScriptingObject protocol ---
|
2018-01-20 07:31:17 +01:00
|
|
|
|
2024-04-17 04:37:53 +02:00
|
|
|
@objc(uniqueID)
|
|
|
|
var scriptingUniqueID:Any {
|
2018-01-20 07:31:17 +01:00
|
|
|
return author.authorID
|
|
|
|
}
|
|
|
|
|
|
|
|
// MARK: --- Scriptable properties ---
|
|
|
|
|
|
|
|
@objc(url)
|
|
|
|
var url:String {
|
|
|
|
return self.author.url ?? ""
|
|
|
|
}
|
|
|
|
|
|
|
|
@objc(name)
|
|
|
|
var name:String {
|
|
|
|
return self.author.name ?? ""
|
|
|
|
}
|
|
|
|
|
|
|
|
@objc(avatarURL)
|
|
|
|
var avatarURL:String {
|
|
|
|
return self.author.avatarURL ?? ""
|
|
|
|
}
|
|
|
|
|
|
|
|
@objc(emailAddress)
|
|
|
|
var emailAddress:String {
|
|
|
|
return self.author.emailAddress ?? ""
|
|
|
|
}
|
|
|
|
}
|