{"action":"created","comment":{"url":"https://api.github.com/repos/coveo/search-ui/pulls/comments/65775865","id":65775865,"diff_hunk":"@@ -873,4 +821,404 @@ export class SearchEndpoint implements ISearchEndpoint {\n   private hasTrailingSlash(uri: string) {\r\n     return uri.charAt(uri.length - 1) == '/';\r\n   }\r\n+\r\n+  private isMissingAuthenticationProviderStatus(status: number): boolean {\r\n+    return status == 402;\r\n+  }\r\n+\r\n+  private isAccessTokenExpiredStatus(status: number): boolean {\r\n+    return status == 419;\r\n+  }\r\n }\r\n+\r\n+\r\n+/**\r\n+ * It's taken for granted that methods using decorators have :\r\n+ * {@link IEndpointCallOptions} as their second to last parameter\r\n+ * {@link IEndpointCallParameters} as their last parameter\r\n+ * The default parameters for each member of the injected {@link IEndpointCallParameters} are the following:\r\n+ * url: '',\r\n+ * queryString: [],\r\n+ * requestData: {},\r\n+ * requestDataType: undefined,\r\n+ * method: '',\r\n+ * responseType: '',\r\n+ * errorsAsSuccess: false\r\n+ */\r\n+\r\n+/**\r\n+ * Add the base url\r\n+ * @param path The path to append to the url\r\n+ */\r\n+function url(path: string){\r\n+  return function(target: Object, key: string, descriptor: TypedPropertyDescriptor<any>) {\r\n+    let originalMethod = descriptor.value;\r\n+    let nbParams = target[key].prototype.constructor.length;\r\n+\r\n+    descriptor.value = function(...args: any[]) {\r\n+      let uri = this.buildBaseUri(path);\r\n+      if(args[nbParams-1]){\r\n+        args[nbParams-1].url = uri;\r\n+      }\r\n+      else{\r\n+        let params: IEndpointCallParameters = {\r\n+          url: uri,\r\n+          queryString: [],\r\n+          requestData: {},\r\n+          method: '',\r\n+          responseType: '',\r\n+          errorsAsSuccess: false\r\n+        };\r\n+        args[nbParams-1] = params;\r\n+      }\r\n+      let result = originalMethod.apply(this, args);\r\n+      return result;\r\n+    };\r\n+\r\n+    return descriptor;\r\n+  }\r\n+}\r\n+\r\n+/**\r\n+ * Add the alert url\r\n+ * @param path The path to append to the url\r\n+ */\r\n+function alertsUrl(path: string){\r\n+  return function(target: Object, key: string, descriptor: TypedPropertyDescriptor<any>) {\r\n+    let originalMethod = descriptor.value;\r\n+    let nbParams = target[key].prototype.constructor.length;\r\n+\r\n+    descriptor.value = function(...args: any[]) {\r\n+      let uri = this.buildSearchAlertsUri(path);\r\n+      if(args[nbParams-1]){\r\n+        args[nbParams-1].url = uri;\r\n+      }\r\n+      else{\r\n+        let params: IEndpointCallParameters = {\r\n+          url: uri,\r\n+          queryString: [],\r\n+          requestData: {},\r\n+          method: '',\r\n+          responseType: '',\r\n+          errorsAsSuccess: false\r\n+        };\r\n+        args[nbParams-1] = params;\r\n+      }\r\n+      let result = originalMethod.apply(this, args);\r\n+      return result;\r\n+    };\r\n+\r\n+    return descriptor;\r\n+  }\r\n+}\r\n+\r\n+/**\r\n+ * Add the base query string arguments\r\n+ */\r\n+function queryStringArguments(){\r","path":"src/rest/SearchEndpoint.ts","position":836,"original_position":836,"commit_id":"685d2880c92baece74b8fc87cf29b9df8f09cfed","original_commit_id":"685d2880c92baece74b8fc87cf29b9df8f09cfed","user":{"login":"olamothe","id":1591893,"avatar_url":"https://avatars.githubusercontent.com/u/1591893?v=3","gravatar_id":"","url":"https://api.github.com/users/olamothe","html_url":"https://github.com/olamothe","followers_url":"https://api.github.com/users/olamothe/followers","following_url":"https://api.github.com/users/olamothe/following{/other_user}","gists_url":"https://api.github.com/users/olamothe/gists{/gist_id}","starred_url":"https://api.github.com/users/olamothe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olamothe/subscriptions","organizations_url":"https://api.github.com/users/olamothe/orgs","repos_url":"https://api.github.com/users/olamothe/repos","events_url":"https://api.github.com/users/olamothe/events{/privacy}","received_events_url":"https://api.github.com/users/olamothe/received_events","type":"User","site_admin":false},"body":"Since this is needed for every single call on the endpoint (correct me if i'm wrong), I think it should then not be passed as a decorator (which means it's not \"mandatory\")\r\n\r\nI would instead move the logic for the base query strings arguments to somewhere where we are sure it will always be added.\r\n\r\nMaybe the `performOneCall` method","created_at":"2016-06-03T21:09:27Z","updated_at":"2016-06-03T21:09:27Z","html_url":"https://github.com/coveo/search-ui/pull/17#discussion_r65775865","pull_request_url":"https://api.github.com/repos/coveo/search-ui/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/coveo/search-ui/pulls/comments/65775865"},"html":{"href":"https://github.com/coveo/search-ui/pull/17#discussion_r65775865"},"pull_request":{"href":"https://api.github.com/repos/coveo/search-ui/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/coveo/search-ui/pulls/17","id":72432251,"html_url":"https://github.com/coveo/search-ui/pull/17","diff_url":"https://github.com/coveo/search-ui/pull/17.diff","patch_url":"https://github.com/coveo/search-ui/pull/17.patch","issue_url":"https://api.github.com/repos/coveo/search-ui/issues/17","number":17,"state":"open","locked":false,"title":"Jsui 814","user":{"login":"fgagnoncoveo","id":19432407,"avatar_url":"https://avatars.githubusercontent.com/u/19432407?v=3","gravatar_id":"","url":"https://api.github.com/users/fgagnoncoveo","html_url":"https://github.com/fgagnoncoveo","followers_url":"https://api.github.com/users/fgagnoncoveo/followers","following_url":"https://api.github.com/users/fgagnoncoveo/following{/other_user}","gists_url":"https://api.github.com/users/fgagnoncoveo/gists{/gist_id}","starred_url":"https://api.github.com/users/fgagnoncoveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fgagnoncoveo/subscriptions","organizations_url":"https://api.github.com/users/fgagnoncoveo/orgs","repos_url":"https://api.github.com/users/fgagnoncoveo/repos","events_url":"https://api.github.com/users/fgagnoncoveo/events{/privacy}","received_events_url":"https://api.github.com/users/fgagnoncoveo/received_events","type":"User","site_admin":false},"body":"May still need tweaking.","created_at":"2016-06-02T23:10:08Z","updated_at":"2016-06-03T21:09:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":{"login":"olamothe","id":1591893,"avatar_url":"https://avatars.githubusercontent.com/u/1591893?v=3","gravatar_id":"","url":"https://api.github.com/users/olamothe","html_url":"https://github.com/olamothe","followers_url":"https://api.github.com/users/olamothe/followers","following_url":"https://api.github.com/users/olamothe/following{/other_user}","gists_url":"https://api.github.com/users/olamothe/gists{/gist_id}","starred_url":"https://api.github.com/users/olamothe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olamothe/subscriptions","organizations_url":"https://api.github.com/users/olamothe/orgs","repos_url":"https://api.github.com/users/olamothe/repos","events_url":"https://api.github.com/users/olamothe/events{/privacy}","received_events_url":"https://api.github.com/users/olamothe/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/coveo/search-ui/pulls/17/commits","review_comments_url":"https://api.github.com/repos/coveo/search-ui/pulls/17/comments","review_comment_url":"https://api.github.com/repos/coveo/search-ui/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coveo/search-ui/issues/17/comments","statuses_url":"https://api.github.com/repos/coveo/search-ui/statuses/685d2880c92baece74b8fc87cf29b9df8f09cfed","head":{"label":"coveo:JSUI-814","ref":"JSUI-814","sha":"685d2880c92baece74b8fc87cf29b9df8f09cfed","user":{"login":"coveo","id":8632328,"avatar_url":"https://avatars.githubusercontent.com/u/8632328?v=3","gravatar_id":"","url":"https://api.github.com/users/coveo","html_url":"https://github.com/coveo","followers_url":"https://api.github.com/users/coveo/followers","following_url":"https://api.github.com/users/coveo/following{/other_user}","gists_url":"https://api.github.com/users/coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveo/subscriptions","organizations_url":"https://api.github.com/users/coveo/orgs","repos_url":"https://api.github.com/users/coveo/repos","events_url":"https://api.github.com/users/coveo/events{/privacy}","received_events_url":"https://api.github.com/users/coveo/received_events","type":"Organization","site_admin":false},"repo":{"id":58133471,"name":"search-ui","full_name":"coveo/search-ui","owner":{"login":"coveo","id":8632328,"avatar_url":"https://avatars.githubusercontent.com/u/8632328?v=3","gravatar_id":"","url":"https://api.github.com/users/coveo","html_url":"https://github.com/coveo","followers_url":"https://api.github.com/users/coveo/followers","following_url":"https://api.github.com/users/coveo/following{/other_user}","gists_url":"https://api.github.com/users/coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveo/subscriptions","organizations_url":"https://api.github.com/users/coveo/orgs","repos_url":"https://api.github.com/users/coveo/repos","events_url":"https://api.github.com/users/coveo/events{/privacy}","received_events_url":"https://api.github.com/users/coveo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coveo/search-ui","description":"Coveo Search UI framework","fork":false,"url":"https://api.github.com/repos/coveo/search-ui","forks_url":"https://api.github.com/repos/coveo/search-ui/forks","keys_url":"https://api.github.com/repos/coveo/search-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coveo/search-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coveo/search-ui/teams","hooks_url":"https://api.github.com/repos/coveo/search-ui/hooks","issue_events_url":"https://api.github.com/repos/coveo/search-ui/issues/events{/number}","events_url":"https://api.github.com/repos/coveo/search-ui/events","assignees_url":"https://api.github.com/repos/coveo/search-ui/assignees{/user}","branches_url":"https://api.github.com/repos/coveo/search-ui/branches{/branch}","tags_url":"https://api.github.com/repos/coveo/search-ui/tags","blobs_url":"https://api.github.com/repos/coveo/search-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coveo/search-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coveo/search-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/coveo/search-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coveo/search-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/coveo/search-ui/languages","stargazers_url":"https://api.github.com/repos/coveo/search-ui/stargazers","contributors_url":"https://api.github.com/repos/coveo/search-ui/contributors","subscribers_url":"https://api.github.com/repos/coveo/search-ui/subscribers","subscription_url":"https://api.github.com/repos/coveo/search-ui/subscription","commits_url":"https://api.github.com/repos/coveo/search-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/coveo/search-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/coveo/search-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/coveo/search-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/coveo/search-ui/contents/{+path}","compare_url":"https://api.github.com/repos/coveo/search-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coveo/search-ui/merges","archive_url":"https://api.github.com/repos/coveo/search-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coveo/search-ui/downloads","issues_url":"https://api.github.com/repos/coveo/search-ui/issues{/number}","pulls_url":"https://api.github.com/repos/coveo/search-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/coveo/search-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/coveo/search-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coveo/search-ui/labels{/name}","releases_url":"https://api.github.com/repos/coveo/search-ui/releases{/id}","deployments_url":"https://api.github.com/repos/coveo/search-ui/deployments","created_at":"2016-05-05T13:41:09Z","updated_at":"2016-06-03T09:45:10Z","pushed_at":"2016-06-03T20:33:46Z","git_url":"git://github.com/coveo/search-ui.git","ssh_url":"git@github.com:coveo/search-ui.git","clone_url":"https://github.com/coveo/search-ui.git","svn_url":"https://github.com/coveo/search-ui","homepage":null,"size":3571,"stargazers_count":6,"watchers_count":6,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2,"mirror_url":null,"open_issues_count":6,"forks":2,"open_issues":6,"watchers":6,"default_branch":"master"}},"base":{"label":"coveo:master","ref":"master","sha":"9e5b534ef882e12683692f33b5c9fe704bd4ff6e","user":{"login":"coveo","id":8632328,"avatar_url":"https://avatars.githubusercontent.com/u/8632328?v=3","gravatar_id":"","url":"https://api.github.com/users/coveo","html_url":"https://github.com/coveo","followers_url":"https://api.github.com/users/coveo/followers","following_url":"https://api.github.com/users/coveo/following{/other_user}","gists_url":"https://api.github.com/users/coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveo/subscriptions","organizations_url":"https://api.github.com/users/coveo/orgs","repos_url":"https://api.github.com/users/coveo/repos","events_url":"https://api.github.com/users/coveo/events{/privacy}","received_events_url":"https://api.github.com/users/coveo/received_events","type":"Organization","site_admin":false},"repo":{"id":58133471,"name":"search-ui","full_name":"coveo/search-ui","owner":{"login":"coveo","id":8632328,"avatar_url":"https://avatars.githubusercontent.com/u/8632328?v=3","gravatar_id":"","url":"https://api.github.com/users/coveo","html_url":"https://github.com/coveo","followers_url":"https://api.github.com/users/coveo/followers","following_url":"https://api.github.com/users/coveo/following{/other_user}","gists_url":"https://api.github.com/users/coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveo/subscriptions","organizations_url":"https://api.github.com/users/coveo/orgs","repos_url":"https://api.github.com/users/coveo/repos","events_url":"https://api.github.com/users/coveo/events{/privacy}","received_events_url":"https://api.github.com/users/coveo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/coveo/search-ui","description":"Coveo Search UI framework","fork":false,"url":"https://api.github.com/repos/coveo/search-ui","forks_url":"https://api.github.com/repos/coveo/search-ui/forks","keys_url":"https://api.github.com/repos/coveo/search-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coveo/search-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coveo/search-ui/teams","hooks_url":"https://api.github.com/repos/coveo/search-ui/hooks","issue_events_url":"https://api.github.com/repos/coveo/search-ui/issues/events{/number}","events_url":"https://api.github.com/repos/coveo/search-ui/events","assignees_url":"https://api.github.com/repos/coveo/search-ui/assignees{/user}","branches_url":"https://api.github.com/repos/coveo/search-ui/branches{/branch}","tags_url":"https://api.github.com/repos/coveo/search-ui/tags","blobs_url":"https://api.github.com/repos/coveo/search-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coveo/search-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coveo/search-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/coveo/search-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coveo/search-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/coveo/search-ui/languages","stargazers_url":"https://api.github.com/repos/coveo/search-ui/stargazers","contributors_url":"https://api.github.com/repos/coveo/search-ui/contributors","subscribers_url":"https://api.github.com/repos/coveo/search-ui/subscribers","subscription_url":"https://api.github.com/repos/coveo/search-ui/subscription","commits_url":"https://api.github.com/repos/coveo/search-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/coveo/search-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/coveo/search-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/coveo/search-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/coveo/search-ui/contents/{+path}","compare_url":"https://api.github.com/repos/coveo/search-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coveo/search-ui/merges","archive_url":"https://api.github.com/repos/coveo/search-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coveo/search-ui/downloads","issues_url":"https://api.github.com/repos/coveo/search-ui/issues{/number}","pulls_url":"https://api.github.com/repos/coveo/search-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/coveo/search-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/coveo/search-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coveo/search-ui/labels{/name}","releases_url":"https://api.github.com/repos/coveo/search-ui/releases{/id}","deployments_url":"https://api.github.com/repos/coveo/search-ui/deployments","created_at":"2016-05-05T13:41:09Z","updated_at":"2016-06-03T09:45:10Z","pushed_at":"2016-06-03T20:33:46Z","git_url":"git://github.com/coveo/search-ui.git","ssh_url":"git@github.com:coveo/search-ui.git","clone_url":"https://github.com/coveo/search-ui.git","svn_url":"https://github.com/coveo/search-ui","homepage":null,"size":3571,"stargazers_count":6,"watchers_count":6,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2,"mirror_url":null,"open_issues_count":6,"forks":2,"open_issues":6,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coveo/search-ui/pulls/17"},"html":{"href":"https://github.com/coveo/search-ui/pull/17"},"issue":{"href":"https://api.github.com/repos/coveo/search-ui/issues/17"},"comments":{"href":"https://api.github.com/repos/coveo/search-ui/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/coveo/search-ui/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/coveo/search-ui/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coveo/search-ui/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/coveo/search-ui/statuses/685d2880c92baece74b8fc87cf29b9df8f09cfed"}}}}
{"actor":{"display_login":"olamothe"}}