{"id":36676034,"url":"https://github.com/kapetacom/sdk-nodejs-rest-client","last_synced_at":"2026-01-12T10:49:12.701Z","repository":{"id":204333851,"uuid":"193269101","full_name":"kapetacom/sdk-nodejs-rest-client","owner":"kapetacom","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-15T13:31:02.000Z","size":200,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-19T10:07:00.543Z","etag":null,"topics":["nodejs-sdk"],"latest_commit_sha":null,"homepage":null,"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/kapetacom.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2019-06-22T18:53:08.000Z","updated_at":"2023-10-29T17:55:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"c8872ef1-8b4b-409f-b011-1f2b8b14746a","html_url":"https://github.com/kapetacom/sdk-nodejs-rest-client","commit_stats":{"total_commits":75,"total_committers":7,"mean_commits":"10.714285714285714","dds":0.6,"last_synced_commit":"3d0fd954d2ab2bcbdf34eb3b6acb2dce7446cdcb"},"previous_names":["kapetacom/sdk-nodejs-rest-client"],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/kapetacom/sdk-nodejs-rest-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapetacom%2Fsdk-nodejs-rest-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapetacom%2Fsdk-nodejs-rest-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapetacom%2Fsdk-nodejs-rest-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapetacom%2Fsdk-nodejs-rest-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kapetacom","download_url":"https://codeload.github.com/kapetacom/sdk-nodejs-rest-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapetacom%2Fsdk-nodejs-rest-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T10:40:25.642Z","status":"ssl_error","status_checked_at":"2026-01-12T10:39:27.820Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["nodejs-sdk"],"created_at":"2026-01-12T10:49:12.626Z","updated_at":"2026-01-12T10:49:12.689Z","avatar_url":"https://github.com/kapetacom.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kapeta NodeJS REST Client\n\nThis provides a REST client for use with Kapeta.\n\nIt wraps the NodeJS `fetch` API and provides a simple interface for making requests within Kapeta.\n\nThe specific REST clients are generated by Kapeta and will extend the RestClient class in this package.\n\n## Usage\n\nThe RestClient class is not meant to be used directly - you should use the generated subclasses.\n\nThey will however all have the same interface which is documented here.\n\n### Making requests\n\nNormally you will make a request by calling the generated method on the client - however you can also make a request directly by calling the `$create` or `$execute` method on the client directly.\n\n`client.$create` will return a Request object which you can then modify before sending it with `request.call()`.\n\n`client.$execute` will send the request immediately.\n\n### Headers\n\nYou can configure headers on 3 levels which you can see below.\n\nIn addition to the withHeader method there are also a few convenience methods for common headers:\n\n-   `withContentType(contentType:string)`: Sets the Content-Type header\n-   `withAuthorization(authorization:string)`: Sets the Authorization header\n-   `withBearerToken(token:string)`: Sets the Authorization header with a Bearer token\n\n#### Per request\n\nSets headers for this request only\n\n```typescript\nconst response = await client.someMethodRequest().withHeader('X-Some-Header', 'some-value').call();\n```\n\n#### Per client\n\nSets headers for all requests made by this client.\n\n**Note** the \"$\" in front of the method name. This is to avoid name collisions with the generated methods.\n\n```typescript\nconst client = new SomeClient().$withHeader('X-Some-Header', 'some-value');\nconst response = await client.someMethod();\n```\n\n#### Globally:\n\nSets headers for all requests made by all clients\n\n```typescript\nRestClient.setDefaultHeader('X-Some-Header', 'some-value');\nconst client = new SomeClient();\nconst response = await client.someMethod();\n```\n\n### Timeouts\n\nTo configure the request timeout you have an option to do so on 3 levels:\n\n#### Per request\n\n```typescript\nconst response = await client\n    .someMethodRequest()\n    .withTimeout(1000) // Set timeout to 1 second\n    .call();\n```\n\n#### Per client\n\n```typescript\nconst client = new SomeClient().$withTimeout(1000); // Set timeout to 1 second\nconst response = await client.someMethod();\n```\n\n#### Globally:\n\n```typescript\nRestClient.setDefaultTimeout(1000); // Set timeout to 1 second\nconst client = new SomeClient();\nconst response = await client.someMethod();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkapetacom%2Fsdk-nodejs-rest-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkapetacom%2Fsdk-nodejs-rest-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkapetacom%2Fsdk-nodejs-rest-client/lists"}