-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from uhooi/feature/create_package
Create package
- Loading branch information
Showing
13 changed files
with
368 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
env: | ||
DEVELOPER_DIR: /Applications/Xcode_12.4.app | ||
|
||
jobs: | ||
build: | ||
runs-on: macOS-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Build | ||
run: swift build -v | ||
|
||
test: | ||
runs-on: macOS-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Test | ||
run: swift test -v | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,11 @@ | ||
# Xcode | ||
# | ||
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore | ||
.DS_Store | ||
/.build | ||
/Packages | ||
/*.xcodeproj | ||
.swiftpm | ||
.*.sw? | ||
|
||
## User settings | ||
xcuserdata/ | ||
# Ruby | ||
.ruby-version | ||
vendor | ||
|
||
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) | ||
*.xcscmblueprint | ||
*.xccheckout | ||
|
||
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) | ||
build/ | ||
DerivedData/ | ||
*.moved-aside | ||
*.pbxuser | ||
!default.pbxuser | ||
*.mode1v3 | ||
!default.mode1v3 | ||
*.mode2v3 | ||
!default.mode2v3 | ||
*.perspectivev3 | ||
!default.perspectivev3 | ||
|
||
## Obj-C/Swift specific | ||
*.hmap | ||
|
||
## App packaging | ||
*.ipa | ||
*.dSYM.zip | ||
*.dSYM | ||
|
||
## Playgrounds | ||
timeline.xctimeline | ||
playground.xcworkspace | ||
|
||
# Swift Package Manager | ||
# | ||
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. | ||
# Packages/ | ||
# Package.pins | ||
# Package.resolved | ||
# *.xcodeproj | ||
# | ||
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata | ||
# hence it is not needed unless you have added a package configuration file to your project | ||
# .swiftpm | ||
|
||
.build/ | ||
|
||
# CocoaPods | ||
# | ||
# We recommend against adding the Pods directory to your .gitignore. However | ||
# you should judge for yourself, the pros and cons are mentioned at: | ||
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control | ||
# | ||
# Pods/ | ||
# | ||
# Add this line if you want to avoid checking in source code from the Xcode workspace | ||
# *.xcworkspace | ||
|
||
# Carthage | ||
# | ||
# Add this line if you want to avoid checking in source code from Carthage dependencies. | ||
# Carthage/Checkouts | ||
|
||
Carthage/Build/ | ||
|
||
# Accio dependency management | ||
Dependencies/ | ||
.accio/ | ||
|
||
# fastlane | ||
# | ||
# It is recommended to not store the screenshots in the git repo. | ||
# Instead, use fastlane to re-generate the screenshots whenever they are needed. | ||
# For more information about the recommended setup visit: | ||
# https://docs.fastlane.tools/best-practices/source-control/#source-control | ||
|
||
fastlane/report.xml | ||
fastlane/Preview.html | ||
fastlane/screenshots/**/*.png | ||
fastlane/test_output | ||
|
||
# Code Injection | ||
# | ||
# After new code Injection tools there's a generated folder /iOSInjectionProject | ||
# https://github.com/johnno1962/injectionforxcode | ||
|
||
iOSInjectionProject/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// swift-tools-version:5.3 | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "HTTPClient", | ||
platforms: [ | ||
.iOS(.v8), | ||
.macOS(.v10_10), | ||
.tvOS(.v9), | ||
.watchOS(.v2), | ||
], | ||
products: [ | ||
.library( | ||
name: "HTTPClient", | ||
targets: ["HTTPClient"]), | ||
], | ||
dependencies: [ | ||
], | ||
targets: [ | ||
.target( | ||
name: "HTTPClient", | ||
dependencies: []), | ||
.testTarget( | ||
name: "HTTPClientTests", | ||
dependencies: ["HTTPClient"]), | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,45 @@ | ||
# swift-http-client | ||
|
||
[](https://github.com/uhooi/swift-http-client/actions/workflows/main.yml) | ||
[](https://github.com/uhooi/swift-http-client/releases/latest) | ||
[](https://github.com/uhooi/swift-http-client/blob/main/LICENSE) | ||
[](https://twitter.com/the_uhooi) | ||
|
||
Communicate via HTTP easily in Swift. | ||
|
||
## Table of Contents | ||
|
||
- [Installation](#installation) | ||
- [How to use](#how-to-use) | ||
- [Contribution](#contribution) | ||
|
||
## Installation | ||
|
||
### Swift Package Manager (Recommended) | ||
|
||
#### Package | ||
|
||
TBD | ||
|
||
#### Xcode | ||
|
||
TBD | ||
|
||
### CocoaPods | ||
|
||
TBD | ||
|
||
### Carthage | ||
|
||
TBD | ||
|
||
## How to use | ||
|
||
You can just import `HTTPClient` to use it. | ||
|
||
## Contribution | ||
|
||
I would be happy if you contribute :) | ||
|
||
- [New issue](https://github.com/uhooi/swift-http-client/issues/new) | ||
- [New pull request](https://github.com/uhooi/swift-http-client/compare) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/// Content-Type. | ||
public enum ContentType: String { | ||
case applicationJson = "application/json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/// HTTP header field. | ||
public enum HTTPHeaderField: String { | ||
case contentType = "Content-Type" | ||
case authorization = "Authorization" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/// HTTP method. | ||
public enum HTTPMethod: String { | ||
case get = "GET" | ||
case post = "POST" | ||
case put = "PUT" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/// Request error. | ||
public enum RequestError: Error { | ||
case invalidUrl | ||
case invalidData | ||
case invalidResponse | ||
case redirection(_ statusCode: Int) | ||
case clientError(_ statusCode: Int) | ||
case serverError(_ statusCode: Int) | ||
case invalidStatusCode(_ statusCode: Int) | ||
} |
Oops, something went wrong.