shanebarringer / webhook-concept

1 stars 0 forks source link

Log Payload #2

Open shanebarringer opened 6 years ago

shanebarringer commented 6 years ago

logging payload

shanebarringer commented 6 years ago

log payload.issue

shanebarringer commented 6 years ago

modifies payload

shanebarringer commented 6 years ago

destructures payload

response =

{ action: 'created',
  issue:
   { url: 'https://api.github.com/repos/shanebarringer/webhook-concept/issues/2',
     repository_url: 'https://api.github.com/repos/shanebarringer/webhook-concept',
     labels_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/issues/2/labels{/name}',
     comments_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/issues/2/comments',
     events_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/issues/2/events',
     html_url: 'https://github.com/shanebarringer/webhook-concept/issues/2',
     id: 308192676,
     number: 2,
     title: 'Log Payload',
     user:
      { login: 'shanebarringer',
        id: 6509923,
        avatar_url: 'https://avatars3.githubusercontent.com/u/6509923?v=4',
        gravatar_id: '',
        url: 'https://api.github.com/users/shanebarringer',
        html_url: 'https://github.com/shanebarringer',
        followers_url: 'https://api.github.com/users/shanebarringer/followers',
        following_url: 'https://api.github.com/users/shanebarringer/following{/other_user}',
        gists_url: 'https://api.github.com/users/shanebarringer/gists{/gist_id}',
        starred_url: 'https://api.github.com/users/shanebarringer/starred{/owner}{/repo}',
        subscriptions_url: 'https://api.github.com/users/shanebarringer/subscriptions',
        organizations_url: 'https://api.github.com/users/shanebarringer/orgs',
        repos_url: 'https://api.github.com/users/shanebarringer/repos',
        events_url: 'https://api.github.com/users/shanebarringer/events{/privacy}',
        received_events_url: 'https://api.github.com/users/shanebarringer/received_events',
        type: 'User',
        site_admin: false },
     labels: [],
     state: 'open',
     locked: false,
     assignee: null,
     assignees: [],
     milestone: null,
     comments: 4,
     created_at: '2018-03-23T22:08:47Z',
     updated_at: '2018-03-23T22:11:49Z',
     closed_at: null,
     author_association: 'OWNER',
     body: 'logging payload' },
  comment:
   { url: 'https://api.github.com/repos/shanebarringer/webhook-concept/issues/comments/375811886',
     html_url: 'https://github.com/shanebarringer/webhook-concept/issues/2#issuecomment-375811886',
     issue_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/issues/2',
     id: 375811886,
     user:
      { login: 'shanebarringer',
        id: 6509923,
        avatar_url: 'https://avatars3.githubusercontent.com/u/6509923?v=4',
        gravatar_id: '',
        url: 'https://api.github.com/users/shanebarringer',
        html_url: 'https://github.com/shanebarringer',
        followers_url: 'https://api.github.com/users/shanebarringer/followers',
        following_url: 'https://api.github.com/users/shanebarringer/following{/other_user}',
        gists_url: 'https://api.github.com/users/shanebarringer/gists{/gist_id}',
        starred_url: 'https://api.github.com/users/shanebarringer/starred{/owner}{/repo}',
        subscriptions_url: 'https://api.github.com/users/shanebarringer/subscriptions',
        organizations_url: 'https://api.github.com/users/shanebarringer/orgs',
        repos_url: 'https://api.github.com/users/shanebarringer/repos',
        events_url: 'https://api.github.com/users/shanebarringer/events{/privacy}',
        received_events_url: 'https://api.github.com/users/shanebarringer/received_events',
        type: 'User',
        site_admin: false },
     created_at: '2018-03-23T22:11:49Z',
     updated_at: '2018-03-23T22:11:49Z',
     author_association: 'OWNER',
     body: 'parsing' },
  repository:
   { id: 126538464,
     name: 'webhook-concept',
     full_name: 'shanebarringer/webhook-concept',
     owner:
      { login: 'shanebarringer',
        id: 6509923,
        avatar_url: 'https://avatars3.githubusercontent.com/u/6509923?v=4',
        gravatar_id: '',
        url: 'https://api.github.com/users/shanebarringer',
        html_url: 'https://github.com/shanebarringer',
        followers_url: 'https://api.github.com/users/shanebarringer/followers',
        following_url: 'https://api.github.com/users/shanebarringer/following{/other_user}',
        gists_url: 'https://api.github.com/users/shanebarringer/gists{/gist_id}',
        starred_url: 'https://api.github.com/users/shanebarringer/starred{/owner}{/repo}',
        subscriptions_url: 'https://api.github.com/users/shanebarringer/subscriptions',
        organizations_url: 'https://api.github.com/users/shanebarringer/orgs',
        repos_url: 'https://api.github.com/users/shanebarringer/repos',
        events_url: 'https://api.github.com/users/shanebarringer/events{/privacy}',
        received_events_url: 'https://api.github.com/users/shanebarringer/received_events',
        type: 'User',
        site_admin: false },
     private: false,
     html_url: 'https://github.com/shanebarringer/webhook-concept',
     description: null,
     fork: false,
     url: 'https://api.github.com/repos/shanebarringer/webhook-concept',
     forks_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/forks',
     keys_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/keys{/key_id}',
     collaborators_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/collaborators{/collaborator}',
     teams_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/teams',
     hooks_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/hooks',
     issue_events_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/issues/events{/number}',
     events_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/events',
     assignees_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/assignees{/user}',
     branches_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/branches{/branch}',
     tags_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/tags',
     blobs_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/git/blobs{/sha}',
     git_tags_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/git/tags{/sha}',
     git_refs_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/git/refs{/sha}',
     trees_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/git/trees{/sha}',
     statuses_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/statuses/{sha}',
     languages_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/languages',
     stargazers_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/stargazers',
     contributors_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/contributors',
     subscribers_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/subscribers',
     subscription_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/subscription',
     commits_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/commits{/sha}',
     git_commits_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/git/commits{/sha}',
     comments_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/comments{/number}',
     issue_comment_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/issues/comments{/number}',
     contents_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/contents/{+path}',
     compare_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/compare/{base}...{head}',
     merges_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/merges',
     archive_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/{archive_format}{/ref}',
     downloads_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/downloads',
     issues_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/issues{/number}',
     pulls_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/pulls{/number}',
     milestones_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/milestones{/number}',
     notifications_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/notifications{?since,all,participating}',
     labels_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/labels{/name}',
     releases_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/releases{/id}',
     deployments_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/deployments',
     created_at: '2018-03-23T21:01:19Z',
     updated_at: '2018-03-23T21:48:34Z',
     pushed_at: '2018-03-23T21:54:48Z',
     git_url: 'git://github.com/shanebarringer/webhook-concept.git',
     ssh_url: 'git@github.com:shanebarringer/webhook-concept.git',
     clone_url: 'https://github.com/shanebarringer/webhook-concept.git',
     svn_url: 'https://github.com/shanebarringer/webhook-concept',
     homepage: null,
     size: 23,
     stargazers_count: 0,
     watchers_count: 0,
     language: 'JavaScript',
     has_issues: true,
     has_projects: true,
     has_downloads: true,
     has_wiki: true,
     has_pages: false,
     forks_count: 0,
     mirror_url: null,
     archived: false,
     open_issues_count: 2,
     license: null,
     forks: 0,
     open_issues: 2,
     watchers: 0,
     default_branch: 'master' },
  sender:
   { login: 'shanebarringer',
     id: 6509923,
     avatar_url: 'https://avatars3.githubusercontent.com/u/6509923?v=4',
     gravatar_id: '',
     url: 'https://api.github.com/users/shanebarringer',
     html_url: 'https://github.com/shanebarringer',
     followers_url: 'https://api.github.com/users/shanebarringer/followers',
     following_url: 'https://api.github.com/users/shanebarringer/following{/other_user}',
     gists_url: 'https://api.github.com/users/shanebarringer/gists{/gist_id}',
     starred_url: 'https://api.github.com/users/shanebarringer/starred{/owner}{/repo}',
     subscriptions_url: 'https://api.github.com/users/shanebarringer/subscriptions',
     organizations_url: 'https://api.github.com/users/shanebarringer/orgs',
     repos_url: 'https://api.github.com/users/shanebarringer/repos',
     events_url: 'https://api.github.com/users/shanebarringer/events{/privacy}',
     received_events_url: 'https://api.github.com/users/shanebarringer/received_events',
     type: 'User',
     site_admin: false } }
