{"action":"created","comment":{"url":"https://api.github.com/repos/rahafoundation/raha.io/pulls/comments/181528603","pull_request_review_id":112178689,"id":181528603,"diff_hunk":"@@ -0,0 +1,191 @@\n+// TODO: consider splitting the actual API endpoint types into their finer grained files\n+import { Uid } from \"../identifiers\";\n+import InvalidApiRequestError from \"../errors/ApiCallError/InvalidApiRequestError\";\n+import ApiCallFailedError from \"../errors/ApiCallError/ApiCallFailedError\";\n+import ApiResponse, {\n+  OperationsApiResponse,\n+  OperationApiResponse\n+} from \"./ApiResponse\";\n+\n+// TODO: make this configurable, probably by environment variable\n+// It will be useful for several things:\n+// a) working offline\n+// b) testing API-dependent code paths\n+// c) different prod/test/staging environments\n+const API_BASE = \"https://raha-5395e.appspot.com/api/\";\n+\n+/* ==============================\n+ * Definitions of how to address\n+ * and use API endpoints\n+ * ==============================\n+ */\n+\n+/**\n+ * Canonical name of an endpoint you can query.\n+ */\n+export const enum ApiEndpoint {\n+  TRUST_MEMBER = \"TRUST_MEMBER\",\n+  GET_OPERATIONS = \"GET_OPERATIONS\"\n+}\n+\n+/**\n+ * Definition for the arguments you need to call a particular API endpoint\n+ */\n+interface ApiCallDef<E extends ApiEndpoint, Params, Body> {\n+  endpoint: E;\n+  params: Params;\n+  body: Body;\n+}\n+type TrustMemberApiCall = ApiCallDef<\n+  ApiEndpoint.TRUST_MEMBER,\n+  { uid: Uid },\n+  void\n+>;\n+type GetOperationsApiCall = ApiCallDef<ApiEndpoint.GET_OPERATIONS, void, void>;\n+/**\n+ * All API calls you can make, and the arguments you need to call them.\n+ */\n+export type ApiCall = TrustMemberApiCall | GetOperationsApiCall;\n+\n+/**\n+ * Definition of how to use an API endpoint, i.e. what you have to provide to\n+ * call it, and what it will return to you.\n+ */\n+interface ApiEndpointDef<Call extends ApiCall, Resp extends ApiResponse> {","path":"src/api/index.ts","position":54,"original_position":54,"commit_id":"a212c632dd3dc30cdd781ebf0e36b249b5b40406","original_commit_id":"a212c632dd3dc30cdd781ebf0e36b249b5b40406","user":{"login":"rahulgi","id":2237985,"avatar_url":"https://avatars1.githubusercontent.com/u/2237985?v=4","gravatar_id":"","url":"https://api.github.com/users/rahulgi","html_url":"https://github.com/rahulgi","followers_url":"https://api.github.com/users/rahulgi/followers","following_url":"https://api.github.com/users/rahulgi/following{/other_user}","gists_url":"https://api.github.com/users/rahulgi/gists{/gist_id}","starred_url":"https://api.github.com/users/rahulgi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rahulgi/subscriptions","organizations_url":"https://api.github.com/users/rahulgi/orgs","repos_url":"https://api.github.com/users/rahulgi/repos","events_url":"https://api.github.com/users/rahulgi/events{/privacy}","received_events_url":"https://api.github.com/users/rahulgi/received_events","type":"User","site_admin":false},"body":"expand def here too. also, you fancy.","created_at":"2018-04-13T23:16:21Z","updated_at":"2018-04-13T23:56:39Z","html_url":"https://github.com/rahafoundation/raha.io/pull/103#discussion_r181528603","pull_request_url":"https://api.github.com/repos/rahafoundation/raha.io/pulls/103","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/rahafoundation/raha.io/pulls/comments/181528603"},"html":{"href":"https://github.com/rahafoundation/raha.io/pull/103#discussion_r181528603"},"pull_request":{"href":"https://api.github.com/repos/rahafoundation/raha.io/pulls/103"}}},"pull_request":{"url":"https://api.github.com/repos/rahafoundation/raha.io/pulls/103","id":181444058,"html_url":"https://github.com/rahafoundation/raha.io/pull/103","diff_url":"https://github.com/rahafoundation/raha.io/pull/103.diff","patch_url":"https://github.com/rahafoundation/raha.io/pull/103.patch","issue_url":"https://api.github.com/repos/rahafoundation/raha.io/issues/103","number":103,"state":"open","locked":false,"title":"refactor trust button, add api calls lib and reducer","user":{"login":"osdiab","id":1890926,"avatar_url":"https://avatars0.githubusercontent.com/u/1890926?v=4","gravatar_id":"","url":"https://api.github.com/users/osdiab","html_url":"https://github.com/osdiab","followers_url":"https://api.github.com/users/osdiab/followers","following_url":"https://api.github.com/users/osdiab/following{/other_user}","gists_url":"https://api.github.com/users/osdiab/gists{/gist_id}","starred_url":"https://api.github.com/users/osdiab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osdiab/subscriptions","organizations_url":"https://api.github.com/users/osdiab/orgs","repos_url":"https://api.github.com/users/osdiab/repos","events_url":"https://api.github.com/users/osdiab/events{/privacy}","received_events_url":"https://api.github.com/users/osdiab/received_events","type":"User","site_admin":false},"body":"Refactor of trust button to use new redux state, and to behave correctly.\r\n\r\nRequires #101 before this works, hence tests failing\r\n\r\nAlso includes a system for calling raha-api over HTTP in a consistent and error-handling way, and keeping track of their current state in the redux store. While that perhaps could have been its own PR, this is the first code that uses it\r\n\r\nI also didn't split this into multiple commits after wrangling all the merge conflicts, but I can if it would help. sorry that this is so big haha but a lot of this boilerplate will make future things ease up a bit.\r\n\r\nLater on the specific types for the API can probably be shared between this and raha-api—we'd probably move them there ultimately.","created_at":"2018-04-13T10:12:23Z","updated_at":"2018-04-13T23:56:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"052e6d7ef80dcdbe11c9c6f708ee87583909354b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/rahafoundation/raha.io/pulls/103/commits","review_comments_url":"https://api.github.com/repos/rahafoundation/raha.io/pulls/103/comments","review_comment_url":"https://api.github.com/repos/rahafoundation/raha.io/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rahafoundation/raha.io/issues/103/comments","statuses_url":"https://api.github.com/repos/rahafoundation/raha.io/statuses/a212c632dd3dc30cdd781ebf0e36b249b5b40406","head":{"label":"rahafoundation:osdiab-trust-button-refactor","ref":"osdiab-trust-button-refactor","sha":"a212c632dd3dc30cdd781ebf0e36b249b5b40406","user":{"login":"rahafoundation","id":35645362,"avatar_url":"https://avatars1.githubusercontent.com/u/35645362?v=4","gravatar_id":"","url":"https://api.github.com/users/rahafoundation","html_url":"https://github.com/rahafoundation","followers_url":"https://api.github.com/users/rahafoundation/followers","following_url":"https://api.github.com/users/rahafoundation/following{/other_user}","gists_url":"https://api.github.com/users/rahafoundation/gists{/gist_id}","starred_url":"https://api.github.com/users/rahafoundation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rahafoundation/subscriptions","organizations_url":"https://api.github.com/users/rahafoundation/orgs","repos_url":"https://api.github.com/users/rahafoundation/repos","events_url":"https://api.github.com/users/rahafoundation/events{/privacy}","received_events_url":"https://api.github.com/users/rahafoundation/received_events","type":"Organization","site_admin":false},"repo":{"id":118571919,"name":"raha.io","full_name":"rahafoundation/raha.io","owner":{"login":"rahafoundation","id":35645362,"avatar_url":"https://avatars1.githubusercontent.com/u/35645362?v=4","gravatar_id":"","url":"https://api.github.com/users/rahafoundation","html_url":"https://github.com/rahafoundation","followers_url":"https://api.github.com/users/rahafoundation/followers","following_url":"https://api.github.com/users/rahafoundation/following{/other_user}","gists_url":"https://api.github.com/users/rahafoundation/gists{/gist_id}","starred_url":"https://api.github.com/users/rahafoundation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rahafoundation/subscriptions","organizations_url":"https://api.github.com/users/rahafoundation/orgs","repos_url":"https://api.github.com/users/rahafoundation/repos","events_url":"https://api.github.com/users/rahafoundation/events{/privacy}","received_events_url":"https://api.github.com/users/rahafoundation/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rahafoundation/raha.io","description":"The raha.io identity network supporting universal basic income","fork":false,"url":"https://api.github.com/repos/rahafoundation/raha.io","forks_url":"https://api.github.com/repos/rahafoundation/raha.io/forks","keys_url":"https://api.github.com/repos/rahafoundation/raha.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rahafoundation/raha.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rahafoundation/raha.io/teams","hooks_url":"https://api.github.com/repos/rahafoundation/raha.io/hooks","issue_events_url":"https://api.github.com/repos/rahafoundation/raha.io/issues/events{/number}","events_url":"https://api.github.com/repos/rahafoundation/raha.io/events","assignees_url":"https://api.github.com/repos/rahafoundation/raha.io/assignees{/user}","branches_url":"https://api.github.com/repos/rahafoundation/raha.io/branches{/branch}","tags_url":"https://api.github.com/repos/rahafoundation/raha.io/tags","blobs_url":"https://api.github.com/repos/rahafoundation/raha.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rahafoundation/raha.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rahafoundation/raha.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/rahafoundation/raha.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rahafoundation/raha.io/statuses/{sha}","languages_url":"https://api.github.com/repos/rahafoundation/raha.io/languages","stargazers_url":"https://api.github.com/repos/rahafoundation/raha.io/stargazers","contributors_url":"https://api.github.com/repos/rahafoundation/raha.io/contributors","subscribers_url":"https://api.github.com/repos/rahafoundation/raha.io/subscribers","subscription_url":"https://api.github.com/repos/rahafoundation/raha.io/subscription","commits_url":"https://api.github.com/repos/rahafoundation/raha.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/rahafoundation/raha.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/rahafoundation/raha.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/rahafoundation/raha.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/rahafoundation/raha.io/contents/{+path}","compare_url":"https://api.github.com/repos/rahafoundation/raha.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rahafoundation/raha.io/merges","archive_url":"https://api.github.com/repos/rahafoundation/raha.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rahafoundation/raha.io/downloads","issues_url":"https://api.github.com/repos/rahafoundation/raha.io/issues{/number}","pulls_url":"https://api.github.com/repos/rahafoundation/raha.io/pulls{/number}","milestones_url":"https://api.github.com/repos/rahafoundation/raha.io/milestones{/number}","notifications_url":"https://api.github.com/repos/rahafoundation/raha.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rahafoundation/raha.io/labels{/name}","releases_url":"https://api.github.com/repos/rahafoundation/raha.io/releases{/id}","deployments_url":"https://api.github.com/repos/rahafoundation/raha.io/deployments","created_at":"2018-01-23T07:07:36Z","updated_at":"2018-04-13T22:29:02Z","pushed_at":"2018-04-13T22:38:01Z","git_url":"git://github.com/rahafoundation/raha.io.git","ssh_url":"git@github.com:rahafoundation/raha.io.git","clone_url":"https://github.com/rahafoundation/raha.io.git","svn_url":"https://github.com/rahafoundation/raha.io","homepage":"https://raha.io/","size":736,"stargazers_count":7,"watchers_count":7,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":19,"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":1,"open_issues":19,"watchers":7,"default_branch":"master"}},"base":{"label":"rahafoundation:master","ref":"master","sha":"fc3b1c3d6d04f35fc0621a11a07bff962eb7708f","user":{"login":"rahafoundation","id":35645362,"avatar_url":"https://avatars1.githubusercontent.com/u/35645362?v=4","gravatar_id":"","url":"https://api.github.com/users/rahafoundation","html_url":"https://github.com/rahafoundation","followers_url":"https://api.github.com/users/rahafoundation/followers","following_url":"https://api.github.com/users/rahafoundation/following{/other_user}","gists_url":"https://api.github.com/users/rahafoundation/gists{/gist_id}","starred_url":"https://api.github.com/users/rahafoundation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rahafoundation/subscriptions","organizations_url":"https://api.github.com/users/rahafoundation/orgs","repos_url":"https://api.github.com/users/rahafoundation/repos","events_url":"https://api.github.com/users/rahafoundation/events{/privacy}","received_events_url":"https://api.github.com/users/rahafoundation/received_events","type":"Organization","site_admin":false},"repo":{"id":118571919,"name":"raha.io","full_name":"rahafoundation/raha.io","owner":{"login":"rahafoundation","id":35645362,"avatar_url":"https://avatars1.githubusercontent.com/u/35645362?v=4","gravatar_id":"","url":"https://api.github.com/users/rahafoundation","html_url":"https://github.com/rahafoundation","followers_url":"https://api.github.com/users/rahafoundation/followers","following_url":"https://api.github.com/users/rahafoundation/following{/other_user}","gists_url":"https://api.github.com/users/rahafoundation/gists{/gist_id}","starred_url":"https://api.github.com/users/rahafoundation/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rahafoundation/subscriptions","organizations_url":"https://api.github.com/users/rahafoundation/orgs","repos_url":"https://api.github.com/users/rahafoundation/repos","events_url":"https://api.github.com/users/rahafoundation/events{/privacy}","received_events_url":"https://api.github.com/users/rahafoundation/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rahafoundation/raha.io","description":"The raha.io identity network supporting universal basic income","fork":false,"url":"https://api.github.com/repos/rahafoundation/raha.io","forks_url":"https://api.github.com/repos/rahafoundation/raha.io/forks","keys_url":"https://api.github.com/repos/rahafoundation/raha.io/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rahafoundation/raha.io/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rahafoundation/raha.io/teams","hooks_url":"https://api.github.com/repos/rahafoundation/raha.io/hooks","issue_events_url":"https://api.github.com/repos/rahafoundation/raha.io/issues/events{/number}","events_url":"https://api.github.com/repos/rahafoundation/raha.io/events","assignees_url":"https://api.github.com/repos/rahafoundation/raha.io/assignees{/user}","branches_url":"https://api.github.com/repos/rahafoundation/raha.io/branches{/branch}","tags_url":"https://api.github.com/repos/rahafoundation/raha.io/tags","blobs_url":"https://api.github.com/repos/rahafoundation/raha.io/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rahafoundation/raha.io/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rahafoundation/raha.io/git/refs{/sha}","trees_url":"https://api.github.com/repos/rahafoundation/raha.io/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rahafoundation/raha.io/statuses/{sha}","languages_url":"https://api.github.com/repos/rahafoundation/raha.io/languages","stargazers_url":"https://api.github.com/repos/rahafoundation/raha.io/stargazers","contributors_url":"https://api.github.com/repos/rahafoundation/raha.io/contributors","subscribers_url":"https://api.github.com/repos/rahafoundation/raha.io/subscribers","subscription_url":"https://api.github.com/repos/rahafoundation/raha.io/subscription","commits_url":"https://api.github.com/repos/rahafoundation/raha.io/commits{/sha}","git_commits_url":"https://api.github.com/repos/rahafoundation/raha.io/git/commits{/sha}","comments_url":"https://api.github.com/repos/rahafoundation/raha.io/comments{/number}","issue_comment_url":"https://api.github.com/repos/rahafoundation/raha.io/issues/comments{/number}","contents_url":"https://api.github.com/repos/rahafoundation/raha.io/contents/{+path}","compare_url":"https://api.github.com/repos/rahafoundation/raha.io/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rahafoundation/raha.io/merges","archive_url":"https://api.github.com/repos/rahafoundation/raha.io/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rahafoundation/raha.io/downloads","issues_url":"https://api.github.com/repos/rahafoundation/raha.io/issues{/number}","pulls_url":"https://api.github.com/repos/rahafoundation/raha.io/pulls{/number}","milestones_url":"https://api.github.com/repos/rahafoundation/raha.io/milestones{/number}","notifications_url":"https://api.github.com/repos/rahafoundation/raha.io/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rahafoundation/raha.io/labels{/name}","releases_url":"https://api.github.com/repos/rahafoundation/raha.io/releases{/id}","deployments_url":"https://api.github.com/repos/rahafoundation/raha.io/deployments","created_at":"2018-01-23T07:07:36Z","updated_at":"2018-04-13T22:29:02Z","pushed_at":"2018-04-13T22:38:01Z","git_url":"git://github.com/rahafoundation/raha.io.git","ssh_url":"git@github.com:rahafoundation/raha.io.git","clone_url":"https://github.com/rahafoundation/raha.io.git","svn_url":"https://github.com/rahafoundation/raha.io","homepage":"https://raha.io/","size":736,"stargazers_count":7,"watchers_count":7,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":19,"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":1,"open_issues":19,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rahafoundation/raha.io/pulls/103"},"html":{"href":"https://github.com/rahafoundation/raha.io/pull/103"},"issue":{"href":"https://api.github.com/repos/rahafoundation/raha.io/issues/103"},"comments":{"href":"https://api.github.com/repos/rahafoundation/raha.io/issues/103/comments"},"review_comments":{"href":"https://api.github.com/repos/rahafoundation/raha.io/pulls/103/comments"},"review_comment":{"href":"https://api.github.com/repos/rahafoundation/raha.io/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rahafoundation/raha.io/pulls/103/commits"},"statuses":{"href":"https://api.github.com/repos/rahafoundation/raha.io/statuses/a212c632dd3dc30cdd781ebf0e36b249b5b40406"}},"author_association":"OWNER"}}
{"actor":{"display_login":"rahulgi"}}