     open var reason: String?
     open var url: String?
     open var threadUrl: String?
-    
-    enum CodingKeys: String,CodingKey {
+
+    enum CodingKeys: String, CodingKey {
         case id
         case subscribed
         case ignored

     - parameter completion: Callback for the outcome of the fetch.
     */
    @discardableResult
    func listRepositoryNotifications(_ session: RequestKitURLSession = URLSession.shared,owner: String,repository: String, all: Bool = false, participating: Bool = false, since: String? = nil,before: String? = nil, page: String = "1", perPage: String = "100", completion: @escaping (_ response: Response<[NotificationThread]>) -> Void) -> URLSessionDataTaskProtocol? {
        let router = NotificationRouter.listRepositoryNotifications(configuration,owner,repository,all,participating,since,before,perPage,page)
        return router.load(session, dateDecodingStrategy: .formatted(Time.rfc3339DateFormatter), expectedResultType: [NotificationThread].self) { notifications, error in
            if let error = error {
                completion(Response.failure(error))

     - parameter completion: Callback for the outcome of the fetch.
     */
    @discardableResult
    func markRepositoryNotificationsRead(_ session: RequestKitURLSession = URLSession.shared, owner: String, repository: String, lastReadAt: String? = nil, completion: @escaping (_ response: Error?) -> Void) -> URLSessionDataTaskProtocol? {
        let router = NotificationRouter.markRepositoryNotificationsRead(configuration, owner, repository, lastReadAt)
        return router.load(session, completion: completion)
    }
}

// MARK: - Router

enum NotificationRouter: Router {
    case readNotifications(Configuration, Bool, Bool, String, String)
    case markNotificationsRead(Configuration, String, Bool)
    case getNotificationThread(Configuration, String)
    case markNotificationThreadAsRead(Configuration, String)
    case getThreadSubscription(Configuration, String)
    case setThreadSubscription(Configuration, String, Bool)
    case deleteThreadSubscription(Configuration, String)
    case listRepositoryNotifications(Configuration, String, String, Bool, Bool, String?, String?, String, String)
    case markRepositoryNotificationsRead(Configuration, String, String, String?)

    var configuration: Configuration {
        switch self {
        case .readNotifications(let config, _, _, _, _): return config
        case .markNotificationsRead(let config, _, _): return config
        case .getNotificationThread(let config, _), .markNotificationThreadAsRead(let config, _): return config
        case .getThreadSubscription(let config, _): return config
        case .setThreadSubscription(let config, _, _): return config
        case .deleteThreadSubscription(let config, _): return config
        case .listRepositoryNotifications(let config, _, _, _, _, _, _, _, _): return config
        case .markRepositoryNotificationsRead(let config, _, _, _): return config
        }
    }

    var method: HTTPMethod {
        switch self {
        case .readNotifications,
             .getNotificationThread,
             .getThreadSubscription,
             .listRepositoryNotifications:
            return .GET
        case .markNotificationsRead,
             .setThreadSubscription,
             .markRepositoryNotificationsRead:
            return .PUT
        case .markNotificationThreadAsRead:
            return .POST
        case .deleteThreadSubscription:
            return .DELETE
        }
    }

    var encoding: HTTPEncoding {
        return .url
    }

    var path: String {
        switch self {
        case .readNotifications,
             .markNotificationsRead:
            return "notifications"
        case .getNotificationThread(_, let threadID):
            return "notifications/threads/\(threadID)"
        case .markNotificationThreadAsRead:
            return "notifications/threads/"
        case .getThreadSubscription(_, let threadId),
             .setThreadSubscription(_, let threadId, _),
             .deleteThreadSubscription(_, let threadId):
            return "notifications/threads/\(threadId)/subscription"
        case .listRepositoryNotifications(_, let owner, let repo, _, _, _, _, _, _),
             .markRepositoryNotificationsRead(_, let owner, let repo, _):
            return "repos/\(owner)/\(repo)/notifications"
        }
    }

    var params: [String: Any] {
        switch self {
        case .readNotifications(_, let all, let participating, let page, let perPage):
            return ["all": "\(all)", "participating": "\(participating)", "page": page, "per_page": perPage]
        case .markNotificationsRead(_, let lastReadAt, let read):
            return ["last_read_at": lastReadAt, "read": "\(read)"]
        case .getNotificationThread:
            return [:]
        case .markNotificationThreadAsRead(_, let threadID):
            return ["thread_id": threadID]
        case .getThreadSubscription:
            return [:]
        case .setThreadSubscription:
            return [:]
        case .deleteThreadSubscription:
            return [:]
        case .listRepositoryNotifications(_, _, _, let all, let participating, let since, let before, let perPage, let page):
            var params: [String: String] = [
                "all": all.description,
                "participating": participating.description,
                "perPage": perPage,
                "page": page
            ]
            if let since = since {
                params["since"] = since
            }
            if let before = before {
                params["before"] = before
            }
            return params
        case .markRepositoryNotificationsRead(_, _, _, let lastReadAt):
            var params: [String: String] = [:]
            if let lastReadAt = lastReadAt {
                params["last_read_at"] = lastReadAt
            }
            return params
        }
    }

}