shanebarringer commented 6 years ago

log issue only

shanebarringer commented 6 years ago

testing out body of issue

result was original issue

{ url: 'https://api.github.com/repos/shanebarringer/webhook-concept/issues/2',
  repository_url: 'https://api.github.com/repos/shanebarringer/webhook-concept',
  labels_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/issues/2/labels{/name}',
  comments_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/issues/2/comments',
  events_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/issues/2/events',
  html_url: 'https://github.com/shanebarringer/webhook-concept/issues/2',
  id: 308192676,
  number: 2,
  title: 'Log Payload',
  user:
   { login: 'shanebarringer',
     id: 6509923,
     avatar_url: 'https://avatars3.githubusercontent.com/u/6509923?v=4',
     gravatar_id: '',
     url: 'https://api.github.com/users/shanebarringer',
     html_url: 'https://github.com/shanebarringer',
     followers_url: 'https://api.github.com/users/shanebarringer/followers',
     following_url: 'https://api.github.com/users/shanebarringer/following{/other_user}',
     gists_url: 'https://api.github.com/users/shanebarringer/gists{/gist_id}',
     starred_url: 'https://api.github.com/users/shanebarringer/starred{/owner}{/repo}',
     subscriptions_url: 'https://api.github.com/users/shanebarringer/subscriptions',
     organizations_url: 'https://api.github.com/users/shanebarringer/orgs',
     repos_url: 'https://api.github.com/users/shanebarringer/repos',
     events_url: 'https://api.github.com/users/shanebarringer/events{/privacy}',
     received_events_url: 'https://api.github.com/users/shanebarringer/received_events',
     type: 'User',
     site_admin: false },
  labels: [],
  state: 'open',
  locked: false,
  assignee: null,
  assignees: [],
  milestone: null,
  comments: 5,
  created_at: '2018-03-23T22:08:47Z',
  updated_at: '2018-03-23T22:16:16Z',
  closed_at: null,
  author_association: 'OWNER',
  body: 'logging payload' }
{ url: 'https://api.github.com/repos/shanebarringer/webhook-concept/issues/2',
  repository_url: 'https://api.github.com/repos/shanebarringer/webhook-concept',
  labels_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/issues/2/labels{/name}',
  comments_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/issues/2/comments',
  events_url: 'https://api.github.com/repos/shanebarringer/webhook-concept/issues/2/events',
  html_url: 'https://github.com/shanebarringer/webhook-concept/issues/2',
  id: 308192676,
  number: 2,
  title: 'Log Payload',
  user:
   { login: 'shanebarringer',
     id: 6509923,
     avatar_url: 'https://avatars3.githubusercontent.com/u/6509923?v=4',
     gravatar_id: '',
     url: 'https://api.github.com/users/shanebarringer',
     html_url: 'https://github.com/shanebarringer',
     followers_url: 'https://api.github.com/users/shanebarringer/followers',
     following_url: 'https://api.github.com/users/shanebarringer/following{/other_user}',
     gists_url: 'https://api.github.com/users/shanebarringer/gists{/gist_id}',
     starred_url: 'https://api.github.com/users/shanebarringer/starred{/owner}{/repo}',
     subscriptions_url: 'https://api.github.com/users/shanebarringer/subscriptions',
     organizations_url: 'https://api.github.com/users/shanebarringer/orgs',
     repos_url: 'https://api.github.com/users/shanebarringer/repos',
     events_url: 'https://api.github.com/users/shanebarringer/events{/privacy}',
     received_events_url: 'https://api.github.com/users/shanebarringer/received_events',
     type: 'User',
     site_admin: false },
  labels: [],
  state: 'open',
  locked: false,
  assignee: null,
  assignees: [],
  milestone: null,
  comments: 5,
  created_at: '2018-03-23T22:08:47Z',
  updated_at: '2018-03-23T22:17:03Z',
  closed_at: null,
  author_association: 'OWNER',
  body: 'logging payload' }
shanebarringer commented 6 years ago

running object.keys

result = [ 'action', 'issue', 'comment', 'repository', 'sender' ]