// // AuthFuncUserVideoView.swift // WOKA // // Created by Bilal on 16/08/2024. // import Foundation import Alamofire extension AuthFunc{ func userVideoView(postID : Int, postType : Int, duration : Int, catID : Int, onCompletion : @escaping (Bool) -> Void){ let headers : HTTPHeaders = ["access-token" : AuthFunc.shareInstance.getAccessToken(), "device-id": AuthFunc.shareInstance.getDeviceUUID()] let params : Parameters = ["post_id" : postID, "post_type" : postType, "total_watched_duration" : duration, "device_type" : "2", //1- android, 2 - iOS "category_id": catID] NetworkManager.shareInstance.apiRequest(url: APIEndPoints.Analytics.user_video_view, method: .post,parameters: params,headers: headers) { (result : Result) in switch result{ case .success(let data): switch data.success{ case 0: /* Error */ Utilities.dismissProgressHUD() onCompletion(false) case 1: Utilities.dismissProgressHUD() print("Updated PostType:- \(postType)") onCompletion(true) default: onCompletion(false) } case .failure(let error): Utilities.dismissProgressHUD() print(error) onCompletion(false) } } } }