中文|English
A V2ex API wrapper for iOS/macOS, built with Swift.
V2EX is a community of start-ups, designers, developers and creative people.
- SPM(Swift Package Manager) Support
- Swift async/await Support
- V2ex API V1 100%
- V2ex API V2 100%
- Zero dependency
接口 | 路径 | 进度 |
---|---|---|
Hottest topic | /api/topics/hot.json | ☑ |
Latest Topics | /api/topics/latest.json | ☑ |
Node list | /api/nodes/list.json | ☑ |
Node Info | /api/nodes/show.json | ☑ |
Profile info | /api/members/show.json | ☑ |
Replies | /api/replies/show.json | ☑ |
接口 | 路径 | 进度 |
---|---|---|
Get the latest notifications | notifications | ☑ |
Delete the specified notification | notifications/:notification_id | ☑ |
Get your own Profile | member | ☑ |
Get the currently used token | token | ☑ |
get the specified node | nodes/:node_name | ☑ |
Get the topics under the specified node | nodes/:node_name/topics | ☑ |
Get specific topic details | topics/:topic_id | ☑ |
Get replies under the specified topic | topics/:topic_id/replies | ☑ |
via Swift Package Manager Install to your project,Add in Package.swift
:
.package(name: "V2exAPI", url: "git@github.com:isaced/V2exAPI.git", .upToNextMinor(from: "1.0.0")),
In Xcode:
- File > Swift Packages > Add Package Dependency
- Add https://github.com/isaced/V2exAPI.git
- Select "Up to Next Major" with "1.0.0"
pod 'V2exAPI', '~> 1.0'
import V2exAPI
// Init V2eXAPI object
let v2ex = V2exAPI(accessToken: "XXXXX-XXXX-XXXX-XXXX-XXXXXXXXX")
// Get node list
let nodes = try await v2ex.nodesList()
// Get latest topics
let latest = try await v2ex.latestTopics()
// Get the topics under the specified node
let topics = try await v2ex.topics(nodeName: "swift", page: 1)
// Get replies under the specified topic
let replies = try await v2ex.replies(topicId: 870607, page: 1)
API Rate Limit
By default, each IP is limited to 120 API requests per hour. You can find the Rate Limit information in the HTTP header of the API return result:
X-Rate-Limit-Limit: 120
X-Rate-Limit-Reset: 1409479200
X-Rate-Limit-Remaining: 116
For API requests that can be cached by the CDN, the Rate Limit quota will only be consumed on the first request.
Personal Access Token:https://v2ex.com/help/personal-access-token
- V2exOS - A SwiftUI V2ex client for macOS
V2exAPI Kingfisher is released under the MIT license. See LICENSE for details.