mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-11-13 15:35:13 +00:00
docs: Add Swift SDK README with comprehensive API documentation and implement authentication provider with JWT support
- Add README.md with installation instructions, architecture overview, and API examples for all SDK modules - Add AuthProvider class with API key and JWT token support (generateJWTToken, validateJWTToken, getHeaders, clearTokenCache methods) - Add HTTPClient base class with retry logic, error handling, and timeout management - Add GraphQLAPI, PaymentAPI, RatingPlanAPI, SubscriberAPI, SystemAPI, and UsageAPI modules - Add TelecomSDK main client integrating all API
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import Foundation
|
||||
|
||||
/// API for payment management
|
||||
public class PaymentAPI {
|
||||
private let client: HTTPClient
|
||||
|
||||
public init(client: HTTPClient) {
|
||||
self.client = client
|
||||
}
|
||||
|
||||
/// Create a payment transaction
|
||||
public func createTransaction(_ request: CreatePaymentRequest) async throws -> PaymentTransaction {
|
||||
return try await client.post(path: "/v1/payments/transactions", body: request)
|
||||
}
|
||||
|
||||
/// Get a payment transaction by ID
|
||||
public func getTransaction(transactionID: String) async throws -> PaymentTransaction {
|
||||
return try await client.get(path: "/v1/payments/transactions/\(transactionID)")
|
||||
}
|
||||
|
||||
/// List payment transactions
|
||||
public func listTransactions(
|
||||
subscriberID: Int64? = nil,
|
||||
status: PaymentStatus? = nil,
|
||||
page: Int = 1,
|
||||
pageSize: Int = 50
|
||||
) async throws -> SubscriberList {
|
||||
var params: [String: String] = [
|
||||
"page": "\(page)",
|
||||
"page_size": "\(pageSize)"
|
||||
]
|
||||
|
||||
if let subscriberID = subscriberID {
|
||||
params["subscriber_id"] = "\(subscriberID)"
|
||||
}
|
||||
if let status = status {
|
||||
params["status"] = "\(status)"
|
||||
}
|
||||
|
||||
return try await client.get(path: "/v1/payments/transactions", params: params)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user