Migrate project management, schedule management, and photographer invitation flows from placeholders, including project image OSS upload and shared business models. Co-authored-by: Cursor <cursoragent@cursor.com>
51 lines
1.5 KiB
Swift
51 lines
1.5 KiB
Swift
//
|
||
// InviteAPI.swift
|
||
// suixinkan
|
||
//
|
||
// Created by Codex on 2026/6/24.
|
||
//
|
||
|
||
import Foundation
|
||
import Observation
|
||
|
||
/// 邀请服务协议,抽象邀请信息和邀请记录接口。
|
||
@MainActor
|
||
protocol InviteServing {
|
||
/// 获取邀请二维码、邀请码和规则信息。
|
||
func inviteInfo() async throws -> InviteInfoResponse
|
||
|
||
/// 获取邀请用户列表。
|
||
func inviteUserList(page: Int, pageSize: Int) async throws -> [InviteUserItem]
|
||
}
|
||
|
||
/// 邀请 API,封装摄影师邀请相关接口。
|
||
@MainActor
|
||
@Observable
|
||
final class InviteAPI: InviteServing {
|
||
@ObservationIgnored private let client: APIClient
|
||
|
||
/// 初始化邀请 API,并注入共享网络客户端。
|
||
init(client: APIClient) {
|
||
self.client = client
|
||
}
|
||
|
||
/// 获取邀请二维码、邀请码和规则信息。
|
||
func inviteInfo() async throws -> InviteInfoResponse {
|
||
try await client.send(APIRequest(method: .get, path: "/api/yf-handset-app/photog/invite-info"))
|
||
}
|
||
|
||
/// 获取邀请用户列表。
|
||
func inviteUserList(page: Int = 1, pageSize: Int = 20) async throws -> [InviteUserItem] {
|
||
try await client.send(
|
||
APIRequest(
|
||
method: .get,
|
||
path: "/api/yf-handset-app/photog/invite/user-list",
|
||
queryItems: [
|
||
URLQueryItem(name: "page", value: "\(max(page, 1))"),
|
||
URLQueryItem(name: "page_size", value: "\(max(pageSize, 1))")
|
||
]
|
||
)
|
||
)
|
||
}
|
||
}
|