{"id":20319551,"url":"https://github.com/davemurphysf/davemurphy-sdk","last_synced_at":"2026-06-05T04:31:05.733Z","repository":{"id":65346317,"uuid":"584007791","full_name":"davemurphysf/DaveMurphy-SDK","owner":"davemurphysf","description":"An isomorphic JS client for The One API","archived":false,"fork":false,"pushed_at":"2023-01-01T15:45:05.000Z","size":125,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-15T17:49:05.788Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/davemurphysf.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":"2022-12-31T22:07:34.000Z","updated_at":"2022-12-31T22:49:43.000Z","dependencies_parsed_at":"2023-01-31T23:31:28.540Z","dependency_job_id":null,"html_url":"https://github.com/davemurphysf/DaveMurphy-SDK","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/davemurphysf%2FDaveMurphy-SDK","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davemurphysf%2FDaveMurphy-SDK/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davemurphysf%2FDaveMurphy-SDK/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davemurphysf%2FDaveMurphy-SDK/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davemurphysf","download_url":"https://codeload.github.com/davemurphysf/DaveMurphy-SDK/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241820229,"owners_count":20025507,"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-11-14T18:47:20.060Z","updated_at":"2026-06-05T04:31:05.646Z","avatar_url":"https://github.com/davemurphysf.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The Lord of the Rings SDK\n\nAn isomorphic JavaScript client for the Movies endpoint of [The One API](https://the-one-api.dev/)\n\n## Usage\n\n1. Install the SDK\n\n```sh\nyarn add @davemurphysf/liblab\n```\n\nor\n\n```sh\nnpm install @davemurphysf/liblab\n```\n\n2. Create a client instance\n\n```js\nimport { createClient } from '@davemurphysf/liblab';\n\nconst theOneClient = createClient('my-api-key');\n```\n\n3. Call an endpoint\n\n```js\nconst movies = await theOneClient.listMovies();\n```\n\n### Setup Options\n\nAn optional second parameter can be passed to `createClient` in the form of an object with the following keys (values):\n\n-   `shouldThrowOnError` (boolean): Whether the client should throw an exception when an error is returned from the API or whether it should set `ok` to false and populate the `metadata.error` field instead\n-   `fetch` (Fetch): The SDK uses the [`cross-fetch`](https://www.npmjs.com/package/cross-fetch) library to make HTTP requests for both browser and Node environments, but an alternative fetch implementation can be provided as an option (perhaps for Cloudflare Workers).\n\n```js\nimport { createClient } from '@davemurphysf/liblab';\n\nconst theOneClient = createClient('my-api-key', {\n    shouldThrowOnError: false,\n    fetch: fetch, // Using the Fetch API available already in the environment instead of the cross-fetch library\n});\n```\n\n## Client APIs\n\n```ts\nasync listMovies(limit: number = 100, page?: number, offset?: number) : Promise\u003cApiResponse\u003e\n```\n\n### listMovies\n\nParams:\n\n-   `limit` (optional): Maximum number of results to return\n-   `page` (optional): Which page to start returning items\n-   `offset` (optional): The number of results to skip before returning\n\n```ts\nasync getMovie(movieId: string) : Promise\u003cApiResponse\u003e\n```\n\n### getMovie\n\nParams:\n\n-   `movieId`: the id of the specific movie to fetch\n\n```ts\nasync getMovieQuotes(movieId: string, limit: number = 100, page?: number, offset?: number) : Promise\u003cApiResponse\u003e\n```\n\n### getMovieQuotes\n\nParams:\n\n-   `movieId`: the id of the specific movie to fetch\n-   `limit` (optional): Maximum number of results to return\n-   `page` (optional): Which page to start returning items\n-   `offset` (optional): The number of results to skip before returning\n\n## Types\n\n```ts\ntype Movie = {\n    _id: string;\n    name: string;\n    runtimeInMinutes: number;\n    budgetInMillions: number;\n    boxOfficeRevenueInMillions: number;\n    academyAwardNominations: number;\n    academyAwardWins: number;\n    rottenTomatoesScore: number;\n};\n\ntype Quote = {\n    _id: string;\n    dialog: string;\n    movie: string;\n    character: string;\n    id: string;\n};\n\ntype SuccessMetadata = {\n    total: number;\n    limit: number;\n    offset: number;\n    page: number;\n    pages: number;\n};\n\ntype ErrorMetadata = {\n    error: string;\n};\n\ntype SucccessResponse = {\n    ok: true;\n    docs: Array\u003cMovie | Quote\u003e;\n    metadata: SuccessMetadata;\n};\n\ntype ErrorResponse = {\n    ok: false;\n    docs: [];\n    metadata: ErrorMetadata;\n};\n\ntype ApiResponse = SucccessResponse | ErrorResponse;\n```\n\n## Examples\n\nThe SDK includes two sample implementations to aid in starting development (both are written in TypeScript):\n\n-   [Next.js](https://github.com/davemurphysf/DaveMurphy-SDK/tree/main/examples/next-ts)\n-   [Node.js](https://github.com/davemurphysf/DaveMurphy-SDK/tree/main/examples/node-ts)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavemurphysf%2Fdavemurphy-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavemurphysf%2Fdavemurphy-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavemurphysf%2Fdavemurphy-sdk/lists"}