-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathWebContentService.swift
More file actions
33 lines (26 loc) · 942 Bytes
/
WebContentService.swift
File metadata and controls
33 lines (26 loc) · 942 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//
// WebContentService.swift
// Sakai
//
// Created by Zachary Joseph Shyi-An Burk on 8/28/20.
//
import Foundation
public class WebContentService {
public func getSiteWebContent(id: String, completion: @escaping NetworkServiceResponse<[SakaiWebContent]>) {
SakaiAPIClient.shared.session.prepAuthedRoute { (sessionResult) in
if let authError = sessionResult.error {
completion(.failure(authError))
return
}
sakaiProvider.request(.webContent(id)) { result in
let result = ResponseHelper.handle([SakaiWebContent].self, result: result, atKeyPath: "webcontent_collection")
guard let webContent: [SakaiWebContent] = result.value else {
completion(result)
return
}
completion(.success(webContent))
return
}
}
}
}