- Notifications
You must be signed in to change notification settings - Fork5
V2ex API 的 Swift 封装,支持 iOS/macOS (A V2ex API wrapper for iOS/macOS, built with Swift)
License
NotificationsYou must be signed in to change notification settings
isaced/V2exAPI
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
中文|English
一个V2ex API 的 Swift 封装,支持 iOS/macOS,支持 SPM 引入和 async/await 方式调用。
- SPM(Swift Package Manager) 支持
- Swift async/await 异步 API
- V2ex API V1 支持度 100%
- V2ex API V2 支持度 100%
- Zero dependency 零三方依赖
接口 | 路径 | 进度 |
---|---|---|
最热主题 | /api/topics/hot.json | ☑ |
最新主题 | /api/topics/latest.json | ☑ |
节点列表 | /api/nodes/list.json | ☑ |
节点信息 | /api/nodes/show.json | ☑ |
用户主页 | /api/members/show.json | ☑ |
回复列表 | /api/replies/show.json | ☑ |
接口 | 路径 | 进度 |
---|---|---|
获取最新的提醒 | notifications | ☑ |
删除指定的提醒 | notifications/:notification_id | ☑ |
获取自己的 Profile | member | ☑ |
查看当前使用的令牌 | token | ☑ |
获取指定节点 | nodes/:node_name | ☑ |
获取指定节点下的主题 | nodes/:node_name/topics | ☑ |
获取指定主题 | topics/:topic_id | ☑ |
获取指定主题下的回复 | topics/:topic_id/replies | ☑ |
通过Swift Package Manager 安装 V2exAPI 到你的项目,在Package.swift
中添加:
.package(name:"V2exAPI", url:"git@github.com:isaced/V2exAPI.git",.upToNextMinor(from:"1.0.0")),
在 Xcode 中:
- 菜单 File > Swift Packages > Add Package Dependency
- 搜索https://github.com/isaced/V2exAPI.git
- 选择 "Up to Next Major" 版本 "1.0.0"
pod'V2exAPI','~> 1.0'
import V2exAPI// 初始化 V2eXAPI 对象letv2ex=V2exAPI(accessToken:"XXXXX-XXXX-XXXX-XXXX-XXXXXXXXX")// 获取节点列表letnodes=tryawait v2ex.nodesList()// 获取最新主题letlatest=tryawait v2ex.latestTopics()// 获取指定节点下的主题列表lettopics=tryawait v2ex.topics(nodeName:"swift", page:1)// 获取指定主题下的回复letreplies=tryawait v2ex.replies(topicId:870607, page:1)
API Rate Limit
默认情况下,每个 IP 每小时可以发起的 API 请求数被限制在 120 次。你可以在 API 返回结果的 HTTP 头部找到 Rate Limit 信息:
X-Rate-Limit-Limit: 120X-Rate-Limit-Reset: 1409479200X-Rate-Limit-Remaining: 116
对于能够被 CDN 缓存的 API 请求,只有第一次请求时,才会消耗 Rate Limit 配额。
Personal Access Token 申请参考:https://v2ex.com/help/personal-access-token
- V2exOS - 一个用 SwiftUI 编写的 V2ex macOS 客户端
V2exAPI 在 MIT 许可下发布的,有关详细信息,请参阅LICENSE
About
V2ex API 的 Swift 封装,支持 iOS/macOS (A V2ex API wrapper for iOS/macOS, built with Swift)
Topics
Resources
License
Stars
Watchers
Forks
Packages0
No packages published