Skip to content

Commit

Permalink
Removes unnecessary Generic param on NetworkingRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
s4cha committed Nov 14, 2023
1 parent e9cb882 commit 9364dc9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions Sources/Networking/Calls/NetworkingClient+Requests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@ import Combine

public extension NetworkingClient {

func getRequest(_ route: String, params: Params = Params()) -> NetworkingRequest<String> {
func getRequest(_ route: String, params: Params = Params()) -> NetworkingRequest {
request(.get, route, params: params)
}

func postRequest(_ route: String, params: Params = Params()) -> NetworkingRequest<String> {
func postRequest(_ route: String, params: Params = Params()) -> NetworkingRequest {
request(.post, route, params: params)
}

func putRequest(_ route: String, params: Params = Params()) -> NetworkingRequest<String> {
func putRequest(_ route: String, params: Params = Params()) -> NetworkingRequest {
request(.put, route, params: params)
}

func patchRequest(_ route: String, params: Params = Params()) -> NetworkingRequest<String> {
func patchRequest(_ route: String, params: Params = Params()) -> NetworkingRequest {
request(.patch, route, params: params)
}

func deleteRequest(_ route: String, params: Params = Params()) -> NetworkingRequest<String> {
func deleteRequest(_ route: String, params: Params = Params()) -> NetworkingRequest {
request(.delete, route, params: params)
}

internal func request(_ httpMethod: HTTPMethod,
_ route: String,
params: Params = Params()
) -> NetworkingRequest<String> {
let req = NetworkingRequest<String>()
) -> NetworkingRequest {
let req = NetworkingRequest()
req.httpMethod = httpMethod
req.route = route
req.params = params
Expand Down Expand Up @@ -63,8 +63,8 @@ public extension NetworkingClient {
_ route: String,
params: Params = Params(),
encodableBody: E? = nil
) -> NetworkingRequest<E> {
let req = NetworkingRequest<E>()
) -> NetworkingRequest {
let req = NetworkingRequest()
req.httpMethod = httpMethod
req.route = route
req.params = Params()
Expand Down
4 changes: 2 additions & 2 deletions Sources/Networking/NetworkingRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import Combine

public typealias NetworkRequestRetrier = (_ request: URLRequest, _ error: Error) -> AnyPublisher<Void, Error>?

public class NetworkingRequest<E: Encodable>: NSObject, URLSessionTaskDelegate {
public class NetworkingRequest: NSObject, URLSessionTaskDelegate {

var parameterEncoding = ParameterEncoding.urlEncoded
var baseURL = ""
var route = ""
var httpMethod = HTTPMethod.get
public var params = Params()
public var encodableBody: E?
public var encodableBody: Encodable?
var headers = [String: String]()
var multipartData: [MultipartData]?
var logLevel: NetworkingLogLevel {
Expand Down

0 comments on commit 9364dc9

Please sign in to comment.