xtool.git
Publicgit clone https://git.maproj.org/xtool.gitxtool.git / Sources / XKit / GrandSlam / Requests / Concrete / GrandSlamValidateRequest.swift
GrandSlamValidateRequest.swift53 lines · 1.3 KiBRaw
| 1 | // |
| 2 | // GrandSlamValidateRequest.swift |
| 3 | // XKit |
| 4 | // |
| 5 | // Created by Kabir Oberai on 20/11/19. |
| 6 | // Copyright © 2019 Kabir Oberai. All rights reserved. |
| 7 | // |
| 8 | |
| 9 | import Foundation |
| 10 | |
| 11 | struct GrandSlamValidateRequest: GrandSlamTwoFactorRequest { |
| 12 | struct Decoder: GrandSlamDataDecoder { |
| 13 | static func decode(data: Data) throws {} |
| 14 | } |
| 15 | |
| 16 | static let endpoint: GrandSlamEndpoint = .lookup(\.validateCode) |
| 17 | |
| 18 | let loginData: GrandSlamLoginData |
| 19 | let verificationCode: String |
| 20 | |
| 21 | var extraHeaders: [String: String] { |
| 22 | ["security-code": verificationCode] |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | struct GrandSlamValidateSMSRequest: GrandSlamTwoFactorRequest { |
| 27 | struct Decoder: GrandSlamDataDecoder { |
| 28 | static func decode(data: Data) throws {} |
| 29 | } |
| 30 | |
| 31 | static let endpoint: GrandSlamEndpoint = .url(URL( |
| 32 | string: "https://gsa.apple.com/auth/verify/phone/securitycode" |
| 33 | )!) |
| 34 | |
| 35 | let loginData: GrandSlamLoginData |
| 36 | let phoneNumberID: Int |
| 37 | let verificationCode: String |
| 38 | |
| 39 | var extraHeaders: [String: String] { |
| 40 | [ |
| 41 | "Content-Type": "application/json", |
| 42 | "Accept": "application/json", |
| 43 | ] |
| 44 | } |
| 45 | |
| 46 | func content(anisetteData: AnisetteData) -> GrandSlamRequestContent { |
| 47 | .post([ |
| 48 | "securityCode": ["code": verificationCode], |
| 49 | "phoneNumber": ["id": phoneNumberID], |
| 50 | "mode": "sms", |
| 51 | ], type: .json) |
| 52 | } |
| 53 | } |