Git Product home page Git Product logo

afterparty's Introduction

Hello ๐Ÿฆ

I'm on a curiosity voyage and these keys are my paddles ๐Ÿ‘จโ€๐Ÿ’ป


Rules of the road

  • What you learn while building is always more important than what you build
  • Be humble
  • Don't give up the ship
  • Learn with others when you can
  • You are not the code you write
  • Joy is experiencing life with others, spark it
  • Code is not an asset, it's a liability
  • It's okay to color out side the lines
  • It's okay to come a purler
  • Don't let perfect be the enemy of good
  • It probably needs more tests...

afterparty's People

Contributors

bombless avatar clux avatar hrothen avatar ms705 avatar softprops avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

afterparty's Issues

Rm clap dep

This project is now a library, not an app

example can not run

I just run the example and get a error

fn main() {
    let mut hub = Hub::new();
    hub.handle("*", |delivery: &Delivery| {
        println!("rec delivery {:#?}", delivery)
    });
    hub.handle_authenticated("pull_request", "secret", |delivery: &Delivery| {
       println!("rec authenticated delivery");
       match delivery.payload {
           Event::PullRequest { ref action, ref sender, .. } => {
               println!("sender {} action {}", sender.login, action)
           },
           _ => ()
       }
    });
    let srv = Server::http("0.0.0.0:4567").unwrap()
       .handle(hub.handle);
    println!("hub is up");
    srv.unwrap();
}

and error is

trait `for<'r, 'r, 'r> afterparty::Hub: std::ops::FnOnce<(hyper::server::Request<'r, 'r>, hyper::server::Response<'r>)>` not satisfied

What's the reason?

Redesign

Make it more straight forward to wrote in process handlers

Keep state across webhook deliveries

In Taster, I use afterparty to provide a regression testing service for Rust applications. As part of this, I need to keep some state across multiple webhook deliveries (namely, performance results from the previous delivery).

Unfortunately, the Hook implementation requires the closure passed to handle to be Fn, not FnMut, so I cannot have any mutable captures. However, such captures are required so that I can actually persist results across invocations.

Is this a restriction that could possibly be relaxed? I don't see any other way of implementing this use case.

(Likewise, I would like to use the closure passed to handle to only push a request to do some testing onto a work queue, rather than doing all the work before returning from the request, since GitHub keeps thinking that my webhooks time out when the testing takes a while. However, not being able to mutate anything from within the closure makes this impossible, too.)

(Cc @jonhoo)

parse errors on various events

Hey, I am trying to use this library for an experimental project. I really like how you are generating api bindings from example data ๐Ÿ˜„

However, using it I am getting tons of parse errors from various events when trying to run this at the moment. Here's output from the ping event:

