{"id":18449547,"url":"https://github.com/jetthoughts/reso_webapi_js","last_synced_at":"2025-04-08T01:33:05.591Z","repository":{"id":57354645,"uuid":"156885369","full_name":"jetthoughts/reso_webapi_js","owner":"jetthoughts","description":null,"archived":false,"fork":false,"pushed_at":"2019-01-11T13:46:14.000Z","size":17,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-04-25T04:21:03.644Z","etag":null,"topics":[],"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/jetthoughts.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}},"created_at":"2018-11-09T16:02:18.000Z","updated_at":"2022-04-02T03:41:26.000Z","dependencies_parsed_at":"2022-09-12T06:01:18.413Z","dependency_job_id":null,"html_url":"https://github.com/jetthoughts/reso_webapi_js","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/jetthoughts%2Freso_webapi_js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jetthoughts%2Freso_webapi_js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jetthoughts%2Freso_webapi_js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jetthoughts%2Freso_webapi_js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jetthoughts","download_url":"https://codeload.github.com/jetthoughts/reso_webapi_js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223298447,"owners_count":17122215,"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-06T07:20:33.655Z","updated_at":"2024-11-06T07:20:34.479Z","avatar_url":"https://github.com/jetthoughts.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# reso_webapi_js\n\nThe RESO Web API JS provides a basic API client that supports the [OData](https://www.odata.org/) protocol as specified by the [RESO standards group](https://www.reso.org/).\n\n## Installing\n\n```bash\n$ yarn add reso_webapi_js\n```\n## Setup\n\nImport a client:\n```javascript\nconst RESOWebApiClient = require('reso_webapi_js');\n```\nInitialize a client:\n```javascript\nconst client = new RESOWebApiClient('http://services.odata.org/V4/OData/OData.svc', auth = {});\n```\n## API\n\nTo get items list of some entity use `get` method:\n```javascript\nclient.get('Products')\n  .then(response =\u003e console.log(response.data.value))\n  .catch(err =\u003e console.log(`Error: ${err.message}`))\n```\nTo find some item by attribute from entity list, use `find_by`:\n```javascript\nclient.find_by('Products', { Name: 'Coffee' })\n  .then(response =\u003e console.log(response.data.value))\n  .catch(err =\u003e console.log(`Error: ${err.message}`))\n```\nOR if you are using `async/await`:\n```javascript\n(async function() {\n  try {\n    const products_response = await client.get('Products');\n    console.log(products_response.data.value);\n    const product_response = await client.find_by('Products', { Name: 'Coffee' });\n    console.log(product_response.data.value);\n  } catch(error) {\n    console.log(`Error: ${error.message}`)\n  }\n})();\n```\n\nTo add new item use `send` method:\n```javascript\nclient.send('Products', { name: 'Example 1' })\n  .then(response =\u003e console.log(response))\n  .catch(err =\u003e console.log(`Error: ${err.message}`))\n```\n\nTo change item data use `edit` method:\n```javascript\nclient.edit('Products', { id: 5, name: 'NewName' })\n  .then(response =\u003e console.log(response))\n  .catch(err =\u003e console.log(`Error: ${err.message}`))\n```\n\nTo delete item use `remove` method:\n```javascript\nclient.remove('Products', { id: 5 })\n  .then(response =\u003e console.log(response))\n  .catch(err =\u003e console.log(`Error: ${err.message}`))\n```\n\n## Basic Authentication\n\nTo secure an oData Web API calls using basic authentication over HTTPS you need to pass the second parameter in your client instance:\n```javascript\n  const client = new RESOWebApiClient(\n    'http://services.odata.org/V4/OData/OData.svc',\n    {\n      username: 'xxxxxxxxxxxxx',\n      password: 'xxxxxxxxxxxxx'\n    }\n  );\n```\n\n## Examples\n\nExamples of the SDK usage are provided in the [example](example/basic.js) folder.\n\nTo run the example:\n```bash\n$ cd example\n$ node basic.js\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on: https://github.com/jetthoughts/reso_webapi_js.\n\nService for testing requests: [https://services.odata.org/V3/(S(fsb41nprwii3l3eo2dhgwecc))/OData/OData.svc/](https://services.odata.org/V3/(S(fsb41nprwii3l3eo2dhgwecc))/OData/OData.svc/).\n\n## Tests\n\nYou can check how we test requests in the `test/specs` folder which contains tests for our library API. In the `test/mocks` folder we hold fake data for testing our requests.\n\nIf you want to add tests for existing API you just need to add **test case/file** in one of the following folders inside `specs`.\n\nBut if you want to add new API you need to create folder with appropriate name, put your test files and add test endpoint inside `test/test.js` file to make tests work.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjetthoughts%2Freso_webapi_js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjetthoughts%2Freso_webapi_js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjetthoughts%2Freso_webapi_js/lists"}