Skip to content

Commit

Permalink
Merge pull request #4 from ragzy15/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ragzy15 authored May 2, 2020
2 parents 543c1de + 733c721 commit 0db9f44
Show file tree
Hide file tree
Showing 42 changed files with 1,720 additions and 920 deletions.
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"repositoryURL": "https://github.com/ragzy15/PublisherKit",
"state": {
"branch": null,
"revision": "ad211780f0f532a473e3d5d1cef2a2644024d7c4",
"version": "1.0.0"
"revision": "0abfe5f5d7c5be13f933fcfe2372e8c9ab3ddf90",
"version": "4.0.2"
}
}
]
Expand Down
4 changes: 1 addition & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ let package = Package(
targets: ["NetworkKit"]),
],
dependencies: [
.package(url: "https://github.com/ragzy15/PublisherKit", from: .init(1, 0, 0))
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/ragzy15/PublisherKit", from: "4.0.2")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
// NetworkKit
//
// Created by Raghav Ahuja on 15/10/19.
// Copyright © 2019 Raghav Ahuja. All rights reserved.
//

import Foundation

/**
A type that represents server api. It can also be used for managing server environment in URL.
Expand All @@ -25,11 +22,11 @@ public protocol APIRepresentable {
It may include server environment for the api.
Use **Environment.current** to maintain environment.
```
let url = "https://api-staging.example.com/users/all"
// `api-staging` is sub url.
let url = "https://api.example.com/users/all"
// `api` is sub url.
```
*/
var subUrl: String { get }
var subURL: String { get }

/**
EndPoint for API.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
// NetworkKit
//
// Created by Raghav Ahuja on 15/10/19.
// Copyright © 2019 Raghav Ahuja. All rights reserved.
//

import Foundation

/**
A type that represents as a connection or an endpoint.
Expand All @@ -16,7 +13,7 @@ import Foundation
// `/users/all` is a connection.
```
*/
public protocol ConnectionRepresentable {
public protocol ConnectionRepresentable: CustomStringConvertible {

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

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

public extension ConnectionRepresentable {
extension ConnectionRepresentable {

public var scheme: Scheme { .https }

var scheme: Scheme { .https }
public var apiType: APIRepresentable? { host.defaultAPIType }

var apiType: APIRepresentable? { host.defaultAPIType }
public var description: String {
"\(name ?? "Unknown")| \(path)"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
// NetworkKit
//
// Created by Raghav Ahuja on 15/10/19.
// Copyright © 2019 Raghav Ahuja. All rights reserved.
//

import Foundation

/**
Server Environment.
Expand All @@ -33,7 +30,8 @@ public struct Environment: Hashable, Equatable {

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

public static let none = Environment(value: "")
public static let staging = Environment(value: "staging")
public static let dev = Environment(value: "dev")
public static let none = Environment(value: "")
public static let staging = Environment(value: "staging")
public static let dev = Environment(value: "dev")
public static let production = Environment(value: "")
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
// NetworkKit
//
// Created by Raghav Ahuja on 15/10/19.
// Copyright © 2019 Raghav Ahuja. All rights reserved.
//

import Foundation

/**
A type that represents a URL host.
Expand All @@ -19,13 +16,14 @@ let url = "https://api.example.com/users/all"
*/
public protocol HostRepresentable {

/// Host name.
var host: String { get }

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

/// Default URL Query for particular host.
var defaultUrlQuery: URLQuery? { get }
var defaultURLQuery: URLQuery? { get }

/// Default API Type for particular host.
var defaultAPIType: APIRepresentable? { get }
Expand Down
226 changes: 0 additions & 226 deletions Sources/NetworkKit/Debug Loging/NKLogger.swift

This file was deleted.

Loading

0 comments on commit 0db9f44

Please sign in to comment.