-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…l as initial models for a Micropub Config request
- Loading branch information
Edward Hinkle
committed
Jun 13, 2019
1 parent
c4ea08f
commit 408cbf1
Showing
8 changed files
with
141 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// MicropubConfig.swift | ||
// | ||
// | ||
// Created by ehinkle-ad on 6/13/19. | ||
// | ||
|
||
import Foundation | ||
|
||
// This is the value returned from the Micropub configuration query endpoint. | ||
// See https://micropub.net/draft/#configuration for more information | ||
public struct MicropubConfig: Codable { | ||
let mediaEndpoint: URL? | ||
let syndicateTo: [SyndicationTarget]? | ||
let postTypes: [PostType]? // This supports the Supported Vocabulary extension. See https://github.com/indieweb/micropub-extensions/issues/1 | ||
let q: [MicropubQueryType]? // This supports the Supported Queries extension. See https://github.com/indieweb/micropub-extensions/issues/7 | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case mediaEndpoint = "media_endpoint" | ||
case syndicateTo = "syndicate_to" | ||
case postTypes = "post_types" | ||
case q | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// | ||
// MicropubError.swift | ||
// | ||
// | ||
// Created by ehinkle-ad on 6/13/19. | ||
// | ||
|
||
import Foundation | ||
enum MicropubError: Error { | ||
case generalError(String) | ||
} |
17 changes: 17 additions & 0 deletions
17
Sources/IndieWebKit/Micropub/models/MicropubQueryType.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// MicropubQueryType.swift | ||
// | ||
// | ||
// Created by ehinkle-ad on 6/13/19. | ||
// | ||
|
||
import Foundation | ||
|
||
// This defines the types of Micropub queries that this framework knows about.. | ||
// For more information, see: https://indieweb.org/Micropub-extensions | ||
public enum MicropubQueryType: String { | ||
case source | ||
case syndicateTo = "syndicate-to" | ||
case category | ||
case contact | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// PostType.swift | ||
// | ||
// | ||
// Created by ehinkle-ad on 6/13/19. | ||
// | ||
|
||
import Foundation | ||
|
||
// The enum value becomes the "type" of supported post type, and the associated String is the name used by the server | ||
public enum PostType: String { | ||
case note(String) | ||
case article(String) | ||
case photo(String) | ||
case video(String) | ||
case reply(String) | ||
case like(String) | ||
case repost(String) | ||
case rsvp(String) | ||
case bookmark(String) | ||
} |
12 changes: 12 additions & 0 deletions
12
Sources/IndieWebKit/Micropub/models/SupportedPostType.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// | ||
// SupportedPostType.swift | ||
// | ||
// | ||
// Created by ehinkle-ad on 6/13/19. | ||
// | ||
|
||
import Foundation | ||
public struct SupportedPostType { | ||
let type: PostType | ||
let name: String | ||
} |
14 changes: 14 additions & 0 deletions
14
Sources/IndieWebKit/Micropub/models/SyndicationTarget.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// SyndicationTarget.swift | ||
// | ||
// | ||
// Created by ehinkle-ad on 6/13/19. | ||
// | ||
|
||
import Foundation | ||
public struct SyndicationTarget { | ||
let uid: String | ||
let name: String | ||
let service: SyndicationTargetCard | ||
let user: SyndicationTargetCard | ||
} |
13 changes: 13 additions & 0 deletions
13
Sources/IndieWebKit/Micropub/models/SyndicationTargetCard.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// SyndicationTargetCard.swift | ||
// | ||
// | ||
// Created by ehinkle-ad on 6/13/19. | ||
// | ||
|
||
import Foundation | ||
public struct SyndicationTargetCard { | ||
let name: String | ||
let url: URL? | ||
let photo: URL? | ||
} |