-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from IanKeen/Models-cleanup
Models cleanup
- Loading branch information
Showing
80 changed files
with
621 additions
and
314 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// | ||
// HelloBot.swift | ||
// Chameleon | ||
// Chameleon | ||
// | ||
// Created by Ian Keen on 4/06/2016. | ||
// | ||
|
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// | ||
// SlackMessageBuilder+Operators.swift | ||
// Chameleon | ||
// Chameleon | ||
// | ||
// Created by Ian Keen on 6/06/2016. | ||
// | ||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// | ||
// SlackMessageBuilder.swift | ||
// Chameleon | ||
// Chameleon | ||
// | ||
// Created by Ian Keen on 6/06/2016. | ||
// | ||
|
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
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// | ||
// SlackBot+Convenience.swift | ||
// Chameleon | ||
// Chameleon | ||
// | ||
// Created by Ian Keen on 7/06/2016. | ||
// | ||
|
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
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// | ||
// Int+Extensions.swift | ||
// Chameleon | ||
// Chameleon | ||
// | ||
// Created by Ian Keen on 8/06/2016. | ||
// | ||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// | ||
// JSON+KeyPath.swift | ||
// Chameleon | ||
// Chameleon | ||
// | ||
// Created by Ian Keen on 8/06/2016. | ||
// | ||
|
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// | ||
// Sequence+Extensions.swift | ||
// Chameleon | ||
// Chameleon | ||
// | ||
// Created by Ian Keen on 10/06/2016. | ||
// | ||
|
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,17 @@ | ||
// | ||
// BotUser+Builder.swift | ||
// Chameleon | ||
// | ||
// Created by Ian Keen on 15/06/2016. | ||
// | ||
// | ||
|
||
extension BotUser: SlackModelType { | ||
public static func make(builder: SlackModelBuilder) throws -> BotUser { | ||
return try tryMake(BotUser( | ||
id: try builder.property("id"), | ||
name: try builder.property("name") | ||
) | ||
) | ||
} | ||
} |
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,31 @@ | ||
// | ||
// Channel+Builder.swift | ||
// Chameleon | ||
// | ||
// Created by Ian Keen on 15/06/2016. | ||
// | ||
// | ||
|
||
extension Channel: SlackModelType { | ||
public static func make(builder: SlackModelBuilder) throws -> Channel { | ||
return try tryMake(Channel( | ||
id: try builder.property("id"), | ||
name: try builder.property("name"), | ||
created: try builder.property("created"), | ||
creator: try builder.slackModel("creator"), | ||
is_channel: builder.property("is_channel"), | ||
is_general: builder.property("is_general"), | ||
is_archived: builder.property("is_archived"), | ||
is_member: builder.property("is_member"), | ||
members: try builder.optionalSlackModels("members"), | ||
topic: try builder.optionalProperty("topic"), | ||
purpose: try builder.optionalProperty("purpose"), | ||
last_read: builder.optionalProperty("last_read"), | ||
latest: try builder.optionalProperty("latest"), | ||
unread_count: builder.optionalProperty("unread_count"), | ||
unread_count_display: builder.optionalProperty("unread_count_display") | ||
) | ||
) | ||
|
||
} | ||
} |
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,29 @@ | ||
// | ||
// Group+Builder.swift | ||
// Chameleon | ||
// | ||
// Created by Ian Keen on 15/06/2016. | ||
// | ||
// | ||
|
||
extension Group: SlackModelType { | ||
public static func make(builder: SlackModelBuilder) throws -> Group { | ||
return try tryMake(Group( | ||
id: try builder.property("id"), | ||
name: try builder.property("name"), | ||
created: try builder.property("created"), | ||
creator: try builder.slackModel("creator"), | ||
is_group: builder.property("is_group"), | ||
is_archived: builder.property("is_archived"), | ||
is_mpim: builder.property("is_mpim"), | ||
members: try builder.optionalSlackModels("members"), | ||
topic: try builder.optionalProperty("topic"), | ||
purpose: try builder.optionalProperty("purpose"), | ||
last_read: builder.optionalProperty("last_read"), | ||
latest: try builder.optionalProperty("latest"), | ||
unread_count: builder.optionalProperty("unread_count"), | ||
unread_count_display: builder.optionalProperty("unread_count_display") | ||
) | ||
) | ||
} | ||
} |
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 @@ | ||
// | ||
// IM+Builder.swift | ||
// Chameleon | ||
// | ||
// Created by Ian Keen on 15/06/2016. | ||
// | ||
// | ||
|
||
extension IM: SlackModelType { | ||
public static func make(builder: SlackModelBuilder) throws -> IM { | ||
return try tryMake(IM( | ||
id: try builder.property("id"), | ||
is_im: builder.property("is_im"), | ||
is_open: builder.property("is_open"), | ||
has_pins: builder.property("has_pins"), | ||
user: try builder.slackModel("user"), | ||
created: builder.property("created"), | ||
is_user_deleted: builder.property("is_user_deleted"), | ||
last_read: builder.property("last_read"), | ||
latest: try builder.optionalProperty("latest") | ||
) | ||
) | ||
} | ||
} |
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,43 @@ | ||
// | ||
// Message+Builder.swift | ||
// Chameleon | ||
// | ||
// Created by Ian Keen on 15/06/2016. | ||
// | ||
// | ||
|
||
import Common | ||
|
||
extension Message: SlackModelType { | ||
public static func make(builder: SlackModelBuilder) throws -> Message { | ||
return try tryMake(Message( | ||
subtype: builder.optionalProperty("subtype"), | ||
timestamp: try builder.property("ts"), | ||
text: builder.optionalProperty("text"), | ||
channel: FailableBox(try builder.optionalSlackModel("channel")), | ||
user: try builder.optionalSlackModel("user"), | ||
inviter: try builder.optionalSlackModel("inviter"), | ||
bot: try builder.optionalSlackModel("bot_id"), | ||
username: builder.optionalProperty("username"), | ||
icons: builder.optionalProperty("icons"), | ||
hidden: builder.property("hidden"), | ||
deleted_ts: builder.optionalProperty("deleted_ts"), | ||
topic: builder.optionalProperty("topic"), | ||
purpose: builder.optionalProperty("purpose"), | ||
old_name: builder.optionalProperty("old_name"), | ||
name: builder.optionalProperty("name"), | ||
members: try builder.optionalSlackModels("members"), | ||
file: builder.optionalProperty("file"), | ||
upload: builder.property("upload"), | ||
comment: builder.optionalProperty("comment"), | ||
item_type: builder.optionalProperty("item_type"), | ||
item: builder.optionalProperty("item"), | ||
is_starred: builder.property("is_starred"), | ||
pinned_to: FailableBox(try builder.optionalSlackModels("pinned_to")), | ||
reactions: try builder.optionalCollection("reactions"), | ||
edited: try builder.optionalProperty("edited"), | ||
attachments: try builder.optionalCollection("attachments") | ||
) | ||
) | ||
} | ||
} |
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,39 @@ | ||
// | ||
// Message_Attachment+Builder.swift | ||
// Chameleon | ||
// | ||
// Created by Ian Keen on 15/06/2016. | ||
// | ||
// | ||
|
||
extension Message.Attachment: SlackModelType { | ||
public static func make(builder: SlackModelBuilder) throws -> Message.Attachment { | ||
return try tryMake(Message.Attachment( | ||
fallback: try builder.property("fallback"), | ||
color: builder.optionalProperty("color"), | ||
pretext: builder.optionalProperty("pretext"), | ||
author_name: builder.optionalProperty("author_name"), | ||
author_link: builder.optionalProperty("author_link"), | ||
author_icon: builder.optionalProperty("author_icon"), | ||
title: builder.optionalProperty("title"), | ||
title_link: builder.optionalProperty("title_link"), | ||
text: try builder.property("text"), | ||
fields: try builder.optionalCollection("fields"), | ||
from_url: builder.optionalProperty("from_url"), | ||
image_url: builder.optionalProperty("image_url"), | ||
thumb_url: builder.optionalProperty("thumb_url") | ||
) | ||
) | ||
} | ||
} | ||
|
||
extension Message.Attachment.Field: SlackModelType { | ||
public static func make(builder: SlackModelBuilder) throws -> Message.Attachment.Field { | ||
return try tryMake(Message.Attachment.Field( | ||
title: try builder.property("title"), | ||
value: try builder.property("value"), | ||
short: builder.property("short") | ||
) | ||
) | ||
} | ||
} |
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 @@ | ||
// | ||
// Message_Edit+Builder.swift | ||
// Chameleon | ||
// | ||
// Created by Ian Keen on 15/06/2016. | ||
// | ||
// | ||
|
||
extension Message.Edit: SlackModelType { | ||
public static func make(builder: SlackModelBuilder) throws -> Message.Edit { | ||
return try tryMake(Message.Edit( | ||
user: try builder.slackModel("user"), | ||
timestamp: try builder.property("ts") | ||
) | ||
) | ||
} | ||
} |
Oops, something went wrong.