| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- //
- // LNHttpManager+Gift.swift
- // Gami
- //
- // Created by OneeChan on 2026/3/24.
- //
- import Foundation
- private let kNetPath_Gift_Resource_List = "/gift/resource/list"
- private let kNetPath_Gift_List = "/list/gift/list"
- private let kNetPath_Gift_Send = "/list/gift/send"
- class LNSendGiftParams {
- var roomId: String = ""
- var giftId: String = ""
- var userIds: [String] = []
- var quantity: Int = 0
- var seamlessRedeem: Bool = false
-
- fileprivate var toParams: [String: Any] {
- [
- "roomId": roomId,
- "giftId": giftId,
- "userIds": userIds,
- "quantity": quantity,
- "seamlessRedeem": seamlessRedeem
- ]
- }
- }
- extension LNHttpManager {
- func loadResourceList(version: String, size: Int, next: String,
- completion: @escaping (LNGiftResourceListResponse?, LNHttpError?) -> Void) {
- post(path: kNetPath_Gift_Resource_List, params: [
- "page": [
- "size": size,
- "next": next
- ],
- "version": version
- ], completion: completion)
- }
-
- func loadGiftList(roomId: String, completion: @escaping (LNGiftListResponse?, LNHttpError?) -> Void) {
- post(path: kNetPath_Gift_List, params: [
- "roomId": roomId,
- ], completion: completion)
- }
-
- func sendGift(params: LNSendGiftParams, completion: @escaping (LNSendGiftResponse?, LNHttpError?) -> Void) {
- post(path: kNetPath_Gift_Send, params: params.toParams, completion: completion)
- }
- }
|