Skip to content

Commit

Permalink
small method signature fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rafiki270 committed May 13, 2018
1 parent 94eeeba commit 5364051
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Sources/S3/Extensions/S3+Delete.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public extension S3 {
// MARK: Delete

/// Delete file from S3
public func delete(file: LocationConvertible, headers: [String: String] = [:], on container: Container) throws -> Future<Void> {
public func delete(file: LocationConvertible, headers: [String: String], on container: Container) throws -> Future<Void> {
let url = try self.url(file: file, on: container)
let headers = try signer.headers(for: .DELETE, urlString: url.absoluteString, headers: headers, payload: .none)
return try make(request: url, method: .DELETE, headers: headers, data: "".convertToData(), on: container).map(to: Void.self) { response in
Expand Down
2 changes: 1 addition & 1 deletion Sources/S3/Extensions/S3+Get.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public extension S3 {
// MARK: Get

/// Retrieve file data from S3
public func get(file: LocationConvertible, headers: [String: String] = [:], on container: Container) throws -> Future<File.Response> {
public func get(file: LocationConvertible, headers: [String: String], on container: Container) throws -> Future<File.Response> {
let url = try self.url(file: file, on: container)
let headers = try signer.headers(for: .GET, urlString: url.absoluteString, headers: headers, payload: .none)
return try make(request: url, method: .GET, headers: headers, on: container).map(to: File.Response.self) { response in
Expand Down
4 changes: 2 additions & 2 deletions Sources/S3/Extensions/S3+ObjectInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public extension S3 {

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

Expand All @@ -29,7 +29,7 @@ public extension S3 {

/// Get file information (HEAD)
/// https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectHEAD.html
public func get(fileInfo file: LocationConvertible, headers: [String: String] = [:], on container: Container) throws -> Future<File.Info> {
public func get(fileInfo file: LocationConvertible, headers: [String: String], on container: Container) throws -> Future<File.Info> {
let url = try self.url(file: file, on: container)
let headers = try signer.headers(for: .HEAD, urlString: url.absoluteString, headers: headers, payload: .none)
return try make(request: url, method: .HEAD, headers: headers, data: "".convertToData(), on: container).map(to: File.Info.self) { response in
Expand Down
7 changes: 6 additions & 1 deletion Sources/S3/Extensions/S3+Put.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public extension S3 {
// MARK: Upload

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

var awsHeaders: [String: String] = headers
Expand All @@ -37,6 +37,11 @@ public extension S3 {
}
}

/// Upload file to S3
public func put(file: File.Upload, on container: Container) throws -> EventLoopFuture<File.Response> {
return try put(file: file, headers: [:], on: container)
}

/// Upload file by it's URL to S3
public func put(file url: URL, destination: String, access: AccessControlList = .privateAccess, on container: Container) throws -> Future<File.Response> {
let data: Data = try Data(contentsOf: url)
Expand Down
3 changes: 3 additions & 0 deletions Sources/S3/Protocols/S3Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public protocol S3Client: Service {
/// Get list of objects
func list(bucket: String, region: Region?, headers: [String: String], on container: Container) throws -> Future<BucketResults>

/// Upload file to S3
func put(file: File.Upload, on container: Container) throws -> EventLoopFuture<File.Response>

/// Upload file to S3
func put(file: File.Upload, headers: [String: String], on: Container) throws -> EventLoopFuture<File.Response>

Expand Down

0 comments on commit 5364051

Please sign in to comment.