afterparty: recv 'ping' event with signature 'Some(XHubSignature("sha1=e5cadd4c82bb46be2b19f3be79a7d0de4d8efa1b"))'
afterparty: failed to parse json SyntaxError(unknown field "type", 1, 81)
"{\"Ping\":{\"zen\":\"Responsive is better than fast.\",\"hook_id\":8872023,\"hook\":{\"type\":\"Repository\",\"id\":8872023,\"name\":\"web\",\"active\":true,\"events\":[\"issues\",\"issue_comment\",\"pull_request\",\"pull_request_review_comment\",\"push\",\"status\"],\"config\":{\"content_type\":\"json\",\"insecure_ssl\":\"0\",\"secret\":\"********\",\"url\":\"http://109.146.234.160:54857\"},\"updated_at\":\"2016-06-23T19:25:48Z\",\"created_at\":\"2016-06-23T19:25:48Z\",\"url\":\"https://api.github.com/repos/clux/volf/hooks/8872023\",\"test_url\":\"https://api.github.com/repos/clux/volf/hooks/8872023/test\",\"ping_url\":\"https://api.github.com/repos/clux/volf/hooks/8872023/pings\",\"last_response\":{\"code\":null,\"status\":\"unused\",\"message\":null}},\"repository\":{\"id\":61758654,\"name\":\"volf\",\"full_name\":\"clux/volf\",\"owner\":{\"login\":\"clux\",\"id\":134092,\"avatar_url\":\"https://avatars.githubusercontent.com/u/134092?v=3\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/clux\",\"html_url\":\"https://github.com/clux\",\"followers_url\":\"https://api.github.com/users/clux/followers\",\"following_url\":\"https://api.github.com/users/clux/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/clux/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/clux/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/clux/subscriptions\",\"organizations_url\":\"https://api.github.com/users/clux/orgs\",\"repos_url\":\"https://api.github.com/users/clux/repos\",\"events_url\":\"https://api.github.com/users/clux/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/clux/received_events\",\"type\":\"User\",\"site_admin\":false},\"private\":false,\"html_url\":\"https://github.com/clux/volf\",\"description\":\"A simple Github webhook bot (SKELETAL CODE ONLY SO FAR)\",\"fork\":false,\"url\":\"https://api.github.com/repos/clux/volf\",\"forks_url\":\"https://api.github.com/repos/clux/volf/forks\",\"keys_url\":\"https://api.github.com/repos/clux/volf/keys{/key_id}\",\"collaborators_url\":\"https://api.github.com/repos/clux/volf/collaborators{/collaborator}\",\"teams_url\":\"https://api.github.com/repos/clux/volf/teams\",\"hooks_url\":\"https://api.github.com/repos/clux/volf/hooks\",\"issue_events_url\":\"https://api.github.com/repos/clux/volf/issues/events{/number}\",\"events_url\":\"https://api.github.com/repos/clux/volf/events\",\"assignees_url\":\"https://api.github.com/repos/clux/volf/assignees{/user}\",\"branches_url\":\"https://api.github.com/repos/clux/volf/branches{/branch}\",\"tags_url\":\"https://api.github.com/repos/clux/volf/tags\",\"blobs_url\":\"https://api.github.com/repos/clux/volf/git/blobs{/sha}\",\"git_tags_url\":\"https://api.github.com/repos/clux/volf/git/tags{/sha}\",\"git_refs_url\":\"https://api.github.com/repos/clux/volf/git/refs{/sha}\",\"trees_url\":\"https://api.github.com/repos/clux/volf/git/trees{/sha}\",\"statuses_url\":\"https://api.github.com/repos/clux/volf/statuses/{sha}\",\"languages_url\":\"https://api.github.com/repos/clux/volf/languages\",\"stargazers_url\":\"https://api.github.com/repos/clux/volf/stargazers\",\"contributors_url\":\"https://api.github.com/repos/clux/volf/contributors\",\"subscribers_url\":\"https://api.github.com/repos/clux/volf/subscribers\",\"subscription_url\":\"https://api.github.com/repos/clux/volf/subscription\",\"commits_url\":\"https://api.github.com/repos/clux/volf/commits{/sha}\",\"git_commits_url\":\"https://api.github.com/repos/clux/volf/git/commits{/sha}\",\"comments_url\":\"https://api.github.com/repos/clux/volf/comments{/number}\",\"issue_comment_url\":\"https://api.github.com/repos/clux/volf/issues/comments{/number}\",\"contents_url\":\"https://api.github.com/repos/clux/volf/contents/{+path}\",\"compare_url\":\"https://api.github.com/repos/clux/volf/compare/{base}...{head}\",\"merges_url\":\"https://api.github.com/repos/clux/volf/merges\",\"archive_url\":\"https://api.github.com/repos/clux/volf/{archive_format}{/ref}\",\"downloads_url\":\"https://api.github.com/repos/clux/volf/downloads\",\"issues_url\":\"https://api.github.com/repos/clux/volf/issues{/number}\",\"pulls_url\":\"https://api.github.com/repos/clux/volf/pulls{/number}\",\"milestones_url\":\"https://api.github.com/repos/clux/volf/milestones{/number}\",\"notifications_url\":\"https://api.github.com/repos/clux/volf/notifications{?since,all,participating}\",\"labels_url\":\"https://api.github.com/repos/clux/volf/labels{/name}\",\"releases_url\":\"https://api.github.com/repos/clux/volf/releases{/id}\",\"deployments_url\":\"https://api.github.com/repos/clux/volf/deployments\",\"created_at\":\"2016-06-22T23:37:16Z\",\"updated_at\":\"2016-06-22T23:40:11Z\",\"pushed_at\":\"2016-06-22T23:39:47Z\",\"git_url\":\"git://github.com/clux/volf.git\",\"ssh_url\":\"[email protected]:clux/volf.git\",\"clone_url\":\"https://github.com/clux/volf.git\",\"svn_url\":\"https://github.com/clux/volf\",\"homepage\":\"\",\"size\":6,\"stargazers_count\":0,\"watchers_count\":0,\"language\":\"Rust\",\"has_issues\":true,\"has_downloads\":true,\"has_wiki\":true,\"has_pages\":false,\"forks_count\":0,\"mirror_url\":null,\"open_issues_count\":0,\"forks\":0,\"open_issues\":0,\"watchers\":0,\"default_branch\":\"master\"},\"sender\":{\"login\":\"clux\",\"id\":134092,\"avatar_url\":\"https://avatars.githubusercontent.com/u/134092?v=3\",\"gravatar_id\":\"\",\"url\":\"https://api.github.com/users/clux\",\"html_url\":\"https://github.com/clux\",\"followers_url\":\"https://api.github.com/users/clux/followers\",\"following_url\":\"https://api.github.com/users/clux/following{/other_user}\",\"gists_url\":\"https://api.github.com/users/clux/gists{/gist_id}\",\"starred_url\":\"https://api.github.com/users/clux/starred{/owner}{/repo}\",\"subscriptions_url\":\"https://api.github.com/users/clux/subscriptions\",\"organizations_url\":\"https://api.github.com/users/clux/orgs\",\"repos_url\":\"https://api.github.com/users/clux/repos\",\"events_url\":\"https://api.github.com/users/clux/events{/privacy}\",\"received_events_url\":\"https://api.github.com/users/clux/received_events\",\"type\":\"User\",\"site_admin\":false}}}"
afterparty: failed to parse event "ping" for delivery "49e54600-3978-11e6-8326-aa9bc862137f"

I cross-referenced the data sent with the data/schema you are using to build the Event type and it appears to miss out a couple of things.

Presumably this should just be a case of updating the data directory and rebuilding afterparty?

make code gen, gen less code

this is less than idea, and takes forever to compile

$ ls -trlh
total 9952
-rw-r--r--+ 1 doug  staff   144K Dec  1 15:24 events.rs.in
-rw-r--r--+ 1 doug  staff   4.7M Dec  1 15:24 events.rs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.