All Projects → cuzv → Redes

cuzv / Redes

Licence: MIT License
High-level network layer abstraction library written in Swift.

Programming Languages

swift
15916 projects
objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Redes

Gout
gout to become the Swiss Army Knife of the http client @^^@---> gout 是http client领域的瑞士军刀,小巧,强大,犀利。具体用法可看文档,如使用迷惑或者API用得不爽都可提issues
Stars: ✭ 749 (+4581.25%)
Mutual labels:  http-client, http-requests
pawn-requests
pawn-requests provides an API for interacting with HTTP(S) JSON APIs.
Stars: ✭ 56 (+250%)
Mutual labels:  http-client, http-requests
Easygo
基于Kotlin、OkHttp的声明式网络框架,像写HTML界面一样写网络调用代码
Stars: ✭ 40 (+150%)
Mutual labels:  http-client, http-requests
Requests
Convenient http client for java, inspired by python request module
Stars: ✭ 459 (+2768.75%)
Mutual labels:  http-client, http-requests
nativescript-http
The best way to do HTTP requests in NativeScript, a drop-in replacement for the core HTTP with important improvements and additions like proper connection pooling, form data support and certificate pinning
Stars: ✭ 32 (+100%)
Mutual labels:  http-client, http-requests
Httpu
The terminal-first http client
Stars: ✭ 619 (+3768.75%)
Mutual labels:  http-client, http-requests
EthernetWebServer SSL
Simple TLS/SSL Ethernet WebServer, HTTP Client and WebSocket Client library for for AVR, Portenta_H7, Teensy, SAM DUE, SAMD21, SAMD51, STM32F/L/H/G/WB/MP1, nRF52 and RASPBERRY_PI_PICO boards using Ethernet shields W5100, W5200, W5500, ENC28J60 or Teensy 4.1 NativeEthernet/QNEthernet. It now supports Ethernet TLS/SSL Client. The library supports …
Stars: ✭ 40 (+150%)
Mutual labels:  http-client, http-requests
robotframework-httprequestlibrary
Robot Framework's library to test REST interfaces utilizing Apache HttpClient
Stars: ✭ 20 (+25%)
Mutual labels:  http-client, http-requests
relay
Relay lets you write HTTP requests as easy to read, structured YAML and dispatch them easily using a CLI. Similar to tools like Postman
Stars: ✭ 22 (+37.5%)
Mutual labels:  http-client, http-requests
1c http
Подсистема 1С для работы с HTTP
Stars: ✭ 48 (+200%)
Mutual labels:  http-client, http-requests
Karin
An elegant promise based HTTP client for the browser and node.js [WIP]
Stars: ✭ 393 (+2356.25%)
Mutual labels:  http-client, http-requests
requester
The package provides a very thin wrapper (no external dependencies) for http.Client allowing the use of layers (middleware).
Stars: ✭ 14 (-12.5%)
Mutual labels:  http-client, http-requests
Http Shortcuts
Android app to create home screen shortcuts that trigger arbitrary HTTP requests
Stars: ✭ 329 (+1956.25%)
Mutual labels:  http-client, http-requests
Restclient
🦄 Simple HTTP and REST client for Unity based on Promises, also supports Callbacks! 🎮
Stars: ✭ 675 (+4118.75%)
Mutual labels:  http-client, http-requests
Node Request Retry
💂 Wrap NodeJS request module to retry http requests in case of errors
Stars: ✭ 330 (+1962.5%)
Mutual labels:  http-client, http-requests
Frequest
FRequest - A fast, lightweight and opensource desktop application to make HTTP(s) requests
Stars: ✭ 130 (+712.5%)
Mutual labels:  http-client, http-requests
EthernetWebServer
This is simple yet complete WebServer library for AVR, Portenta_H7, Teensy, SAM DUE, SAMD21/SAMD51, nRF52, STM32, RP2040-based, etc. boards running Ethernet shields. The functions are similar and compatible to ESP8266/ESP32 WebServer libraries to make life much easier to port sketches from ESP8266/ESP32. Coexisting now with `ESP32 WebServer` and…
Stars: ✭ 118 (+637.5%)
Mutual labels:  http-client, http-requests
direwolf
Package direwolf is a convenient and easy to use http client written in Golang.
Stars: ✭ 44 (+175%)
Mutual labels:  http-client, http-requests
swish
C++ HTTP requests for humans
Stars: ✭ 52 (+225%)
Mutual labels:  http-client, http-requests
centra
Core Node.js HTTP client
Stars: ✭ 52 (+225%)
Mutual labels:  http-client, http-requests

