Skip to content

Commit 0db9f44

Browse files
authored
Merge pull request #4 from ragzy15/develop
Develop
2 parents 543c1de + 733c721 commit 0db9f44

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1720
-920
lines changed

Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ let package = Package(
1818
targets: ["NetworkKit"]),
1919
],
2020
dependencies: [
21-
.package(url: "https://github.com/ragzy15/PublisherKit", from: .init(1, 0, 0))
22-
// Dependencies declare other packages that this package depends on.
23-
// .package(url: /* package url */, from: "1.0.0"),
21+
.package(url: "https://github.com/ragzy15/PublisherKit", from: "4.0.2")
2422
],
2523
targets: [
2624
// Targets are the basic building blocks of a package. A target can define a module or a test suite.

Sources/NetworkKit/Protocols/Server/API Representable.swift renamed to Sources/NetworkKit/API Creation/API Representable.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@
33
// NetworkKit
44
//
55
// Created by Raghav Ahuja on 15/10/19.
6-
// Copyright © 2019 Raghav Ahuja. All rights reserved.
76
//
87

9-
import Foundation
10-
118
/**
129
A type that represents server api. It can also be used for managing server environment in URL.
1310

@@ -25,11 +22,11 @@ public protocol APIRepresentable {
2522
It may include server environment for the api.
2623
Use **Environment.current** to maintain environment.
2724
```
28-
let url = "https://api-staging.example.com/users/all"
29-
// `api-staging` is sub url.
25+
let url = "https://api.example.com/users/all"
26+
// `api` is sub url.
3027
```
3128
*/
32-
var subUrl: String { get }
29+
var subURL: String { get }
3330

3431
/**
3532
EndPoint for API.

Sources/NetworkKit/Connection/Connection Representable.swift renamed to Sources/NetworkKit/API Creation/Connection Representable.swift

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@
33
// NetworkKit
44
//
55
// Created by Raghav Ahuja on 15/10/19.
6-
// Copyright © 2019 Raghav Ahuja. All rights reserved.
76
//
87

9-
import Foundation
10-
118
/**
129
A type that represents as a connection or an endpoint.
1310

@@ -16,7 +13,7 @@ import Foundation
1613
// `/users/all` is a connection.
1714
```
1815
*/
19-
public protocol ConnectionRepresentable {
16+
public protocol ConnectionRepresentable: CustomStringConvertible {
2017

2118
/**
2219
The path subcomponent. It is the connection endpoint for the url.
@@ -25,9 +22,9 @@ public protocol ConnectionRepresentable {
2522
let url = "https://api.example.com/users/all"
2623
// `/users/all` is the path for this connection
2724
```
28-
25+
2926
Setting this property assumes the subcomponent or component string is not percent encoded and will add percent encoding (if the component allows percent encoding).
30-
*/
27+
*/
3128
var path: String { get }
3229

3330
/// Connection name if any. Use for console logging. Defaults to connection url if provided `nil`.
@@ -52,9 +49,13 @@ public protocol ConnectionRepresentable {
5249
var apiType: APIRepresentable? { get }
5350
}
5451

55-
public extension ConnectionRepresentable {
52+
extension ConnectionRepresentable {
53+
54+
public var scheme: Scheme { .https }
5655

57-
var scheme: Scheme { .https }
56+
public var apiType: APIRepresentable? { host.defaultAPIType }
5857

59-
var apiType: APIRepresentable? { host.defaultAPIType }
58+
public var description: String {
59+
"\(name ?? "Unknown")| \(path)"
60+
}
6061
}

Sources/NetworkKit/Protocols/Server/Environment.swift renamed to Sources/NetworkKit/API Creation/Environment.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@
33
// NetworkKit
44
//
55
// Created by Raghav Ahuja on 15/10/19.
6-
// Copyright © 2019 Raghav Ahuja. All rights reserved.
76
//
87

9-
import Foundation
10-
118
/**
129
Server Environment.
1310

@@ -33,7 +30,8 @@ public struct Environment: Hashable, Equatable {
3330

3431
public internal(set) static var current: Environment = .none
3532

36-
public static let none = Environment(value: "")
37-
public static let staging = Environment(value: "staging")
38-
public static let dev = Environment(value: "dev")
33+
public static let none = Environment(value: "")
34+
public static let staging = Environment(value: "staging")
35+
public static let dev = Environment(value: "dev")
36+
public static let production = Environment(value: "")
3937
}

Sources/NetworkKit/Protocols/Server/Host Representable.swift renamed to Sources/NetworkKit/API Creation/Host Representable.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@
33
// NetworkKit
44
//
55
// Created by Raghav Ahuja on 15/10/19.
6-
// Copyright © 2019 Raghav Ahuja. All rights reserved.
76
//
87

9-
import Foundation
10-
118
/**
129
A type that represents a URL host.
1310

@@ -19,13 +16,14 @@ let url = "https://api.example.com/users/all"
1916
*/
2017
public protocol HostRepresentable {
2118

19+
/// Host name.
2220
var host: String { get }
2321

2422
/// Default Headers attached to every request with this host.
2523
var defaultHeaders: HTTPHeaderParameters { get }
2624

2725
/// Default URL Query for particular host.
28-
var defaultUrlQuery: URLQuery? { get }
26+
var defaultURLQuery: URLQuery? { get }
2927

3028
/// Default API Type for particular host.
3129
var defaultAPIType: APIRepresentable? { get }

Sources/NetworkKit/Debug Loging/NKLogger.swift

Lines changed: 0 additions & 226 deletions
This file was deleted.

0 commit comments

Comments
 (0)