NetworkService
protocol NetworkService : Observable, ServiceProvider
Provides network-related functionality
-
Send contact form
Declaration
Swift
func contact(payload: ContactPayload, then: @escaping NetworkCompletion<String>)Parameters
payloadContact payload
thenCompletion
-
Load location photos
Declaration
Swift
func loadPhotos(location id: Int, reload: Bool, then: @escaping NetworkCompletion<PhotosInfoJSON>)Parameters
idLocation ID
reloadForce reload
thenCompletion
-
Load logged in user photos
Declaration
Swift
func loadPhotos(page: Int, reload: Bool, then: @escaping NetworkCompletion<PhotosPageInfoJSON>)Parameters
pageIndex
reloadForce reload
thenCompletion
-
Load user photos
Declaration
Swift
func loadPhotos(profile id: Int, page: Int, reload: Bool, then: @escaping NetworkCompletion<PhotosPageInfoJSON>)Parameters
idUser ID
pageIndex
reloadForce reload
thenCompletion
-
Load location posts
Declaration
Swift
func loadPosts(location id: Int, reload: Bool, then: @escaping NetworkCompletion<PostsJSON>)Parameters
idLocation ID
reloadForce reload
thenCompletion
-
Load user posts
Declaration
Swift
func loadPosts(user id: Int, reload: Bool, then: @escaping NetworkCompletion<PostsJSON>)Parameters
idUser ID
reloadForce reload
thenCompletion
-
Load rankings
Declaration
Swift
func loadRankings(query: RankingsQuery, then: @escaping NetworkCompletion<RankingsPageInfoJSON>)Parameters
queryFilter
thenCompletion
-
Load scorecard
Declaration
Swift
func loadScorecard(list: Checklist, user id: Int, then: @escaping NetworkCompletion<ScorecardJSON>)Parameters
listChecklist
idUser ID
thenCompletion
-
Load user
Declaration
Swift
func loadUser(id: Int, then: @escaping NetworkCompletion<UserJSON>)Parameters
idUser ID
thenCompletion
-
Search
Declaration
Swift
func search(query: String, then: @escaping NetworkCompletion<SearchResultJSON>)Parameters
queryQuery
thenCompletion
-
Set places visit status
Declaration
Swift
func set(items: [Checklist.Item], visited: Bool, then: @escaping NetworkCompletion<Bool>)Parameters
itemsPlaces
visitedWhether visited
thenCompletion
-
Upload photo
Declaration
Swift
func upload(photo: Data, caption: String?, location id: Int?, then: @escaping NetworkCompletion<PhotoReply>)Parameters
photoData
captionString
idLocation ID if any
thenCompletion
-
Update photo
Declaration
Swift
func photoUpdate(payload: PhotoUpdatePayload, then: @escaping NetworkCompletion<Bool>)Parameters
payloadPhotoUpdatePayload
thenCompletion
-
Delete photo
Declaration
Swift
func delete(photo: Int, then: @escaping NetworkCompletion<Bool>)Parameters
photoInt
thenCompletion
-
Publish post
Declaration
Swift
func postPublish(payload: PostPayload, then: @escaping NetworkCompletion<PostReply>)Parameters
payloadPost payload
thenCompletion
-
Update post
Declaration
Swift
func postUpdate(payload: PostUpdatePayload, then: @escaping NetworkCompletion<Bool>)Parameters
payloadPostUpdatePayload
thenCompletion
-
Delete post
Declaration
Swift
func delete(post: Int, then: @escaping NetworkCompletion<Bool>)Parameters
oistInt
thenCompletion
-
Delete user account
Declaration
Swift
func userDeleteAccount(then: @escaping NetworkCompletion<String>)Parameters
thenCompletion
-
Send reset password link
Declaration
Swift
func userForgotPassword(email: String, then: @escaping NetworkCompletion<String>)Parameters
emailEmail
thenCompletion
-
Login user
Declaration
Swift
func userLogin(email: String, password: String, then: @escaping NetworkCompletion<UserJSON>)Parameters
emailEmail
passwordPassword
thenCompletion
-
Register new user
Declaration
Swift
func userRegister(payload: RegistrationPayload, then: @escaping NetworkCompletion<UserJSON>)Parameters
payloadRegistrationPayload
thenCompletion
-
Update user info
Declaration
Swift
func userUpdate(payload: UserUpdatePayload, then: @escaping NetworkCompletion<UserJSON>)Parameters
payloadUserUpdatePayload
thenCompletion
-
Update user token
Declaration
Swift
func userUpdate(token: String, then: @escaping NetworkCompletion<UserTokenReply>)Parameters
tokenString
thenCompletion
-
Resend verification email
Declaration
Swift
func userVerify(id: Int, then: @escaping NetworkCompletion<String>)Parameters
idUser ID
thenCompletion
-
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 } -
statusKeyExtension methodType of change generated
Declaration
Swift
var statusKey: StatusKey { get } -
notificationExtension 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
changeNetworkServiceChange
objectAttachment if any
-
observer(of:handler:)Extension methodCreate network change observer
Declaration
Swift
func observer(of change: NetworkServiceChange, handler: @escaping NotificationHandler) -> ObserverParameters
ofNetworkServiceChange
handlerHandler
Return Value
Observer
View on GitHub
NetworkService Protocol Reference