{"id":21829437,"url":"https://github.com/paulchiu/tradegecko-headless","last_synced_at":"2025-10-03T23:44:11.869Z","repository":{"id":57378763,"uuid":"124134070","full_name":"paulchiu/tradegecko-headless","owner":"paulchiu","description":"Headless TradeGecko interaction CLI for those without API access","archived":false,"fork":false,"pushed_at":"2018-07-08T07:14:02.000Z","size":24,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-04T21:52:30.293Z","etag":null,"topics":["cli","tradegecko","tradegecko-headless"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paulchiu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-06T20:25:09.000Z","updated_at":"2019-08-09T00:49:24.000Z","dependencies_parsed_at":"2022-09-02T21:20:46.649Z","dependency_job_id":null,"html_url":"https://github.com/paulchiu/tradegecko-headless","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/paulchiu/tradegecko-headless","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulchiu%2Ftradegecko-headless","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulchiu%2Ftradegecko-headless/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulchiu%2Ftradegecko-headless/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulchiu%2Ftradegecko-headless/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paulchiu","download_url":"https://codeload.github.com/paulchiu/tradegecko-headless/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paulchiu%2Ftradegecko-headless/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264781019,"owners_count":23662770,"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":["cli","tradegecko","tradegecko-headless"],"created_at":"2024-11-27T18:27:18.887Z","updated_at":"2025-10-03T23:44:06.826Z","avatar_url":"https://github.com/paulchiu.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TradeGecko Headless CLI\n\nHeadless [TradeGecko](https://www.tradegecko.com/) interaction CLI for those without API access or for automating calls not yet published in the [TradeGecko API Reference](http://developer.tradegecko.com/).\n\n# Install\n\n```\nnpm install --global tradegecko-headless\n```\n\nIf you receive the error [ERROR: Failed to download Chromium](https://github.com/GoogleChrome/puppeteer/issues/375),\nplease see the [NPM article on preventing premission errors](https://docs.npmjs.com/getting-started/fixing-npm-permissions).\n\nGiven that a Chrome headless instance will need to be launched, it is advised that a local install\nbe used if permission issues exist.\n\n# Usage\n\nThe following usage examples should be read sequentially as it references results from previous commands.\n\nIt is also recommended that all result files be viewed or manipulated with [jq](https://stedolan.github.io/jq/).\n\n## Command pattern\n\nTo use the CLI, identify the command you want to execute and provide any parameters and options.\n\n```\ntgcli [command] [options]\n```\n\nTo see the full list of commands, execute\n\n```\ntgcli --help\n```\n\n## Set username and password\n\nUsername and password can be provided as environment variables or as parameters. It is\nrecommended that environment variables be used.\n\n```\nexport TG_USERNAME=\"foo@example.com\"\nexport TG_PASSWORD=\"bar\"\n```\n\n## Download a list of resources\n\nDownload 2nd and 3rd oldest `variants` resource, keeping only fields `id` and `created_at` and save them to file `variants.json`\n\n```\ntgcli tg:resource-list:download variants variants.json --limit=2 --offset=1 --fields=id,created_at\n```\n\n### Sample output\n\n```\nSigning in ...\nGetting variants count ...\nGetting variants ...\n ████████████████████████████████████████ 100% | ETA: 0s | 2/2\nSaving variants to file ...\nDone\n```\n\n### Sample output file contents\n\n```\n[{\"id\":1,\"created_at\":\"2017-01-11T11:00:00.000Z\"},{\"id\":2,\"created_at\":\"2017-01-11T12:00:00.000Z\"}]\n```\n\n## Perform fetch actions on a JSON object list\n\nMake a fetch call using `variants.json` and output results to `fetched-variants.json`. The fetch\ncall should make a GET call to get the variant by id.\n\n```\ntgcli tg:resource-list:fetch variants.json fetched-variants.json GET \"variants/{{id}}\"\n```\n\n### Sample output\n\n```\nSigning in ...\nPerforming fetches ...\n ████████████████████████████████████████ 100% | ETA: 0s | 2/2\nSaving responses to file ...\nDone\n```\n\n### Sample output file contents\n\nPlese note the following outputs have been shortended for readability.\n\n```\n[{\"variant\":{\"id\":1,\"created_at\":\"2017-01-11T11:00:00.000Z\",\"updated_at\":\"...\",\"committed_stock_levels\":{}}},{\"variant\":{\"id\":2,\"created_at\":\"2017-01-11T12:00:00.000Z\",\"updated_at\":\"...\",\"committed_stock_levels\":{}}}]\n```\n\n# Commands\n\nFor a full list of commands, execute the program with `--help`. All commands should be prefixed with `tgcli`.\n\n|Command|Description|\n|-------|-----------|\n|`tg:resource-list:download [resource] [file]`|Download a list of a given resource|\n|`tg:resource-list:fetch [listFile] [responsesFile] [method] [endpoint]`|Perform fetch action on each record of a provided resource list JSON file|\n|`tg:resource:count [resource]`|Get the total records of a given resource|\n|`tg:ajax:fetch [method] [endpoint]`|Perform a fetch call against the TradeGecko AJAX API, see the [MDN entry for Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) for details|\n# Known TradeGecko resources\n\nThe following list of resources were obtained by observing Chrome debugger XHR activity for connections related to `https://go.tradegecko.com/ajax`\n\n- channels\n- products\n- variants\n\nAlthough not fully tested, most resources listed in the [TradeGecko API Reference](http://developer.tradegecko.com/) should be available as well.\n\n# Built with\n\n- [Puppeteer](https://github.com/GoogleChrome/puppeteer) for headless Chrome interaction\n- [yargs](https://github.com/yargs/yargs) for CLI\n- [cli-progress](https://www.npmjs.com/package/cli-progress) for progress bars\n- [mustache](https://www.npmjs.com/package/mustache) for parameter templates","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulchiu%2Ftradegecko-headless","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaulchiu%2Ftradegecko-headless","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaulchiu%2Ftradegecko-headless/lists"}