Advertisement
McFamous

Untitled

Jul 24th, 2023
1,125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.87 KB | None | 0 0
  1. import Foundation
  2. import Alamofire
  3. import NeedleFoundation
  4.  
  5. class AuthHttpService: Component<EmptyDependency>, AuthHttpServiceProtocol {
  6.     func getDeviceId() async -> Result<Array<DeviceId>, NetworkError> {
  7.         return await AF.requestPayload(
  8.             path: "/device",
  9.             method: .get,
  10.             headers: [.authorization("Basic 647863724389778:n'?+%)h\"vBd?UH%A?*TSuqe`H@pKXB[")]
  11.         )
  12.     }
  13.    
  14.     func getAccessToken(tokenRequest: TokenRequestProtocol) async -> Result<Array<Token>, NetworkError> {
  15.         return await AF.requestPayload(
  16.             path: "/token/store",
  17.             method: .post,
  18.             parameters: ["password": "123123Q", "deviceId": "8fdfa049-2976-4c66-af99-eddfda4f7788", "username": "RU#71231231234"],
  19.             headers: [.authorization("Basic 647863724389778:n'?+%)h\"vBd?UH%A?*TSuqe`H@pKXB[")]
  20.         )
  21.     }
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement