{"id":18479202,"url":"https://github.com/kevinzhourafael/shrimp","last_synced_at":"2025-04-08T15:34:27.245Z","repository":{"id":62455318,"uuid":"71879513","full_name":"KevinZhouRafael/Shrimp","owner":"KevinZhouRafael","description":"Shrimp is an simplify HTTP networking library on iOS.","archived":false,"fork":false,"pushed_at":"2023-01-20T13:21:23.000Z","size":1846,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-30T17:30:51.736Z","etag":null,"topics":["afnetworking","alamore","downloadmanager","http","https","ios","ios-downloader","network","networking","pause-download","resume-download","swift","swift-downloader"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KevinZhouRafael.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-25T09:10:13.000Z","updated_at":"2022-03-06T10:22:18.000Z","dependencies_parsed_at":"2023-02-12T02:17:07.540Z","dependency_job_id":null,"html_url":"https://github.com/KevinZhouRafael/Shrimp","commit_stats":null,"previous_names":["kevinchourafael/shrimphttp"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinZhouRafael%2FShrimp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinZhouRafael%2FShrimp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinZhouRafael%2FShrimp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KevinZhouRafael%2FShrimp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KevinZhouRafael","download_url":"https://codeload.github.com/KevinZhouRafael/Shrimp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223335087,"owners_count":17128521,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["afnetworking","alamore","downloadmanager","http","https","ios","ios-downloader","network","networking","pause-download","resume-download","swift","swift-downloader"],"created_at":"2024-11-06T12:13:46.721Z","updated_at":"2024-11-06T12:13:47.183Z","avatar_url":"https://github.com/KevinZhouRafael.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shrimp\n\n[![Version](https://img.shields.io/cocoapods/v/Shrimp.svg?style=flat)](http://cocoapods.org/pods/Shrimp)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![License](https://img.shields.io/cocoapods/l/Shrimp.svg?style=flat)](http://cocoapods.org/pods/Shrimp)\n[![Platform](https://img.shields.io/cocoapods/p/Shrimp.svg?style=flat)](http://cocoapods.org/pods/Shrimp)\n\n\nShrimp is an simplify HTTP networking library written in Swift.\n\n## Features\n\n- [x] Chainable Request / Response Methods\n- [x] Parameter Encoding\n- [x] GET / POST / PUT / DELETE\n- [x] Builtin JSON Request Serialization\n- [x] Resume Download Datas\n- [x] Download with Progress Notification\n- [x] Auto Adjust Server Date\n\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n\n\n## Usage\n\n### GET\n\n```swift\n        Shrimp.request(.GET, urlString: \"https://httpbin.org/get\")\n        .responseString ({ (string, response) in\n            debugPrint(\"GET: \\(string)\")\n        })\n```\n\n### POST\n\n```swift\n\n        Shrimp.request(.POST, urlString: \"http://www.mocky.io/v2/56c5b7a80f0000d027a204e2\", parameters: [\"username\":\"rafael\",\n            \"password\":\"123456\"])\n        .responseJSONObject({ (json, response) in\n                debugPrint(json[\"first_name\"])\n                debugPrint(json[\"last_name\"])\n                debugPrint(json[\"gender\"])            \n            }, errorHandler: { (error) in\n                \n        })\n```\n\n### Get Server Time\nShrimp can auto adjust server time.\nGet server time like this:\n\n```swift\nextension Date{\n    static func serverNow()-\u003eDate{\n        Date(ShrimpConfigure.serverTimeInterval())\n    }\n}\n\nDate.serverNow()\n\n```\n\n### DOWNLOAD\nMore powerfull tools use [Reed Download](https://github.com/KevinZhouRafael/Reed).\n\n#### Start Download\n```swift\nDownloadManager.download(withURL: downloadURLString, withDestPath: destPath)\n```\n\n#### Resume Download\n\n```swift\nDownloadManager.resumeDownload(withURL: downloadURLString, withDestPath: destPath)\n\n```\n\n#### Register Download Notifications\n\n```swift\nNotificationCenter.default.addObserver(self, selector: SELECTOR ), name: NSNotification.Name(rawValue: Noti_DownloadManager_Start), object: nil)\nNotificationCenter.default.addObserver(self, selector: SELECTOR ), name: NSNotification.Name(rawValue: Noti_DownloadManager_Progress), object: nil)\nNotificationCenter.default.addObserver(self, selector: SELECTOR ), name: NSNotification.Name(rawValue: Noti_DownloadManager_Complete), object: nil)\nNotificationCenter.default.addObserver(self, selector: SELECTOR ), name: NSNotification.Name(rawValue: Noti_DownloadManager_Failed), object: nil)\nNotificationCenter.default.addObserver(self, selector: SELECTOR ), name: NSNotification.Name(rawValue: Noti_DownloadManager_Cancel), object: nil)\n\n```\n\n#### Observe Notifications\n```swift\nfunc downloadProgress(noti:Notification) {\n        let url = noti.userInfo![\"url\"] as! String\n        let progress = noti.userInfo![\"progress\"] as! Float\n        let bytesWritten = noti.userInfo![\"bytesWritten\"] as! Int64\n        let totalBytesWritten = noti.userInfo![\"totalBytesWritten\"] as! Int64\n        let totalBytesExpectedToWrite = noti.userInfo![\"totalBytesExpectedToWrite\"] as! Int64\n        \n        debugPrint(\"url:\\(url),progress:\\(progress),bytesWritten:\\(bytesWritten),totalBytesWritten\\(totalBytesWritten),totalBytesExpectedToWrite:\\(totalBytesExpectedToWrite)\")\n        \n        //url:http://www.abc.com/xyz.zip, progress :0.6, bytesWritten :30, totalBytesWritten :6000, totalBytesExpectedToWrite :10000 \n            \n}\n\n\nfunc downloadComplete(noti:Notification) {\n    let url = noti.userInfo![\"url\"] as! String\n    let destPath = noti.userInfo![\"destPath\"] as! String\n\n}\n\n\n```\n\n#### Other Methods\n```swift\n    DownloadManager.pauseDownload(withURL url:String)\n    DownloadManager.pauseDownloadAll()\n    DownloadManager.isDownloading(url:String)    \n    DownloadManager.isHasResumDate(url:String)\n\n```\n\n\n## Requirements\n- iOS 8.0+  \n- Xcode 11.3\n- Swift 5\n\n## Installation\n\n### Cocoapods\n\nShrimp is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\n# swift5+ ,ios 8.0+\npod \"Shrimp\"\n```\n\n### Carthage\n\nIf you're using [Carthage](https://github.com/Carthage/Carthage), you can add a dependency on Shrimp by adding it to your Cartfile:\n\n```ruby\ngithub \"KevinZhouRafael/Shrimp\"\n```\n\n## Author\n\nRafael Zhou\n\n- Email me: \u003cwumingapie@gmail.com\u003e\n\n## License\n\nShrimp is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinzhourafael%2Fshrimp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevinzhourafael%2Fshrimp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevinzhourafael%2Fshrimp/lists"}