{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/addons-frontend/pulls/comments/137932015","pull_request_review_id":61668048,"id":137932015,"diff_hunk":"@@ -162,111 +161,22 @@ export function callApi({\n     .then((response) => (schema ? normalize(response, schema) : response));\n }\n \n-type FetchAddonParams = {|\n-  api: ApiStateType,\n-  slug: string,\n-|};\n-\n-export function fetchAddon({ api, slug }: FetchAddonParams) {\n-  return callApi({\n-    endpoint: `addons/addon/${slug}`,\n-    schema: addon,\n-    auth: true,\n-    state: api,\n-  });\n-}\n-\n-type LoginParams = {|\n-  api: ApiStateType,\n-  code: string,\n-  state: string,\n-|};\n-\n-export function login({ api, code, state }: LoginParams) {\n-  const params = { config: undefined };\n-  const configName = config.get('fxaConfig');\n-  if (configName) {\n-    params.config = configName;\n-  }\n-  return callApi({\n-    endpoint: 'accounts/login',\n-    method: 'POST',\n-    body: { code, state },\n-    params,\n-    state: api,\n-    credentials: true,\n-  });\n-}\n-\n-export function startLoginUrl(\n-  { location }: {| location: ReactRouterLocation |},\n-) {\n-  const configName = config.get('fxaConfig');\n-  const params = {\n-    config: undefined,\n-    to: url.format({ ...location }),\n-  };\n-  if (configName) {\n-    params.config = configName;\n-  }\n-  const query = makeQueryString(params);\n-  return `${API_BASE}/accounts/login/start/${query}`;\n-}\n-\n-type FeaturedParams = {|\n-  api: ApiStateType,\n-  filters: Object,\n-  page: number,\n-|};\n-\n-export function featured({ api, filters, page }: FeaturedParams) {\n-  return callApi({\n-    endpoint: 'addons/featured',\n-    params: {\n-      app: api.clientApp,\n-      ...convertFiltersToQueryParams(filters),\n-      page,\n-    },\n-    schema: { results: [addon] },\n-    state: api,\n-  });\n-}\n-\n-export function categories({ api }: {| api: ApiStateType |}) {\n-  return callApi({\n-    endpoint: 'addons/categories',\n-    schema: { results: [category] },\n-    state: api,\n-  });\n-}\n-\n-export function logOutFromServer({ api }: {| api: ApiStateType |}) {\n-  return callApi({\n-    auth: true,\n-    credentials: true,\n-    endpoint: 'accounts/session',\n-    method: 'DELETE',\n-    state: api,\n-  });\n-}\n-\n-type AutocompleteParams = {|\n-  api: ApiStateType,\n-  filters: {|\n-    query: string,\n-    addonType?: string,\n-  |},\n-|};\n-\n-export function autocomplete({ api, filters }: AutocompleteParams) {\n-  return callApi({\n-    endpoint: 'addons/autocomplete',\n-    params: {\n-      app: api.clientApp,\n-      ...convertFiltersToQueryParams(filters),\n-    },\n-    state: api,\n-  });\n-}\n-\n-export const search = searchApi;\n+// Schemas\n+// TODO: Remove this when\n+// https://github.com/mozilla/addons-frontend/issues/2917 is fixed.\n+export const addon = addonApi.addonSchema;\n+export const category = categoriesApi.categorySchema;\n+\n+// Add-on APIs\n+export const fetchAddon = addonApi.fetchAddon;\n+// Auth APIs\n+export const login = authenticationApi.login;\n+export const logOutFromServer = authenticationApi.logOutFromServer;\n+export const startLoginUrl = authenticationApi.startLoginUrl;\n+// Category APIs\n+export const categories = categoriesApi.categories;\n+// Featured Add-on APIs\n+export const featured = featuredApi.featured;\n+// Search and Autocomplete APIs\n+export const autocomplete = searchApi.autocomplete;\n+export const search = searchApi.search;","path":"src/core/api/index.js","position":164,"original_position":164,"commit_id":"856ab4cbe545f5bda29caccc21b27ea92a8c06eb","original_commit_id":"856ab4cbe545f5bda29caccc21b27ea92a8c06eb","user":{"login":"willdurand","id":217628,"avatar_url":"https://avatars0.githubusercontent.com/u/217628?v=4","gravatar_id":"","url":"https://api.github.com/users/willdurand","html_url":"https://github.com/willdurand","followers_url":"https://api.github.com/users/willdurand/followers","following_url":"https://api.github.com/users/willdurand/following{/other_user}","gists_url":"https://api.github.com/users/willdurand/gists{/gist_id}","starred_url":"https://api.github.com/users/willdurand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willdurand/subscriptions","organizations_url":"https://api.github.com/users/willdurand/orgs","repos_url":"https://api.github.com/users/willdurand/repos","events_url":"https://api.github.com/users/willdurand/events{/privacy}","received_events_url":"https://api.github.com/users/willdurand/received_events","type":"User","site_admin":false},"body":"Can't we just add per API `import` where we rely on `core/api`?","created_at":"2017-09-09T18:13:20Z","updated_at":"2017-09-09T18:13:20Z","html_url":"https://github.com/mozilla/addons-frontend/pull/3089#discussion_r137932015","pull_request_url":"https://api.github.com/repos/mozilla/addons-frontend/pulls/3089","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/mozilla/addons-frontend/pulls/comments/137932015"},"html":{"href":"https://github.com/mozilla/addons-frontend/pull/3089#discussion_r137932015"},"pull_request":{"href":"https://api.github.com/repos/mozilla/addons-frontend/pulls/3089"}},"in_reply_to_id":137929852},"pull_request":{"url":"https://api.github.com/repos/mozilla/addons-frontend/pulls/3089","id":140171776,"html_url":"https://github.com/mozilla/addons-frontend/pull/3089","diff_url":"https://github.com/mozilla/addons-frontend/pull/3089.diff","patch_url":"https://github.com/mozilla/addons-frontend/pull/3089.patch","issue_url":"https://api.github.com/repos/mozilla/addons-frontend/issues/3089","number":3089,"state":"open","locked":false,"title":"chore: Reorganise API code and tests","user":{"login":"tofumatt","id":90871,"avatar_url":"https://avatars2.githubusercontent.com/u/90871?v=4","gravatar_id":"","url":"https://api.github.com/users/tofumatt","html_url":"https://github.com/tofumatt","followers_url":"https://api.github.com/users/tofumatt/followers","following_url":"https://api.github.com/users/tofumatt/following{/other_user}","gists_url":"https://api.github.com/users/tofumatt/gists{/gist_id}","starred_url":"https://api.github.com/users/tofumatt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tofumatt/subscriptions","organizations_url":"https://api.github.com/users/tofumatt/orgs","repos_url":"https://api.github.com/users/tofumatt/repos","events_url":"https://api.github.com/users/tofumatt/events{/privacy}","received_events_url":"https://api.github.com/users/tofumatt/received_events","type":"User","site_admin":false},"body":"This just separates out a lot of the code in core/api. I was finding it a real pain to read that file and while we've moved to using separate files for new code I wanted to separate it out because the tests and API code is hard to make sense of right now.\r\n\r\nThis didn't take too long and is solely reorganising. If you think it's not worth the time though just say so and you can close this, it's not the hugest deal.","created_at":"2017-09-09T14:31:39Z","updated_at":"2017-09-09T18:13:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"475cc5a02d51927dabe4250151cb4fca92cd1b3e","assignee":null,"assignees":[],"requested_reviewers":[{"login":"kumar303","id":55398,"avatar_url":"https://avatars1.githubusercontent.com/u/55398?v=4","gravatar_id":"","url":"https://api.github.com/users/kumar303","html_url":"https://github.com/kumar303","followers_url":"https://api.github.com/users/kumar303/followers","following_url":"https://api.github.com/users/kumar303/following{/other_user}","gists_url":"https://api.github.com/users/kumar303/gists{/gist_id}","starred_url":"https://api.github.com/users/kumar303/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kumar303/subscriptions","organizations_url":"https://api.github.com/users/kumar303/orgs","repos_url":"https://api.github.com/users/kumar303/repos","events_url":"https://api.github.com/users/kumar303/events{/privacy}","received_events_url":"https://api.github.com/users/kumar303/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/addons-frontend/pulls/3089/commits","review_comments_url":"https://api.github.com/repos/mozilla/addons-frontend/pulls/3089/comments","review_comment_url":"https://api.github.com/repos/mozilla/addons-frontend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/addons-frontend/issues/3089/comments","statuses_url":"https://api.github.com/repos/mozilla/addons-frontend/statuses/856ab4cbe545f5bda29caccc21b27ea92a8c06eb","head":{"label":"mozilla:tidy-up-api-xxxx","ref":"tidy-up-api-xxxx","sha":"856ab4cbe545f5bda29caccc21b27ea92a8c06eb","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars2.githubusercontent.com/u/131524?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":52104368,"name":"addons-frontend","full_name":"mozilla/addons-frontend","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars2.githubusercontent.com/u/131524?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/addons-frontend","description":"Front-end to complement mozilla/addons-server","fork":false,"url":"https://api.github.com/repos/mozilla/addons-frontend","forks_url":"https://api.github.com/repos/mozilla/addons-frontend/forks","keys_url":"https://api.github.com/repos/mozilla/addons-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/addons-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/addons-frontend/teams","hooks_url":"https://api.github.com/repos/mozilla/addons-frontend/hooks","issue_events_url":"https://api.github.com/repos/mozilla/addons-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/addons-frontend/events","assignees_url":"https://api.github.com/repos/mozilla/addons-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/addons-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/addons-frontend/tags","blobs_url":"https://api.github.com/repos/mozilla/addons-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/addons-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/addons-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/addons-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/addons-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/addons-frontend/languages","stargazers_url":"https://api.github.com/repos/mozilla/addons-frontend/stargazers","contributors_url":"https://api.github.com/repos/mozilla/addons-frontend/contributors","subscribers_url":"https://api.github.com/repos/mozilla/addons-frontend/subscribers","subscription_url":"https://api.github.com/repos/mozilla/addons-frontend/subscription","commits_url":"https://api.github.com/repos/mozilla/addons-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/addons-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/addons-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/addons-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/addons-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/addons-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/addons-frontend/merges","archive_url":"https://api.github.com/repos/mozilla/addons-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/addons-frontend/downloads","issues_url":"https://api.github.com/repos/mozilla/addons-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/addons-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/addons-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/addons-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/addons-frontend/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/addons-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla/addons-frontend/deployments","created_at":"2016-02-19T17:25:57Z","updated_at":"2017-09-06T10:45:39Z","pushed_at":"2017-09-09T18:11:13Z","git_url":"git://github.com/mozilla/addons-frontend.git","ssh_url":"git@github.com:mozilla/addons-frontend.git","clone_url":"https://github.com/mozilla/addons-frontend.git","svn_url":"https://github.com/mozilla/addons-frontend","homepage":"","size":330215,"stargazers_count":52,"watchers_count":52,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":52,"mirror_url":null,"open_issues_count":293,"forks":52,"open_issues":293,"watchers":52,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"a8d741c76981c20c8ca89882979838bfc43bbc4d","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars2.githubusercontent.com/u/131524?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":52104368,"name":"addons-frontend","full_name":"mozilla/addons-frontend","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars2.githubusercontent.com/u/131524?v=4","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/addons-frontend","description":"Front-end to complement mozilla/addons-server","fork":false,"url":"https://api.github.com/repos/mozilla/addons-frontend","forks_url":"https://api.github.com/repos/mozilla/addons-frontend/forks","keys_url":"https://api.github.com/repos/mozilla/addons-frontend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/addons-frontend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/addons-frontend/teams","hooks_url":"https://api.github.com/repos/mozilla/addons-frontend/hooks","issue_events_url":"https://api.github.com/repos/mozilla/addons-frontend/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/addons-frontend/events","assignees_url":"https://api.github.com/repos/mozilla/addons-frontend/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/addons-frontend/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/addons-frontend/tags","blobs_url":"https://api.github.com/repos/mozilla/addons-frontend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/addons-frontend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/addons-frontend/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/addons-frontend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/addons-frontend/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/addons-frontend/languages","stargazers_url":"https://api.github.com/repos/mozilla/addons-frontend/stargazers","contributors_url":"https://api.github.com/repos/mozilla/addons-frontend/contributors","subscribers_url":"https://api.github.com/repos/mozilla/addons-frontend/subscribers","subscription_url":"https://api.github.com/repos/mozilla/addons-frontend/subscription","commits_url":"https://api.github.com/repos/mozilla/addons-frontend/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/addons-frontend/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/addons-frontend/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/addons-frontend/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/addons-frontend/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/addons-frontend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/addons-frontend/merges","archive_url":"https://api.github.com/repos/mozilla/addons-frontend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/addons-frontend/downloads","issues_url":"https://api.github.com/repos/mozilla/addons-frontend/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/addons-frontend/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/addons-frontend/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/addons-frontend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/addons-frontend/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/addons-frontend/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla/addons-frontend/deployments","created_at":"2016-02-19T17:25:57Z","updated_at":"2017-09-06T10:45:39Z","pushed_at":"2017-09-09T18:11:13Z","git_url":"git://github.com/mozilla/addons-frontend.git","ssh_url":"git@github.com:mozilla/addons-frontend.git","clone_url":"https://github.com/mozilla/addons-frontend.git","svn_url":"https://github.com/mozilla/addons-frontend","homepage":"","size":330215,"stargazers_count":52,"watchers_count":52,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":52,"mirror_url":null,"open_issues_count":293,"forks":52,"open_issues":293,"watchers":52,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/addons-frontend/pulls/3089"},"html":{"href":"https://github.com/mozilla/addons-frontend/pull/3089"},"issue":{"href":"https://api.github.com/repos/mozilla/addons-frontend/issues/3089"},"comments":{"href":"https://api.github.com/repos/mozilla/addons-frontend/issues/3089/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/addons-frontend/pulls/3089/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/addons-frontend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/addons-frontend/pulls/3089/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/addons-frontend/statuses/856ab4cbe545f5bda29caccc21b27ea92a8c06eb"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"willdurand"}}