Skip to content

Commit

Permalink
Update copyright
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Jan 10, 2022
1 parent afe1abf commit 1d03843
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 13 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Get 0.x

## Get 0.4.0

*Jan 10, 2022*

- Add public `Request` intializer

## Get 0.3.1

*Dec 29, 2021*
Expand Down
2 changes: 1 addition & 1 deletion Sources/Get/APIClient.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) 2021 Alexander Grebenyuk (github.com/kean).
// Copyright (c) 2021-2022 Alexander Grebenyuk (github.com/kean).

import Foundation

Expand Down
2 changes: 1 addition & 1 deletion Sources/Get/Helpers.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) 2021 Alexander Grebenyuk (github.com/kean).
// Copyright (c) 2021-2022 Alexander Grebenyuk (github.com/kean).

import Foundation

Expand Down
25 changes: 20 additions & 5 deletions Sources/Get/Request.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) 2021 Alexander Grebenyuk (github.com/kean).
// Copyright (c) 2021-2022 Alexander Grebenyuk (github.com/kean).

import Foundation

Expand All @@ -11,6 +11,21 @@ public struct Request<Response> {
var body: AnyEncodable?
public var headers: [String: String]?
public var id: String?

public init(method: String, path: String, query: [(String, String?)]? = nil, headers: [String : String]? = nil) {
self.method = method
self.path = path
self.query = query
self.headers = headers
}

public init<U: Encodable>(method: String, path: String, query: [(String, String?)]? = nil, body: U?, headers: [String : String]? = nil) {
self.method = method
self.path = path
self.query = query
self.body = body.map(AnyEncodable.init)
self.headers = headers
}

public static func get(_ path: String, query: [(String, String?)]? = nil, headers: [String: String]? = nil) -> Request {
Request(method: "GET", path: path, query: query, headers: headers)
Expand All @@ -21,31 +36,31 @@ public struct Request<Response> {
}

public static func post<U: Encodable>(_ path: String, query: [(String, String?)]? = nil, body: U?, headers: [String: String]? = nil) -> Request {
Request(method: "POST", path: path, query: query, body: body.map(AnyEncodable.init), headers: headers)
Request(method: "POST", path: path, query: query, body: body, headers: headers)
}

public static func put(_ path: String, query: [(String, String?)]? = nil, headers: [String: String]? = nil) -> Request {
Request(method: "PUT", path: path, query: query, headers: headers)
}

public static func put<U: Encodable>(_ path: String, query: [(String, String?)]? = nil, body: U?, headers: [String: String]? = nil) -> Request {
Request(method: "PUT", path: path, query: query, body: body.map(AnyEncodable.init), headers: headers)
Request(method: "PUT", path: path, query: query, body: body, headers: headers)
}

public static func patch(_ path: String, query: [(String, String?)]? = nil, headers: [String: String]? = nil) -> Request {
Request(method: "PATCH", path: path, query: query, headers: headers)
}

public static func patch<U: Encodable>(_ path: String, query: [(String, String?)]? = nil, body: U?, headers: [String: String]? = nil) -> Request {
Request(method: "PATCH", path: path, query: query, body: body.map(AnyEncodable.init), headers: headers)
Request(method: "PATCH", path: path, query: query, body: body, headers: headers)
}

public static func delete(_ path: String, query: [(String, String?)]? = nil, headers: [String: String]? = nil) -> Request {
Request(method: "DELETE", path: path, query: query, headers: headers)
}

public static func delete<U: Encodable>(_ path: String, query: [(String, String?)]? = nil, body: U?, headers: [String: String]? = nil) -> Request {
Request(method: "DELETE", path: path, query: query, body: body.map(AnyEncodable.init), headers: headers)
Request(method: "DELETE", path: path, query: query, body: body, headers: headers)
}

public static func options(_ path: String, query: [(String, String?)]? = nil, headers: [String: String]? = nil) -> Request {
Expand Down
2 changes: 1 addition & 1 deletion Tests/GetTests/ClientAuthorizationTests.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) 2021 Alexander Grebenyuk (github.com/kean).
// Copyright (c) 2021-2022 Alexander Grebenyuk (github.com/kean).

import XCTest
import Mocker
Expand Down
2 changes: 1 addition & 1 deletion Tests/GetTests/ClientIIntegrationTests.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) 2021 Alexander Grebenyuk (github.com/kean).
// Copyright (c) 2021-2022 Alexander Grebenyuk (github.com/kean).

import XCTest
import Mocker
Expand Down
2 changes: 1 addition & 1 deletion Tests/GetTests/ClientSessionDelegateTests.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) 2021 Alexander Grebenyuk (github.com/kean).
// Copyright (c) 2021-2022 Alexander Grebenyuk (github.com/kean).

import XCTest
import Mocker
Expand Down
2 changes: 1 addition & 1 deletion Tests/GetTests/ClientTests.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) 2021 Alexander Grebenyuk (github.com/kean).
// Copyright (c) 2021-2022 Alexander Grebenyuk (github.com/kean).

import XCTest
import Mocker
Expand Down
2 changes: 1 addition & 1 deletion Tests/GetTests/GitHubAPI.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) 2021 Alexander Grebenyuk (github.com/kean).
// Copyright (c) 2021-2022 Alexander Grebenyuk (github.com/kean).

import Foundation
import Get
Expand Down
2 changes: 1 addition & 1 deletion Tests/GetTests/Helpers.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) 2021 Alexander Grebenyuk (github.com/kean).
// Copyright (c) 2021-2022 Alexander Grebenyuk (github.com/kean).

import XCTest
import Mocker
Expand Down

0 comments on commit 1d03843

Please sign in to comment.