Skip to content

Latest commit

 

History

History
119 lines (82 loc) · 4.08 KB

README_EN.md

File metadata and controls

119 lines (82 loc) · 4.08 KB

V2exAPI

Swift CocoaPods Carthage iOS macOS

中文|English

A V2ex API wrapper for iOS/macOS, built with Swift.

V2EX is a community of start-ups, designers, developers and creative people.

Features

  • SPM(Swift Package Manager) Support
  • Swift async/await Support
  • V2ex API V1 100%
  • V2ex API V2 100%
  • Zero dependency

API Support

V1

接口 路径 进度
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

V2

接口 路径 进度
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

Installation

Swift Package Manager

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:

CocoaPods

pod 'V2exAPI', '~> 1.0'

Useage

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 Reference

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

Examples

  • V2exOS - A SwiftUI V2ex client for macOS

screenshot screenshot

License

V2exAPI Kingfisher is released under the MIT license. See LICENSE for details.