目录
安装
CocoaPods
- 将
source 'https://github.com/CocoaPods/Specs.git'
添加到您的Podfile
- 将
pod 'SafehealthPush', '~> 0.1.0'
添加到您的Podfile
您的 Podfile
应该是这样的
# Podfile
source 'https://github.com/CocoaPods/Specs.git'
target 'Example' do
pod 'SafehealthPush', '~> 0.1.0'
end
- 运行
pod install
❯ pod install
Analyzing dependencies
Downloading dependencies
Installing SafehealthPush 0.1.0
Generating Pods project
Integrating client project
Pod installation complete! There is 1 dependency from the Podfile and 2 total pods installed.
入门
import SafehealthPush
let safehealthpush = SafehealthPushClient(
identityAccessToken: "AUTHORIZATION",
safeAccount: "X_SF_ACCOUNT",
safeTenant: "X_SF_TENANT"
// Defining the base path is optional and defaults to https://api.dev-1.sf.safecdx.io/v1beta/notification-push
// basePath: "https://api.dev-1.sf.safecdx.io/v1beta/notification-push"
)
let userId = UUID().uuidString
let deviceId = UUID().uuidString
let deleteResponse = try await safehealthpush.device.delete(
userId: userId,
deviceId: deviceId
)
参考
safehealthpush.device.delete
从指定用户的设备中删除指定的设备。
🛠️ 使用
let userId = UUID().uuidString
let deviceId = UUID().uuidString
let deleteResponse = try await safehealthpush.device.delete(
userId: userId,
deviceId: deviceId
)
⚙️ 参数
字符串
userId: 用于标识与该设备关联的用户。
字符串
deviceId: 标识要删除的设备。
🌐 端点
/users/{userId}/devices/{deviceId}
DELETE
safehealthpush.device.list
获取指定用户关联的设备分页列表。
🛠️ 使用方法
let userId = UUID().uuidString
let page = 987
let limit = 987
let listResponse = try await safehealthpush.device.list(
userId: userId,
page: page,
limit: limit
)
⚙️ 参数
字符串
userId: 标识要检索设备的用户。
整数
page: 整数
limit: 🔄 返回
🌐 端点
/users/{userId}/devices
GET
safehealthpush.device.store
存储与指定用户关联的新设备。如果该用户已存在任何匹配令牌的设备,则将删除该设备。
🛠️ 使用方法
let userId = UUID().uuidString
let device = Device(
id: "id_example",
createdAt: Date(),
updatedAt: Date(),
platform: Platform.unknown,
web: Web(
operatingSystem: OperatingSystem.unknown,
browserName: BrowserName.unknown,
hostname: "hostname_example",
defaults: WebPushDefaults(
channels: WebChannels(
firebaseCloudMessaging: WebFirebaseCloudMessaging(
projectId: "projectId_example",
appId: "appId_example",
token: "token_example"
)
)
)
),
mobile: Mobile(
os: MobileOperatingSystem.appleIos,
ios: AppleIos(
bundleId: "bundleId_example",
teamId: "teamId_example",
signingCertificateType: SigningCertificate.development,
channels: AppleIosChannels(
simpleNotificationService: AppleSimpleNotificationService(
apnsVoip: ApplePushNotificationServiceVoIp(
applicationArn: "applicationArn_example",
token: "token_example"
)
),
firebaseCloudMessaging: AppleFirebaseCloudMessaging(
projectId: "projectId_example",
applicationId: "applicationId_example",
token: "token_example"
)
)
),
android: Android(
channels: AndroidChannels(
firebaseCloudMessaging: AndroidFirebaseCloudMessaging(
projectId: "projectId_example",
applicationId: "applicationId_example",
token: "token_example"
)
)
)
)
)
let storeResponse = try await safehealthpush.device.store(
userId: userId,
device: device
)
⚙️ 参数
字符串
userId: 用于识别将与设备关联的用户。
Device
设备: 🔄 返回
🌐 端点
/users/{userId}/devices
POST
safehealthpush.userDevice.create
创建UserDevice实体。
🛠️ 用法
let id = "id_example"
let createdAt = Date()
let updatedAt = Date()
let deviceId = "deviceId_example"
let appVersion = "appVersion_example"
let deviceModel = "deviceModel_example"
let deviceToken = "deviceToken_example"
let deviceType = "deviceType_example"
let idfaId = "idfaId_example"
let isLoggedIn = true
let osVersion = "osVersion_example"
let voipToken = "voipToken_example"
let userId = "userId_example"
let tenantId = "tenantId_example"
let userUUID = "userUUID_example"
let nationalHealthId = "nationalHealthId_example"
let language = "language_example"
let createResponse = try await safehealthpush.userDevice.create(
id: id,
createdAt: createdAt,
updatedAt: updatedAt,
deviceId: deviceId,
appVersion: appVersion,
deviceModel: deviceModel,
deviceToken: deviceToken,
deviceType: deviceType,
idfaId: idfaId,
isLoggedIn: isLoggedIn,
osVersion: osVersion,
voipToken: voipToken,
userId: userId,
tenantId: tenantId,
userUUID: userUUID,
nationalHealthId: nationalHealthId,
language: language
)
⚙️ 参数
字符串
id: 日期
createdAt: 日期
updatedAt: 字符串
deviceId: 字符串
appVersion: 字符串
deviceModel: 字符串
deviceToken: 字符串
deviceType: 字符串
idfaId: 布尔型
是否登录: 字符串
操作系统版本: 字符串
Voice-over-IP令牌: 字符串
用户ID: 字符串
租户ID: String
userUUID: String
nationalHealthId: String
language: 🔄 返回
🌐 端点
/device
POST
safehealthpush.userDevice.delete
通过设备令牌删除UserDevice实体。
🛠️ 使用方法
let deviceToken = "deviceToken_example"
let deleteResponse = try await safehealthpush.userDevice.delete(
deviceToken: deviceToken
)
⚙️ 参数
String
deviceToken: 创建UserDevice时传递的标识令牌。
🔄 返回结果
🌐 端点
/device
DELETE
作者
此TypeScript包由Konfig自动生成