License CocoaPods Compatible Carthage Compatible Weibo Twitter

Redes

High-level network layer abstraction library written in Swift.

Why not just use Alamofire directly

  • If one day the project manager tell you need to use Socket reconstruct all network interfaces, you are going to all the business code to replace the Alamofire to new Socket requests?
  • A few days late, the project manager tell you some old interfaces must compatible with previous methods, but requires the use of Socket new interfaces to achieve, you are going to change the network interfaces which you already reconstructed back?
  • Direct use Alamofire, all requests related parameters are located in the business code, and there are several different methods of calling the request, such as uploading and downloading and a normal request invoke methods on the inconsistency. Pack all related parameters into an object, you can use only one very method to achieve all different situations request call. Conforms to the Command Pattern rules
  • Wrap network layer, brings more conducive to expansion. If you preferred use Alamofire and Socket both, only need to specify which way you want to use for request in command inside, and then expand the corresponding request mode implement (default only implements Alamofire)
  • The code change of network layer does not affect the business layer, underlying free replacement transducer, a request to call as long as the business layer rule to conform redes ask

Requirements

  • iOS 9.0+
  • Xcode 8.0+

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects.

CocoaPods 0.36 adds supports for Swift and embedded frameworks. You can install it with the following command:

$ gem install cocoapods

To integrate Redes into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'Redes'

Then, run the following command:

$ pod install

You should open the {Project}.xcworkspace instead of the {Project}.xcodeproj after you installed anything from CocoaPods.

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate Redes into your Xcode project using Carthage, specify it in your Cartfile:

github "cuzv/Redes"

Then, run the following command to build the Redes framework:

$ carthage update

At last, you need to set up your Xcode project manually to add the Redes framework.

On your application targets’ “General” settings tab, in the “Linked Frameworks and Libraries” section, drag and drop each framework you want to use from the Carthage/Build folder on disk.

On your application targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase”. Create a Run Script with the following content:

/usr/local/bin/carthage copy-frameworks

and add the paths to the frameworks you want to use under “Input Files”:

$(SRCROOT)/Carthage/Build/iOS/Redes.framework

For more information about how to use Carthage, please see its project page.

Since Redes related to Alamofire, you should do those produce again for Alamofire

Usage

  • Make your API conforms to Requestable
struct LoginApi: Requestable {
    var userName: String = ""
    var passWord: String = ""

    var url: URLConvertible {
        return "https://host/to/path"
    }
    
	var method: HTTPMethod {
        return .POST
    }
    
    var var bodies: HTTPBodies {
        return [
            "user": userName,
            "pass": passWord
        ]
    }
    
    var headers: HTTPHeaders {
        return [:]
    }
}
  • Build api and start request & process result
let loginRequest = LoginApi().action()

loginRequest.responseJSON {
    debugPrint($0.result)
}

loginRequest.responseJSON(queue: DispatchQueue.global()) {
    debugPrint($0.result)
}
.responseString {
	switch $0.result {
	case .success(let value):
		debugPrint(value)
	case .failure(let error):
         debugPrint(error)
  	}
}
// .cancel()
  • More information see the demo in project. (Before you run this project, checkout API.swift and change the setups to your server configuration.)

Caching

Caching is handled on the system framework level by URLCache.

Notice

  • v0.x for swift 2.2
  • v1.x for swift 2.3
  • v2.x for swift 3.x

License

Redes is available under the MIT license. See the LICENSE file for more info.

Contact

Follow me on Twitter (@mochxiao)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].