Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Snippets/Snippets+Micropub.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ extension Snippets {
})
}

static public func postHtml(_ identity : Snippets.Configuration, title : String, content : String, isDraft : Bool = false, location : SnippetsLocation? = nil, completion: @escaping(Error?, String?) -> ()) -> UUHttpRequest?
static public func postHtml(_ identity : Snippets.Configuration, title : String, content : String, category : String? = nil, isDraft : Bool = false, location : SnippetsLocation? = nil, completion: @escaping(Error?, String?) -> ()) -> UUHttpRequest?
{
// Pre-flight check to see if we are even configured...
if identity.micropubToken.count == 0 {
Expand All @@ -113,6 +113,10 @@ extension Snippets {
properties["post-status"] = [ "published" ]
}

if let category = category {
properties["category"] = [ category ]
}

if let location = location {
if location.name.count > 0 {
properties["checkin"] = [
Expand Down
4 changes: 2 additions & 2 deletions Snippets/Snippets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ public class Snippets : NSObject {
}
}

@objc public func postHtml(title : String, content : String, isDraft : Bool = false, completion: @escaping(Error?, String?) -> ()) -> UUHttpRequest? {
@objc public func postHtml(title : String, content : String, category : String? = nil, isDraft : Bool = false, completion: @escaping(Error?, String?) -> ()) -> UUHttpRequest? {
if Snippets.Configuration.publishing.type == .micropub {
return Snippets.Micropub.postHtml(Snippets.Configuration.publishing, title: title, content: content, completion: completion)
return Snippets.Micropub.postHtml(Snippets.Configuration.publishing, title: title, content: content, category: category, completion: completion)
}
else {
let request = Snippets.XMLRPC.Request.publishPostRequest(identity: Snippets.Configuration.publishing, existingPost: false)
Expand Down