{"id":15445569,"url":"https://github.com/scriptnull/github-issues","last_synced_at":"2025-04-04T18:17:40.241Z","repository":{"id":74061875,"uuid":"48086677","full_name":"scriptnull/github-issues","owner":"scriptnull","description":"Exercise for talking with Github Search API","archived":false,"fork":false,"pushed_at":"2015-12-16T05:41:01.000Z","size":764,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-10T03:26:58.371Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://scriptnull.github.io/github-issues","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scriptnull.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-16T04:09:06.000Z","updated_at":"2015-12-16T04:55:17.000Z","dependencies_parsed_at":"2023-03-15T10:20:51.706Z","dependency_job_id":null,"html_url":"https://github.com/scriptnull/github-issues","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptnull%2Fgithub-issues","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptnull%2Fgithub-issues/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptnull%2Fgithub-issues/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptnull%2Fgithub-issues/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scriptnull","download_url":"https://codeload.github.com/scriptnull/github-issues/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247226191,"owners_count":20904467,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T19:45:20.723Z","updated_at":"2025-04-04T18:17:40.223Z","avatar_url":"https://github.com/scriptnull.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### github-issues\nExercise for talking with Github Search API. The App is hosted on github pages and can be accessed from [here](http://scriptnull.github.io/github-issues) .\n\n### Built with \n- HTML / CSS / JS \n- Jquery - For making Ajax Requests.\n- Bootstrap - For User Interface.\n- Moment.js - For Performing date operations easily.\n\n### Solution \nThe core logic of the app can be found in [js/script.js](https://github.com/scriptnull/github-issues/blob/gh-pages/js/script.js) file. \nTo get the work done , I have split up the logic into few sub tasks.\n\n1. Get input link and validate.\n2. Accessing the Github API.\n3. Show Details on the Web page.\n\n#### ApiClient\nThe script.js file has an object called [`ApiClient`](https://github.com/scriptnull/github-issues/blob/gh-pages/js/script.js#L4) which is a singleton , that will be instantiated only once in the project.\nThis avoids allocating memory for the api client again and again for each requests. \nApiClient exposes [getInstance()](https://github.com/scriptnull/github-issues/blob/gh-pages/js/script.js#L37) method through which the singleton pattern is implemented.\nThe ApiClient instance exposes two methods\n- [queryFormatter](https://github.com/scriptnull/github-issues/blob/gh-pages/js/script.js#L14) - Converts JSON to Github API style query strings. This can be declared private , but I expose it publicly as it can be used to debug things. \n- [getIssues](https://github.com/scriptnull/github-issues/blob/gh-pages/js/script.js#L28) - Does GET request to Github API and returns  a Promise object for handling success and error.\n\n#### Request Builder \n- [getRequests](https://github.com/scriptnull/github-issues/blob/gh-pages/js/script.js#L56) - a function that returns list of query objects to send with HTTPS request.\n\nEach object looks something like this \n```javascipt\n{\n  query : {\n    repo : repo ,\n    state : 'open' ,\n    is : 'issue'\n  } ,\n  description : 'Total number of open issues' ,\n  viewId : 'tr1'\n}\n```\n- query - this will be translated using queryFormatter function in ApiClient.\n- Description and viewId for rendering the result with description in the DOM element with the ID specified in viewId.\n\n#### Possible Improvements \nI think the ApiClient's implementation is clean. However, I would like to have React.js to render things on the web page after getting results from the API. It will make the code more readable and a smooth interface for loading things can be implemented. But , for the inital stages , I didn't want to increase the dependency count by adding react and babel. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscriptnull%2Fgithub-issues","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscriptnull%2Fgithub-issues","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscriptnull%2Fgithub-issues/lists"}