Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/devxoul/Endpoint
:rocket: Elegant API Abstraction for Swift
https://github.com/devxoul/Endpoint
Last synced: 9 days ago
JSON representation
:rocket: Elegant API Abstraction for Swift
- Host: GitHub
- URL: https://github.com/devxoul/Endpoint
- Owner: devxoul
- License: mit
- Archived: true
- Created: 2016-01-06T19:11:48.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-10-25T09:00:06.000Z (about 8 years ago)
- Last Synced: 2024-09-23T08:02:28.198Z (about 2 months ago)
- Language: Swift
- Homepage:
- Size: 20.5 KB
- Stars: 35
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-swift-cn - Endpoint - :rocket: Elegant API Abstraction for Swift. (Libs / Network)
README
Endpoint (Deprecated)
=====================⚠️ This project has been deprecated. Consider using [Moya](https://github.com/Moya/Moya) and [MoyaSugar](https://github.com/devxoul/MoyaSugar) instead.
![Swift](https://img.shields.io/badge/Swift-2.1-orange.svg)
[![Build Status](https://travis-ci.org/devxoul/Endpoint.svg)](https://travis-ci.org/devxoul/Endpoint)
[![CocoaPods](http://img.shields.io/cocoapods/v/Endpoint.svg)](https://cocoapods.org/pods/Endpoint)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)🚀 Elegant API Abstraction for Swift.
At a Glance
-----------##### API Declarations
Create an Enum with raw type `Rule` and conform protocol `Endpoint`. Each cases is the API endpoint which contains HTTP method and URL path.
```swift
enum GitHub: Rule, Endpoint {
static var baseURLString = "https://api.github.com"case Repo = "GET /repos//"
case RepoIssues = "GET /repos///issues"
case CreateIssue = "POST /repos///issues"
}
```##### Using APIs
Endpoint is built on [Alamofire](https://github.com/Alamofire/Alamofire). Calling `request()` on endpoint cases returns `Alamofire.Request` instance.
```swift
GitHub.Repo.request(["owner": "devxoul", "repo": "Then"]).responseJSON { response in
// This is an Alamofire's response block!
}
```This example is sending an HTTP request to `https://api.github.com/repos/devxoul/Then` using `GET`.
Installation
------------- **Using [CocoaPods](https://cocoapods.org)**:
```ruby
pod 'Endpoint', '~> 0.2'
```- **Using [Carthage](https://github.com/Carthage/Carthage)**:
```
github "devxoul/Endpoint" ~> 0.2
```- **Using [Swift Package Manager](https://swift.org/package-manager)**:
```swift
import PackageDescriptionlet package = Package(
name: "MyAwesomeApp",
dependencies: [
.Package(url: "https://github.com/devxoul/Endpoint", "0.2.0"),
]
)
```License
-------**Endpoint** is under MIT license. See the [LICENSE](LICENSE) file for more info.