{"id":16293539,"url":"https://github.com/badsyntax/lamernews-api-client","last_synced_at":"2026-04-26T12:31:15.346Z","repository":{"id":57289695,"uuid":"369333069","full_name":"badsyntax/lamernews-api-client","owner":"badsyntax","description":"Lamer News API client","archived":false,"fork":false,"pushed_at":"2021-05-23T09:58:35.000Z","size":42,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-19T23:31:03.716Z","etag":null,"topics":["api-client","lamernews","openapi","swagger","typescript"],"latest_commit_sha":null,"homepage":"","language":null,"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/badsyntax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2021-05-20T20:41:30.000Z","updated_at":"2021-05-23T09:58:37.000Z","dependencies_parsed_at":"2022-09-17T03:23:53.727Z","dependency_job_id":null,"html_url":"https://github.com/badsyntax/lamernews-api-client","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/badsyntax/lamernews-api-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badsyntax%2Flamernews-api-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badsyntax%2Flamernews-api-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badsyntax%2Flamernews-api-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badsyntax%2Flamernews-api-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/badsyntax","download_url":"https://codeload.github.com/badsyntax/lamernews-api-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badsyntax%2Flamernews-api-client/sbom","scorecard":{"id":222979,"data":{"date":"2025-08-11","repo":{"name":"github.com/badsyntax/lamernews-api-client","commit":"a0d3db5d8df28a02241df6bcca12799f36787b16"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/14 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"17 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-cj7v-w2c7-cp7c","Warn: Project is vulnerable to: GHSA-4jpv-8r57-pv7j","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-cph5-m8f7-6c5x","Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx","Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q","Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T03:02:24.166Z","repository_id":57289695,"created_at":"2025-08-17T03:02:24.166Z","updated_at":"2025-08-17T03:02:24.166Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32297893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T09:34:17.070Z","status":"ssl_error","status_checked_at":"2026-04-26T09:34:00.993Z","response_time":129,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["api-client","lamernews","openapi","swagger","typescript"],"created_at":"2024-10-10T20:11:40.847Z","updated_at":"2026-04-26T12:31:15.330Z","avatar_url":"https://github.com/badsyntax.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lamer News API Client\n\n[![npm version](https://badge.fury.io/js/lamernews-api-client.svg)](https://www.npmjs.com/package/lamernews-api-client)\n\nA JavaScript API client for the Lamer News API. This package exports ES modules and includes TypeScript definitions.\n\n**Note this package is still under development.**\n\nSource code is generated from the [OpenAPI spec](./api/lamernews-schema.yml) using the [typescript-fetch](https://openapi-generator.tech/docs/generators/typescript-fetch/) template.\n\n## Getting Started\n\n### Install\n\n```bash\nnpm install lamernews-api-client --save\n```\n\n### Basic Usage\n\n```ts\nimport { Configuration, NewsApi, SortType } from 'lamernews-api-client';\n\nconst apiConfig = new Configuration({\n  basePath: 'https://echojs.com',\n});\n\nconst newsApi = new NewsApi(apiConfig);\n\nnewsApi\n  .getNews({\n    sort: SortType.Top,\n    start: 0,\n    count: 30,\n  })\n  .then((response) =\u003e {\n    console.log(response);\n  });\n```\n\n### Usage with Middleware \u0026 TypeScript\n\n```ts\nimport {\n  AuthApi,\n  CommentsApi,\n  Configuration,\n  ConfigurationParameters,\n  FetchParams,\n  GenericResponse,\n  Middleware,\n  NewsApi,\n  ResponseContext,\n  RequestContext,\n  ResponseStatus,\n} from 'lamernews-api-client';\n\nclass ApiMiddleWare implements Middleware {\n  public async pre(context: RequestContext): Promise\u003cFetchParams | void\u003e {\n    return Promise.resolve(context);\n  }\n\n  public async post(context: ResponseContext): Promise\u003cResponse | void\u003e {\n    // Treat successful responses with response.status === 'err' as errors\n    if (\n      context.response.ok \u0026\u0026\n      context.response.headers\n        .get('content-type')\n        ?.startsWith('application/json')\n    ) {\n      const response = (await context.response\n        .clone()\n        .json()) as GenericResponse;\n      if (response.status === ResponseStatus.Err) {\n        return Promise.reject(context.response);\n      }\n    }\n    return Promise.resolve(context.response);\n  }\n}\n\nconst configParams: ConfigurationParameters = {\n  basePath: 'https://echojs.com',\n  middleware: [new ApiMiddleWare()],\n};\n\nconst apiConfig = new Configuration(configParams);\n\nexport const apiClient = {\n  newsApi: new NewsApi(apiConfig),\n  commentsApi: new CommentsApi(apiConfig),\n  authApi: new AuthApi(apiConfig),\n};\n\nexport type ApiClient = typeof apiClient;\n```\n\n### Authentication\n\nHere's an example of how to authenticate, then upvote a new entry:\n\n```ts\nauthApi\n  .login({\n    username: 'username',\n    password: 'password',\n  })\n  .then((data) =\u003e {\n    const { auth, apisecret } = data;\n    document.cookie =\n      'auth=' + auth + '; expires=Thu, 1 Aug 2030 20:00:00 UTC; path=/';\n    return newsApi.voteNews({\n      newsId: newsId,\n      voteType: VoteType.Up,\n      apisecret: apisecret,\n    });\n  });\n```\n\n### Authentication in React Native\n\nSimilar to the previous example we need to manually set the cookie. This can be achieved by updating the api config.\n\nFirst you need to expose a function to mutate the config:\n\n```ts\nconst configParams = {\n  basePath: 'https://echojs.com/api',\n  middleware: [new ApiMiddleWare()],\n};\n\nconst apiConfig = new Configuration(configParams);\n\nexport const apiClient = {\n  newsApi: new NewsApi(apiConfig),\n  commentsApi: new CommentsApi(apiConfig),\n  authApi: new AuthApi(apiConfig),\n};\n\nexport function updateApiConfig(config: ConfigurationParameters): void {\n  Object.assign(configParams, config);\n}\n```\n\nNow after a successful login, add the auth cookie header to the API config:\n\n```ts\nauthApi\n  .login({\n    username: 'username',\n    password: 'password',\n  })\n  .then((data) =\u003e {\n    const { auth } = data;\n    updateApiConfig({\n      headers: {\n        cookie: `auth=${auth}`,\n      },\n    });\n  });\n```\n\nAll subsequent requests will now include this request header containing the cookie.\n\nReact-Native's `fetch` implementation does not support posting a `URLSearchParam` instance as the body. You need to adjust the request body to stringify the `URLSearchParams`:\n\n```ts\nexport class ApiMiddleWare implements Middleware {\n  public async pre(context: RequestContext): Promise\u003cFetchParams | void\u003e {\n    if (context.init.body instanceof URLSearchParams) {\n      context.init.body = context.init.body.toString();\n    }\n    return Promise.resolve(context);\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadsyntax%2Flamernews-api-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbadsyntax%2Flamernews-api-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadsyntax%2Flamernews-api-client/lists"}