{"id":16426596,"url":"https://github.com/andrebraghini/hunit-js","last_synced_at":"2025-03-23T07:32:48.830Z","repository":{"id":40751642,"uuid":"148496753","full_name":"andrebraghini/hunit-js","owner":"andrebraghini","description":"Communication library for HUnit Channel Manager","archived":false,"fork":false,"pushed_at":"2023-01-06T16:08:58.000Z","size":985,"stargazers_count":3,"open_issues_count":12,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-18T18:52:47.650Z","etag":null,"topics":["channel","hsystem","hunit","manager"],"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/andrebraghini.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":"2018-09-12T14:52:15.000Z","updated_at":"2022-04-09T14:41:46.000Z","dependencies_parsed_at":"2023-02-06T06:17:33.473Z","dependency_job_id":null,"html_url":"https://github.com/andrebraghini/hunit-js","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrebraghini%2Fhunit-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrebraghini%2Fhunit-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrebraghini%2Fhunit-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrebraghini%2Fhunit-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrebraghini","download_url":"https://codeload.github.com/andrebraghini/hunit-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245072234,"owners_count":20556352,"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":["channel","hsystem","hunit","manager"],"created_at":"2024-10-11T08:09:40.843Z","updated_at":"2025-03-23T07:32:48.503Z","avatar_url":"https://github.com/andrebraghini.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./doc/logo-hunit.png\" alt=\"Firebase Triggers\" width=\"305\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\t\n  \u003ca href=\"https://www.linkedin.com/in/andrebraghinis/\"\u003e\n    \u003cimg alt=\"André Braghini\" src=\"https://img.shields.io/badge/-AndreBraghiniS-798D2A?style=flat\u0026logo=Linkedin\u0026logoColor=white\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/hunit-js\"\u003e\n    \u003cimg alt=\"npm version\" src=\"https://img.shields.io/npm/v/hunit-js?color=798D2A\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/andrebraghini/hunit-js/blob/master/LICENSE\"\u003e\n    \u003cimg alt=\"License\" src=\"https://img.shields.io/badge/license-MIT-798D2A\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/andrebraghini/hunit-js\"\u003e\n    \u003cimg src=\"https://codecov.io/gh/andrebraghini/hunit-js/branch/master/graph/badge.svg?token=bF5hxlvggz\"/\u003e\n  \u003c/a\u003e\n  \u003cimg alt=\"Build result\" src=\"https://travis-ci.org/andrebraghini/hunit-js.svg?branch=master\"\u003e\n\n  \u003cbr\u003e\n\n  \u003ci\u003e\n    Communication library for HUnit, HSystem Channel Manager\n  \u003c/i\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"README.md\"\u003eEnglish\u003c/a\u003e\n  ·\n  \u003ca href=\"https://github.com/andrebraghini/hunit-js/blob/master/README.pt.md\"\u003ePortuguese\u003c/a\u003e\n\u003c/p\u003e\n\n\n## Content\n\n1. [Installation](#installation)\n\n2. [Usage](#usage)\n\n\n## Installation\n\n```bash\nnpm install hunit-js --save\n```\n\n## Usage\n\n```ts\nimport { HUnitClient } from 'hunit-js';\n\n// Defines authentication credentials. Hotel id, user and password.\nconst credentials = {\n  hotelId: '20',\n  userName: 'hotel.user',\n  password: 'hotel.password'\n};\n\n// Instantiate the client\nconst hunit = new HUnitClient(credentials);\n\n// Do request\nhunit.portalRead()\n  .then(console.log)\n  .catch(console.error);\n```\n\n### Example list\n\nThe examples below show the most diverse communications being made to a single hotel in a simple way.\n\n```ts\nimport { HUnitClient } from 'hunit-js';\n\nconst hunit = new HUnitClient({ hotelId: '20', userName: 'hotel.user', password: 'hotel.password' });\n\n// Get OTAs list\nhunit.portalRead()\n  .then(portalList =\u003e console.log({ portalList }))\n  .catch(console.error);\n\n// Get new, changed or canceled reservations\nhunit.bookingRead()\n  .then(reservationList =\u003e console.log({ reservationList }))\n  .catch(console.error);\n\n// Get specific reservation by HUnit ID\nhunit.bookingByIdRead({ locatorId: '21565' })\n  .then(reservation =\u003e console.log({ reservation }))\n  .catch(console.error);\n\n// Get specific reservation by Portal ID\nhunit.bookingByIdRead({ portalId: '1', channelReservationId: '155511' })\n  .then(reservation =\u003e console.log({ reservation }))\n  .catch(console.error);\n\n// Confirm receipt of reservation\nconst confirmationList = [\n  { reservationId: '12', pmsReservationIdentifier: 'my_id_1' },\n  { reservationId: '52', pmsReservationIdentifier: 'my_id_2' },\n  { reservationId: '589', pmsReservationIdentifier: 'my_id_5' }\n];\nhunit.confirmePost(confirmationList)\n  .then(confirmeResult =\u003e console.log({ confirmeResult }))\n  .catch(console.error);\n\n// Update inventory\nconst updates = [\n  // Remove availability from apartment 12, from December 25 to December 31\n  // if you do not enter the day of the week in the \"dateRange\" tag, all days will be considered\n  {\n    roomTypeId: '12',\n    availability: 0,\n    dateRange: { from: new Date('2021-12-25'), to: new Date('2021-12-31') }\n  },\n  // Remove availability from apartment 12, during the weekends of January\n  {\n    roomTypeId: '12',\n    availability: 0,\n    dateRange: { from: new Date('2021-01-01'), to: new Date('2021-01-31'), fri: true, sat: true }\n  },\n  // Close availability from apartment 222 sending a sell stop\n  {\n    roomTypeId: '222',\n    dateRange: { from: new Date('2021-12-25'), to: new Date('2021-12-31') },\n    stopSell: true\n  },\n  // Open availability from apartment 15 canceling a sell stop\n  {\n    roomTypeId: '15',\n    dateRange: { from: new Date('2021-12-25'), to: new Date('2021-12-31') },\n    stopSell: false\n  }\n];\nhunit.availabilityUpdate(updates)\n  .then(availabilityUpdateResult =\u003e console.log({ availabilityUpdateResult }))\n  .catch(console.error);\n\n// Get packages list\nhunit.packageRead()\n  .then(packageList =\u003e console.log({ packageList }))\n  .catch(console.error);\n\n// Get room rate list\nhunit.roomRateRead()\n  .then(roomRateList =\u003e console.log({ roomRateList }))\n  .catch(console.error);\n\n// Update occupancy rate\nconst occupancyRateList = [\n  { date: new Date('2020-01-01'), occupancy: 15 },\n  { date: new Date('2020-01-02'), occupancy: 21 },\n  { date: new Date('2020-01-03'), occupancy: 13 }\n];\nhunit.occupancyRateUpdate(occupancyRateList)\n  .then(rateUpdateResult =\u003e console.log({ rateUpdateResult }))\n  .catch(console.error);\n```\n\nThe requests below are made to get reservations and confirm the receipt of several hotels at the same time in a single request.\n\n```ts\nimport { HUnitClient } from 'hunit-js';\n\nconst hunit = new HUnitClient({ userName: 'hotel.user', password: 'hotel.password' });\n\n// Get new, changed or canceled reservations for all hotels\nhunit.bookingReadOneCall()\n  .then(reservationList =\u003e console.log({ reservationList }))\n  .catch(console.error);\n\n// Confirm receipt of reservation for all hotels\nconst confirmationListOneCall = [\n  { hotelId: '65', reservationId: '12', pmsReservationIdentifier: 'my_id_1' },\n  { hotelId: '65', reservationId: '52', pmsReservationIdentifier: 'my_id_2' },\n  { hotelId: '77', reservationId: '98', pmsReservationIdentifier: 'my_id_78' }\n];\nhunit.bookingConfirmationOneCall(confirmationListOneCall)\n  .then(confirmeResult =\u003e console.log({ confirmeResult }))\n  .catch(console.error);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrebraghini%2Fhunit-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrebraghini%2Fhunit-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrebraghini%2Fhunit-js/lists"}