{"action":"created","comment":{"url":"https://api.github.com/repos/fnproject/fn/pulls/comments/177245830","pull_request_review_id":107085912,"id":177245830,"diff_hunk":"@@ -55,14 +55,16 @@ var (\n \tbufPool = &sync.Pool{New: func() interface{} { return new(bytes.Buffer) }}\n )\n \n-// TODO it would be nice if we could make this have nothing to do with the gin.Context but meh\n-// TODO make async store an *http.Request? would be sexy until we have different api format...\n-func (s *Server) serve(c *gin.Context, app *models.App, path string) error {\n+// CallFunction exposed to become the API extension, to let API listeners to be capable to call a functions\n+// defined by app and path\n+func (s *Server) CallFunction(app *models.App, path string, req *http.Request,\n+\trespWriter http.ResponseWriter) (*string, io.Reader, error) {","path":"api/server/runner.go","position":10,"original_position":10,"commit_id":"dae3028feb4920d89cdc5c90a29093a9207812fd","original_commit_id":"dae3028feb4920d89cdc5c90a29093a9207812fd","user":{"login":"rdallman","id":2935111,"avatar_url":"https://avatars0.githubusercontent.com/u/2935111?v=4","gravatar_id":"","url":"https://api.github.com/users/rdallman","html_url":"https://github.com/rdallman","followers_url":"https://api.github.com/users/rdallman/followers","following_url":"https://api.github.com/users/rdallman/following{/other_user}","gists_url":"https://api.github.com/users/rdallman/gists{/gist_id}","starred_url":"https://api.github.com/users/rdallman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdallman/subscriptions","organizations_url":"https://api.github.com/users/rdallman/orgs","repos_url":"https://api.github.com/users/rdallman/repos","events_url":"https://api.github.com/users/rdallman/events{/privacy}","received_events_url":"https://api.github.com/users/rdallman/received_events","type":"User","site_admin":false},"body":"with the general idea here, thought we had done this already for some reason. this does seem an odd signature for an extension to be able to fulfill. most of our extensions are either based around http req/resp or the app/route and don't seem likely to have a handle on all of these. a lot of the stuff in here is also pretty specific to our http endpoint and not necessarily relevant to the extension caller (error handling, wait time, async, etc).\r\n\r\nseems like:\r\n\r\n```\r\nvar out bytes.Buffer\r\ncall, err := Server.Agent.GetCall(agent.FromRequest(req), agent.WithWriter(&out))\r\nerr := Server.Agent.Submit(call)\r\n```\r\n\r\nis more in line with what extensions would want, and it's flexible for the extension to do this based on whatever they have, be it a request or an app/route (we can add options to make this easier), or build a model, etc. we could tidy this up into a one liner easily enough. the proposed plumbing here just seems a little off. exposing agent is easy, not sure if it's the right plumbing, either, though.","created_at":"2018-03-26T21:49:18Z","updated_at":"2018-03-26T21:49:19Z","html_url":"https://github.com/fnproject/fn/pull/892#discussion_r177245830","pull_request_url":"https://api.github.com/repos/fnproject/fn/pulls/892","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/fnproject/fn/pulls/comments/177245830"},"html":{"href":"https://github.com/fnproject/fn/pull/892#discussion_r177245830"},"pull_request":{"href":"https://api.github.com/repos/fnproject/fn/pulls/892"}}},"pull_request":{"url":"https://api.github.com/repos/fnproject/fn/pulls/892","id":177573025,"html_url":"https://github.com/fnproject/fn/pull/892","diff_url":"https://github.com/fnproject/fn/pull/892.diff","patch_url":"https://github.com/fnproject/fn/pull/892.patch","issue_url":"https://api.github.com/repos/fnproject/fn/issues/892","number":892,"state":"open","locked":false,"title":"Expose func call as the extensions API","user":{"login":"denismakogon","id":3034091,"avatar_url":"https://avatars1.githubusercontent.com/u/3034091?v=4","gravatar_id":"","url":"https://api.github.com/users/denismakogon","html_url":"https://github.com/denismakogon","followers_url":"https://api.github.com/users/denismakogon/followers","following_url":"https://api.github.com/users/denismakogon/following{/other_user}","gists_url":"https://api.github.com/users/denismakogon/gists{/gist_id}","starred_url":"https://api.github.com/users/denismakogon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denismakogon/subscriptions","organizations_url":"https://api.github.com/users/denismakogon/orgs","repos_url":"https://api.github.com/users/denismakogon/repos","events_url":"https://api.github.com/users/denismakogon/events{/privacy}","received_events_url":"https://api.github.com/users/denismakogon/received_events","type":"User","site_admin":false},"body":"The purpose of the PR is to expose an API in the extension manner, so the developers can use this to call the functions inside the extensions, specifically, listeners (note, that existing middleware `CallFunction` can be consumed only within the middleware, but not the listeners). So, given refactoring brings capabilities of the listeners to the same level of the middleware.\r\n\r\nThere is no impact to existing API.\r\nNew method suppose to be (or become) fewer HTTP-aligned.\r\n\r\nPlease note, that, eventually, this method should become trigger-agnostic and just accept a call for the execution, so any HTTP-(or whatever)-specific configuration should happen outside of this method to give unimaginable freedom of choice.\r\n","created_at":"2018-03-26T21:28:26Z","updated_at":"2018-03-26T21:49:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8ad33d9fcba46a3eb225a7f9fc31fc5078ba4db5","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/fnproject/fn/pulls/892/commits","review_comments_url":"https://api.github.com/repos/fnproject/fn/pulls/892/comments","review_comment_url":"https://api.github.com/repos/fnproject/fn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fnproject/fn/issues/892/comments","statuses_url":"https://api.github.com/repos/fnproject/fn/statuses/dae3028feb4920d89cdc5c90a29093a9207812fd","head":{"label":"fnproject:expose-call-func","ref":"expose-call-func","sha":"dae3028feb4920d89cdc5c90a29093a9207812fd","user":{"login":"fnproject","id":30273834,"avatar_url":"https://avatars2.githubusercontent.com/u/30273834?v=4","gravatar_id":"","url":"https://api.github.com/users/fnproject","html_url":"https://github.com/fnproject","followers_url":"https://api.github.com/users/fnproject/followers","following_url":"https://api.github.com/users/fnproject/following{/other_user}","gists_url":"https://api.github.com/users/fnproject/gists{/gist_id}","starred_url":"https://api.github.com/users/fnproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fnproject/subscriptions","organizations_url":"https://api.github.com/users/fnproject/orgs","repos_url":"https://api.github.com/users/fnproject/repos","events_url":"https://api.github.com/users/fnproject/events{/privacy}","received_events_url":"https://api.github.com/users/fnproject/received_events","type":"Organization","site_admin":false},"repo":{"id":97652025,"name":"fn","full_name":"fnproject/fn","owner":{"login":"fnproject","id":30273834,"avatar_url":"https://avatars2.githubusercontent.com/u/30273834?v=4","gravatar_id":"","url":"https://api.github.com/users/fnproject","html_url":"https://github.com/fnproject","followers_url":"https://api.github.com/users/fnproject/followers","following_url":"https://api.github.com/users/fnproject/following{/other_user}","gists_url":"https://api.github.com/users/fnproject/gists{/gist_id}","starred_url":"https://api.github.com/users/fnproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fnproject/subscriptions","organizations_url":"https://api.github.com/users/fnproject/orgs","repos_url":"https://api.github.com/users/fnproject/repos","events_url":"https://api.github.com/users/fnproject/events{/privacy}","received_events_url":"https://api.github.com/users/fnproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fnproject/fn","description":"The container native, cloud agnostic serverless platform.","fork":false,"url":"https://api.github.com/repos/fnproject/fn","forks_url":"https://api.github.com/repos/fnproject/fn/forks","keys_url":"https://api.github.com/repos/fnproject/fn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fnproject/fn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fnproject/fn/teams","hooks_url":"https://api.github.com/repos/fnproject/fn/hooks","issue_events_url":"https://api.github.com/repos/fnproject/fn/issues/events{/number}","events_url":"https://api.github.com/repos/fnproject/fn/events","assignees_url":"https://api.github.com/repos/fnproject/fn/assignees{/user}","branches_url":"https://api.github.com/repos/fnproject/fn/branches{/branch}","tags_url":"https://api.github.com/repos/fnproject/fn/tags","blobs_url":"https://api.github.com/repos/fnproject/fn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fnproject/fn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fnproject/fn/git/refs{/sha}","trees_url":"https://api.github.com/repos/fnproject/fn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fnproject/fn/statuses/{sha}","languages_url":"https://api.github.com/repos/fnproject/fn/languages","stargazers_url":"https://api.github.com/repos/fnproject/fn/stargazers","contributors_url":"https://api.github.com/repos/fnproject/fn/contributors","subscribers_url":"https://api.github.com/repos/fnproject/fn/subscribers","subscription_url":"https://api.github.com/repos/fnproject/fn/subscription","commits_url":"https://api.github.com/repos/fnproject/fn/commits{/sha}","git_commits_url":"https://api.github.com/repos/fnproject/fn/git/commits{/sha}","comments_url":"https://api.github.com/repos/fnproject/fn/comments{/number}","issue_comment_url":"https://api.github.com/repos/fnproject/fn/issues/comments{/number}","contents_url":"https://api.github.com/repos/fnproject/fn/contents/{+path}","compare_url":"https://api.github.com/repos/fnproject/fn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fnproject/fn/merges","archive_url":"https://api.github.com/repos/fnproject/fn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fnproject/fn/downloads","issues_url":"https://api.github.com/repos/fnproject/fn/issues{/number}","pulls_url":"https://api.github.com/repos/fnproject/fn/pulls{/number}","milestones_url":"https://api.github.com/repos/fnproject/fn/milestones{/number}","notifications_url":"https://api.github.com/repos/fnproject/fn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fnproject/fn/labels{/name}","releases_url":"https://api.github.com/repos/fnproject/fn/releases{/id}","deployments_url":"https://api.github.com/repos/fnproject/fn/deployments","created_at":"2017-07-18T23:22:46Z","updated_at":"2018-03-26T21:40:59Z","pushed_at":"2018-03-26T21:41:28Z","git_url":"git://github.com/fnproject/fn.git","ssh_url":"git@github.com:fnproject/fn.git","clone_url":"https://github.com/fnproject/fn.git","svn_url":"https://github.com/fnproject/fn","homepage":"http://fnproject.io","size":148191,"stargazers_count":2519,"watchers_count":2519,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":171,"mirror_url":null,"archived":false,"open_issues_count":106,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":171,"open_issues":106,"watchers":2519,"default_branch":"master"}},"base":{"label":"fnproject:master","ref":"master","sha":"a567b88370b542e8f080acc080c1fd2eb4280e5f","user":{"login":"fnproject","id":30273834,"avatar_url":"https://avatars2.githubusercontent.com/u/30273834?v=4","gravatar_id":"","url":"https://api.github.com/users/fnproject","html_url":"https://github.com/fnproject","followers_url":"https://api.github.com/users/fnproject/followers","following_url":"https://api.github.com/users/fnproject/following{/other_user}","gists_url":"https://api.github.com/users/fnproject/gists{/gist_id}","starred_url":"https://api.github.com/users/fnproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fnproject/subscriptions","organizations_url":"https://api.github.com/users/fnproject/orgs","repos_url":"https://api.github.com/users/fnproject/repos","events_url":"https://api.github.com/users/fnproject/events{/privacy}","received_events_url":"https://api.github.com/users/fnproject/received_events","type":"Organization","site_admin":false},"repo":{"id":97652025,"name":"fn","full_name":"fnproject/fn","owner":{"login":"fnproject","id":30273834,"avatar_url":"https://avatars2.githubusercontent.com/u/30273834?v=4","gravatar_id":"","url":"https://api.github.com/users/fnproject","html_url":"https://github.com/fnproject","followers_url":"https://api.github.com/users/fnproject/followers","following_url":"https://api.github.com/users/fnproject/following{/other_user}","gists_url":"https://api.github.com/users/fnproject/gists{/gist_id}","starred_url":"https://api.github.com/users/fnproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fnproject/subscriptions","organizations_url":"https://api.github.com/users/fnproject/orgs","repos_url":"https://api.github.com/users/fnproject/repos","events_url":"https://api.github.com/users/fnproject/events{/privacy}","received_events_url":"https://api.github.com/users/fnproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fnproject/fn","description":"The container native, cloud agnostic serverless platform.","fork":false,"url":"https://api.github.com/repos/fnproject/fn","forks_url":"https://api.github.com/repos/fnproject/fn/forks","keys_url":"https://api.github.com/repos/fnproject/fn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fnproject/fn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fnproject/fn/teams","hooks_url":"https://api.github.com/repos/fnproject/fn/hooks","issue_events_url":"https://api.github.com/repos/fnproject/fn/issues/events{/number}","events_url":"https://api.github.com/repos/fnproject/fn/events","assignees_url":"https://api.github.com/repos/fnproject/fn/assignees{/user}","branches_url":"https://api.github.com/repos/fnproject/fn/branches{/branch}","tags_url":"https://api.github.com/repos/fnproject/fn/tags","blobs_url":"https://api.github.com/repos/fnproject/fn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fnproject/fn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fnproject/fn/git/refs{/sha}","trees_url":"https://api.github.com/repos/fnproject/fn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fnproject/fn/statuses/{sha}","languages_url":"https://api.github.com/repos/fnproject/fn/languages","stargazers_url":"https://api.github.com/repos/fnproject/fn/stargazers","contributors_url":"https://api.github.com/repos/fnproject/fn/contributors","subscribers_url":"https://api.github.com/repos/fnproject/fn/subscribers","subscription_url":"https://api.github.com/repos/fnproject/fn/subscription","commits_url":"https://api.github.com/repos/fnproject/fn/commits{/sha}","git_commits_url":"https://api.github.com/repos/fnproject/fn/git/commits{/sha}","comments_url":"https://api.github.com/repos/fnproject/fn/comments{/number}","issue_comment_url":"https://api.github.com/repos/fnproject/fn/issues/comments{/number}","contents_url":"https://api.github.com/repos/fnproject/fn/contents/{+path}","compare_url":"https://api.github.com/repos/fnproject/fn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fnproject/fn/merges","archive_url":"https://api.github.com/repos/fnproject/fn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fnproject/fn/downloads","issues_url":"https://api.github.com/repos/fnproject/fn/issues{/number}","pulls_url":"https://api.github.com/repos/fnproject/fn/pulls{/number}","milestones_url":"https://api.github.com/repos/fnproject/fn/milestones{/number}","notifications_url":"https://api.github.com/repos/fnproject/fn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fnproject/fn/labels{/name}","releases_url":"https://api.github.com/repos/fnproject/fn/releases{/id}","deployments_url":"https://api.github.com/repos/fnproject/fn/deployments","created_at":"2017-07-18T23:22:46Z","updated_at":"2018-03-26T21:40:59Z","pushed_at":"2018-03-26T21:41:28Z","git_url":"git://github.com/fnproject/fn.git","ssh_url":"git@github.com:fnproject/fn.git","clone_url":"https://github.com/fnproject/fn.git","svn_url":"https://github.com/fnproject/fn","homepage":"http://fnproject.io","size":148191,"stargazers_count":2519,"watchers_count":2519,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":171,"mirror_url":null,"archived":false,"open_issues_count":106,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":171,"open_issues":106,"watchers":2519,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fnproject/fn/pulls/892"},"html":{"href":"https://github.com/fnproject/fn/pull/892"},"issue":{"href":"https://api.github.com/repos/fnproject/fn/issues/892"},"comments":{"href":"https://api.github.com/repos/fnproject/fn/issues/892/comments"},"review_comments":{"href":"https://api.github.com/repos/fnproject/fn/pulls/892/comments"},"review_comment":{"href":"https://api.github.com/repos/fnproject/fn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fnproject/fn/pulls/892/commits"},"statuses":{"href":"https://api.github.com/repos/fnproject/fn/statuses/dae3028feb4920d89cdc5c90a29093a9207812fd"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"rdallman"}}