2016-01-28 00:50:06 +03:00
|
|
|
:: This library includes parsing functions for the json objects
|
|
|
|
:: that Github's API produces. In general, the conversion from
|
|
|
|
:: JSON to urbit types should be performed in marks, so those
|
|
|
|
:: marks should include this library.
|
|
|
|
::
|
2016-01-26 04:13:08 +03:00
|
|
|
/- gh
|
2017-02-14 03:02:25 +03:00
|
|
|
/+ old-zuse
|
|
|
|
=, old-zuse
|
2016-01-26 04:13:08 +03:00
|
|
|
|%
|
|
|
|
++ repository
|
2016-02-17 21:12:28 +03:00
|
|
|
^- $-(json (unit repository:gh))
|
2016-01-26 04:13:08 +03:00
|
|
|
=+ jo
|
|
|
|
%- ot :~
|
|
|
|
'id'^id
|
|
|
|
'name'^so
|
|
|
|
'full_name'^so
|
|
|
|
'owner'^user
|
|
|
|
'private'^bo
|
|
|
|
'html_url'^so
|
|
|
|
'description'^so
|
|
|
|
'fork'^bo
|
|
|
|
'url'^so
|
|
|
|
'forks_url'^so
|
|
|
|
'keys_url'^so
|
|
|
|
'collaborators_url'^so
|
|
|
|
'teams_url'^so
|
|
|
|
'hooks_url'^so
|
|
|
|
'issue_events_url'^so
|
|
|
|
'events_url'^so
|
|
|
|
'assignees_url'^so
|
|
|
|
'branches_url'^so
|
|
|
|
'tags_url'^so
|
|
|
|
'blobs_url'^so
|
|
|
|
'git_tags_url'^so
|
|
|
|
'git_refs_url'^so
|
|
|
|
'trees_url'^so
|
|
|
|
'statuses_url'^so
|
|
|
|
'languages_url'^so
|
|
|
|
'stargazers_url'^so
|
|
|
|
'contributors_url'^so
|
|
|
|
'subscribers_url'^so
|
|
|
|
'subscription_url'^so
|
|
|
|
'commits_url'^so
|
|
|
|
'git_commits_url'^so
|
|
|
|
'comments_url'^so
|
|
|
|
'issue_comment_url'^so
|
|
|
|
'contents_url'^so
|
|
|
|
'compare_url'^so
|
|
|
|
'merges_url'^so
|
|
|
|
'archive_url'^so
|
|
|
|
'downloads_url'^so
|
|
|
|
'issues_url'^so
|
|
|
|
'pulls_url'^so
|
|
|
|
'milestones_url'^so
|
|
|
|
'notifications_url'^so
|
|
|
|
'labels_url'^so
|
|
|
|
'releases_url'^so
|
|
|
|
'created_at'^so
|
|
|
|
'updated_at'^so
|
|
|
|
'pushed_at'^so
|
|
|
|
'git_url'^so
|
|
|
|
'ssh_url'^so
|
|
|
|
'clone_url'^so
|
|
|
|
'svn_url'^so
|
|
|
|
'homepage'^some
|
|
|
|
'size'^ni
|
|
|
|
'stargazers_count'^ni
|
|
|
|
'watchers_count'^ni
|
|
|
|
'language'^some
|
|
|
|
'has_issues'^bo
|
|
|
|
'has_downloads'^bo
|
|
|
|
'has_wiki'^bo
|
|
|
|
'has_pages'^bo
|
|
|
|
'forks_count'^ni
|
|
|
|
'mirror_url'^some
|
|
|
|
'open_issues_count'^ni
|
|
|
|
'forks'^ni
|
|
|
|
'open_issues'^ni
|
|
|
|
'watchers'^ni
|
|
|
|
'default_branch'^so
|
|
|
|
==
|
|
|
|
++ user
|
2016-02-17 21:12:28 +03:00
|
|
|
^- $-(json (unit user:gh))
|
2016-01-26 04:13:08 +03:00
|
|
|
=+ jo
|
|
|
|
%- ot :~
|
|
|
|
'login'^so
|
|
|
|
'id'^id
|
|
|
|
'avatar_url'^so
|
|
|
|
'gravatar_id'^so
|
|
|
|
'url'^so
|
|
|
|
'html_url'^so
|
|
|
|
'followers_url'^so
|
|
|
|
'following_url'^so
|
|
|
|
'gists_url'^so
|
|
|
|
'starred_url'^so
|
|
|
|
'subscriptions_url'^so
|
|
|
|
'organizations_url'^so
|
|
|
|
'repos_url'^so
|
|
|
|
'events_url'^so
|
|
|
|
'received_events_url'^so
|
|
|
|
'type'^so
|
|
|
|
'site_admin'^bo
|
|
|
|
==
|
|
|
|
++ issue
|
2016-02-17 21:12:28 +03:00
|
|
|
^- $-(json (unit issue:gh))
|
2016-05-04 02:26:52 +03:00
|
|
|
|= jon/json
|
|
|
|
=- (bind - |*(issue/* `issue:gh`[jon issue]))
|
|
|
|
%. jon
|
2016-01-26 04:13:08 +03:00
|
|
|
=+ jo
|
|
|
|
%- ot :~
|
|
|
|
'url'^so
|
|
|
|
'labels_url'^so
|
|
|
|
'comments_url'^so
|
|
|
|
'events_url'^so
|
|
|
|
'html_url'^so
|
|
|
|
'id'^id
|
|
|
|
'number'^ni
|
|
|
|
'title'^so
|
|
|
|
'user'^user::|+(* (some *user:gh))
|
|
|
|
'labels'^(ar label)::|+(* (some *(list label:gh)))::(ar label)
|
|
|
|
'state'^so
|
|
|
|
'locked'^bo
|
|
|
|
'assignee'^(mu user)::|+(* (some *(unit user:gh)))::(mu user)
|
|
|
|
'milestone'^some
|
|
|
|
'comments'^ni
|
|
|
|
'created_at'^so
|
|
|
|
'updated_at'^so
|
|
|
|
'closed_at'^(mu so)
|
|
|
|
'body'^so
|
|
|
|
==
|
|
|
|
++ label
|
2016-02-17 21:12:28 +03:00
|
|
|
^- $-(json (unit label:gh))
|
2016-01-26 04:13:08 +03:00
|
|
|
=+ jo
|
|
|
|
%- ot :~
|
|
|
|
'url'^so
|
|
|
|
'name'^so
|
|
|
|
'color'^so
|
|
|
|
==
|
|
|
|
++ comment
|
2016-02-17 21:12:28 +03:00
|
|
|
^- $-(json (unit comment:gh))
|
2016-01-26 04:13:08 +03:00
|
|
|
=+ jo
|
|
|
|
%- ot :~
|
|
|
|
'url'^so
|
|
|
|
'html_url'^so
|
|
|
|
'issue_url'^so
|
|
|
|
'id'^id
|
|
|
|
'user'^user
|
|
|
|
'created_at'^so
|
|
|
|
'updated_at'^so
|
|
|
|
'body'^so
|
|
|
|
==
|
|
|
|
++ id no:jo
|
2016-05-04 22:59:10 +03:00
|
|
|
++ print-issue
|
|
|
|
|= issue:gh
|
2017-02-14 03:02:25 +03:00
|
|
|
=, format
|
2016-05-04 22:59:10 +03:00
|
|
|
^- wain
|
|
|
|
=+ c=(cury cat 3)
|
|
|
|
:* :(c 'title: ' title ' (#' (rsh 3 2 (scot %ui number)) ')')
|
|
|
|
(c 'state: ' state)
|
|
|
|
(c 'creator: ' login.user)
|
|
|
|
(c 'created-at: ' created-at)
|
|
|
|
(c 'assignee: ' ?~(assignee 'none' login.u.assignee))
|
|
|
|
::
|
|
|
|
%+ c 'labels: '
|
|
|
|
?~ labels ''
|
|
|
|
|- ^- @t
|
|
|
|
?~ t.labels name.i.labels
|
|
|
|
:(c name.i.t.labels ', ' $(t.labels t.t.labels))
|
|
|
|
::
|
|
|
|
(c 'comments: ' (rsh 3 2 (scot %ui comments)))
|
|
|
|
(c 'url: ' url)
|
|
|
|
''
|
2016-12-03 01:14:39 +03:00
|
|
|
%+ turn (to-wain body) :: strip carriage returns
|
2016-05-04 22:59:10 +03:00
|
|
|
|= l/@t
|
|
|
|
?: =('' l)
|
|
|
|
l
|
|
|
|
?. =('\0d' (rsh 3 (dec (met 3 l)) l))
|
|
|
|
l
|
|
|
|
(end 3 (dec (met 3 l)) l)
|
|
|
|
==
|
2016-01-26 04:13:08 +03:00
|
|
|
--
|