Skip to content

Commit 5364051

Browse files
committed
small method signature fixes
1 parent 94eeeba commit 5364051

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

Sources/S3/Extensions/S3+Delete.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public extension S3 {
1515
// MARK: Delete
1616

1717
/// Delete file from S3
18-
public func delete(file: LocationConvertible, headers: [String: String] = [:], on container: Container) throws -> Future<Void> {
18+
public func delete(file: LocationConvertible, headers: [String: String], on container: Container) throws -> Future<Void> {
1919
let url = try self.url(file: file, on: container)
2020
let headers = try signer.headers(for: .DELETE, urlString: url.absoluteString, headers: headers, payload: .none)
2121
return try make(request: url, method: .DELETE, headers: headers, data: "".convertToData(), on: container).map(to: Void.self) { response in

Sources/S3/Extensions/S3+Get.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public extension S3 {
1515
// MARK: Get
1616

1717
/// Retrieve file data from S3
18-
public func get(file: LocationConvertible, headers: [String: String] = [:], on container: Container) throws -> Future<File.Response> {
18+
public func get(file: LocationConvertible, headers: [String: String], on container: Container) throws -> Future<File.Response> {
1919
let url = try self.url(file: file, on: container)
2020
let headers = try signer.headers(for: .GET, urlString: url.absoluteString, headers: headers, payload: .none)
2121
return try make(request: url, method: .GET, headers: headers, on: container).map(to: File.Response.self) { response in

Sources/S3/Extensions/S3+ObjectInfo.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public extension S3 {
1717

1818
/// Get acl file information (ACL)
1919
/// https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectGETacl.html
20-
public func get(acl file: LocationConvertible, headers: [String: String] = [:], on container: Container) throws -> Future<File.Info> {
20+
public func get(acl file: LocationConvertible, headers: [String: String], on container: Container) throws -> Future<File.Info> {
2121
fatalError("Not implemented")
2222
}
2323

@@ -29,7 +29,7 @@ public extension S3 {
2929

3030
/// Get file information (HEAD)
3131
/// https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectHEAD.html
32-
public func get(fileInfo file: LocationConvertible, headers: [String: String] = [:], on container: Container) throws -> Future<File.Info> {
32+
public func get(fileInfo file: LocationConvertible, headers: [String: String], on container: Container) throws -> Future<File.Info> {
3333
let url = try self.url(file: file, on: container)
3434
let headers = try signer.headers(for: .HEAD, urlString: url.absoluteString, headers: headers, payload: .none)
3535
return try make(request: url, method: .HEAD, headers: headers, data: "".convertToData(), on: container).map(to: File.Info.self) { response in

Sources/S3/Extensions/S3+Put.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public extension S3 {
1616
// MARK: Upload
1717

1818
/// Upload file to S3
19-
public func put(file: File.Upload, headers: [String: String] = [:], on container: Container) throws -> EventLoopFuture<File.Response> {
19+
public func put(file: File.Upload, headers: [String: String], on container: Container) throws -> EventLoopFuture<File.Response> {
2020
let url = try self.url(file: file, on: container)
2121

2222
var awsHeaders: [String: String] = headers
@@ -37,6 +37,11 @@ public extension S3 {
3737
}
3838
}
3939

40+
/// Upload file to S3
41+
public func put(file: File.Upload, on container: Container) throws -> EventLoopFuture<File.Response> {
42+
return try put(file: file, headers: [:], on: container)
43+
}
44+
4045
/// Upload file by it's URL to S3
4146
public func put(file url: URL, destination: String, access: AccessControlList = .privateAccess, on container: Container) throws -> Future<File.Response> {
4247
let data: Data = try Data(contentsOf: url)

Sources/S3/Protocols/S3Client.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ public protocol S3Client: Service {
3333
/// Get list of objects
3434
func list(bucket: String, region: Region?, headers: [String: String], on container: Container) throws -> Future<BucketResults>
3535

36+
/// Upload file to S3
37+
func put(file: File.Upload, on container: Container) throws -> EventLoopFuture<File.Response>
38+
3639
/// Upload file to S3
3740
func put(file: File.Upload, headers: [String: String], on: Container) throws -> EventLoopFuture<File.Response>
3841

0 commit comments

Comments
 (0)