Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add delete overload func and protocol to allow file delete #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Sources/GitHubKit/GitHub.swift
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ extension GitHub {
return self.eventLoop.makeSucceededFuture(Void())
}
}

/// Delete a file
public func delete<C, E>(path: String, post: E) throws -> EventLoopFuture<C?> where C: Decodable, E: Encodable {
return try send(method: .DELETE, path: path, post: post)
}

/// Retrieve a file
public func get(file path: String) throws -> EventLoopFuture<Data?> {
Expand Down
1 change: 1 addition & 0 deletions Sources/GitHubKit/GitHubClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public protocol GitHubClient {
func put<C, E>(path: String, post: E) throws -> EventLoopFuture<C?> where C: Decodable, E: Encodable
func patch<C, E>(path: String, post: E) throws -> EventLoopFuture<C?> where C: Decodable, E: Encodable
func delete(path: String) throws -> EventLoopFuture<Void>
func delete<C, E>(path: String, post: E) throws -> EventLoopFuture<C?> where C: Decodable, E: Encodable
func get(file path: String) throws -> EventLoopFuture<Data?>
func redirect(file path: String, status: HTTPResponseStatus) throws -> EventLoopFuture<String>
func download(org: String, repo: String, ref: String, format: GitHub.Format) throws -> EventLoopFuture<String>
Expand Down