From e1b47e4c85c83ca06bf1a147e8deb434536aef4c Mon Sep 17 00:00:00 2001 From: Monique Solanki Date: Thu, 29 Nov 2018 23:31:18 -0800 Subject: [PATCH] Added notifications to API document and tested. --- elpha-ios/MastodonAPI.swift | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/elpha-ios/MastodonAPI.swift b/elpha-ios/MastodonAPI.swift index 1e4fe1f..b3b1ba3 100644 --- a/elpha-ios/MastodonAPI.swift +++ b/elpha-ios/MastodonAPI.swift @@ -404,6 +404,23 @@ class MastodonAPI { } } + static func notifications( + limit: Int?, + pagination: PaginationItem?, + completion: @escaping (JSONObjectArray?, [PaginationItem]?, Error?) -> Void + ) { + let parameters: Parameters = ["limit": limit ?? 20] + + self.request(path: "api/v1/notifications", method: .get, parameters: parameters, pagination: pagination) { data, pagination, error in + guard error == nil else { + completion(nil, nil, error) + return + } + + completion(data as? JSONObjectArray, pagination, nil) + } + } + static func registerApp(serverURL: URL, completion: @escaping (JSONObject?, Error?) -> Void) { let requestURL = serverURL.appendingPathComponent("api/v1/apps") let parameters: Parameters = [