{"action":"created","comment":{"url":"https://api.github.com/repos/vapor-community/stripe-provider/pulls/comments/217889947","pull_request_review_id":155719196,"id":217889947,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNzg4OTk0Nw==","diff_hunk":"@@ -0,0 +1,101 @@\n+//\n+//  FileRoutes.swift\n+//  Stripe\n+//\n+//  Created by Andrew Edwards on 9/15/18.\n+//\n+\n+import Vapor\n+\n+public protocol FileRoutes {\n+    /// Uploads a file to Stripe\n+    ///\n+    /// - Parameters:\n+    ///   - file: A file to upload.\n+    ///   - purpose: The purpose of the uploaded file.\n+    ///   - filename: The name of the file.\n+    ///   - type: The MIME type of the file.\n+    /// - Returns: The file object.\n+    func upload(file: Data, purpose: FilePurpose, filename: String, type: FileType) throws -> Future<StripeFileUpload>\n+    \n+    /// Retrieves the details of an existing file object. Supply the unique file upload ID from a file creation request, and Stripe will return the corresponding transfer information.\n+    ///\n+    /// - Parameter id: The identifier of the file upload to be retrieved.\n+    /// - Returns: Returns a file upload object if a valid identifier was provided, and returns an error otherwise.\n+    func retrieve(id: String) throws -> Future<StripeFileUpload>\n+    \n+    /// Returns a list of the files that you have uploaded to Stripe. The file uploads are returned sorted by creation date, with the most recently created file uploads appearing first.\n+    ///\n+    /// - Parameter filter: A dictionary that contains the filters. More info [here](https://stripe.com/docs/api/curl#list_file_uploads).\n+    /// - Returns: A `FileUploadList`\n+    func listAll(filter: [String: Any]?) throws -> Future<FileUploadList>\n+}\n+\n+extension FileRoutes {\n+    public func upload(file: Data, purpose: FilePurpose, filename: String, type: FileType) throws -> Future<StripeFileUpload> {\n+        return try upload(file: file, purpose: purpose, filename: filename, type: type)\n+    }\n+    \n+    public func retrieve(id: String) throws -> Future<StripeFileUpload> {\n+        return try retrieve(id: id)\n+    }\n+    \n+    public func listAll(filter: [String: Any]? = nil) throws -> Future<FileUploadList> {\n+        return try listAll(filter: filter)\n+    }\n+}\n+\n+public struct StripeFileRoutes: FileRoutes {\n+    private let request: StripeRequest\n+    \n+    init(request: StripeRequest) {\n+        self.request = request\n+    }\n+    \n+    public func upload(file: Data, purpose: FilePurpose, filename: String, type: FileType) throws -> Future<StripeFileUpload> {\n+        var headers: HTTPHeaders = [:]\n+        var body: Data = Data()\n+        \n+        guard let fileType = MediaType.fileExtension(type.rawValue) else {\n+            throw StripeUploadError.unsupportedFileType\n+        }\n+        \n+        // Fordm data structure found here.\n+        // https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4\n+        \n+        let boundary = \"Stripe-Vapor-\\(UUID().uuidString)\"","path":"Sources/Stripe/API/Routes/FileRoutes.swift","position":66,"original_position":66,"commit_id":"853940c5abb5d295001252b392be5b66d993d241","original_commit_id":"853940c5abb5d295001252b392be5b66d993d241","user":{"login":"anthonycastelli","id":2137365,"node_id":"MDQ6VXNlcjIxMzczNjU=","avatar_url":"https://avatars0.githubusercontent.com/u/2137365?v=4","gravatar_id":"","url":"https://api.github.com/users/anthonycastelli","html_url":"https://github.com/anthonycastelli","followers_url":"https://api.github.com/users/anthonycastelli/followers","following_url":"https://api.github.com/users/anthonycastelli/following{/other_user}","gists_url":"https://api.github.com/users/anthonycastelli/gists{/gist_id}","starred_url":"https://api.github.com/users/anthonycastelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anthonycastelli/subscriptions","organizations_url":"https://api.github.com/users/anthonycastelli/orgs","repos_url":"https://api.github.com/users/anthonycastelli/repos","events_url":"https://api.github.com/users/anthonycastelli/events{/privacy}","received_events_url":"https://api.github.com/users/anthonycastelli/received_events","type":"User","site_admin":false},"body":"Vapor has a Mutlipart library that you can import to take care of all this heavy lifting. I'm not sure how it all works in Vapor 3, but I know it's still around. ","created_at":"2018-09-15T16:59:22Z","updated_at":"2018-09-15T16:59:51Z","html_url":"https://github.com/vapor-community/stripe-provider/pull/67#discussion_r217889947","pull_request_url":"https://api.github.com/repos/vapor-community/stripe-provider/pulls/67","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/vapor-community/stripe-provider/pulls/comments/217889947"},"html":{"href":"https://github.com/vapor-community/stripe-provider/pull/67#discussion_r217889947"},"pull_request":{"href":"https://api.github.com/repos/vapor-community/stripe-provider/pulls/67"}}},"pull_request":{"url":"https://api.github.com/repos/vapor-community/stripe-provider/pulls/67","id":215778279,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE1Nzc4Mjc5","html_url":"https://github.com/vapor-community/stripe-provider/pull/67","diff_url":"https://github.com/vapor-community/stripe-provider/pull/67.diff","patch_url":"https://github.com/vapor-community/stripe-provider/pull/67.patch","issue_url":"https://api.github.com/repos/vapor-community/stripe-provider/issues/67","number":67,"state":"open","locked":false,"title":"Files implementation","user":{"login":"Andrewangeta","id":12012815,"node_id":"MDQ6VXNlcjEyMDEyODE1","avatar_url":"https://avatars2.githubusercontent.com/u/12012815?v=4","gravatar_id":"","url":"https://api.github.com/users/Andrewangeta","html_url":"https://github.com/Andrewangeta","followers_url":"https://api.github.com/users/Andrewangeta/followers","following_url":"https://api.github.com/users/Andrewangeta/following{/other_user}","gists_url":"https://api.github.com/users/Andrewangeta/gists{/gist_id}","starred_url":"https://api.github.com/users/Andrewangeta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Andrewangeta/subscriptions","organizations_url":"https://api.github.com/users/Andrewangeta/orgs","repos_url":"https://api.github.com/users/Andrewangeta/repos","events_url":"https://api.github.com/users/Andrewangeta/events{/privacy}","received_events_url":"https://api.github.com/users/Andrewangeta/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-09-15T16:49:19Z","updated_at":"2018-09-15T16:59:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"94538f3b0b278647b29af279991d5daa57344ea3","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/vapor-community/stripe-provider/pulls/67/commits","review_comments_url":"https://api.github.com/repos/vapor-community/stripe-provider/pulls/67/comments","review_comment_url":"https://api.github.com/repos/vapor-community/stripe-provider/pulls/comments{/number}","comments_url":"https://api.github.com/repos/vapor-community/stripe-provider/issues/67/comments","statuses_url":"https://api.github.com/repos/vapor-community/stripe-provider/statuses/853940c5abb5d295001252b392be5b66d993d241","head":{"label":"vapor-community:files","ref":"files","sha":"853940c5abb5d295001252b392be5b66d993d241","user":{"login":"vapor-community","id":26165732,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2MTY1NzMy","avatar_url":"https://avatars0.githubusercontent.com/u/26165732?v=4","gravatar_id":"","url":"https://api.github.com/users/vapor-community","html_url":"https://github.com/vapor-community","followers_url":"https://api.github.com/users/vapor-community/followers","following_url":"https://api.github.com/users/vapor-community/following{/other_user}","gists_url":"https://api.github.com/users/vapor-community/gists{/gist_id}","starred_url":"https://api.github.com/users/vapor-community/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vapor-community/subscriptions","organizations_url":"https://api.github.com/users/vapor-community/orgs","repos_url":"https://api.github.com/users/vapor-community/repos","events_url":"https://api.github.com/users/vapor-community/events{/privacy}","received_events_url":"https://api.github.com/users/vapor-community/received_events","type":"Organization","site_admin":false},"repo":{"id":88382271,"node_id":"MDEwOlJlcG9zaXRvcnk4ODM4MjI3MQ==","name":"stripe-provider","full_name":"vapor-community/stripe-provider","private":false,"owner":{"login":"vapor-community","id":26165732,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2MTY1NzMy","avatar_url":"https://avatars0.githubusercontent.com/u/26165732?v=4","gravatar_id":"","url":"https://api.github.com/users/vapor-community","html_url":"https://github.com/vapor-community","followers_url":"https://api.github.com/users/vapor-community/followers","following_url":"https://api.github.com/users/vapor-community/following{/other_user}","gists_url":"https://api.github.com/users/vapor-community/gists{/gist_id}","starred_url":"https://api.github.com/users/vapor-community/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vapor-community/subscriptions","organizations_url":"https://api.github.com/users/vapor-community/orgs","repos_url":"https://api.github.com/users/vapor-community/repos","events_url":"https://api.github.com/users/vapor-community/events{/privacy}","received_events_url":"https://api.github.com/users/vapor-community/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/vapor-community/stripe-provider","description":"Stripe Provider for Vapor","fork":false,"url":"https://api.github.com/repos/vapor-community/stripe-provider","forks_url":"https://api.github.com/repos/vapor-community/stripe-provider/forks","keys_url":"https://api.github.com/repos/vapor-community/stripe-provider/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vapor-community/stripe-provider/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vapor-community/stripe-provider/teams","hooks_url":"https://api.github.com/repos/vapor-community/stripe-provider/hooks","issue_events_url":"https://api.github.com/repos/vapor-community/stripe-provider/issues/events{/number}","events_url":"https://api.github.com/repos/vapor-community/stripe-provider/events","assignees_url":"https://api.github.com/repos/vapor-community/stripe-provider/assignees{/user}","branches_url":"https://api.github.com/repos/vapor-community/stripe-provider/branches{/branch}","tags_url":"https://api.github.com/repos/vapor-community/stripe-provider/tags","blobs_url":"https://api.github.com/repos/vapor-community/stripe-provider/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vapor-community/stripe-provider/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vapor-community/stripe-provider/git/refs{/sha}","trees_url":"https://api.github.com/repos/vapor-community/stripe-provider/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vapor-community/stripe-provider/statuses/{sha}","languages_url":"https://api.github.com/repos/vapor-community/stripe-provider/languages","stargazers_url":"https://api.github.com/repos/vapor-community/stripe-provider/stargazers","contributors_url":"https://api.github.com/repos/vapor-community/stripe-provider/contributors","subscribers_url":"https://api.github.com/repos/vapor-community/stripe-provider/subscribers","subscription_url":"https://api.github.com/repos/vapor-community/stripe-provider/subscription","commits_url":"https://api.github.com/repos/vapor-community/stripe-provider/commits{/sha}","git_commits_url":"https://api.github.com/repos/vapor-community/stripe-provider/git/commits{/sha}","comments_url":"https://api.github.com/repos/vapor-community/stripe-provider/comments{/number}","issue_comment_url":"https://api.github.com/repos/vapor-community/stripe-provider/issues/comments{/number}","contents_url":"https://api.github.com/repos/vapor-community/stripe-provider/contents/{+path}","compare_url":"https://api.github.com/repos/vapor-community/stripe-provider/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vapor-community/stripe-provider/merges","archive_url":"https://api.github.com/repos/vapor-community/stripe-provider/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vapor-community/stripe-provider/downloads","issues_url":"https://api.github.com/repos/vapor-community/stripe-provider/issues{/number}","pulls_url":"https://api.github.com/repos/vapor-community/stripe-provider/pulls{/number}","milestones_url":"https://api.github.com/repos/vapor-community/stripe-provider/milestones{/number}","notifications_url":"https://api.github.com/repos/vapor-community/stripe-provider/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vapor-community/stripe-provider/labels{/name}","releases_url":"https://api.github.com/repos/vapor-community/stripe-provider/releases{/id}","deployments_url":"https://api.github.com/repos/vapor-community/stripe-provider/deployments","created_at":"2017-04-16T00:41:03Z","updated_at":"2018-09-15T16:40:37Z","pushed_at":"2018-09-15T16:49:19Z","git_url":"git://github.com/vapor-community/stripe-provider.git","ssh_url":"git@github.com:vapor-community/stripe-provider.git","clone_url":"https://github.com/vapor-community/stripe-provider.git","svn_url":"https://github.com/vapor-community/stripe-provider","homepage":"","size":831,"stargazers_count":80,"watchers_count":80,"language":"Swift","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":18,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":18,"open_issues":6,"watchers":80,"default_branch":"master"}},"base":{"label":"vapor-community:master","ref":"master","sha":"8a1390c2622da53fec60d8d311e0069e41f2b195","user":{"login":"vapor-community","id":26165732,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2MTY1NzMy","avatar_url":"https://avatars0.githubusercontent.com/u/26165732?v=4","gravatar_id":"","url":"https://api.github.com/users/vapor-community","html_url":"https://github.com/vapor-community","followers_url":"https://api.github.com/users/vapor-community/followers","following_url":"https://api.github.com/users/vapor-community/following{/other_user}","gists_url":"https://api.github.com/users/vapor-community/gists{/gist_id}","starred_url":"https://api.github.com/users/vapor-community/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vapor-community/subscriptions","organizations_url":"https://api.github.com/users/vapor-community/orgs","repos_url":"https://api.github.com/users/vapor-community/repos","events_url":"https://api.github.com/users/vapor-community/events{/privacy}","received_events_url":"https://api.github.com/users/vapor-community/received_events","type":"Organization","site_admin":false},"repo":{"id":88382271,"node_id":"MDEwOlJlcG9zaXRvcnk4ODM4MjI3MQ==","name":"stripe-provider","full_name":"vapor-community/stripe-provider","private":false,"owner":{"login":"vapor-community","id":26165732,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2MTY1NzMy","avatar_url":"https://avatars0.githubusercontent.com/u/26165732?v=4","gravatar_id":"","url":"https://api.github.com/users/vapor-community","html_url":"https://github.com/vapor-community","followers_url":"https://api.github.com/users/vapor-community/followers","following_url":"https://api.github.com/users/vapor-community/following{/other_user}","gists_url":"https://api.github.com/users/vapor-community/gists{/gist_id}","starred_url":"https://api.github.com/users/vapor-community/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vapor-community/subscriptions","organizations_url":"https://api.github.com/users/vapor-community/orgs","repos_url":"https://api.github.com/users/vapor-community/repos","events_url":"https://api.github.com/users/vapor-community/events{/privacy}","received_events_url":"https://api.github.com/users/vapor-community/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/vapor-community/stripe-provider","description":"Stripe Provider for Vapor","fork":false,"url":"https://api.github.com/repos/vapor-community/stripe-provider","forks_url":"https://api.github.com/repos/vapor-community/stripe-provider/forks","keys_url":"https://api.github.com/repos/vapor-community/stripe-provider/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vapor-community/stripe-provider/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vapor-community/stripe-provider/teams","hooks_url":"https://api.github.com/repos/vapor-community/stripe-provider/hooks","issue_events_url":"https://api.github.com/repos/vapor-community/stripe-provider/issues/events{/number}","events_url":"https://api.github.com/repos/vapor-community/stripe-provider/events","assignees_url":"https://api.github.com/repos/vapor-community/stripe-provider/assignees{/user}","branches_url":"https://api.github.com/repos/vapor-community/stripe-provider/branches{/branch}","tags_url":"https://api.github.com/repos/vapor-community/stripe-provider/tags","blobs_url":"https://api.github.com/repos/vapor-community/stripe-provider/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vapor-community/stripe-provider/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vapor-community/stripe-provider/git/refs{/sha}","trees_url":"https://api.github.com/repos/vapor-community/stripe-provider/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vapor-community/stripe-provider/statuses/{sha}","languages_url":"https://api.github.com/repos/vapor-community/stripe-provider/languages","stargazers_url":"https://api.github.com/repos/vapor-community/stripe-provider/stargazers","contributors_url":"https://api.github.com/repos/vapor-community/stripe-provider/contributors","subscribers_url":"https://api.github.com/repos/vapor-community/stripe-provider/subscribers","subscription_url":"https://api.github.com/repos/vapor-community/stripe-provider/subscription","commits_url":"https://api.github.com/repos/vapor-community/stripe-provider/commits{/sha}","git_commits_url":"https://api.github.com/repos/vapor-community/stripe-provider/git/commits{/sha}","comments_url":"https://api.github.com/repos/vapor-community/stripe-provider/comments{/number}","issue_comment_url":"https://api.github.com/repos/vapor-community/stripe-provider/issues/comments{/number}","contents_url":"https://api.github.com/repos/vapor-community/stripe-provider/contents/{+path}","compare_url":"https://api.github.com/repos/vapor-community/stripe-provider/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vapor-community/stripe-provider/merges","archive_url":"https://api.github.com/repos/vapor-community/stripe-provider/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vapor-community/stripe-provider/downloads","issues_url":"https://api.github.com/repos/vapor-community/stripe-provider/issues{/number}","pulls_url":"https://api.github.com/repos/vapor-community/stripe-provider/pulls{/number}","milestones_url":"https://api.github.com/repos/vapor-community/stripe-provider/milestones{/number}","notifications_url":"https://api.github.com/repos/vapor-community/stripe-provider/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vapor-community/stripe-provider/labels{/name}","releases_url":"https://api.github.com/repos/vapor-community/stripe-provider/releases{/id}","deployments_url":"https://api.github.com/repos/vapor-community/stripe-provider/deployments","created_at":"2017-04-16T00:41:03Z","updated_at":"2018-09-15T16:40:37Z","pushed_at":"2018-09-15T16:49:19Z","git_url":"git://github.com/vapor-community/stripe-provider.git","ssh_url":"git@github.com:vapor-community/stripe-provider.git","clone_url":"https://github.com/vapor-community/stripe-provider.git","svn_url":"https://github.com/vapor-community/stripe-provider","homepage":"","size":831,"stargazers_count":80,"watchers_count":80,"language":"Swift","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":18,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":18,"open_issues":6,"watchers":80,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/vapor-community/stripe-provider/pulls/67"},"html":{"href":"https://github.com/vapor-community/stripe-provider/pull/67"},"issue":{"href":"https://api.github.com/repos/vapor-community/stripe-provider/issues/67"},"comments":{"href":"https://api.github.com/repos/vapor-community/stripe-provider/issues/67/comments"},"review_comments":{"href":"https://api.github.com/repos/vapor-community/stripe-provider/pulls/67/comments"},"review_comment":{"href":"https://api.github.com/repos/vapor-community/stripe-provider/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/vapor-community/stripe-provider/pulls/67/commits"},"statuses":{"href":"https://api.github.com/repos/vapor-community/stripe-provider/statuses/853940c5abb5d295001252b392be5b66d993d241"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"anthonycastelli"}}