Skip to content

Commit 94ea72b

Browse files
committed
Updated README.md
1 parent e40c865 commit 94ea72b

File tree

5 files changed

+31
-20
lines changed

5 files changed

+31
-20
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog 📝
22

3+
![Relative date](https://img.shields.io/date/1671759188)
4+
|Release|0.1.5|
5+
|:---|:---|
6+
|Changed|Changed the APIRouter name to URLRouter which is a universal meaning #33 by @devyhan|
7+
|Fixed|Fixed the public scope of the static parameter and static function of `Scheme` components #32 by @devyhan|
8+
9+
---
10+
311
![Relative date](https://img.shields.io/date/1671605792)
412
|Release|0.1.4|
513
|:---|:---|

README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
![main](https://github.com/devyhan/urlrouter/actions/workflows/ci.yml/badge.svg?branch=main)
2-
[![codecov](https://codecov.io/gh/devyhan/URLRouter/branch/main/graph/badge.svg?token=ZQNDOX2VDF)](https://codecov.io/gh/devyhan/APIRouter)
3-
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fdevyhan%2FAPIRouter%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/devyhan/APIRouter)
4-
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fdevyhan%2FAPIRouter%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/devyhan/APIRouter)
2+
[![codecov](https://codecov.io/gh/devyhan/URLRouter/branch/main/graph/badge.svg?token=ZQNDOX2VDF)](https://codecov.io/gh/devyhan/URLRouter)
3+
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fdevyhan%2FURLRouter%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/devyhan/URLRouter)
4+
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fdevyhan%2FURLRouter%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/devyhan/URLRouter)
55

66
<p align="center">
77
<img src="https://user-images.githubusercontent.com/45344633/208562346-19b44df3-c581-4f32-af8e-d85dbc99ec18.png" />
@@ -13,10 +13,10 @@ It provides a simple interface for managing multiple endpoints and allows develo
1313
It also provides a way for developers to create custom endpoints DSL(Domain-Specific Languages) and to manage their own settings for each endpoint.
1414
Additionally, it provides a way to track the status of each endpoint and to easily detect any changes or updates that have been made.
1515

16-
Similar to Swift Evolution's [Regex builder DSL](https://github.com/apple/swift-evolution/blob/main/proposals/0351-regex-builder.md), URL string literal and a more powerful pattern result builder to help make Swift URL string processing fast and easy and without mistakes. Ultimately, with ***APIRouter***, changes are easy to detect and useful for maintenance.
16+
Similar to Swift Evolution's [Regex builder DSL](https://github.com/apple/swift-evolution/blob/main/proposals/0351-regex-builder.md), URL string literal and a more powerful pattern result builder to help make Swift URL string processing fast and easy and without mistakes. Ultimately, with ***URLRouter***, changes are easy to detect and useful for maintenance.
1717

1818
🤔 *Ask questions you’re wondering about [here](https://github.com/devyhan/URLRouter/discussions/new?category=q-a).*<br/>
19-
💡 *Share ideas [here](https://github.com/devyhan/APIRouter/discussions/new).*
19+
💡 *Share ideas [here](https://github.com/devyhan/URLRouter/discussions/new).*
2020

2121
## Installation 📦
2222
- Using [Swift Package Manager](https://swift.org/package-manager)
@@ -34,11 +34,11 @@ Similar to Swift Evolution's [Regex builder DSL](https://github.com/apple/swift-
3434

3535
## Configure URLRouter 📝
3636
### Implement URLs Namespace
37-
- To implement URLs namespace we create a new type that will house the domain and behavior of the URLs by conforming to `RouterProtocol`.
37+
- To implement URLs namespace we create a new type that will house the domain and behavior of the URLs by conforming to `URLRoutable`.
3838
```swift
3939
import URLRouter
4040

41-
public enum URLs: RouterProtocol {
41+
public enum URLs: URLRoutable {
4242
...
4343
}
4444
```
@@ -236,7 +236,7 @@ Request {
236236
```swift
237237
import URLRouter
238238

239-
enum URLs: RouterProtocol {
239+
enum URLs: URLRoutable {
240240
// DOC: https://docs.github.com/ko/rest/repos/repos?apiVersion=2022-11-28#list-organization-repositories
241241
case listOrganizationRepositories(organizationName: String)
242242
// DOC: https://docs.github.com/ko/rest/repos/repos?apiVersion=2022-11-28#create-an-organization-repository
@@ -255,8 +255,8 @@ enum URLs: RouterProtocol {
255255
let hasWiki: Bool
256256
}
257257

258-
var router: Router? {
259-
Router {
258+
var router: URLRouter {
259+
URLRouter {
260260
BaseURL("http://api.github.com")
261261
switch self {
262262
case let .listOrganizationRepositories(organizationName):

Sources/URLRouter/RequestBuilder.swift

-5
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,5 @@ public struct URL: RequestProtocol, URLRouterProtocol {
139139
router.urlComponents = self.components
140140
router.urlRequest?.url = self.components?.url
141141
router.url = self.components?.url
142-
if !queryItems.isEmpty {
143-
router.urlComponents?.queryItems = self.queryItems
144-
router.urlRequest?.url = router.urlComponents?.url
145-
router.url = router.urlComponents?.url
146-
}
147142
}
148143
}

Tests/URLRouterTests/RouterBuilderTests.swift

+13-5
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ final class RouterBuilderTests: XCTestCase {
6868

6969
func testRouterSwiftchBranching() {
7070
enum URLs {
71-
case one, two, deeplink
71+
case one, two, homeDeeplink, detailDeeplink
7272

7373
var router: URLRouter {
7474
URLRouter {
@@ -102,7 +102,12 @@ final class RouterBuilderTests: XCTestCase {
102102
Query("postId", value: "2")
103103
}
104104
}
105-
case .deeplink:
105+
case .homeDeeplink:
106+
URL {
107+
Scheme.custom("example-deeplink")
108+
Host("home")
109+
}
110+
case .detailDeeplink:
106111
URL {
107112
Scheme.custom("example-deeplink")
108113
Host("detail")
@@ -131,14 +136,17 @@ final class RouterBuilderTests: XCTestCase {
131136
mockOptionTwoUrlRequest.httpMethod = "GET"
132137
mockOptionTwoUrlRequest.allHTTPHeaderFields = header
133138

134-
let mockDeeplinkUrl = Foundation.URL(string: "example-deeplink://detail/comments?1=postId&2021-04-27T04:39:54.261Z=createdAt")!
139+
let mockHomeDeeplinkUrl = Foundation.URL(string: "example-deeplink://home")!
140+
let mockDetailDeeplinkUrl = Foundation.URL(string: "example-deeplink://detail/comments?1=postId&2021-04-27T04:39:54.261Z=createdAt")!
135141

136142
if let optionOneUrlRequest = URLs.one.router.urlRequest,
137143
let optionTwoUrlRequest = URLs.two.router.urlRequest,
138-
let deeplinkUrl = URLs.deeplink.router.url {
144+
let homeDeeplinkUrl = URLs.homeDeeplink.router.url,
145+
let detailDeeplinkUrl = URLs.detailDeeplink.router.url {
139146
XCTAssertEqual(optionOneUrlRequest, mockOptionOneUrlRequest)
140147
XCTAssertEqual(optionTwoUrlRequest, mockOptionTwoUrlRequest)
141-
XCTAssertEqual(deeplinkUrl, mockDeeplinkUrl)
148+
XCTAssertEqual(homeDeeplinkUrl, mockHomeDeeplinkUrl)
149+
XCTAssertEqual(detailDeeplinkUrl, mockDetailDeeplinkUrl)
142150
}
143151
}
144152
}

0 commit comments

Comments
 (0)