@rimiti/keldoc-js-sdk

2.12.1 • Public • Published

keldoc-js-sdk

Dependencies Coverage Build Status MIT License PRs Welcome

Description

This module provides an Keldoc API implementation.

Install

$ npm install @rimiti/keldoc-js-sdk --save

Features

  • Agendas
  • Appointments
  • Availabilities
  • Available slots
  • Config
  • ConfigWebhooks
  • Motives
  • Patients
  • Specialities

Documentation

Examples

Create your keldoc sdk by requiring it, making it's initial configuration and instantiating it.

From import

import * as sdk from '@rimiti/keldoc-js-sdk'

sdk.configure({
  credentials: {
    clientAccessKeyId: 'CLIENT_ACCESS_KEY_ID',
    secretAccessKeyId: 'SECRET_ACCESS_KEY_ID',
  },
  host: 'http://www.example.com'
});

const keldoc = sdk.create()

From require

const sdk = require('@rimiti/keldoc-js-sdk');

sdk.configure({
  credentials: {
    clientAccessKeyId: 'CLIENT_ACCESS_KEY_ID',
    secretAccessKeyId: 'SECRET_ACCESS_KEY_ID',
  },
  host: 'http://www.example.com',
  routes: {
    agendas: '/agendas.json',
    appointments: '/appointments',
    availabilities: '/availabilities',
    availableSlots: '/available_slots',
    motives: '/motives.json',
    patients: '/patients',
    specialties: '/specialties',
    config: '/config',
    configWebhooks: '/config/webhooks' },
});

const keldoc = sdk.create();

API Methods

Agenda

  • Fetch all agendas.

    Function

    const response = await keldoc.agendas.get();

Appointments

  • Create a new appointment

    Arguments

    start_at                  {Datetime} start date (required).
    agenda_id                 {Integer} Agenda ID (required).
    state                     {String} 'confirmed' or 'canceled' (required).
    duration                  {Integer} duration in seconds.
    no_show                   {Boolean} patient hasn ' t come.
    patient_arrived           {Boolean} patient is waiting in the waiting room.
    no_show_excused           {Boolean} patient hasn ' t come but he excused.
    motive_id                 {Integer} motive id.
    skip_sms_confirmation     {Boolean} disable sms confirmation for consultation.
    skip_email_confirmation   {Boolean} disable email confirmation for consultation.
    skip_sms_reminder         {Boolean} disable sms reminder for consultation.
    skip_email_reminder       {Boolean} disable email reminder for consultation.
    patient_id                {Integer} patient ID.
    patient.first_name        {String} patient firstname.
    patient.last_name         {String} patient lastname.
    patient.maiden_name       {String} patient maiden name.
    patient.gender            {Char} 'm' or 'f'.
    patient.phone             {String} patient phone number.
    patient.phone2            {String} patient alternative phone number.
    patient.email             {String} patient email address.
    patient.street            {String} patient street number & streetnames.
    patient.city              {String} patient city name.
    patient.zipcode           {String} patient city zipcode.
    const response = await keldoc.appointments.create({start_at: '2001-09-23', agenda_id: '2135', state: 'confirmed'});
  • Update an existing appointment

    Arguments

    id                        {Integer} KelDoc internal ID for appointment to update.
    start_at                  {Datetime} start date (required).
    agenda_id                 {Integer} Agenda ID (required).
    state                     {String} 'confirmed' or 'canceled' (required).
    duration                  {Integer} duration in seconds.
    no_show                   {Boolean} patient hasn ' t come.
    patient_arrived           {Boolean} patient is waiting in the waiting room.
    no_show_excused           {Boolean} patient hasn ' t come but he excused.
    motive_id                 {Integer} motive id.
    skip_sms_confirmation     {Boolean} disable sms confirmation for consultation.
    skip_email_confirmation   {Boolean} disable email confirmation for consultation.
    skip_sms_reminder         {Boolean} disable sms reminder for consultation.
    skip_email_reminder       {Boolean} disable email reminder for consultation.
    patient_id                {Integer} patient ID.
    patient.first_name        {String} patient firstname.
    patient.last_name         {String} patient lastname.
    patient.maiden_name       {String} patient maiden name.
    patient.gender            {Char} 'm' or 'f'.
    patient.phone             {String} patient phone number.
    patient.phone2            {String} patient alternative phone number.
    patient.email             {String} patient email address.
    patient.street            {String} patient street number & streetnames.
    patient.city              {String} patient city name.
    patient.zipcode           {String} patient city zipcode.
    const response = await keldoc.appointments.update(21354, {start_at: '2001-09-23', agenda_id: '2135', state: 'confirmed'});
  • Delete an appointment

    Arguments

    id {Integer} KelDoc internal ID for appointment to remove.
    const response = await keldoc.appointments.remove(21321);

