{"id":15593194,"url":"https://github.com/mendahu/rocket-launch-live-client","last_synced_at":"2025-07-19T20:11:17.636Z","repository":{"id":65661083,"uuid":"593409114","full_name":"mendahu/rocket-launch-live-client","owner":"mendahu","description":"A Node.JS library for interacting with the RocketLaunch.Live API","archived":false,"fork":false,"pushed_at":"2024-08-15T15:57:00.000Z","size":221,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-04T16:38:31.105Z","etag":null,"topics":["nodejs","rocket","rockets"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mendahu.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-01-25T23:20:58.000Z","updated_at":"2023-09-19T23:03:14.000Z","dependencies_parsed_at":"2025-04-18T03:54:35.726Z","dependency_job_id":"587927ac-cdc8-4e2c-9a94-e3d4b66d072c","html_url":"https://github.com/mendahu/rocket-launch-live-client","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/mendahu/rocket-launch-live-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mendahu%2Frocket-launch-live-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mendahu%2Frocket-launch-live-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mendahu%2Frocket-launch-live-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mendahu%2Frocket-launch-live-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mendahu","download_url":"https://codeload.github.com/mendahu/rocket-launch-live-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mendahu%2Frocket-launch-live-client/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266004496,"owners_count":23862969,"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":["nodejs","rocket","rockets"],"created_at":"2024-10-03T00:05:19.859Z","updated_at":"2025-07-19T20:11:17.617Z","avatar_url":"https://github.com/mendahu.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rocket-launch-live-client\n\n## Table of Contents\n\n- [Requirements](#reqs)\n- [Simple Usage](#simple)\n- [Client Configuration](#config)\n- [Endpoints](#endpoints)\n  - [Response Types](#types)\n  - [Companies](#companies)\n  - [Launches](#launches)\n  - [Locations](#locations)\n  - [Missions](#missions)\n  - [Pads](#pads)\n  - [Tags](#tags)\n  - [Vehicles](#vehicles)\n- [Watcher](#watcher)\n  - [Methods and Properties](#watcher_props)\n  - [Options](#watcher_options)\n  - [Events](#watcher_events)\n\nThis package is a fully-typed, promise-based, zero-dependency Node.JS JavaScript/TypeScript library for interacting with the [RocketLaunch.Live](https://www.rocketlaunch.live) API.\n\n\u003ca name=\"reqs\"\u003e\u003c/a\u003e\n\n## Requirements\n\nThis package is tested on and supports Node 14.18 or higher. It is fully CommonJS/ESM compatible and has Typescript support built in.\n\n\u003ca name=\"simple\"\u003e\u003c/a\u003e\n\n## Simple usage\n\n```js\n// Import package\nimport { rllc } from \"rocket-launch-live-client\";\n\n// Get API Your Key\nconst RLL_API_KEY = process.env.RLL_API_KEY;\n\n// Create client\nconst client = rllc(RLL_API_KEY);\n\n// Call endpoints\nconst launches = await client.launches();\n```\n\n\u003ca name=\"config\"\u003e\u003c/a\u003e\n\n## Client Configuration\n\nRLL Clients require an API key as the first parameter, and will throw if one is not present.\n\nThe client can be configured with an optional second parameter using the following keys:\n\n```js\nconst options = {\n  // Defaults to false.\n  // API Key is normally passed in the Authorization Bearer header\n  // Set to true to pass your API key as a query parameter instead (not recommended)\n  keyInQueryParams: true,\n};\n\nconst client = rllc(RLL_API_KEY, options);\n```\n\n\u003ca name=\"endpoints\"\u003e\u003c/a\u003e\n\n## Endpoints\n\nAll endpoints return the following response format, where `T` is an array of results:\n\n```ts\ntype RLLResponse\u003cT\u003e = {\n  errors?: string[];\n  valid_auth: boolean;\n  count: number;\n  limit: number;\n  total: number;\n  last_page: number;\n  result: T;\n};\n```\n\nAll endpoints return a maximum of 25 results per page. A `page` argument can be passed to retrieve incremental results.\n\n```js\nconst response = await client.launches({ page: 2 });\n// Also accepts page number as a number-parseable string like \"2\"\n```\n\nFor complete API Documentation on parameters, be sure to visit [RocketLaunch.Live](https://www.rocketlaunch.live/api)\n\n\u003ca name=\"types\"\u003e\u003c/a\u003e\n\n### Response Types\n\nAll entity response types are browseable in the [GitHub Repository](https://github.com/mendahu/rocket-launch-live-client/tree/main/src/types).\n\n\u003ca name=\"companies\"\u003e\u003c/a\u003e\n\n### Companies\n\n```js\nconst response = await client.companies(options);\n```\n\nOptional search parameters:\n\n```js\nconst options = {\n  // Company numeric id\n  // Also accepts number parseable strings like \"1\"\n  id: 1,\n\n  // Company name\n  name: \"SpaceX\",\n\n  // Company country\n  // ISO 3166 Alpha 2 Country Code\n  country_code: \"US\",\n\n  // For defunct companies\n  inactive: true,\n};\n```\n\n\u003ca name=\"launches\"\u003e\u003c/a\u003e\n\n### Launches\n\n```js\nconst response = await client.launches(options);\n```\n\nOptional search parameters:\n\n```js\nconst options = {\n  // Launch numeric id\n  // Also accepts number parseable strings like \"1\"\n  id: 1,\n\n  // COSPAR\n  // Format YYYY-NNN\n  cospar_id: \"2022-123\",\n\n  // Show launches only before this date\n  // JS Date Object - Anything more precise than day is ignored\n  // Also accepts any date string which can be used to create a valid Date object in JavaScript\n  before_date: new Date(\"2023-01-31\"),\n\n  // Show launches only after this date\n  // JS Date Object - Anything more precise than day is ignored\n  // Also accepts any date string which can be used to create a valid Date object in JavaScript\n  after_date: new Date(\"2023-01-31\"),\n\n  // Show launches that have had data updated since this date\n  // Useful for checking for changes since your last API call\n  // JS Date Object\n  // Also accepts any date string which can be used to create a valid Date object in JavaScript\n  modified_since: new Date(\"2023-01-31T06:00:00Z\"),\n\n  // Launch location id\n  // Also accepts number parseable strings like \"1\"\n  location_id: 1,\n\n  // Launch pad id\n  // Also accepts number parseable strings like \"1\"\n  pad_id: 1,\n\n  // Launch provider id\n  // Also accepts number parseable strings like \"1\"\n  provider_id: 1,\n\n  // Launch tag id\n  // Also accepts number parseable strings like \"1\"\n  tag_id: 1,\n\n  // Launch vehicle id\n  // Also accepts number parseable strings like \"1\"\n  vehicle_id: 1,\n\n  // US State\n  // ISO 3166-2 US State Code Abbreviation\n  state_abbr: \"FL\",\n\n  // Country of launch\n  // ISO 3166-1 Alpha 2 Country Code\n  country_code: \"US\",\n\n  // Search string\n  // Also accepts numbers like 2020\n  search: \"Starlink\",\n\n  // Unique launch slug as used on RocketLaunch.live\n  slug: \"ses-20-ses-21\",\n\n  // Limit amount of launches returned\n  // Must be between 1 and 25\n  // Also accepts number parseable strings like \"10\"\n  // Note: this param is safely ignored when using in conjuction with a Watcher (see below)\n  limit: 10,\n\n  // Sort order (by date) of results\n  // Accepts either \"asc\" or \"desc\"\n  // If left unfilled, API defaults to \"asc\"\n  direction: \"asc\",\n};\n```\n\n\u003ca name=\"locations\"\u003e\u003c/a\u003e\n\n### Locations\n\n```js\nconst response = await client.locations(options);\n```\n\nOptional search parameters:\n\n```js\nconst options = {\n  // Location numeric id\n  // Also accepts number parseable strings like \"1\"\n  id: 1,\n\n  // Location name\n  name: \"Cape Canaveral\",\n\n  // Location State (US)\n  // ISO 3166-2 US State Code Abbreviation\n  state_abbr: \"FL\",\n\n  // Location country\n  // ISO 3166 Alpha 2 Country Code\n  country_code: \"US\",\n};\n```\n\n\u003ca name=\"missions\"\u003e\u003c/a\u003e\n\n### Missions\n\n```js\nconst response = await client.missions(options);\n```\n\nOptional search parameters:\n\n```js\nconst options = {\n  // Mission numeric id\n  // Also accepts number parseable strings like \"1\"\n  id: 1,\n\n  // Mission name\n  name: \"Juno\",\n};\n```\n\n\u003ca name=\"pads\"\u003e\u003c/a\u003e\n\n### Pads\n\n```js\nconst response = await client.pads(options);\n```\n\nOptional search parameters:\n\n```js\nconst options = {\n  // Pad numeric id\n  // Also accepts number parseable strings like \"1\"\n  id: 1,\n\n  // Pad name\n  name: \"SpaceX\",\n\n  // Pad State (US)\n  // ISO 3166-2 US State Code Abbreviation\n  state_abbr: \"FL\",\n\n  // Pad country\n  // ISO 3166 Alpha 2 Country Code\n  country_code: \"US\",\n};\n```\n\n\u003ca name=\"tags\"\u003e\u003c/a\u003e\n\n### Tags\n\n```js\nconst response = await client.tags(options);\n```\n\nOptional search parameters:\n\n```js\nconst options = {\n  // Tag numeric id\n  // Also accepts number parseable strings like \"1\"\n  id: 1,\n\n  // Tag text\n  text: \"Crewed\",\n};\n```\n\n\u003ca name=\"vehicles\"\u003e\u003c/a\u003e\n\n### Vehicles\n\n```js\nconst response = await client.vehicles(options);\n```\n\nOptional search parameters:\n\n```js\nconst options = {\n  // Vehicle numeric id\n  // Also accepts number parseable strings like \"1\"\n  id: 1,\n\n  // Vehicle name\n  name: \"Atlas V\",\n};\n```\n\n\u003ca name=\"watcher\"\u003e\u003c/a\u003e\n\n## Watcher\n\nThe `rocket-launch-live-client` has the ability to monitor the `launches` endpoint on a regular basis and return changes as they happen live.\n\n```js\n// Instantiate a new watcher\n// See below for options\nconst watcher = client.watch(5, options);\n\n// Define event handlers\nwatcher.on(\"new\", (newLaunch) =\u003e {\n  // handle new launch\n});\n\n// Start monitoring\nwatcher.start();\n\n// Stop monitoring\nwatcher.stop();\n```\n\n\u003ca name=\"watcher_props\"\u003e\u003c/a\u003e\n\n\u003ca name=\"watcher_options\"\u003e\u003c/a\u003e\n\n### Watcher Options\n\nA new watcher takes up to two arguments:\n\n1. Interval - (optional) (default: 5) - a duration, in minutes, between calls to the API. Adjust this based on the frequency you wish to stay up to date. To avoid needlessly querying the API, this client will now allow any option less than 1 minute.\n2. Query Options - (optional) - The exact same query options that can be submitted to the [`launches`](#launches) endpoint. _NOTE:_ the \"limit\" param is ignored on the `watcher`.\n\nQuery options cannot be altered on a running watcher. In order to change your search conditions, you'll need to stop the watcher and start a new one.\n\n### Watcher Methods and Properties\n\n#### Start\n\nBegin watching the `launches` endpoint using the interval and query options provided during watcher instantiation.\n\n```js\nwatcher.start();\n```\n\n#### End\n\nStop watching the `launches` endpoint.\n\n```js\nwatcher.stop();\n```\n\n#### On\n\nSet an event handler for a Watcher event. Extends the Node Event Emitter `on` method. Takes an event name (see below) and a callback.\n\n```js\nwatcher.on(\"ready\", (launches) =\u003e {\n  // handle event\n});\n```\n\n#### Launches Data\n\nAccess the launches data cache. The data is stored in a [JavaScript Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) and has all the methods associated with Maps.\n\n```js\nwatcher.launches; // Map of all launches in cache\nwatcher.launches.size // Count of launches in cache\nwatcher.launches.get(1) // Get launch with launch_id of 1\nwatcher.launches.forEach((launch, launchId) =\u003e /* Do something to each launch */ )\n```\n\nNote: We recommend not altering the `launches` cache directly (such as by using Map's `set` or `delete` methods). The watcher will notice the discrepancy on the next API call and trigger appropriate `new` or `change` events to set it back. This may not be the behaviour you expect.\n\n\u003ca name=\"watcher_events\"\u003e\u003c/a\u003e\n\n### Watcher Events\n\nWatcher events are triggered when the client recieves a response to a query to `launches` using the `modified_since` parameter. The client will compare the changes to a cached version of the launch and trigger the appropriate event.\n\nIf there are multiple changes on a single API call, the appropriate events will be triggered more than once, so have your callbacks handle a single event.\n\n\u003ca name=\"watcher_events_new\"\u003e\u003c/a\u003e\n\n#### New\n\nA new launch has been added! The Watcher will provide the new launch data as the first argument to your callback.\n\n```js\nwatcher.on(\"new\", (newLaunch) =\u003e {\n  // Handle the new addition here\n});\n```\n\nThe `newLaunch` argument will be an `RLLEntity.Launch` object, the same shape as what is received from the `launches` endpoint (but not wrapped in the standard response).\n\n\u003ca name=\"watcher_events_change\"\u003e\u003c/a\u003e\n\n#### Change\n\nAn existing launch has had information change. The Watcher will provide the old and new versions of the launch object to do your own comparisons.\n\n```js\nwatcher.on(\"change\", (oldLaunch, newLaunch) =\u003e {\n  // Handle changes here\n});\n```\n\nThe `oldLaunch` and `newLaunch` will be the cached version and the new version of an `RLLEntity.Launch` object, the same shape as what is received from the `launches` endpoint (but not wrapped in the standard response).\n\n\u003ca name=\"watcher_events_error\"\u003e\u003c/a\u003e\n\n#### Error\n\nThere was an error on an API call. The error will be passed as the first argument of the callback.\n\n```js\nwatcher.on(\"error\", (err) =\u003e {\n  // Handle error here\n});\n```\n\nThe `err` object will have the following shape, and is accessible via TypeScript as `RLLError`:\n\n```js\nconst err = {\n  error: \"Error title\";\n  statusCode: 404; // HTTP status code or null if no response\n  message: \"Could not find this resource\"; //  Custom error string from RLLC\n  server_response: { } // error passed through from server, can be null if no response\n}\n```\n\n#### Ready\n\nThe watcher has completed its initial API calls and built a cache of launches. The initial cache of launches is passed as the first argument. The client is now monitoring the API.\n\n```js\nwatcher.on(\"ready\", (launches) =\u003e {\n  // Handle ready here\n});\n```\n\n#### Initialization Errors\n\nThe watcher has experienced a problem setting up its initial cache and is has not started monitoring.\n\n```js\nwatcher.on(\"init_error\", (err) =\u003e {\n  // Handle error here\n});\n```\n\nThe `err` object will have the following shape, and is accessible via TypeScript as `RLLError`:\n\n```js\nconst err = {\n  error: \"Error title\";\n  statusCode: 404; // HTTP status code or null if no response\n  message: \"Could not find this resource\"; //  Custom error string from RLLC\n  server_response: { } // error passed through from server, can be null if no response\n}\n```\n\n#### Call\n\nThe watcher also emits a `call` event every time it makes a request, passing in the query parameters it used in the Node URLSearchParams format. Use this to monitor or diagnose how often the API is being queried.\n\n```js\nwatcher.on(\"call\", (params) =\u003e {\n  // Handle call here\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmendahu%2Frocket-launch-live-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmendahu%2Frocket-launch-live-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmendahu%2Frocket-launch-live-client/lists"}