NetworkService
protocol NetworkService : Observable, ServiceProvider
Provides network-related functionality
-
Send contact form
Declaration
Swift
func contact(payload: ContactPayload, then: @escaping NetworkCompletion<String>)
Parameters
payload
Contact payload
then
Completion
-
Load location photos
Declaration
Swift
func loadPhotos(location id: Int, reload: Bool, then: @escaping NetworkCompletion<PhotosInfoJSON>)
Parameters
id
Location ID
reload
Force reload
then
Completion
-
Load logged in user photos
Declaration
Swift
func loadPhotos(page: Int, reload: Bool, then: @escaping NetworkCompletion<PhotosPageInfoJSON>)
Parameters
page
Index
reload
Force reload
then
Completion
-
Load user photos
Declaration
Swift
func loadPhotos(profile id: Int, page: Int, reload: Bool, then: @escaping NetworkCompletion<PhotosPageInfoJSON>)
Parameters
id
User ID
page
Index
reload
Force reload
then
Completion
-
Load location posts
Declaration
Swift
func loadPosts(location id: Int, reload: Bool, then: @escaping NetworkCompletion<PostsJSON>)
Parameters
id
Location ID
reload
Force reload
then
Completion
-
Load user posts
Declaration
Swift
func loadPosts(user id: Int, reload: Bool, then: @escaping NetworkCompletion<PostsJSON>)
Parameters
id
User ID
reload
Force reload
then
Completion
-
Load rankings
Declaration
Swift
func loadRankings(query: RankingsQuery, then: @escaping NetworkCompletion<RankingsPageInfoJSON>)
Parameters
query
Filter
then
Completion
-
Load scorecard
Declaration
Swift
func loadScorecard(list: Checklist, user id: Int, then: @escaping NetworkCompletion<ScorecardJSON>)
Parameters
list
Checklist
id
User ID
then
Completion
-
Load user
Declaration
Swift
func loadUser(id: Int, then: @escaping NetworkCompletion<UserJSON>)
Parameters
id
User ID
then
Completion
-
Search
Declaration
Swift
func search(query: String, then: @escaping NetworkCompletion<SearchResultJSON>)
Parameters
query
Query
then
Completion
-
Set places visit status
Declaration
Swift
func set(items: [Checklist.Item], visited: Bool, then: @escaping NetworkCompletion<Bool>)
Parameters
items
Places
visited
Whether visited
then
Completion
-
Upload photo
Declaration
Swift
func upload(photo: Data, caption: String?, location id: Int?, then: @escaping NetworkCompletion<PhotoReply>)
Parameters
photo
Data
caption
String
id
Location ID if any
then
Completion
-
Update photo
Declaration
Swift
func photoUpdate(payload: PhotoUpdatePayload, then: @escaping NetworkCompletion<Bool>)
Parameters
payload
PhotoUpdatePayload
then
Completion
-
Delete photo
Declaration
Swift
func delete(photo: Int, then: @escaping NetworkCompletion<Bool>)
Parameters
photo
Int
then
Completion
-
Publish post
Declaration
Swift
func postPublish(payload: PostPayload, then: @escaping NetworkCompletion<PostReply>)
Parameters
payload
Post payload
then
Completion
-
Update post
Declaration
Swift
func postUpdate(payload: PostUpdatePayload, then: @escaping NetworkCompletion<Bool>)
Parameters
payload
PostUpdatePayload
then
Completion
-
Delete post
Declaration
Swift
func delete(post: Int, then: @escaping NetworkCompletion<Bool>)
Parameters
oist
Int
then
Completion
-
Delete user account
Declaration
Swift
func userDeleteAccount(then: @escaping NetworkCompletion<String>)
Parameters
then
Completion
-
Send reset password link
Declaration
Swift
func userForgotPassword(email: String, then: @escaping NetworkCompletion<String>)
Parameters
email
Email
then
Completion
-
Login user
Declaration
Swift
func userLogin(email: String, password: String, then: @escaping NetworkCompletion<UserJSON>)
Parameters
email
Email
password
Password
then
Completion
-
Register new user
Declaration
Swift
func userRegister(payload: RegistrationPayload, then: @escaping NetworkCompletion<UserJSON>)
Parameters
payload
RegistrationPayload
then
Completion
-
Update user info
Declaration
Swift
func userUpdate(payload: UserUpdatePayload, then: @escaping NetworkCompletion<UserJSON>)
Parameters
payload
UserUpdatePayload
then
Completion
-
Update user token
Declaration
Swift
func userUpdate(token: String, then: @escaping NetworkCompletion<UserTokenReply>)
Parameters
token
String
then
Completion
-
Resend verification email
Declaration
Swift
func userVerify(id: Int, then: @escaping NetworkCompletion<String>)
Parameters
id
User ID
then
Completion
-
Refresh first page of each list’s rankings
Declaration
Swift
func refreshRankings()
-
Refresh everything
Declaration
Swift
func refreshEverything()
-
Reset all networking
Declaration
Swift
func logout()
-
Direct accessor for connection status
Declaration
Swift
var isConnected: Bool { get }
-
Direct accessor for queued requests
Declaration
Swift
var requests: [OfflineRequest] { get }
-
Direct accessor for network controller
Declaration
Swift
var mtp: MTPNetworkController { get }
-
statusKey
Extension methodType of change generated
Declaration
Swift
var statusKey: StatusKey { get }
-
notification
Extension methodName of change
Declaration
Swift
var notification: Notification.Name { get }
-
notify(change:object:)
Extension methodNotify change listeners
Declaration
Swift
func notify(change: NetworkServiceChange, object: Any? = nil)
Parameters
change
NetworkServiceChange
object
Attachment if any
-
observer(of:handler:)
Extension methodCreate network change observer
Declaration
Swift
func observer(of change: NetworkServiceChange, handler: @escaping NotificationHandler) -> Observer
Parameters
of
NetworkServiceChange
handler
Handler
Return Value
Observer