Availabilities

  • Fetch available slots for agendas. Maximum duration between start date and end date is 7 days.

    Arguments

    motive_id   {Integer} KelDoc internal ID (required).
    start_date  {Datetime} start date.
    end_date    {Datetime} end date.
    agenda_ids  {Array} IDs of agendas.
    const response = await keldoc.availabilities.get({
      agenda_ids: 112,
      end_date: '2017-09-17',
      start_date: '2017-09-18',
      motive_id: '366',
    });

Available slots

  • Fetch available slots for agendas. Maximum duration between start date and end date is 2 months (default is 2 months from now).
  • When motive_ids is [], it means the available slot is for all motives. Arguments
    agenda_id   {Array} ID of agenda.
    start_date  {Datetime} start date.
    end_date    {Datetime} end date.
    const response = await keldoc.availableSlots.get({
      agenda_id: 112,
      start_date: '2017-09-18',
      end_date: '2017-09-17',
    });

Config

  • Retrieves account configuration : agendas, motives, specialties
    const response = await keldoc.config.get();

Motives

Fetch all motives

    const response = await keldoc.motives.get();

Patients

  • Create a new patient

    Arguments

    first_name  {String} patient firstname.
    last_name   {String} patient lastname.
    maiden_name {String} patient maiden name.
    gender      {Char} 'm' or 'f'.
    phone       {String} patient phone number.
    email       {String} patient email address.
    street      {String} patient street number & streetnames.
    city        {String} patient city name.
    zipcode     {String} patient city zipcode.
    const response = await keldoc.patients.create({
      first_name: 'test',
      last_name: 'john',
      gender: 'm',
      email: 'test.john@test.com'
    });
  • Update an existing patient

    Arguments

    id          {Integer} KelDoc internal ID for patient to update.
    first_name  {String} patient firstname.
    last_name   {String} patient lastname.
    maiden_name {String} patient maiden name.
    gender      {Char} 'm' or 'f'.
    phone       {String} patient phone number.
    email       {String} patient email address.
    street      {String} patient street number & streetnames.
    city        {String} patient city name.
    zipcode     {String} patient city zipcode.
   const response = await keldoc.patients.update(12026, {
      first_name: 'test',
      last_name: 'john',
      gender: 'm',
      email: 'test.john@test.com'
    });

Specialties

  • Fetch all specialties
    const response = await keldoc.specialties.get();

ConfigWebhooks

  • Create account webhook

    Arguments

    url {String} Webhook url.
    const response = await keldoc.configWebhooks.create({url: 'http://test.webhook.com'});
  • Update account webhook

    Arguments

    url {String} Webhook url.
    const response = await keldoc.configWebhooks.update({url: 'http://test.webhook.com'});
  • Delete account webhook

    Arguments

    url {String} Webhook url.
    const response = await keldoc.configWebhooks();

Scripts

Run using npm run <script> command.

clean - remove coverage data, Jest cache and transpiled files,
lint - lint source files and tests,
typecheck - check type annotations,
test - lint, typecheck and run tests with coverage,
test-only - run tests with coverage,
test:watch - interactive watch mode to automatically re-run tests,
build - compile source files,
build:watch - interactive watch mode, compile sources on change.

License

MIT © Dimitri DO BAIRRO

Readme

Keywords

Package Sidebar

Install

npm i @rimiti/keldoc-js-sdk

Weekly Downloads

0

Version

2.12.1

License

MIT

Unpacked Size

114 kB

Total Files

83

Last publish

Collaborators

  • rimiti